Struct pnet::packet::gre::GrePacket [] [src]

pub struct GrePacket<'p> {
    // some fields omitted
}

A structure enabling manipulation of on the wire packets

Methods

impl<'a> GrePacket<'a>
[src]

fn new<'p>(packet: &'p [u8]) -> Option<GrePacket<'p>>

Constructs a new GrePacket. If the provided buffer is less than the minimum required packet size, this will return None.

fn to_immutable<'p>(&'p self) -> GrePacket<'p>

Maps from a GrePacket to a GrePacket

fn minimum_packet_size() -> usize

The minimum size (in bytes) a packet of this type can be. It's based on the total size of the fixed-size fields.

fn packet_size(_packet: &Gre) -> usize

The size (in bytes) of a Gre instance when converted into a byte-array

fn get_checksum_present(&self) -> u1

Get the checksum_present field

fn get_routing_present(&self) -> u1

Get the routing_present field

fn get_key_present(&self) -> u1

Get the key_present field

fn get_sequence_present(&self) -> u1

Get the sequence_present field

fn get_strict_source_route(&self) -> u1

Get the strict_source_route field

fn get_recursion_control(&self) -> u3

Get the recursion_control field

fn get_zero_flags(&self) -> u5

Get the zero_flags field

fn get_version(&self) -> u3

Get the version field

fn get_protocol_type(&self) -> u16be

Get the protocol_type field

fn get_checksum_raw(&self) -> &[u8]

Get the raw &[u8] value of the checksum field, without copying

fn get_checksum(&self) -> Vec<U16BE>

Get the value of the checksum field (copies contents)

fn get_checksum_iter(&self) -> U16BEIterable

Get the value of the checksum field as iterator

fn get_offset_raw(&self) -> &[u8]

Get the raw &[u8] value of the offset field, without copying

fn get_offset(&self) -> Vec<U16BE>

Get the value of the offset field (copies contents)

fn get_offset_iter(&self) -> U16BEIterable

Get the value of the offset field as iterator

fn get_key_raw(&self) -> &[u8]

Get the raw &[u8] value of the key field, without copying

fn get_key(&self) -> Vec<U32BE>

Get the value of the key field (copies contents)

fn get_key_iter(&self) -> U32BEIterable

Get the value of the key field as iterator

fn get_sequence_raw(&self) -> &[u8]

Get the raw &[u8] value of the sequence field, without copying

fn get_sequence(&self) -> Vec<U32BE>

Get the value of the sequence field (copies contents)

fn get_sequence_iter(&self) -> U32BEIterable

Get the value of the sequence field as iterator

fn get_routing_raw(&self) -> &[u8]

Get the raw &[u8] value of the routing field, without copying

fn get_routing(&self) -> Vec<u8>

Get the value of the routing field (copies contents)

Trait Implementations

impl<'a> PacketSize for GrePacket<'a>
[src]

fn packet_size(&self) -> usize

Get the calculated size of the packet

impl<'a> Packet for GrePacket<'a>
[src]

fn packet<'p>(&'p self) -> &'p [u8]

Retreive the underlying buffer for the packet

fn payload<'p>(&'p self) -> &'p [u8]

Retreive the payload for the packet

impl<'p> FromPacket for GrePacket<'p>
[src]

type T = Gre

The type of the packet to convert from

fn from_packet(&self) -> Gre

Converts a wire-format packet to #[packet] struct format

impl<'p> Debug for GrePacket<'p>
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

Derived Implementations

impl<'p> PartialEq for GrePacket<'p>
[src]

fn eq(&self, __arg_0: &GrePacket<'p>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &GrePacket<'p>) -> bool

This method tests for !=.