[−][src]Struct packet::tcp::Packet
TCP packet parser.
Implementations
impl<B: AsRef<[u8]>> Packet<B>
[src]
pub fn unchecked(buffer: B) -> Packet<B>
[src]
Create a TCP packet without checking the buffer.
pub fn new(buffer: B) -> Result<Packet<B>>
[src]
Parse a TCP packet, checking the buffer contents are correct.
impl<B: AsRef<[u8]>> Packet<B>
[src]
pub fn to_owned(&self) -> Packet<Vec<u8>>
[src]
Convert the packet to its owned version.
Notes
It would be nice if ToOwned
could be implemented, but Packet
already
implements Clone
and the impl would conflict.
impl<B: AsRef<[u8]>> Packet<B>
[src]
pub fn source(&self) -> u16
[src]
Source port.
pub fn destination(&self) -> u16
[src]
Destination port.
pub fn sequence(&self) -> u32
[src]
Packet sequence.
pub fn acknowledgment(&self) -> u32
[src]
Optional acknowledgment.
pub fn offset(&self) -> u8
[src]
Data offset.
pub fn flags(&self) -> Flags
[src]
Packet flags.
pub fn window(&self) -> u16
[src]
Packet window.
pub fn checksum(&self) -> u16
[src]
Packet checksum.
pub fn is_valid<I: AsRef<[u8]>>(&self, ip: &Packet<I>) -> bool
[src]
Verify the packet is valid by calculating the checksum.
pub fn pointer(&self) -> u16
[src]
Urgent pointer.
pub fn options(&self) -> OptionIter<'_>
[src]
TCP options for the packet.
impl<B: AsRef<[u8]> + AsMut<[u8]>> Packet<B>
[src]
pub fn set_source(&mut self, value: u16) -> Result<&mut Self>
[src]
Source port.
pub fn set_destination(&mut self, value: u16) -> Result<&mut Self>
[src]
Destination port.
pub fn set_sequence(&mut self, value: u32) -> Result<&mut Self>
[src]
Packet sequence.
pub fn set_acknowledgment(&mut self, value: u32) -> Result<&mut Self>
[src]
Optional acknowledgment.
pub fn set_flags(&mut self, value: Flags) -> Result<&mut Self>
[src]
Packet flags.
pub fn set_window(&mut self, value: u16) -> Result<&mut Self>
[src]
Packet window.
pub fn set_pointer(&mut self, value: u16) -> Result<&mut Self>
[src]
Urgent pointer.
pub fn checked<'a, 'b, BI: AsRef<[u8]> + 'b>(
&'a mut self,
ip: &'b Packet<BI>
) -> Checked<'a, 'b, B, BI>
[src]
&'a mut self,
ip: &'b Packet<BI>
) -> Checked<'a, 'b, B, BI>
Create a checksumed setter.
pub fn set_checksum(&mut self, value: u16) -> Result<&mut Self>
[src]
Set the checksum value.
pub fn update_checksum<BI: AsRef<[u8]>>(
&mut self,
ip: &Packet<BI>
) -> Result<&mut Self>
[src]
&mut self,
ip: &Packet<BI>
) -> Result<&mut Self>
Recalculate and set the checksum value.
Trait Implementations
impl<B: AsRef<[u8]> + AsMut<[u8]>> AsMut<[u8]> for Packet<B>
[src]
impl<'a, B: AsRef<[u8]>> AsPacket<'a, Packet<&'a [u8]>> for B
[src]
impl<'a, B: Buffer> AsPacket<'a, Packet<&'a [u8]>> for Builder<B>
[src]
impl<'a, B: AsRef<[u8]> + AsMut<[u8]>> AsPacketMut<'a, Packet<&'a mut [u8]>> for B
[src]
impl<'a, B: Buffer> AsPacketMut<'a, Packet<&'a mut [u8]>> for Builder<B>
[src]
impl<B: AsRef<[u8]>> AsRef<[u8]> for Packet<B>
[src]
impl<B: AsRef<[u8]>> Debug for Packet<B>
[src]
impl<B> Max for Packet<B>
[src]
impl<B> Max for Packet<B>
[src]
impl<B> Min for Packet<B>
[src]
impl<B> Min for Packet<B>
[src]
impl<B: AsRef<[u8]>> Packet for Packet<B>
[src]
pub fn split(&self) -> (&[u8], &[u8])
[src]
pub fn header(&self) -> &[u8]
[src]
pub fn payload(&self) -> &[u8]
[src]
impl<B: AsRef<[u8]> + AsMut<[u8]>> PacketMut for Packet<B>
[src]
pub fn split_mut(&mut self) -> (&mut [u8], &mut [u8])
[src]
pub fn header_mut(&mut self) -> &mut [u8]
[src]
pub fn payload_mut(&mut self) -> &mut [u8]
[src]
impl<B: AsRef<[u8]>> Size for Packet<B>
[src]
impl<B: AsRef<[u8]>> Size for Packet<B>
[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for Packet<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for Packet<B> where
B: Send,
B: Send,
impl<B> Sync for Packet<B> where
B: Sync,
B: Sync,
impl<B> Unpin for Packet<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for Packet<B> where
B: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Max for T where
T: Max + Max,
[src]
T: Max + Max,
impl<T> Min for T where
T: Min + Min,
[src]
T: Min + Min,
impl<T> Size for T where
T: Size + Size,
[src]
T: Size + Size,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,