Skip to content

Commit 7182f97

Browse files
committed
uefi: pxe: use core::net-types in public API
Please note that some structs that are low-level types and UEFI-facing still use EfiIpAddr instead. This includes for example ```rust /// This struct contains optional parameters for [`BaseCode::discover`]. /// /// Corresponds to the `EFI_PXE_BASE_CODE_DISCOVER_INFO` type in the C API. #[repr(C)] #[derive(Debug, Pointee)] pub struct DiscoverInfo { use_m_cast: bool, use_b_cast: bool, use_u_cast: bool, must_use_list: bool, server_m_cast_ip: EfiIpAddr, ip_cnt: u16, srv_list: [Server], } ``` Once #1642 is resolved, this can be improved.
1 parent 6c89597 commit 7182f97

File tree

2 files changed

+109
-72
lines changed
  • uefi-test-runner/src/proto/network
  • uefi/src/proto/network

2 files changed

+109
-72
lines changed

uefi-test-runner/src/proto/network/pxe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT OR Apache-2.0
22

3-
use uefi::proto::network::IpAddress;
3+
use core::net::{IpAddr, Ipv4Addr};
44
use uefi::proto::network::pxe::{BaseCode, DhcpV4Packet, IpFilter, IpFilters, UdpOpFlags};
55
use uefi::{CStr8, boot};
66

@@ -30,7 +30,7 @@ pub fn test() {
3030
info!("DHCP: Server IP: {:?}", dhcp_ack.bootp_si_addr);
3131
info!("DHCP: Client IP: {:?}", dhcp_ack.bootp_yi_addr);
3232

33-
let server_ip = IpAddress::new_v4(dhcp_ack.bootp_si_addr);
33+
let server_ip = IpAddr::V4(Ipv4Addr::from(dhcp_ack.bootp_si_addr));
3434

3535
const EXAMPLE_FILE_NAME: &[u8] = b"example-file.txt\0";
3636
const EXAMPLE_FILE_CONTENT: &[u8] = b"Hello world!";
@@ -77,9 +77,9 @@ pub fn test() {
7777
info!("Reading UDP packet from example service");
7878

7979
// Used as buffers
80-
let mut src_ip = IpAddress::new_v4([0; 4]);
80+
let mut src_ip = IpAddr::V4(Ipv4Addr::from([0; 4]));
8181
let mut src_port = 0;
82-
let mut dest_ip = IpAddress::new_v4([0; 4]);
82+
let mut dest_ip = IpAddr::V4(Ipv4Addr::from([0; 4]));
8383
let mut dest_port = 0;
8484
let mut header = [0; 1];
8585
let mut received = [0; 4];

0 commit comments

Comments
 (0)