@@ -31,10 +31,10 @@ pub use uefi_raw::protocol::network::pxe::{
31
31
#[ allow( clippy:: type_complexity) ]
32
32
pub struct BaseCode {
33
33
revision : u64 ,
34
- start : extern "efiapi" fn ( this : & Self , use_ipv6 : bool ) -> Status ,
35
- stop : extern "efiapi" fn ( this : & Self ) -> Status ,
36
- dhcp : extern "efiapi" fn ( this : & Self , sort_offers : bool ) -> Status ,
37
- discover : extern "efiapi" fn (
34
+ start : unsafe extern "efiapi" fn ( this : & Self , use_ipv6 : bool ) -> Status ,
35
+ stop : unsafe extern "efiapi" fn ( this : & Self ) -> Status ,
36
+ dhcp : unsafe extern "efiapi" fn ( this : & Self , sort_offers : bool ) -> Status ,
37
+ discover : unsafe extern "efiapi" fn (
38
38
this : & Self ,
39
39
ty : BootstrapType ,
40
40
layer : & mut u16 ,
@@ -78,26 +78,26 @@ pub struct BaseCode {
78
78
buffer_size : & mut usize ,
79
79
buffer_ptr : * mut c_void ,
80
80
) -> Status ,
81
- set_ip_filter : extern "efiapi" fn ( this : & Self , new_filter : & IpFilter ) -> Status ,
82
- arp : extern "efiapi" fn (
81
+ set_ip_filter : unsafe extern "efiapi" fn ( this : & Self , new_filter : & IpFilter ) -> Status ,
82
+ arp : unsafe extern "efiapi" fn (
83
83
this : & Self ,
84
84
ip_addr : & IpAddress ,
85
85
mac_addr : Option < & mut MacAddress > ,
86
86
) -> Status ,
87
- set_parameters : extern "efiapi" fn (
87
+ set_parameters : unsafe extern "efiapi" fn (
88
88
this : & Self ,
89
89
new_auto_arp : Option < & bool > ,
90
90
new_send_guid : Option < & bool > ,
91
91
new_ttl : Option < & u8 > ,
92
92
new_tos : Option < & u8 > ,
93
93
new_make_callback : Option < & bool > ,
94
94
) -> Status ,
95
- set_station_ip : extern "efiapi" fn (
95
+ set_station_ip : unsafe extern "efiapi" fn (
96
96
this : & Self ,
97
97
new_station_ip : Option < & IpAddress > ,
98
98
new_subnet_mask : Option < & IpAddress > ,
99
99
) -> Status ,
100
- set_packets : extern "efiapi" fn (
100
+ set_packets : unsafe extern "efiapi" fn (
101
101
this : & Self ,
102
102
new_dhcp_discover_valid : Option < & bool > ,
103
103
new_dhcp_ack_received : Option < & bool > ,
@@ -118,18 +118,18 @@ pub struct BaseCode {
118
118
impl BaseCode {
119
119
/// Enables the use of the PXE Base Code Protocol functions.
120
120
pub fn start ( & mut self , use_ipv6 : bool ) -> Result {
121
- ( self . start ) ( self , use_ipv6) . to_result ( )
121
+ unsafe { ( self . start ) ( self , use_ipv6) } . to_result ( )
122
122
}
123
123
124
124
/// Disables the use of the PXE Base Code Protocol functions.
125
125
pub fn stop ( & mut self ) -> Result {
126
- ( self . stop ) ( self ) . to_result ( )
126
+ unsafe { ( self . stop ) ( self ) } . to_result ( )
127
127
}
128
128
129
129
/// Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request /
130
130
/// acknowledge) or DHCPv6 S.A.R.R (solicit / advertise / request / reply) sequence.
131
131
pub fn dhcp ( & mut self , sort_offers : bool ) -> Result {
132
- ( self . dhcp ) ( self , sort_offers) . to_result ( )
132
+ unsafe { ( self . dhcp ) ( self , sort_offers) } . to_result ( )
133
133
}
134
134
135
135
/// Attempts to complete the PXE Boot Server and/or boot image discovery
@@ -148,7 +148,7 @@ impl BaseCode {
148
148
} )
149
149
. unwrap_or ( null ( ) ) ;
150
150
151
- ( self . discover ) ( self , ty, layer, use_bis, info) . to_result ( )
151
+ unsafe { ( self . discover ) ( self , ty, layer, use_bis, info) } . to_result ( )
152
152
}
153
153
154
154
/// Returns the size of a file located on a TFTP server.
@@ -537,12 +537,12 @@ impl BaseCode {
537
537
/// Updates the IP receive filters of a network device and enables software
538
538
/// filtering.
539
539
pub fn set_ip_filter ( & mut self , new_filter : & IpFilter ) -> Result {
540
- ( self . set_ip_filter ) ( self , new_filter) . to_result ( )
540
+ unsafe { ( self . set_ip_filter ) ( self , new_filter) } . to_result ( )
541
541
}
542
542
543
543
/// Uses the ARP protocol to resolve a MAC address.
544
544
pub fn arp ( & mut self , ip_addr : & IpAddress , mac_addr : Option < & mut MacAddress > ) -> Result {
545
- ( self . arp ) ( self , ip_addr, mac_addr) . to_result ( )
545
+ unsafe { ( self . arp ) ( self , ip_addr, mac_addr) } . to_result ( )
546
546
}
547
547
548
548
/// Updates the parameters that affect the operation of the PXE Base Code
@@ -555,14 +555,16 @@ impl BaseCode {
555
555
new_tos : Option < u8 > ,
556
556
new_make_callback : Option < bool > ,
557
557
) -> Result {
558
- ( self . set_parameters ) (
559
- self ,
560
- new_auto_arp. as_ref ( ) ,
561
- new_send_guid. as_ref ( ) ,
562
- new_ttl. as_ref ( ) ,
563
- new_tos. as_ref ( ) ,
564
- new_make_callback. as_ref ( ) ,
565
- )
558
+ unsafe {
559
+ ( self . set_parameters ) (
560
+ self ,
561
+ new_auto_arp. as_ref ( ) ,
562
+ new_send_guid. as_ref ( ) ,
563
+ new_ttl. as_ref ( ) ,
564
+ new_tos. as_ref ( ) ,
565
+ new_make_callback. as_ref ( ) ,
566
+ )
567
+ }
566
568
. to_result ( )
567
569
}
568
570
@@ -573,7 +575,7 @@ impl BaseCode {
573
575
new_station_ip : Option < & IpAddress > ,
574
576
new_subnet_mask : Option < & IpAddress > ,
575
577
) -> Result {
576
- ( self . set_station_ip ) ( self , new_station_ip, new_subnet_mask) . to_result ( )
578
+ unsafe { ( self . set_station_ip ) ( self , new_station_ip, new_subnet_mask) } . to_result ( )
577
579
}
578
580
579
581
/// Updates the contents of the cached DHCP and Discover packets.
@@ -593,21 +595,23 @@ impl BaseCode {
593
595
new_pxe_reply : Option < & Packet > ,
594
596
new_pxe_bis_reply : Option < & Packet > ,
595
597
) -> Result {
596
- ( self . set_packets ) (
597
- self ,
598
- new_dhcp_discover_valid. as_ref ( ) ,
599
- new_dhcp_ack_received. as_ref ( ) ,
600
- new_proxy_offer_received. as_ref ( ) ,
601
- new_pxe_discover_valid. as_ref ( ) ,
602
- new_pxe_reply_received. as_ref ( ) ,
603
- new_pxe_bis_reply_received. as_ref ( ) ,
604
- new_dhcp_discover,
605
- new_dhcp_ack,
606
- new_proxy_offer,
607
- new_pxe_discover,
608
- new_pxe_reply,
609
- new_pxe_bis_reply,
610
- )
598
+ unsafe {
599
+ ( self . set_packets ) (
600
+ self ,
601
+ new_dhcp_discover_valid. as_ref ( ) ,
602
+ new_dhcp_ack_received. as_ref ( ) ,
603
+ new_proxy_offer_received. as_ref ( ) ,
604
+ new_pxe_discover_valid. as_ref ( ) ,
605
+ new_pxe_reply_received. as_ref ( ) ,
606
+ new_pxe_bis_reply_received. as_ref ( ) ,
607
+ new_dhcp_discover,
608
+ new_dhcp_ack,
609
+ new_proxy_offer,
610
+ new_pxe_discover,
611
+ new_pxe_reply,
612
+ new_pxe_bis_reply,
613
+ )
614
+ }
611
615
. to_result ( )
612
616
}
613
617
0 commit comments