pub struct TcpHeader { /* private fields */ }Implementations§
Source§impl TcpHeader
impl TcpHeader
pub fn get_src_port(&self) -> &u16
pub fn get_dst_port(&self) -> &u16
pub fn get_flags(&self) -> &u8
pub fn get_window(&self) -> &u16
pub fn get_pseudo_header_set(&self) -> &bool
Source§impl TcpHeader
impl TcpHeader
pub fn set_src_port(&mut self, v: u16)
pub fn set_dst_port(&mut self, v: u16)
pub fn set_flags(&mut self, v: u8)
pub fn set_window(&mut self, v: u16)
Trait Implementations§
Source§impl Header for TcpHeader
impl Header for TcpHeader
Source§fn make(self) -> PacketData
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. Read moreSource§fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
fn parse(raw_data: &[u8]) -> Result<Box<Self>, ParseError>
parse() should never be run from a box, is hould only ever br un as ::parse().
this is just here to complete the implementation of Header onto boxed structs that implement header
fn get_proto(&self) -> Protocol
Source§fn get_length(&self) -> u8
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
Source§fn get_min_length() -> u8
fn get_min_length() -> u8
get the minimum length (in bytes) that this type of header can be
Source§fn into_transport_header(&mut self) -> Option<&mut dyn TransportHeader>
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 TcpHeaderSource§impl TransportHeader for TcpHeader
impl TransportHeader for TcpHeader
Source§fn set_pseudo_header(&mut self, src_ip: [u8; 4], dst_ip: [u8; 4], data_len: u16)
fn set_pseudo_header(&mut self, src_ip: [u8; 4], dst_ip: [u8; 4], data_len: u16)
Sets the values of an internal value which represents the pseudo header that is used when calculating the checksum.
This method must be called before the
make method, which is called when the header is added to the Packet with the add_header method.
If the IP header is already present in the Packet when this one is added, then this method will be called in the add_header method, using the data from the IP header. Read moreAuto Trait Implementations§
impl Freeze for TcpHeader
impl RefUnwindSafe for TcpHeader
impl Send for TcpHeader
impl Sync for TcpHeader
impl Unpin for TcpHeader
impl UnsafeUnpin for TcpHeader
impl UnwindSafe for TcpHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more