pub struct InternetPacket { /* private fields */ }Implementations§
source§impl InternetPacket
impl InternetPacket
A simple representation of TCP/UDP over IPv4/IPv6 packets.
pub fn src_ip(&self) -> IpAddr
pub fn dst_ip(&self) -> IpAddr
pub fn set_src_ip(&mut self, addr: IpAddr)
pub fn set_dst_ip(&mut self, addr: IpAddr)
pub fn src_port(&self) -> u16
pub fn dst_port(&self) -> u16
pub fn set_src_port(&mut self, port: u16)
pub fn set_dst_port(&mut self, port: u16)
pub fn src(&self) -> SocketAddr
pub fn dst(&self) -> SocketAddr
pub fn set_src(&mut self, src: &SocketAddr)
pub fn set_dst(&mut self, dst: &SocketAddr)
pub fn connection_id(&self) -> ConnectionId
pub fn inner(self) -> Vec<u8>
pub fn hop_limit(&self) -> u8
pub fn set_hop_limit(&mut self, hop_limit: u8)
pub fn tcp_sequence_number(&self) -> u32
sourcepub fn set_tcp_sequence_number(&mut self, seq: u32)
pub fn set_tcp_sequence_number(&mut self, seq: u32)
This method is a no-op if this is not a TCP packet.
pub fn tcp_acknowledgement_number(&self) -> u32
sourcepub fn set_tcp_acknowledgement_number(&mut self, ack: u32)
pub fn set_tcp_acknowledgement_number(&mut self, ack: u32)
This method is a no-op if this is not a TCP packet.
pub fn tcp_flags(&self) -> u8
sourcepub fn set_tcp_flags(&mut self, flags: u8)
pub fn set_tcp_flags(&mut self, flags: u8)
This method is a no-op if this is not a TCP packet.
pub fn tcp_syn(&self) -> bool
pub fn tcp_ack(&self) -> bool
pub fn tcp_flag_str(&self) -> String
pub fn protocol(&self) -> TransportProtocol
pub fn payload(&self) -> &[u8] ⓘ
pub fn recalculate_ip_checksum(&mut self)
Available on crate feature
internet-checksum only.pub fn recalculate_tcp_checksum(&mut self)
Available on crate feature
internet-checksum only.pub fn recalculate_udp_checksum(&mut self)
Available on crate feature
internet-checksum only.Trait Implementations§
source§impl Clone for InternetPacket
impl Clone for InternetPacket
source§fn clone(&self) -> InternetPacket
fn clone(&self) -> InternetPacket
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for InternetPacket
impl Debug for InternetPacket
source§impl PartialEq for InternetPacket
impl PartialEq for InternetPacket
impl StructuralPartialEq for InternetPacket
Auto Trait Implementations§
impl Freeze for InternetPacket
impl RefUnwindSafe for InternetPacket
impl Send for InternetPacket
impl Sync for InternetPacket
impl Unpin for InternetPacket
impl UnwindSafe for InternetPacket
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)