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