NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -9,7 +9,6 @@
#include "Dhcp6Impl.h"
/**
Retrieves a Unicode string that is the user-readable name of the driver.
@@ -57,7 +56,6 @@ Dhcp6ComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user-readable name of the controller
that is being managed by a driver.
@@ -129,18 +127,17 @@ Dhcp6ComponentNameGetDriverName (
EFI_STATUS
EFIAPI
Dhcp6ComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName = {
Dhcp6ComponentNameGetDriverName,
Dhcp6ComponentNameGetControllerName,
"eng"
@@ -149,13 +146,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Dhcp6ComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Dhcp6ComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)Dhcp6ComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)Dhcp6ComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTable[] = {
{
"eng;en",
L"DHCP6 Protocol Driver"
@@ -166,9 +163,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTab
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable = NULL;
CHAR16 *mDhcp6ControllerName[] = {
CHAR16 *mDhcp6ControllerName[] = {
L"DHCPv6 (State=0, Init)",
L"DHCPv6 (State=1, Selecting)",
L"DHCPv6 (State=2, Requesting)",
@@ -248,12 +245,12 @@ Dhcp6ComponentNameGetDriverName (
**/
EFI_STATUS
UpdateName (
IN EFI_DHCP6_PROTOCOL *Dhcp6
IN EFI_DHCP6_PROTOCOL *Dhcp6
)
{
EFI_STATUS Status;
EFI_DHCP6_MODE_DATA Dhcp6ModeData;
CHAR16 *HandleName;
EFI_STATUS Status;
EFI_DHCP6_MODE_DATA Dhcp6ModeData;
CHAR16 *HandleName;
if (Dhcp6 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -278,12 +275,14 @@ UpdateName (
if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) {
return EFI_DEVICE_ERROR;
}
HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State];
}
if (Dhcp6ModeData.Ia != NULL) {
FreePool (Dhcp6ModeData.Ia);
}
if (Dhcp6ModeData.ClientId != NULL) {
FreePool (Dhcp6ModeData.ClientId);
}
@@ -379,15 +378,15 @@ UpdateName (
EFI_STATUS
EFIAPI
Dhcp6ComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_DHCP6_PROTOCOL *Dhcp6;
EFI_STATUS Status;
EFI_DHCP6_PROTOCOL *Dhcp6;
//
// Only provide names for child handles.
@@ -439,4 +438,3 @@ Dhcp6ComponentNameGetControllerName (
(BOOLEAN)(This == &gDhcp6ComponentName)
);
}

View File

@@ -10,8 +10,7 @@
#include "Dhcp6Impl.h"
EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
Dhcp6DriverBindingSupported,
Dhcp6DriverBindingStart,
Dhcp6DriverBindingStop,
@@ -20,7 +19,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
NULL
};
EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
Dhcp6ServiceBindingCreateChild,
Dhcp6ServiceBindingDestroyChild
};
@@ -39,12 +38,12 @@ EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
EFI_STATUS
EFIAPI
Dhcp6ConfigureUdpIo (
IN UDP_IO *UdpIo,
IN VOID *Context
IN UDP_IO *UdpIo,
IN VOID *Context
)
{
EFI_UDP6_PROTOCOL *Udp6;
EFI_UDP6_CONFIG_DATA *Config;
EFI_UDP6_PROTOCOL *Udp6;
EFI_UDP6_CONFIG_DATA *Config;
Udp6 = UdpIo->Protocol.Udp6;
Config = &(UdpIo->Config.Udp6);
@@ -67,13 +66,12 @@ Dhcp6ConfigureUdpIo (
// will be overridden later. Note that we MUST not limit RemotePort.
// More details, refer to RFC 3315 section 5.2.
//
Config->StationPort = DHCP6_PORT_CLIENT;
Config->RemotePort = 0;
Config->StationPort = DHCP6_PORT_CLIENT;
Config->RemotePort = 0;
return Udp6->Configure (Udp6, Config);;
return Udp6->Configure (Udp6, Config);
}
/**
Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized,
or partly destroyed. If a resource is destroyed, it is marked as such in
@@ -84,7 +82,7 @@ Dhcp6ConfigureUdpIo (
**/
VOID
Dhcp6DestroyService (
IN OUT DHCP6_SERVICE *Service
IN OUT DHCP6_SERVICE *Service
)
{
//
@@ -103,7 +101,6 @@ Dhcp6DestroyService (
FreePool (Service);
}
/**
Create a new Dhcp6 service for the Nic controller.
@@ -119,13 +116,13 @@ Dhcp6DestroyService (
**/
EFI_STATUS
Dhcp6CreateService (
IN EFI_HANDLE Controller,
IN EFI_HANDLE ImageHandle,
OUT DHCP6_SERVICE **Service
IN EFI_HANDLE Controller,
IN EFI_HANDLE ImageHandle,
OUT DHCP6_SERVICE **Service
)
{
DHCP6_SERVICE *Dhcp6Srv;
EFI_STATUS Status;
DHCP6_SERVICE *Dhcp6Srv;
EFI_STATUS Status;
*Service = NULL;
Dhcp6Srv = AllocateZeroPool (sizeof (DHCP6_SERVICE));
@@ -147,10 +144,10 @@ Dhcp6CreateService (
//
// Initialize the fields of the new Dhcp6 service.
//
Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE;
Dhcp6Srv->Controller = Controller;
Dhcp6Srv->Image = ImageHandle;
Dhcp6Srv->Xid = (0xffffff & NET_RANDOM (NetRandomInitSeed ()));
Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE;
Dhcp6Srv->Controller = Controller;
Dhcp6Srv->Image = ImageHandle;
Dhcp6Srv->Xid = (0xffffff & NET_RANDOM (NetRandomInitSeed ()));
CopyMem (
&Dhcp6Srv->ServiceBinding,
@@ -164,7 +161,7 @@ Dhcp6CreateService (
Status = gBS->HandleProtocol (
Controller,
&gEfiIp6ConfigProtocolGuid,
(VOID **) &Dhcp6Srv->Ip6Cfg
(VOID **)&Dhcp6Srv->Ip6Cfg
);
if (EFI_ERROR (Status)) {
FreePool (Dhcp6Srv);
@@ -175,7 +172,7 @@ Dhcp6CreateService (
// Generate client Duid: If SMBIOS system UUID is located, generate DUID in DUID-UUID format.
// Otherwise, in DUID-LLT format.
//
Dhcp6Srv->ClientId = Dhcp6GenerateClientId (Dhcp6Srv->Snp->Mode);
Dhcp6Srv->ClientId = Dhcp6GenerateClientId (Dhcp6Srv->Snp->Mode);
if (Dhcp6Srv->ClientId == NULL) {
FreePool (Dhcp6Srv);
@@ -206,7 +203,6 @@ Dhcp6CreateService (
return EFI_SUCCESS;
}
/**
Destroy the Dhcp6 instance and recycle the resources.
@@ -215,7 +211,7 @@ Dhcp6CreateService (
**/
VOID
Dhcp6DestroyInstance (
IN OUT DHCP6_INSTANCE *Instance
IN OUT DHCP6_INSTANCE *Instance
)
{
//
@@ -239,6 +235,7 @@ Dhcp6DestroyInstance (
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
FreePool (Instance->IaCb.Ia->ReplyPacket);
}
FreePool (Instance->IaCb.Ia);
}
@@ -253,7 +250,6 @@ Dhcp6DestroyInstance (
FreePool (Instance);
}
/**
Create the Dhcp6 instance and initialize it.
@@ -266,12 +262,12 @@ Dhcp6DestroyInstance (
**/
EFI_STATUS
Dhcp6CreateInstance (
IN DHCP6_SERVICE *Service,
OUT DHCP6_INSTANCE **Instance
IN DHCP6_SERVICE *Service,
OUT DHCP6_INSTANCE **Instance
)
{
EFI_STATUS Status;
DHCP6_INSTANCE *Dhcp6Ins;
EFI_STATUS Status;
DHCP6_INSTANCE *Dhcp6Ins;
*Instance = NULL;
Dhcp6Ins = AllocateZeroPool (sizeof (DHCP6_INSTANCE));
@@ -283,11 +279,11 @@ Dhcp6CreateInstance (
//
// Initialize the fields of the new Dhcp6 instance.
//
Dhcp6Ins->Signature = DHCP6_INSTANCE_SIGNATURE;
Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED;
Dhcp6Ins->Service = Service;
Dhcp6Ins->InDestroy = FALSE;
Dhcp6Ins->MediaPresent = TRUE;
Dhcp6Ins->Signature = DHCP6_INSTANCE_SIGNATURE;
Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED;
Dhcp6Ins->Service = Service;
Dhcp6Ins->InDestroy = FALSE;
Dhcp6Ins->MediaPresent = TRUE;
CopyMem (
&Dhcp6Ins->Dhcp6,
@@ -333,24 +329,23 @@ Dhcp6CreateInstance (
EFI_STATUS
EFIAPI
Dhcp6DestroyChildEntry (
IN LIST_ENTRY *Entry,
IN VOID *Context
IN LIST_ENTRY *Entry,
IN VOID *Context
)
{
DHCP6_INSTANCE *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DHCP6_INSTANCE *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
if (Entry == NULL || Context == NULL) {
if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE);
ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context;
Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE);
ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *)Context;
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
}
/**
Entry point of the DHCP6 driver to install various protocols.
@@ -364,8 +359,8 @@ Dhcp6DestroyChildEntry (
EFI_STATUS
EFIAPI
Dhcp6DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (
@@ -378,7 +373,6 @@ Dhcp6DriverEntryPoint (
);
}
/**
Test to see if this driver supports ControllerHandle. This service
is called by the EFI boot service ConnectController(). In
@@ -414,7 +408,6 @@ Dhcp6DriverBindingSupported (
);
}
/**
Start this driver on ControllerHandle. This service is called by the
EFI boot service ConnectController(). In order to make
@@ -441,8 +434,8 @@ Dhcp6DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
DHCP6_SERVICE *Service;
EFI_STATUS Status;
DHCP6_SERVICE *Service;
//
// Check the Dhcp6 service whether already started.
@@ -490,7 +483,6 @@ Dhcp6DriverBindingStart (
return EFI_SUCCESS;
}
/**
Stop this driver on ControllerHandle. This service is called by the
EFI boot service DisconnectController(). In order to
@@ -519,12 +511,12 @@ Dhcp6DriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
EFI_STATUS Status;
EFI_HANDLE NicHandle;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DHCP6_SERVICE *Service;
LIST_ENTRY *List;
UINTN ListLength;
EFI_STATUS Status;
EFI_HANDLE NicHandle;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DHCP6_SERVICE *Service;
LIST_ENTRY *List;
UINTN ListLength;
//
// Find and check the Nic handle by the controller handle.
@@ -538,7 +530,7 @@ Dhcp6DriverBindingStop (
Status = gBS->OpenProtocol (
NicHandle,
&gEfiDhcp6ServiceBindingProtocolGuid,
(VOID **) &ServiceBinding,
(VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -553,23 +545,23 @@ Dhcp6DriverBindingStop (
//
// Destroy all the children instances before destroy the service.
//
List = &Service->Child;
List = &Service->Child;
Status = NetDestroyLinkList (
List,
Dhcp6DestroyChildEntry,
ServiceBinding,
&ListLength
);
if (EFI_ERROR (Status) || ListLength != 0) {
if (EFI_ERROR (Status) || (ListLength != 0)) {
Status = EFI_DEVICE_ERROR;
}
}
if (NumberOfChildren == 0 && !IsListEmpty (&Service->Child)) {
if ((NumberOfChildren == 0) && !IsListEmpty (&Service->Child)) {
Status = EFI_DEVICE_ERROR;
}
if (NumberOfChildren == 0 && IsListEmpty (&Service->Child)) {
if ((NumberOfChildren == 0) && IsListEmpty (&Service->Child)) {
//
// Destroy the service itself if no child instance left.
//
@@ -590,7 +582,6 @@ ON_EXIT:
return Status;
}
/**
Creates a child handle and installs a protocol.
@@ -615,19 +606,19 @@ Dhcp6ServiceBindingCreateChild (
IN OUT EFI_HANDLE *ChildHandle
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_SERVICE *Service;
DHCP6_INSTANCE *Instance;
VOID *Udp6;
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_SERVICE *Service;
DHCP6_INSTANCE *Instance;
VOID *Udp6;
if (This == NULL || ChildHandle == NULL) {
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
Service = DHCP6_SERVICE_FROM_THIS (This);
Status = Dhcp6CreateInstance (Service, &Instance);
Status = Dhcp6CreateInstance (Service, &Instance);
if (EFI_ERROR (Status)) {
return Status;
@@ -670,14 +661,13 @@ Dhcp6ServiceBindingCreateChild (
Status = gBS->OpenProtocol (
Service->UdpIo->UdpHandle,
&gEfiUdp6ProtocolGuid,
(VOID **) &Udp6,
(VOID **)&Udp6,
gDhcp6DriverBinding.DriverBindingHandle,
Instance->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
Instance->Handle,
&gEfiDhcp6ProtocolGuid,
@@ -704,7 +694,6 @@ ON_ERROR:
return Status;
}
/**
Destroys a child handle with a protocol installed on it.
@@ -730,13 +719,13 @@ Dhcp6ServiceBindingDestroyChild (
IN EFI_HANDLE ChildHandle
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_PROTOCOL *Dhcp6;
DHCP6_SERVICE *Service;
DHCP6_INSTANCE *Instance;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_PROTOCOL *Dhcp6;
DHCP6_SERVICE *Service;
DHCP6_INSTANCE *Instance;
if (This == NULL || ChildHandle == NULL) {
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -746,7 +735,7 @@ Dhcp6ServiceBindingDestroyChild (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiDhcp6ProtocolGuid,
(VOID **) &Dhcp6,
(VOID **)&Dhcp6,
gDhcp6DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL

View File

@@ -13,9 +13,9 @@
#include <Protocol/ServiceBinding.h>
extern EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2;
extern EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable;
extern EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2;
extern EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable;
/**
Test to see if this driver supports ControllerHandle. This service

View File

@@ -14,9 +14,11 @@
//
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
//
EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};
EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {
{ 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }
};
EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
EfiDhcp6GetModeData,
EfiDhcp6Configure,
EfiDhcp6Start,
@@ -61,14 +63,14 @@ EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
EFI_STATUS
EFIAPI
EfiDhcp6Start (
IN EFI_DHCP6_PROTOCOL *This
IN EFI_DHCP6_PROTOCOL *This
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_STATUS MediaStatus;
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_STATUS MediaStatus;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -93,7 +95,7 @@ EfiDhcp6Start (
return EFI_ALREADY_STARTED;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
// Check Media Status.
@@ -119,7 +121,7 @@ EfiDhcp6Start (
//
// Register receive callback for the stateful exchange process.
//
Status = UdpIoRecvDatagram(
Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -136,10 +138,10 @@ EfiDhcp6Start (
// Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
return Instance->UdpSts;
}
@@ -151,7 +153,6 @@ ON_ERROR:
return Status;
}
/**
Stops the DHCPv6 standard S.A.R.R. process.
@@ -170,14 +171,14 @@ ON_ERROR:
EFI_STATUS
EFIAPI
EfiDhcp6Stop (
IN EFI_DHCP6_PROTOCOL *This
IN EFI_DHCP6_PROTOCOL *This
)
{
EFI_TPL OldTpl;
EFI_STATUS Status;
EFI_UDP6_PROTOCOL *Udp6;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_TPL OldTpl;
EFI_STATUS Status;
EFI_UDP6_PROTOCOL *Udp6;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -200,10 +201,11 @@ EfiDhcp6Stop (
//
// No valid REPLY message received yet, cleanup this instance directly.
//
if (Instance->IaCb.Ia->State == Dhcp6Init ||
Instance->IaCb.Ia->State == Dhcp6Selecting ||
Instance->IaCb.Ia->State == Dhcp6Requesting
) {
if ((Instance->IaCb.Ia->State == Dhcp6Init) ||
(Instance->IaCb.Ia->State == Dhcp6Selecting) ||
(Instance->IaCb.Ia->State == Dhcp6Requesting)
)
{
goto ON_EXIT;
}
@@ -213,7 +215,7 @@ EfiDhcp6Stop (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance->UdpSts = EFI_ALREADY_STARTED;
Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);
Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);
gBS->RestoreTPL (OldTpl);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
@@ -227,6 +229,7 @@ EfiDhcp6Stop (
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Udp6->Poll (Udp6);
}
Status = Instance->UdpSts;
}
@@ -241,7 +244,6 @@ ON_EXIT:
return Status;
}
/**
Returns the current operating mode data for the Dhcp6 instance.
@@ -260,26 +262,26 @@ ON_EXIT:
EFI_STATUS
EFIAPI
EfiDhcp6GetModeData (
IN EFI_DHCP6_PROTOCOL *This,
OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
IN EFI_DHCP6_PROTOCOL *This,
OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
)
{
EFI_TPL OldTpl;
EFI_DHCP6_IA *Ia;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINT32 IaSize;
UINT32 IdSize;
EFI_TPL OldTpl;
EFI_DHCP6_IA *Ia;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINT32 IaSize;
UINT32 IdSize;
if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {
if ((This == NULL) || ((Dhcp6ModeData == NULL) && (Dhcp6ConfigData == NULL))) {
return EFI_INVALID_PARAMETER;
}
Instance = DHCP6_INSTANCE_FROM_THIS (This);
Service = Instance->Service;
if (Instance->Config == NULL && Dhcp6ConfigData != NULL) {
if ((Instance->Config == NULL) && (Dhcp6ConfigData != NULL)) {
return EFI_ACCESS_DENIED;
}
@@ -291,7 +293,7 @@ EfiDhcp6GetModeData (
// User needs a copy of instance config data.
//
if (Dhcp6ConfigData != NULL) {
ZeroMem (Dhcp6ConfigData, sizeof(EFI_DHCP6_CONFIG_DATA));
ZeroMem (Dhcp6ConfigData, sizeof (EFI_DHCP6_CONFIG_DATA));
//
// Duplicate config data, including all reference buffers.
//
@@ -347,6 +349,7 @@ EfiDhcp6GetModeData (
if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {
goto ON_ERROR;
}
CopyMem (
Dhcp6ModeData->Ia->ReplyPacket,
Ia->ReplyPacket,
@@ -365,15 +368,16 @@ ON_ERROR:
if (Dhcp6ConfigData != NULL) {
Dhcp6CleanupConfigData (Dhcp6ConfigData);
}
if (Dhcp6ModeData != NULL) {
Dhcp6CleanupModeData (Dhcp6ModeData);
}
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
}
/**
Initializes, changes, or resets the operational settings for the Dhcp6 instance.
@@ -405,17 +409,17 @@ ON_ERROR:
EFI_STATUS
EFIAPI
EfiDhcp6Configure (
IN EFI_DHCP6_PROTOCOL *This,
IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
IN EFI_DHCP6_PROTOCOL *This,
IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
)
{
EFI_TPL OldTpl;
EFI_STATUS Status;
LIST_ENTRY *Entry;
DHCP6_INSTANCE *Other;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINTN Index;
EFI_TPL OldTpl;
EFI_STATUS Status;
LIST_ENTRY *Entry;
DHCP6_INSTANCE *Other;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINTN Index;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -428,36 +432,40 @@ EfiDhcp6Configure (
// Check the parameter of configure data.
//
if (Dhcp6CfgData != NULL) {
if (Dhcp6CfgData->OptionCount > 0 && Dhcp6CfgData->OptionList == NULL) {
if ((Dhcp6CfgData->OptionCount > 0) && (Dhcp6CfgData->OptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (Dhcp6CfgData->OptionList != NULL) {
for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {
if (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId ||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit ||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept ||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana ||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata
) {
if ((Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId) ||
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit) ||
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept) ||
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana) ||
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata)
)
{
return EFI_INVALID_PARAMETER;
}
}
}
if (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA &&
Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA
) {
if ((Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA) &&
(Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA)
)
{
return EFI_INVALID_PARAMETER;
}
if (Dhcp6CfgData->IaInfoEvent == NULL && Dhcp6CfgData->SolicitRetransmission == NULL) {
if ((Dhcp6CfgData->IaInfoEvent == NULL) && (Dhcp6CfgData->SolicitRetransmission == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (Dhcp6CfgData->SolicitRetransmission != NULL &&
Dhcp6CfgData->SolicitRetransmission->Mrc == 0 &&
Dhcp6CfgData->SolicitRetransmission->Mrd == 0
) {
if ((Dhcp6CfgData->SolicitRetransmission != NULL) &&
(Dhcp6CfgData->SolicitRetransmission->Mrc == 0) &&
(Dhcp6CfgData->SolicitRetransmission->Mrd == 0)
)
{
return EFI_INVALID_PARAMETER;
}
@@ -466,10 +474,11 @@ EfiDhcp6Configure (
//
NET_LIST_FOR_EACH (Entry, &Service->Child) {
Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);
if (Other->IaCb.Ia != NULL &&
Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type &&
Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId
) {
if ((Other->IaCb.Ia != NULL) &&
(Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type) &&
(Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId)
)
{
return EFI_INVALID_PARAMETER;
}
}
@@ -496,7 +505,7 @@ EfiDhcp6Configure (
}
Status = Dhcp6CopyConfigData (Instance->Config, Dhcp6CfgData);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
FreePool (Instance->Config);
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
@@ -506,21 +515,20 @@ EfiDhcp6Configure (
// Initialize the Ia descriptor from the config data, and leave the other
// fields of the Ia as default value 0.
//
Instance->IaCb.Ia = AllocateZeroPool (sizeof(EFI_DHCP6_IA));
Instance->IaCb.Ia = AllocateZeroPool (sizeof (EFI_DHCP6_IA));
if (Instance->IaCb.Ia == NULL) {
Dhcp6CleanupConfigData (Instance->Config);
FreePool (Instance->Config);
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
}
CopyMem (
&Instance->IaCb.Ia->Descriptor,
&Dhcp6CfgData->IaDescriptor,
sizeof(EFI_DHCP6_IA_DESCRIPTOR)
sizeof (EFI_DHCP6_IA_DESCRIPTOR)
);
} else {
if (Instance->Config == NULL) {
ASSERT (Instance->IaCb.Ia == NULL);
gBS->RestoreTPL (OldTpl);
@@ -548,7 +556,6 @@ EfiDhcp6Configure (
return EFI_SUCCESS;
}
/**
Request configuration information without the assignment of any
Ia addresses of the client.
@@ -604,29 +611,29 @@ EfiDhcp6InfoRequest (
IN VOID *CallbackContext OPTIONAL
)
{
EFI_STATUS Status;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINTN Index;
EFI_EVENT Timer;
EFI_STATUS TimerStatus;
UINTN GetMappingTimeOut;
EFI_STATUS Status;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
UINTN Index;
EFI_EVENT Timer;
EFI_STATUS TimerStatus;
UINTN GetMappingTimeOut;
if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) {
if ((This == NULL) || (OptionRequest == NULL) || (Retransmission == NULL) || (ReplyCallback == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (Retransmission != NULL && Retransmission->Mrc == 0 && Retransmission->Mrd == 0) {
if ((Retransmission != NULL) && (Retransmission->Mrc == 0) && (Retransmission->Mrd == 0)) {
return EFI_INVALID_PARAMETER;
}
if (OptionCount > 0 && OptionList == NULL) {
if ((OptionCount > 0) && (OptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (OptionList != NULL) {
for (Index = 0; Index < OptionCount; Index++) {
if (OptionList[Index]->OpCode == Dhcp6OptClientId || OptionList[Index]->OpCode == Dhcp6OptRequestOption) {
if ((OptionList[Index]->OpCode == Dhcp6OptClientId) || (OptionList[Index]->OpCode == Dhcp6OptRequestOption)) {
return EFI_INVALID_PARAMETER;
}
}
@@ -651,8 +658,8 @@ EfiDhcp6InfoRequest (
// The link local address is not ready, wait for some time and restart
// the DHCP6 information request process.
//
Status = Dhcp6GetMappingTimeOut(Service->Ip6Cfg, &GetMappingTimeOut);
if (EFI_ERROR(Status)) {
Status = Dhcp6GetMappingTimeOut (Service->Ip6Cfg, &GetMappingTimeOut);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -689,6 +696,7 @@ EfiDhcp6InfoRequest (
gBS->CloseEvent (Timer);
}
if (EFI_ERROR (Status)) {
return Status;
}
@@ -697,17 +705,16 @@ EfiDhcp6InfoRequest (
// Poll udp out of the net tpl if synchronous call.
//
if (TimeoutEvent == NULL) {
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
return Instance->UdpSts;
}
return EFI_SUCCESS;
}
/**
Manually extend the valid and preferred lifetimes for the IPv6 addresses
of the configured IA and update other configuration parameters by sending a
@@ -756,14 +763,14 @@ EfiDhcp6InfoRequest (
EFI_STATUS
EFIAPI
EfiDhcp6RenewRebind (
IN EFI_DHCP6_PROTOCOL *This,
IN BOOLEAN RebindRequest
IN EFI_DHCP6_PROTOCOL *This,
IN BOOLEAN RebindRequest
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_STATUS Status;
EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -784,9 +791,10 @@ EfiDhcp6RenewRebind (
//
// The instance has already entered renewing or rebinding state.
//
if ((Instance->IaCb.Ia->State == Dhcp6Rebinding && RebindRequest) ||
(Instance->IaCb.Ia->State == Dhcp6Renewing && !RebindRequest)
) {
if (((Instance->IaCb.Ia->State == Dhcp6Rebinding) && RebindRequest) ||
((Instance->IaCb.Ia->State == Dhcp6Renewing) && !RebindRequest)
)
{
return EFI_ALREADY_STARTED;
}
@@ -809,7 +817,7 @@ EfiDhcp6RenewRebind (
//
// Register receive callback for the stateful exchange process.
//
Status = UdpIoRecvDatagram(
Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -826,10 +834,10 @@ EfiDhcp6RenewRebind (
// Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
return Instance->UdpSts;
}
@@ -841,7 +849,6 @@ ON_ERROR:
return Status;
}
/**
Inform that one or more addresses assigned by a server are already
in use by another node.
@@ -877,18 +884,18 @@ ON_ERROR:
EFI_STATUS
EFIAPI
EfiDhcp6Decline (
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_IA *DecIa;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_IA *DecIa;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
if (This == NULL || AddressCount == 0 || Addresses == NULL) {
if ((This == NULL) || (AddressCount == 0) || (Addresses == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -913,7 +920,7 @@ EfiDhcp6Decline (
//
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
@@ -943,7 +950,7 @@ EfiDhcp6Decline (
//
// Register receive callback for the stateful exchange process.
//
Status = UdpIoRecvDatagram(
Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -961,10 +968,10 @@ EfiDhcp6Decline (
// Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
return Instance->UdpSts;
}
@@ -975,12 +982,12 @@ ON_ERROR:
if (DecIa != NULL) {
FreePool (DecIa);
}
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Release one or more addresses associated with the configured Ia
for current instance.
@@ -1018,18 +1025,18 @@ ON_ERROR:
EFI_STATUS
EFIAPI
EfiDhcp6Release (
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_IA *RelIa;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_DHCP6_IA *RelIa;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
if (This == NULL || (AddressCount != 0 && Addresses == NULL)) {
if ((This == NULL) || ((AddressCount != 0) && (Addresses == NULL))) {
return EFI_INVALID_PARAMETER;
}
@@ -1054,7 +1061,7 @@ EfiDhcp6Release (
//
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1084,7 +1091,7 @@ EfiDhcp6Release (
//
// Register receive callback for the stateful exchange process.
//
Status = UdpIoRecvDatagram(
Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1105,6 +1112,7 @@ EfiDhcp6Release (
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
return Instance->UdpSts;
}
@@ -1115,12 +1123,12 @@ ON_ERROR:
if (RelIa != NULL) {
FreePool (RelIa);
}
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Parse the option data in the Dhcp6 packet.
@@ -1146,21 +1154,21 @@ EfiDhcp6Parse (
OUT EFI_DHCP6_PACKET_OPTION *PacketOptionList[] OPTIONAL
)
{
UINT32 OptCnt;
UINT32 OptLen;
UINT16 DataLen;
UINT8 *Start;
UINT8 *End;
UINT32 OptCnt;
UINT32 OptLen;
UINT16 DataLen;
UINT8 *Start;
UINT8 *End;
if (This == NULL || Packet == NULL || OptionCount == NULL) {
if ((This == NULL) || (Packet == NULL) || (OptionCount == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (*OptionCount != 0 && PacketOptionList == NULL) {
if ((*OptionCount != 0) && (PacketOptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (Packet->Length > Packet->Size || Packet->Length < sizeof (EFI_DHCP6_HEADER)) {
if ((Packet->Length > Packet->Size) || (Packet->Length < sizeof (EFI_DHCP6_HEADER))) {
return EFI_INVALID_PARAMETER;
}
@@ -1185,7 +1193,7 @@ EfiDhcp6Parse (
// Calculate the number of option in the packet.
//
while (Start < End) {
DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;
DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
Start += (NTOHS (DataLen) + 4);
OptCnt++;
}
@@ -1208,13 +1216,11 @@ EfiDhcp6Parse (
Start = Packet->Dhcp6.Option;
while (Start < End) {
PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *) Start;
DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;
Start += (NTOHS (DataLen) + 4);
PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;
DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
Start += (NTOHS (DataLen) + 4);
OptCnt++;
}
return EFI_SUCCESS;
}

View File

@@ -10,7 +10,6 @@
#ifndef __EFI_DHCP6_IMPL_H__
#define __EFI_DHCP6_IMPL_H__
#include <Uefi.h>
#include <IndustryStandard/Dhcp.h>
@@ -33,12 +32,11 @@
#include <Library/PrintLib.h>
#include <Guid/ZeroGuid.h>
typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
typedef struct _DHCP6_SERVICE DHCP6_SERVICE;
typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
typedef struct _DHCP6_SERVICE DHCP6_SERVICE;
typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
#include "Dhcp6Utility.h"
#include "Dhcp6Io.h"
@@ -47,104 +45,104 @@ typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
#define DHCP6_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'S')
#define DHCP6_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'I')
#define DHCP6_PACKET_ALL 0
#define DHCP6_PACKET_STATEFUL 1
#define DHCP6_PACKET_STATELESS 2
#define DHCP6_PACKET_ALL 0
#define DHCP6_PACKET_STATEFUL 1
#define DHCP6_PACKET_STATELESS 2
#define DHCP6_BASE_PACKET_SIZE 1024
#define DHCP6_BASE_PACKET_SIZE 1024
#define DHCP6_PORT_CLIENT 546
#define DHCP6_PORT_SERVER 547
#define DHCP6_PORT_CLIENT 546
#define DHCP6_PORT_SERVER 547
#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
extern EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
extern EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate;
extern EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
extern EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate;
//
// Control block for each IA.
//
struct _DHCP6_IA_CB {
EFI_DHCP6_IA *Ia;
UINT32 T1;
UINT32 T2;
UINT32 AllExpireTime;
UINT32 LeaseTime;
EFI_DHCP6_IA *Ia;
UINT32 T1;
UINT32 T2;
UINT32 AllExpireTime;
UINT32 LeaseTime;
};
//
// Control block for each transmitted message.
//
struct _DHCP6_TX_CB {
LIST_ENTRY Link;
UINT32 Xid;
EFI_DHCP6_PACKET *TxPacket;
EFI_DHCP6_RETRANSMISSION RetryCtl;
UINT32 RetryCnt;
UINT32 RetryExp;
UINT32 RetryLos;
UINT32 TickTime;
UINT16 *Elapsed;
BOOLEAN SolicitRetry;
LIST_ENTRY Link;
UINT32 Xid;
EFI_DHCP6_PACKET *TxPacket;
EFI_DHCP6_RETRANSMISSION RetryCtl;
UINT32 RetryCnt;
UINT32 RetryExp;
UINT32 RetryLos;
UINT32 TickTime;
UINT16 *Elapsed;
BOOLEAN SolicitRetry;
};
//
// Control block for each info-request message.
//
struct _DHCP6_INF_CB {
LIST_ENTRY Link;
UINT32 Xid;
EFI_DHCP6_INFO_CALLBACK ReplyCallback;
VOID *CallbackContext;
EFI_EVENT TimeoutEvent;
LIST_ENTRY Link;
UINT32 Xid;
EFI_DHCP6_INFO_CALLBACK ReplyCallback;
VOID *CallbackContext;
EFI_EVENT TimeoutEvent;
};
//
// Control block for Dhcp6 instance, it's per configuration data.
//
struct _DHCP6_INSTANCE {
UINT32 Signature;
EFI_HANDLE Handle;
DHCP6_SERVICE *Service;
LIST_ENTRY Link;
EFI_DHCP6_PROTOCOL Dhcp6;
EFI_EVENT Timer;
EFI_DHCP6_CONFIG_DATA *Config;
EFI_DHCP6_IA *CacheIa;
DHCP6_IA_CB IaCb;
LIST_ENTRY TxList;
LIST_ENTRY InfList;
EFI_DHCP6_PACKET *AdSelect;
UINT8 AdPref;
EFI_IPv6_ADDRESS *Unicast;
volatile EFI_STATUS UdpSts;
BOOLEAN InDestroy;
BOOLEAN MediaPresent;
UINT32 Signature;
EFI_HANDLE Handle;
DHCP6_SERVICE *Service;
LIST_ENTRY Link;
EFI_DHCP6_PROTOCOL Dhcp6;
EFI_EVENT Timer;
EFI_DHCP6_CONFIG_DATA *Config;
EFI_DHCP6_IA *CacheIa;
DHCP6_IA_CB IaCb;
LIST_ENTRY TxList;
LIST_ENTRY InfList;
EFI_DHCP6_PACKET *AdSelect;
UINT8 AdPref;
EFI_IPv6_ADDRESS *Unicast;
volatile EFI_STATUS UdpSts;
BOOLEAN InDestroy;
BOOLEAN MediaPresent;
//
// StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315,
// the elapsed-time is amount of time since the client began its current DHCP transaction.
//
UINT64 StartTime;
UINT64 StartTime;
};
//
// Control block for Dhcp6 service, it's per Nic handle.
//
struct _DHCP6_SERVICE {
UINT32 Signature;
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
EFI_DHCP6_DUID *ClientId;
UDP_IO *UdpIo;
UINT32 Xid;
LIST_ENTRY Child;
UINTN NumOfChild;
UINT32 Signature;
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
EFI_DHCP6_DUID *ClientId;
UDP_IO *UdpIo;
UINT32 Xid;
LIST_ENTRY Child;
UINTN NumOfChild;
};
/**
@@ -179,7 +177,7 @@ struct _DHCP6_SERVICE {
EFI_STATUS
EFIAPI
EfiDhcp6Start (
IN EFI_DHCP6_PROTOCOL *This
IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -200,7 +198,7 @@ EfiDhcp6Start (
EFI_STATUS
EFIAPI
EfiDhcp6Stop (
IN EFI_DHCP6_PROTOCOL *This
IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -222,9 +220,9 @@ EfiDhcp6Stop (
EFI_STATUS
EFIAPI
EfiDhcp6GetModeData (
IN EFI_DHCP6_PROTOCOL *This,
OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
IN EFI_DHCP6_PROTOCOL *This,
OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
);
/**
@@ -259,8 +257,8 @@ EfiDhcp6GetModeData (
EFI_STATUS
EFIAPI
EfiDhcp6Configure (
IN EFI_DHCP6_PROTOCOL *This,
IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
IN EFI_DHCP6_PROTOCOL *This,
IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
);
/**
@@ -366,8 +364,8 @@ EfiDhcp6InfoRequest (
EFI_STATUS
EFIAPI
EfiDhcp6RenewRebind (
IN EFI_DHCP6_PROTOCOL *This,
IN BOOLEAN RebindRequest
IN EFI_DHCP6_PROTOCOL *This,
IN BOOLEAN RebindRequest
);
/**
@@ -405,9 +403,9 @@ EfiDhcp6RenewRebind (
EFI_STATUS
EFIAPI
EfiDhcp6Decline (
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -446,9 +444,9 @@ EfiDhcp6Decline (
EFI_STATUS
EFIAPI
EfiDhcp6Release (
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_PROTOCOL *This,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
);
/**

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,6 @@
#ifndef __EFI_DHCP6_IO_H__
#define __EFI_DHCP6_IO_H__
/**
Clean up the specific nodes in the retry list.
@@ -20,8 +19,8 @@
**/
VOID
Dhcp6CleanupRetry (
IN DHCP6_INSTANCE *Instance,
IN UINT32 Scope
IN DHCP6_INSTANCE *Instance,
IN UINT32 Scope
);
/**
@@ -33,8 +32,8 @@ Dhcp6CleanupRetry (
**/
VOID
Dhcp6CleanupSession (
IN OUT DHCP6_INSTANCE *Instance,
IN EFI_STATUS Status
IN OUT DHCP6_INSTANCE *Instance,
IN EFI_STATUS Status
);
/**
@@ -49,7 +48,7 @@ Dhcp6CleanupSession (
**/
EFI_STATUS
Dhcp6SendSolicitMsg (
IN DHCP6_INSTANCE *Instance
IN DHCP6_INSTANCE *Instance
);
/**
@@ -65,7 +64,7 @@ Dhcp6SendSolicitMsg (
**/
EFI_STATUS
Dhcp6SendRequestMsg (
IN DHCP6_INSTANCE *Instance
IN DHCP6_INSTANCE *Instance
);
/**
@@ -83,8 +82,8 @@ Dhcp6SendRequestMsg (
**/
EFI_STATUS
Dhcp6SendRenewRebindMsg (
IN DHCP6_INSTANCE *Instance,
IN BOOLEAN RebindRequest
IN DHCP6_INSTANCE *Instance,
IN BOOLEAN RebindRequest
);
/**
@@ -101,8 +100,8 @@ Dhcp6SendRenewRebindMsg (
**/
EFI_STATUS
Dhcp6SendDeclineMsg (
IN DHCP6_INSTANCE *Instance,
IN EFI_DHCP6_IA *DecIa
IN DHCP6_INSTANCE *Instance,
IN EFI_DHCP6_IA *DecIa
);
/**
@@ -119,8 +118,8 @@ Dhcp6SendDeclineMsg (
**/
EFI_STATUS
Dhcp6SendReleaseMsg (
IN DHCP6_INSTANCE *Instance,
IN EFI_DHCP6_IA *RelIa
IN DHCP6_INSTANCE *Instance,
IN EFI_DHCP6_IA *RelIa
);
/**
@@ -198,10 +197,10 @@ Dhcp6SendInfoRequestMsg (
VOID
EFIAPI
Dhcp6ReceivePacket (
IN NET_BUF *Udp6Wrap,
IN UDP_END_POINT *EndPoint,
IN EFI_STATUS IoStatus,
IN VOID *Context
IN NET_BUF *Udp6Wrap,
IN UDP_END_POINT *EndPoint,
IN EFI_STATUS IoStatus,
IN VOID *Context
);
/**
@@ -214,8 +213,8 @@ Dhcp6ReceivePacket (
VOID
EFIAPI
Dhcp6OnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -10,9 +10,8 @@
#ifndef __EFI_DHCP6_UTILITY_H__
#define __EFI_DHCP6_UTILITY_H__
#define DHCP6_10_BIT_MASK 0x3ff
#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
#define DHCP6_10_BIT_MASK 0x3ff
#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
/**
Generate client Duid in the format of Duid-llt.
@@ -25,7 +24,7 @@
**/
EFI_DHCP6_DUID *
Dhcp6GenerateClientId (
IN EFI_SIMPLE_NETWORK_MODE *Mode
IN EFI_SIMPLE_NETWORK_MODE *Mode
);
/**
@@ -40,8 +39,8 @@ Dhcp6GenerateClientId (
**/
EFI_STATUS
Dhcp6CopyConfigData (
IN EFI_DHCP6_CONFIG_DATA *DstCfg,
IN EFI_DHCP6_CONFIG_DATA *SorCfg
IN EFI_DHCP6_CONFIG_DATA *DstCfg,
IN EFI_DHCP6_CONFIG_DATA *SorCfg
);
/**
@@ -52,7 +51,7 @@ Dhcp6CopyConfigData (
**/
VOID
Dhcp6CleanupConfigData (
IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
);
/**
@@ -63,7 +62,7 @@ Dhcp6CleanupConfigData (
**/
VOID
Dhcp6CleanupModeData (
IN OUT EFI_DHCP6_MODE_DATA *ModeData
IN OUT EFI_DHCP6_MODE_DATA *ModeData
);
/**
@@ -78,9 +77,9 @@ Dhcp6CleanupModeData (
**/
UINT32
Dhcp6CalculateExpireTime (
IN UINT32 Base,
IN BOOLEAN IsFirstRt,
IN BOOLEAN NeedSigned
IN UINT32 Base,
IN BOOLEAN IsFirstRt,
IN BOOLEAN NeedSigned
);
/**
@@ -91,7 +90,7 @@ Dhcp6CalculateExpireTime (
**/
VOID
Dhcp6CalculateLeaseTime (
IN DHCP6_IA_CB *IaCb
IN DHCP6_IA_CB *IaCb
);
/**
@@ -107,9 +106,9 @@ Dhcp6CalculateLeaseTime (
**/
EFI_STATUS
Dhcp6CheckAddress (
IN EFI_DHCP6_IA *Ia,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_IA *Ia,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -125,9 +124,9 @@ Dhcp6CheckAddress (
**/
EFI_DHCP6_IA *
Dhcp6DepriveAddress (
IN EFI_DHCP6_IA *Ia,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
IN EFI_DHCP6_IA *Ia,
IN UINT32 AddressCount,
IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -139,7 +138,7 @@ Dhcp6DepriveAddress (
VOID
EFIAPI
Dhcp6DummyExtFree (
IN VOID *Arg
IN VOID *Arg
);
/**
@@ -154,10 +153,10 @@ Dhcp6DummyExtFree (
VOID
EFIAPI
Dhcp6OnTransmitted (
IN NET_BUF *Wrap,
IN UDP_END_POINT *EndPoint,
IN EFI_STATUS IoStatus,
IN VOID *Context
IN NET_BUF *Wrap,
IN UDP_END_POINT *EndPoint,
IN EFI_STATUS IoStatus,
IN VOID *Context
);
/**
@@ -173,10 +172,10 @@ Dhcp6OnTransmitted (
**/
UINT8 *
Dhcp6AppendOption (
IN OUT UINT8 *Buf,
IN UINT16 OptType,
IN UINT16 OptLen,
IN UINT8 *Data
IN OUT UINT8 *Buf,
IN UINT16 OptType,
IN UINT16 OptLen,
IN UINT8 *Data
);
/**
@@ -193,11 +192,11 @@ Dhcp6AppendOption (
**/
UINT8 *
Dhcp6AppendIaOption (
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
IN UINT32 T2,
IN UINT32 MessageType
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
IN UINT32 T2,
IN UINT32 MessageType
);
/**
@@ -213,9 +212,9 @@ Dhcp6AppendIaOption (
**/
UINT8 *
Dhcp6AppendETOption (
IN OUT UINT8 *Buf,
IN DHCP6_INSTANCE *Instance,
OUT UINT16 **Elapsed
IN OUT UINT8 *Buf,
IN DHCP6_INSTANCE *Instance,
OUT UINT16 **Elapsed
);
/**
@@ -227,8 +226,8 @@ Dhcp6AppendETOption (
**/
VOID
SetElapsedTime (
IN UINT16 *Elapsed,
IN DHCP6_INSTANCE *Instance
IN UINT16 *Elapsed,
IN DHCP6_INSTANCE *Instance
);
/**
@@ -244,9 +243,9 @@ SetElapsedTime (
**/
UINT8 *
Dhcp6SeekOption (
IN UINT8 *Buf,
IN UINT32 SeekLen,
IN UINT16 OptType
IN UINT8 *Buf,
IN UINT32 SeekLen,
IN UINT16 OptType
);
/**
@@ -262,9 +261,9 @@ Dhcp6SeekOption (
**/
UINT8 *
Dhcp6SeekIaOption (
IN UINT8 *Buf,
IN UINT32 SeekLen,
IN EFI_DHCP6_IA_DESCRIPTOR *IaDesc
IN UINT8 *Buf,
IN UINT32 SeekLen,
IN EFI_DHCP6_IA_DESCRIPTOR *IaDesc
);
/**
@@ -279,11 +278,11 @@ Dhcp6SeekIaOption (
**/
VOID
Dhcp6ParseAddrOption (
IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
);
/**
@@ -303,14 +302,13 @@ Dhcp6ParseAddrOption (
**/
EFI_STATUS
Dhcp6GenerateIaCb (
IN DHCP6_INSTANCE *Instance,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
IN UINT32 T1,
IN UINT32 T2
IN DHCP6_INSTANCE *Instance,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
IN UINT32 T1,
IN UINT32 T2
);
/**
Cache the current IA configuration information.
@@ -322,10 +320,9 @@ Dhcp6GenerateIaCb (
**/
EFI_STATUS
Dhcp6CacheIa (
IN DHCP6_INSTANCE *Instance
IN DHCP6_INSTANCE *Instance
);
/**
Append CacheIa to the current IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
@@ -334,7 +331,7 @@ Dhcp6CacheIa (
**/
VOID
Dhcp6AppendCacheIa (
IN DHCP6_INSTANCE *Instance
IN DHCP6_INSTANCE *Instance
);
/**
@@ -348,7 +345,8 @@ Dhcp6AppendCacheIa (
**/
EFI_STATUS
Dhcp6GetMappingTimeOut (
IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
OUT UINTN *TimeOut
IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
OUT UINTN *TimeOut
);
#endif