Enum smoltcp::wire::IpRepr[][src]

#[non_exhaustive]pub enum IpRepr {
    Unspecified {
        src_addr: Address,
        dst_addr: Address,
        protocol: Protocol,
        payload_len: usize,
        hop_limit: u8,
    },
    Ipv4(Ipv4Repr),
    Ipv6(Ipv6Repr),
}

An IP packet representation.

This enum abstracts the various versions of IP packets. It either contains a concrete high-level representation for some IP protocol version, or an unspecified representation, which permits the IpAddress::Unspecified addresses.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unspecified

Fields of Unspecified

src_addr: Addressdst_addr: Addressprotocol: Protocolpayload_len: usizehop_limit: u8
Ipv4(Ipv4Repr)
Ipv6(Ipv6Repr)

Implementations

impl Repr[src]

pub fn version(&self) -> Version[src]

Return the protocol version.

pub fn src_addr(&self) -> Address[src]

Return the source address.

pub fn dst_addr(&self) -> Address[src]

Return the destination address.

pub fn protocol(&self) -> Protocol[src]

Return the protocol.

pub fn payload_len(&self) -> usize[src]

Return the payload length.

pub fn set_payload_len(&mut self, length: usize)[src]

Set the payload length.

pub fn hop_limit(&self) -> u8[src]

Return the TTL value.

pub fn lower(&self, fallback_src_addrs: &[Cidr]) -> Result<Repr>[src]

Convert an unspecified representation into a concrete one, or return Err(Error::Unaddressable) if not possible.

Panics

This function panics if source and destination addresses belong to different families, or the destination address is unspecified, since this indicates a logic error.

pub fn buffer_len(&self) -> usize[src]

Return the length of a header that will be emitted from this high-level representation.

Panics

This function panics if invoked on an unspecified representation.

pub fn emit<T: AsRef<[u8]> + AsMut<[u8]>>(
    &self,
    buffer: T,
    _checksum_caps: &ChecksumCapabilities
)
[src]

Emit this high-level representation into a buffer.

Panics

This function panics if invoked on an unspecified representation.

pub fn total_len(&self) -> usize[src]

Return the total length of a packet that will be emitted from this high-level representation.

This is the same as repr.buffer_len() + repr.payload_len().

Panics

This function panics if invoked on an unspecified representation.

Trait Implementations

impl Clone for Repr[src]

impl Debug for Repr[src]

impl Eq for Repr[src]

impl From<Repr> for Repr[src]

impl From<Repr> for Repr[src]

impl PartialEq<Repr> for Repr[src]

impl StructuralEq for Repr[src]

impl StructuralPartialEq for Repr[src]

Auto Trait Implementations

impl RefUnwindSafe for Repr

impl Send for Repr

impl Sync for Repr

impl Unpin for Repr

impl UnwindSafe for Repr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.