frames - SkycoinWikis/dmsg GitHub Wiki

dmsg HOME » SOFTWARE » DMSG » FRAMES

Frames

Frames are sent and received within a dmsg connection after the noise handshake. A frame has two sections; the header and the payload. Here are the fields of a frame:

|| FrameType | TransportID | PayloadSize || Payload ||
|| 1 byte    | 2 bytes     | 2 bytes     || ~ bytes ||
  • The FrameType specifies the frame type via the one byte.
  • The TransportID contains an encoded uint16 which represents a identifier for a transport. A set of IDs are unique for a given dmsg connection.
  • The PayloadSize contains an encoded uint16 which represents the size (in bytes) of the payload.
  • The Payload have a size that is obtainable via PayloadSize.

The following is a summary of the frame types:

FrameType Name Payload Contents Payload Size
0x1 REQUEST initiating client's public key + responding client's public key 66
0x2 ACCEPT initiating client's public key + responding client's public key 66
0x3 CLOSE 1 byte that represents the reason for closing 1
0xa FWD uint16 sequence + transport payload >2
0xb ACK uint16 sequence 2