Ip6Mld.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /** @file
  2. Multicast Listener Discovery support routines.
  3. Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __EFI_IP6_MLD_H__
  7. #define __EFI_IP6_MLD_H__
  8. #define IP6_UNSOLICITED_REPORT_INTERVAL 10
  9. #pragma pack(1)
  10. typedef struct {
  11. IP6_ICMP_HEAD Head;
  12. UINT16 MaxRespDelay;
  13. UINT16 Reserved;
  14. EFI_IPv6_ADDRESS Group;
  15. } IP6_MLD_HEAD;
  16. #pragma pack()
  17. //
  18. // The status of multicast group. It isn't necessary to maintain
  19. // explicit state of host state diagram. A group with finity
  20. // DelayTime (less than 0xffffffff) is in "delaying listener" state. otherwise, it is in
  21. // "idle listener" state.
  22. //
  23. typedef struct {
  24. LIST_ENTRY Link;
  25. INTN RefCnt;
  26. EFI_IPv6_ADDRESS Address;
  27. UINT32 DelayTimer;
  28. BOOLEAN SendByUs;
  29. EFI_MAC_ADDRESS Mac;
  30. } IP6_MLD_GROUP;
  31. //
  32. // The MLD status. Each IP6 service instance has a MLD_SERVICE_DATA
  33. // attached. The Mldv1QuerySeen remember whether the server on this
  34. // connected network is v1 or v2.
  35. //
  36. typedef struct {
  37. INTN Mldv1QuerySeen;
  38. LIST_ENTRY Groups;
  39. } IP6_MLD_SERVICE_DATA;
  40. /**
  41. Search a IP6_MLD_GROUP list entry node from a list array.
  42. @param[in] IpSb Points to an IP6 service binding instance.
  43. @param[in] MulticastAddr The IPv6 multicast address to be searched.
  44. @return The found IP6_ML_GROUP list entry or NULL.
  45. **/
  46. IP6_MLD_GROUP *
  47. Ip6FindMldEntry (
  48. IN IP6_SERVICE *IpSb,
  49. IN EFI_IPv6_ADDRESS *MulticastAddr
  50. );
  51. /**
  52. Init the MLD data of the IP6 service instance, configure
  53. MNP to receive ALL SYSTEM multicasts.
  54. @param[in] IpSb The IP6 service whose MLD is to be initialized.
  55. @retval EFI_OUT_OF_RESOURCES There are not sufficient resources to complete the
  56. operation.
  57. @retval EFI_SUCCESS The MLD module successfully initialized.
  58. **/
  59. EFI_STATUS
  60. Ip6InitMld (
  61. IN IP6_SERVICE *IpSb
  62. );
  63. /**
  64. Join the multicast group on behalf of this IP6 service binding instance.
  65. @param[in] IpSb The IP6 service binding instance.
  66. @param[in] Interface Points to an IP6_INTERFACE structure.
  67. @param[in] Address The group address to join.
  68. @retval EFI_SUCCESS Successfully joined the multicast group.
  69. @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
  70. @retval Others Failed to join the multicast group.
  71. **/
  72. EFI_STATUS
  73. Ip6JoinGroup (
  74. IN IP6_SERVICE *IpSb,
  75. IN IP6_INTERFACE *Interface,
  76. IN EFI_IPv6_ADDRESS *Address
  77. );
  78. /**
  79. Leave the IP6 multicast group.
  80. @param[in] IpSb The IP6 service binding instance.
  81. @param[in] Address The group address to leave.
  82. @retval EFI_NOT_FOUND The IP6 service instance isn't in the group.
  83. @retval EFI_SUCCESS Successfully left the multicast group.
  84. @retval Others Failed to leave the multicast group.
  85. **/
  86. EFI_STATUS
  87. Ip6LeaveGroup (
  88. IN IP6_SERVICE *IpSb,
  89. IN EFI_IPv6_ADDRESS *Address
  90. );
  91. /**
  92. Worker function for EfiIp6Groups(). The caller
  93. should verify that the parameters are valid.
  94. @param[in] IpInstance The IP6 child to change the setting.
  95. @param[in] JoinFlag TRUE to join the group, otherwise leave it.
  96. @param[in] GroupAddress The target group address. If NULL, leave all
  97. the group addresses.
  98. @retval EFI_ALREADY_STARTED Wants to join the group, but is already a member of it.
  99. @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
  100. @retval EFI_DEVICE_ERROR Failed to set the group configuration.
  101. @retval EFI_SUCCESS Successfully updated the group setting.
  102. @retval EFI_NOT_FOUND Tried to leave a group of whom it isn't a member.
  103. **/
  104. EFI_STATUS
  105. Ip6Groups (
  106. IN IP6_PROTOCOL *IpInstance,
  107. IN BOOLEAN JoinFlag,
  108. IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
  109. );
  110. /**
  111. Process the Multicast Listener Query message.
  112. @param[in] IpSb The IP service that received the packet.
  113. @param[in] Head The IP head of the MLD query packet.
  114. @param[in] Packet The content of the MLD query packet with IP head
  115. removed.
  116. @retval EFI_SUCCESS The MLD query packet processed successfully.
  117. @retval EFI_INVALID_PARAMETER The packet is invalid.
  118. @retval Others Failed to process the packet.
  119. **/
  120. EFI_STATUS
  121. Ip6ProcessMldQuery (
  122. IN IP6_SERVICE *IpSb,
  123. IN EFI_IP6_HEADER *Head,
  124. IN NET_BUF *Packet
  125. );
  126. /**
  127. Process the Multicast Listener Report message.
  128. @param[in] IpSb The IP service that received the packet.
  129. @param[in] Head The IP head of the MLD report packet.
  130. @param[in] Packet The content of the MLD report packet with IP head
  131. removed.
  132. @retval EFI_SUCCESS The MLD report packet processed successfully.
  133. @retval EFI_INVALID_PARAMETER The packet is invalid.
  134. **/
  135. EFI_STATUS
  136. Ip6ProcessMldReport (
  137. IN IP6_SERVICE *IpSb,
  138. IN EFI_IP6_HEADER *Head,
  139. IN NET_BUF *Packet
  140. );
  141. /**
  142. The heartbeat timer of the MLD module. It sends out solicited MLD report when
  143. DelayTimer expires.
  144. @param[in] IpSb The IP6 service binding instance.
  145. **/
  146. VOID
  147. Ip6MldTimerTicking (
  148. IN IP6_SERVICE *IpSb
  149. );
  150. #endif