Documentation ¶
Index ¶
Constants ¶
View Source
const ( MessageTypeHeader message.Type = 0 // The amount of bytes dedicated for the message type in the packet header. HeaderTypeBytesLength = 1 // The amount of bytes dedicated for the message length denotation in the packet header. HeaderLengthByteLength = 2 // The amount of bytes making up the protocol TLV packet header. HeaderBytesLength = HeaderLengthByteLength + HeaderTypeBytesLength )
Variables ¶
View Source
var ( // ErrInvalidMessageLength is returned when a packet advertises a message length which // is invalid for the given message type. ErrInvalidMessageLength = errors.New("invalid message length") )
View Source
var ( // The message header sent in each message denoting the TLV fields. HeaderMessageDefinition = &message.Definition{ ID: MessageTypeHeader, MaxBytesLength: HeaderBytesLength, VariableLength: false, } )
Functions ¶
Types ¶
type Header ¶
type Header struct { // The definition of the message. Definition *message.Definition // The length in bytes of the message. MessageBytesLength uint16 }
Header includes the definition of the message and its bytes length.
func ParseHeader ¶
ParseHeader parses the given buffer to a Header.
Click to show internal directories.
Click to hide internal directories.