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