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