Skip to content

Commit 477dc26

Browse files
committed
publically document the corresponding types
1 parent 70875f8 commit 477dc26

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

src/proto/network/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
pub mod pxe;
66

7-
/// Represents an IPv4/v6 address. Corresponds to `EFI_IP_ADDRESS` type in the
8-
/// C API.
7+
/// Represents an IPv4/v6 address.
8+
///
9+
/// Corresponds to the `EFI_IP_ADDRESS` type in the C API.
910
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
1011
#[repr(C, align(4))]
1112
pub struct IpAddress(pub [u8; 16]);
@@ -27,8 +28,9 @@ impl IpAddress {
2728
}
2829
}
2930

30-
/// Represents a MAC (media access control) address. Corresponds to the
31-
/// `EFI_MAC_ADDRESS` type in the C API.
31+
/// Represents a MAC (media access control) address.
32+
///
33+
/// Corresponds to the `EFI_MAC_ADDRESS` type in the C API.
3234
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
3335
#[repr(C)]
3436
pub struct MacAddress(pub [u8; 32]);

src/proto/network/pxe.rs

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ impl BaseCode {
617617
}
618618

619619
/// A type of bootstrap to perform in [`BaseCode::discover`].
620-
// EFI_PXE_BASE_CODE_BOOT_*
620+
///
621+
/// Corresponds to the `EFI_PXE_BASE_CODE_BOOT_` constants in the C API.
621622
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
622623
#[repr(u16)]
623624
#[allow(missing_docs)]
@@ -648,7 +649,8 @@ pub enum BootstrapType {
648649
}
649650

650651
/// This struct contains optional parameters for [`BaseCode::discover`].
651-
// EFI_PXE_BASE_CODE_DISCOVER_INFO
652+
///
653+
/// Corresponds to the `EFI_PXE_BASE_CODE_DISCOVER_INFO` type in the C API.
652654
#[repr(C)]
653655
pub struct DiscoverInfo<T: ?Sized> {
654656
use_m_cast: bool,
@@ -724,7 +726,8 @@ impl<T> DiscoverInfo<T> {
724726
}
725727

726728
/// An entry in the Boot Server list
727-
// EFI_PXE_BASE_CODE_SRVLIST
729+
///
730+
/// Corresponds to the `EFI_PXE_BASE_CODE_SRVLIST` type in the C API.
728731
#[repr(C)]
729732
pub struct Server {
730733
/// The type of Boot Server reply
@@ -759,7 +762,7 @@ impl Server {
759762
}
760763
}
761764

762-
// EFI_PXE_BASE_CODE_TFTP_OPCODE
765+
/// Corresponds to the `EFI_PXE_BASE_CODE_TFTP_OPCODE` type in the C API.
763766
#[repr(C)]
764767
enum TftpOpcode {
765768
TftpGetFileSize = 1,
@@ -772,7 +775,8 @@ enum TftpOpcode {
772775
}
773776

774777
/// MTFTP connection parameters
775-
// EFI_PXE_BASE_CODE_MTFTP_INFO
778+
///
779+
/// Corresponds to the `EFI_PXE_BASE_CODE_MTFTP_INFO` type in the C API.
776780
#[derive(Clone, Copy)]
777781
#[repr(C)]
778782
pub struct MtftpInfo {
@@ -816,7 +820,8 @@ bitflags! {
816820
}
817821

818822
/// IP receive filter settings
819-
// EFI_PXE_BASE_CODE_IP_FILTER
823+
///
824+
/// Corresponds to the `EFI_PXE_BASE_CODE_IP_FILTER` type in the C API.
820825
#[repr(C)]
821826
pub struct IpFilter {
822827
/// A set of filters.
@@ -870,7 +875,8 @@ bitflags! {
870875
}
871876

872877
/// A network packet.
873-
// EFI_PXE_BASE_CODE_PACKET
878+
///
879+
/// Corresponds to the `EFI_PXE_BASE_CODE_PACKET` type in the C API.
874880
#[repr(C)]
875881
pub union Packet {
876882
raw: [u8; 1472],
@@ -897,7 +903,8 @@ impl AsRef<DhcpV6Packet> for Packet {
897903
}
898904

899905
/// A Dhcpv4 Packet.
900-
// EFI_PXE_BASE_CODE_DHCPV4_PACKET
906+
///
907+
/// Corresponds to the `EFI_PXE_BASE_CODE_DHCPV4_PACKET` type in the C API.
901908
#[repr(C)]
902909
#[derive(Clone, Copy)]
903910
pub struct DhcpV4Packet {
@@ -967,7 +974,8 @@ bitflags! {
967974
}
968975

969976
/// A Dhcpv6 Packet.
970-
// EFI_PXE_BASE_CODE_DHCPV6_PACKET
977+
///
978+
/// Corresponds to the `EFI_PXE_BASE_CODE_DHCPV6_PACKET` type in the C API.
971979
#[repr(C)]
972980
#[derive(Clone, Copy)]
973981
pub struct DhcpV6Packet {
@@ -989,7 +997,8 @@ impl DhcpV6Packet {
989997

990998
/// The data values in this structure are read-only and are updated by the
991999
/// [`BaseCode`].
992-
// EFI_PXE_BASE_CODE_MODE
1000+
///
1001+
/// Corresponds to the `EFI_PXE_BASE_CODE_MODE` type in the C API.
9931002
#[repr(C)]
9941003
pub struct Mode {
9951004
/// `true` if this device has been started by calling [`BaseCode::start`].
@@ -1146,7 +1155,8 @@ pub struct Mode {
11461155
}
11471156

11481157
/// An entry for the ARP cache found in [`Mode::arp_cache`]
1149-
// EFI_PXE_BASE_CODE_ARP_ENTRY
1158+
///
1159+
/// Corresponds to the `EFI_PXE_BASE_CODE_ARP_ENTRY` type in the C API.
11501160
#[repr(C)]
11511161
pub struct ArpEntry {
11521162
/// The IP address.
@@ -1156,7 +1166,8 @@ pub struct ArpEntry {
11561166
}
11571167

11581168
/// An entry for the route table found in [`Mode::route_table`]
1159-
// EFI_PXE_BASE_CODE_ROUTE_ENTRY
1169+
///
1170+
/// Corresponds to the `EFI_PXE_BASE_CODE_ROUTE_ENTRY` type in the C API.
11601171
#[repr(C)]
11611172
#[allow(missing_docs)]
11621173
pub struct RouteEntry {
@@ -1165,7 +1176,9 @@ pub struct RouteEntry {
11651176
pub gw_addr: IpAddress,
11661177
}
11671178

1168-
// EFI_PXE_BASE_CODE_ICMP_ERROR
1179+
/// An ICMP error packet.
1180+
///
1181+
/// Corresponds to the `EFI_PXE_BASE_CODE_ICMP_ERROR` type in the C API.
11691182
#[repr(C)]
11701183
#[allow(missing_docs)]
11711184
pub struct IcmpError {
@@ -1176,8 +1189,8 @@ pub struct IcmpError {
11761189
pub data: [u8; 494],
11771190
}
11781191

1179-
// This type represents the anonymous union inside
1180-
// EFI_PXE_BASE_CODE_ICMP_ERROR.
1192+
/// Corresponds to the anonymous union inside
1193+
/// `EFI_PXE_BASE_CODE_ICMP_ERROR` in the C API.
11811194
#[repr(C)]
11821195
#[allow(missing_docs)]
11831196
pub union IcmpErrorUnion {
@@ -1187,8 +1200,8 @@ pub union IcmpErrorUnion {
11871200
pub echo: IcmpErrorEcho,
11881201
}
11891202

1190-
// This type represents on of the fields in the anonymous union inside
1191-
// EFI_PXE_BASE_CODE_ICMP_ERROR.
1203+
/// Corresponds to the `Echo` field in the anonymous union inside
1204+
/// `EFI_PXE_BASE_CODE_ICMP_ERROR` in the C API.
11921205
#[repr(C)]
11931206
#[derive(Clone, Copy)]
11941207
#[allow(missing_docs)]
@@ -1197,7 +1210,9 @@ pub struct IcmpErrorEcho {
11971210
pub sequence: u16,
11981211
}
11991212

1200-
// EFI_PXE_BASE_CODE_TFTP_ERROR
1213+
/// A TFTP error packet.
1214+
///
1215+
/// Corresponds to the `EFI_PXE_BASE_CODE_TFTP_ERROR` type in the C API.
12011216
#[repr(C)]
12021217
#[allow(missing_docs)]
12031218
pub struct TftpError {

0 commit comments

Comments
 (0)