pub trait SendFrame {
    fn send_frame(&mut self, frame: &[u8]) -> Result<usize, Error>;
    fn send_raw(&mut self, raw_frame: &[u8]) -> Result<usize, Error>;

    fn send_routed(
        &mut self,
        _source: &[u8],
        _route: &[u8],
        _address: &[u8],
        _data: &[u8]
    ) -> Result<usize, Error> { ... } }
Expand description

Frame sending type which is able to compose frame with a given raw data and send it via an underlying overlaid protocol such as ZMQ, HTTP, Websocket.

Required Methods

Sends a single frame of data structured as a byte string. The frame must already contain LNP framing prefix with size data. The function must check that the provided data frame length is below the limit defined with MAX_FRAME_SIZE constant if a tcp connection is used.

Returns

In case of success, number of bytes send (NB: this is larger than the message payload size and is equal to the size of the provided frame argument)

Errors

Sends a single frame of data structured as a byte string. The frame must already contain LNP framing prefix with size data.

NB: Unlike SendFrame::send_frame, this function does not check that the provided data frame length is below the limit defined with MAX_FRAME_SIZE constant.

Returns

In case of success, number of bytes send (NB: this is larger than the message payload size and is equal to the size of the provided raw_frame argument)

Errors

Provided Methods

Sends a single frame of data structured as a byte string to a specific receiver with remote_id. Function works like RecvFrame::recv_frame and is used for the underlying protocols supporting multipeer connectivity. The frame must already contain LNP framing prefix with size data.

Returns

In case of success, number of bytes send (NB: this is larger than the message payload size and is equal to the size of the provided frame argument)

Errors
Panics

Default implementation panics, since the most of framing protocols do not support multipeer sockets and SendFrame::send_frame must be used instead (currently only ZMQ-based connections support this operation)

Implementations on Foreign Types

Implementors