[][src]Trait comms_service::LinkPacket

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 { ... } }

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

Required methods

fn parse(raw: &[u8]) -> CommsResult<Box<Self>>

Parse packet from raw bytes

fn build(
    command_id: u64,
    link_type: PayloadType,
    destination_port: u16,
    payload: &[u8]
) -> CommsResult<Box<Self>>

Build packet from necessary parts

fn to_bytes(&self) -> CommsResult<Vec<u8>>

Create a bytes representation of the packet

fn command_id(&self) -> u64

The Command ID of the packet

fn payload(&self) -> Vec<u8>

The payload or data of the packet

fn payload_type(&self) -> PayloadType

The type of payload contained in the packet

fn destination(&self) -> u16

The Destination port of the packet

Loading content...

Provided methods

fn validate(&self) -> bool

Validate the contents of the link packet

fn max_size() -> usize

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

Loading content...

Implementors

impl LinkPacket for SpacePacket[src]

fn validate(&self) -> bool[src]

fn max_size() -> usize[src]

Loading content...