hhtian | a3bcde7 | 2010-11-01 06:13:54 +0000 | [diff] [blame] | 1 | /** @file
|
| 2 | Multicast Listener Discovery support routines.
|
| 3 |
|
| 4 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
| 5 |
|
| 6 | This program and the accompanying materials
|
| 7 | are licensed and made available under the terms and conditions of the BSD License
|
| 8 | which accompanies this distribution. The full text of the license may be found at
|
| 9 | http://opensource.org/licenses/bsd-license.php.
|
| 10 |
|
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 13 |
|
| 14 | **/
|
| 15 |
|
| 16 | #ifndef __EFI_IP6_MLD_H__
|
| 17 | #define __EFI_IP6_MLD_H__
|
| 18 |
|
| 19 | #define IP6_UNSOLICITED_REPORT_INTERVAL 10
|
| 20 |
|
| 21 | #pragma pack(1)
|
| 22 | typedef struct {
|
| 23 | IP6_ICMP_HEAD Head;
|
| 24 | UINT16 MaxRespDelay;
|
| 25 | UINT16 Reserved;
|
| 26 | EFI_IPv6_ADDRESS Group;
|
| 27 | } IP6_MLD_HEAD;
|
| 28 | #pragma pack()
|
| 29 |
|
| 30 | //
|
| 31 | // The status of multicast group. It isn't necessary to maintain
|
| 32 | // explicit state of host state diagram. A group with finity
|
| 33 | // DelayTime (less than 0xffffffff) is in "delaying listener" state. otherwise, it is in
|
| 34 | // "idle listener" state.
|
| 35 | //
|
| 36 | typedef struct {
|
| 37 | LIST_ENTRY Link;
|
| 38 | INTN RefCnt;
|
| 39 | EFI_IPv6_ADDRESS Address;
|
| 40 | UINT32 DelayTimer;
|
| 41 | BOOLEAN SendByUs;
|
| 42 | EFI_MAC_ADDRESS Mac;
|
| 43 | } IP6_MLD_GROUP;
|
| 44 |
|
| 45 | //
|
| 46 | // The MLD status. Each IP6 service instance has a MLD_SERVICE_DATA
|
| 47 | // attached. The Mldv1QuerySeen remember whether the server on this
|
| 48 | // connected network is v1 or v2.
|
| 49 | //
|
| 50 | typedef struct {
|
| 51 | INTN Mldv1QuerySeen;
|
| 52 | LIST_ENTRY Groups;
|
| 53 | } IP6_MLD_SERVICE_DATA;
|
| 54 |
|
| 55 | /**
|
| 56 | Search a IP6_MLD_GROUP list entry node from a list array.
|
| 57 |
|
| 58 | @param[in] IpSb Points to an IP6 service binding instance.
|
| 59 | @param[in] MulticastAddr The IPv6 multicast address to be searched.
|
| 60 |
|
| 61 | @return The found IP6_ML_GROUP list entry or NULL.
|
| 62 |
|
| 63 | **/
|
| 64 | IP6_MLD_GROUP *
|
| 65 | Ip6FindMldEntry (
|
| 66 | IN IP6_SERVICE *IpSb,
|
| 67 | IN EFI_IPv6_ADDRESS *MulticastAddr
|
| 68 | );
|
| 69 |
|
| 70 | /**
|
| 71 | Init the MLD data of the IP6 service instance, configure
|
| 72 | MNP to receive ALL SYSTEM multicasts.
|
| 73 |
|
| 74 | @param[in] IpSb The IP6 service whose MLD is to be initialized.
|
| 75 |
|
| 76 | @retval EFI_OUT_OF_RESOURCES There are not sufficient resources to complete the
|
| 77 | operation.
|
| 78 | @retval EFI_SUCCESS The MLD module successfully initialized.
|
| 79 |
|
| 80 | **/
|
| 81 | EFI_STATUS
|
| 82 | Ip6InitMld (
|
| 83 | IN IP6_SERVICE *IpSb
|
| 84 | );
|
| 85 |
|
| 86 | /**
|
| 87 | Join the multicast group on behalf of this IP6 service binding instance.
|
| 88 |
|
| 89 | @param[in] IpSb The IP6 service binding instance.
|
| 90 | @param[in] Interface Points to an IP6_INTERFACE structure.
|
| 91 | @param[in] Address The group address to join.
|
| 92 |
|
| 93 | @retval EFI_SUCCESS Successfully joined the multicast group.
|
| 94 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
|
| 95 | @retval Others Failed to join the multicast group.
|
| 96 |
|
| 97 | **/
|
| 98 | EFI_STATUS
|
| 99 | Ip6JoinGroup (
|
| 100 | IN IP6_SERVICE *IpSb,
|
| 101 | IN IP6_INTERFACE *Interface,
|
| 102 | IN EFI_IPv6_ADDRESS *Address
|
| 103 | );
|
| 104 |
|
| 105 | /**
|
| 106 | Leave the IP6 multicast group.
|
| 107 |
|
| 108 | @param[in] IpSb The IP6 service binding instance.
|
| 109 | @param[in] Address The group address to leave.
|
| 110 |
|
| 111 | @retval EFI_NOT_FOUND The IP6 service instance isn't in the group.
|
| 112 | @retval EFI_SUCCESS Successfully left the multicast group.
|
| 113 | @retval Others Failed to leave the multicast group.
|
| 114 |
|
| 115 | **/
|
| 116 | EFI_STATUS
|
| 117 | Ip6LeaveGroup (
|
| 118 | IN IP6_SERVICE *IpSb,
|
| 119 | IN EFI_IPv6_ADDRESS *Address
|
| 120 | );
|
| 121 |
|
| 122 | /**
|
| 123 | Worker function for EfiIp6Groups(). The caller
|
| 124 | should verify that the parameters are valid.
|
| 125 |
|
| 126 | @param[in] IpInstance The IP6 child to change the setting.
|
| 127 | @param[in] JoinFlag TRUE to join the group, otherwise leave it.
|
| 128 | @param[in] GroupAddress The target group address. If NULL, leave all
|
| 129 | the group addresses.
|
| 130 |
|
| 131 | @retval EFI_ALREADY_STARTED Wants to join the group, but is already a member of it.
|
| 132 | @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
|
| 133 | @retval EFI_DEVICE_ERROR Failed to set the group configuraton.
|
| 134 | @retval EFI_SUCCESS Successfully updated the group setting.
|
| 135 | @retval EFI_NOT_FOUND Tried to leave a group of whom it isn't a member.
|
| 136 |
|
| 137 | **/
|
| 138 | EFI_STATUS
|
| 139 | Ip6Groups (
|
| 140 | IN IP6_PROTOCOL *IpInstance,
|
| 141 | IN BOOLEAN JoinFlag,
|
| 142 | IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
|
| 143 | );
|
| 144 |
|
| 145 | /**
|
| 146 | Process the Multicast Listener Query message.
|
| 147 |
|
| 148 | @param[in] IpSb The IP service that received the packet.
|
| 149 | @param[in] Head The IP head of the MLD query packet.
|
| 150 | @param[in] Packet The content of the MLD query packet with IP head
|
| 151 | removed.
|
| 152 |
|
| 153 | @retval EFI_SUCCESS The MLD query packet processed successfully.
|
| 154 | @retval EFI_INVALID_PARAMETER The packet is invalid.
|
| 155 | @retval Others Failed to process the packet.
|
| 156 |
|
| 157 | **/
|
| 158 | EFI_STATUS
|
| 159 | Ip6ProcessMldQuery (
|
| 160 | IN IP6_SERVICE *IpSb,
|
| 161 | IN EFI_IP6_HEADER *Head,
|
| 162 | IN NET_BUF *Packet
|
| 163 | );
|
| 164 |
|
| 165 | /**
|
| 166 | Process the Multicast Listener Report message.
|
| 167 |
|
| 168 | @param[in] IpSb The IP service that received the packet.
|
| 169 | @param[in] Head The IP head of the MLD report packet.
|
| 170 | @param[in] Packet The content of the MLD report packet with IP head
|
| 171 | removed.
|
| 172 |
|
| 173 | @retval EFI_SUCCESS The MLD report packet processed successfully.
|
| 174 | @retval EFI_INVALID_PARAMETER The packet is invalid.
|
| 175 |
|
| 176 | **/
|
| 177 | EFI_STATUS
|
| 178 | Ip6ProcessMldReport (
|
| 179 | IN IP6_SERVICE *IpSb,
|
| 180 | IN EFI_IP6_HEADER *Head,
|
| 181 | IN NET_BUF *Packet
|
| 182 | );
|
| 183 |
|
| 184 |
|
| 185 | /**
|
| 186 | The heartbeat timer of the MLD module. It sends out solicited MLD report when
|
| 187 | DelayTimer expires.
|
| 188 |
|
| 189 | @param[in] IpSb The IP6 service binding instance.
|
| 190 |
|
| 191 | **/
|
| 192 | VOID
|
| 193 | Ip6MldTimerTicking (
|
| 194 | IN IP6_SERVICE *IpSb
|
| 195 | );
|
| 196 |
|
| 197 | #endif
|
| 198 |
|