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:
committed by
mergify[bot]
parent
2f88bd3a12
commit
d1050b9dff
@@ -12,6 +12,7 @@
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user-readable name of the driver.
|
||||
|
||||
@@ -59,7 +60,6 @@ Udp6ComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user-readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -150,14 +150,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUdp6ComponentName =
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Udp6ComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Udp6ComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)Udp6ComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)Udp6ComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdp6DriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdp6DriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"UDP6 Network Service Driver"
|
||||
@@ -222,7 +221,7 @@ Udp6ComponentNameGetDriverName (
|
||||
This->SupportedLanguages,
|
||||
mUdp6DriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN) (This == &gUdp6ComponentName)
|
||||
(BOOLEAN)(This == &gUdp6ComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -238,12 +237,12 @@ Udp6ComponentNameGetDriverName (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateName (
|
||||
IN EFI_UDP6_PROTOCOL *Udp6
|
||||
IN EFI_UDP6_PROTOCOL *Udp6
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[64];
|
||||
EFI_UDP6_CONFIG_DATA Udp6ConfigData;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[64];
|
||||
EFI_UDP6_CONFIG_DATA Udp6ConfigData;
|
||||
|
||||
if (Udp6 == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -254,7 +253,9 @@ UpdateName (
|
||||
//
|
||||
Status = Udp6->GetModeData (Udp6, &Udp6ConfigData, NULL, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
UnicodeSPrint (HandleName, sizeof (HandleName),
|
||||
UnicodeSPrint (
|
||||
HandleName,
|
||||
sizeof (HandleName),
|
||||
L"UDPv6 (SrcPort=%d, DestPort=%d)",
|
||||
Udp6ConfigData.StationPort,
|
||||
Udp6ConfigData.RemotePort
|
||||
@@ -368,8 +369,8 @@ Udp6ComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_UDP6_PROTOCOL *Udp6;
|
||||
EFI_STATUS Status;
|
||||
EFI_UDP6_PROTOCOL *Udp6;
|
||||
|
||||
//
|
||||
// Only provide names for child handles.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "Udp6Impl.h"
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gUdp6DriverBinding = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gUdp6DriverBinding = {
|
||||
Udp6DriverBindingSupported,
|
||||
Udp6DriverBindingStart,
|
||||
Udp6DriverBindingStop,
|
||||
@@ -18,7 +18,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUdp6DriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding = {
|
||||
EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding = {
|
||||
Udp6ServiceBindingCreateChild,
|
||||
Udp6ServiceBindingDestroyChild
|
||||
};
|
||||
@@ -74,6 +74,7 @@ Udp6DriverBindingSupported (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Test for the Udp6ServiceBinding Protocol
|
||||
//
|
||||
@@ -88,6 +89,7 @@ Udp6DriverBindingSupported (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Test for the Ip6ServiceBinding Protocol
|
||||
//
|
||||
@@ -166,6 +168,7 @@ EXIT:
|
||||
FreePool (Udp6Service);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -183,8 +186,8 @@ EXIT:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Udp6DestroyChildEntryInHandleBuffer (
|
||||
IN LIST_ENTRY *Entry,
|
||||
IN VOID *Context
|
||||
IN LIST_ENTRY *Entry,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UDP6_INSTANCE_DATA *Instance;
|
||||
@@ -192,14 +195,14 @@ Udp6DestroyChildEntryInHandleBuffer (
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
|
||||
if (Entry == NULL || Context == NULL) {
|
||||
if ((Entry == NULL) || (Context == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Instance = NET_LIST_USER_STRUCT_S (Entry, UDP6_INSTANCE_DATA, Link, UDP6_INSTANCE_DATA_SIGNATURE);
|
||||
ServiceBinding = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
|
||||
NumberOfChildren = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
|
||||
ChildHandleBuffer = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
|
||||
Instance = NET_LIST_USER_STRUCT_S (Entry, UDP6_INSTANCE_DATA, Link, UDP6_INSTANCE_DATA_SIGNATURE);
|
||||
ServiceBinding = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
|
||||
NumberOfChildren = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
|
||||
ChildHandleBuffer = ((UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
|
||||
|
||||
if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
|
||||
return EFI_SUCCESS;
|
||||
@@ -258,7 +261,7 @@ Udp6DriverBindingStop (
|
||||
Status = gBS->OpenProtocol (
|
||||
NicHandle,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
(VOID **) &ServiceBinding,
|
||||
(VOID **)&ServiceBinding,
|
||||
This->DriverBindingHandle,
|
||||
NicHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -273,23 +276,23 @@ Udp6DriverBindingStop (
|
||||
//
|
||||
// NumberOfChildren is not zero, destroy the children instances in ChildHandleBuffer.
|
||||
//
|
||||
List = &Udp6Service->ChildrenList;
|
||||
List = &Udp6Service->ChildrenList;
|
||||
Context.ServiceBinding = ServiceBinding;
|
||||
Context.NumberOfChildren = NumberOfChildren;
|
||||
Context.ChildHandleBuffer = ChildHandleBuffer;
|
||||
Status = NetDestroyLinkList (
|
||||
List,
|
||||
Udp6DestroyChildEntryInHandleBuffer,
|
||||
&Context,
|
||||
NULL
|
||||
);
|
||||
Status = NetDestroyLinkList (
|
||||
List,
|
||||
Udp6DestroyChildEntryInHandleBuffer,
|
||||
&Context,
|
||||
NULL
|
||||
);
|
||||
} else if (IsListEmpty (&Udp6Service->ChildrenList)) {
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
NicHandle,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
&Udp6Service->ServiceBinding,
|
||||
NULL
|
||||
);
|
||||
NicHandle,
|
||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||
&Udp6Service->ServiceBinding,
|
||||
NULL
|
||||
);
|
||||
|
||||
Udp6CleanService (Udp6Service);
|
||||
FreePool (Udp6Service);
|
||||
@@ -376,7 +379,7 @@ Udp6ServiceBindingCreateChild (
|
||||
Status = gBS->OpenProtocol (
|
||||
Udp6Service->IpIo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
(VOID **) &Ip6,
|
||||
(VOID **)&Ip6,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
@@ -391,7 +394,7 @@ Udp6ServiceBindingCreateChild (
|
||||
Status = gBS->OpenProtocol (
|
||||
Instance->IpInfo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
(VOID **) &Ip6,
|
||||
(VOID **)&Ip6,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
@@ -478,7 +481,7 @@ Udp6ServiceBindingDestroyChild (
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiUdp6ProtocolGuid,
|
||||
(VOID **) &Udp6Proto,
|
||||
(VOID **)&Udp6Proto,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -502,11 +505,11 @@ Udp6ServiceBindingDestroyChild (
|
||||
// Close the Ip6 protocol on the default IpIo.
|
||||
//
|
||||
Status = gBS->CloseProtocol (
|
||||
Udp6Service->IpIo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle
|
||||
);
|
||||
Udp6Service->IpIo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Instance->InDestroy = FALSE;
|
||||
return Status;
|
||||
@@ -516,11 +519,11 @@ Udp6ServiceBindingDestroyChild (
|
||||
// Close the Ip6 protocol on this instance's IpInfo.
|
||||
//
|
||||
Status = gBS->CloseProtocol (
|
||||
Instance->IpInfo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle
|
||||
);
|
||||
Instance->IpInfo->ChildHandle,
|
||||
&gEfiIp6ProtocolGuid,
|
||||
gUdp6DriverBinding.DriverBindingHandle,
|
||||
Instance->ChildHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Instance->InDestroy = FALSE;
|
||||
return Status;
|
||||
@@ -532,7 +535,7 @@ Udp6ServiceBindingDestroyChild (
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
ChildHandle,
|
||||
&gEfiUdp6ProtocolGuid,
|
||||
(VOID *) &Instance->Udp6Proto,
|
||||
(VOID *)&Instance->Udp6Proto,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -611,13 +614,11 @@ Udp6DriverEntryPoint (
|
||||
// Initialize the UDP random port.
|
||||
//
|
||||
mUdp6RandomPort = (UINT16)(
|
||||
((UINT16) NetRandomInitSeed ()) %
|
||||
UDP6_PORT_KNOWN +
|
||||
UDP6_PORT_KNOWN
|
||||
);
|
||||
((UINT16)NetRandomInitSeed ()) %
|
||||
UDP6_PORT_KNOWN +
|
||||
UDP6_PORT_KNOWN
|
||||
);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -173,4 +173,3 @@ Udp6ServiceBindingDestroyChild (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -63,10 +63,10 @@ Udp6FindInstanceByPort (
|
||||
VOID
|
||||
EFIAPI
|
||||
Udp6DgramSent (
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -264,8 +264,8 @@ Udp6SendPortUnreach (
|
||||
**/
|
||||
NET_MAP_ITEM *
|
||||
Udp6MapMultiCastAddr (
|
||||
IN NET_MAP *Map,
|
||||
IN VOID *Key
|
||||
IN NET_MAP *Map,
|
||||
IN VOID *Key
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -317,10 +317,10 @@ Udp6CreateService (
|
||||
&mIp6IoDefaultIpConfigData,
|
||||
sizeof (EFI_IP6_CONFIG_DATA)
|
||||
);
|
||||
OpenData.RcvdContext = (VOID *) Udp6Service;
|
||||
OpenData.SndContext = NULL;
|
||||
OpenData.PktRcvdNotify = Udp6DgramRcvd;
|
||||
OpenData.PktSentNotify = Udp6DgramSent;
|
||||
OpenData.RcvdContext = (VOID *)Udp6Service;
|
||||
OpenData.SndContext = NULL;
|
||||
OpenData.PktRcvdNotify = Udp6DgramRcvd;
|
||||
OpenData.PktSentNotify = Udp6DgramSent;
|
||||
|
||||
//
|
||||
// Configure and start the IpIo.
|
||||
@@ -370,7 +370,6 @@ ON_ERROR:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clean the Udp service context data.
|
||||
|
||||
@@ -396,7 +395,6 @@ Udp6CleanService (
|
||||
ZeroMem (Udp6Service, sizeof (UDP6_SERVICE_DATA));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function checks and times out the I/O datagrams listed in the
|
||||
UDP6_SERVICE_DATA which is specified by the input parameter Context.
|
||||
@@ -421,7 +419,7 @@ Udp6CheckTimeout (
|
||||
LIST_ENTRY *NextEntry;
|
||||
UDP6_RXDATA_WRAP *Wrap;
|
||||
|
||||
Udp6Service = (UDP6_SERVICE_DATA *) Context;
|
||||
Udp6Service = (UDP6_SERVICE_DATA *)Context;
|
||||
NET_CHECK_SIGNATURE (Udp6Service, UDP6_SERVICE_DATA_SIGNATURE);
|
||||
|
||||
NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
|
||||
@@ -448,7 +446,7 @@ Udp6CheckTimeout (
|
||||
//
|
||||
// Remove this RxData if it timeouts.
|
||||
//
|
||||
Udp6RecycleRxDataWrap (NULL, (VOID *) Wrap);
|
||||
Udp6RecycleRxDataWrap (NULL, (VOID *)Wrap);
|
||||
} else {
|
||||
Wrap->TimeoutTick -= UDP6_TIMEOUT_INTERVAL / 10;
|
||||
}
|
||||
@@ -456,7 +454,6 @@ Udp6CheckTimeout (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function initializes the new created udp instance.
|
||||
|
||||
@@ -500,7 +497,6 @@ Udp6InitInstance (
|
||||
Instance->InDestroy = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function cleans the udp instance.
|
||||
|
||||
@@ -517,7 +513,6 @@ Udp6CleanInstance (
|
||||
NetMapClean (&Instance->TxTokens);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function finds the udp instance by the specified <Address, Port> pair.
|
||||
|
||||
@@ -558,7 +553,8 @@ Udp6FindInstanceByPort (
|
||||
|
||||
if (EFI_IP6_EQUAL (&ConfigData->StationAddress, Address) &&
|
||||
(ConfigData->StationPort == Port)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// If both the address and the port are the same, return TRUE.
|
||||
//
|
||||
@@ -572,7 +568,6 @@ Udp6FindInstanceByPort (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function tries to bind the udp instance according to the configured port
|
||||
allocation strategy.
|
||||
@@ -604,10 +599,10 @@ Udp6Bind (
|
||||
StationAddress = &ConfigData->StationAddress;
|
||||
|
||||
if (ConfigData->StationPort != 0) {
|
||||
|
||||
if (!ConfigData->AllowDuplicatePort &&
|
||||
Udp6FindInstanceByPort (InstanceList, StationAddress, ConfigData->StationPort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do not allow duplicate ports and the port is already used by other instance.
|
||||
//
|
||||
@@ -623,11 +618,9 @@ Udp6Bind (
|
||||
//
|
||||
ConfigData->StationPort = mUdp6RandomPort;
|
||||
} else {
|
||||
|
||||
StartPort = mUdp6RandomPort;
|
||||
|
||||
while (Udp6FindInstanceByPort (InstanceList, StationAddress, mUdp6RandomPort)) {
|
||||
|
||||
mUdp6RandomPort++;
|
||||
if (mUdp6RandomPort == 0) {
|
||||
mUdp6RandomPort = UDP6_PORT_KNOWN;
|
||||
@@ -649,10 +642,10 @@ Udp6Bind (
|
||||
mUdp6RandomPort = UDP6_PORT_KNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used to check whether the NewConfigData has any un-reconfigurable
|
||||
parameters changed compared to the OldConfigData.
|
||||
@@ -674,7 +667,8 @@ Udp6IsReconfigurable (
|
||||
if ((NewConfigData->AcceptAnyPort != OldConfigData->AcceptAnyPort) ||
|
||||
(NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||
|
||||
(NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The receiving filter parameters cannot be changed.
|
||||
//
|
||||
@@ -683,7 +677,8 @@ Udp6IsReconfigurable (
|
||||
|
||||
if ((!NewConfigData->AcceptAnyPort) &&
|
||||
(NewConfigData->StationPort != OldConfigData->StationPort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The port is not changeable.
|
||||
//
|
||||
@@ -697,7 +692,6 @@ Udp6IsReconfigurable (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!EFI_IP6_EQUAL (&NewConfigData->RemoteAddress, &OldConfigData->RemoteAddress)) {
|
||||
//
|
||||
// The remoteaddress is not the same.
|
||||
@@ -707,7 +701,8 @@ Udp6IsReconfigurable (
|
||||
|
||||
if (!NetIp6IsUnspecifiedAddr (&NewConfigData->RemoteAddress) &&
|
||||
(NewConfigData->RemotePort != OldConfigData->RemotePort)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The RemotePort differs if it's designated in the configdata.
|
||||
//
|
||||
@@ -720,7 +715,6 @@ Udp6IsReconfigurable (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function builds the Ip6 configdata from the Udp6ConfigData.
|
||||
|
||||
@@ -730,8 +724,8 @@ Udp6IsReconfigurable (
|
||||
**/
|
||||
VOID
|
||||
Udp6BuildIp6ConfigData (
|
||||
IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,
|
||||
IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData
|
||||
IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,
|
||||
IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData
|
||||
)
|
||||
{
|
||||
CopyMem (
|
||||
@@ -739,17 +733,16 @@ Udp6BuildIp6ConfigData (
|
||||
&mIp6IoDefaultIpConfigData,
|
||||
sizeof (EFI_IP6_CONFIG_DATA)
|
||||
);
|
||||
Ip6ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;
|
||||
Ip6ConfigData->AcceptPromiscuous = Udp6ConfigData->AcceptPromiscuous;
|
||||
Ip6ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;
|
||||
Ip6ConfigData->AcceptPromiscuous = Udp6ConfigData->AcceptPromiscuous;
|
||||
IP6_COPY_ADDRESS (&Ip6ConfigData->StationAddress, &Udp6ConfigData->StationAddress);
|
||||
IP6_COPY_ADDRESS (&Ip6ConfigData->DestinationAddress, &Udp6ConfigData->RemoteAddress);
|
||||
//
|
||||
// Use the -1 magic number to disable the receiving process of the ip instance.
|
||||
//
|
||||
Ip6ConfigData->ReceiveTimeout = (UINT32) (-1);
|
||||
Ip6ConfigData->ReceiveTimeout = (UINT32)(-1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function validates the TxToken. It returns the error code according to the spec.
|
||||
|
||||
@@ -791,7 +784,6 @@ Udp6ValidateTxToken (
|
||||
EFI_UDP6_CONFIG_DATA *ConfigData;
|
||||
EFI_UDP6_SESSION_DATA *UdpSessionData;
|
||||
|
||||
|
||||
if (TxToken->Event == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -804,10 +796,10 @@ Udp6ValidateTxToken (
|
||||
|
||||
TotalLen = 0;
|
||||
for (Index = 0; Index < TxData->FragmentCount; Index++) {
|
||||
|
||||
if ((TxData->FragmentTable[Index].FragmentBuffer == NULL) ||
|
||||
(TxData->FragmentTable[Index].FragmentLength == 0)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// If the FragmentBuffer is NULL, or the FragmentLeng is zero.
|
||||
//
|
||||
@@ -829,7 +821,6 @@ Udp6ValidateTxToken (
|
||||
UdpSessionData = TxData->UdpSessionData;
|
||||
|
||||
if (UdpSessionData != NULL) {
|
||||
|
||||
if ((UdpSessionData->DestinationPort == 0) && (ConfigData->RemotePort == 0)) {
|
||||
//
|
||||
// Ambiguous; no available DestinationPort for this token.
|
||||
@@ -839,7 +830,8 @@ Udp6ValidateTxToken (
|
||||
|
||||
if (NetIp6IsUnspecifiedAddr (&UdpSessionData->DestinationAddress) &&
|
||||
NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The DestinationAddress is not specified.
|
||||
//
|
||||
@@ -848,7 +840,8 @@ Udp6ValidateTxToken (
|
||||
|
||||
if (!NetIp6IsUnspecifiedAddr (&UdpSessionData->DestinationAddress) &&
|
||||
!NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The ConfigData.RemoteAddress is not zero and the UdpSessionData.DestinationAddress
|
||||
// is not zero too.
|
||||
@@ -870,7 +863,6 @@ Udp6ValidateTxToken (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function checks whether the specified Token duplicates the one in the Map.
|
||||
|
||||
@@ -895,8 +887,8 @@ Udp6TokenExist (
|
||||
EFI_UDP6_COMPLETION_TOKEN *Token;
|
||||
EFI_UDP6_COMPLETION_TOKEN *TokenInItem;
|
||||
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *) Context;
|
||||
TokenInItem = (EFI_UDP6_COMPLETION_TOKEN *) Item->Key;
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *)Context;
|
||||
TokenInItem = (EFI_UDP6_COMPLETION_TOKEN *)Item->Key;
|
||||
|
||||
if ((Token == TokenInItem) || (Token->Event == TokenInItem->Event)) {
|
||||
//
|
||||
@@ -909,7 +901,6 @@ Udp6TokenExist (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function calculates the checksum for the Packet, utilizing the pre-calculated
|
||||
pseudo HeadSum to reduce some overhead.
|
||||
@@ -923,21 +914,20 @@ Udp6TokenExist (
|
||||
**/
|
||||
UINT16
|
||||
Udp6Checksum (
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
)
|
||||
{
|
||||
UINT16 Checksum;
|
||||
|
||||
Checksum = NetbufChecksum (Packet);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
Checksum = NetbufChecksum (Packet);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
|
||||
Checksum = NetAddChecksum (Checksum, HTONS ((UINT16) Packet->TotalSize));
|
||||
Checksum = (UINT16) (~Checksum);
|
||||
Checksum = NetAddChecksum (Checksum, HTONS ((UINT16)Packet->TotalSize));
|
||||
Checksum = (UINT16)(~Checksum);
|
||||
return Checksum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the specified Token from the TokenMap.
|
||||
|
||||
@@ -959,7 +949,7 @@ Udp6RemoveToken (
|
||||
//
|
||||
// Find the Token first.
|
||||
//
|
||||
Item = NetMapFindKey (TokenMap, (VOID *) Token);
|
||||
Item = NetMapFindKey (TokenMap, (VOID *)Token);
|
||||
|
||||
if (Item != NULL) {
|
||||
//
|
||||
@@ -969,10 +959,10 @@ Udp6RemoveToken (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is the packet transmitting notify function registered to the IpIo
|
||||
interface. It's called to signal the udp TxToken when IpIo layer completes the
|
||||
@@ -990,10 +980,10 @@ Udp6RemoveToken (
|
||||
VOID
|
||||
EFIAPI
|
||||
Udp6DgramSent (
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
IN EFI_STATUS Status,
|
||||
IN VOID *Context,
|
||||
IN IP_IO_IP_PROTOCOL Sender,
|
||||
IN VOID *NotifyData
|
||||
)
|
||||
{
|
||||
UDP6_INSTANCE_DATA *Instance;
|
||||
@@ -1001,8 +991,8 @@ Udp6DgramSent (
|
||||
|
||||
ASSERT (Context != NULL && NotifyData != NULL);
|
||||
|
||||
Instance = (UDP6_INSTANCE_DATA *) Context;
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;
|
||||
Instance = (UDP6_INSTANCE_DATA *)Context;
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *)NotifyData;
|
||||
|
||||
if (Udp6RemoveToken (&Instance->TxTokens, Token) == EFI_SUCCESS) {
|
||||
//
|
||||
@@ -1014,7 +1004,6 @@ Udp6DgramSent (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function processes the received datagram passed up by the IpIo layer.
|
||||
|
||||
@@ -1048,16 +1037,15 @@ Udp6DgramRcvd (
|
||||
// IpIo only passes received packets with Status EFI_SUCCESS or EFI_ICMP_ERROR.
|
||||
//
|
||||
if (Status == EFI_SUCCESS) {
|
||||
|
||||
//
|
||||
// Demultiplex the received datagram.
|
||||
//
|
||||
Udp6Demultiplex ((UDP6_SERVICE_DATA *) Context, NetSession, Packet);
|
||||
Udp6Demultiplex ((UDP6_SERVICE_DATA *)Context, NetSession, Packet);
|
||||
} else {
|
||||
//
|
||||
// Handle the ICMP6 Error packet.
|
||||
//
|
||||
Udp6IcmpHandler ((UDP6_SERVICE_DATA *) Context, IcmpError, NetSession, Packet);
|
||||
Udp6IcmpHandler ((UDP6_SERVICE_DATA *)Context, IcmpError, NetSession, Packet);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1067,7 +1055,6 @@ Udp6DgramRcvd (
|
||||
DispatchDpc ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the multicast group specified by Arg from the Map.
|
||||
|
||||
@@ -1096,7 +1083,8 @@ Udp6LeaveGroup (
|
||||
|
||||
if ((McastIp != NULL) &&
|
||||
!EFI_IP6_EQUAL (McastIp, ((EFI_IPv6_ADDRESS *)Item->Key))
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// McastIp is not NULL and the multicast address contained in the Item
|
||||
// is not the same as McastIp.
|
||||
@@ -1121,7 +1109,6 @@ Udp6LeaveGroup (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function cancel the token specified by Arg in the Map.
|
||||
|
||||
@@ -1161,15 +1148,15 @@ Udp6CancelTokens (
|
||||
// will invoke Udp6DgramSent, the token will be signaled and this Item will
|
||||
// be removed from the Map there.
|
||||
//
|
||||
Packet = (NET_BUF *) (Item->Value);
|
||||
IpIo = (IP_IO *) (*((UINTN *) &Packet->ProtoData[0]));
|
||||
Packet = (NET_BUF *)(Item->Value);
|
||||
IpIo = (IP_IO *)(*((UINTN *)&Packet->ProtoData[0]));
|
||||
|
||||
IpIoCancelTxToken (IpIo, Packet);
|
||||
} else {
|
||||
//
|
||||
// The token is a receive token. Abort it and remove it from the Map.
|
||||
//
|
||||
TokenToCancel = (EFI_UDP6_COMPLETION_TOKEN *) Item->Key;
|
||||
TokenToCancel = (EFI_UDP6_COMPLETION_TOKEN *)Item->Key;
|
||||
NetMapRemoveItem (Map, Item, NULL);
|
||||
|
||||
TokenToCancel->Status = EFI_ABORTED;
|
||||
@@ -1183,7 +1170,6 @@ Udp6CancelTokens (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes all the Wrap datas in the RcvdDgramQue.
|
||||
|
||||
@@ -1206,12 +1192,10 @@ Udp6FlushRcvdDgram (
|
||||
//
|
||||
// The Wrap will be removed from the RcvdDgramQue by this function call.
|
||||
//
|
||||
Udp6RecycleRxDataWrap (NULL, (VOID *) Wrap);
|
||||
Udp6RecycleRxDataWrap (NULL, (VOID *)Wrap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Cancel Udp6 tokens from the Udp6 instance.
|
||||
|
||||
@@ -1259,15 +1243,15 @@ Udp6InstanceCancelToken (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT ((Token != NULL) ||
|
||||
((0 == NetMapGetCount (&Instance->TxTokens)) &&
|
||||
(0 == NetMapGetCount (&Instance->RxTokens)))
|
||||
);
|
||||
ASSERT (
|
||||
(Token != NULL) ||
|
||||
((0 == NetMapGetCount (&Instance->TxTokens)) &&
|
||||
(0 == NetMapGetCount (&Instance->RxTokens)))
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function checks if the received udp datagram matches with the Instance.
|
||||
|
||||
@@ -1299,7 +1283,8 @@ Udp6MatchDgram (
|
||||
|
||||
if ((!ConfigData->AcceptAnyPort && (Udp6Session->DestinationPort != ConfigData->StationPort)) ||
|
||||
((ConfigData->RemotePort != 0) && (Udp6Session->SourcePort != ConfigData->RemotePort))
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The local port or the remote port doesn't match.
|
||||
//
|
||||
@@ -1308,7 +1293,8 @@ Udp6MatchDgram (
|
||||
|
||||
if (!NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress) &&
|
||||
!EFI_IP6_EQUAL (&ConfigData->RemoteAddress, &Udp6Session->SourceAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// This datagram doesn't come from the instance's specified sender.
|
||||
//
|
||||
@@ -1317,7 +1303,8 @@ Udp6MatchDgram (
|
||||
|
||||
if (NetIp6IsUnspecifiedAddr (&ConfigData->StationAddress) ||
|
||||
EFI_IP6_EQUAL (&Udp6Session->DestinationAddress, &ConfigData->StationAddress)
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// The instance is configured to receive datagrams destinated to any station IP or
|
||||
// the destination address of this datagram matches the configured station IP.
|
||||
@@ -1329,7 +1316,8 @@ Udp6MatchDgram (
|
||||
|
||||
if (IP6_IS_MULTICAST (&Destination) &&
|
||||
(NULL != Udp6MapMultiCastAddr (&Instance->McastIps, &Destination))
|
||||
) {
|
||||
)
|
||||
{
|
||||
//
|
||||
// It's a multicast packet and the multicast address is accepted by this instance.
|
||||
//
|
||||
@@ -1339,7 +1327,6 @@ Udp6MatchDgram (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function removes the Wrap specified by Context and release relevant resources.
|
||||
|
||||
@@ -1356,7 +1343,7 @@ Udp6RecycleRxDataWrap (
|
||||
{
|
||||
UDP6_RXDATA_WRAP *Wrap;
|
||||
|
||||
Wrap = (UDP6_RXDATA_WRAP *) Context;
|
||||
Wrap = (UDP6_RXDATA_WRAP *)Context;
|
||||
|
||||
//
|
||||
// Remove the Wrap from the list it belongs to.
|
||||
@@ -1376,7 +1363,6 @@ Udp6RecycleRxDataWrap (
|
||||
FreePool (Wrap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function wraps the Packet into RxData.
|
||||
|
||||
@@ -1397,21 +1383,23 @@ Udp6WrapRxData (
|
||||
IN EFI_UDP6_RECEIVE_DATA *RxData
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UDP6_RXDATA_WRAP *Wrap;
|
||||
EFI_STATUS Status;
|
||||
UDP6_RXDATA_WRAP *Wrap;
|
||||
|
||||
//
|
||||
// Allocate buffer for the Wrap.
|
||||
//
|
||||
Wrap = AllocateZeroPool (sizeof (UDP6_RXDATA_WRAP) +
|
||||
(Packet->BlockOpNum - 1) * sizeof (EFI_UDP6_FRAGMENT_DATA));
|
||||
Wrap = AllocateZeroPool (
|
||||
sizeof (UDP6_RXDATA_WRAP) +
|
||||
(Packet->BlockOpNum - 1) * sizeof (EFI_UDP6_FRAGMENT_DATA)
|
||||
);
|
||||
if (Wrap == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
InitializeListHead (&Wrap->Link);
|
||||
|
||||
CopyMem (&Wrap->RxData, RxData, sizeof(EFI_UDP6_RECEIVE_DATA));
|
||||
CopyMem (&Wrap->RxData, RxData, sizeof (EFI_UDP6_RECEIVE_DATA));
|
||||
//
|
||||
// Create the Recycle event.
|
||||
//
|
||||
@@ -1433,7 +1421,6 @@ Udp6WrapRxData (
|
||||
return Wrap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function enqueues the received datagram into the instances' receiving queues.
|
||||
|
||||
@@ -1490,7 +1477,6 @@ Udp6EnqueueDgram (
|
||||
return Enqueued;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function delivers the received datagrams to the specified instance.
|
||||
|
||||
@@ -1510,8 +1496,8 @@ Udp6InstanceDeliverDgram (
|
||||
|
||||
if (!IsListEmpty (&Instance->RcvdDgramQue) &&
|
||||
!NetMapIsEmpty (&Instance->RxTokens)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
Wrap = NET_LIST_HEAD (&Instance->RcvdDgramQue, UDP6_RXDATA_WRAP, Link);
|
||||
|
||||
if (NET_BUF_SHARED (Wrap->Packet)) {
|
||||
@@ -1530,7 +1516,7 @@ Udp6InstanceDeliverDgram (
|
||||
|
||||
NetListRemoveHead (&Instance->RcvdDgramQue);
|
||||
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
|
||||
//
|
||||
// Build the FragmentTable and set the FragmentCount in RxData.
|
||||
@@ -1540,7 +1526,7 @@ Udp6InstanceDeliverDgram (
|
||||
|
||||
NetbufBuildExt (
|
||||
Wrap->Packet,
|
||||
(NET_FRAGMENT *) RxData->FragmentTable,
|
||||
(NET_FRAGMENT *)RxData->FragmentTable,
|
||||
&RxData->FragmentCount
|
||||
);
|
||||
|
||||
@@ -1555,7 +1541,6 @@ Udp6InstanceDeliverDgram (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function delivers the datagrams enqueued in the instances.
|
||||
|
||||
@@ -1587,7 +1572,6 @@ Udp6DeliverDgram (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function demultiplexes the received udp datagram to the appropriate instances.
|
||||
|
||||
@@ -1605,7 +1589,7 @@ Udp6Demultiplex (
|
||||
IN NET_BUF *Packet
|
||||
)
|
||||
{
|
||||
EFI_UDP_HEADER *Udp6Header;
|
||||
EFI_UDP_HEADER *Udp6Header;
|
||||
UINT16 HeadSum;
|
||||
EFI_UDP6_RECEIVE_DATA RxData;
|
||||
EFI_UDP6_SESSION_DATA *Udp6Session;
|
||||
@@ -1619,7 +1603,7 @@ Udp6Demultiplex (
|
||||
//
|
||||
// Get the datagram header from the packet buffer.
|
||||
//
|
||||
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
|
||||
Udp6Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);
|
||||
ASSERT (Udp6Header != NULL);
|
||||
if (Udp6Header == NULL) {
|
||||
NetbufFree (Packet);
|
||||
@@ -1658,7 +1642,7 @@ Udp6Demultiplex (
|
||||
//
|
||||
NetbufTrim (Packet, UDP6_HEADER_SIZE, TRUE);
|
||||
|
||||
RxData.DataLength = (UINT32) Packet->TotalSize;
|
||||
RxData.DataLength = (UINT32)Packet->TotalSize;
|
||||
|
||||
//
|
||||
// Try to enqueue this datagram into the instances.
|
||||
@@ -1685,7 +1669,6 @@ Udp6Demultiplex (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function builds and sends out a icmp port unreachable message.
|
||||
|
||||
@@ -1721,14 +1704,14 @@ Udp6SendPortUnreach (
|
||||
//
|
||||
if (NetSession->IpVersion == IP_VERSION_6) {
|
||||
if (NetIp6IsUnspecifiedAddr (&NetSession->Dest.v6) ||
|
||||
IP6_IS_MULTICAST (&NetSession->Dest.v6)
|
||||
) {
|
||||
IP6_IS_MULTICAST (&NetSession->Dest.v6)
|
||||
)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IpSender = IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);
|
||||
IpSender = IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);
|
||||
|
||||
//
|
||||
// Get the Ipv6 Mode Data.
|
||||
@@ -1759,11 +1742,12 @@ Udp6SendPortUnreach (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
//
|
||||
// The ICMP6 packet length, includes whole invoking packet and ICMP6 error header.
|
||||
//
|
||||
Len = NetSession->IpHdrLen +
|
||||
NTOHS(((EFI_UDP_HEADER *) Udp6Header)->Length) +
|
||||
NTOHS (((EFI_UDP_HEADER *)Udp6Header)->Length) +
|
||||
sizeof (IP6_ICMP_ERROR_HEAD);
|
||||
|
||||
//
|
||||
@@ -1784,7 +1768,7 @@ Udp6SendPortUnreach (
|
||||
//
|
||||
// Allocate space for the IP6_ICMP_ERROR_HEAD.
|
||||
//
|
||||
IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);
|
||||
IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *)NetbufAllocSpace (Packet, Len, FALSE);
|
||||
ASSERT (IcmpErrHdr != NULL);
|
||||
if (IcmpErrHdr == NULL) {
|
||||
goto EXIT;
|
||||
@@ -1804,8 +1788,8 @@ Udp6SendPortUnreach (
|
||||
// the length of EFI_IP6_HEADER, so when using the length of IP6_ICMP_ERROR_HEAD
|
||||
// for pointer movement that fact should be considered.
|
||||
//
|
||||
Ptr = (VOID *) &IcmpErrHdr->Head;
|
||||
Ptr = (UINT8 *) (UINTN) ((UINTN) Ptr + sizeof (IP6_ICMP_ERROR_HEAD) - sizeof (EFI_IP6_HEADER));
|
||||
Ptr = (VOID *)&IcmpErrHdr->Head;
|
||||
Ptr = (UINT8 *)(UINTN)((UINTN)Ptr + sizeof (IP6_ICMP_ERROR_HEAD) - sizeof (EFI_IP6_HEADER));
|
||||
CopyMem (Ptr, NetSession->IpHdr.Ip6Hdr, NetSession->IpHdrLen);
|
||||
CopyMem (
|
||||
Ptr + NetSession->IpHdrLen,
|
||||
@@ -1821,9 +1805,9 @@ Udp6SendPortUnreach (
|
||||
//
|
||||
// Fill the override data.
|
||||
//
|
||||
Override.Ip6OverrideData.FlowLabel = 0;
|
||||
Override.Ip6OverrideData.HopLimit = 255;
|
||||
Override.Ip6OverrideData.Protocol = IP6_ICMP;
|
||||
Override.Ip6OverrideData.FlowLabel = 0;
|
||||
Override.Ip6OverrideData.HopLimit = 255;
|
||||
Override.Ip6OverrideData.Protocol = IP6_ICMP;
|
||||
|
||||
//
|
||||
// Send out this icmp packet.
|
||||
@@ -1838,7 +1822,6 @@ EXIT:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function handles the received Icmp Error message and de-multiplexes it to the
|
||||
instance.
|
||||
@@ -1868,7 +1851,7 @@ Udp6IcmpHandler (
|
||||
return;
|
||||
}
|
||||
|
||||
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
|
||||
Udp6Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);
|
||||
ASSERT (Udp6Header != NULL);
|
||||
if (Udp6Header == NULL) {
|
||||
NetbufFree (Packet);
|
||||
@@ -1913,7 +1896,6 @@ Udp6IcmpHandler (
|
||||
NetbufFree (Packet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function reports the received ICMP error.
|
||||
|
||||
@@ -1938,7 +1920,7 @@ Udp6ReportIcmpError (
|
||||
//
|
||||
// Try to get a RxToken from the RxTokens map.
|
||||
//
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
Token = (EFI_UDP6_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);
|
||||
|
||||
if (Token != NULL) {
|
||||
//
|
||||
@@ -1955,7 +1937,6 @@ Udp6ReportIcmpError (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is a dummy ext-free function for the NET_BUF created for the output
|
||||
udp datagram.
|
||||
@@ -1982,8 +1963,8 @@ Udp6NetVectorExtFree (
|
||||
**/
|
||||
NET_MAP_ITEM *
|
||||
Udp6MapMultiCastAddr (
|
||||
IN NET_MAP *Map,
|
||||
IN VOID *Key
|
||||
IN NET_MAP *Map,
|
||||
IN VOID *Key
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
@@ -1992,12 +1973,11 @@ Udp6MapMultiCastAddr (
|
||||
|
||||
ASSERT (Map != NULL);
|
||||
NET_LIST_FOR_EACH (Entry, &Map->Used) {
|
||||
Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
|
||||
Addr = (EFI_IPv6_ADDRESS *) Item->Key;
|
||||
Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
|
||||
Addr = (EFI_IPv6_ADDRESS *)Item->Key;
|
||||
if (EFI_IP6_EQUAL (Addr, Key)) {
|
||||
return Item;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -28,22 +28,22 @@
|
||||
|
||||
#include "Udp6Driver.h"
|
||||
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gUdp6ComponentName;
|
||||
extern EFI_UNICODE_STRING_TABLE *gUdp6ControllerNameTable;
|
||||
extern EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding;
|
||||
extern EFI_UDP6_PROTOCOL mUdp6Protocol;
|
||||
extern UINT16 mUdp6RandomPort;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gUdp6ComponentName;
|
||||
extern EFI_UNICODE_STRING_TABLE *gUdp6ControllerNameTable;
|
||||
extern EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding;
|
||||
extern EFI_UDP6_PROTOCOL mUdp6Protocol;
|
||||
extern UINT16 mUdp6RandomPort;
|
||||
|
||||
//
|
||||
// Define time out 50 milliseconds
|
||||
//
|
||||
#define UDP6_TIMEOUT_INTERVAL (50 * TICKS_PER_MS)
|
||||
#define UDP6_HEADER_SIZE sizeof (EFI_UDP_HEADER)
|
||||
#define UDP6_MAX_DATA_SIZE 65507
|
||||
#define UDP6_PORT_KNOWN 1024
|
||||
#define UDP6_TIMEOUT_INTERVAL (50 * TICKS_PER_MS)
|
||||
#define UDP6_HEADER_SIZE sizeof (EFI_UDP_HEADER)
|
||||
#define UDP6_MAX_DATA_SIZE 65507
|
||||
#define UDP6_PORT_KNOWN 1024
|
||||
|
||||
#define UDP6_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', '6')
|
||||
#define UDP6_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', '6')
|
||||
#define UDP6_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', 'S')
|
||||
|
||||
#define UDP6_SERVICE_DATA_FROM_THIS(a) \
|
||||
@@ -65,47 +65,47 @@ extern UINT16 mUdp6RandomPort;
|
||||
// Udp6 service contest data
|
||||
//
|
||||
typedef struct _UDP6_SERVICE_DATA {
|
||||
UINT32 Signature;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
LIST_ENTRY ChildrenList;
|
||||
UINTN ChildrenNumber;
|
||||
IP_IO *IpIo;
|
||||
EFI_EVENT TimeoutEvent;
|
||||
} UDP6_SERVICE_DATA;
|
||||
UINT32 Signature;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
LIST_ENTRY ChildrenList;
|
||||
UINTN ChildrenNumber;
|
||||
IP_IO *IpIo;
|
||||
EFI_EVENT TimeoutEvent;
|
||||
} UDP6_SERVICE_DATA;
|
||||
|
||||
typedef struct _UDP6_INSTANCE_DATA {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
UDP6_SERVICE_DATA *Udp6Service;
|
||||
EFI_UDP6_PROTOCOL Udp6Proto;
|
||||
EFI_UDP6_CONFIG_DATA ConfigData;
|
||||
EFI_HANDLE ChildHandle;
|
||||
BOOLEAN Configured;
|
||||
BOOLEAN IsNoMapping;
|
||||
NET_MAP TxTokens;
|
||||
NET_MAP RxTokens;
|
||||
NET_MAP McastIps;
|
||||
LIST_ENTRY RcvdDgramQue;
|
||||
LIST_ENTRY DeliveredDgramQue;
|
||||
UINT16 HeadSum;
|
||||
EFI_STATUS IcmpError;
|
||||
IP_IO_IP_INFO *IpInfo;
|
||||
BOOLEAN InDestroy;
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
UDP6_SERVICE_DATA *Udp6Service;
|
||||
EFI_UDP6_PROTOCOL Udp6Proto;
|
||||
EFI_UDP6_CONFIG_DATA ConfigData;
|
||||
EFI_HANDLE ChildHandle;
|
||||
BOOLEAN Configured;
|
||||
BOOLEAN IsNoMapping;
|
||||
NET_MAP TxTokens;
|
||||
NET_MAP RxTokens;
|
||||
NET_MAP McastIps;
|
||||
LIST_ENTRY RcvdDgramQue;
|
||||
LIST_ENTRY DeliveredDgramQue;
|
||||
UINT16 HeadSum;
|
||||
EFI_STATUS IcmpError;
|
||||
IP_IO_IP_INFO *IpInfo;
|
||||
BOOLEAN InDestroy;
|
||||
} UDP6_INSTANCE_DATA;
|
||||
|
||||
typedef struct _UDP6_RXDATA_WRAP {
|
||||
LIST_ENTRY Link;
|
||||
NET_BUF *Packet;
|
||||
UINT32 TimeoutTick;
|
||||
EFI_UDP6_RECEIVE_DATA RxData;
|
||||
LIST_ENTRY Link;
|
||||
NET_BUF *Packet;
|
||||
UINT32 TimeoutTick;
|
||||
EFI_UDP6_RECEIVE_DATA RxData;
|
||||
} UDP6_RXDATA_WRAP;
|
||||
|
||||
typedef struct {
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
} UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
|
||||
|
||||
/**
|
||||
@@ -458,8 +458,8 @@ Udp6Bind (
|
||||
**/
|
||||
VOID
|
||||
Udp6BuildIp6ConfigData (
|
||||
IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,
|
||||
IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData
|
||||
IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,
|
||||
IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -600,8 +600,8 @@ Udp6NetVectorExtFree (
|
||||
**/
|
||||
UINT16
|
||||
Udp6Checksum (
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
IN NET_BUF *Packet,
|
||||
IN UINT16 HeadSum
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -645,4 +645,3 @@ Udp6FlushRcvdDgram (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -19,7 +19,6 @@ EFI_UDP6_PROTOCOL mUdp6Protocol = {
|
||||
Udp6Poll
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
This function copies the current operational settings of this EFI UDPv6 Protocol
|
||||
instance into user-supplied buffers. This function is used optionally to retrieve
|
||||
@@ -91,7 +90,6 @@ Udp6GetModeData (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used to do the following:
|
||||
Initialize and start this instance of the EFI UDPv6 Protocol.
|
||||
@@ -159,16 +157,16 @@ Udp6Configure (
|
||||
Status = EFI_SUCCESS;
|
||||
ASSERT (Udp6Service != NULL);
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (UdpConfigData != NULL) {
|
||||
|
||||
IP6_COPY_ADDRESS (&StationAddress, &UdpConfigData->StationAddress);
|
||||
IP6_COPY_ADDRESS (&RemoteAddress, &UdpConfigData->RemoteAddress);
|
||||
|
||||
if ((!NetIp6IsUnspecifiedAddr (&StationAddress) && !NetIp6IsValidUnicast (&StationAddress)) ||
|
||||
(!NetIp6IsUnspecifiedAddr (&RemoteAddress) && !NetIp6IsValidUnicast (&RemoteAddress))
|
||||
){
|
||||
)
|
||||
{
|
||||
//
|
||||
// If not use default address, and StationAddress is not a valid unicast
|
||||
// if it is not IPv6 address or RemoteAddress is not a valid unicast IPv6
|
||||
@@ -286,7 +284,6 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used to enable and disable the multicast group filtering.
|
||||
|
||||
@@ -348,12 +345,13 @@ Udp6Groups (
|
||||
if (McastIp != NULL) {
|
||||
FreePool (McastIp);
|
||||
}
|
||||
|
||||
return EFI_NOT_STARTED;
|
||||
}
|
||||
|
||||
Ip = Instance->IpInfo->Ip.Ip6;
|
||||
Ip = Instance->IpInfo->Ip.Ip6;
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
//
|
||||
// Invoke the Ip instance the Udp6 instance consumes to do the group operation.
|
||||
@@ -371,10 +369,8 @@ Udp6Groups (
|
||||
// the multicast datagrams destinated to multicast IPs the other instances configured.
|
||||
//
|
||||
if (JoinFlag) {
|
||||
|
||||
Status = NetMapInsertTail (&Instance->McastIps, (VOID *) McastIp, NULL);
|
||||
Status = NetMapInsertTail (&Instance->McastIps, (VOID *)McastIp, NULL);
|
||||
} else {
|
||||
|
||||
Status = NetMapIterate (&Instance->McastIps, Udp6LeaveGroup, MulticastAddress);
|
||||
if ((MulticastAddress != NULL) && (Status == EFI_ABORTED)) {
|
||||
Status = EFI_SUCCESS;
|
||||
@@ -394,8 +390,6 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This function places a sending request to this instance of the EFI UDPv6 Protocol,
|
||||
alongside the transmit data that was filled by the user.
|
||||
@@ -490,7 +484,8 @@ Udp6Transmit (
|
||||
|
||||
if (EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp6TokenExist, Token)) ||
|
||||
EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp6TokenExist, Token))
|
||||
){
|
||||
)
|
||||
{
|
||||
//
|
||||
// Try to find a duplicate token in the two token maps, if found, return
|
||||
// EFI_ACCESS_DENIED.
|
||||
@@ -505,7 +500,7 @@ Udp6Transmit (
|
||||
// Create a net buffer to hold the user buffer and the udp header.
|
||||
//
|
||||
Packet = NetbufFromExt (
|
||||
(NET_FRAGMENT *) TxData->FragmentTable,
|
||||
(NET_FRAGMENT *)TxData->FragmentTable,
|
||||
TxData->FragmentCount,
|
||||
UDP6_HEADER_SIZE,
|
||||
0,
|
||||
@@ -520,10 +515,10 @@ Udp6Transmit (
|
||||
//
|
||||
// Store the IpIo in ProtoData.
|
||||
//
|
||||
Udp6Service = Instance->Udp6Service;
|
||||
*((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp6Service->IpIo);
|
||||
Udp6Service = Instance->Udp6Service;
|
||||
*((UINTN *)&Packet->ProtoData[0]) = (UINTN)(Udp6Service->IpIo);
|
||||
|
||||
Udp6Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP6_HEADER_SIZE, TRUE);
|
||||
Udp6Header = (EFI_UDP_HEADER *)NetbufAllocSpace (Packet, UDP6_HEADER_SIZE, TRUE);
|
||||
ASSERT (Udp6Header != NULL);
|
||||
if (Udp6Header == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -535,10 +530,10 @@ Udp6Transmit (
|
||||
//
|
||||
// Fill the udp header.
|
||||
//
|
||||
Udp6Header->SrcPort = HTONS (ConfigData->StationPort);
|
||||
Udp6Header->DstPort = HTONS (ConfigData->RemotePort);
|
||||
Udp6Header->Length = HTONS ((UINT16) Packet->TotalSize);
|
||||
Udp6Header->Checksum = 0;
|
||||
Udp6Header->SrcPort = HTONS (ConfigData->StationPort);
|
||||
Udp6Header->DstPort = HTONS (ConfigData->RemotePort);
|
||||
Udp6Header->Length = HTONS ((UINT16)Packet->TotalSize);
|
||||
Udp6Header->Checksum = 0;
|
||||
//
|
||||
// Set the UDP Header in NET_BUF, this UDP header is for IP6 can fast get the
|
||||
// Udp header for pseudoHeadCheckSum.
|
||||
@@ -564,7 +559,7 @@ Udp6Transmit (
|
||||
}
|
||||
|
||||
//
|
||||
//Calculate the pseudo head checksum using the overridden parameters.
|
||||
// Calculate the pseudo head checksum using the overridden parameters.
|
||||
//
|
||||
if (!NetIp6IsUnspecifiedAddr (&ConfigData->StationAddress)) {
|
||||
HeadSum = NetIp6PseudoHeadChecksum (
|
||||
@@ -590,7 +585,6 @@ Udp6Transmit (
|
||||
// and the Ipv6 will fill the correct value of this checksum.
|
||||
//
|
||||
Udp6Header->Checksum = 0;
|
||||
|
||||
}
|
||||
} else {
|
||||
//
|
||||
@@ -611,8 +605,6 @@ Udp6Transmit (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Fill the IpIo Override data.
|
||||
//
|
||||
@@ -631,7 +623,7 @@ Udp6Transmit (
|
||||
//
|
||||
// Send out this datagram through IpIo.
|
||||
//
|
||||
if (UdpSessionData != NULL){
|
||||
if (UdpSessionData != NULL) {
|
||||
IP6_COPY_ADDRESS (&(IpDestAddr.v6), &Destination);
|
||||
} else {
|
||||
ZeroMem (&IpDestAddr.v6, sizeof (EFI_IPv6_ADDRESS));
|
||||
@@ -664,7 +656,6 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function places a completion token into the receive packet queue. This function
|
||||
is always asynchronous.
|
||||
@@ -717,7 +708,8 @@ Udp6Receive (
|
||||
|
||||
if (EFI_ERROR (NetMapIterate (&Instance->RxTokens, Udp6TokenExist, Token)) ||
|
||||
EFI_ERROR (NetMapIterate (&Instance->TxTokens, Udp6TokenExist, Token))
|
||||
){
|
||||
)
|
||||
{
|
||||
//
|
||||
// Return EFI_ACCESS_DENIED if the specified token is already in the TxTokens or
|
||||
// RxTokens map.
|
||||
@@ -759,7 +751,6 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is used to abort a pending transmit or receive request.
|
||||
|
||||
@@ -821,7 +812,6 @@ Udp6Cancel (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function can be used by network drivers and applications to increase the rate that
|
||||
data packets are moved between the communications device and the transmit/receive queues.
|
||||
|
Reference in New Issue
Block a user