99//! No interface function must be called until `SimpleNetwork.start` is successfully
1010//! called first.
1111
12- use super :: { IpAddress , MacAddress } ;
1312use crate :: data_types:: Event ;
1413use crate :: proto:: unsafe_protocol;
1514use crate :: { Result , StatusExt } ;
1615use core:: ffi:: c_void;
16+ use core:: net:: IpAddr ;
1717use core:: ptr;
1818use core:: ptr:: NonNull ;
19- use uefi_raw:: Boolean ;
2019use uefi_raw:: protocol:: network:: snp:: SimpleNetworkProtocol ;
20+ use uefi_raw:: { Boolean , IpAddress as EfiIpAddr , MacAddress as EfiMacAddr } ;
2121
2222pub use uefi_raw:: protocol:: network:: snp:: {
2323 InterruptStatus , NetworkMode , NetworkState , NetworkStatistics , ReceiveFlags ,
@@ -68,7 +68,7 @@ impl SimpleNetwork {
6868 enable : ReceiveFlags ,
6969 disable : ReceiveFlags ,
7070 reset_mcast_filter : bool ,
71- mcast_filter : Option < & [ MacAddress ] > ,
71+ mcast_filter : Option < & [ EfiMacAddr ] > ,
7272 ) -> Result {
7373 let filter_count = mcast_filter. map ( |filters| filters. len ( ) ) . unwrap_or ( 0 ) ;
7474 let filters = mcast_filter
@@ -89,7 +89,7 @@ impl SimpleNetwork {
8989 }
9090
9191 /// Modify or reset the current station address, if supported.
92- pub fn station_address ( & self , reset : bool , new : Option < & MacAddress > ) -> Result {
92+ pub fn station_address ( & self , reset : bool , new : Option < & EfiMacAddr > ) -> Result {
9393 unsafe {
9494 ( self . 0 . station_address ) (
9595 & self . 0 ,
@@ -129,13 +129,14 @@ impl SimpleNetwork {
129129 }
130130
131131 /// Convert a multicast IP address to a multicast HW MAC Address.
132- pub fn mcast_ip_to_mac ( & self , ipv6 : bool , ip : IpAddress ) -> Result < MacAddress > {
133- let mut mac_address = MacAddress ( [ 0 ; 32 ] ) ;
132+ pub fn mcast_ip_to_mac ( & self , ipv6 : bool , ip : IpAddr ) -> Result < EfiMacAddr > {
133+ let mut mac_address = EfiMacAddr ( [ 0 ; 32 ] ) ;
134+ let ip = EfiIpAddr :: from ( ip) ;
134135 let status = unsafe {
135136 ( self . 0 . multicast_ip_to_mac ) (
136137 & self . 0 ,
137138 Boolean :: from ( ipv6) ,
138- ip . as_raw_ptr ( ) ,
139+ & raw const ip ,
139140 & mut mac_address,
140141 )
141142 } ;
@@ -220,8 +221,8 @@ impl SimpleNetwork {
220221 & self ,
221222 header_size : usize ,
222223 buffer : & [ u8 ] ,
223- src_addr : Option < MacAddress > ,
224- dst_addr : Option < MacAddress > ,
224+ src_addr : Option < EfiMacAddr > ,
225+ dst_addr : Option < EfiMacAddr > ,
225226 protocol : Option < u16 > ,
226227 ) -> Result {
227228 unsafe {
@@ -245,8 +246,8 @@ impl SimpleNetwork {
245246 & self ,
246247 buffer : & mut [ u8 ] ,
247248 header_size : Option < & mut usize > ,
248- src_addr : Option < & mut MacAddress > ,
249- dest_addr : Option < & mut MacAddress > ,
249+ src_addr : Option < & mut EfiMacAddr > ,
250+ dest_addr : Option < & mut EfiMacAddr > ,
250251 protocol : Option < & mut u16 > ,
251252 ) -> Result < usize > {
252253 let mut buffer_size = buffer. len ( ) ;
0 commit comments