[−][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]
impl LinkPacket for SpacePacket
fn build(
command_id: u64,
payload_type: PayloadType,
destination_port: u16,
payload: &[u8]
) -> CommsResult<Box<Self>>
[src]
fn build(
command_id: u64,
payload_type: PayloadType,
destination_port: u16,
payload: &[u8]
) -> CommsResult<Box<Self>>
fn parse(raw: &[u8]) -> CommsResult<Box<Self>>
[src]
fn parse(raw: &[u8]) -> CommsResult<Box<Self>>
fn to_bytes(&self) -> CommsResult<Vec<u8>>
[src]
fn to_bytes(&self) -> CommsResult<Vec<u8>>
fn command_id(&self) -> u64
[src]
fn command_id(&self) -> u64
fn payload(&self) -> Vec<u8>
[src]
fn payload(&self) -> Vec<u8>
fn payload_type(&self) -> PayloadType
[src]
fn payload_type(&self) -> PayloadType
fn destination(&self) -> u16
[src]
fn destination(&self) -> u16
fn validate(&self) -> bool
[src]
fn validate(&self) -> bool
fn max_size() -> usize
[src]
fn max_size() -> usize