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