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