diff --git a/uefi-raw/src/protocol/network/pxe.rs b/uefi-raw/src/protocol/network/pxe.rs index 63fa27d04..a0bdc6a6f 100644 --- a/uefi-raw/src/protocol/network/pxe.rs +++ b/uefi-raw/src/protocol/network/pxe.rs @@ -176,14 +176,28 @@ pub struct PxeBaseCodeMtftpInfo { } bitflags! { + /// Flags for UDP read and write operations. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] pub struct PxeBaseCodeUdpOpFlags: u16 { + /// Receive a packet sent from any IP address in UDP read operations. const ANY_SRC_IP = 0x0001; + + /// Receive a packet sent from any UDP port in UDP read operations. If + /// the source port is not specified in UDP write operations, the + /// source port will be automatically selected. const ANY_SRC_PORT = 0x0002; + + /// Receive a packet sent to any IP address in UDP read operations. const ANY_DEST_IP = 0x0004; + + /// Receive a packet sent to any UDP port in UDP read operations. const ANY_DEST_PORT = 0x0008; + + /// The software filter is used in UDP read operations. const USE_FILTER = 0x0010; + + /// If required, a UDP write operation may be broken up across multiple packets. const MAY_FRAGMENT = 0x0020; } } @@ -280,12 +294,20 @@ pub struct PxeBaseCodeIpFilter { } bitflags! { + /// IP receive filters. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] pub struct PxeBaseCodeIpFilterFlags: u8 { + /// Enable the Station IP address. const STATION_IP = 0x01; + + /// Enable IPv4 broadcast addresses. const BROADCAST = 0x02; + + /// Enable all addresses. const PROMISCUOUS = 0x04; + + /// Enable all multicast addresses. const PROMISCUOUS_MULTICAST = 0x08; } } diff --git a/uefi/src/proto/network/pxe.rs b/uefi/src/proto/network/pxe.rs index 3cd642588..2cbf2a965 100644 --- a/uefi/src/proto/network/pxe.rs +++ b/uefi/src/proto/network/pxe.rs @@ -18,6 +18,10 @@ use crate::{CStr8, Char8, Result, Status, StatusExt}; use super::{IpAddress, MacAddress}; +pub use uefi_raw::protocol::network::pxe::{ + PxeBaseCodeIpFilterFlags as IpFilters, PxeBaseCodeUdpOpFlags as UdpOpFlags, +}; + /// PXE Base Code protocol #[derive(Debug)] #[repr(C)] @@ -829,29 +833,6 @@ pub struct MtftpInfo { pub transmit_timeout: u16, } -// No corresponding type in the UEFI spec, it just uses UINT16. -bitflags! { - /// Flags for UDP read and write operations. - #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] - #[repr(transparent)] - pub struct UdpOpFlags: u16 { - /// Receive a packet sent from any IP address in UDP read operations. - const ANY_SRC_IP = 0x0001; - /// Receive a packet sent from any UDP port in UDP read operations. If - /// the source port is no specified in UDP write operations, the - /// source port will be automatically selected. - const ANY_SRC_PORT = 0x0002; - /// Receive a packet sent to any IP address in UDP read operations. - const ANY_DEST_IP = 0x0004; - /// Receive a packet sent to any UDP port in UDP read operations. - const ANY_DEST_PORT = 0x0008; - /// The software filter is used in UDP read operations. - const USE_FILTER = 0x0010; - /// If required, a UDP write operation may be broken up across multiple packets. - const MAY_FRAGMENT = 0x0020; - } -} - /// IP receive filter settings /// /// Corresponds to the `EFI_PXE_BASE_CODE_IP_FILTER` type in the C API. @@ -895,22 +876,6 @@ impl IpFilter { } } -bitflags! { - /// IP receive filters. - #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] - #[repr(transparent)] - pub struct IpFilters: u8 { - /// Enable the Station IP address. - const STATION_IP = 0x01; - /// Enable IPv4 broadcast addresses. - const BROADCAST = 0x02; - /// Enable all addresses. - const PROMISCUOUS = 0x04; - /// Enable all multicast addresses. - const PROMISCUOUS_MULTICAST = 0x08; - } -} - /// A network packet. /// /// Corresponds to the `EFI_PXE_BASE_CODE_PACKET` type in the C API.