@@ -12,7 +12,6 @@ use crate::protocol::network::snp::NetworkMode;
1212use crate :: { Boolean , Event , Guid , Handle , Ipv4Address , Status , guid, newtype_enum} ;
1313use core:: ffi:: c_void;
1414use core:: fmt:: { Debug , Formatter } ;
15- use core:: ptr:: NonNull ;
1615
1716#[ derive( Debug ) ]
1817#[ repr( C ) ]
@@ -25,7 +24,7 @@ pub struct Tcpv4Protocol {
2524 /// drivers such as IPv4, MNP, or SNP.
2625 #[ allow( clippy:: type_complexity) ]
2726 pub get_mode_data : unsafe extern "efiapi" fn (
28- this : NonNull < Self > ,
27+ this : * mut Self ,
2928 connection_state : * mut Tcpv4ConnectionState ,
3029 config_data : * mut Tcpv4ConfigData ,
3130 ip4_mode_data : * mut Ipv4ModeData ,
@@ -50,7 +49,7 @@ pub struct Tcpv4Protocol {
5049 /// and transmit queue will be flushed, and no traffic will be
5150 /// allowed through this instance.
5251 pub configure :
53- unsafe extern "efiapi" fn ( this : NonNull < Self > , config_data : * mut Tcpv4ConfigData ) -> Status ,
52+ unsafe extern "efiapi" fn ( this : * mut Self , config_data : * const Tcpv4ConfigData ) -> Status ,
5453
5554 /// Add or delete routing entries.
5655 ///
@@ -87,11 +86,11 @@ pub struct Tcpv4Protocol {
8786 /// independent network stack that shares information only through
8887 /// EFI TCPv4 variable.
8988 pub routes : unsafe extern "efiapi" fn (
90- this : NonNull < Self > ,
89+ this : * mut Self ,
9190 delete_route : Boolean ,
92- subnet_address : NonNull < Ipv4Address > ,
93- subnet_mask : NonNull < Ipv4Address > ,
94- gateway_address : NonNull < Ipv4Address > ,
91+ subnet_address : * const Ipv4Address ,
92+ subnet_mask : * const Ipv4Address ,
93+ gateway_address : * const Ipv4Address ,
9594 ) -> Status ,
9695
9796 /// Initiate a nonblocking TCP connection request for an active
@@ -110,8 +109,8 @@ pub struct Tcpv4Protocol {
110109 /// [`Tcpv4ConnectionState::ESTABLISHED`], otherwise, the state
111110 /// will return to [`Tcpv4ConnectionState::CLOSED`].
112111 pub connect : unsafe extern "efiapi" fn (
113- this : NonNull < Self > ,
114- connection_token : NonNull < Tcpv4CompletionToken > ,
112+ this : * mut Self ,
113+ connection_token : * mut Tcpv4CompletionToken ,
115114 ) -> Status ,
116115
117116 /// Listen on the passive instance to accept an incoming
@@ -134,19 +133,16 @@ pub struct Tcpv4Protocol {
134133 ///
135134 /// This function can only be called when the current TCP instance
136135 /// is in [`Tcpv4ConnectionState::LISTEN`] state.
137- pub accept : unsafe extern "efiapi" fn (
138- this : NonNull < Self > ,
139- listen_token : NonNull < Tcpv4ListenToken > ,
140- ) -> Status ,
136+ pub accept :
137+ unsafe extern "efiapi" fn ( this : * mut Self , listen_token : * mut Tcpv4ListenToken ) -> Status ,
141138
142139 /// Queues outgoing data into the transmit queue.
143140 ///
144141 /// The `transmit` function queues a sending request to this
145142 /// instance along with the user data. The status of the token is
146143 /// updated and the event in the token will be signaled once the
147144 /// data is sent out or some error occurs.
148- pub transmit :
149- unsafe extern "efiapi" fn ( this : NonNull < Self > , token : NonNull < Tcpv4IoToken > ) -> Status ,
145+ pub transmit : unsafe extern "efiapi" fn ( this : * mut Self , token : * mut Tcpv4IoToken ) -> Status ,
150146
151147 /// Places an asynchronous receive request into the receiving
152148 /// queue.
@@ -169,8 +165,7 @@ pub struct Tcpv4Protocol {
169165 /// for the event will enable the user to receive the notification
170166 /// and receiving status. That notification function is guaranteed
171167 /// to not be re-entered.
172- pub receive :
173- unsafe extern "efiapi" fn ( this : NonNull < Self > , token : NonNull < Tcpv4IoToken > ) -> Status ,
168+ pub receive : unsafe extern "efiapi" fn ( this : * mut Self , token : * mut Tcpv4IoToken ) -> Status ,
174169
175170 /// Disconnect a TCP connection gracefully or reset a TCP
176171 /// connection. This function is a nonblocking operation.
@@ -185,7 +180,7 @@ pub struct Tcpv4Protocol {
185180 /// [`Tcpv4ConnectionState::CLOSED`] state, all pending
186181 /// asynchronous operations are signaled, and any buffers used for
187182 /// TCP network traffic are flushed.
188- pub close : unsafe extern "efiapi" fn ( this : NonNull < Self > , close_token : * mut c_void ) -> Status ,
183+ pub close : unsafe extern "efiapi" fn ( this : * mut Self , close_token : * mut c_void ) -> Status ,
189184
190185 /// Abort an asynchronous connection, listen, transmission or
191186 /// receive request.
@@ -202,8 +197,7 @@ pub struct Tcpv4Protocol {
202197 /// by [`Tcpv4Protocol::connect`], [`Tcpv4Protocol::accept`],
203198 /// [`Tcpv4Protocol::transmit`] and [`Tcpv4Protocol::receive`]
204199 /// will be aborted.
205- pub cancel :
206- unsafe extern "efiapi" fn ( this : NonNull < Self > , completion_token : * mut c_void ) -> Status ,
200+ pub cancel : unsafe extern "efiapi" fn ( this : * mut Self , completion_token : * mut c_void ) -> Status ,
207201
208202 /// Poll to receive incoming data and transmit outgoing segments.
209203 ///
@@ -216,7 +210,7 @@ pub struct Tcpv4Protocol {
216210 /// enough to avoid dropping packets. Drivers and applications
217211 /// that are experiencing packet loss should try calling the
218212 /// `poll` function at a high frequency.
219- pub poll : unsafe extern "efiapi" fn ( this : NonNull < Self > ) -> Status ,
213+ pub poll : unsafe extern "efiapi" fn ( this : * mut Self ) -> Status ,
220214}
221215
222216impl Tcpv4Protocol {
@@ -232,7 +226,7 @@ impl Tcpv4Protocol {
232226}
233227
234228newtype_enum ! {
235- pub enum Tcpv4ConnectionState : i32 => # [ allow ( missing_docs ) ] {
229+ pub enum Tcpv4ConnectionState : i32 => {
236230 CLOSED = 0 ,
237231 LISTEN = 1 ,
238232 SYN_SENT = 2 ,
@@ -264,21 +258,23 @@ pub struct Ipv4ModeData {
264258 /// Number of joined multicast groups.
265259 pub group_count : u32 ,
266260 /// List of joined multicast group addresses.
267- pub group_table : * mut Ipv4Address ,
261+ pub group_table : * const Ipv4Address ,
268262 /// Number of entries in the routing table.
269263 pub route_count : u32 ,
270264 /// Routing table entries.
271- pub ip4_route_table : * mut Ipv4RouteTable ,
265+ pub ip4_route_table : * const Ipv4RouteTable ,
272266 /// Number of entries in the supported ICMP types list.
273267 pub icmp_type_count : u32 ,
274268 /// Array of ICMP types and codes that are supported.
275- pub icmp_type_list : * mut Ipv4IcmpType ,
269+ pub icmp_type_list : * const Ipv4IcmpType ,
276270}
277271
278272#[ derive( Debug ) ]
279273#[ repr( C ) ]
280274pub struct Ipv4ConfigData {
281275 /// Default protocol to be used.
276+ ///
277+ /// See <https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml>.
282278 pub default_protocol : u8 ,
283279 /// Set to `TRUE` to receive all IPv4 packets.
284280 pub accept_any_protocol : Boolean ,
@@ -427,9 +423,9 @@ pub struct Tcpv4IoToken {
427423#[ repr( C ) ]
428424pub union Tcpv4Packet {
429425 /// Pointer to receive data structure.
430- pub rx_data : NonNull < Tcpv4ReceiveData > ,
426+ pub rx_data : * mut Tcpv4ReceiveData ,
431427 /// Pointer to transmit data structure.
432- pub tx_data : NonNull < Tcpv4TransmitData > ,
428+ pub tx_data : * mut Tcpv4TransmitData ,
433429}
434430
435431impl Debug for Tcpv4Packet {
@@ -445,7 +441,7 @@ pub struct Tcpv4FragmentData {
445441 pub fragment_length : u32 ,
446442 /// Pointer to an array of contiguous bytes, at least
447443 /// `fragment_length` in length.
448- pub fragment_buf : NonNull < u8 > ,
444+ pub fragment_buf : * mut u8 ,
449445}
450446
451447#[ derive( Debug ) ]
0 commit comments