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