Skip to content

Commit fd72002

Browse files
authored
Merge pull request #1548 from nicholasbishop/bishop-use-raw-pxe-bitflags
Use bitflags definitions from uefi-raw in uefi's pxe module
2 parents 20c31f1 + 86cc82a commit fd72002

File tree

2 files changed

+26
-39
lines changed
  • uefi/src/proto/network
  • uefi-raw/src/protocol/network

2 files changed

+26
-39
lines changed

Diff for: uefi-raw/src/protocol/network/pxe.rs

+22
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,28 @@ pub struct PxeBaseCodeMtftpInfo {
176176
}
177177

178178
bitflags! {
179+
/// Flags for UDP read and write operations.
179180
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
180181
#[repr(transparent)]
181182
pub struct PxeBaseCodeUdpOpFlags: u16 {
183+
/// Receive a packet sent from any IP address in UDP read operations.
182184
const ANY_SRC_IP = 0x0001;
185+
186+
/// Receive a packet sent from any UDP port in UDP read operations. If
187+
/// the source port is not specified in UDP write operations, the
188+
/// source port will be automatically selected.
183189
const ANY_SRC_PORT = 0x0002;
190+
191+
/// Receive a packet sent to any IP address in UDP read operations.
184192
const ANY_DEST_IP = 0x0004;
193+
194+
/// Receive a packet sent to any UDP port in UDP read operations.
185195
const ANY_DEST_PORT = 0x0008;
196+
197+
/// The software filter is used in UDP read operations.
186198
const USE_FILTER = 0x0010;
199+
200+
/// If required, a UDP write operation may be broken up across multiple packets.
187201
const MAY_FRAGMENT = 0x0020;
188202
}
189203
}
@@ -280,12 +294,20 @@ pub struct PxeBaseCodeIpFilter {
280294
}
281295

282296
bitflags! {
297+
/// IP receive filters.
283298
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
284299
#[repr(transparent)]
285300
pub struct PxeBaseCodeIpFilterFlags: u8 {
301+
/// Enable the Station IP address.
286302
const STATION_IP = 0x01;
303+
304+
/// Enable IPv4 broadcast addresses.
287305
const BROADCAST = 0x02;
306+
307+
/// Enable all addresses.
288308
const PROMISCUOUS = 0x04;
309+
310+
/// Enable all multicast addresses.
289311
const PROMISCUOUS_MULTICAST = 0x08;
290312
}
291313
}

Diff for: uefi/src/proto/network/pxe.rs

+4-39
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ use crate::{CStr8, Char8, Result, Status, StatusExt};
1818

1919
use super::{IpAddress, MacAddress};
2020

21+
pub use uefi_raw::protocol::network::pxe::{
22+
PxeBaseCodeIpFilterFlags as IpFilters, PxeBaseCodeUdpOpFlags as UdpOpFlags,
23+
};
24+
2125
/// PXE Base Code protocol
2226
#[derive(Debug)]
2327
#[repr(C)]
@@ -829,29 +833,6 @@ pub struct MtftpInfo {
829833
pub transmit_timeout: u16,
830834
}
831835

832-
// No corresponding type in the UEFI spec, it just uses UINT16.
833-
bitflags! {
834-
/// Flags for UDP read and write operations.
835-
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
836-
#[repr(transparent)]
837-
pub struct UdpOpFlags: u16 {
838-
/// Receive a packet sent from any IP address in UDP read operations.
839-
const ANY_SRC_IP = 0x0001;
840-
/// Receive a packet sent from any UDP port in UDP read operations. If
841-
/// the source port is no specified in UDP write operations, the
842-
/// source port will be automatically selected.
843-
const ANY_SRC_PORT = 0x0002;
844-
/// Receive a packet sent to any IP address in UDP read operations.
845-
const ANY_DEST_IP = 0x0004;
846-
/// Receive a packet sent to any UDP port in UDP read operations.
847-
const ANY_DEST_PORT = 0x0008;
848-
/// The software filter is used in UDP read operations.
849-
const USE_FILTER = 0x0010;
850-
/// If required, a UDP write operation may be broken up across multiple packets.
851-
const MAY_FRAGMENT = 0x0020;
852-
}
853-
}
854-
855836
/// IP receive filter settings
856837
///
857838
/// Corresponds to the `EFI_PXE_BASE_CODE_IP_FILTER` type in the C API.
@@ -895,22 +876,6 @@ impl IpFilter {
895876
}
896877
}
897878

898-
bitflags! {
899-
/// IP receive filters.
900-
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
901-
#[repr(transparent)]
902-
pub struct IpFilters: u8 {
903-
/// Enable the Station IP address.
904-
const STATION_IP = 0x01;
905-
/// Enable IPv4 broadcast addresses.
906-
const BROADCAST = 0x02;
907-
/// Enable all addresses.
908-
const PROMISCUOUS = 0x04;
909-
/// Enable all multicast addresses.
910-
const PROMISCUOUS_MULTICAST = 0x08;
911-
}
912-
}
913-
914879
/// A network packet.
915880
///
916881
/// Corresponds to the `EFI_PXE_BASE_CODE_PACKET` type in the C API.

0 commit comments

Comments
 (0)