Skip to main content

NetError

Enum NetError 

Source
#[repr(u16)]
pub enum NetError {
Show 25 variants PacketTooShort = 1, PacketTooLarge = 2, InvalidEthernetFrame = 3, UnsupportedEtherType = 4, InvalidIpv4Header = 5, Ipv4ChecksumError = 6, InvalidIpVersion = 7, InvalidIpHeaderLength = 8, TtlExpired = 9, InvalidUdpHeader = 10, UdpChecksumError = 11, InvalidIcmpHeader = 12, InvalidArpPacket = 13, ArpNotFound = 14, ArpCacheFull = 15, SocketNotBound = 16, PortInUse = 17, NoPortsAvailable = 18, DestinationUnreachable = 19, DeviceError = 20, BufferTooSmall = 21, WouldBlock = 22, InvalidPort = 23, FragmentationNotSupported = 24, KernelError(u16),
}
Expand description

Network error codes.

These errors cover all network stack operations from Ethernet to UDP.

Variants§

§

PacketTooShort = 1

The packet is too short to contain the expected header.

§

PacketTooLarge = 2

The packet exceeds the maximum allowed size.

§

InvalidEthernetFrame = 3

Invalid Ethernet frame format.

§

UnsupportedEtherType = 4

Unknown or unsupported EtherType.

§

InvalidIpv4Header = 5

Invalid IPv4 header format or checksum.

§

Ipv4ChecksumError = 6

IPv4 header checksum mismatch.

§

InvalidIpVersion = 7

IPv4 version is not 4.

§

InvalidIpHeaderLength = 8

IPv4 header length is invalid.

§

TtlExpired = 9

IPv4 Time To Live expired.

§

InvalidUdpHeader = 10

Invalid UDP header format or checksum.

§

UdpChecksumError = 11

UDP checksum mismatch.

§

InvalidIcmpHeader = 12

Invalid ICMP header format.

§

InvalidArpPacket = 13

Invalid ARP packet format.

§

ArpNotFound = 14

No ARP entry found for the target IP.

§

ArpCacheFull = 15

ARP cache is full.

§

SocketNotBound = 16

The socket is not bound to a port.

§

PortInUse = 17

The port is already in use.

§

NoPortsAvailable = 18

No available ports for ephemeral allocation.

§

DestinationUnreachable = 19

The destination is unreachable.

§

DeviceError = 20

Network device error.

§

BufferTooSmall = 21

The provided buffer is too small.

§

WouldBlock = 22

Operation would block (non-blocking mode).

§

InvalidPort = 23

Invalid port number (0 for source).

§

FragmentationNotSupported = 24

Fragment reassembly not supported.

§

KernelError(u16)

Kernel error passthrough.

Implementations§

Source§

impl NetError

Source

pub const fn as_str(&self) -> &'static str

Returns a human-readable description of the error.

Source

pub const fn code(&self) -> u16

Returns the error code as a u16 (for unit variants).

Source

pub const fn from_u16(code: u16) -> Option<Self>

Converts from a raw u16 error code.

Trait Implementations§

Source§

impl Clone for NetError

Source§

fn clone(&self) -> NetError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NetError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<KernelError> for NetError

Source§

fn from(err: KernelError) -> Self

Converts to this type from the input type.
Source§

impl Hash for NetError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NetError

Source§

fn eq(&self, other: &NetError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for NetError

Source§

impl Eq for NetError

Source§

impl StructuralPartialEq for NetError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.