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
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user