pub trait LinkPacket {
    fn parse(raw: &[u8]) -> CommsResult<Box<Self>>;
    fn build(
        command_id: u64,
        link_type: PayloadType,
        destination_port: u16,
        payload: &[u8]
    ) -> CommsResult<Box<Self>>; fn to_bytes(&self) -> CommsResult<Vec<u8>>; fn command_id(&self) -> u64; fn payload(&self) -> Vec<u8>; fn payload_type(&self) -> PayloadType; fn destination(&self) -> u16; fn validate(&self) -> bool { ... } fn max_size() -> usize { ... } }
Expand description

Generic LinkPacket trait which defines the internal packet requirements of the communications service.

Required Methods

Parse packet from raw bytes

Build packet from necessary parts

Create a bytes representation of the packet

The Command ID of the packet

The payload or data of the packet

The type of payload contained in the packet

The Destination port of the packet

Provided Methods

Validate the contents of the link packet

The maximum allowed size of the packet We are still assuming that at some point these packets will be sent over IP/UDP

Implementors