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