]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Ip6.h
Clean up MdePkg source to correct some coding style issues, etc.
[mirror_edk2.git] / MdePkg / Include / Protocol / Ip6.h
CommitLineData
bdb140d7 1/** @file\r
bdb140d7 2 This file defines the EFI IPv6 (Internet Protocol version 6)\r
3 Protocol interface. It is split into the following three main\r
4 sections:\r
5 - EFI IPv6 Service Binding Protocol\r
6 - EFI IPv6 Variable\r
7 - EFI IPv6 Protocol\r
8 The EFI IPv6 Protocol provides basic network IPv6 packet I/O services,\r
9 which includes support for Neighbor Discovery Protocol (ND), Multicast\r
10 Listener Discovery Protocol (MLD), and a subset of the Internet Control\r
11 Message Protocol (ICMPv6).\r
12 \r
ea6898b9 13 Copyright (c) 2008 - 2010, Intel Corporation \r
bdb140d7 14 All rights reserved. This program and the accompanying materials \r
15 are licensed and made available under the terms and conditions of the BSD License \r
16 which accompanies this distribution. The full text of the license may be found at \r
17 http://opensource.org/licenses/bsd-license.php \r
18\r
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
5899caf0 20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
21\r
22 @par Revision Reference: \r
23 This Protocol is introduced in UEFI Specification 2.2 \r
bdb140d7 24\r
25**/\r
26\r
27#ifndef __EFI_IP6_PROTOCOL_H__\r
28#define __EFI_IP6_PROTOCOL_H__\r
29\r
30#include <Protocol/ManagedNetwork.h>\r
31\r
32\r
33#define EFI_IP6_SERVICE_BINDING_PROTOCOL_GUID \\r
34 { \\r
35 0xec835dd3, 0xfe0f, 0x617b, {0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 } \\r
36 }\r
37\r
38#define EFI_IP6_PROTOCOL_GUID \\r
39 { \\r
40 0x2c8759d5, 0x5c2d, 0x66ef, {0x92, 0x5f, 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 } \\r
41 }\r
42\r
43typedef struct _EFI_IP6_PROTOCOL EFI_IP6_PROTOCOL;\r
44\r
abbfadd7 45///\r
46/// EFI_IP6_ADDRESS_PAIR \r
3a7afaf6 47/// which is not defined in the UEFI 2.3 Specification.\r
abbfadd7 48///\r
49typedef struct{ \r
50 ///\r
51 /// The EFI IPv6 Protocol instance handle that is using this address/prefix pair.\r
52 ///\r
53 EFI_HANDLE InstanceHandle;\r
54 ///\r
55 /// IPv6 address in network byte order.\r
56 ///\r
57 EFI_IPv6_ADDRESS Ip6Address;\r
58 ///\r
59 /// The length of the prefix associated with the Ip6Address.\r
60 ///\r
61 UINT8 PrefixLength;\r
62} EFI_IP6_ADDRESS_PAIR; \r
63\r
64///\r
65/// EFI_IP6_VARIABLE_DATA\r
3a7afaf6 66/// which is not defined in the UEFI 2.3 Specification.\r
abbfadd7 67///\r
68typedef struct {\r
69 ///\r
70 /// The handle of the driver that creates this entry.\r
71 ///\r
72 EFI_HANDLE DriverHandle;\r
73 ///\r
74 /// The number of IPv6 address pairs that follow this data structure.\r
75 ///\r
76 UINT32 AddressCount;\r
77 ///\r
78 /// List of IPv6 address pairs that are currently in use.\r
79 ///\r
80 EFI_IP6_ADDRESS_PAIR AddressPairs[1];\r
81} EFI_IP6_VARIABLE_DATA;\r
82\r
bdb140d7 83///\r
84/// ICMPv6 type definitions for error messages\r
85///\r
86///@{\r
87#define ICMP_V6_DEST_UNREACHABLE 0x1\r
88#define ICMP_V6_PACKET_TOO_BIG 0x2\r
89#define ICMP_V6_TIME_EXCEEDED 0x3\r
90#define ICMP_V6_PARAMETER_PROBLEM 0x4\r
91///@}\r
92\r
93///\r
94/// ICMPv6 type definition for informational messages\r
95///\r
96///@{\r
97#define ICMP_V6_ECHO_REQUEST 0x80\r
98#define ICMP_V6_ECHO_REPLY 0x81\r
99#define ICMP_V6_LISTENER_QUERY 0x82\r
100#define ICMP_V6_LISTENER_REPORT 0x83\r
101#define ICMP_V6_LISTENER_DONE 0x84\r
102#define ICMP_V6_ROUTER_SOLICIT 0x85\r
103#define ICMP_V6_ROUTER_ADVERTISE 0x86\r
104#define ICMP_V6_NEIGHBOR_SOLICIT 0x87\r
105#define ICMP_V6_NEIGHBOR_ADVERTISE 0x88\r
106#define ICMP_V6_REDIRECT 0x89\r
107#define ICMP_V6_LISTENER_REPORT_2 0x8F\r
108///@}\r
109\r
110///\r
111/// ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE\r
112///\r
113///@{\r
114#define ICMP_V6_NO_ROUTE_TO_DEST 0x0\r
115#define ICMP_V6_COMM_PROHIBITED 0x1\r
116#define ICMP_V6_BEYOND_SCOPE 0x2\r
117#define ICMP_V6_ADDR_UNREACHABLE 0x3 \r
118#define ICMP_V6_PORT_UNREACHABLE 0x4\r
119#define ICMP_V6_SOURCE_ADDR_FAILED 0x5\r
120#define ICMP_V6_ROUTE_REJECTED 0x6\r
121///@}\r
122 \r
123///\r
124/// ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED\r
125///\r
126///@{\r
127#define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0\r
128#define ICMP_V6_TIMEOUT_REASSEMBLE 0x1\r
129///@}\r
130 \r
131///\r
132/// ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM\r
133///\r
134///@{\r
135#define ICMP_V6_ERRONEOUS_HEADER 0x0\r
136#define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1\r
137#define ICMP_V6_UNRECOGNIZE_OPTION 0x2\r
138///@}\r
139\r
140///\r
141/// EFI_IP6_CONFIG_DATA\r
142/// is used to report and change IPv6 session parameters.\r
143///\r
144typedef struct {\r
145 /// \r
146 /// For the IPv6 packet to send and receive, this is the default value \r
147 /// of the 'Next Header' field in the last IPv6 extension header or in \r
148 /// the IPv6 header if there are no extension headers. Ignored when \r
149 /// AcceptPromiscuous is TRUE.\r
150 /// \r
151 UINT8 DefaultProtocol;\r
152 /// \r
153 /// Set to TRUE to receive all IPv6 packets that get through the \r
154 /// receive filters. \r
155 /// Set to FALSE to receive only the DefaultProtocol IPv6 \r
156 /// packets that get through the receive filters. Ignored when \r
157 /// AcceptPromiscuous is TRUE.\r
158 /// \r
159 BOOLEAN AcceptAnyProtocol;\r
160 /// \r
161 /// Set to TRUE to receive ICMP error report packets. Ignored when \r
162 /// AcceptPromiscuous or AcceptAnyProtocol is TRUE.\r
163 /// \r
164 BOOLEAN AcceptIcmpErrors;\r
165 /// \r
166 /// Set to TRUE to receive all IPv6 packets that are sent to any \r
167 /// hardware address or any protocol address. Set to FALSE to stop \r
168 /// receiving all promiscuous IPv6 packets.\r
169 /// \r
170 BOOLEAN AcceptPromiscuous;\r
171 /// \r
172 /// The destination address of the packets that will be transmitted. \r
173 /// Ignored if it is unspecified.\r
174 /// \r
175 EFI_IPv6_ADDRESS DestinationAddress;\r
176 /// \r
177 /// The station IPv6 address that will be assigned to this EFI IPv6 \r
178 /// Protocol instance. This field can be set and changed only when \r
179 /// the EFI IPv6 driver is transitioning from the stopped to the started \r
180 /// states. If the StationAddress is specified, the EFI IPv6 Protocol \r
181 /// driver will deliver only incoming IPv6 packets whose destination \r
182 /// matches this IPv6 address exactly. The StationAddress is required \r
183 /// to be one of currently configured IPv6 addresses. An address \r
184 /// containing all zeroes is also accepted as a special case. Under this \r
185 /// situation, the IPv6 driver is responsible for binding a source \r
186 /// address to this EFI IPv6 protocol instance according to the source \r
187 /// address selection algorithm. Only incoming packets destined to \r
188 /// the selected address will be delivered to the user. And the \r
189 /// selected station address can be retrieved through later \r
190 /// GetModeData() call. If no address is available for selecting, \r
191 /// EFI_NO_MAPPING will be returned, and the station address will \r
192 /// only be successfully bound to this EFI IPv6 protocol instance \r
193 /// after IP6ModeData.IsConfigured changed to TRUE.\r
194 /// \r
195 EFI_IPv6_ADDRESS StationAddress; \r
196 /// \r
197 /// TrafficClass field in transmitted IPv6 packets. Default value \r
198 /// is zero.\r
199 /// \r
200 UINT8 TrafficClass;\r
201 /// \r
202 /// HopLimit field in transmitted IPv6 packets. \r
203 /// \r
204 UINT8 HopLimit;\r
205 /// \r
206 /// FlowLabel field in transmitted IPv6 packets. Default value is \r
207 /// zero.\r
208 /// \r
209 UINT32 FlowLabel;\r
210 /// \r
211 /// The timer timeout value (number of microseconds) for the \r
212 /// receive timeout event to be associated with each assembled \r
213 /// packet. Zero means do not drop assembled packets.\r
214 /// \r
215 UINT32 ReceiveTimeout;\r
216 /// \r
217 /// The timer timeout value (number of microseconds) for the \r
218 /// transmit timeout event to be associated with each outgoing \r
219 /// packet. Zero means do not drop outgoing packets.\r
220 /// \r
221 UINT32 TransmitTimeout;\r
222} EFI_IP6_CONFIG_DATA;\r
223\r
224///\r
225/// EFI_IP6_ADDRESS_INFO\r
226///\r
227typedef struct {\r
228 EFI_IPv6_ADDRESS Address; ///< The IPv6 address.\r
229 UINT8 PrefixLength; ///< The length of the prefix associated with the Address. \r
230} EFI_IP6_ADDRESS_INFO;\r
231\r
232///\r
233/// EFI_IP6_ROUTE_TABLE\r
234/// is the entry structure that is used in routing tables\r
235/// \r
236typedef struct {\r
237 ///\r
238 /// The IPv6 address of the gateway to be used as the next hop for \r
239 /// packets to this prefix. If the IPv6 address is all zeros, then the \r
240 /// prefix is on-link.\r
241 ///\r
242 EFI_IPv6_ADDRESS Gateway; \r
243 ///\r
244 /// The destination prefix to be routed.\r
245 ///\r
246 EFI_IPv6_ADDRESS Destination; \r
247 ///\r
248 /// The length of the prefix associated with the Destination.\r
249 ///\r
250 UINT8 PrefixLength;\r
251} EFI_IP6_ROUTE_TABLE;\r
252\r
253///\r
254/// EFI_IP6_NEIGHBOR_STATE\r
255///\r
256typedef enum {\r
257 ///\r
258 /// Address resolution is being performed on this entry. Specially, \r
259 /// Neighbor Solicitation has been sent to the solicited-node \r
260 /// multicast address of the target, but corresponding Neighbor \r
261 /// Advertisement has not been received.\r
262 ///\r
263 EfiNeighborInComplete, \r
264 ///\r
265 /// Positive confirmation was received that the forward path to the \r
266 /// neighbor was functioning properly.\r
267 ///\r
268 EfiNeighborReachable,\r
269 ///\r
270 ///Reachable Time has elapsed since the last positive confirmation \r
271 ///was received. In this state, the forward path to the neighbor was \r
272 ///functioning properly.\r
273 ///\r
274 EfiNeighborStale,\r
275 ///\r
276 /// This state is an optimization that gives upper-layer protocols \r
277 /// additional time to provide reachability confirmation.\r
278 ///\r
279 EfiNeighborDelay,\r
280 ///\r
281 /// A reachability confirmation is actively sought by retransmitting \r
282 /// Neighbor Solicitations every RetransTimer milliseconds until a \r
283 /// reachability confirmation is received.\r
284 ///\r
285 EfiNeighborProbe\r
286} EFI_IP6_NEIGHBOR_STATE;\r
287\r
288///\r
289/// EFI_IP6_NEIGHBOR_CACHE\r
290/// is the entry structure that is used in neighbor cache. It records a set \r
291/// of entries about individual neighbors to which traffic has been sent recently. \r
292///\r
293typedef struct {\r
294 EFI_IPv6_ADDRESS Neighbor; ///< The on-link unicast/anycast IP address of the neighbor.\r
295 EFI_MAC_ADDRESS LinkAddress; ///< Link-layer address of the neighbor. \r
296 EFI_IP6_NEIGHBOR_STATE State; ///< State of this neighbor cache entry. \r
297} EFI_IP6_NEIGHBOR_CACHE;\r
298\r
299///\r
300/// EFI_IP6_ICMP_TYPE\r
301/// is used to describe those ICMP messages that are supported by this EFI \r
302/// IPv6 Protocol driver.\r
303///\r
304typedef struct {\r
305 UINT8 Type; ///< The type of ICMP message.\r
306 UINT8 Code; ///< The code of the ICMP message.\r
307} EFI_IP6_ICMP_TYPE; \r
308\r
309///\r
310/// EFI_IP6_MODE_DATA\r
311///\r
312typedef struct { \r
313 ///\r
314 /// Set to TRUE after this EFI IPv6 Protocol instance is started. \r
315 /// All other fields in this structure are undefined until this field is TRUE. \r
316 /// Set to FALSE when the EFI IPv6 Protocol instance is stopped.\r
317 /// \r
318 BOOLEAN IsStarted;\r
319 ///\r
320 /// The maximum packet size, in bytes, of the packet which the upper layer driver could feed.\r
321 ///\r
322 UINT32 MaxPacketSize;\r
323 /// \r
324 /// Current configuration settings. Undefined until IsStarted is TRUE.\r
325 ///\r
326 EFI_IP6_CONFIG_DATA ConfigData;\r
327 /// \r
328 /// Set to TRUE when the EFI IPv6 Protocol instance is configured. \r
329 /// The instance is configured when it has a station address and \r
330 /// corresponding prefix length. \r
331 /// Set to FALSE when the EFI IPv6 Protocol instance is not configured.\r
332 ///\r
333 BOOLEAN IsConfigured;\r
334 /// \r
335 /// Number of configured IPv6 addresses on this interface. \r
336 ///\r
337 UINT32 AddressCount;\r
338 /// \r
339 /// List of currently configured IPv6 addresses and corresponding \r
340 /// prefix lengths assigned to this interface. It is caller's \r
341 /// responsibility to free this buffer.\r
342 /// \r
343 EFI_IP6_ADDRESS_INFO *AddressList;\r
344 /// \r
345 /// Number of joined multicast groups. Undefined until \r
346 /// IsConfigured is TRUE.\r
347 ///\r
348 UINT32 GroupCount;\r
349 /// \r
350 /// List of joined multicast group addresses. It is caller's \r
351 /// responsibility to free this buffer. Undefined until \r
352 /// IsConfigured is TRUE.\r
353 ///\r
354 EFI_IPv6_ADDRESS *GroupTable;\r
355 /// \r
356 /// Number of entries in the routing table. Undefined until \r
357 /// IsConfigured is TRUE.\r
358 ///\r
359 UINT32 RouteCount;\r
360 /// \r
361 /// Routing table entries. It is caller's responsibility to free this buffer.\r
362 ///\r
363 EFI_IP6_ROUTE_TABLE *RouteTable;\r
364 ///\r
365 /// Number of entries in the neighbor cache. Undefined until \r
366 /// IsConfigured is TRUE.\r
367 ///\r
368 UINT32 NeighborCount;\r
369 /// \r
370 /// Neighbor cache entries. It is caller's responsibility to free this \r
371 /// buffer. Undefined until IsConfigured is TRUE. \r
372 ///\r
373 EFI_IP6_NEIGHBOR_CACHE *NeighborCache; \r
374 /// \r
375 /// Number of entries in the prefix table. Undefined until \r
376 /// IsConfigured is TRUE.\r
377 ///\r
378 UINT32 PrefixCount;\r
379 /// \r
380 /// On-link Prefix table entries. It is caller's responsibility to free this \r
381 /// buffer. Undefined until IsConfigured is TRUE. \r
382 ///\r
383 EFI_IP6_ADDRESS_INFO *PrefixTable;\r
384 /// \r
385 /// Number of entries in the supported ICMP types list.\r
386 ///\r
387 UINT32 IcmpTypeCount;\r
388 /// \r
389 /// Array of ICMP types and codes that are supported by this EFI \r
390 /// IPv6 Protocol driver. It is caller's responsibility to free this \r
391 /// buffer.\r
392 ///\r
393 EFI_IP6_ICMP_TYPE *IcmpTypeList;\r
394} EFI_IP6_MODE_DATA;\r
395\r
396///\r
397/// EFI_IP6_HEADER\r
398/// The fields in the IPv6 header structure are defined in the Internet\r
399/// Protocol version6 specification.\r
400///\r
401#pragma pack(1)\r
402typedef struct _EFI_IP6_HEADER {\r
403 UINT8 TrafficClassH:4;\r
404 UINT8 Version:4;\r
405 UINT8 FlowLabelH:4;\r
406 UINT8 TrafficClassL:4; \r
407 UINT16 FlowLabelL;\r
408 UINT16 PayloadLength;\r
409 UINT8 NextHeader;\r
410 UINT8 HopLimit;\r
411 EFI_IPv6_ADDRESS SourceAddress;\r
412 EFI_IPv6_ADDRESS DestinationAddress;\r
413} EFI_IP6_HEADER;\r
9591f383 414#pragma pack()\r
bdb140d7 415\r
416///\r
417/// EFI_IP6_FRAGMENT_DATA\r
418/// describes the location and length of the IPv6 packet \r
419/// fragment to transmit or that has been received.\r
420///\r
421typedef struct _EFI_IP6_FRAGMENT_DATA {\r
422 UINT32 FragmentLength; ///< Length of fragment data. This field may not be set to zero.\r
423 VOID *FragmentBuffer; ///< Pointer to fragment data. This field may not be set to NULL.\r
424} EFI_IP6_FRAGMENT_DATA;\r
425\r
426///\r
427/// EFI_IP6_RECEIVE_DATA\r
428///\r
429typedef struct _EFI_IP6_RECEIVE_DATA {\r
430 /// \r
431 /// Time when the EFI IPv6 Protocol driver accepted the packet. \r
432 /// Ignored if it is zero.\r
433 /// \r
434 EFI_TIME TimeStamp;\r
435 /// \r
436 /// After this event is signaled, the receive data structure is released \r
437 /// and must not be referenced.\r
438 /// \r
439 EFI_EVENT RecycleSignal;\r
440 ///\r
441 ///Length of the IPv6 packet headers, including both the IPv6 \r
442 ///header and any extension headers. \r
443 ///\r
444 UINT32 HeaderLength;\r
445 /// \r
446 /// Pointer to the IPv6 packet header. If the IPv6 packet was \r
447 /// fragmented, this argument is a pointer to the header in the first \r
448 /// fragment. \r
449 /// \r
450 EFI_IP6_HEADER *Header;\r
451 /// \r
452 /// Sum of the lengths of IPv6 packet buffers in FragmentTable. May \r
453 /// be zero.\r
454 /// \r
455 UINT32 DataLength;\r
456 /// \r
457 /// Number of IPv6 payload fragments. May be zero.\r
458 /// \r
459 UINT32 FragmentCount;\r
460 /// \r
461 /// Array of payload fragment lengths and buffer pointers.\r
462 /// \r
463 EFI_IP6_FRAGMENT_DATA FragmentTable[1];\r
464} EFI_IP6_RECEIVE_DATA;\r
465\r
466///\r
467/// EFI_IP6_OVERRIDE_DATA\r
468/// The information and flags in the override data structure will override \r
469/// default parameters or settings for one Transmit() function call. \r
470///\r
471typedef struct _EFI_IP6_OVERRIDE_DATA {\r
472 UINT8 Protocol; ///< Protocol type override.\r
473 UINT8 HopLimit; ///< Hop-Limit override.\r
474 UINT32 FlowLabel; ///< Flow-Label override.\r
475} EFI_IP6_OVERRIDE_DATA;\r
476 \r
477///\r
478/// EFI_IP6_TRANSMIT_DATA \r
479///\r
480typedef struct _EFI_IP6_TRANSMIT_DATA { \r
481 /// \r
482 /// The destination IPv6 address. If it is unspecified, \r
483 /// ConfigData.DestinationAddress will be used instead.\r
484 /// \r
485 EFI_IPv6_ADDRESS DestinationAddress;\r
486 /// \r
487 /// If not NULL, the IPv6 transmission control override data.\r
488 /// \r
489 EFI_IP6_OVERRIDE_DATA *OverrideData;\r
490 /// \r
491 /// Total length in byte of the IPv6 extension headers specified in \r
492 /// ExtHdrs.\r
493 /// \r
494 UINT32 ExtHdrsLength;\r
495 /// \r
496 /// Pointer to the IPv6 extension headers. The IP layer will append \r
497 /// the required extension headers if they are not specified by \r
498 /// ExtHdrs. Ignored if ExtHdrsLength is zero.\r
499 /// \r
500 VOID *ExtHdrs;\r
501 /// \r
502 /// The protocol of first extension header in ExtHdrs. Ignored if \r
503 /// ExtHdrsLength is zero.\r
504 /// \r
505 UINT8 NextHeader;\r
506 /// \r
507 /// Total length in bytes of the FragmentTable data to transmit.\r
508 /// \r
509 UINT32 DataLength;\r
510 /// \r
511 /// Number of entries in the fragment data table.\r
512 /// \r
513 UINT32 FragmentCount;\r
514 /// \r
515 /// Start of the fragment data table.\r
516 /// \r
517 EFI_IP6_FRAGMENT_DATA FragmentTable[1];\r
518} EFI_IP6_TRANSMIT_DATA;\r
519\r
520///\r
521/// EFI_IP6_COMPLETION_TOKEN\r
522/// structures are used for both transmit and receive operations.\r
523///\r
524typedef struct {\r
525 ///\r
526 /// This Event will be signaled after the Status field is updated by \r
527 /// the EFI IPv6 Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL.\r
528 ///\r
529 EFI_EVENT Event;\r
530 ///\r
531 /// Will be set to one of the following values:\r
532 /// - EFI_SUCCESS: The receive or transmit completed \r
533 /// successfully.\r
534 /// - EFI_ABORTED: The receive or transmit was aborted\r
535 /// - EFI_TIMEOUT: The transmit timeout expired.\r
536 /// - EFI_ICMP_ERROR: An ICMP error packet was received.\r
537 /// - EFI_DEVICE_ERROR: An unexpected system or network \r
538 /// error occurred.\r
539 /// - EFI_SECURITY_VIOLATION: The transmit or receive was \r
540 /// failed because of an IPsec policy check.\r
541 ///\r
542 EFI_STATUS Status;\r
543 union {\r
544 ///\r
545 /// When the Token is used for receiving, RxData is a pointer to the EFI_IP6_RECEIVE_DATA.\r
546 ///\r
547 EFI_IP6_RECEIVE_DATA *RxData;\r
548 ///\r
549 /// When the Token is used for transmitting, TxData is a pointer to the EFI_IP6_TRANSMIT_DATA.\r
550 ///\r
551 EFI_IP6_TRANSMIT_DATA *TxData;\r
552 } Packet;\r
553} EFI_IP6_COMPLETION_TOKEN;\r
554\r
555/**\r
556 Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.\r
557 \r
558 The GetModeData() function returns the current operational mode data for this driver instance. \r
559 The data fields in EFI_IP6_MODE_DATA are read only. This function is used optionally to \r
560 retrieve the operational mode data of underlying networks or drivers..\r
561\r
562 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
563 @param[out] Ip6ModeData Pointer to the EFI IPv6 Protocol mode data structure.\r
564 @param[out] MnpConfigData Pointer to the managed network configuration data structure.\r
565 @param[out] SnpModeData Pointer to the simple network mode data structure.\r
566 \r
567 @retval EFI_SUCCESS The operation completed successfully.\r
568 @retval EFI_INVALID_PARAMETER This is NULL.\r
569 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r
570\r
571**/\r
572typedef \r
573EFI_STATUS\r
5e6f3ee2 574(EFIAPI *EFI_IP6_GET_MODE_DATA)(\r
bdb140d7 575 IN EFI_IP6_PROTOCOL *This,\r
576 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r
577 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
578 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
579 );\r
580\r
581/**\r
582 Assigns an IPv6 address and subnet mask to this EFI IPv6 Protocol driver instance.\r
583 \r
584 The Configure() function is used to set, change, or reset the operational parameters and filter \r
585 settings for this EFI IPv6 Protocol instance. Until these parameters have been set, no network traffic \r
586 can be sent or received by this instance. Once the parameters have been reset (by calling this \r
587 function with Ip6ConfigData set to NULL), no more traffic can be sent or received until these \r
588 parameters have been set again. Each EFI IPv6 Protocol instance can be started and stopped \r
589 independently of each other by enabling or disabling their receive filter settings with the \r
590 Configure() function.\r
591 \r
592 If Ip6ConfigData.StationAddress is a valid non-zero IPv6 unicast address, it is required \r
593 to be one of the currently configured IPv6 addresses list in the EFI IPv6 drivers, or else \r
594 EFI_INVALID_PARAMETER will be returned. If Ip6ConfigData.StationAddress is \r
595 unspecified, the IPv6 driver will bind a source address according to the source address selection \r
596 algorithm. Clients could frequently call GetModeData() to check get currently configured IPv6 \r
597 address list in the EFI IPv6 driver. If both Ip6ConfigData.StationAddress and \r
598 Ip6ConfigData.Destination are unspecified, when transmitting the packet afterwards, the \r
599 source address filled in each outgoing IPv6 packet is decided based on the destination of this packet. .\r
600 \r
601 If operational parameters are reset or changed, any pending transmit and receive requests will be \r
602 cancelled. Their completion token status will be set to EFI_ABORTED and their events will be \r
603 signaled.\r
604\r
605 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
606 @param[in] Ip6ConfigData Pointer to the EFI IPv6 Protocol configuration data structure.\r
607 \r
608 @retval EFI_SUCCESS The driver instance was successfully opened.\r
609 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
610 - This is NULL.\r
611 - Ip6ConfigData.StationAddress is neither zero nor \r
612 a unicast IPv6 address.\r
613 - Ip6ConfigData.StationAddress is neither zero nor \r
614 one of the configured IP addresses in the EFI IPv6 driver.\r
615 - Ip6ConfigData.DefaultProtocol is illegal. \r
616 @retval EFI_OUT_OF_RESOURCES The EFI IPv6 Protocol driver instance data could not be allocated.\r
617 @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing a source address for \r
618 this instance, but no source address was available for use. \r
619 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the IPv6 \r
620 address or prefix length can be changed.\r
621 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv6 \r
622 Protocol driver instance is not opened.\r
623 @retval EFI_UNSUPPORTED Default protocol specified through \r
624 Ip6ConfigData.DefaulProtocol isn't supported.\r
625\r
626**/\r
627typedef \r
628EFI_STATUS\r
5e6f3ee2 629(EFIAPI *EFI_IP6_CONFIGURE)(\r
bdb140d7 630 IN EFI_IP6_PROTOCOL *This,\r
631 IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL\r
632 );\r
633\r
634/**\r
635 Joins and leaves multicast groups.\r
636 \r
637 The Groups() function is used to join and leave multicast group sessions. Joining a group will \r
638 enable reception of matching multicast packets. Leaving a group will disable reception of matching \r
639 multicast packets. Source-Specific Multicast isn't required to be supported.\r
640 \r
641 If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.\r
642\r
643 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
644 @param[in] JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.\r
645 @param[in] GroupAddress Pointer to the IPv6 multicast address.\r
646 \r
647 @retval EFI_SUCCESS The operation completed successfully.\r
648 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r
649 - This is NULL.\r
650 - JoinFlag is TRUE and GroupAddress is NULL.\r
651 - GroupAddress is not NULL and *GroupAddress is\r
652 not a multicast IPv6 address. \r
653 - GroupAddress is not NULL and *GroupAddress is in the \r
654 range of SSM destination address.\r
655 @retval EFI_NOT_STARTED This instance has not been started.\r
656 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.\r
657 @retval EFI_UNSUPPORTED This EFI IPv6 Protocol implementation does not support multicast groups.\r
658 @retval EFI_ALREADY_STARTED The group address is already in the group table (when\r
659 JoinFlag is TRUE).\r
660 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).\r
661 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
662\r
663**/\r
664typedef \r
665EFI_STATUS\r
5e6f3ee2 666(EFIAPI *EFI_IP6_GROUPS)(\r
bdb140d7 667 IN EFI_IP6_PROTOCOL *This,\r
668 IN BOOLEAN JoinFlag,\r
669 IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL\r
670 );\r
671\r
672/**\r
673 Adds and deletes routing table entries.\r
674\r
675 The Routes() function adds a route to or deletes a route from the routing table.\r
676 \r
677 Routes are determined by comparing the leftmost PrefixLength bits of Destination with \r
678 the destination IPv6 address arithmetically. The gateway address must be on the same subnet as the\r
679 configured station address.\r
680 \r
681 The default route is added with Destination and PrefixLegth both set to all zeros. The \r
682 default route matches all destination IPv6 addresses that do not match any other routes.\r
683\r
684 All EFI IPv6 Protocol instances share a routing table.\r
685 \r
686 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
687 @param[in] DeleteRoute Set to TRUE to delete this route from the routing table. Set to \r
688 FALSE to add this route to the routing table. Destination, \r
689 PrefixLength and Gateway are used as the key to each \r
690 route entry.\r
691 @param[in] Destination The address prefix of the subnet that needs to be routed.\r
692 @param[in] PrefixLength The prefix length of Destination. Ignored if Destination \r
693 is NULL.\r
694 @param[in] GatewayAddress The unicast gateway IPv6 address for this route.\r
695\r
696 @retval EFI_SUCCESS The operation completed successfully.\r
697 @retval EFI_NOT_STARTED The driver instance has not been started.\r
698 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
699 - This is NULL.\r
700 - When DeleteRoute is TRUE, both Destination and \r
701 GatewayAddress are NULL.\r
702 - When DeleteRoute is FALSE, either Destination or \r
703 GatewayAddress is NULL.\r
704 - *GatewayAddress is not a valid unicast IPv6 address.\r
705 - *GatewayAddress is one of the local configured IPv6 \r
706 addresses.\r
707 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.\r
708 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).\r
709 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when\r
710 DeleteRoute is FALSE).\r
711 \r
712**/\r
713typedef \r
714EFI_STATUS\r
5e6f3ee2 715(EFIAPI *EFI_IP6_ROUTES)(\r
bdb140d7 716 IN EFI_IP6_PROTOCOL *This,\r
717 IN BOOLEAN DeleteRoute,\r
5e6f3ee2 718 IN EFI_IPv6_ADDRESS *Destination OPTIONAL,\r
bdb140d7 719 IN UINT8 PrefixLength,\r
720 IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL \r
721 );\r
722\r
723/**\r
724 Add or delete Neighbor cache entries.\r
725\r
726 The Neighbors() function is used to add, update, or delete an entry from neighbor cache. \r
727 IPv6 neighbor cache entries are typically inserted and updated by the network protocol driver as \r
728 network traffic is processed. Most neighbor cache entries will time out and be deleted if the network \r
729 traffic stops. Neighbor cache entries that were inserted by Neighbors() may be static (will not \r
730 timeout) or dynamic (will time out).\r
731 \r
732 The implementation should follow the neighbor cache timeout mechanism which is defined in \r
733 RFC4861. The default neighbor cache timeout value should be tuned for the expected network \r
734 environment\r
735\r
736 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
737 @param[in] DeleteFlag Set to TRUE to delete the specified cache entry, set to FALSE to \r
738 add (or update, if it already exists and Override is TRUE) the \r
739 specified cache entry. TargetIp6Address is used as the key \r
740 to find the requested cache entry.\r
741 @param[in] TargetIp6Address Pointer to Target IPv6 address.\r
742 @param[in] TargetLinkAddress Pointer to link-layer address of the target. Ignored if NULL. \r
743 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor \r
744 cache, it will be deleted after Timeout. A value of zero means that \r
745 the entry is permanent. A non-zero value means that the entry is \r
746 dynamic. \r
747 @param[in] Override If TRUE, the cached link-layer address of the matching entry will \r
748 be overridden and updated; if FALSE, EFI_ACCESS_DENIED \r
749 will be returned if a corresponding cache entry already existed.\r
750\r
751 @retval EFI_SUCCESS The data has been queued for transmission.\r
752 @retval EFI_NOT_STARTED This instance has not been started.\r
753 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
754 - This is NULL.\r
755 - TargetIpAddress is NULL.\r
756 - *TargetLinkAddress is invalid when not NULL.\r
757 - *TargetIpAddress is not a valid unicast IPv6 address.\r
758 - *TargetIpAddress is one of the local configured IPv6 \r
759 addresses.\r
760 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache.\r
761 @retval EFI_NOT_FOUND This entry is not in the neighbor cache (when DeleteFlag is \r
762 TRUE or when DeleteFlag is FALSE while \r
763 TargetLinkAddress is NULL.).\r
764 @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache, \r
765 and that entry is tagged as un-overridden (when DeleteFlag \r
766 is FALSE).\r
767\r
768**/\r
769typedef \r
770EFI_STATUS\r
5e6f3ee2 771(EFIAPI *EFI_IP6_NEIGHBORS)(\r
bdb140d7 772 IN EFI_IP6_PROTOCOL *This,\r
773 IN BOOLEAN DeleteFlag,\r
774 IN EFI_IPv6_ADDRESS *TargetIp6Address,\r
775 IN EFI_MAC_ADDRESS *TargetLinkAddress,\r
776 IN UINT32 Timeout,\r
777 IN BOOLEAN Override\r
778 );\r
779\r
780/**\r
781 Places outgoing data packets into the transmit queue.\r
782\r
783 The Transmit() function places a sending request in the transmit queue of this\r
784 EFI IPv6 Protocol instance. Whenever the packet in the token is sent out or some\r
785 errors occur, the event in the token will be signaled and the status is updated.\r
786\r
787 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
788 @param[in] Token Pointer to the transmit token.\r
789\r
790 @retval EFI_SUCCESS The data has been queued for transmission.\r
791 @retval EFI_NOT_STARTED This instance has not been started.\r
792 @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing a source address for \r
793 this transmission, but no source address was available for use.\r
794 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r
795 - This is NULL.\r
796 - Token is NULL.\r
797 - Token.Event is NULL.\r
798 - Token.Packet.TxData is NULL.\r
799 - Token.Packet.ExtHdrsLength is not zero and Token.Packet.ExtHdrs is NULL.\r
800 - Token.Packet.FragmentCount is zero.\r
801 - One or more of the Token.Packet.TxData.FragmentTable[].FragmentLength fields is zero.\r
802 - One or more of the Token.Packet.TxData.FragmentTable[].FragmentBuffer fields is NULL.\r
803 - Token.Packet.TxData.DataLength is zero or not equal to the sum of fragment lengths.\r
804 - Token.Packet.TxData.DestinationAddress is non-zero when DestinationAddress is configured as \r
805 non-zero when doing Configure() for this EFI IPv6 protocol instance.\r
806 - Token.Packet.TxData.DestinationAddress is unspecified when DestinationAddress is unspecified \r
807 when doing Configure() for this EFI IPv6 protocol instance.\r
808 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event\r
809 was already in the transmit queue.\r
810 @retval EFI_NOT_READY The completion token could not be queued because the transmit\r
811 queue is full. \r
812 @retval EFI_NOT_FOUND Not route is found to destination address.\r
813 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.\r
814 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too\r
815 short to transmit.\r
816 @retval EFI_BAD_BUFFER_SIZE If Token.Packet.TxData.DataLength is beyond the \r
817 maximum that which can be described through the Fragment Offset\r
818 field in Fragment header when performing fragmentation.\r
819 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
820\r
821**/\r
822typedef \r
823EFI_STATUS\r
5e6f3ee2 824(EFIAPI *EFI_IP6_TRANSMIT)(\r
bdb140d7 825 IN EFI_IP6_PROTOCOL *This,\r
826 IN EFI_IP6_COMPLETION_TOKEN *Token\r
827 );\r
828\r
829/**\r
830 Places a receiving request into the receiving queue.\r
831 \r
832 The Receive() function places a completion token into the receive packet queue.\r
833 This function is always asynchronous.\r
834 \r
835 The Token.Event field in the completion token must be filled in by the caller\r
836 and cannot be NULL. When the receive operation completes, the EFI IPv6 Protocol\r
837 driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event\r
838 is signaled.\r
839\r
840 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
ea6898b9 841 @param[in] Token Pointer to a token that is associated with the receive data descriptor.\r
bdb140d7 842 \r
843 @retval EFI_SUCCESS The receive completion token was cached.\r
844 @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.\r
845 @retval EFI_NO_MAPPING When IP6 driver responsible for binding source address to this instance, \r
846 while no source address is available for use.\r
847 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
848 - This is NULL.\r
849 - Token is NULL.\r
850 - Token.Event is NULL.\r
851 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system\r
852 resources (usually memory).\r
853 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
854 The EFI IPv6 Protocol instance has been reset to startup defaults.\r
855 @retval EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already\r
856 in the receive queue.\r
857 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
858 \r
859**/ \r
860typedef \r
861EFI_STATUS \r
5e6f3ee2 862(EFIAPI *EFI_IP6_RECEIVE)( \r
bdb140d7 863 IN EFI_IP6_PROTOCOL *This,\r
864 IN EFI_IP6_COMPLETION_TOKEN *Token\r
865 );\r
866\r
867/**\r
868 Abort an asynchronous transmit or receive request.\r
869 \r
870 The Cancel() function is used to abort a pending transmit or receive request.\r
871 If the token is in the transmit or receive request queues, after calling this\r
872 function, Token->Status will be set to EFI_ABORTED and then Token->Event will\r
873 be signaled. If the token is not in one of the queues, which usually means the\r
874 asynchronous operation has completed, this function will not signal the token\r
875 and EFI_NOT_FOUND is returned.\r
876\r
877 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
878 @param[in] Token Pointer to a token that has been issued by\r
879 EFI_IP6_PROTOCOL.Transmit() or\r
880 EFI_IP6_PROTOCOL.Receive(). If NULL, all pending\r
881 tokens are aborted. Type EFI_IP6_COMPLETION_TOKEN is\r
882 defined in EFI_IP6_PROTOCOL.Transmit().\r
883 \r
884 @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r
885 Token->Event was signaled. When Token is NULL, all\r
886 pending requests were aborted and their events were signaled.\r
887 @retval EFI_INVALID_PARAMETER This is NULL.\r
888 @retval EFI_NOT_STARTED This instance has not been started.\r
889 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was\r
890 not found in the transmit or receive queue. It has either completed\r
891 or was not issued by Transmit() and Receive().\r
892 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
893 \r
894**/ \r
895typedef \r
896EFI_STATUS \r
897(EFIAPI *EFI_IP6_CANCEL)( \r
898 IN EFI_IP6_PROTOCOL *This,\r
899 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL\r
900 );\r
901\r
902/**\r
903 Polls for incoming data packets and processes outgoing data packets.\r
904 \r
905 The Poll() function polls for incoming data packets and processes outgoing data\r
906 packets. Network drivers and applications can call the EFI_IP6_PROTOCOL.Poll()\r
907 function to increase the rate that data packets are moved between the communications\r
908 device and the transmit and receive queues.\r
909 \r
910 In some systems the periodic timer event may not poll the underlying communications\r
911 device fast enough to transmit and/or receive all data packets without missing\r
912 incoming packets or dropping outgoing packets. Drivers and applications that are\r
913 experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function\r
914 more often.\r
915\r
916 @param[in] This Pointer to the EFI_IP6_PROTOCOL instance.\r
917\r
918 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
919 @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.\r
920 @retval EFI_INVALID_PARAMETER This is NULL.\r
921 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
922 @retval EFI_NOT_READY No incoming or outgoing data is processed.\r
923 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
924 Consider increasing the polling rate.\r
925\r
926**/\r
927typedef \r
928EFI_STATUS\r
5e6f3ee2 929(EFIAPI *EFI_IP6_POLL)(\r
bdb140d7 930 IN EFI_IP6_PROTOCOL *This\r
931 );\r
932\r
933///\r
934/// The EFI IPv6 Protocol implements a simple packet-oriented interface that can be\r
935/// used by drivers, daemons, and applications to transmit and receive network packets.\r
936///\r
5e6f3ee2 937struct _EFI_IP6_PROTOCOL {\r
bdb140d7 938 EFI_IP6_GET_MODE_DATA GetModeData;\r
939 EFI_IP6_CONFIGURE Configure;\r
940 EFI_IP6_GROUPS Groups;\r
941 EFI_IP6_ROUTES Routes;\r
942 EFI_IP6_NEIGHBORS Neighbors;\r
943 EFI_IP6_TRANSMIT Transmit;\r
944 EFI_IP6_RECEIVE Receive;\r
945 EFI_IP6_CANCEL Cancel;\r
946 EFI_IP6_POLL Poll;\r
5e6f3ee2 947};\r
bdb140d7 948\r
949extern EFI_GUID gEfiIp6ServiceBindingProtocolGuid;\r
950extern EFI_GUID gEfiIp6ProtocolGuid;\r
951\r
952#endif\r