X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FIp4Dxe%2FIp4Igmp.c;h=029b365eac78c411b6989c11ab1b4e4d9ade4727;hp=135efa62ce99085b78dd2a690efb670684b584ff;hb=5405e9a66b5ecf9f8a7ba571ead43cbee45161ae;hpb=772db4bb33ae66fa20e39f786b5f80d107d450a5 diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.c index 135efa62ce..029b365eac 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.c @@ -36,14 +36,14 @@ UINT32 mRouteAlertOption = 0x00000494; @param IpSb The IP4 service whose IGMP is to be initialized. + @retval EFI_SUCCESS IGMP of the IpSb is successfully initialized. @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to initialize IGMP. @retval Others Failed to initialize the IGMP of IpSb. - @retval EFI_SUCCESS IGMP of the IpSb is successfully initialized. **/ EFI_STATUS Ip4InitIgmp ( - IN IP4_SERVICE *IpSb + IN OUT IP4_SERVICE *IpSb ) { IGMP_SERVICE_DATA *IgmpCtrl; @@ -56,7 +56,7 @@ Ip4InitIgmp ( // // Configure MNP to receive ALL_SYSTEM multicast // - Group = NetAllocatePool (sizeof (IGMP_GROUP)); + Group = AllocatePool (sizeof (IGMP_GROUP)); if (Group == NULL) { return EFI_OUT_OF_RESOURCES; @@ -81,11 +81,11 @@ Ip4InitIgmp ( goto ON_ERROR; } - NetListInsertHead (&IgmpCtrl->Groups, &Group->Link); + InsertHeadList (&IgmpCtrl->Groups, &Group->Link); return EFI_SUCCESS; ON_ERROR: - NetFreePool (Group); + gBS->FreePool (Group); return Status; } @@ -98,8 +98,8 @@ ON_ERROR: @param Address The multicast address to search @return NULL if the multicast address isn't in the IGMP control block. Otherwise - @return the point to the IGMP_GROUP which contains the status of multicast group - @return for Address. + the point to the IGMP_GROUP which contains the status of multicast group + for Address. **/ IGMP_GROUP * @@ -108,7 +108,7 @@ Ip4FindGroup ( IN IP4_ADDR Address ) { - NET_LIST_ENTRY *Entry; + LIST_ENTRY *Entry; IGMP_GROUP *Group; NET_LIST_FOR_EACH (Entry, &IgmpCtrl->Groups) { @@ -132,7 +132,7 @@ Ip4FindGroup ( @param Mac The MAC address to search @return The number of the IP4 multicast group that mapped to the same - @return multicast group Mac. + multicast group Mac. **/ INTN @@ -141,7 +141,7 @@ Ip4FindMac ( IN EFI_MAC_ADDRESS *Mac ) { - NET_LIST_ENTRY *Entry; + LIST_ENTRY *Entry; IGMP_GROUP *Group; INTN Count; @@ -165,7 +165,7 @@ Ip4FindMac ( @param IpSb The IP4 service instance that requests the transmission @param Dst The destinaton to send to - @param Type The IGMP message type, such as IGMP v2 membership + @param Type The IGMP message type, such as IGMP v1 membership report @param Group The group address in the IGMP message head. @@ -206,7 +206,7 @@ Ip4SendIgmpMessage ( Igmp->MaxRespTime = 0; Igmp->Checksum = 0; Igmp->Group = HTONL (Group); - Igmp->Checksum = ~NetblockChecksum ((UINT8 *) Igmp, sizeof (IGMP_HEAD)); + Igmp->Checksum = (UINT16) (~NetblockChecksum ((UINT8 *) Igmp, sizeof (IGMP_HEAD))); Head.Tos = 0; Head.Protocol = IP4_PROTO_IGMP; @@ -257,7 +257,7 @@ Ip4SendIgmpReport ( /** - Join the multicast group on behavior of this IP4 child + Join the multicast group on behalf of this IP4 child @param IpInstance The IP4 child that wants to join the group @param Address The group to join @@ -298,7 +298,7 @@ Ip4JoinGroup ( // Otherwise, create a new IGMP_GROUP, Get the multicast's MAC address, // send a report, then direct MNP to receive the multicast. // - Group = NetAllocatePool (sizeof (IGMP_GROUP)); + Group = AllocatePool (sizeof (IGMP_GROUP)); if (Group == NULL) { return EFI_OUT_OF_RESOURCES; @@ -327,17 +327,17 @@ Ip4JoinGroup ( goto ON_ERROR; } - NetListInsertHead (&IgmpCtrl->Groups, &Group->Link); + InsertHeadList (&IgmpCtrl->Groups, &Group->Link); return EFI_SUCCESS; ON_ERROR: - NetFreePool (Group); + gBS->FreePool (Group); return Status; } /** - Leave the IP4 multicast group on behavior of IpInstance. + Leave the IP4 multicast group on behalf of IpInstance. @param IpInstance The IP4 child that wants to leave the group address @@ -395,12 +395,12 @@ Ip4LeaveGroup ( // Send a leave report if the membership is reported by us // and we are talking IGMPv2. // - if (Group->ReportByUs && !IgmpCtrl->Igmpv1QuerySeen) { + if (Group->ReportByUs && IgmpCtrl->Igmpv1QuerySeen == 0) { Ip4SendIgmpMessage (IpSb, IP4_ALLROUTER_ADDRESS, IGMP_LEAVE_GROUP, Group->Address); } - NetListRemoveEntry (&Group->Link); - NetFreePool (Group); + RemoveEntryList (&Group->Link); + gBS->FreePool (Group); return EFI_SUCCESS; } @@ -428,7 +428,7 @@ Ip4IgmpHandle ( IGMP_HEAD Igmp; IGMP_GROUP *Group; IP4_ADDR Address; - NET_LIST_ENTRY *Entry; + LIST_ENTRY *Entry; IgmpCtrl = &IpSb->IgmpCtrl; @@ -450,7 +450,7 @@ Ip4IgmpHandle ( switch (Igmp.Type) { case IGMP_MEMBERSHIP_QUERY: // - // If MaxRespTIme is zero, it is most likely that we are + // If MaxRespTime is zero, it is most likely that we are // talking to a V1 router // if (Igmp.MaxRespTime == 0) { @@ -482,7 +482,7 @@ Ip4IgmpHandle ( // is longer than the MaxRespTime. TODO: randomize the DelayTime. // if ((Group->DelayTime == 0) || (Group->DelayTime > Igmp.MaxRespTime)) { - Group->DelayTime = NET_MAX (1, Igmp.MaxRespTime); + Group->DelayTime = MAX (1, Igmp.MaxRespTime); } } } @@ -511,9 +511,9 @@ Ip4IgmpHandle ( The periodical timer function for IGMP. It does the following things: 1. Decrease the Igmpv1QuerySeen to make it possible to refresh - the IGMP server type. + the IGMP server type. 2. Decrease the report timer for each IGMP group in "delaying - member" state. + member" state. @param IpSb The IP4 service instance that is ticking @@ -526,7 +526,7 @@ Ip4IgmpTicking ( ) { IGMP_SERVICE_DATA *IgmpCtrl; - NET_LIST_ENTRY *Entry; + LIST_ENTRY *Entry; IGMP_GROUP *Group; IgmpCtrl = &IpSb->IgmpCtrl; @@ -566,7 +566,7 @@ Ip4IgmpTicking ( @param Addr The IP4 multicast address to add @return NULL if failed to allocate memory for the new groups, - @return otherwise the new combined group addresses. + otherwise the new combined group addresses. **/ IP4_ADDR * @@ -578,13 +578,13 @@ Ip4CombineGroups ( { IP4_ADDR *Groups; - Groups = NetAllocatePool (sizeof (IP4_ADDR) * (Count + 1)); + Groups = AllocatePool (sizeof (IP4_ADDR) * (Count + 1)); if (Groups == NULL) { return NULL; } - NetCopyMem (Groups, Source, Count * sizeof (IP4_ADDR)); + CopyMem (Groups, Source, Count * sizeof (IP4_ADDR)); Groups[Count] = Addr; return Groups; @@ -592,7 +592,7 @@ Ip4CombineGroups ( /** - Remove a group address frome the array of group addresses. + Remove a group address from the array of group addresses. Although the function doesn't assume the byte order of the both Groups and Addr, the network byte order is used by the caller. @@ -602,14 +602,14 @@ Ip4CombineGroups ( @param Addr The IP4 multicast address to remove @return The nubmer of group addresses in the Groups after remove. - @return It is Count if the Addr isn't in the Groups. + It is Count if the Addr isn't in the Groups. **/ INTN Ip4RemoveGroupAddr ( - IN IP4_ADDR *Groups, - IN UINT32 Count, - IN IP4_ADDR Addr + IN OUT IP4_ADDR *Groups, + IN UINT32 Count, + IN IP4_ADDR Addr ) { UINT32 Index;