nvflare.fuel.f3.sfm.prefix module

class Prefix(length: int = 0, header_len: int = 0, type: int = 0, reserved: int = 0, flags: int = 0, app_id: int = 0, stream_id: int = 0, sequence: int = 0)[source]

Bases: object

Prefix is the 16-byte fixed header for the SFM frame, every frame must have this prefix. Beside all the other attributes, it provides framing for the message. Framing is needed if the frame is sent over byte streams like TCP or sockets.

The 8 fields in the prefix are all integers encoded in big-endian,

  1. length(4): Total length of the frame.

  2. header_len(2): Length of the encoded headers

  3. type(1): Frame type (DATA, HELLO etc)

  4. reserved(1): Not used, 0

  5. flags(2): Attribute of the frame (OOB, ACK etc).

  6. app_id(2): Application ID to support multiple apps

  7. stream_id(2): Stream ID to connect all fragments of a stream

  8. sequence(2): A sequence number for each frame. Used to detect lost frames.

app_id: int = 0
flags: int = 0
static from_bytes(buffer: bytes) Prefix[source]
header_len: int = 0
length: int = 0
reserved: int = 0
sequence: int = 0
stream_id: int = 0
to_buffer(buffer: bytes | bytearray | memoryview | list, offset: int)[source]
type: int = 0