@retval EFI_SUCCESS The udp4 service context data is created and\r
initialized.\r
@retval EFI_OUT_OF_RESOURCES Cannot allocate memory.\r
+ @retval other Other error occurs.\r
\r
**/\r
EFI_STATUS\r
Udp4CreateService (\r
- IN UDP4_SERVICE_DATA *Udp4Service,\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_HANDLE ControllerHandle\r
+ IN OUT UDP4_SERVICE_DATA *Udp4Service,\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_HANDLE ControllerHandle\r
)\r
{\r
EFI_STATUS Status;\r
service context.\r
\r
@param Event The event this function registered to.\r
- @param Conext The context data registered during the creation of\r
+ @param Context The context data registered during the creation of\r
the Event.\r
\r
@return None.\r
**/\r
VOID\r
Udp4InitInstance (\r
- IN UDP4_SERVICE_DATA *Udp4Service,\r
- IN UDP4_INSTANCE_DATA *Instance\r
+ IN UDP4_SERVICE_DATA *Udp4Service,\r
+ IN OUT UDP4_INSTANCE_DATA *Instance\r
)\r
{\r
//\r
@param Address Pointer to the specified IPv4 address.\r
@param Port The udp port number.\r
\r
- @return Is the specified <Address, Port> pair found or not.\r
+ @retval TRUE The specified <Address, Port> pair is found.\r
+ @retval FALSE Otherwise.\r
\r
**/\r
BOOLEAN\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 InstanceList Pointer to the head of the list linking the udp\r
instances.\r
@param ConfigData Pointer to the ConfigData of the instance to be\r
- bound.\r
+ bound. ConfigData->StationPort will be assigned\r
+ with an available port value on success.\r
\r
@retval EFI_SUCCESS The bound operation is completed successfully.\r
@retval EFI_ACCESS_DENIED The <Address, Port> specified by the ConfigData is\r
**/\r
EFI_STATUS\r
Udp4Bind (\r
- IN LIST_ENTRY *InstanceList,\r
- IN EFI_UDP4_CONFIG_DATA *ConfigData\r
+ IN LIST_ENTRY *InstanceList,\r
+ IN OUT EFI_UDP4_CONFIG_DATA *ConfigData\r
)\r
{\r
EFI_IPv4_ADDRESS *StationAddress;\r
uses.\r
@param NewConfigData Pointer to the new ConfigData.\r
\r
- @return The instance is reconfigurable or not according to the NewConfigData.\r
+ @retval TRUE The instance is reconfigurable.\r
+ @retval FALSE Otherwise.\r
\r
**/\r
BOOLEAN\r
IN EFI_UDP4_CONFIG_DATA *NewConfigData\r
)\r
{\r
- if ((NewConfigData->AcceptAnyPort != OldConfigData->AcceptAnyPort) ||\r
- (NewConfigData->AcceptBroadcast != OldConfigData->AcceptBroadcast) ||\r
- (NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||\r
- (NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)) {\r
+ if ((NewConfigData->AcceptAnyPort != OldConfigData->AcceptAnyPort) ||\r
+ (NewConfigData->AcceptBroadcast != OldConfigData->AcceptBroadcast) ||\r
+ (NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||\r
+ (NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)\r
+ ) {\r
//\r
// The receiving filter parameters cannot be changed.\r
//\r
}\r
\r
if ((!NewConfigData->AcceptAnyPort) &&\r
- (NewConfigData->StationPort != OldConfigData->StationPort)) {\r
+ (NewConfigData->StationPort != OldConfigData->StationPort)\r
+ ) {\r
//\r
// The port is not changeable.\r
//\r
}\r
\r
if (!NewConfigData->UseDefaultAddress &&\r
- (!EFI_IP4_EQUAL (&NewConfigData->StationAddress, &OldConfigData->StationAddress) ||\r
- !EFI_IP4_EQUAL (&NewConfigData->SubnetMask, &OldConfigData->SubnetMask))) {\r
+ (!EFI_IP4_EQUAL (&NewConfigData->StationAddress, &OldConfigData->StationAddress) ||\r
+ !EFI_IP4_EQUAL (&NewConfigData->SubnetMask, &OldConfigData->SubnetMask))\r
+ ) {\r
//\r
// If the instance doesn't use the default address, and the new address or\r
// new subnet mask is different from the old values.\r
return FALSE;\r
}\r
\r
- if (!EFI_IP4_EQUAL (&NewConfigData->RemoteAddress, &mZeroIp4Addr) && (NewConfigData->RemotePort != OldConfigData->RemotePort)) {\r
+ if (!EFI_IP4_EQUAL (&NewConfigData->RemoteAddress, &mZeroIp4Addr) &&\r
+ NewConfigData->RemotePort != OldConfigData->RemotePort\r
+ ) {\r
//\r
// The RemotePort differs if it's designated in the configdata.\r
//\r
**/\r
VOID\r
Udp4BuildIp4ConfigData (\r
- IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,\r
- IN EFI_IP4_CONFIG_DATA *Ip4ConfigData\r
+ IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,\r
+ IN OUT EFI_IP4_CONFIG_DATA *Ip4ConfigData\r
)\r
{\r
CopyMem (Ip4ConfigData, &mIpIoDefaultIpConfigData, sizeof (*Ip4ConfigData));\r
**/\r
EFI_STATUS\r
Udp4RemoveToken (\r
- IN NET_MAP *TokenMap,\r
- IN EFI_UDP4_COMPLETION_TOKEN *Token\r
+ IN OUT NET_MAP *TokenMap,\r
+ IN EFI_UDP4_COMPLETION_TOKEN *Token\r
)\r
{\r
NET_MAP_ITEM *Item;\r
**/\r
EFI_STATUS\r
Udp4LeaveGroup (\r
- IN NET_MAP *Map,\r
- IN NET_MAP_ITEM *Item,\r
- IN VOID *Arg OPTIONAL\r
+ IN OUT NET_MAP *Map,\r
+ IN NET_MAP_ITEM *Item,\r
+ IN VOID *Arg OPTIONAL\r
)\r
{\r
EFI_IPv4_ADDRESS *McastIp;\r
\r
\r
/**\r
- This function cancle the token specified by Arg in the Map.\r
+ This function cancels the token specified by Arg in the Map. This is a callback\r
+ used by Udp4InstanceCancelToken().\r
\r
@param Map Pointer to the NET_MAP.\r
@param Item Pointer to the NET_MAP_ITEM.\r
- @param Arg Pointer to the token to be cancelled, if NULL, all\r
- the tokens in this Map will be cancelled.\r
+ @param Arg Pointer to the token to be cancelled, if NULL,\r
+ the token specified by Item is cancelled.\r
\r
@retval EFI_SUCCESS The token is cancelled if Arg is NULL or the token\r
is not the same as that in the Item if Arg is not\r
/**\r
This function removes all the Wrap datas in the RcvdDgramQue.\r
\r
- @param RcvdDgramQue Pointer to the list containing all the Wrap datas.\r
+ @param Instance Pointer to the udp instance context data.\r
\r
@return None.\r
\r
\r
\r
/**\r
+ Cancel Udp4 tokens from the Udp4 instance.\r
\r
@param Instance Pointer to the udp instance context data.\r
@param Token Pointer to the token to be canceled, if NULL, all\r
EFI_STATUS Status;\r
\r
//\r
- // Cancle this token from the TxTokens map.\r
+ // Cancel this token from the TxTokens map.\r
//\r
Status = NetMapIterate (&Instance->TxTokens, Udp4CancelTokens, Token);\r
\r
@param Udp4Session Pointer to the EFI_UDP4_SESSION_DATA abstracted\r
from the received udp datagram.\r
\r
- @return The udp datagram matches the receiving requirments of the Instance or not.\r
+ @retval TRUE The udp datagram matches the receiving requirments of the\r
+ udp Instance.\r
+ @retval FALSE Otherwise.\r
\r
**/\r
BOOLEAN\r
}\r
\r
if ((!ConfigData->AcceptAnyPort && (Udp4Session->DestinationPort != ConfigData->StationPort)) ||\r
- ((ConfigData->RemotePort != 0) && (Udp4Session->SourcePort != ConfigData->RemotePort))) {\r
+ ((ConfigData->RemotePort != 0) && (Udp4Session->SourcePort != ConfigData->RemotePort))\r
+ ) {\r
//\r
// The local port or the remote port doesn't match.\r
//\r
}\r
\r
if (!EFI_IP4_EQUAL (&ConfigData->RemoteAddress, &mZeroIp4Addr) &&\r
- !EFI_IP4_EQUAL (&ConfigData->RemoteAddress, &Udp4Session->SourceAddress)) {\r
+ !EFI_IP4_EQUAL (&ConfigData->RemoteAddress, &Udp4Session->SourceAddress)\r
+ ) {\r
//\r
// This datagram doesn't come from the instance's specified sender.\r
//\r
}\r
\r
if (EFI_IP4_EQUAL (&ConfigData->StationAddress, &mZeroIp4Addr) ||\r
- EFI_IP4_EQUAL (&Udp4Session->DestinationAddress, &ConfigData->StationAddress)) {\r
+ EFI_IP4_EQUAL (&Udp4Session->DestinationAddress, &ConfigData->StationAddress)\r
+ ) {\r
//\r
- // The instance is configured to receive datagrams destinated to any station IP or\r
+ // The instance is configured to receive datagrams destined to any station IP or\r
// the destination address of this datagram matches the configured station IP.\r
//\r
return TRUE;\r
}\r
\r
if (IP4_IS_MULTICAST (NTOHL (Destination)) &&\r
- (NULL != NetMapFindKey (&Instance->McastIps, (VOID *) (UINTN) Destination))) {\r
+ NetMapFindKey (&Instance->McastIps, (VOID *) (UINTN) Destination) != NULL\r
+ ) {\r
//\r
// It's a multicast packet and the multicast address is accepted by this instance.\r
//\r
EFI_TPL OldTpl;\r
\r
if (!IsListEmpty (&Instance->RcvdDgramQue) &&\r
- !NetMapIsEmpty (&Instance->RxTokens)) {\r
+ !NetMapIsEmpty (&Instance->RxTokens)) {\r
\r
Wrap = NET_LIST_HEAD (&Instance->RcvdDgramQue, UDP4_RXDATA_WRAP, Link);\r
\r
NetbufFree (Wrap->Packet);\r
\r
Wrap->Packet = Dup;\r
- } \r
+ }\r
\r
NetListRemoveHead (&Instance->RcvdDgramQue);\r
\r
Instance = NET_LIST_USER_STRUCT (Entry, UDP4_INSTANCE_DATA, Link);\r
\r
if (!Instance->Configured ||\r
- Instance->ConfigData.AcceptPromiscuous ||\r
- Instance->ConfigData.AcceptAnyPort ||\r
- EFI_IP4_EQUAL (&Instance->ConfigData.StationAddress, &mZeroIp4Addr)) {\r
+ Instance->ConfigData.AcceptPromiscuous ||\r
+ Instance->ConfigData.AcceptAnyPort ||\r
+ EFI_IP4_EQUAL (&Instance->ConfigData.StationAddress, &mZeroIp4Addr)\r
+ ) {\r
//\r
// Don't try to deliver the ICMP error to this instance if it is not configured,\r
// or it's configured to be promiscuous or accept any port or accept all the\r
\r
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the\r
variable.\r
+ @retval EFI_SUCCESS Set variable successfully.\r
@retval other Set variable failed.\r
\r
**/\r