Skip to main content

parse_packet

Function parse_packet 

Source
pub fn parse_packet(data: &[u8]) -> Option<ParsedPacket>
Expand description

Decode a packet.

Returns None only when the buffer is shorter than PACKET_SIZE or when the magic prefix does not match — those are the conditions that mean “this is not an Enpose packet at all”.

A packet with an unrecognised ParsedPacket::pkt_type or a ParsedPacket::version different from PROTOCOL_VERSION is returned to the caller unmodified; rejection policy is the caller’s choice.