Struct zenoh_protocol::proto::Frame[][src]

pub struct Frame {
    pub ch: Channel,
    pub sn: ZInt,
    pub payload: FramePayload,
}

Frame message

NOTE: 16 bits (2 bytes) may be prepended to the serialized message indicating the total length
      in bytes of the message, resulting in the maximum length of a message being 65_535 bytes.
      This is necessary in those stream-oriented transports (e.g., TCP) that do not preserve
      the boundary of the serialized messages. The length is encoded as little-endian.
      In any case, the length of a message must not exceed 65_535 bytes.

 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+
|E|F|R|  FRAME  |
+-+-+-+-+-------+
~      SN       ~
+---------------+
~  FramePayload ~ -- if F==1 then the payload is a fragment of a single Zenoh Message, a list of complete Zenoh Messages otherwise.
+---------------+

- if R==1 then the FRAME is sent on the reliable channel, best-effort otherwise.
- if F==1 then the FRAME is a fragment.
- if E==1 then the FRAME is the last fragment. E==1 is valid iff F==1.

NOTE: Only one bit would be sufficient to signal fragmentation in a IP-like fashion as follows:
        - if F==1 then this FRAME is a fragment and more fragment will follow;
        - if F==0 then the message is the last fragment if SN-1 had F==1,
          otherwise it's a non-fragmented message.
      However, this would require to always perform a two-steps de-serialization: first
      de-serialize the FRAME and then the Payload. This is due to the fact the F==0 is ambigous
      w.r.t. detecting if the FRAME is a fragment or not before SN re-ordering has occured.
      By using the F bit to only signal whether the FRAME is fragmented or not, it allows to
      de-serialize the payload in one single pass when F==0 since no re-ordering needs to take
      place at this stage. Then, the F bit is used to detect the last fragment during re-ordering.

Fields

ch: Channelsn: ZIntpayload: FramePayload

Trait Implementations

impl Clone for Frame[src]

impl Debug for Frame[src]

impl PartialEq<Frame> for Frame[src]

impl StructuralPartialEq for Frame[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,