TianoCore EDK2 master
Loading...
Searching...
No Matches
Dhcp6Io.c File Reference
#include "Dhcp6Impl.h"

Go to the source code of this file.

Functions

EFI_STATUS Dhcp6EnqueueRetry (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet, IN UINT16 *Elapsed, IN EFI_DHCP6_RETRANSMISSION *RetryCtl OPTIONAL)
 
EFI_STATUS Dhcp6DequeueRetry (IN DHCP6_INSTANCE *Instance, IN UINT32 PacketXid, IN BOOLEAN NeedSignal)
 
VOID Dhcp6CleanupRetry (IN DHCP6_INSTANCE *Instance, IN UINT32 Scope)
 
BOOLEAN Dhcp6IsValidTxCb (IN DHCP6_INSTANCE *Instance, IN DHCP6_TX_CB *TxCb)
 
VOID Dhcp6CleanupSession (IN OUT DHCP6_INSTANCE *Instance, IN EFI_STATUS Status)
 
EFI_STATUS EFIAPI Dhcp6CallbackUser (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_EVENT Event, IN OUT EFI_DHCP6_PACKET **Packet)
 
EFI_STATUS Dhcp6UpdateIaInfo (IN OUT DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet)
 
EFI_STATUS Dhcp6SeekInnerOptionSafe (IN UINT16 IaType, IN UINT8 *Option, IN UINT32 OptionLen, OUT UINT8 **IaInnerOpt, OUT UINT16 *IaInnerLen)
 
EFI_STATUS Dhcp6SeekStsOption (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet, OUT UINT8 **Option)
 
EFI_STATUS Dhcp6TransmitPacket (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet, IN UINT16 *Elapsed)
 
EFI_STATUS Dhcp6SendSolicitMsg (IN DHCP6_INSTANCE *Instance)
 
EFI_STATUS Dhcp6InitSolicitMsg (IN DHCP6_INSTANCE *Instance)
 
EFI_STATUS Dhcp6SendRequestMsg (IN DHCP6_INSTANCE *Instance)
 
EFI_STATUS Dhcp6SendDeclineMsg (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_IA *DecIa)
 
EFI_STATUS Dhcp6SendReleaseMsg (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_IA *RelIa)
 
EFI_STATUS Dhcp6SendRenewRebindMsg (IN DHCP6_INSTANCE *Instance, IN BOOLEAN RebindRequest)
 
EFI_STATUS Dhcp6StartInfoRequest (IN DHCP6_INSTANCE *Instance, IN BOOLEAN SendClientId, IN EFI_DHCP6_PACKET_OPTION *OptionRequest, IN UINT32 OptionCount, IN EFI_DHCP6_PACKET_OPTION *OptionList[] OPTIONAL, IN EFI_DHCP6_RETRANSMISSION *Retransmission, IN EFI_EVENT TimeoutEvent OPTIONAL, IN EFI_DHCP6_INFO_CALLBACK ReplyCallback, IN VOID *CallbackContext OPTIONAL)
 
EFI_STATUS Dhcp6SendInfoRequestMsg (IN DHCP6_INSTANCE *Instance, IN DHCP6_INF_CB *InfCb, IN BOOLEAN SendClientId, IN EFI_DHCP6_PACKET_OPTION *OptionRequest, IN UINT32 OptionCount, IN EFI_DHCP6_PACKET_OPTION *OptionList[], IN EFI_DHCP6_RETRANSMISSION *Retransmission)
 
EFI_STATUS Dhcp6SendConfirmMsg (IN DHCP6_INSTANCE *Instance)
 
EFI_STATUS Dhcp6HandleReplyMsg (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet)
 
EFI_STATUS Dhcp6SelectAdvertiseMsg (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *AdSelect)
 
EFI_STATUS Dhcp6HandleAdvertiseMsg (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet)
 
VOID Dhcp6HandleStateful (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet)
 
VOID Dhcp6HandleStateless (IN DHCP6_INSTANCE *Instance, IN EFI_DHCP6_PACKET *Packet)
 
VOID EFIAPI Dhcp6ReceivePacket (IN NET_BUF *Udp6Wrap, IN UDP_END_POINT *EndPoint, IN EFI_STATUS IoStatus, IN VOID *Context)
 
BOOLEAN Dhcp6LinkMovDetect (IN DHCP6_INSTANCE *Instance)
 
VOID EFIAPI Dhcp6OnTimerTick (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

Dhcp6 internal functions implementation.

(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Dhcp6Io.c.

Function Documentation

◆ Dhcp6CallbackUser()

EFI_STATUS EFIAPI Dhcp6CallbackUser ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_EVENT  Event,
IN OUT EFI_DHCP6_PACKET **  Packet 
)

Callback to user when Dhcp6 transmit/receive occurs.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]EventThe current Dhcp6 event.
[in,out]PacketThe pointer to the packet sending or received.
Return values
EFI_SUCCESSThe user function returns success.
EFI_NOT_READYDirect the caller to continue collecting the offer.
EFI_ABORTEDThe user function ask it to abort.

Definition at line 468 of file Dhcp6Io.c.

◆ Dhcp6CleanupRetry()

VOID Dhcp6CleanupRetry ( IN DHCP6_INSTANCE Instance,
IN UINT32  Scope 
)

Clean up the specific nodes in the retry list.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]ScopeThe scope of cleanup nodes.

Definition at line 292 of file Dhcp6Io.c.

◆ Dhcp6CleanupSession()

VOID Dhcp6CleanupSession ( IN OUT DHCP6_INSTANCE Instance,
IN EFI_STATUS  Status 
)

Clean up the session of the instance stateful exchange.

Parameters
[in,out]InstanceThe pointer to the Dhcp6 instance.
[in]StatusThe return status from udp.

Definition at line 387 of file Dhcp6Io.c.

◆ Dhcp6DequeueRetry()

EFI_STATUS Dhcp6DequeueRetry ( IN DHCP6_INSTANCE Instance,
IN UINT32  PacketXid,
IN BOOLEAN  NeedSignal 
)

Dequeue the packet from retry list if reply received or timeout at last.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketXidThe packet transaction id to match.
[in]NeedSignalIf TRUE, then an timeout event need be signaled when it is existed. Otherwise, this parameter is ignored.
Return values
EFI_SUCCESSSuccessfully dequeued the packet into retry list .
EFI_NOT_FOUNDThere is no xid matched in retry list.

Definition at line 230 of file Dhcp6Io.c.

◆ Dhcp6EnqueueRetry()

EFI_STATUS Dhcp6EnqueueRetry ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet,
IN UINT16 *  Elapsed,
IN EFI_DHCP6_RETRANSMISSION *RetryCtl  OPTIONAL 
)

Enqueue the packet into the retry list in case of timeout.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to the Dhcp6 packet to retry.
[in]ElapsedThe pointer to the elapsed time value in the packet.
[in]RetryCtlThe pointer to the transmission control of the packet. This parameter is optional and may be NULL.
Return values
EFI_SUCCESSSuccessfully enqueued the packet into the retry list according to its message type.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected message type.

Definition at line 29 of file Dhcp6Io.c.

◆ Dhcp6HandleAdvertiseMsg()

EFI_STATUS Dhcp6HandleAdvertiseMsg ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet 
)

Handle with the Dhcp6 advertisement message.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to the Dhcp6 advertisement message.
Return values
EFI_SUCCESSProcessed the advertisement message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to process the advertise message.

Definition at line 2639 of file Dhcp6Io.c.

◆ Dhcp6HandleReplyMsg()

EFI_STATUS Dhcp6HandleReplyMsg ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet 
)

Handle with the Dhcp6 reply message.

Parameters
[in]InstanceThe pointer to Dhcp6 instance.
[in]PacketThe pointer to the Dhcp6 reply message.
Return values
EFI_SUCCESSProcessed the reply message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to process the reply message.

Definition at line 2290 of file Dhcp6Io.c.

◆ Dhcp6HandleStateful()

VOID Dhcp6HandleStateful ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet 
)

The Dhcp6 stateful exchange process routine.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to the received Dhcp6 message.

Definition at line 2790 of file Dhcp6Io.c.

◆ Dhcp6HandleStateless()

VOID Dhcp6HandleStateless ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet 
)

The Dhcp6 stateless exchange process routine.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to the received Dhcp6 message.

Definition at line 2902 of file Dhcp6Io.c.

◆ Dhcp6InitSolicitMsg()

EFI_STATUS Dhcp6InitSolicitMsg ( IN DHCP6_INSTANCE Instance)

Configure some parameter to initiate SolicitMsg.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
Return values
EFI_SUCCESSCreated and sent the solicit message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
OthersFailed to send the solicit message.

Definition at line 1160 of file Dhcp6Io.c.

◆ Dhcp6IsValidTxCb()

BOOLEAN Dhcp6IsValidTxCb ( IN DHCP6_INSTANCE Instance,
IN DHCP6_TX_CB TxCb 
)

Check whether the TxCb is still a valid control block in the instance's retry list.

Parameters
[in]InstanceThe pointer to DHCP6_INSTANCE.
[in]TxCbThe control block for a transmitted message.
Return values
TRUEThe control block is in Instance's retry list.
FALSEThe control block is NOT in Instance's retry list.

Definition at line 363 of file Dhcp6Io.c.

◆ Dhcp6LinkMovDetect()

BOOLEAN Dhcp6LinkMovDetect ( IN DHCP6_INSTANCE Instance)

Detect Link movement for specified network device.

This routine will try to invoke Snp->GetStatus() to get the media status. If media present status switches from unpresent to present, a link movement is detected. Note that the underlying UNDI driver may not support reporting media status from GET_STATUS command. If that, fail to detect link movement.

Parameters
[in]InstanceThe pointer to DHCP6_INSTANCE.
Return values
TRUEA link movement is detected.
FALSEA link movement is not detected.

Definition at line 3146 of file Dhcp6Io.c.

◆ Dhcp6OnTimerTick()

VOID EFIAPI Dhcp6OnTimerTick ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The timer routine of the Dhcp6 instance for each second.

Parameters
[in]EventThe timer event.
[in]ContextThe opaque parameter to the function.

Definition at line 3194 of file Dhcp6Io.c.

◆ Dhcp6ReceivePacket()

VOID EFIAPI Dhcp6ReceivePacket ( IN NET_BUF Udp6Wrap,
IN UDP_END_POINT EndPoint,
IN EFI_STATUS  IoStatus,
IN VOID *  Context 
)

The receive callback function for Dhcp6 exchange process.

Parameters
[in]Udp6WrapThe pointer to the received net buffer.
[in]EndPointThe pointer to the udp end point.
[in]IoStatusThe return status from udp io.
[in]ContextThe opaque parameter to the function.

Definition at line 3007 of file Dhcp6Io.c.

◆ Dhcp6SeekInnerOptionSafe()

EFI_STATUS Dhcp6SeekInnerOptionSafe ( IN UINT16  IaType,
IN UINT8 *  Option,
IN UINT32  OptionLen,
OUT UINT8 **  IaInnerOpt,
OUT UINT16 *  IaInnerLen 
)

Seeks the Inner Options from a DHCP6 Option

Parameters
[in]IaTypeThe type of the IA option.
[in]OptionThe pointer to the DHCP6 Option.
[in]OptionLenThe length of the DHCP6 Option.
[out]IaInnerOptThe pointer to the IA inner option.
[out]IaInnerLenThe length of the IA inner option.
Return values
EFI_SUCCESSSeek the inner option successfully.
EFI_DEVICE_ERRORThe OptionLen is invalid. On Error, the pointers are not modified

Definition at line 705 of file Dhcp6Io.c.

◆ Dhcp6SeekStsOption()

EFI_STATUS Dhcp6SeekStsOption ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet,
OUT UINT8 **  Option 
)

Seek StatusCode Option in package. A Status Code option may appear in the options field of a DHCP message and/or in the options field of another option. See details in section 22.13, RFC3315.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to reply messages.
[out]OptionThe pointer to status code option.
Return values
EFI_SUCCESSSeek status code option successfully.
EFI_DEVICE_ERRORAn unexpected error.

Definition at line 796 of file Dhcp6Io.c.

◆ Dhcp6SelectAdvertiseMsg()

EFI_STATUS Dhcp6SelectAdvertiseMsg ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET AdSelect 
)

Select the appointed Dhcp6 advertisement message.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]AdSelectThe pointer to the selected Dhcp6 advertisement message.
Return values
EFI_SUCCESSSelected the right advertisement message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
OthersFailed to select the advertise message.

Definition at line 2556 of file Dhcp6Io.c.

◆ Dhcp6SendConfirmMsg()

EFI_STATUS Dhcp6SendConfirmMsg ( IN DHCP6_INSTANCE Instance)

Create the Confirm message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
Return values
EFI_SUCCESSCreated and sent the confirm message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to send the confirm message.

Definition at line 2137 of file Dhcp6Io.c.

◆ Dhcp6SendDeclineMsg()

EFI_STATUS Dhcp6SendDeclineMsg ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_IA DecIa 
)

Create the decline message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]DecIaThe pointer to the decline Ia.
Return values
EFI_SUCCESSCreated and sent the decline message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to send the decline message.

Definition at line 1367 of file Dhcp6Io.c.

◆ Dhcp6SendInfoRequestMsg()

EFI_STATUS Dhcp6SendInfoRequestMsg ( IN DHCP6_INSTANCE Instance,
IN DHCP6_INF_CB InfCb,
IN BOOLEAN  SendClientId,
IN EFI_DHCP6_PACKET_OPTION OptionRequest,
IN UINT32  OptionCount,
IN EFI_DHCP6_PACKET_OPTION OptionList[],
IN EFI_DHCP6_RETRANSMISSION Retransmission 
)

Create the information request message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]InfCbThe pointer to the information request control block.
[in]SendClientIdIf TRUE, the client identifier option will be included in information request message. Otherwise, the client identifier option will not be included.
[in]OptionRequestThe pointer to the option request option.
[in]OptionCountThe number options in the OptionList.
[in]OptionListThe array pointers to the appended options.
[in]RetransmissionThe pointer to the retransmission control.
Return values
EFI_SUCCESSCreated and sent the info-request message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
OthersFailed to send the info-request message.

Definition at line 1987 of file Dhcp6Io.c.

◆ Dhcp6SendReleaseMsg()

EFI_STATUS Dhcp6SendReleaseMsg ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_IA RelIa 
)

Create the release message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]RelIaThe pointer to the release Ia.
Return values
EFI_SUCCESSCreated and sent the release message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to send the release message.

Definition at line 1527 of file Dhcp6Io.c.

◆ Dhcp6SendRenewRebindMsg()

EFI_STATUS Dhcp6SendRenewRebindMsg ( IN DHCP6_INSTANCE Instance,
IN BOOLEAN  RebindRequest 
)

Create the renew/rebind message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]RebindRequestIf TRUE, it is a Rebind type message. Otherwise, it is a Renew type message.
Return values
EFI_SUCCESSCreated and sent the renew/rebind message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to send the renew/rebind message.

Definition at line 1683 of file Dhcp6Io.c.

◆ Dhcp6SendRequestMsg()

EFI_STATUS Dhcp6SendRequestMsg ( IN DHCP6_INSTANCE Instance)

Create the request message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
Return values
EFI_SUCCESSCreated and sent the request message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_DEVICE_ERRORAn unexpected error.
OthersFailed to send the request message.

Definition at line 1183 of file Dhcp6Io.c.

◆ Dhcp6SendSolicitMsg()

EFI_STATUS Dhcp6SendSolicitMsg ( IN DHCP6_INSTANCE Instance)

Create the solicit message and send it.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
Return values
EFI_SUCCESSCreated and sent the solicit message successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
OthersFailed to send the solicit message.

Definition at line 1005 of file Dhcp6Io.c.

◆ Dhcp6StartInfoRequest()

EFI_STATUS Dhcp6StartInfoRequest ( IN DHCP6_INSTANCE Instance,
IN BOOLEAN  SendClientId,
IN EFI_DHCP6_PACKET_OPTION OptionRequest,
IN UINT32  OptionCount,
IN EFI_DHCP6_PACKET_OPTION *OptionList[]  OPTIONAL,
IN EFI_DHCP6_RETRANSMISSION Retransmission,
IN EFI_EVENT TimeoutEvent  OPTIONAL,
IN EFI_DHCP6_INFO_CALLBACK  ReplyCallback,
IN VOID *CallbackContext  OPTIONAL 
)

Start the information request process.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]SendClientIdIf TRUE, the client identifier option will be included in information request message. Otherwise, the client identifier option will not be included.
[in]OptionRequestThe pointer to the option request option.
[in]OptionCountThe number options in the OptionList.
[in]OptionListThe array pointers to the appended options.
[in]RetransmissionThe pointer to the retransmission control.
[in]TimeoutEventThe event of timeout.
[in]ReplyCallbackThe callback function when the reply was received.
[in]CallbackContextThe pointer to the parameter passed to the callback.
Return values
EFI_SUCCESSStart the info-request process successfully.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
EFI_NO_MAPPINGNo source address is available for use.
OthersFailed to start the info-request process.

Definition at line 1889 of file Dhcp6Io.c.

◆ Dhcp6TransmitPacket()

EFI_STATUS Dhcp6TransmitPacket ( IN DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet,
IN UINT16 *  Elapsed 
)

Transmit Dhcp6 message by udpio.

Parameters
[in]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to transmit message.
[in]ElapsedThe pointer to the elapsed time value to fill in.
Return values
EFI_SUCCESSSuccessfully transmitted the packet.
EFI_OUT_OF_RESOURCESRequired system resources could not be allocated.
OthersFailed to transmit the packet.

Definition at line 916 of file Dhcp6Io.c.

◆ Dhcp6UpdateIaInfo()

EFI_STATUS Dhcp6UpdateIaInfo ( IN OUT DHCP6_INSTANCE Instance,
IN EFI_DHCP6_PACKET Packet 
)

Update Ia according to the new reply message.

Parameters
[in,out]InstanceThe pointer to the Dhcp6 instance.
[in]PacketThe pointer to reply messages.
Return values
EFI_SUCCESSUpdated the Ia information successfully.
EFI_DEVICE_ERRORAn unexpected error.

Definition at line 524 of file Dhcp6Io.c.