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