1 | /** @file
|
---|
2 | Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | This program and the accompanying materials
|
---|
7 | are licensed and made available under the terms and conditions of the BSD License
|
---|
8 | which accompanies this distribution. The full text of the license may be found at
|
---|
9 | http://opensource.org/licenses/bsd-license.php.
|
---|
10 |
|
---|
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
13 |
|
---|
14 | **/
|
---|
15 |
|
---|
16 | #ifndef __EFI_IP6_IMPL_H__
|
---|
17 | #define __EFI_IP6_IMPL_H__
|
---|
18 |
|
---|
19 | #include <Uefi.h>
|
---|
20 |
|
---|
21 | #include <Protocol/ServiceBinding.h>
|
---|
22 | #include <Protocol/ManagedNetwork.h>
|
---|
23 | #include <Protocol/IpSec.h>
|
---|
24 | #include <Protocol/Ip6.h>
|
---|
25 | #include <Protocol/Ip6Config.h>
|
---|
26 | #include <Protocol/Dhcp6.h>
|
---|
27 | #include <Protocol/DevicePath.h>
|
---|
28 | #include <Protocol/HiiConfigRouting.h>
|
---|
29 | #include <Protocol/HiiConfigAccess.h>
|
---|
30 |
|
---|
31 | #include <Library/DebugLib.h>
|
---|
32 | #include <Library/UefiBootServicesTableLib.h>
|
---|
33 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
34 | #include <Library/BaseLib.h>
|
---|
35 | #include <Library/UefiLib.h>
|
---|
36 | #include <Library/NetLib.h>
|
---|
37 | #include <Library/BaseMemoryLib.h>
|
---|
38 | #include <Library/MemoryAllocationLib.h>
|
---|
39 | #include <Library/DpcLib.h>
|
---|
40 | #include <Library/HiiLib.h>
|
---|
41 | #include <Library/UefiHiiServicesLib.h>
|
---|
42 | #include <Library/DevicePathLib.h>
|
---|
43 | #include <Library/PrintLib.h>
|
---|
44 |
|
---|
45 | #include <Guid/MdeModuleHii.h>
|
---|
46 |
|
---|
47 | #include "Ip6Common.h"
|
---|
48 | #include "Ip6Driver.h"
|
---|
49 | #include "Ip6Icmp.h"
|
---|
50 | #include "Ip6If.h"
|
---|
51 | #include "Ip6Input.h"
|
---|
52 | #include "Ip6Mld.h"
|
---|
53 | #include "Ip6Nd.h"
|
---|
54 | #include "Ip6Option.h"
|
---|
55 | #include "Ip6Output.h"
|
---|
56 | #include "Ip6Route.h"
|
---|
57 | #include "Ip6ConfigNv.h"
|
---|
58 | #include "Ip6ConfigImpl.h"
|
---|
59 |
|
---|
60 | #define IP6_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'P')
|
---|
61 | #define IP6_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'S')
|
---|
62 |
|
---|
63 | //
|
---|
64 | // The state of IP6 protocol. It starts from UNCONFIGED. if it is
|
---|
65 | // successfully configured, it goes to CONFIGED. if configure NULL
|
---|
66 | // is called, it becomes UNCONFIGED again. If (partly) destroyed, it
|
---|
67 | // becomes DESTROY.
|
---|
68 | //
|
---|
69 | #define IP6_STATE_UNCONFIGED 0
|
---|
70 | #define IP6_STATE_CONFIGED 1
|
---|
71 | #define IP6_STATE_DESTROY 2
|
---|
72 |
|
---|
73 | //
|
---|
74 | // The state of IP6 service. It starts from UNSTARTED. It transits
|
---|
75 | // to STARTED if autoconfigure is started. If default address is
|
---|
76 | // configured, it becomes CONFIGED. and if partly destroyed, it goes
|
---|
77 | // to DESTROY.
|
---|
78 | //
|
---|
79 | #define IP6_SERVICE_UNSTARTED 0
|
---|
80 | #define IP6_SERVICE_STARTED 1
|
---|
81 | #define IP6_SERVICE_CONFIGED 2
|
---|
82 | #define IP6_SERVICE_DESTROY 3
|
---|
83 |
|
---|
84 | #define IP6_INSTANCE_FROM_PROTOCOL(Ip6) \
|
---|
85 | CR ((Ip6), IP6_PROTOCOL, Ip6Proto, IP6_PROTOCOL_SIGNATURE)
|
---|
86 |
|
---|
87 | #define IP6_SERVICE_FROM_PROTOCOL(Sb) \
|
---|
88 | CR ((Sb), IP6_SERVICE, ServiceBinding, IP6_SERVICE_SIGNATURE)
|
---|
89 |
|
---|
90 | #define IP6_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
|
---|
91 |
|
---|
92 | extern EFI_IPSEC2_PROTOCOL *mIpSec;
|
---|
93 |
|
---|
94 | //
|
---|
95 | // IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
|
---|
96 | // The user's data is kept in the Packet. When fragment is
|
---|
97 | // needed, each fragment of the Packet has a reference to the
|
---|
98 | // Packet, no data is actually copied. The Packet will be
|
---|
99 | // released when all the fragments of it have been recycled by
|
---|
100 | // MNP. Upon then, the IP6_TXTOKEN_WRAP will be released, and
|
---|
101 | // user's event signalled.
|
---|
102 | //
|
---|
103 | typedef struct {
|
---|
104 | IP6_PROTOCOL *IpInstance;
|
---|
105 | EFI_IP6_COMPLETION_TOKEN *Token;
|
---|
106 | EFI_EVENT IpSecRecycleSignal;
|
---|
107 | NET_BUF *Packet;
|
---|
108 | BOOLEAN Sent;
|
---|
109 | INTN Life;
|
---|
110 | } IP6_TXTOKEN_WRAP;
|
---|
111 |
|
---|
112 | typedef struct {
|
---|
113 | EFI_EVENT IpSecRecycleSignal;
|
---|
114 | NET_BUF *Packet;
|
---|
115 | } IP6_IPSEC_WRAP;
|
---|
116 |
|
---|
117 | //
|
---|
118 | // IP6_RXDATA_WRAP wraps the data IP6 child delivers to the
|
---|
119 | // upper layers. The received packet is kept in the Packet.
|
---|
120 | // The Packet itself may be constructured from some fragments.
|
---|
121 | // All the fragments of the Packet is organized by a
|
---|
122 | // IP6_ASSEMBLE_ENTRY structure. If the Packet is recycled by
|
---|
123 | // the upper layer, the assemble entry and its associated
|
---|
124 | // fragments will be freed at last.
|
---|
125 | //
|
---|
126 | typedef struct {
|
---|
127 | LIST_ENTRY Link;
|
---|
128 | IP6_PROTOCOL *IpInstance;
|
---|
129 | NET_BUF *Packet;
|
---|
130 | EFI_IP6_RECEIVE_DATA RxData;
|
---|
131 | } IP6_RXDATA_WRAP;
|
---|
132 |
|
---|
133 | struct _IP6_PROTOCOL {
|
---|
134 | UINT32 Signature;
|
---|
135 |
|
---|
136 | EFI_IP6_PROTOCOL Ip6Proto;
|
---|
137 | EFI_HANDLE Handle;
|
---|
138 | INTN State;
|
---|
139 |
|
---|
140 | IP6_SERVICE *Service;
|
---|
141 | LIST_ENTRY Link; // Link to all the IP protocol from the service
|
---|
142 |
|
---|
143 | UINT8 PrefixLength; // PrefixLength of the configured station address.
|
---|
144 | //
|
---|
145 | // User's transmit/receive tokens, and received/deliverd packets
|
---|
146 | //
|
---|
147 | NET_MAP RxTokens;
|
---|
148 | NET_MAP TxTokens; // map between (User's Token, IP6_TXTOKE_WRAP)
|
---|
149 | LIST_ENTRY Received; // Received but not delivered packet
|
---|
150 | LIST_ENTRY Delivered; // Delivered and to be recycled packets
|
---|
151 | EFI_LOCK RecycleLock;
|
---|
152 |
|
---|
153 | IP6_INTERFACE *Interface;
|
---|
154 | LIST_ENTRY AddrLink; // Ip instances with the same IP address.
|
---|
155 |
|
---|
156 | EFI_IPv6_ADDRESS *GroupList; // stored in network order.
|
---|
157 | UINT32 GroupCount;
|
---|
158 |
|
---|
159 | EFI_IP6_CONFIG_DATA ConfigData;
|
---|
160 | };
|
---|
161 |
|
---|
162 | struct _IP6_SERVICE {
|
---|
163 | UINT32 Signature;
|
---|
164 | EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
---|
165 | INTN State;
|
---|
166 | BOOLEAN InDestroy;
|
---|
167 |
|
---|
168 | //
|
---|
169 | // List of all the IP instances and interfaces, and default
|
---|
170 | // interface and route table and caches.
|
---|
171 | //
|
---|
172 | UINTN NumChildren;
|
---|
173 | LIST_ENTRY Children;
|
---|
174 |
|
---|
175 | LIST_ENTRY Interfaces;
|
---|
176 |
|
---|
177 | IP6_INTERFACE *DefaultInterface;
|
---|
178 | IP6_ROUTE_TABLE *RouteTable;
|
---|
179 |
|
---|
180 | IP6_LINK_RX_TOKEN RecvRequest;
|
---|
181 |
|
---|
182 | //
|
---|
183 | // Ip reassemble utilities and MLD data
|
---|
184 | //
|
---|
185 | IP6_ASSEMBLE_TABLE Assemble;
|
---|
186 | IP6_MLD_SERVICE_DATA MldCtrl;
|
---|
187 |
|
---|
188 | EFI_IPv6_ADDRESS LinkLocalAddr;
|
---|
189 | BOOLEAN LinkLocalOk;
|
---|
190 | BOOLEAN LinkLocalDadFail;
|
---|
191 | BOOLEAN Dhcp6NeedStart;
|
---|
192 | BOOLEAN Dhcp6NeedInfoRequest;
|
---|
193 |
|
---|
194 | //
|
---|
195 | // ND data
|
---|
196 | //
|
---|
197 | UINT8 CurHopLimit;
|
---|
198 | UINT32 LinkMTU;
|
---|
199 | UINT32 BaseReachableTime;
|
---|
200 | UINT32 ReachableTime;
|
---|
201 | UINT32 RetransTimer;
|
---|
202 | LIST_ENTRY NeighborTable;
|
---|
203 |
|
---|
204 | LIST_ENTRY OnlinkPrefix;
|
---|
205 | LIST_ENTRY AutonomousPrefix;
|
---|
206 |
|
---|
207 | LIST_ENTRY DefaultRouterList;
|
---|
208 | UINT32 RoundRobin;
|
---|
209 |
|
---|
210 | UINT8 InterfaceIdLen;
|
---|
211 | UINT8 *InterfaceId;
|
---|
212 |
|
---|
213 | BOOLEAN RouterAdvertiseReceived;
|
---|
214 | UINT8 SolicitTimer;
|
---|
215 | UINT32 Ticks;
|
---|
216 |
|
---|
217 | //
|
---|
218 | // Low level protocol used by this service instance
|
---|
219 | //
|
---|
220 | EFI_HANDLE Image;
|
---|
221 | EFI_HANDLE Controller;
|
---|
222 |
|
---|
223 | EFI_HANDLE MnpChildHandle;
|
---|
224 | EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
|
---|
225 |
|
---|
226 | EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
|
---|
227 | EFI_SIMPLE_NETWORK_MODE SnpMode;
|
---|
228 |
|
---|
229 | EFI_EVENT Timer;
|
---|
230 | EFI_EVENT FasterTimer;
|
---|
231 |
|
---|
232 | //
|
---|
233 | // IPv6 Configuration Protocol instance
|
---|
234 | //
|
---|
235 | IP6_CONFIG_INSTANCE Ip6ConfigInstance;
|
---|
236 |
|
---|
237 | //
|
---|
238 | // The string representation of the current mac address of the
|
---|
239 | // NIC this IP6_SERVICE works on.
|
---|
240 | //
|
---|
241 | CHAR16 *MacString;
|
---|
242 | UINT32 MaxPacketSize;
|
---|
243 | UINT32 OldMaxPacketSize;
|
---|
244 | };
|
---|
245 |
|
---|
246 | /**
|
---|
247 | The callback function for the net buffer which wraps the user's
|
---|
248 | transmit token. Although this function seems simple,
|
---|
249 | there are some subtle aspects.
|
---|
250 | When a user requests the IP to transmit a packet by passing it a
|
---|
251 | token, the token is wrapped in an IP6_TXTOKEN_WRAP and the data
|
---|
252 | is wrapped in a net buffer. The net buffer's Free function is
|
---|
253 | set to Ip6FreeTxToken. The Token and token wrap are added to the
|
---|
254 | IP child's TxToken map. Then the buffer is passed to Ip6Output for
|
---|
255 | transmission. If an error occurs before that, the buffer
|
---|
256 | is freed, which in turn frees the token wrap. The wrap may
|
---|
257 | have been added to the TxToken map or not, and the user's event
|
---|
258 | shouldn't be signaled because we are still in the EfiIp6Transmit. If
|
---|
259 | the buffer has been sent by Ip6Output, it should be removed from
|
---|
260 | the TxToken map and the user's event signaled. The token wrap and buffer
|
---|
261 | are bound together. Refer to the comments in Ip6Output for information
|
---|
262 | about IP fragmentation.
|
---|
263 |
|
---|
264 | @param[in] Context The token's wrap.
|
---|
265 |
|
---|
266 | **/
|
---|
267 | VOID
|
---|
268 | EFIAPI
|
---|
269 | Ip6FreeTxToken (
|
---|
270 | IN VOID *Context
|
---|
271 | );
|
---|
272 |
|
---|
273 | /**
|
---|
274 | Config the MNP parameter used by IP. The IP driver use one MNP
|
---|
275 | child to transmit/receive frames. By default, it configures MNP
|
---|
276 | to receive unicast/multicast/broadcast. And it will enable/disable
|
---|
277 | the promiscuous receive according to whether there is IP child
|
---|
278 | enable that or not. If Force is FALSE, it will iterate through
|
---|
279 | all the IP children to check whether the promiscuous receive
|
---|
280 | setting has been changed. If it hasn't been changed, it won't
|
---|
281 | reconfigure the MNP. If Force is TRUE, the MNP is configured
|
---|
282 | whether that is changed or not.
|
---|
283 |
|
---|
284 | @param[in] IpSb The IP6 service instance that is to be changed.
|
---|
285 | @param[in] Force Force the configuration or not.
|
---|
286 |
|
---|
287 | @retval EFI_SUCCESS The MNP successfully configured/reconfigured.
|
---|
288 | @retval Others The configuration failed.
|
---|
289 |
|
---|
290 | **/
|
---|
291 | EFI_STATUS
|
---|
292 | Ip6ServiceConfigMnp (
|
---|
293 | IN IP6_SERVICE *IpSb,
|
---|
294 | IN BOOLEAN Force
|
---|
295 | );
|
---|
296 |
|
---|
297 | /**
|
---|
298 | Cancel the user's receive/transmit request. It is the worker function of
|
---|
299 | EfiIp6Cancel API.
|
---|
300 |
|
---|
301 | @param[in] IpInstance The IP6 child.
|
---|
302 | @param[in] Token The token to cancel. If NULL, all tokens will be
|
---|
303 | cancelled.
|
---|
304 |
|
---|
305 | @retval EFI_SUCCESS The token was cancelled.
|
---|
306 | @retval EFI_NOT_FOUND The token isn't found on either the
|
---|
307 | transmit or receive queue.
|
---|
308 | @retval EFI_DEVICE_ERROR Not all tokens are cancelled when Token is NULL.
|
---|
309 |
|
---|
310 | **/
|
---|
311 | EFI_STATUS
|
---|
312 | Ip6Cancel (
|
---|
313 | IN IP6_PROTOCOL *IpInstance,
|
---|
314 | IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
|
---|
315 | );
|
---|
316 |
|
---|
317 | /**
|
---|
318 | Initialize the IP6_PROTOCOL structure to the unconfigured states.
|
---|
319 |
|
---|
320 | @param[in] IpSb The IP6 service instance.
|
---|
321 | @param[in, out] IpInstance The IP6 child instance.
|
---|
322 |
|
---|
323 | **/
|
---|
324 | VOID
|
---|
325 | Ip6InitProtocol (
|
---|
326 | IN IP6_SERVICE *IpSb,
|
---|
327 | IN OUT IP6_PROTOCOL *IpInstance
|
---|
328 | );
|
---|
329 |
|
---|
330 | /**
|
---|
331 | Clean up the IP6 child, release all the resources used by it.
|
---|
332 |
|
---|
333 | @param[in, out] IpInstance The IP6 child to clean up.
|
---|
334 |
|
---|
335 | @retval EFI_SUCCESS The IP6 child was cleaned up
|
---|
336 | @retval EFI_DEVICE_ERROR Some resources failed to be released.
|
---|
337 |
|
---|
338 | **/
|
---|
339 | EFI_STATUS
|
---|
340 | Ip6CleanProtocol (
|
---|
341 | IN OUT IP6_PROTOCOL *IpInstance
|
---|
342 | );
|
---|
343 |
|
---|
344 | //
|
---|
345 | // EFI_IP6_PROTOCOL interface prototypes
|
---|
346 | //
|
---|
347 |
|
---|
348 | /**
|
---|
349 | Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
|
---|
350 |
|
---|
351 | The GetModeData() function returns the current operational mode data for this driver instance.
|
---|
352 | The data fields in EFI_IP6_MODE_DATA are read only. This function is used optionally to
|
---|
353 | retrieve the operational mode data of underlying networks or drivers.
|
---|
354 |
|
---|
355 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
356 | @param[out] Ip6ModeData The pointer to the EFI IPv6 Protocol mode data structure.
|
---|
357 | @param[out] MnpConfigData The pointer to the managed network configuration data structure.
|
---|
358 | @param[out] SnpModeData The pointer to the simple network mode data structure.
|
---|
359 |
|
---|
360 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
361 | @retval EFI_INVALID_PARAMETER This is NULL.
|
---|
362 | @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
|
---|
363 |
|
---|
364 | **/
|
---|
365 | EFI_STATUS
|
---|
366 | EFIAPI
|
---|
367 | EfiIp6GetModeData (
|
---|
368 | IN EFI_IP6_PROTOCOL *This,
|
---|
369 | OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
|
---|
370 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
---|
371 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
---|
372 | );
|
---|
373 |
|
---|
374 | /**
|
---|
375 | Assigns an IPv6 address and subnet mask to this EFI IPv6 Protocol driver instance.
|
---|
376 |
|
---|
377 | The Configure() function is used to set, change, or reset the operational parameters and filter
|
---|
378 | settings for this EFI IPv6 Protocol instance. Until these parameters have been set, no network traffic
|
---|
379 | can be sent or received by this instance. Once the parameters have been reset (by calling this
|
---|
380 | function with Ip6ConfigData set to NULL), no more traffic can be sent or received until these
|
---|
381 | parameters have been set again. Each EFI IPv6 Protocol instance can be started and stopped
|
---|
382 | independently of each other by enabling or disabling their receive filter settings with the
|
---|
383 | Configure() function.
|
---|
384 |
|
---|
385 | If Ip6ConfigData.StationAddress is a valid non-zero IPv6 unicast address, it is required
|
---|
386 | to be one of the currently configured IPv6 addresses list in the EFI IPv6 drivers, or else
|
---|
387 | EFI_INVALID_PARAMETER will be returned. If Ip6ConfigData.StationAddress is
|
---|
388 | unspecified, the IPv6 driver will bind a source address according to the source address selection
|
---|
389 | algorithm. Clients could frequently call GetModeData() to check get a currently configured IPv6.
|
---|
390 | If both Ip6ConfigData.StationAddress and Ip6ConfigData.Destination are unspecified, when
|
---|
391 | transmitting the packet afterwards, the source address filled in each outgoing IPv6 packet
|
---|
392 | is decided based on the destination of this packet.
|
---|
393 |
|
---|
394 | If operational parameters are reset or changed, any pending transmit and receive requests will be
|
---|
395 | cancelled. Their completion token status will be set to EFI_ABORTED, and their events will be
|
---|
396 | signaled.
|
---|
397 |
|
---|
398 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
399 | @param[in] Ip6ConfigData The pointer to the EFI IPv6 Protocol configuration data structure.
|
---|
400 | If NULL, reset the configuration data.
|
---|
401 |
|
---|
402 | @retval EFI_SUCCESS The driver instance was successfully opened.
|
---|
403 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
404 | - This is NULL.
|
---|
405 | - Ip6ConfigData.StationAddress is neither zero nor
|
---|
406 | a unicast IPv6 address.
|
---|
407 | - Ip6ConfigData.StationAddress is neither zero nor
|
---|
408 | one of the configured IP addresses in the EFI IPv6 driver.
|
---|
409 | - Ip6ConfigData.DefaultProtocol is illegal.
|
---|
410 | @retval EFI_OUT_OF_RESOURCES The EFI IPv6 Protocol driver instance data could not be allocated.
|
---|
411 | @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing a source address for
|
---|
412 | this instance, but no source address was available for use.
|
---|
413 | @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the IPv6
|
---|
414 | address or prefix length can be changed.
|
---|
415 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv6
|
---|
416 | Protocol driver instance was not opened.
|
---|
417 | @retval EFI_UNSUPPORTED Default protocol specified through
|
---|
418 | Ip6ConfigData.DefaulProtocol isn't supported.
|
---|
419 |
|
---|
420 | **/
|
---|
421 | EFI_STATUS
|
---|
422 | EFIAPI
|
---|
423 | EfiIp6Configure (
|
---|
424 | IN EFI_IP6_PROTOCOL *This,
|
---|
425 | IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
|
---|
426 | );
|
---|
427 |
|
---|
428 | /**
|
---|
429 | Joins and leaves multicast groups.
|
---|
430 |
|
---|
431 | The Groups() function is used to join and leave multicast group sessions. Joining a group will
|
---|
432 | enable reception of matching multicast packets. Leaving a group will disable reception of matching
|
---|
433 | multicast packets. Source-Specific Multicast isn't required to be supported.
|
---|
434 |
|
---|
435 | If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
|
---|
436 |
|
---|
437 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
438 | @param[in] JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
|
---|
439 | @param[in] GroupAddress The pointer to the IPv6 multicast address.
|
---|
440 | This is an optional parameter that may be NULL.
|
---|
441 |
|
---|
442 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
443 | @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
|
---|
444 | - This is NULL.
|
---|
445 | - JoinFlag is TRUE and GroupAddress is NULL.
|
---|
446 | - GroupAddress is not NULL and *GroupAddress is
|
---|
447 | not a multicast IPv6 address.
|
---|
448 | - GroupAddress is not NULL and *GroupAddress is in the
|
---|
449 | range of SSM destination address.
|
---|
450 | @retval EFI_NOT_STARTED This instance has not been started.
|
---|
451 | @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
|
---|
452 | @retval EFI_UNSUPPORTED This EFI IPv6 Protocol implementation does not support multicast groups.
|
---|
453 | @retval EFI_ALREADY_STARTED The group address is already in the group table (when
|
---|
454 | JoinFlag is TRUE).
|
---|
455 | @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
|
---|
456 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
457 |
|
---|
458 | **/
|
---|
459 | EFI_STATUS
|
---|
460 | EFIAPI
|
---|
461 | EfiIp6Groups (
|
---|
462 | IN EFI_IP6_PROTOCOL *This,
|
---|
463 | IN BOOLEAN JoinFlag,
|
---|
464 | IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
|
---|
465 | );
|
---|
466 |
|
---|
467 | /**
|
---|
468 | Adds and deletes routing table entries.
|
---|
469 |
|
---|
470 | The Routes() function adds a route to or deletes a route from the routing table.
|
---|
471 |
|
---|
472 | Routes are determined by comparing the leftmost PrefixLength bits of Destination with
|
---|
473 | the destination IPv6 address arithmetically. The gateway address must be on the same subnet as the
|
---|
474 | configured station address.
|
---|
475 |
|
---|
476 | The default route is added with Destination and PrefixLegth both set to all zeros. The
|
---|
477 | default route matches all destination IPv6 addresses that do not match any other routes.
|
---|
478 |
|
---|
479 | All EFI IPv6 Protocol instances share a routing table.
|
---|
480 |
|
---|
481 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
482 | @param[in] DeleteRoute Set to TRUE to delete this route from the routing table. Set to
|
---|
483 | FALSE to add this route to the routing table. Destination,
|
---|
484 | PrefixLength and Gateway are used as the key to each
|
---|
485 | route entry.
|
---|
486 | @param[in] Destination The address prefix of the subnet that needs to be routed.
|
---|
487 | This is an optional parameter that may be NULL.
|
---|
488 | @param[in] PrefixLength The prefix length of Destination. Ignored if Destination
|
---|
489 | is NULL.
|
---|
490 | @param[in] GatewayAddress The unicast gateway IPv6 address for this route.
|
---|
491 | This is an optional parameter that may be NULL.
|
---|
492 |
|
---|
493 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
494 | @retval EFI_NOT_STARTED The driver instance has not been started.
|
---|
495 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
496 | - This is NULL.
|
---|
497 | - When DeleteRoute is TRUE, both Destination and
|
---|
498 | GatewayAddress are NULL.
|
---|
499 | - When DeleteRoute is FALSE, either Destination or
|
---|
500 | GatewayAddress is NULL.
|
---|
501 | - *GatewayAddress is not a valid unicast IPv6 address.
|
---|
502 | - *GatewayAddress is one of the local configured IPv6
|
---|
503 | addresses.
|
---|
504 | @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
|
---|
505 | @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
|
---|
506 | @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
|
---|
507 | DeleteRoute is FALSE).
|
---|
508 |
|
---|
509 | **/
|
---|
510 | EFI_STATUS
|
---|
511 | EFIAPI
|
---|
512 | EfiIp6Routes (
|
---|
513 | IN EFI_IP6_PROTOCOL *This,
|
---|
514 | IN BOOLEAN DeleteRoute,
|
---|
515 | IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
|
---|
516 | IN UINT8 PrefixLength,
|
---|
517 | IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
|
---|
518 | );
|
---|
519 |
|
---|
520 | /**
|
---|
521 | Add or delete Neighbor cache entries.
|
---|
522 |
|
---|
523 | The Neighbors() function is used to add, update, or delete an entry from a neighbor cache.
|
---|
524 | IPv6 neighbor cache entries are typically inserted and updated by the network protocol driver as
|
---|
525 | network traffic is processed. Most neighbor cache entries will timeout and be deleted if the network
|
---|
526 | traffic stops. Neighbor cache entries that were inserted by Neighbors() may be static (will not
|
---|
527 | timeout) or dynamic (will timeout).
|
---|
528 |
|
---|
529 | The implementation should follow the neighbor cache timeout mechanism defined in
|
---|
530 | RFC4861. The default neighbor cache timeout value should be tuned for the expected network
|
---|
531 | environment.
|
---|
532 |
|
---|
533 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
534 | @param[in] DeleteFlag Set to TRUE to delete the specified cache entry. Set to FALSE to
|
---|
535 | add (or update, if it already exists and Override is TRUE) the
|
---|
536 | specified cache entry. TargetIp6Address is used as the key
|
---|
537 | to find the requested cache entry.
|
---|
538 | @param[in] TargetIp6Address The pointer to the Target IPv6 address.
|
---|
539 | @param[in] TargetLinkAddress The pointer to link-layer address of the target. Ignored if NULL.
|
---|
540 | @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor
|
---|
541 | cache, it will be deleted after Timeout. A value of zero means that
|
---|
542 | the entry is permanent. A non-zero value means that the entry is
|
---|
543 | dynamic.
|
---|
544 | @param[in] Override If TRUE, the cached link-layer address of the matching entry will
|
---|
545 | be overridden and updated; if FALSE, EFI_ACCESS_DENIED
|
---|
546 | will be returned if a corresponding cache entry already exists.
|
---|
547 |
|
---|
548 | @retval EFI_SUCCESS The data has been queued for transmission.
|
---|
549 | @retval EFI_NOT_STARTED This instance has not been started.
|
---|
550 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
551 | - This is NULL.
|
---|
552 | - TargetIpAddress is NULL.
|
---|
553 | - *TargetLinkAddress is invalid when not NULL.
|
---|
554 | - *TargetIpAddress is not a valid unicast IPv6 address.
|
---|
555 | - *TargetIpAddress is one of the local configured IPv6
|
---|
556 | addresses.
|
---|
557 | @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache.
|
---|
558 | @retval EFI_NOT_FOUND This entry is not in the neighbor cache (when DeleteFlag is
|
---|
559 | TRUE or when DeleteFlag is FALSE while
|
---|
560 | TargetLinkAddress is NULL.).
|
---|
561 | @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache,
|
---|
562 | and that entry is tagged as un-overridden (when Override
|
---|
563 | is FALSE).
|
---|
564 |
|
---|
565 | **/
|
---|
566 | EFI_STATUS
|
---|
567 | EFIAPI
|
---|
568 | EfiIp6Neighbors (
|
---|
569 | IN EFI_IP6_PROTOCOL *This,
|
---|
570 | IN BOOLEAN DeleteFlag,
|
---|
571 | IN EFI_IPv6_ADDRESS *TargetIp6Address,
|
---|
572 | IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
|
---|
573 | IN UINT32 Timeout,
|
---|
574 | IN BOOLEAN Override
|
---|
575 | );
|
---|
576 |
|
---|
577 | /**
|
---|
578 | Places outgoing data packets into the transmit queue.
|
---|
579 |
|
---|
580 | The Transmit() function places a sending request in the transmit queue of this
|
---|
581 | EFI IPv6 Protocol instance. Whenever the packet in the token is sent out or some
|
---|
582 | errors occur, the event in the token will be signaled and the status is updated.
|
---|
583 |
|
---|
584 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
585 | @param[in] Token The pointer to the transmit token.
|
---|
586 |
|
---|
587 | @retval EFI_SUCCESS The data has been queued for transmission.
|
---|
588 | @retval EFI_NOT_STARTED This instance has not been started.
|
---|
589 | @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing
|
---|
590 | a source address for this transmission,
|
---|
591 | but no source address was available for use.
|
---|
592 | @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
|
---|
593 | - This is NULL.
|
---|
594 | - Token is NULL.
|
---|
595 | - Token.Event is NULL.
|
---|
596 | - Token.Packet.TxData is NULL.
|
---|
597 | - Token.Packet.ExtHdrsLength is not zero and
|
---|
598 | Token.Packet.ExtHdrs is NULL.
|
---|
599 | - Token.Packet.FragmentCount is zero.
|
---|
600 | - One or more of the Token.Packet.TxData.
|
---|
601 | FragmentTable[].FragmentLength fields is zero.
|
---|
602 | - One or more of the Token.Packet.TxData.
|
---|
603 | FragmentTable[].FragmentBuffer fields is NULL.
|
---|
604 | - Token.Packet.TxData.DataLength is zero or not
|
---|
605 | equal to the sum of fragment lengths.
|
---|
606 | - Token.Packet.TxData.DestinationAddress is non-
|
---|
607 | zero when DestinationAddress is configured as
|
---|
608 | non-zero when doing Configure() for this
|
---|
609 | EFI IPv6 protocol instance.
|
---|
610 | - Token.Packet.TxData.DestinationAddress is
|
---|
611 | unspecified when DestinationAddress is unspecified
|
---|
612 | when doing Configure() for this EFI IPv6 protocol
|
---|
613 | instance.
|
---|
614 | @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.
|
---|
615 | The event was already in the transmit queue.
|
---|
616 | @retval EFI_NOT_READY The completion token could not be queued because
|
---|
617 | the transmit queue is full.
|
---|
618 | @retval EFI_NOT_FOUND Not route is found to the destination address.
|
---|
619 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
|
---|
620 | @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
|
---|
621 | short to transmit.
|
---|
622 | @retval EFI_BAD_BUFFER_SIZE If Token.Packet.TxData.DataLength is beyond the
|
---|
623 | maximum that which can be described through the
|
---|
624 | Fragment Offset field in Fragment header when
|
---|
625 | performing fragmentation.
|
---|
626 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
627 |
|
---|
628 | **/
|
---|
629 | EFI_STATUS
|
---|
630 | EFIAPI
|
---|
631 | EfiIp6Transmit (
|
---|
632 | IN EFI_IP6_PROTOCOL *This,
|
---|
633 | IN EFI_IP6_COMPLETION_TOKEN *Token
|
---|
634 | );
|
---|
635 |
|
---|
636 | /**
|
---|
637 | Places a receiving request into the receiving queue.
|
---|
638 |
|
---|
639 | The Receive() function places a completion token into the receive packet queue.
|
---|
640 | This function is always asynchronous.
|
---|
641 |
|
---|
642 | The Token.Event field in the completion token must be filled in by the caller
|
---|
643 | and cannot be NULL. When the receive operation completes, the EFI IPv6 Protocol
|
---|
644 | driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
|
---|
645 | is signaled.
|
---|
646 |
|
---|
647 | Current Udp implementation creates an IP child for each Udp child.
|
---|
648 | It initates a asynchronous receive immediately whether or not
|
---|
649 | there is no mapping. Therefore, disable the returning EFI_NO_MAPPING for now.
|
---|
650 | To enable it, the following check must be performed:
|
---|
651 |
|
---|
652 | if (NetIp6IsUnspecifiedAddr (&Config->StationAddress) && IP6_NO_MAPPING (IpInstance)) {
|
---|
653 | Status = EFI_NO_MAPPING;
|
---|
654 | goto Exit;
|
---|
655 | }
|
---|
656 |
|
---|
657 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
658 | @param[in] Token The pointer to a token that is associated with the
|
---|
659 | receive data descriptor.
|
---|
660 |
|
---|
661 | @retval EFI_SUCCESS The receive completion token was cached.
|
---|
662 | @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.
|
---|
663 | @retval EFI_NO_MAPPING When IP6 driver responsible for binding source address to this instance,
|
---|
664 | while no source address is available for use.
|
---|
665 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
666 | - This is NULL.
|
---|
667 | - Token is NULL.
|
---|
668 | - Token.Event is NULL.
|
---|
669 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
|
---|
670 | resources (usually memory).
|
---|
671 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
672 | The EFI IPv6 Protocol instance has been reset to startup defaults.
|
---|
673 | @retval EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
|
---|
674 | in the receive queue.
|
---|
675 | @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
|
---|
676 |
|
---|
677 | **/
|
---|
678 | EFI_STATUS
|
---|
679 | EFIAPI
|
---|
680 | EfiIp6Receive (
|
---|
681 | IN EFI_IP6_PROTOCOL *This,
|
---|
682 | IN EFI_IP6_COMPLETION_TOKEN *Token
|
---|
683 | );
|
---|
684 |
|
---|
685 | /**
|
---|
686 | Abort an asynchronous transmit or receive request.
|
---|
687 |
|
---|
688 | The Cancel() function is used to abort a pending transmit or receive request.
|
---|
689 | If the token is in the transmit or receive request queues, after calling this
|
---|
690 | function, Token->Status will be set to EFI_ABORTED, and then Token->Event will
|
---|
691 | be signaled. If the token is not in one of the queues, which usually means the
|
---|
692 | asynchronous operation has completed, this function will not signal the token,
|
---|
693 | and EFI_NOT_FOUND is returned.
|
---|
694 |
|
---|
695 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
696 | @param[in] Token The pointer to a token that has been issued by
|
---|
697 | EFI_IP6_PROTOCOL.Transmit() or
|
---|
698 | EFI_IP6_PROTOCOL.Receive(). If NULL, all pending
|
---|
699 | tokens are aborted. Type EFI_IP6_COMPLETION_TOKEN is
|
---|
700 | defined in EFI_IP6_PROTOCOL.Transmit().
|
---|
701 |
|
---|
702 | @retval EFI_SUCCESS The asynchronous I/O request was aborted and
|
---|
703 | Token->Event was signaled. When Token is NULL, all
|
---|
704 | pending requests were aborted, and their events were signaled.
|
---|
705 | @retval EFI_INVALID_PARAMETER This is NULL.
|
---|
706 | @retval EFI_NOT_STARTED This instance has not been started.
|
---|
707 | @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
|
---|
708 | not found in the transmit or receive queue. It has either completed
|
---|
709 | or was not issued by Transmit() and Receive().
|
---|
710 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
711 |
|
---|
712 | **/
|
---|
713 | EFI_STATUS
|
---|
714 | EFIAPI
|
---|
715 | EfiIp6Cancel (
|
---|
716 | IN EFI_IP6_PROTOCOL *This,
|
---|
717 | IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
|
---|
718 | );
|
---|
719 |
|
---|
720 | /**
|
---|
721 | Polls for incoming data packets and processes outgoing data packets.
|
---|
722 |
|
---|
723 | The Poll() function polls for incoming data packets and processes outgoing data
|
---|
724 | packets. Network drivers and applications can call the EFI_IP6_PROTOCOL.Poll()
|
---|
725 | function to increase the rate that data packets are moved between the communications
|
---|
726 | device and the transmit and receive queues.
|
---|
727 |
|
---|
728 | In some systems the periodic timer event may not poll the underlying communications
|
---|
729 | device fast enough to transmit and/or receive all data packets without missing
|
---|
730 | incoming packets or dropping outgoing packets. Drivers and applications that are
|
---|
731 | experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function
|
---|
732 | more often.
|
---|
733 |
|
---|
734 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.
|
---|
735 |
|
---|
736 | @retval EFI_SUCCESS Incoming or outgoing data was processed.
|
---|
737 | @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.
|
---|
738 | @retval EFI_INVALID_PARAMETER This is NULL.
|
---|
739 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
740 | @retval EFI_NOT_READY No incoming or outgoing data was processed.
|
---|
741 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
|
---|
742 | Consider increasing the polling rate.
|
---|
743 |
|
---|
744 | **/
|
---|
745 | EFI_STATUS
|
---|
746 | EFIAPI
|
---|
747 | EfiIp6Poll (
|
---|
748 | IN EFI_IP6_PROTOCOL *This
|
---|
749 | );
|
---|
750 |
|
---|
751 | #endif
|
---|