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