IPv4

Type Alias IPv4 

Source
pub type IPv4 = U32<NetworkEndian>;
Expand description

The underlying value (u32) and trait impl for AFI 1. Exactly fitting IPv4 bytes (4 octets).

Aliased Type§

pub struct IPv4(/* private fields */);

Trait Implementations§

Source§

impl AddressFamily for IPv4

Source§

const BITS: u8 = 32u8

The number of bits in the byte representation of the family.
Source§

type Inner = u32

The type actually holding the value, u32 for IPv4, and u128 for IPv6.
Source§

type InnerIpAddr = Ipv4Addr

The std::net that the value of self belongs to. So, std::net::Ipv4Addr, and std::net::Ipv6Addr for IPv4, and IPv6 respectively.
Source§

fn zero() -> Self

Source§

fn from_u8(value: u8) -> Self

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_ipaddr(ip_addr: Self::InnerIpAddr) -> Self

Source§

fn into_bit_span(net: Self, start_bit: u8, len: u8) -> BitSpan

Source§

fn add_bit_span(self, len: u8, bs: BitSpan) -> (U32<NetworkEndian>, u8)

Treat self as a prefix and append the given bitspan to it.
Source§

fn into_ipaddr(self) -> IpAddr

Turn self in to a std::net::IpAddr.
Source§

fn dangerously_truncate_to_u32(self) -> u32

Truncate self to a u32. For IPv4 this is a NOP. For IPv6 this truncates to 32 bits.
Source§

fn truncate_to_len(self, len: u8) -> Self

fill the bits after the specified len with zeros. Interpreted as an IP Prefix, this means that self will be truncated to the specified len.
Source§

fn checked_shr_or_zero(self, rhs: u32) -> Self

Source§

fn checked_shl_or_zero(self, rhs: u32) -> Self

Source§

fn checked_shr(self, rhs: u32) -> Option<u32>

Source§

fn checked_shl(self, rhs: u32) -> Option<u32>

Source§

fn new(value: Self::Inner) -> Self