]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Include/Library/IpIoLib.h
NetworkPkg: Move Network library header file from MdeModulePkg to NetworkPkg
[mirror_edk2.git] / NetworkPkg / Include / Library / IpIoLib.h
CommitLineData
97b38d4e 1/** @file\r
fb115c61 2 This library is only intended to be used by UEFI network stack modules.\r
3 It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 protocol.\r
97b38d4e 4\r
d1102dba 5Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
97b38d4e 7\r
8**/\r
9\r
10#ifndef _IP_IO_H_\r
11#define _IP_IO_H_\r
12\r
13#include <Protocol/Ip4.h>\r
fb115c61 14#include <Protocol/Ip6.h>\r
cdfdbb97 15\r
97b38d4e 16#include <Library/NetLib.h>\r
17\r
18//\r
d1102dba 19// type and code define for ICMP protocol error\r
97b38d4e 20// from IP\r
21//\r
22#define ICMP_TYPE_UNREACH 3\r
cdfdbb97 23#define ICMP_TYPE_TIMXCEED 11\r
97b38d4e 24#define ICMP_TYPE_PARAMPROB 12\r
25#define ICMP_TYPE_SOURCEQUENCH 4\r
26\r
27#define ICMP_CODE_UNREACH_NET 0\r
28#define ICMP_CODE_UNREACH_HOST 1\r
29#define ICMP_CODE_UNREACH_PROTOCOL 2\r
30#define ICMP_CODE_UNREACH_PORT 3\r
31#define ICMP_CODE_UNREACH_NEEDFRAG 4\r
32#define ICMP_CODE_UNREACH_SRCFAIL 5\r
33#define ICMP_CODE_UNREACH_NET_UNKNOWN 6\r
34#define ICMP_CODE_UNREACH_HOST_UNKNOWN 7\r
35#define ICMP_CODE_UNREACH_ISOLATED 8\r
36#define ICMP_CODE_UNREACH_NET_PROHIB 9\r
37#define ICMP_CODE_UNREACH_HOST_PROHIB 10\r
38#define ICMP_CODE_UNREACH_TOSNET 11\r
39#define ICMP_CODE_UNREACH_TOSHOST 12\r
40\r
cdfdbb97 41/**\r
e9b67286 42 Get the IP header length from the struct EFI_IP4_HEADER. HeaderLength is\r
cdfdbb97 43 Internet header length in 32-bit words, so HeaderLength<<2 is the real\r
44 length of IP header.\r
d1102dba 45\r
64a80549 46 @param[out] HdrPtr A pointer to EFI_IP4_HEADER.\r
d1102dba 47\r
64a80549 48 @return The IP header length.\r
cdfdbb97 49**/\r
50#define EFI_IP4_HEADER_LEN(HdrPtr) ((HdrPtr)->HeaderLength << 2)\r
51\r
52/**\r
d1102dba
LG
53 To types of ICMP error which consist of ICMP header, IP header and original\r
54 datagram's data, get length from sum of ICMP header length, IP header length\r
cdfdbb97 55 and first 64 bits of datagram's data length.\r
d1102dba 56\r
64a80549 57 @param[in] IpHdr A pointer to EFI_IP4_HEADER.\r
d1102dba 58\r
64a80549 59 @return The ICMP error length.\r
cdfdbb97 60**/\r
61#define ICMP_ERRLEN(IpHdr) \\r
62 (sizeof(IP4_ICMP_HEAD) + EFI_IP4_HEADER_LEN(IpHdr) + 8)\r
63\r
64/**\r
65 Get the packet header from NET_BUF.\r
d1102dba 66\r
64a80549 67 @param[out] Buf A pointer to NET_BUF.\r
68 @param[in] Type Header type.\r
d1102dba 69\r
64a80549 70 @return The pointer to packet header.\r
cdfdbb97 71**/\r
72#define NET_PROTO_HDR(Buf, Type) ((Type *) ((Buf)->BlockOp[0].Head))\r
73\r
d1102dba 74\r
fb115c61 75extern EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData;\r
76extern EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData;\r
77\r
cdfdbb97 78\r
e29a2e7e 79///\r
80/// This error will be delivered to the\r
81/// listening transportation layer protocol\r
82/// that consumes IpIO.\r
83///\r
b45b45b2 84\r
85#define ICMP_ERR_UNREACH_NET 0\r
86#define ICMP_ERR_UNREACH_HOST 1\r
87#define ICMP_ERR_UNREACH_PROTOCOL 2\r
88#define ICMP_ERR_UNREACH_PORT 3\r
89#define ICMP_ERR_MSGSIZE 4\r
90#define ICMP_ERR_UNREACH_SRCFAIL 5\r
91#define ICMP_ERR_TIMXCEED_INTRANS 6\r
92#define ICMP_ERR_TIMXCEED_REASS 7\r
93#define ICMP_ERR_QUENCH 8\r
94#define ICMP_ERR_PARAMPROB 9\r
95\r
96#define ICMP6_ERR_UNREACH_NET 0\r
97#define ICMP6_ERR_UNREACH_HOST 1\r
98#define ICMP6_ERR_UNREACH_PROTOCOL 2\r
99#define ICMP6_ERR_UNREACH_PORT 3\r
100#define ICMP6_ERR_PACKAGE_TOOBIG 4\r
101#define ICMP6_ERR_TIMXCEED_HOPLIMIT 5\r
102#define ICMP6_ERR_TIMXCEED_REASS 6\r
103#define ICMP6_ERR_PARAMPROB_HEADER 7\r
104#define ICMP6_ERR_PARAMPROB_NEXHEADER 8\r
105#define ICMP6_ERR_PARAMPROB_IPV6OPTION 9\r
fb115c61 106\r
e29a2e7e 107///\r
e9b67286 108/// The helper struct for IpIoGetIcmpErrStatus(). It is for internal use only.\r
e29a2e7e 109///\r
cdfdbb97 110typedef struct {\r
fb115c61 111 BOOLEAN IsHard;\r
112 BOOLEAN Notify;\r
97b38d4e 113} ICMP_ERROR_INFO;\r
114\r
fb115c61 115typedef union {\r
116 EFI_IP4_COMPLETION_TOKEN Ip4Token;\r
117 EFI_IP6_COMPLETION_TOKEN Ip6Token;\r
118} IP_IO_IP_COMPLETION_TOKEN;\r
119\r
120typedef union {\r
121 EFI_IP4_TRANSMIT_DATA Ip4TxData;\r
122 EFI_IP6_TRANSMIT_DATA Ip6TxData;\r
123} IP_IO_IP_TX_DATA;\r
124\r
125typedef union {\r
126 EFI_IP4_RECEIVE_DATA Ip4RxData;\r
127 EFI_IP6_RECEIVE_DATA Ip6RxData;\r
128} IP_IO_IP_RX_DATA;\r
129\r
130typedef union {\r
131 EFI_IP4_OVERRIDE_DATA Ip4OverrideData;\r
132 EFI_IP6_OVERRIDE_DATA Ip6OverrideData;\r
133} IP_IO_OVERRIDE;\r
134\r
135typedef union {\r
136 EFI_IP4_CONFIG_DATA Ip4CfgData;\r
137 EFI_IP6_CONFIG_DATA Ip6CfgData;\r
138} IP_IO_IP_CONFIG_DATA;\r
139\r
b45b45b2 140typedef union {\r
141 EFI_IP4_HEADER *Ip4Hdr;\r
142 EFI_IP6_HEADER *Ip6Hdr;\r
143} IP_IO_IP_HEADER;\r
144\r
145typedef union {\r
146 IP4_ADDR SubnetMask;\r
147 UINT8 PrefixLength;\r
148} IP_IO_IP_MASK;\r
149\r
2a2e33b2 150typedef union {\r
151 EFI_IP4_PROTOCOL *Ip4;\r
152 EFI_IP6_PROTOCOL *Ip6;\r
153} IP_IO_IP_PROTOCOL;\r
154\r
e29a2e7e 155///\r
156/// The IP session for an IP receive packet.\r
157///\r
97b38d4e 158typedef struct _EFI_NET_SESSION_DATA {\r
64a80549 159 EFI_IP_ADDRESS Source; ///< Source IP of the received packet.\r
160 EFI_IP_ADDRESS Dest; ///< Destination IP of the received packet.\r
161 IP_IO_IP_HEADER IpHdr; ///< IP header of the received packet.\r
d1102dba
LG
162 UINT32 IpHdrLen; ///< IP header length of the received packet.\r
163 ///< For IPv6, it includes the IP6 header\r
a09ee46d 164 ///< length and extension header length. For\r
165 ///< IPv4, it includes the IP4 header length\r
166 ///< and options length.\r
64a80549 167 UINT8 IpVersion; ///< The IP version of the received packet.\r
97b38d4e 168} EFI_NET_SESSION_DATA;\r
169\r
e29a2e7e 170/**\r
171 The prototype is called back when an IP packet is received.\r
d1102dba 172\r
64a80549 173 @param[in] Status The result of the receive request.\r
174 @param[in] IcmpErr Valid when Status is EFI_ICMP_ERROR.\r
175 @param[in] NetSession The IP session for the received packet.\r
176 @param[in] Pkt The packet received.\r
e9b67286 177 @param[in] Context The data provided by the user for the received packet when\r
cdfdbb97 178 the callback is registered in IP_IO_OPEN_DATA::RcvdContext.\r
d1102dba 179\r
e29a2e7e 180**/\r
97b38d4e 181typedef\r
182VOID\r
e798cd87 183(EFIAPI *PKT_RCVD_NOTIFY) (\r
d1102dba 184 IN EFI_STATUS Status,\r
b45b45b2 185 IN UINT8 IcmpErr,\r
e29a2e7e 186 IN EFI_NET_SESSION_DATA *NetSession,\r
187 IN NET_BUF *Pkt,\r
188 IN VOID *Context\r
97b38d4e 189 );\r
190\r
e29a2e7e 191/**\r
192 The prototype is called back when an IP packet is sent.\r
d1102dba 193\r
64a80549 194 @param[in] Status Result of the IP packet being sent.\r
cdfdbb97 195 @param[in] Context The data provided by user for the received packet when\r
196 the callback is registered in IP_IO_OPEN_DATA::SndContext.\r
d1102dba 197 @param[in] Sender A Union type to specify a pointer of EFI_IP4_PROTOCOL\r
2a2e33b2 198 or EFI_IP6_PROTOCOL.\r
64a80549 199 @param[in] NotifyData The Context data specified when calling IpIoSend()\r
d1102dba 200\r
e29a2e7e 201**/\r
97b38d4e 202typedef\r
203VOID\r
e798cd87 204(EFIAPI *PKT_SENT_NOTIFY) (\r
2a2e33b2 205 IN EFI_STATUS Status,\r
206 IN VOID *Context,\r
207 IN IP_IO_IP_PROTOCOL Sender,\r
208 IN VOID *NotifyData\r
97b38d4e 209 );\r
210\r
e29a2e7e 211///\r
fb115c61 212/// This data structure wraps Ip4/Ip6 instances. The IpIo Library uses it for all\r
213/// Ip4/Ip6 operations.\r
e29a2e7e 214///\r
97b38d4e 215typedef struct _IP_IO {\r
e29a2e7e 216 ///\r
217 /// The node used to link this IpIo to the active IpIo list.\r
218 ///\r
97b38d4e 219 LIST_ENTRY Entry;\r
220\r
e29a2e7e 221 ///\r
222 /// The list used to maintain the IP instance for different sending purpose.\r
223 ///\r
97b38d4e 224 LIST_ENTRY IpList;\r
d1102dba 225\r
97b38d4e 226 EFI_HANDLE Controller;\r
227 EFI_HANDLE Image;\r
228 EFI_HANDLE ChildHandle;\r
e29a2e7e 229 //\r
230 // The IP instance consumed by this IP_IO\r
231 //\r
2a2e33b2 232 IP_IO_IP_PROTOCOL Ip;\r
97b38d4e 233 BOOLEAN IsConfigured;\r
234\r
e29a2e7e 235 ///\r
64a80549 236 /// Some ip configuration data can be changed.\r
e29a2e7e 237 ///\r
97b38d4e 238 UINT8 Protocol;\r
239\r
e29a2e7e 240 ///\r
64a80549 241 /// Token and event used to get data from IP.\r
e29a2e7e 242 ///\r
d1102dba 243 IP_IO_IP_COMPLETION_TOKEN RcvToken;\r
97b38d4e 244\r
e29a2e7e 245 ///\r
64a80549 246 /// List entry used to link the token passed to IP_IO.\r
e29a2e7e 247 ///\r
97b38d4e 248 LIST_ENTRY PendingSndList;\r
249\r
250 //\r
251 // User interface used to get notify from IP_IO\r
252 //\r
64a80549 253 VOID *RcvdContext; ///< See IP_IO_OPEN_DATA::RcvdContext.\r
254 VOID *SndContext; ///< See IP_IO_OPEN_DATA::SndContext.\r
255 PKT_RCVD_NOTIFY PktRcvdNotify; ///< See IP_IO_OPEN_DATA::PktRcvdNotify.\r
256 PKT_SENT_NOTIFY PktSentNotify; ///< See IP_IO_OPEN_DATA::PktSentNotify.\r
b45b45b2 257 UINT8 IpVersion;\r
01b5ac88
FS
258 IP4_ADDR StationIp;\r
259 IP4_ADDR SubnetMask;\r
97b38d4e 260} IP_IO;\r
261\r
e29a2e7e 262///\r
e9b67286 263/// The struct is for the user to pass IP configuration and callbacks to IP_IO.\r
e29a2e7e 264/// It is used by IpIoOpen().\r
265///\r
97b38d4e 266typedef struct _IP_IO_OPEN_DATA {\r
64a80549 267 IP_IO_IP_CONFIG_DATA IpConfigData; ///< Configuration of the IP instance.\r
268 VOID *RcvdContext; ///< Context data used by receive callback.\r
269 VOID *SndContext; ///< Context data used by send callback.\r
270 PKT_RCVD_NOTIFY PktRcvdNotify; ///< Receive callback.\r
271 PKT_SENT_NOTIFY PktSentNotify; ///< Send callback.\r
97b38d4e 272} IP_IO_OPEN_DATA;\r
273\r
e29a2e7e 274///\r
275/// Internal struct book-keeping send request of IP_IO.\r
276///\r
277/// An IP_IO_SEND_ENTRY will be created each time a send request is issued to\r
278/// IP_IO via IpIoSend().\r
279///\r
97b38d4e 280typedef struct _IP_IO_SEND_ENTRY {\r
281 LIST_ENTRY Entry;\r
282 IP_IO *IpIo;\r
283 VOID *Context;\r
284 VOID *NotifyData;\r
2a2e33b2 285 IP_IO_IP_PROTOCOL Ip;\r
97b38d4e 286 NET_BUF *Pkt;\r
fb115c61 287 IP_IO_IP_COMPLETION_TOKEN SndToken;\r
97b38d4e 288} IP_IO_SEND_ENTRY;\r
289\r
e29a2e7e 290///\r
291/// The IP_IO_IP_INFO is used in IpIoSend() to override the default IP instance\r
292/// in IP_IO.\r
293///\r
97b38d4e 294typedef struct _IP_IO_IP_INFO {\r
fb115c61 295 EFI_IP_ADDRESS Addr;\r
b45b45b2 296 IP_IO_IP_MASK PreMask;\r
97b38d4e 297 LIST_ENTRY Entry;\r
298 EFI_HANDLE ChildHandle;\r
2a2e33b2 299 IP_IO_IP_PROTOCOL Ip;\r
fb115c61 300 IP_IO_IP_COMPLETION_TOKEN DummyRcvToken;\r
97b38d4e 301 INTN RefCnt;\r
b45b45b2 302 UINT8 IpVersion;\r
97b38d4e 303} IP_IO_IP_INFO;\r
304\r
305/**\r
306 Create a new IP_IO instance.\r
2b208747
WF
307\r
308 If IpVersion is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
d1102dba 309\r
fb115c61 310 This function uses IP4/IP6 service binding protocol in Controller to create\r
311 an IP4/IP6 child (aka IP4/IP6 instance).\r
97b38d4e 312\r
cdfdbb97 313 @param[in] Image The image handle of the driver or application that\r
e29a2e7e 314 consumes IP_IO.\r
fb115c61 315 @param[in] Controller The controller handle that has IP4 or IP6 service\r
316 binding protocol installed.\r
317 @param[in] IpVersion The version of the IP protocol to use, either\r
d1102dba 318 IPv4 or IPv6.\r
97b38d4e 319\r
64a80549 320 @return The pointer to a newly created IP_IO instance, or NULL if failed.\r
97b38d4e 321\r
322**/\r
323IP_IO *\r
324EFIAPI\r
325IpIoCreate (\r
326 IN EFI_HANDLE Image,\r
fb115c61 327 IN EFI_HANDLE Controller,\r
b45b45b2 328 IN UINT8 IpVersion\r
97b38d4e 329 );\r
330\r
331/**\r
332 Destroy an IP_IO instance.\r
d1102dba 333\r
e29a2e7e 334 This function is paired with IpIoCreate(). The IP_IO will be closed first.\r
335 Resource will be freed afterwards. See IpIoClose().\r
97b38d4e 336\r
64a80549 337 @param[in, out] IpIo The pointer to the IP_IO instance that needs to be\r
e29a2e7e 338 destroyed.\r
97b38d4e 339\r
64a80549 340 @retval EFI_SUCCESS The IP_IO instance was destroyed successfully.\r
341 @retval Others An error condition occurred.\r
97b38d4e 342\r
343**/\r
344EFI_STATUS\r
345EFIAPI\r
346IpIoDestroy (\r
cdfdbb97 347 IN OUT IP_IO *IpIo\r
97b38d4e 348 );\r
349\r
350/**\r
351 Stop an IP_IO instance.\r
2b208747
WF
352\r
353 If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
d1102dba 354\r
e9b67286 355 This function is paired with IpIoOpen(). The IP_IO will be unconfigured, and all\r
356 pending send/receive tokens will be canceled.\r
97b38d4e 357\r
64a80549 358 @param[in, out] IpIo The pointer to the IP_IO instance that needs to stop.\r
97b38d4e 359\r
6ccfeec2
FS
360 @retval EFI_SUCCESS The IP_IO instance stopped successfully.\r
361 @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
362 @retval Others Anrror condition occurred.\r
97b38d4e 363\r
364**/\r
365EFI_STATUS\r
366EFIAPI\r
367IpIoStop (\r
cdfdbb97 368 IN OUT IP_IO *IpIo\r
97b38d4e 369 );\r
370\r
371/**\r
372 Open an IP_IO instance for use.\r
2b208747
WF
373\r
374 If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
375\r
e29a2e7e 376 This function is called after IpIoCreate(). It is used for configuring the IP\r
377 instance and register the callbacks and their context data for sending and\r
378 receiving IP packets.\r
97b38d4e 379\r
64a80549 380 @param[in, out] IpIo The pointer to an IP_IO instance that needs\r
cdfdbb97 381 to open.\r
382 @param[in] OpenData The configuration data and callbacks for\r
383 the IP_IO instance.\r
97b38d4e 384\r
6ccfeec2
FS
385 @retval EFI_SUCCESS The IP_IO instance opened with OpenData\r
386 successfully.\r
d1102dba 387 @retval EFI_ACCESS_DENIED The IP_IO instance is configured, avoid to\r
6ccfeec2
FS
388 reopen it.\r
389 @retval EFI_UNSUPPORTED IPv4 RawData mode is no supported.\r
390 @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
391 @retval Others Error condition occurred.\r
97b38d4e 392\r
393**/\r
394EFI_STATUS\r
e29a2e7e 395EFIAPI\r
97b38d4e 396IpIoOpen (\r
cdfdbb97 397 IN OUT IP_IO *IpIo,\r
398 IN IP_IO_OPEN_DATA *OpenData\r
97b38d4e 399 );\r
400\r
401/**\r
402 Send out an IP packet.\r
d1102dba 403\r
2b208747 404 This function is called after IpIoOpen(). The data to be sent is wrapped in\r
8569a87e
FS
405 Pkt. The IP instance wrapped in IpIo is used for sending by default but can be\r
406 overriden by Sender. Other sending configs, like source address and gateway\r
407 address etc., are specified in OverrideData.\r
97b38d4e 408\r
8569a87e 409 @param[in, out] IpIo Pointer to an IP_IO instance used for sending IP\r
cdfdbb97 410 packet.\r
8569a87e
FS
411 @param[in, out] Pkt Pointer to the IP packet to be sent.\r
412 @param[in] Sender The IP protocol instance used for sending.\r
413 @param[in] Context Optional context data.\r
414 @param[in] NotifyData Optional notify data.\r
cdfdbb97 415 @param[in] Dest The destination IP address to send this packet to.\r
8569a87e 416 This parameter is optional when using IPv6.\r
cdfdbb97 417 @param[in] OverrideData The data to override some configuration of the IP\r
418 instance used for sending.\r
97b38d4e 419\r
8569a87e
FS
420 @retval EFI_SUCCESS The operation is completed successfully.\r
421 @retval EFI_INVALID_PARAMETER The input parameter is not correct.\r
cdfdbb97 422 @retval EFI_NOT_STARTED The IpIo is not configured.\r
8569a87e 423 @retval EFI_OUT_OF_RESOURCES Failed due to resource limit.\r
6dbfed92 424 @retval Others Error condition occurred.\r
97b38d4e 425\r
426**/\r
427EFI_STATUS\r
428EFIAPI\r
429IpIoSend (\r
cdfdbb97 430 IN OUT IP_IO *IpIo,\r
431 IN OUT NET_BUF *Pkt,\r
432 IN IP_IO_IP_INFO *Sender OPTIONAL,\r
433 IN VOID *Context OPTIONAL,\r
434 IN VOID *NotifyData OPTIONAL,\r
c167ef91 435 IN EFI_IP_ADDRESS *Dest OPTIONAL,\r
cdfdbb97 436 IN IP_IO_OVERRIDE *OverrideData OPTIONAL\r
97b38d4e 437 );\r
438\r
439/**\r
64a80549 440 Cancel the IP transmit token that wraps this Packet.\r
97b38d4e 441\r
2b208747
WF
442 If IpIo is NULL, then ASSERT().\r
443 If Packet is NULL, then ASSERT().\r
444\r
64a80549 445 @param[in] IpIo The pointer to the IP_IO instance.\r
446 @param[in] Packet The pointer to the packet of NET_BUF to cancel.\r
97b38d4e 447\r
448**/\r
449VOID\r
450EFIAPI\r
451IpIoCancelTxToken (\r
452 IN IP_IO *IpIo,\r
453 IN VOID *Packet\r
454 );\r
455\r
456/**\r
457 Add a new IP instance for sending data.\r
2b208747
WF
458\r
459 If IpIo is NULL, then ASSERT().\r
460 If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
d1102dba 461\r
e29a2e7e 462 The function is used to add the IP_IO to the IP_IO sending list. The caller\r
463 can later use IpIoFindSender() to get the IP_IO and call IpIoSend() to send\r
464 data.\r
97b38d4e 465\r
64a80549 466 @param[in, out] IpIo The pointer to an IP_IO instance to add a new IP\r
e9b67286 467 instance for sending purposes.\r
97b38d4e 468\r
64a80549 469 @return The pointer to the created IP_IO_IP_INFO structure; NULL if failed.\r
97b38d4e 470\r
471**/\r
472IP_IO_IP_INFO *\r
473EFIAPI\r
474IpIoAddIp (\r
cdfdbb97 475 IN OUT IP_IO *IpIo\r
97b38d4e 476 );\r
477\r
478/**\r
fb115c61 479 Configure the IP instance of this IpInfo and start the receiving if IpConfigData\r
97b38d4e 480 is not NULL.\r
481\r
2b208747
WF
482 If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
483\r
64a80549 484 @param[in, out] IpInfo The pointer to the IP_IO_IP_INFO instance.\r
d1102dba 485 @param[in, out] IpConfigData The IP4 or IP6 configure data used to configure\r
fb115c61 486 the IP instance. If NULL, the IP instance is reset.\r
487 If UseDefaultAddress is set to TRUE, and the configure\r
cdfdbb97 488 operation succeeds, the default address information\r
fb115c61 489 is written back in this IpConfigData.\r
97b38d4e 490\r
64a80549 491 @retval EFI_SUCCESS The IP instance of this IpInfo was configured successfully,\r
e9b67286 492 or there is no need to reconfigure it.\r
64a80549 493 @retval Others The configuration failed.\r
97b38d4e 494\r
495**/\r
496EFI_STATUS\r
497EFIAPI\r
498IpIoConfigIp (\r
cdfdbb97 499 IN OUT IP_IO_IP_INFO *IpInfo,\r
fb115c61 500 IN OUT VOID *IpConfigData OPTIONAL\r
97b38d4e 501 );\r
502\r
503/**\r
504 Destroy an IP instance maintained in IpIo->IpList for\r
505 sending purpose.\r
2b208747 506\r
d1102dba
LG
507 If Ip version is not IP_VERSION_4 or IP_VERSION_6, then ASSERT().\r
508\r
e29a2e7e 509 This function pairs with IpIoAddIp(). The IpInfo is previously created by\r
510 IpIoAddIp(). The IP_IO_IP_INFO::RefCnt is decremented and the IP instance\r
511 will be dstroyed if the RefCnt is zero.\r
97b38d4e 512\r
64a80549 513 @param[in] IpIo The pointer to the IP_IO instance.\r
514 @param[in] IpInfo The pointer to the IpInfo to be removed.\r
97b38d4e 515\r
97b38d4e 516**/\r
517VOID\r
518EFIAPI\r
519IpIoRemoveIp (\r
520 IN IP_IO *IpIo,\r
521 IN IP_IO_IP_INFO *IpInfo\r
522 );\r
523\r
524/**\r
525 Find the first IP protocol maintained in IpIo whose local\r
e9b67286 526 address is the same as Src.\r
d1102dba 527\r
e29a2e7e 528 This function is called when the caller needs the IpIo to send data to the\r
529 specified Src. The IpIo was added previously by IpIoAddIp().\r
97b38d4e 530\r
64a80549 531 @param[in, out] IpIo The pointer to the pointer of the IP_IO instance.\r
fb115c61 532 @param[in] IpVersion The version of the IP protocol to use, either\r
533 IPv4 or IPv6.\r
cdfdbb97 534 @param[in] Src The local IP address.\r
97b38d4e 535\r
64a80549 536 @return The pointer to the IP protocol can be used for sending purpose and its local\r
6ccfeec2 537 address is the same with Src. NULL if failed.\r
97b38d4e 538\r
539**/\r
540IP_IO_IP_INFO *\r
541EFIAPI\r
542IpIoFindSender (\r
fb115c61 543 IN OUT IP_IO **IpIo,\r
b45b45b2 544 IN UINT8 IpVersion,\r
fb115c61 545 IN EFI_IP_ADDRESS *Src\r
97b38d4e 546 );\r
547\r
548/**\r
e29a2e7e 549 Get the ICMP error map information.\r
d1102dba 550\r
e29a2e7e 551 The ErrorStatus will be returned. The IsHard and Notify are optional. If they\r
552 are not NULL, this routine will fill them.\r
97b38d4e 553\r
3a1ab4bc 554 @param[in] IcmpError IcmpError Type.\r
fb115c61 555 @param[in] IpVersion The version of the IP protocol to use,\r
d1102dba 556 either IPv4 or IPv6.\r
3b1464d5 557 @param[out] IsHard If TRUE, indicates that it is a hard error.\r
558 @param[out] Notify If TRUE, SockError needs to be notified.\r
97b38d4e 559\r
6dbfed92 560 @retval EFI_UNSUPPORTED Unrecognizable ICMP error code\r
64a80549 561 @return The ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.\r
97b38d4e 562\r
563**/\r
564EFI_STATUS\r
565EFIAPI\r
566IpIoGetIcmpErrStatus (\r
b45b45b2 567 IN UINT8 IcmpError,\r
568 IN UINT8 IpVersion,\r
e29a2e7e 569 OUT BOOLEAN *IsHard OPTIONAL,\r
570 OUT BOOLEAN *Notify OPTIONAL\r
97b38d4e 571 );\r
572\r
fb115c61 573/**\r
574 Refresh the remote peer's Neighbor Cache entries.\r
575\r
576 This function is called when the caller needs the IpIo to refresh the existing\r
d1102dba
LG
577 IPv6 neighbor cache entries since the neighbor is considered reachable by the\r
578 node has recently received a confirmation that packets sent recently to the\r
579 neighbor were received by its IP layer.\r
fb115c61 580\r
64a80549 581 @param[in] IpIo The pointer to an IP_IO instance\r
fb115c61 582 @param[in] Neighbor The IP address of the neighbor\r
64a80549 583 @param[in] Timeout The time in 100-ns units that this entry will\r
d1102dba
LG
584 remain in the neighbor cache. A value of\r
585 zero means that the entry is permanent.\r
586 A value of non-zero means that the entry is\r
fb115c61 587 dynamic and will be deleted after Timeout.\r
588\r
64a80549 589 @retval EFI_SUCCESS The operation completed successfully.\r
fb115c61 590 @retval EFI_NOT_STARTED The IpIo is not configured.\r
64a80549 591 @retval EFI_INVALID_PARAMETER The Neighbor Address is invalid.\r
d1102dba
LG
592 @retval EFI_NOT_FOUND The neighbor cache entry is not in the\r
593 neighbor table.\r
6dbfed92 594 @retval EFI_UNSUPPORTED IP version is IPv4, which doesn't support neighbor cache refresh.\r
64a80549 595 @retval EFI_OUT_OF_RESOURCES Failed due to resource limitations.\r
fb115c61 596\r
597**/\r
598EFI_STATUS\r
2b208747 599EFIAPI\r
fb115c61 600IpIoRefreshNeighbor (\r
601 IN IP_IO *IpIo,\r
602 IN EFI_IP_ADDRESS *Neighbor,\r
d1102dba 603 IN UINT32 Timeout\r
fb115c61 604 );\r
605\r
97b38d4e 606#endif\r
fb115c61 607\r