xref: /illumos-gate/usr/src/boot/efi/include/Protocol/Ip4.h (revision cdd3e9a818787b4def17c9f707f435885ce0ed31)
1 /** @file
2   This file defines the EFI IPv4 (Internet Protocol version 4)
3   Protocol interface. It is split into the following three main
4   sections:
5   - EFI IPv4 Service Binding Protocol
6   - EFI IPv4 Variable (deprecated in UEFI 2.4B)
7   - EFI IPv4 Protocol.
8   The EFI IPv4 Protocol provides basic network IPv4 packet I/O services,
9   which includes support foR a subset of the Internet Control Message
10   Protocol (ICMP) and may include support for the Internet Group Management
11   Protocol (IGMP).
12 
13 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
14 SPDX-License-Identifier: BSD-2-Clause-Patent
15 
16   @par Revision Reference:
17   This Protocol is introduced in UEFI Specification 2.0.
18 
19 **/
20 
21 #ifndef __EFI_IP4_PROTOCOL_H__
22 #define __EFI_IP4_PROTOCOL_H__
23 
24 #include <Protocol/ManagedNetwork.h>
25 
26 #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \
27   { \
28     0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \
29   }
30 
31 #define EFI_IP4_PROTOCOL_GUID \
32   { \
33     0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
34   }
35 
36 typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;
37 
38 ///
39 /// EFI_IP4_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
40 /// The definition in here is only present to provide backwards compatability.
41 ///
42 typedef struct {
43   EFI_HANDLE          InstanceHandle;
44   EFI_IPv4_ADDRESS    Ip4Address;
45   EFI_IPv4_ADDRESS    SubnetMask;
46 } EFI_IP4_ADDRESS_PAIR;
47 
48 ///
49 /// EFI_IP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
50 /// The definition in here is only present to provide backwards compatability.
51 ///
52 typedef struct {
53   EFI_HANDLE              DriverHandle;
54   UINT32                  AddressCount;
55   EFI_IP4_ADDRESS_PAIR    AddressPairs[1];
56 } EFI_IP4_VARIABLE_DATA;
57 
58 typedef struct {
59   ///
60   /// The default IPv4 protocol packets to send and receive. Ignored
61   /// when AcceptPromiscuous is TRUE.
62   ///
63   UINT8               DefaultProtocol;
64   ///
65   /// Set to TRUE to receive all IPv4 packets that get through the receive filters.
66   /// Set to FALSE to receive only the DefaultProtocol IPv4
67   /// packets that get through the receive filters.
68   ///
69   BOOLEAN             AcceptAnyProtocol;
70   ///
71   /// Set to TRUE to receive ICMP error report packets. Ignored when
72   /// AcceptPromiscuous or AcceptAnyProtocol is TRUE.
73   ///
74   BOOLEAN             AcceptIcmpErrors;
75   ///
76   /// Set to TRUE to receive broadcast IPv4 packets. Ignored when
77   /// AcceptPromiscuous is TRUE.
78   /// Set to FALSE to stop receiving broadcast IPv4 packets.
79   ///
80   BOOLEAN             AcceptBroadcast;
81   ///
82   /// Set to TRUE to receive all IPv4 packets that are sent to any
83   /// hardware address or any protocol address.
84   /// Set to FALSE to stop receiving all promiscuous IPv4 packets
85   ///
86   BOOLEAN             AcceptPromiscuous;
87   ///
88   /// Set to TRUE to use the default IPv4 address and default routing table.
89   ///
90   BOOLEAN             UseDefaultAddress;
91   ///
92   /// The station IPv4 address that will be assigned to this EFI IPv4Protocol instance.
93   ///
94   EFI_IPv4_ADDRESS    StationAddress;
95   ///
96   /// The subnet address mask that is associated with the station address.
97   ///
98   EFI_IPv4_ADDRESS    SubnetMask;
99   ///
100   /// TypeOfService field in transmitted IPv4 packets.
101   ///
102   UINT8               TypeOfService;
103   ///
104   /// TimeToLive field in transmitted IPv4 packets.
105   ///
106   UINT8               TimeToLive;
107   ///
108   /// State of the DoNotFragment bit in transmitted IPv4 packets.
109   ///
110   BOOLEAN             DoNotFragment;
111   ///
112   /// Set to TRUE to send and receive unformatted packets. The other
113   /// IPv4 receive filters are still applied. Fragmentation is disabled for RawData mode.
114   ///
115   BOOLEAN             RawData;
116   ///
117   /// The timer timeout value (number of microseconds) for the
118   /// receive timeout event to be associated with each assembled
119   /// packet. Zero means do not drop assembled packets.
120   ///
121   UINT32              ReceiveTimeout;
122   ///
123   /// The timer timeout value (number of microseconds) for the
124   /// transmit timeout event to be associated with each outgoing
125   /// packet. Zero means do not drop outgoing packets.
126   ///
127   UINT32              TransmitTimeout;
128 } EFI_IP4_CONFIG_DATA;
129 
130 typedef struct {
131   EFI_IPv4_ADDRESS    SubnetAddress;
132   EFI_IPv4_ADDRESS    SubnetMask;
133   EFI_IPv4_ADDRESS    GatewayAddress;
134 } EFI_IP4_ROUTE_TABLE;
135 
136 typedef struct {
137   UINT8    Type;
138   UINT8    Code;
139 } EFI_IP4_ICMP_TYPE;
140 
141 typedef struct {
142   ///
143   /// Set to TRUE after this EFI IPv4 Protocol instance has been successfully configured.
144   ///
145   BOOLEAN                IsStarted;
146   ///
147   /// The maximum packet size, in bytes, of the packet which the upper layer driver could feed.
148   ///
149   UINT32                 MaxPacketSize;
150   ///
151   /// Current configuration settings.
152   ///
153   EFI_IP4_CONFIG_DATA    ConfigData;
154   ///
155   /// Set to TRUE when the EFI IPv4 Protocol instance has a station address and subnet mask.
156   ///
157   BOOLEAN                IsConfigured;
158   ///
159   /// Number of joined multicast groups.
160   ///
161   UINT32                 GroupCount;
162   ///
163   /// List of joined multicast group addresses.
164   ///
165   EFI_IPv4_ADDRESS       *GroupTable;
166   ///
167   /// Number of entries in the routing table.
168   ///
169   UINT32                 RouteCount;
170   ///
171   /// Routing table entries.
172   ///
173   EFI_IP4_ROUTE_TABLE    *RouteTable;
174   ///
175   /// Number of entries in the supported ICMP types list.
176   ///
177   UINT32                 IcmpTypeCount;
178   ///
179   /// Array of ICMP types and codes that are supported by this EFI IPv4 Protocol driver
180   ///
181   EFI_IP4_ICMP_TYPE      *IcmpTypeList;
182 } EFI_IP4_MODE_DATA;
183 
184 #pragma pack(1)
185 
186 typedef struct {
187   UINT8               HeaderLength : 4;
188   UINT8               Version      : 4;
189   UINT8               TypeOfService;
190   UINT16              TotalLength;
191   UINT16              Identification;
192   UINT16              Fragmentation;
193   UINT8               TimeToLive;
194   UINT8               Protocol;
195   UINT16              Checksum;
196   EFI_IPv4_ADDRESS    SourceAddress;
197   EFI_IPv4_ADDRESS    DestinationAddress;
198 } EFI_IP4_HEADER;
199 #pragma pack()
200 
201 typedef struct {
202   UINT32    FragmentLength;
203   VOID      *FragmentBuffer;
204 } EFI_IP4_FRAGMENT_DATA;
205 
206 typedef struct {
207   EFI_TIME                 TimeStamp;
208   EFI_EVENT                RecycleSignal;
209   UINT32                   HeaderLength;
210   EFI_IP4_HEADER           *Header;
211   UINT32                   OptionsLength;
212   VOID                     *Options;
213   UINT32                   DataLength;
214   UINT32                   FragmentCount;
215   EFI_IP4_FRAGMENT_DATA    FragmentTable[1];
216 } EFI_IP4_RECEIVE_DATA;
217 
218 typedef struct {
219   EFI_IPv4_ADDRESS    SourceAddress;
220   EFI_IPv4_ADDRESS    GatewayAddress;
221   UINT8               Protocol;
222   UINT8               TypeOfService;
223   UINT8               TimeToLive;
224   BOOLEAN             DoNotFragment;
225 } EFI_IP4_OVERRIDE_DATA;
226 
227 typedef struct {
228   EFI_IPv4_ADDRESS         DestinationAddress;
229   EFI_IP4_OVERRIDE_DATA    *OverrideData;    // OPTIONAL
230   UINT32                   OptionsLength;    // OPTIONAL
231   VOID                     *OptionsBuffer;   // OPTIONAL
232   UINT32                   TotalDataLength;
233   UINT32                   FragmentCount;
234   EFI_IP4_FRAGMENT_DATA    FragmentTable[1];
235 } EFI_IP4_TRANSMIT_DATA;
236 
237 typedef struct {
238   ///
239   /// This Event will be signaled after the Status field is updated
240   /// by the EFI IPv4 Protocol driver. The type of Event must be
241   /// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of
242   /// Event must be lower than or equal to TPL_CALLBACK.
243   ///
244   EFI_EVENT     Event;
245   ///
246   /// The status that is returned to the caller at the end of the operation
247   /// to indicate whether this operation completed successfully.
248   ///
249   EFI_STATUS    Status;
250   union {
251     ///
252     /// When this token is used for receiving, RxData is a pointer to the EFI_IP4_RECEIVE_DATA.
253     ///
254     EFI_IP4_RECEIVE_DATA     *RxData;
255     ///
256     /// When this token is used for transmitting, TxData is a pointer to the EFI_IP4_TRANSMIT_DATA.
257     ///
258     EFI_IP4_TRANSMIT_DATA    *TxData;
259   } Packet;
260 } EFI_IP4_COMPLETION_TOKEN;
261 
262 /**
263   Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
264 
265   The GetModeData() function returns the current operational mode data for this
266   driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
267   function is used optionally to retrieve the operational mode data of underlying
268   networks or drivers.
269 
270   @param  This          The pointer to the EFI_IP4_PROTOCOL instance.
271   @param  Ip4ModeData   The pointer to the EFI IPv4 Protocol mode data structure.
272   @param  MnpConfigData The pointer to the managed network configuration data structure.
273   @param  SnpModeData   The pointer to the simple network mode data structure.
274 
275   @retval EFI_SUCCESS           The operation completed successfully.
276   @retval EFI_INVALID_PARAMETER This is NULL.
277   @retval EFI_OUT_OF_RESOURCES  The required mode data could not be allocated.
278 
279 **/
280 typedef
281 EFI_STATUS
282 (EFIAPI *EFI_IP4_GET_MODE_DATA)(
283   IN CONST  EFI_IP4_PROTOCOL                *This,
284   OUT       EFI_IP4_MODE_DATA               *Ip4ModeData     OPTIONAL,
285   OUT       EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData   OPTIONAL,
286   OUT       EFI_SIMPLE_NETWORK_MODE         *SnpModeData     OPTIONAL
287   );
288 
289 /**
290   Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
291 
292   The Configure() function is used to set, change, or reset the operational
293   parameters and filter settings for this EFI IPv4 Protocol instance. Until these
294   parameters have been set, no network traffic can be sent or received by this
295   instance. Once the parameters have been reset (by calling this function with
296   IpConfigData set to NULL), no more traffic can be sent or received until these
297   parameters have been set again. Each EFI IPv4 Protocol instance can be started
298   and stopped independently of each other by enabling or disabling their receive
299   filter settings with the Configure() function.
300 
301   When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
302   be appended as an alias address into the addresses list in the EFI IPv4 Protocol
303   driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
304   to retrieve the default IPv4 address if it is not available yet. Clients could
305   frequently call GetModeData() to check the status to ensure that the default IPv4
306   address is ready.
307 
308   If operational parameters are reset or changed, any pending transmit and receive
309   requests will be cancelled. Their completion token status will be set to EFI_ABORTED
310   and their events will be signaled.
311 
312   @param  This         The pointer to the EFI_IP4_PROTOCOL instance.
313   @param  IpConfigData The pointer to the EFI IPv4 Protocol configuration data structure.
314 
315   @retval EFI_SUCCESS           The driver instance was successfully opened.
316   @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,
317                                 RARP, etc.) is not finished yet.
318   @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
319                                 This is NULL.
320                                 IpConfigData.StationAddress is not a unicast IPv4 address.
321                                 IpConfigData.SubnetMask is not a valid IPv4 subnet
322   @retval EFI_UNSUPPORTED       One or more of the following conditions is TRUE:
323                                 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
324                                 not be located when clients choose to use the default IPv4
325                                 address. This EFI IPv4 Protocol implementation does not
326                                 support this requested filter or timeout setting.
327   @retval EFI_OUT_OF_RESOURCES  The EFI IPv4 Protocol driver instance data could not be allocated.
328   @retval EFI_ALREADY_STARTED   The interface is already open and must be stopped before the
329                                 IPv4 address or subnet mask can be changed. The interface must
330                                 also be stopped when switching to/from raw packet mode.
331   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. The EFI IPv4
332                                 Protocol driver instance is not opened.
333 
334 **/
335 typedef
336 EFI_STATUS
337 (EFIAPI *EFI_IP4_CONFIGURE)(
338   IN EFI_IP4_PROTOCOL    *This,
339   IN EFI_IP4_CONFIG_DATA *IpConfigData     OPTIONAL
340   );
341 
342 /**
343   Joins and leaves multicast groups.
344 
345   The Groups() function is used to join and leave multicast group sessions. Joining
346   a group will enable reception of matching multicast packets. Leaving a group will
347   disable the multicast packet reception.
348 
349   If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
350 
351   @param  This                  The pointer to the EFI_IP4_PROTOCOL instance.
352   @param  JoinFlag              Set to TRUE to join the multicast group session and FALSE to leave.
353   @param  GroupAddress          The pointer to the IPv4 multicast address.
354 
355   @retval EFI_SUCCESS           The operation completed successfully.
356   @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
357                                 - This is NULL.
358                                 - JoinFlag is TRUE and GroupAddress is NULL.
359                                 - GroupAddress is not NULL and *GroupAddress is
360                                   not a multicast IPv4 address.
361   @retval EFI_NOT_STARTED       This instance has not been started.
362   @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,
363                                 RARP, etc.) is not finished yet.
364   @retval EFI_OUT_OF_RESOURCES  System resources could not be allocated.
365   @retval EFI_UNSUPPORTED       This EFI IPv4 Protocol implementation does not support multicast groups.
366   @retval EFI_ALREADY_STARTED   The group address is already in the group table (when
367                                 JoinFlag is TRUE).
368   @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is FALSE).
369   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
370 
371 **/
372 typedef
373 EFI_STATUS
374 (EFIAPI *EFI_IP4_GROUPS)(
375   IN EFI_IP4_PROTOCOL    *This,
376   IN BOOLEAN             JoinFlag,
377   IN EFI_IPv4_ADDRESS    *GroupAddress  OPTIONAL
378   );
379 
380 /**
381   Adds and deletes routing table entries.
382 
383   The Routes() function adds a route to or deletes a route from the routing table.
384 
385   Routes are determined by comparing the SubnetAddress with the destination IPv4
386   address arithmetically AND-ed with the SubnetMask. The gateway address must be
387   on the same subnet as the configured station address.
388 
389   The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
390   The default route matches all destination IPv4 addresses that do not match any
391   other routes.
392 
393   A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
394   IP address if it can be found in the ARP cache or on the local subnet. One automatic
395   nonroute entry will be inserted into the routing table for outgoing packets that
396   are addressed to a local subnet (gateway address of 0.0.0.0).
397 
398   Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
399   IPv4 Protocol instances that use the default IPv4 address will also have copies
400   of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
401   copies will be updated whenever the EIF IPv4 Protocol driver reconfigures its
402   instances. As a result, client modification to the routing table will be lost.
403 
404   @param  This                   The pointer to the EFI_IP4_PROTOCOL instance.
405   @param  DeleteRoute            Set to TRUE to delete this route from the routing table. Set to
406                                  FALSE to add this route to the routing table. SubnetAddress
407                                  and SubnetMask are used as the key to each route entry.
408   @param  SubnetAddress          The address of the subnet that needs to be routed.
409   @param  SubnetMask             The subnet mask of SubnetAddress.
410   @param  GatewayAddress         The unicast gateway IPv4 address for this route.
411 
412   @retval EFI_SUCCESS            The operation completed successfully.
413   @retval EFI_NOT_STARTED        The driver instance has not been started.
414   @retval EFI_NO_MAPPING         When using the default address, configuration (DHCP, BOOTP,
415                                  RARP, etc.) is not finished yet.
416   @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
417                                  - This is NULL.
418                                  - SubnetAddress is NULL.
419                                  - SubnetMask is NULL.
420                                  - GatewayAddress is NULL.
421                                  - *SubnetAddress is not a valid subnet address.
422                                  - *SubnetMask is not a valid subnet mask.
423                                  - *GatewayAddress is not a valid unicast IPv4 address.
424   @retval EFI_OUT_OF_RESOURCES   Could not add the entry to the routing table.
425   @retval EFI_NOT_FOUND          This route is not in the routing table (when DeleteRoute is TRUE).
426   @retval EFI_ACCESS_DENIED      The route is already defined in the routing table (when
427                                  DeleteRoute is FALSE).
428 
429 **/
430 typedef
431 EFI_STATUS
432 (EFIAPI *EFI_IP4_ROUTES)(
433   IN EFI_IP4_PROTOCOL    *This,
434   IN BOOLEAN             DeleteRoute,
435   IN EFI_IPv4_ADDRESS    *SubnetAddress,
436   IN EFI_IPv4_ADDRESS    *SubnetMask,
437   IN EFI_IPv4_ADDRESS    *GatewayAddress
438   );
439 
440 /**
441   Places outgoing data packets into the transmit queue.
442 
443   The Transmit() function places a sending request in the transmit queue of this
444   EFI IPv4 Protocol instance. Whenever the packet in the token is sent out or some
445   errors occur, the event in the token will be signaled and the status is updated.
446 
447   @param  This  The pointer to the EFI_IP4_PROTOCOL instance.
448   @param  Token The pointer to the transmit token.
449 
450   @retval  EFI_SUCCESS           The data has been queued for transmission.
451   @retval  EFI_NOT_STARTED       This instance has not been started.
452   @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,
453                                  RARP, etc.) is not finished yet.
454   @retval  EFI_INVALID_PARAMETER One or more pameters are invalid.
455   @retval  EFI_ACCESS_DENIED     The transmit completion token with the same Token.Event
456                                  was already in the transmit queue.
457   @retval  EFI_NOT_READY         The completion token could not be queued because the transmit
458                                  queue is full.
459   @retval  EFI_NOT_FOUND         Not route is found to destination address.
460   @retval  EFI_OUT_OF_RESOURCES  Could not queue the transmit data.
461   @retval  EFI_BUFFER_TOO_SMALL  Token.Packet.TxData.TotalDataLength is too
462                                  short to transmit.
463   @retval  EFI_BAD_BUFFER_SIZE   The length of the IPv4 header + option length + total data length is
464                                  greater than MTU (or greater than the maximum packet size if
465                                  Token.Packet.TxData.OverrideData.
466                                  DoNotFragment is TRUE.)
467 
468 **/
469 typedef
470 EFI_STATUS
471 (EFIAPI *EFI_IP4_TRANSMIT)(
472   IN EFI_IP4_PROTOCOL          *This,
473   IN EFI_IP4_COMPLETION_TOKEN  *Token
474   );
475 
476 /**
477   Places a receiving request into the receiving queue.
478 
479   The Receive() function places a completion token into the receive packet queue.
480   This function is always asynchronous.
481 
482   The Token.Event field in the completion token must be filled in by the caller
483   and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
484   driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
485   is signaled.
486 
487   @param  This  The pointer to the EFI_IP4_PROTOCOL instance.
488   @param  Token The pointer to a token that is associated with the receive data descriptor.
489 
490   @retval EFI_SUCCESS           The receive completion token was cached.
491   @retval EFI_NOT_STARTED       This EFI IPv4 Protocol instance has not been started.
492   @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
493                                 is not finished yet.
494   @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
495                                 - This is NULL.
496                                 - Token is NULL.
497                                 - Token.Event is NULL.
498   @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system
499                                 resources (usually memory).
500   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
501                                 The EFI IPv4 Protocol instance has been reset to startup defaults.
502   @retval EFI_ACCESS_DENIED     The receive completion token with the same Token.Event was already
503                                 in the receive queue.
504   @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.
505   @retval EFI_ICMP_ERROR        An ICMP error packet was received.
506 
507 **/
508 typedef
509 EFI_STATUS
510 (EFIAPI *EFI_IP4_RECEIVE)(
511   IN EFI_IP4_PROTOCOL          *This,
512   IN EFI_IP4_COMPLETION_TOKEN  *Token
513   );
514 
515 /**
516   Abort an asynchronous transmit or receive request.
517 
518   The Cancel() function is used to abort a pending transmit or receive request.
519   If the token is in the transmit or receive request queues, after calling this
520   function, Token->Status will be set to EFI_ABORTED and then Token->Event will
521   be signaled. If the token is not in one of the queues, which usually means the
522   asynchronous operation has completed, this function will not signal the token
523   and EFI_NOT_FOUND is returned.
524 
525   @param  This  The pointer to the EFI_IP4_PROTOCOL instance.
526   @param  Token The pointer to a token that has been issued by
527                 EFI_IP4_PROTOCOL.Transmit() or
528                 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
529                 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
530                 defined in EFI_IP4_PROTOCOL.Transmit().
531 
532   @retval EFI_SUCCESS           The asynchronous I/O request was aborted and
533                                 Token->Event was signaled. When Token is NULL, all
534                                 pending requests were aborted and their events were signaled.
535   @retval EFI_INVALID_PARAMETER This is NULL.
536   @retval EFI_NOT_STARTED       This instance has not been started.
537   @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,
538                                 RARP, etc.) is not finished yet.
539   @retval EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was
540                                 not found in the transmit or receive queue. It has either completed
541                                 or was not issued by Transmit() and Receive().
542 
543 **/
544 typedef
545 EFI_STATUS
546 (EFIAPI *EFI_IP4_CANCEL)(
547   IN EFI_IP4_PROTOCOL          *This,
548   IN EFI_IP4_COMPLETION_TOKEN  *Token OPTIONAL
549   );
550 
551 /**
552   Polls for incoming data packets and processes outgoing data packets.
553 
554   The Poll() function polls for incoming data packets and processes outgoing data
555   packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
556   function to increase the rate that data packets are moved between the communications
557   device and the transmit and receive queues.
558 
559   In some systems the periodic timer event may not poll the underlying communications
560   device fast enough to transmit and/or receive all data packets without missing
561   incoming packets or dropping outgoing packets. Drivers and applications that are
562   experiencing packet loss should try calling the EFI_IP4_PROTOCOL.Poll() function
563   more often.
564 
565   @param  This The pointer to the EFI_IP4_PROTOCOL instance.
566 
567   @retval  EFI_SUCCESS           Incoming or outgoing data was processed.
568   @retval  EFI_NOT_STARTED       This EFI IPv4 Protocol instance has not been started.
569   @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,
570                                  RARP, etc.) is not finished yet.
571   @retval  EFI_INVALID_PARAMETER This is NULL.
572   @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.
573   @retval  EFI_NOT_READY         No incoming or outgoing data is processed.
574   @retval  EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.
575                                  Consider increasing the polling rate.
576 
577 **/
578 typedef
579 EFI_STATUS
580 (EFIAPI *EFI_IP4_POLL)(
581   IN EFI_IP4_PROTOCOL          *This
582   );
583 
584 ///
585 /// The EFI IPv4 Protocol implements a simple packet-oriented interface that can be
586 /// used by drivers, daemons, and applications to transmit and receive network packets.
587 ///
588 struct _EFI_IP4_PROTOCOL {
589   EFI_IP4_GET_MODE_DATA    GetModeData;
590   EFI_IP4_CONFIGURE        Configure;
591   EFI_IP4_GROUPS           Groups;
592   EFI_IP4_ROUTES           Routes;
593   EFI_IP4_TRANSMIT         Transmit;
594   EFI_IP4_RECEIVE          Receive;
595   EFI_IP4_CANCEL           Cancel;
596   EFI_IP4_POLL             Poll;
597 };
598 
599 extern EFI_GUID  gEfiIp4ServiceBindingProtocolGuid;
600 extern EFI_GUID  gEfiIp4ProtocolGuid;
601 
602 #endif
603