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