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