pub struct TcpPacket<'a> { /* private fields */ }Expand description
Zero-copy TCP packet parser.
Implementations§
Source§impl<'a> TcpPacket<'a>
impl<'a> TcpPacket<'a>
pub fn new(buf: &'a [u8]) -> Option<Self>
pub fn source_port(&self) -> u16
pub fn destination_port(&self) -> u16
pub fn sequence(&self) -> u32
pub fn ack_number(&self) -> u32
pub fn data_offset(&self) -> u8
pub fn flags(&self) -> u8
pub fn fin(&self) -> bool
pub fn syn(&self) -> bool
pub fn rst(&self) -> bool
pub fn psh(&self) -> bool
pub fn ack(&self) -> bool
pub fn urg(&self) -> bool
pub fn window(&self) -> u16
pub fn checksum(&self) -> u16
pub fn urgent_pointer(&self) -> u16
Sourcepub fn options(&self) -> TcpOptionsIter<'a> ⓘ
pub fn options(&self) -> TcpOptionsIter<'a> ⓘ
TCP options (if data_offset > 5).
pub fn header_length(&self) -> usize
Sourcepub fn verify_checksum(&self, src: Ipv4Addr, dst: Ipv4Addr) -> bool
pub fn verify_checksum(&self, src: Ipv4Addr, dst: Ipv4Addr) -> bool
Verify the TCP checksum (includes IPv4 pseudo-header).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TcpPacket<'a>
impl<'a> RefUnwindSafe for TcpPacket<'a>
impl<'a> Send for TcpPacket<'a>
impl<'a> Sync for TcpPacket<'a>
impl<'a> Unpin for TcpPacket<'a>
impl<'a> UnsafeUnpin for TcpPacket<'a>
impl<'a> UnwindSafe for TcpPacket<'a>
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