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