[−][src]Trait packet_crafter::headers::Header
Required methods
fn make(self) -> PacketData
'cook' the header, returning it as a Vec<u8>
.
this function will calculate checksums, even though they will be over-written by the OS if the packet is sent 'down the wire', likewise with a lot of length
fields and such.
The reason i decided to still calculate checksums is incase someone uses the packet for some other purpose, or if they are building/using an experimntal OS which doesn calculate checksums (or they havent built that in yet).
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
parse() should never be run from a box
fn get_proto(&self) -> Protocol
fn get_length(&self) -> u8
get the current length of the header in bytes. this usually just returns a fixed value as most headers dont have variable length, only really IP does and even then its rare for it to be > 20 bytes
fn get_min_length() -> u8
get the minimum length (in bytes) that this type of header can be
Provided methods
fn into_transport_header(&mut self) -> Option<&mut dyn TransportHeader>
attempts to coerce the header (a type which implements the Header trait) into a &mut dyn TransportHeader.
Only returns Option::Some
when the underlying concrete type is a UdpHeader
or a TcpHeader
Implementations on Foreign Types
impl<T: Header> Header for Box<T>
[src]
fn make(self) -> PacketData
[src]
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
[src]
fn get_proto(&self) -> Protocol
[src]
fn get_length(&self) -> u8
[src]
fn get_min_length() -> u8
[src]
fn into_transport_header(&mut self) -> Option<&mut dyn TransportHeader>
[src]
Implementors
impl Header for ArpHeader
[src]
fn make(self) -> PacketData
[src]
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
[src]
fn get_proto(&self) -> Protocol
[src]
fn get_length(&self) -> u8
[src]
fn get_min_length() -> u8
[src]
impl Header for EthernetHeader
[src]
fn make(self) -> PacketData
[src]
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
[src]
fn get_proto(&self) -> Protocol
[src]
fn get_length(&self) -> u8
[src]
fn get_min_length() -> u8
[src]
impl Header for IcmpHeader
[src]
fn make(self) -> PacketData
[src]
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
[src]
fn get_proto(&self) -> Protocol
[src]
fn get_length(&self) -> u8
[src]
fn get_min_length() -> u8
[src]
impl Header for IpHeader
[src]
fn make(self) -> PacketData
[src]
needs testing on a big endian machine