TianoCore EDK2 master
|
#include "Ip6Impl.h"
Go to the source code of this file.
The implementation of common functions shared by IP6 driver.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Ip6Common.c.
VOID Ip6AddAddr | ( | IN OUT IP6_INTERFACE * | IpIf, |
IN IP6_ADDRESS_INFO * | AddrInfo | ||
) |
Insert a node IP6_ADDRESS_INFO to an IP6 interface.
[in,out] | IpIf | Points to an IP6 interface. |
[in] | AddrInfo | Points to IP6_ADDRESS_INFO |
Definition at line 316 of file Ip6Common.c.
EFI_STATUS Ip6BuildEfiAddressList | ( | IN IP6_SERVICE * | IpSb, |
OUT UINT32 * | AddressCount, | ||
OUT EFI_IP6_ADDRESS_INFO **AddressList | OPTIONAL | ||
) |
Build a array of EFI_IP6_ADDRESS_INFO to be returned to the caller. The number of EFI_IP6_ADDRESS_INFO is also returned. If AddressList is NULL, only the address count is returned.
[in] | IpSb | The IP6 service binding instance. |
[out] | AddressCount | The number of returned addresses. |
[out] | AddressList | The pointer to the array of EFI_IP6_ADDRESS_INFO. This is an optional parameter. |
EFI_SUCCESS | The address array successfully built. |
EFI_OUT_OF_RESOURCES | Failed to allocate the memory for the address info. |
EFI_INVALID_PARAMETER | Any input parameter is invalid. |
Definition at line 29 of file Ip6Common.c.
VOID Ip6CopyAddressByPrefix | ( | OUT EFI_IPv6_ADDRESS * | Dest, |
IN EFI_IPv6_ADDRESS * | Src, | ||
IN UINT8 | PrefixLength | ||
) |
Copy the PrefixLength bits from Src to Dest.
[out] | Dest | A pointer to the buffer to copy to. |
[in] | Src | A pointer to the buffer to copy from. |
[in] | PrefixLength | The number of bits to copy. |
Definition at line 593 of file Ip6Common.c.
UINT8 * Ip6CreateInterfaceID | ( | IN OUT IP6_SERVICE * | IpSb | ) |
This function converts MAC address to 64 bits interface ID according to RFC4291 and returns the interface ID. Currently only 48-bit MAC address is supported by this function.
[in,out] | IpSb | The IP6 service binding instance. |
NULL | The operation fails. |
Definition at line 142 of file Ip6Common.c.
EFI_IPv6_ADDRESS * Ip6CreateLinkLocalAddr | ( | IN OUT IP6_SERVICE * | IpSb | ) |
This function creates link-local address from interface identifier. The interface identifier is normally created from MAC address. It might be manually configured by administrator if the link-local address created from MAC address is a duplicate address.
[in,out] | IpSb | The IP6 service binding instance. |
NULL | If the operation fails. |
Definition at line 200 of file Ip6Common.c.
VOID Ip6CreateSNMulticastAddr | ( | IN EFI_IPv6_ADDRESS * | Ip6Addr, |
OUT EFI_IPv6_ADDRESS * | MulticastAddr | ||
) |
Compute the solicited-node multicast address for an unicast or anycast address, by taking the low-order 24 bits of this address, and appending those bits to the prefix FF02:0:0:0:0:1:FF00::/104.
[in] | Ip6Addr | The unicast or anycast address, in network order. |
[out] | MulticastAddr | The generated solicited-node multicast address, in network order. |
Definition at line 291 of file Ip6Common.c.
EFI_STATUS EFIAPI Ip6DestroyChildEntryByAddr | ( | IN LIST_ENTRY * | Entry, |
IN VOID * | Context | ||
) |
Callback function which provided by user to remove one node in NetDestroyLinkList process.
[in] | Entry | The entry to be removed. |
[in] | Context | Pointer to the callback context corresponds to the Context in NetDestroyLinkList. |
EFI_SUCCESS | The entry has been removed successfully. |
Others | Fail to remove the entry. |
Definition at line 337 of file Ip6Common.c.
VOID Ip6DestroyInstanceByAddress | ( | IN OUT IP6_SERVICE * | IpSb, |
IN EFI_IPv6_ADDRESS * | Address | ||
) |
Destroy the IP instance if its StationAddress is removed. It is the help function for Ip6RemoveAddr().
[in,out] | IpSb | Points to an IP6 service binding instance. |
[in] | Address | The to be removed address |
Definition at line 366 of file Ip6Common.c.
EFI_STATUS Ip6GetMulticastMac | ( | IN EFI_MANAGED_NETWORK_PROTOCOL * | Mnp, |
IN EFI_IPv6_ADDRESS * | Multicast, | ||
OUT EFI_MAC_ADDRESS * | Mac | ||
) |
Get the MAC address for a multicast IP address. Call Mnp's McastIpToMac to find the MAC address instead of hard-coding the NIC to be Ethernet.
[in] | Mnp | The Mnp instance to get the MAC address. |
[in] | Multicast | The multicast IP address to translate. |
[out] | Mac | The buffer to hold the translated address. |
EFI_SUCCESS | The multicast IP successfully translated to a multicast MAC address. |
Other | The address is not converted because an error occurred. |
Definition at line 635 of file Ip6Common.c.
BOOLEAN Ip6IsOneOfSetAddress | ( | IN IP6_SERVICE * | IpSb, |
IN EFI_IPv6_ADDRESS * | Address, | ||
OUT IP6_INTERFACE **Interface | OPTIONAL, | ||
OUT IP6_ADDRESS_INFO **AddressInfo | OPTIONAL | ||
) |
Check whether the incoming IPv6 address is one of the maintained addresses in the IP6 service binding instance.
[in] | IpSb | Points to a IP6 service binding instance. |
[in] | Address | The IP6 address to be checked. |
[out] | Interface | If not NULL, output the IP6 interface which maintains the Address. |
[out] | AddressInfo | If not NULL, output the IP6 address information of the Address. |
TRUE | Yes, it is one of the maintained address. |
FALSE | No, it is not one of the maintained address. |
Definition at line 504 of file Ip6Common.c.
BOOLEAN Ip6IsSNMulticastAddr | ( | IN EFI_IPv6_ADDRESS * | Ip6 | ) |
Check whether the incoming Ipv6 address is a solicited-node multicast address.
[in] | Ip6 | Ip6 address, in network order. |
TRUE | Yes, solicited-node multicast address |
FALSE | No |
Definition at line 471 of file Ip6Common.c.
BOOLEAN Ip6IsValidLinkAddress | ( | IN IP6_SERVICE * | IpSb, |
IN EFI_MAC_ADDRESS * | LinkAddress | ||
) |
Check whether the incoming MAC address is valid.
[in] | IpSb | Points to a IP6 service binding instance. |
[in] | LinkAddress | The MAC address. |
TRUE | Yes, it is valid. |
FALSE | No, it is not valid. |
Definition at line 565 of file Ip6Common.c.
EFI_IP6_HEADER * Ip6NtohHead | ( | IN OUT EFI_IP6_HEADER * | Head | ) |
Convert the multibyte field in IP header's byter order. In spite of its name, it can also be used to convert from host to network byte order.
[in,out] | Head | The IP head to convert. |
Definition at line 659 of file Ip6Common.c.
EFI_STATUS Ip6RemoveAddr | ( | IN IP6_SERVICE *IpSb | OPTIONAL, |
IN OUT LIST_ENTRY * | AddressList, | ||
IN OUT UINT32 * | AddressCount, | ||
IN EFI_IPv6_ADDRESS *Prefix | OPTIONAL, | ||
IN UINT8 | PrefixLength | ||
) |
Remove the IPv6 address from the address list node points to IP6_ADDRESS_INFO.
This function removes the matching IPv6 addresses from the address list and adjusts the address count of the address list. If IpSb is not NULL, this function calls Ip6LeaveGroup to see whether it should call Mnp->Groups() to remove the its solicited-node multicast MAC address from the filter list and sends out a Multicast Listener Done. If Prefix is NULL, all address in the address list will be removed. If Prefix is not NULL, the address that matching the Prefix with PrefixLength in the address list will be removed.
[in] | IpSb | NULL or points to IP6 service binding instance. |
[in,out] | AddressList | Address list array. |
[in,out] | AddressCount | The count of addresses in address list array. |
[in] | Prefix | NULL or an IPv6 address prefix. |
[in] | PrefixLength | The length of Prefix. |
EFI_SUCCESS | The operation completed successfully. |
EFI_NOT_FOUND | The address matching the Prefix with PrefixLength cannot be found in the address list. |
EFI_INVALID_PARAMETER | Any input parameter is invalid. |
Definition at line 411 of file Ip6Common.c.
EFI_STATUS Ip6SetToAllNodeMulticast | ( | IN BOOLEAN | Router, |
IN UINT8 | Scope, | ||
OUT EFI_IPv6_ADDRESS * | Ip6Addr | ||
) |
Generate the multicast addresses identify the group of all IPv6 nodes or IPv6 routers defined in RFC4291.
All Nodes Addresses: FF01::1, FF02::1. All Router Addresses: FF01::2, FF02::2, FF05::2.
[in] | Router | If TRUE, generate all routers addresses, else generate all node addresses. |
[in] | Scope | interface-local(1), link-local(2), or site-local(5) |
[out] | Ip6Addr | The generated multicast address. |
EFI_INVALID_PARAMETER | Any input parameter is invalid. |
EFI_SUCCESS | The address is generated. |
Definition at line 103 of file Ip6Common.c.