[−][src]Trait comms_service::LinkPacket
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>>
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
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
Implementors
impl LinkPacket for SpacePacket
[src]
fn build(
command_id: u64,
payload_type: PayloadType,
destination_port: u16,
payload: &[u8]
) -> CommsResult<Box<Self>>
[src]
command_id: u64,
payload_type: PayloadType,
destination_port: u16,
payload: &[u8]
) -> CommsResult<Box<Self>>