\r
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
VOID\r
EFIAPI\r
Udp6DgramSent (\r
- IN EFI_STATUS Status,\r
- IN VOID *Context,\r
- IN IP_IO_IP_PROTOCOL Sender,\r
- IN VOID *NotifyData\r
+ IN EFI_STATUS Status,\r
+ IN VOID *Context,\r
+ IN IP_IO_IP_PROTOCOL Sender,\r
+ IN VOID *NotifyData\r
);\r
\r
/**\r
);\r
\r
/**\r
- This function cancle the token specified by Arg in the Map.\r
+ This function cancel the token specified by Arg in the Map.\r
\r
@param[in] Map Pointer to the NET_MAP.\r
@param[in] Item Pointer to the NET_MAP_ITEM.\r
**/\r
NET_MAP_ITEM *\r
Udp6MapMultiCastAddr (\r
- IN NET_MAP *Map,\r
- IN VOID *Key\r
+ IN NET_MAP *Map,\r
+ IN VOID *Key\r
);\r
\r
/**\r
&mIp6IoDefaultIpConfigData,\r
sizeof (EFI_IP6_CONFIG_DATA)\r
);\r
- OpenData.RcvdContext = (VOID *) Udp6Service;\r
- OpenData.SndContext = NULL;\r
- OpenData.PktRcvdNotify = Udp6DgramRcvd;\r
- OpenData.PktSentNotify = Udp6DgramSent;\r
+ OpenData.RcvdContext = (VOID *)Udp6Service;\r
+ OpenData.SndContext = NULL;\r
+ OpenData.PktRcvdNotify = Udp6DgramRcvd;\r
+ OpenData.PktSentNotify = Udp6DgramSent;\r
\r
//\r
// Configure and start the IpIo.\r
return Status;\r
}\r
\r
-\r
/**\r
Clean the Udp service context data.\r
\r
ZeroMem (Udp6Service, sizeof (UDP6_SERVICE_DATA));\r
}\r
\r
-\r
/**\r
This function checks and times out the I/O datagrams listed in the\r
UDP6_SERVICE_DATA which is specified by the input parameter Context.\r
LIST_ENTRY *NextEntry;\r
UDP6_RXDATA_WRAP *Wrap;\r
\r
- Udp6Service = (UDP6_SERVICE_DATA *) Context;\r
+ Udp6Service = (UDP6_SERVICE_DATA *)Context;\r
NET_CHECK_SIGNATURE (Udp6Service, UDP6_SERVICE_DATA_SIGNATURE);\r
\r
NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {\r
//\r
// Remove this RxData if it timeouts.\r
//\r
- Udp6RecycleRxDataWrap (NULL, (VOID *) Wrap);\r
+ Udp6RecycleRxDataWrap (NULL, (VOID *)Wrap);\r
} else {\r
Wrap->TimeoutTick -= UDP6_TIMEOUT_INTERVAL / 10;\r
}\r
}\r
}\r
\r
-\r
/**\r
- This function intializes the new created udp instance.\r
+ This function initializes the new created udp instance.\r
\r
@param[in] Udp6Service Pointer to the UDP6_SERVICE_DATA.\r
@param[in, out] Instance Pointer to the un-initialized UDP6_INSTANCE_DATA.\r
Instance->InDestroy = FALSE;\r
}\r
\r
-\r
/**\r
This function cleans the udp instance.\r
\r
NetMapClean (&Instance->TxTokens);\r
}\r
\r
-\r
/**\r
This function finds the udp instance by the specified <Address, Port> pair.\r
\r
\r
if (EFI_IP6_EQUAL (&ConfigData->StationAddress, Address) &&\r
(ConfigData->StationPort == Port)\r
- ) {\r
+ )\r
+ {\r
//\r
// If both the address and the port are the same, return TRUE.\r
//\r
return FALSE;\r
}\r
\r
-\r
/**\r
This function tries to bind the udp instance according to the configured port\r
- allocation stragety.\r
+ allocation strategy.\r
\r
@param[in] InstanceList Pointer to the head of the list linking the udp\r
instances.\r
StationAddress = &ConfigData->StationAddress;\r
\r
if (ConfigData->StationPort != 0) {\r
-\r
if (!ConfigData->AllowDuplicatePort &&\r
Udp6FindInstanceByPort (InstanceList, StationAddress, ConfigData->StationPort)\r
- ) {\r
+ )\r
+ {\r
//\r
// Do not allow duplicate ports and the port is already used by other instance.\r
//\r
//\r
ConfigData->StationPort = mUdp6RandomPort;\r
} else {\r
-\r
StartPort = mUdp6RandomPort;\r
\r
while (Udp6FindInstanceByPort (InstanceList, StationAddress, mUdp6RandomPort)) {\r
-\r
mUdp6RandomPort++;\r
if (mUdp6RandomPort == 0) {\r
mUdp6RandomPort = UDP6_PORT_KNOWN;\r
mUdp6RandomPort = UDP6_PORT_KNOWN;\r
}\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This function is used to check whether the NewConfigData has any un-reconfigurable\r
parameters changed compared to the OldConfigData.\r
if ((NewConfigData->AcceptAnyPort != OldConfigData->AcceptAnyPort) ||\r
(NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||\r
(NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)\r
- ) {\r
+ )\r
+ {\r
//\r
// The receiving filter parameters cannot be changed.\r
//\r
\r
if ((!NewConfigData->AcceptAnyPort) &&\r
(NewConfigData->StationPort != OldConfigData->StationPort)\r
- ) {\r
+ )\r
+ {\r
//\r
// The port is not changeable.\r
//\r
return FALSE;\r
}\r
\r
-\r
if (!EFI_IP6_EQUAL (&NewConfigData->RemoteAddress, &OldConfigData->RemoteAddress)) {\r
//\r
// The remoteaddress is not the same.\r
\r
if (!NetIp6IsUnspecifiedAddr (&NewConfigData->RemoteAddress) &&\r
(NewConfigData->RemotePort != OldConfigData->RemotePort)\r
- ) {\r
+ )\r
+ {\r
//\r
// The RemotePort differs if it's designated in the configdata.\r
//\r
return TRUE;\r
}\r
\r
-\r
/**\r
This function builds the Ip6 configdata from the Udp6ConfigData.\r
\r
**/\r
VOID\r
Udp6BuildIp6ConfigData (\r
- IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,\r
- IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData\r
+ IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,\r
+ IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData\r
)\r
{\r
CopyMem (\r
&mIp6IoDefaultIpConfigData,\r
sizeof (EFI_IP6_CONFIG_DATA)\r
);\r
- Ip6ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;\r
- Ip6ConfigData->AcceptPromiscuous = Udp6ConfigData->AcceptPromiscuous;\r
+ Ip6ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;\r
+ Ip6ConfigData->AcceptPromiscuous = Udp6ConfigData->AcceptPromiscuous;\r
IP6_COPY_ADDRESS (&Ip6ConfigData->StationAddress, &Udp6ConfigData->StationAddress);\r
IP6_COPY_ADDRESS (&Ip6ConfigData->DestinationAddress, &Udp6ConfigData->RemoteAddress);\r
//\r
// Use the -1 magic number to disable the receiving process of the ip instance.\r
//\r
- Ip6ConfigData->ReceiveTimeout = (UINT32) (-1);\r
+ Ip6ConfigData->ReceiveTimeout = (UINT32)(-1);\r
}\r
\r
-\r
/**\r
This function validates the TxToken. It returns the error code according to the spec.\r
\r
EFI_UDP6_CONFIG_DATA *ConfigData;\r
EFI_UDP6_SESSION_DATA *UdpSessionData;\r
\r
-\r
if (TxToken->Event == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
TotalLen = 0;\r
for (Index = 0; Index < TxData->FragmentCount; Index++) {\r
-\r
if ((TxData->FragmentTable[Index].FragmentBuffer == NULL) ||\r
(TxData->FragmentTable[Index].FragmentLength == 0)\r
- ) {\r
+ )\r
+ {\r
//\r
// If the FragmentBuffer is NULL, or the FragmentLeng is zero.\r
//\r
UdpSessionData = TxData->UdpSessionData;\r
\r
if (UdpSessionData != NULL) {\r
-\r
if ((UdpSessionData->DestinationPort == 0) && (ConfigData->RemotePort == 0)) {\r
//\r
- // Ambiguous; no avalaible DestinationPort for this token.\r
+ // Ambiguous; no available DestinationPort for this token.\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
if (NetIp6IsUnspecifiedAddr (&UdpSessionData->DestinationAddress) &&\r
NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress)\r
- ) {\r
+ )\r
+ {\r
//\r
- // The DestinationAddress is not specificed.\r
+ // The DestinationAddress is not specified.\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
if (!NetIp6IsUnspecifiedAddr (&UdpSessionData->DestinationAddress) &&\r
!NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress)\r
- ) {\r
+ )\r
+ {\r
//\r
// The ConfigData.RemoteAddress is not zero and the UdpSessionData.DestinationAddress\r
// is not zero too.\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This function checks whether the specified Token duplicates the one in the Map.\r
\r
EFI_UDP6_COMPLETION_TOKEN *Token;\r
EFI_UDP6_COMPLETION_TOKEN *TokenInItem;\r
\r
- Token = (EFI_UDP6_COMPLETION_TOKEN *) Context;\r
- TokenInItem = (EFI_UDP6_COMPLETION_TOKEN *) Item->Key;\r
+ Token = (EFI_UDP6_COMPLETION_TOKEN *)Context;\r
+ TokenInItem = (EFI_UDP6_COMPLETION_TOKEN *)Item->Key;\r
\r
if ((Token == TokenInItem) || (Token->Event == TokenInItem->Event)) {\r
//\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This function calculates the checksum for the Packet, utilizing the pre-calculated\r
pseudo HeadSum to reduce some overhead.\r
\r
@param[in] Packet Pointer to the NET_BUF contains the udp datagram.\r
- @param[in] HeadSum Checksum of the pseudo header, execpt the length\r
+ @param[in] HeadSum Checksum of the pseudo header, except the length\r
field.\r
\r
@return The 16-bit checksum of this udp datagram.\r
**/\r
UINT16\r
Udp6Checksum (\r
- IN NET_BUF *Packet,\r
- IN UINT16 HeadSum\r
+ IN NET_BUF *Packet,\r
+ IN UINT16 HeadSum\r
)\r
{\r
UINT16 Checksum;\r
\r
- Checksum = NetbufChecksum (Packet);\r
- Checksum = NetAddChecksum (Checksum, HeadSum);\r
+ Checksum = NetbufChecksum (Packet);\r
+ Checksum = NetAddChecksum (Checksum, HeadSum);\r
\r
- Checksum = NetAddChecksum (Checksum, HTONS ((UINT16) Packet->TotalSize));\r
- Checksum = (UINT16) (~Checksum);\r
+ Checksum = NetAddChecksum (Checksum, HTONS ((UINT16)Packet->TotalSize));\r
+ Checksum = (UINT16)(~Checksum);\r
return Checksum;\r
}\r
\r
-\r
/**\r
This function removes the specified Token from the TokenMap.\r
\r
//\r
// Find the Token first.\r
//\r
- Item = NetMapFindKey (TokenMap, (VOID *) Token);\r
+ Item = NetMapFindKey (TokenMap, (VOID *)Token);\r
\r
if (Item != NULL) {\r
//\r
\r
return EFI_SUCCESS;\r
}\r
+\r
return EFI_NOT_FOUND;\r
}\r
\r
-\r
/**\r
This function is the packet transmitting notify function registered to the IpIo\r
interface. It's called to signal the udp TxToken when IpIo layer completes the\r
VOID\r
EFIAPI\r
Udp6DgramSent (\r
- IN EFI_STATUS Status,\r
- IN VOID *Context,\r
- IN IP_IO_IP_PROTOCOL Sender,\r
- IN VOID *NotifyData\r
+ IN EFI_STATUS Status,\r
+ IN VOID *Context,\r
+ IN IP_IO_IP_PROTOCOL Sender,\r
+ IN VOID *NotifyData\r
)\r
{\r
UDP6_INSTANCE_DATA *Instance;\r
\r
ASSERT (Context != NULL && NotifyData != NULL);\r
\r
- Instance = (UDP6_INSTANCE_DATA *) Context;\r
- Token = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;\r
+ Instance = (UDP6_INSTANCE_DATA *)Context;\r
+ Token = (EFI_UDP6_COMPLETION_TOKEN *)NotifyData;\r
\r
if (Udp6RemoveToken (&Instance->TxTokens, Token) == EFI_SUCCESS) {\r
//\r
}\r
}\r
\r
-\r
/**\r
This function processes the received datagram passed up by the IpIo layer.\r
\r
// IpIo only passes received packets with Status EFI_SUCCESS or EFI_ICMP_ERROR.\r
//\r
if (Status == EFI_SUCCESS) {\r
-\r
//\r
// Demultiplex the received datagram.\r
//\r
- Udp6Demultiplex ((UDP6_SERVICE_DATA *) Context, NetSession, Packet);\r
+ Udp6Demultiplex ((UDP6_SERVICE_DATA *)Context, NetSession, Packet);\r
} else {\r
//\r
// Handle the ICMP6 Error packet.\r
//\r
- Udp6IcmpHandler ((UDP6_SERVICE_DATA *) Context, IcmpError, NetSession, Packet);\r
+ Udp6IcmpHandler ((UDP6_SERVICE_DATA *)Context, IcmpError, NetSession, Packet);\r
}\r
\r
//\r
DispatchDpc ();\r
}\r
\r
-\r
/**\r
This function removes the multicast group specified by Arg from the Map.\r
\r
\r
if ((McastIp != NULL) &&\r
!EFI_IP6_EQUAL (McastIp, ((EFI_IPv6_ADDRESS *)Item->Key))\r
- ) {\r
+ )\r
+ {\r
//\r
// McastIp is not NULL and the multicast address contained in the Item\r
// is not the same as McastIp.\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
- This function cancle the token specified by Arg in the Map.\r
+ This function cancel the token specified by Arg in the Map.\r
\r
@param[in] Map Pointer to the NET_MAP.\r
@param[in] Item Pointer to the NET_MAP_ITEM.\r
// will invoke Udp6DgramSent, the token will be signaled and this Item will\r
// be removed from the Map there.\r
//\r
- Packet = (NET_BUF *) (Item->Value);\r
- IpIo = (IP_IO *) (*((UINTN *) &Packet->ProtoData[0]));\r
+ Packet = (NET_BUF *)(Item->Value);\r
+ IpIo = (IP_IO *)(*((UINTN *)&Packet->ProtoData[0]));\r
\r
IpIoCancelTxToken (IpIo, Packet);\r
} else {\r
//\r
// The token is a receive token. Abort it and remove it from the Map.\r
//\r
- TokenToCancel = (EFI_UDP6_COMPLETION_TOKEN *) Item->Key;\r
+ TokenToCancel = (EFI_UDP6_COMPLETION_TOKEN *)Item->Key;\r
NetMapRemoveItem (Map, Item, NULL);\r
\r
TokenToCancel->Status = EFI_ABORTED;\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This function removes all the Wrap datas in the RcvdDgramQue.\r
\r
//\r
// The Wrap will be removed from the RcvdDgramQue by this function call.\r
//\r
- Udp6RecycleRxDataWrap (NULL, (VOID *) Wrap);\r
+ Udp6RecycleRxDataWrap (NULL, (VOID *)Wrap);\r
}\r
}\r
\r
-\r
-\r
/**\r
Cancel Udp6 tokens from the Udp6 instance.\r
\r
return EFI_NOT_FOUND;\r
}\r
\r
- ASSERT ((Token != NULL) ||\r
- ((0 == NetMapGetCount (&Instance->TxTokens)) &&\r
- (0 == NetMapGetCount (&Instance->RxTokens)))\r
- );\r
+ ASSERT (\r
+ (Token != NULL) ||\r
+ ((0 == NetMapGetCount (&Instance->TxTokens)) &&\r
+ (0 == NetMapGetCount (&Instance->RxTokens)))\r
+ );\r
\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This function checks if the received udp datagram matches with the Instance.\r
\r
from the received udp datagram.\r
\r
@retval TRUE The udp datagram matches the receiving requirements of the Instance.\r
- @retval FALSE The udp datagram does not matche the receiving requirements of the Instance.\r
+ @retval FALSE The udp datagram does not match the receiving requirements of the Instance.\r
\r
**/\r
BOOLEAN\r
\r
if ((!ConfigData->AcceptAnyPort && (Udp6Session->DestinationPort != ConfigData->StationPort)) ||\r
((ConfigData->RemotePort != 0) && (Udp6Session->SourcePort != ConfigData->RemotePort))\r
- ) {\r
+ )\r
+ {\r
//\r
// The local port or the remote port doesn't match.\r
//\r
\r
if (!NetIp6IsUnspecifiedAddr (&ConfigData->RemoteAddress) &&\r
!EFI_IP6_EQUAL (&ConfigData->RemoteAddress, &Udp6Session->SourceAddress)\r
- ) {\r
+ )\r
+ {\r
//\r
// This datagram doesn't come from the instance's specified sender.\r
//\r
\r
if (NetIp6IsUnspecifiedAddr (&ConfigData->StationAddress) ||\r
EFI_IP6_EQUAL (&Udp6Session->DestinationAddress, &ConfigData->StationAddress)\r
- ) {\r
+ )\r
+ {\r
//\r
// The instance is configured to receive datagrams destinated to any station IP or\r
// the destination address of this datagram matches the configured station IP.\r
\r
if (IP6_IS_MULTICAST (&Destination) &&\r
(NULL != Udp6MapMultiCastAddr (&Instance->McastIps, &Destination))\r
- ) {\r
+ )\r
+ {\r
//\r
// It's a multicast packet and the multicast address is accepted by this instance.\r
//\r
return FALSE;\r
}\r
\r
-\r
/**\r
This function removes the Wrap specified by Context and release relevant resources.\r
\r
{\r
UDP6_RXDATA_WRAP *Wrap;\r
\r
- Wrap = (UDP6_RXDATA_WRAP *) Context;\r
+ Wrap = (UDP6_RXDATA_WRAP *)Context;\r
\r
//\r
// Remove the Wrap from the list it belongs to.\r
FreePool (Wrap);\r
}\r
\r
-\r
/**\r
This function wraps the Packet into RxData.\r
\r
IN EFI_UDP6_RECEIVE_DATA *RxData\r
)\r
{\r
- EFI_STATUS Status;\r
- UDP6_RXDATA_WRAP *Wrap;\r
+ EFI_STATUS Status;\r
+ UDP6_RXDATA_WRAP *Wrap;\r
\r
//\r
// Allocate buffer for the Wrap.\r
//\r
- Wrap = AllocateZeroPool (sizeof (UDP6_RXDATA_WRAP) +\r
- (Packet->BlockOpNum - 1) * sizeof (EFI_UDP6_FRAGMENT_DATA));\r
+ Wrap = AllocateZeroPool (\r
+ sizeof (UDP6_RXDATA_WRAP) +\r
+ (Packet->BlockOpNum - 1) * sizeof (EFI_UDP6_FRAGMENT_DATA)\r
+ );\r
if (Wrap == NULL) {\r
return NULL;\r
}\r
\r
InitializeListHead (&Wrap->Link);\r
\r
- CopyMem (&Wrap->RxData, RxData, sizeof(EFI_UDP6_RECEIVE_DATA));\r
+ CopyMem (&Wrap->RxData, RxData, sizeof (EFI_UDP6_RECEIVE_DATA));\r
//\r
// Create the Recycle event.\r
//\r
return Wrap;\r
}\r
\r
-\r
/**\r
This function enqueues the received datagram into the instances' receiving queues.\r
\r
return Enqueued;\r
}\r
\r
-\r
/**\r
This function delivers the received datagrams to the specified instance.\r
\r
\r
if (!IsListEmpty (&Instance->RcvdDgramQue) &&\r
!NetMapIsEmpty (&Instance->RxTokens)\r
- ) {\r
-\r
+ )\r
+ {\r
Wrap = NET_LIST_HEAD (&Instance->RcvdDgramQue, UDP6_RXDATA_WRAP, Link);\r
\r
if (NET_BUF_SHARED (Wrap->Packet)) {\r
\r
NetListRemoveHead (&Instance->RcvdDgramQue);\r
\r
- Token = (EFI_UDP6_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);\r
+ Token = (EFI_UDP6_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);\r
\r
//\r
// Build the FragmentTable and set the FragmentCount in RxData.\r
\r
NetbufBuildExt (\r
Wrap->Packet,\r
- (NET_FRAGMENT *) RxData->FragmentTable,\r
+ (NET_FRAGMENT *)RxData->FragmentTable,\r
&RxData->FragmentCount\r
);\r
\r
}\r
}\r
\r
-\r
/**\r
This function delivers the datagrams enqueued in the instances.\r
\r
}\r
}\r
\r
-\r
/**\r
This function demultiplexes the received udp datagram to the appropriate instances.\r
\r
IN NET_BUF *Packet\r
)\r
{\r
- EFI_UDP_HEADER *Udp6Header;\r
+ EFI_UDP_HEADER *Udp6Header;\r
UINT16 HeadSum;\r
EFI_UDP6_RECEIVE_DATA RxData;\r
EFI_UDP6_SESSION_DATA *Udp6Session;\r
//\r
// Get the datagram header from the packet buffer.\r
//\r
- Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);\r
+ Udp6Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);\r
ASSERT (Udp6Header != NULL);\r
if (Udp6Header == NULL) {\r
NetbufFree (Packet);\r
//\r
NetbufTrim (Packet, UDP6_HEADER_SIZE, TRUE);\r
\r
- RxData.DataLength = (UINT32) Packet->TotalSize;\r
+ RxData.DataLength = (UINT32)Packet->TotalSize;\r
\r
//\r
// Try to enqueue this datagram into the instances.\r
}\r
}\r
\r
-\r
/**\r
This function builds and sends out a icmp port unreachable message.\r
\r
//\r
if (NetSession->IpVersion == IP_VERSION_6) {\r
if (NetIp6IsUnspecifiedAddr (&NetSession->Dest.v6) ||\r
- IP6_IS_MULTICAST (&NetSession->Dest.v6)\r
- ) {\r
+ IP6_IS_MULTICAST (&NetSession->Dest.v6)\r
+ )\r
+ {\r
goto EXIT;\r
}\r
}\r
\r
-\r
- IpSender = IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);\r
+ IpSender = IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);\r
\r
//\r
// Get the Ipv6 Mode Data.\r
if (EFI_ERROR (Status)) {\r
goto EXIT;\r
}\r
+\r
//\r
// The ICMP6 packet length, includes whole invoking packet and ICMP6 error header.\r
//\r
Len = NetSession->IpHdrLen +\r
- NTOHS(((EFI_UDP_HEADER *) Udp6Header)->Length) +\r
+ NTOHS (((EFI_UDP_HEADER *)Udp6Header)->Length) +\r
sizeof (IP6_ICMP_ERROR_HEAD);\r
\r
//\r
//\r
// Allocate space for the IP6_ICMP_ERROR_HEAD.\r
//\r
- IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *) NetbufAllocSpace (Packet, Len, FALSE);\r
+ IcmpErrHdr = (IP6_ICMP_ERROR_HEAD *)NetbufAllocSpace (Packet, Len, FALSE);\r
ASSERT (IcmpErrHdr != NULL);\r
if (IcmpErrHdr == NULL) {\r
goto EXIT;\r
// the length of EFI_IP6_HEADER, so when using the length of IP6_ICMP_ERROR_HEAD\r
// for pointer movement that fact should be considered.\r
//\r
- Ptr = (VOID *) &IcmpErrHdr->Head;\r
- Ptr = (UINT8 *) (UINTN) ((UINTN) Ptr + sizeof (IP6_ICMP_ERROR_HEAD) - sizeof (EFI_IP6_HEADER));\r
+ Ptr = (VOID *)&IcmpErrHdr->Head;\r
+ Ptr = (UINT8 *)(UINTN)((UINTN)Ptr + sizeof (IP6_ICMP_ERROR_HEAD) - sizeof (EFI_IP6_HEADER));\r
CopyMem (Ptr, NetSession->IpHdr.Ip6Hdr, NetSession->IpHdrLen);\r
CopyMem (\r
Ptr + NetSession->IpHdrLen,\r
);\r
\r
//\r
- // Set the checksum as zero, and IP6 driver will calcuate it with pseudo header.\r
+ // Set the checksum as zero, and IP6 driver will calculate it with pseudo header.\r
//\r
IcmpErrHdr->Head.Checksum = 0;\r
\r
//\r
// Fill the override data.\r
//\r
- Override.Ip6OverrideData.FlowLabel = 0;\r
- Override.Ip6OverrideData.HopLimit = 255;\r
- Override.Ip6OverrideData.Protocol = IP6_ICMP;\r
+ Override.Ip6OverrideData.FlowLabel = 0;\r
+ Override.Ip6OverrideData.HopLimit = 255;\r
+ Override.Ip6OverrideData.Protocol = IP6_ICMP;\r
\r
//\r
// Send out this icmp packet.\r
}\r
}\r
\r
-\r
/**\r
This function handles the received Icmp Error message and de-multiplexes it to the\r
instance.\r
return;\r
}\r
\r
- Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);\r
+ Udp6Header = (EFI_UDP_HEADER *)NetbufGetByte (Packet, 0, NULL);\r
ASSERT (Udp6Header != NULL);\r
if (Udp6Header == NULL) {\r
NetbufFree (Packet);\r
NetbufFree (Packet);\r
}\r
\r
-\r
/**\r
This function reports the received ICMP error.\r
\r
//\r
// Try to get a RxToken from the RxTokens map.\r
//\r
- Token = (EFI_UDP6_COMPLETION_TOKEN *) NetMapRemoveHead (&Instance->RxTokens, NULL);\r
+ Token = (EFI_UDP6_COMPLETION_TOKEN *)NetMapRemoveHead (&Instance->RxTokens, NULL);\r
\r
if (Token != NULL) {\r
//\r
}\r
}\r
\r
-\r
/**\r
This function is a dummy ext-free function for the NET_BUF created for the output\r
udp datagram.\r
**/\r
NET_MAP_ITEM *\r
Udp6MapMultiCastAddr (\r
- IN NET_MAP *Map,\r
- IN VOID *Key\r
+ IN NET_MAP *Map,\r
+ IN VOID *Key\r
)\r
{\r
LIST_ENTRY *Entry;\r
\r
ASSERT (Map != NULL);\r
NET_LIST_FOR_EACH (Entry, &Map->Used) {\r
- Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);\r
- Addr = (EFI_IPv6_ADDRESS *) Item->Key;\r
+ Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);\r
+ Addr = (EFI_IPv6_ADDRESS *)Item->Key;\r
if (EFI_IP6_EQUAL (Addr, Key)) {\r
return Item;\r
}\r
}\r
return NULL;\r
}\r
-\r