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