TianoCore EDK2 master
|
#include "Dhcp6Impl.h"
Go to the source code of this file.
Macros | |
#define | IS_INVALID_PACKET_CURSOR(PacketCursor, Packet) |
Dhcp6 support functions implementation.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Dhcp6Utility.c.
#define IS_INVALID_PACKET_CURSOR | ( | PacketCursor, | |
Packet | |||
) |
Definition at line 17 of file Dhcp6Utility.c.
BOOLEAN Dhcp6AddrIsInCurrentIa | ( | IN EFI_DHCP6_IA_ADDRESS * | IaAddr, |
IN EFI_DHCP6_IA * | CurrentIa | ||
) |
Check whether the incoming IPv6 address in IaAddr is one of the maintained addresses in the IA control block.
[in] | IaAddr | The pointer to the IA Address to be checked. |
[in] | CurrentIa | The pointer to the IA in IA control block. |
TRUE | Yes, this Address is already in IA control block. |
FALSE | No, this Address is NOT in IA control block. |
Definition at line 1206 of file Dhcp6Utility.c.
VOID Dhcp6AppendCacheIa | ( | IN DHCP6_INSTANCE * | Instance | ) |
Append CacheIa to the current IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
[in] | Instance | The pointer to DHCP6 instance. |
Definition at line 1440 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6AppendETOption | ( | IN OUT EFI_DHCP6_PACKET * | Packet, |
IN OUT UINT8 ** | PacketCursor, | ||
IN DHCP6_INSTANCE * | Instance, | ||
OUT UINT16 ** | Elapsed | ||
) |
Append the appointed Elapsed time option to Buf, and move Buf to the end.
[in,out] | Packet | A pointer to the packet, on success Packet->Length will be updated. |
[in,out] | PacketCursor | The pointer in the packet, on success PacketCursor will be moved to the end of the option. |
[in] | Instance | The pointer to the Dhcp6 instance. |
[out] | Elapsed | The pointer to the elapsed time value in the generated packet. |
EFI_INVALID_PARAMETER | An argument provided to the function was invalid |
EFI_BUFFER_TOO_SMALL | The buffer is too small to append the option. |
EFI_SUCCESS | The option is appended successfully. |
Definition at line 968 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6AppendIaAddrOption | ( | IN OUT EFI_DHCP6_PACKET * | Packet, |
IN OUT UINT8 ** | PacketCursor, | ||
IN EFI_DHCP6_IA_ADDRESS * | IaAddr, | ||
IN UINT32 | MessageType | ||
) |
Append the appointed IA Address option to Buf, and move Buf to the end.
[in,out] | Packet | A pointer to the packet, on success Packet->Length will be updated. |
[in,out] | PacketCursor | The pointer in the packet, on success PacketCursor will be moved to the end of the option. |
[in] | IaAddr | The pointer to the IA Address. |
[in] | MessageType | Message type of DHCP6 package. |
EFI_INVALID_PARAMETER | An argument provided to the function was invalid |
EFI_BUFFER_TOO_SMALL | The buffer is too small to append the option. |
EFI_SUCCESS | The option is appended successfully. |
Definition at line 697 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6AppendIaOption | ( | IN OUT EFI_DHCP6_PACKET * | Packet, |
IN OUT UINT8 ** | PacketCursor, | ||
IN EFI_DHCP6_IA * | Ia, | ||
IN UINT32 | T1, | ||
IN UINT32 | T2, | ||
IN UINT32 | MessageType | ||
) |
Append the appointed Ia option to Buf, and move Buf to the end.
[in,out] | Packet | A pointer to the packet, on success Packet->Length will be updated. |
[in,out] | PacketCursor | The pointer in the packet, on success PacketCursor will be moved to the end of the option. |
[in] | Ia | The pointer to the Ia. |
[in] | T1 | The time of T1. |
[in] | T2 | The time of T2. |
[in] | MessageType | Message type of DHCP6 package. |
EFI_INVALID_PARAMETER | An argument provided to the function was invalid |
EFI_BUFFER_TOO_SMALL | The buffer is too small to append the option. |
EFI_SUCCESS | The option is appended successfully. |
Definition at line 824 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6AppendOption | ( | IN OUT EFI_DHCP6_PACKET * | Packet, |
IN OUT UINT8 ** | PacketCursor, | ||
IN UINT16 | OptType, | ||
IN UINT16 | OptLen, | ||
IN UINT8 * | Data | ||
) |
Append the option to Buf, update the length of packet, and move Buf to the end.
[in,out] | Packet | A pointer to the packet, on success Packet->Length will be updated. |
[in,out] | PacketCursor | The pointer in the packet, on success PacketCursor will be moved to the end of the option. |
[in] | OptType | The option type. |
[in] | OptLen | The length of option contents. |
[in] | Data | The pointer to the option content. |
EFI_INVALID_PARAMETER | An argument provided to the function was invalid |
EFI_BUFFER_TOO_SMALL | The buffer is too small to append the option. |
EFI_SUCCESS | The option is appended successfully. |
Definition at line 606 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6CacheIa | ( | IN DHCP6_INSTANCE * | Instance | ) |
Cache the current IA configuration information.
[in] | Instance | The pointer to DHCP6 Instance. |
EFI_SUCCESS | Cache the current IA successfully. |
EFI_OUT_OF_RESOURCES | Required system resources could not be allocated. |
Definition at line 1407 of file Dhcp6Utility.c.
Calculate the expire time by the algorithm defined in rfc.
[in] | Base | The base value of the time. |
[in] | IsFirstRt | If TRUE, it is the first time to calculate expire time. |
[in] | NeedSigned | If TRUE, the signed factor is needed. |
Definition at line 321 of file Dhcp6Utility.c.
VOID Dhcp6CalculateLeaseTime | ( | IN DHCP6_IA_CB * | IaCb | ) |
Calculate the lease time by the algorithm defined in rfc.
[in] | IaCb | The pointer to the Ia control block. |
Definition at line 372 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6CheckAddress | ( | IN EFI_DHCP6_IA * | Ia, |
IN UINT32 | AddressCount, | ||
IN EFI_IPv6_ADDRESS * | Addresses | ||
) |
Check whether the addresses are all included by the configured Ia.
[in] | Ia | The pointer to the Ia. |
[in] | AddressCount | The number of addresses. |
[in] | Addresses | The pointer to the addresses buffer. |
EFI_SUCCESS | The addresses are all included by the configured IA. |
EFI_NOT_FOUND | The addresses are not included by the configured IA. |
Definition at line 416 of file Dhcp6Utility.c.
VOID Dhcp6CleanupConfigData | ( | IN OUT EFI_DHCP6_CONFIG_DATA * | CfgData | ) |
Clean up the configure data.
[in,out] | CfgData | The pointer to the configure data. |
Definition at line 251 of file Dhcp6Utility.c.
VOID Dhcp6CleanupModeData | ( | IN OUT EFI_DHCP6_MODE_DATA * | ModeData | ) |
Clean up the mode data.
[in,out] | ModeData | The pointer to the mode data. |
Definition at line 286 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6CopyConfigData | ( | IN EFI_DHCP6_CONFIG_DATA * | DstCfg, |
IN EFI_DHCP6_CONFIG_DATA * | SorCfg | ||
) |
Copy the Dhcp6 configure data.
[in] | DstCfg | The pointer to the destination configure data. |
[in] | SorCfg | The pointer to the source configure data. |
EFI_SUCCESS | Copy the content from SorCfg from DstCfg successfully. |
EFI_OUT_OF_RESOURCES | Required system resources could not be allocated. |
Definition at line 180 of file Dhcp6Utility.c.
EFI_DHCP6_IA * Dhcp6DepriveAddress | ( | IN EFI_DHCP6_IA * | Ia, |
IN UINT32 | AddressCount, | ||
IN EFI_IPv6_ADDRESS * | Addresses | ||
) |
Deprive the addresses from current Ia, and generate another eliminated Ia.
[in] | Ia | The pointer to the Ia. |
[in] | AddressCount | The number of addresses. |
[in] | Addresses | The pointer to the addresses buffer. |
NULL | If it failed to generate the deprived Ia. |
others | The pointer to the deprived Ia. |
Definition at line 465 of file Dhcp6Utility.c.
VOID EFIAPI Dhcp6DummyExtFree | ( | IN VOID * | Arg | ) |
The dummy ext buffer free callback routine.
[in] | Arg | The pointer to the parameter. |
Definition at line 562 of file Dhcp6Utility.c.
EFI_DHCP6_DUID * Dhcp6GenerateClientId | ( | IN EFI_SIMPLE_NETWORK_MODE * | Mode | ) |
Generate client Duid in the format of Duid-llt.
[in] | Mode | The pointer to the mode of SNP. |
NULL | If it failed to generate a client Id. |
others | The pointer to the new client id. |
Definition at line 33 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6GenerateIaCb | ( | IN DHCP6_INSTANCE * | Instance, |
IN UINT8 * | IaInnerOpt, | ||
IN UINT16 | IaInnerLen, | ||
IN UINT32 | T1, | ||
IN UINT32 | T2 | ||
) |
Create a control block for the Ia according to the corresponding options.
[in] | Instance | The pointer to DHCP6 Instance. |
[in] | IaInnerOpt | The pointer to the inner options in the Ia option. |
[in] | IaInnerLen | The length of all the inner options in the Ia option. |
[in] | T1 | T1 time in the Ia option. |
[in] | T2 | T2 time in the Ia option. |
EFI_NOT_FOUND | No valid IA option is found. |
EFI_SUCCESS | Create an IA control block successfully. |
EFI_OUT_OF_RESOURCES | Required system resources could not be allocated. |
EFI_DEVICE_ERROR | An unexpected error. |
Definition at line 1326 of file Dhcp6Utility.c.
EFI_STATUS Dhcp6GetMappingTimeOut | ( | IN EFI_IP6_CONFIG_PROTOCOL * | Ip6Cfg, |
OUT UINTN * | TimeOut | ||
) |
Calculate the Dhcp6 get mapping timeout by adding additional delay to the IP6 DAD transmits count.
[in] | Ip6Cfg | The pointer to Ip6 config protocol. |
[out] | TimeOut | The time out value in 100ns units. |
EFI_INVALID_PARAMETER | Input parameters are invalid. |
EFI_SUCCESS | Calculate the time out value successfully. |
Definition at line 1499 of file Dhcp6Utility.c.
VOID EFIAPI Dhcp6OnTransmitted | ( | IN NET_BUF * | Wrap, |
IN UDP_END_POINT * | EndPoint, | ||
IN EFI_STATUS | IoStatus, | ||
IN VOID * | Context | ||
) |
The callback routine once message transmitted.
[in] | Wrap | The pointer to the received net buffer. |
[in] | EndPoint | The pointer to the udp end point. |
[in] | IoStatus | The return status from udp io. |
[in] | Context | The opaque parameter to the function. |
Definition at line 579 of file Dhcp6Utility.c.
VOID Dhcp6ParseAddrOption | ( | IN EFI_DHCP6_IA * | CurrentIa, |
IN UINT8 * | IaInnerOpt, | ||
IN UINT16 | IaInnerLen, | ||
OUT UINT32 * | AddrNum, | ||
IN OUT EFI_DHCP6_IA_ADDRESS * | AddrBuf | ||
) |
Parse the address option and update the address information.
[in] | CurrentIa | The pointer to the Ia Address in control block. |
[in] | IaInnerOpt | The pointer to the buffer. |
[in] | IaInnerLen | The length to parse. |
[out] | AddrNum | The number of addresses. |
[in,out] | AddrBuf | The pointer to the address buffer. |
Definition at line 1235 of file Dhcp6Utility.c.
UINT8 * Dhcp6SeekIaOption | ( | IN UINT8 * | Buf, |
IN UINT32 | SeekLen, | ||
IN EFI_DHCP6_IA_DESCRIPTOR * | IaDesc | ||
) |
Seek the address of the first byte of the Ia option header.
[in] | Buf | The pointer to the buffer. |
[in] | SeekLen | The length to seek. |
[in] | IaDesc | The pointer to the Ia descriptor. |
NULL | If it failed to seek the Ia option. |
others | The position to the Ia option. |
Definition at line 1161 of file Dhcp6Utility.c.
Seek the address of the first byte of the option header.
[in] | Buf | The pointer to the buffer. |
[in] | SeekLen | The length to seek. |
[in] | OptType | The option type. |
NULL | If it failed to seek the option. |
others | The position to the option. |
Definition at line 1118 of file Dhcp6Utility.c.
VOID SetElapsedTime | ( | IN UINT16 * | Elapsed, |
IN DHCP6_INSTANCE * | Instance | ||
) |
Set the elapsed time based on the given instance and the pointer to the elapsed time option.
[in] | Elapsed | The pointer to the position to append. |
[in] | Instance | The pointer to the Dhcp6 instance. |
Definition at line 1062 of file Dhcp6Utility.c.