]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2005 - 2006, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | Ip4Igmp.h\r | |
16 | \r | |
17 | Abstract:\r | |
18 | \r | |
19 | \r | |
20 | **/\r | |
21 | \r | |
22 | #ifndef __EFI_IP4_IGMP_H__\r | |
23 | #define __EFI_IP4_IGMP_H__\r | |
24 | \r | |
25 | #pragma pack(1)\r | |
26 | typedef struct {\r | |
27 | UINT8 Type;\r | |
28 | UINT8 MaxRespTime;\r | |
29 | UINT16 Checksum;\r | |
30 | IP4_ADDR Group;\r | |
31 | } IGMP_HEAD;\r | |
32 | #pragma pack()\r | |
33 | \r | |
96e1079f | 34 | ///\r |
35 | /// The status of multicast group. It isn't necessary to maintain\r | |
36 | /// explicit state of host state diagram. A group with non-zero\r | |
37 | /// DelayTime is in "delaying member" state. otherwise, it is in\r | |
38 | /// "idle member" state.\r | |
39 | ///\r | |
83cbd279 | 40 | typedef struct {\r |
e48e37fc | 41 | LIST_ENTRY Link;\r |
83cbd279 | 42 | INTN RefCnt;\r |
43 | IP4_ADDR Address;\r | |
44 | INTN DelayTime;\r | |
45 | BOOLEAN ReportByUs;\r | |
46 | EFI_MAC_ADDRESS Mac;\r | |
47 | } IGMP_GROUP;\r | |
48 | \r | |
96e1079f | 49 | ///\r |
50 | /// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA\r | |
51 | /// attached. The Igmpv1QuerySeen remember whether the server on this\r | |
52 | /// connected network is v1 or v2.\r | |
53 | ///\r | |
83cbd279 | 54 | typedef struct {\r |
55 | INTN Igmpv1QuerySeen;\r | |
e48e37fc | 56 | LIST_ENTRY Groups;\r |
83cbd279 | 57 | } IGMP_SERVICE_DATA;\r |
58 | \r | |
5405e9a6 | 59 | typedef enum {\r |
83cbd279 | 60 | //\r |
61 | // IGMP message type\r | |
62 | //\r | |
63 | IGMP_MEMBERSHIP_QUERY = 0x11,\r | |
64 | IGMP_V1_MEMBERSHIP_REPORT = 0x12,\r | |
65 | IGMP_V2_MEMBERSHIP_REPORT = 0x16,\r | |
66 | IGMP_LEAVE_GROUP = 0x17,\r | |
67 | \r | |
68 | IGMP_V1ROUTER_PRESENT = 400,\r | |
69 | IGMP_UNSOLICIATED_REPORT = 10\r | |
5405e9a6 | 70 | } IGMP_ENUM_TYPES;\r |
83cbd279 | 71 | \r |
2ff29212 | 72 | /**\r |
73 | Init the IGMP control data of the IP4 service instance, configure\r | |
74 | MNP to receive ALL SYSTEM multicast.\r | |
75 | \r | |
76 | @param IpSb The IP4 service whose IGMP is to be initialized.\r | |
77 | \r | |
78 | @retval EFI_SUCCESS IGMP of the IpSb is successfully initialized.\r | |
79 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to initialize IGMP.\r | |
80 | @retval Others Failed to initialize the IGMP of IpSb.\r | |
81 | \r | |
82 | **/\r | |
83cbd279 | 83 | EFI_STATUS\r |
84 | Ip4InitIgmp (\r | |
2ff29212 | 85 | IN OUT IP4_SERVICE *IpSb\r |
83cbd279 | 86 | );\r |
87 | \r | |
2ff29212 | 88 | /**\r |
89 | Join the multicast group on behalf of this IP4 child\r | |
90 | \r | |
91 | @param IpInstance The IP4 child that wants to join the group\r | |
92 | @param Address The group to join\r | |
93 | \r | |
94 | @retval EFI_SUCCESS Successfully join the multicast group\r | |
95 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources\r | |
96 | @retval Others Failed to join the multicast group.\r | |
97 | \r | |
98 | **/\r | |
83cbd279 | 99 | EFI_STATUS\r |
100 | Ip4JoinGroup (\r | |
2ff29212 | 101 | IN IP4_PROTOCOL *IpInstance,\r |
102 | IN IP4_ADDR Address\r | |
83cbd279 | 103 | );\r |
104 | \r | |
2ff29212 | 105 | /**\r |
106 | Leave the IP4 multicast group on behalf of IpInstance.\r | |
107 | \r | |
108 | @param IpInstance The IP4 child that wants to leave the group\r | |
109 | address\r | |
110 | @param Address The group address to leave\r | |
111 | \r | |
112 | @retval EFI_NOT_FOUND The IP4 service instance isn't in the group\r | |
113 | @retval EFI_SUCCESS Successfully leave the multicast group.\r | |
114 | @retval Others Failed to leave the multicast group.\r | |
115 | \r | |
116 | **/\r | |
83cbd279 | 117 | EFI_STATUS\r |
118 | Ip4LeaveGroup (\r | |
2ff29212 | 119 | IN IP4_PROTOCOL *IpInstance,\r |
120 | IN IP4_ADDR Address\r | |
83cbd279 | 121 | );\r |
122 | \r | |
2ff29212 | 123 | /**\r |
124 | Handle the received IGMP message for the IP4 service instance.\r | |
125 | \r | |
126 | @param IpSb The IP4 service instance that received the message\r | |
127 | @param Head The IP4 header of the received message\r | |
128 | @param Packet The IGMP message, without IP4 header\r | |
129 | \r | |
130 | @retval EFI_INVALID_PARAMETER The IGMP message is malformated.\r | |
131 | @retval EFI_SUCCESS The IGMP message is successfully processed.\r | |
132 | \r | |
133 | **/\r | |
83cbd279 | 134 | EFI_STATUS\r |
135 | Ip4IgmpHandle (\r | |
2ff29212 | 136 | IN IP4_SERVICE *IpSb,\r |
137 | IN IP4_HEAD *Head,\r | |
138 | IN NET_BUF *Packet\r | |
83cbd279 | 139 | );\r |
140 | \r | |
2ff29212 | 141 | /**\r |
142 | The periodical timer function for IGMP. It does the following\r | |
143 | things:\r | |
144 | 1. Decrease the Igmpv1QuerySeen to make it possible to refresh\r | |
145 | the IGMP server type.\r | |
146 | 2. Decrease the report timer for each IGMP group in "delaying\r | |
147 | member" state.\r | |
148 | \r | |
149 | @param IpSb The IP4 service instance that is ticking\r | |
150 | \r | |
151 | @return None\r | |
152 | \r | |
153 | **/\r | |
83cbd279 | 154 | VOID\r |
155 | Ip4IgmpTicking (\r | |
2ff29212 | 156 | IN IP4_SERVICE *IpSb\r |
83cbd279 | 157 | );\r |
158 | \r | |
2ff29212 | 159 | /**\r |
160 | Add a group address to the array of group addresses.\r | |
161 | The caller should make sure that no duplicated address\r | |
162 | existed in the array. Although the function doesn't\r | |
163 | assume the byte order of the both Source and Addr, the\r | |
164 | network byte order is used by the caller.\r | |
165 | \r | |
166 | @param Source The array of group addresses to add to\r | |
167 | @param Count The number of group addresses in the Source\r | |
168 | @param Addr The IP4 multicast address to add\r | |
169 | \r | |
170 | @return NULL if failed to allocate memory for the new groups,\r | |
171 | otherwise the new combined group addresses.\r | |
172 | \r | |
173 | **/\r | |
83cbd279 | 174 | IP4_ADDR *\r |
175 | Ip4CombineGroups (\r | |
2ff29212 | 176 | IN IP4_ADDR *Source,\r |
177 | IN UINT32 Count,\r | |
178 | IN IP4_ADDR Addr\r | |
83cbd279 | 179 | );\r |
180 | \r | |
2ff29212 | 181 | /**\r |
182 | Remove a group address from the array of group addresses.\r | |
183 | Although the function doesn't assume the byte order of the\r | |
184 | both Groups and Addr, the network byte order is used by\r | |
185 | the caller.\r | |
186 | \r | |
187 | @param Groups The array of group addresses to remove from\r | |
188 | @param Count The number of group addresses in the Groups\r | |
189 | @param Addr The IP4 multicast address to remove\r | |
190 | \r | |
191 | @return The nubmer of group addresses in the Groups after remove.\r | |
192 | It is Count if the Addr isn't in the Groups.\r | |
193 | \r | |
194 | **/\r | |
83cbd279 | 195 | INTN\r |
196 | Ip4RemoveGroupAddr (\r | |
2ff29212 | 197 | IN OUT IP4_ADDR *Groups,\r |
198 | IN UINT32 Count,\r | |
199 | IN IP4_ADDR Addr\r | |
83cbd279 | 200 | );\r |
201 | \r | |
2ff29212 | 202 | /**\r |
203 | Find the IGMP_GROUP structure which contains the status of multicast\r | |
204 | group Address in this IGMP control block\r | |
205 | \r | |
206 | @param IgmpCtrl The IGMP control block to search from\r | |
207 | @param Address The multicast address to search\r | |
208 | \r | |
209 | @return NULL if the multicast address isn't in the IGMP control block. Otherwise\r | |
210 | the point to the IGMP_GROUP which contains the status of multicast group\r | |
211 | for Address.\r | |
212 | \r | |
213 | **/\r | |
83cbd279 | 214 | IGMP_GROUP *\r |
215 | Ip4FindGroup (\r | |
2ff29212 | 216 | IN IGMP_SERVICE_DATA *IgmpCtrl,\r |
217 | IN IP4_ADDR Address\r | |
83cbd279 | 218 | );\r |
219 | #endif\r |