Enum smoltcp::wire::IpRepr
[−]
[src]
pub enum IpRepr { Unspecified { src_addr: Address, dst_addr: Address, protocol: Protocol, payload_len: usize, }, Ipv4(Ipv4Repr), // some variants omitted }
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
Unspecified
Fields of Unspecified
src_addr: Address | |
dst_addr: Address | |
protocol: Protocol | |
payload_len: usize |
Ipv4(Ipv4Repr)
Methods
impl IpRepr
[src]
fn version(&self) -> Version
[src]
Return the protocol version.
fn src_addr(&self) -> Address
[src]
Return the source address.
fn dst_addr(&self) -> Address
[src]
Return the destination address.
fn protocol(&self) -> Protocol
[src]
Return the protocol.
fn payload_len(&self) -> usize
[src]
Return the payload length.
fn set_payload_len(&mut self, length: usize)
[src]
Set the payload length.
fn lower(&self, fallback_src_addrs: &[Address]) -> Result<IpRepr>
[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.
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.
fn emit<T: AsRef<[u8]> + AsMut<[u8]>>(&self, buffer: T)
[src]
Emit this high-level representation into a buffer.
Panics
This function panics if invoked on an unspecified representation.
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 Debug for IpRepr
[src]
impl Clone for IpRepr
[src]
fn clone(&self) -> IpRepr
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for IpRepr
[src]
fn eq(&self, __arg_0: &IpRepr) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &IpRepr) -> bool
[src]
This method tests for !=
.