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