]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Ip6Dxe/Ip6If.h
NetworkPkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6If.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Definition for IP6 pesudo interface structure.\r
3\r
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __EFI_IP6_IF_H__\r
17#define __EFI_IP6_IF_H__\r
18\r
19#define IP6_LINK_RX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'R')\r
20#define IP6_LINK_TX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'T')\r
21#define IP6_INTERFACE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'I')\r
22#define IP6_ADDR_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', 'A', 'I')\r
23\r
24//\r
25// This prototype is used by both receive and transmission.\r
26// When receiving Netbuf is allocated by IP6_INTERFACE, and\r
27// released by IP6. Flag shows whether the frame is received\r
28// as unicast/multicast/anycast...\r
29//\r
30// When transmitting, the Netbuf is from IP6, and provided\r
31// to the callback as a reference. Flag isn't used.\r
32//\r
33// IpInstance can be NULL which means that it is the IP6 driver\r
34// itself sending the packets. IP6 driver may send packets that\r
35// don't belong to any instance, such as ICMP errors, ICMP\r
36// informational packets. IpInstance is used as a tag in\r
37// this module.\r
38//\r
39typedef\r
40VOID\r
41(*IP6_FRAME_CALLBACK) (\r
42 NET_BUF *Packet,\r
43 EFI_STATUS IoStatus,\r
44 UINT32 LinkFlag,\r
45 VOID *Context\r
46 );\r
47\r
48//\r
49// Each receive request is wrapped in an IP6_LINK_RX_TOKEN.\r
50// Upon completion, the Callback will be called. Only one\r
51// receive request is send to MNP. IpInstance is always NULL.\r
52// Reference MNP's spec for information.\r
53//\r
54typedef struct {\r
55 UINT32 Signature;\r
56 IP6_FRAME_CALLBACK CallBack;\r
57 VOID *Context;\r
58 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;\r
59} IP6_LINK_RX_TOKEN;\r
60\r
61//\r
62// Each transmit request is wrapped in an IP6_LINK_TX_TOKEN.\r
63// Upon completion, the Callback will be called.\r
64//\r
65typedef struct {\r
66 UINT32 Signature;\r
67 LIST_ENTRY Link;\r
68\r
69 IP6_PROTOCOL *IpInstance;\r
70 IP6_FRAME_CALLBACK CallBack;\r
71 NET_BUF *Packet;\r
72 VOID *Context;\r
73\r
74 EFI_MAC_ADDRESS DstMac;\r
75 EFI_MAC_ADDRESS SrcMac;\r
76\r
77 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;\r
78 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;\r
79} IP6_LINK_TX_TOKEN;\r
80\r
81struct _IP6_ADDRESS_INFO {\r
82 UINT32 Signature;\r
83 LIST_ENTRY Link;\r
84 EFI_IPv6_ADDRESS Address;\r
85 BOOLEAN IsAnycast;\r
86 UINT8 PrefixLength;\r
87 UINT32 ValidLifetime;\r
88 UINT32 PreferredLifetime;\r
89};\r
90\r
91//\r
92// Callback to select which frame to cancel. Caller can cancel a\r
93// single frame, or all the frame from an IP instance.\r
94//\r
95typedef\r
96BOOLEAN\r
97(*IP6_FRAME_TO_CANCEL) (\r
98 IP6_LINK_TX_TOKEN *Frame,\r
99 VOID *Context\r
100 );\r
101\r
102struct _IP6_INTERFACE {\r
103 UINT32 Signature;\r
104 LIST_ENTRY Link;\r
105 INTN RefCnt;\r
106\r
107 //\r
108 // IP address and prefix length of the interface. The fileds\r
109 // are invalid if (Configured == FALSE)\r
110 //\r
111 LIST_ENTRY AddressList;\r
112 UINT32 AddressCount;\r
113 BOOLEAN Configured;\r
114\r
115 IP6_SERVICE *Service;\r
116\r
117 EFI_HANDLE Controller;\r
118 EFI_HANDLE Image;\r
119\r
120\r
121 //\r
122 // Queues to keep the frames sent and waiting ARP request.\r
123 //\r
124 LIST_ENTRY ArpQues;\r
125 LIST_ENTRY SentFrames;\r
126\r
127\r
128 //\r
129 // The interface's configuration variables\r
130 //\r
131 UINT32 DupAddrDetect;\r
132 LIST_ENTRY DupAddrDetectList;\r
133 LIST_ENTRY DelayJoinList;\r
134\r
135 //\r
136 // All the IP instances that have the same IP/SubnetMask are linked\r
137 // together through IpInstances. If any of the instance enables\r
138 // promiscuous receive, PromiscRecv is true.\r
139 //\r
140 LIST_ENTRY IpInstances;\r
141 BOOLEAN PromiscRecv;\r
142};\r
143\r
144/**\r
145 Create an IP6_INTERFACE.\r
146\r
147 @param[in] IpSb The IP6 service binding instance.\r
148 @param[in] LinkLocal If TRUE, the instance is created for link-local address.\r
149 Otherwise, it is not for a link-local address.\r
150\r
151 @return Point to the created IP6_INTERFACE, otherwise NULL.\r
152\r
153**/\r
154IP6_INTERFACE *\r
155Ip6CreateInterface (\r
156 IN IP6_SERVICE *IpSb,\r
157 IN BOOLEAN LinkLocal\r
158 );\r
159\r
160/**\r
161 Free the interface used by IpInstance. All the IP instance with\r
162 the same Ip/prefix pair share the same interface. It is reference\r
163 counted. All the frames that haven't been sent will be cancelled.\r
164 Because the IpInstance is optional, the caller must remove\r
165 IpInstance from the interface's instance list.\r
166\r
167 @param[in] Interface The interface used by the IpInstance.\r
168 @param[in] IpInstance The IP instance that free the interface. NULL if\r
169 the IP driver is releasing the default interface.\r
170\r
171**/\r
172VOID\r
173Ip6CleanInterface (\r
174 IN IP6_INTERFACE *Interface,\r
175 IN IP6_PROTOCOL *IpInstance OPTIONAL\r
176 );\r
177\r
178/**\r
179 Free the link layer transmit token. It will close the event\r
180 then free the memory used.\r
181\r
182 @param[in] Token Token to free.\r
183\r
184**/\r
185VOID\r
186Ip6FreeLinkTxToken (\r
187 IN IP6_LINK_TX_TOKEN *Token\r
188 );\r
189\r
190/**\r
191 Request Ip6OnFrameReceivedDpc as a DPC at TPL_CALLBACK\r
192\r
193 @param Event The receive event delivered to MNP for receive.\r
194 @param Context Context for the callback.\r
195\r
196**/\r
197VOID\r
198EFIAPI\r
199Ip6OnFrameReceived (\r
200 IN EFI_EVENT Event,\r
201 IN VOID *Context\r
202 );\r
203\r
204/**\r
205 Request to receive the packet from the interface.\r
206\r
207 @param[in] CallBack Function to call when the receive finished.\r
208 @param[in] IpSb Points to the IP6 service binding instance.\r
209\r
210 @retval EFI_ALREADY_STARTED There is already a pending receive request.\r
211 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to receive.\r
212 @retval EFI_SUCCESS The recieve request has been started.\r
213\r
214**/\r
215EFI_STATUS\r
216Ip6ReceiveFrame (\r
217 IN IP6_FRAME_CALLBACK CallBack,\r
218 IN IP6_SERVICE *IpSb\r
219 );\r
220\r
221/**\r
222 Send a frame from the interface. If the next hop is multicast address,\r
223 it is transmitted immediately. If the next hop is a unicast,\r
224 and the NextHop's MAC is not known, it will perform address resolution.\r
225 If some error happened, the CallBack won't be called. So, the caller\r
226 must test the return value, and take action when there is an error.\r
227\r
228 @param[in] Interface The interface to send the frame from\r
229 @param[in] IpInstance The IP child that request the transmission.\r
230 NULL if it is the IP6 driver itself.\r
231 @param[in] Packet The packet to transmit.\r
232 @param[in] NextHop The immediate destination to transmit the packet to.\r
233 @param[in] CallBack Function to call back when transmit finished.\r
234 @param[in] Context Opaque parameter to the call back.\r
235\r
236 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame.\r
237 @retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop.\r
238 @retval EFI_SUCCESS The packet successfully transmitted.\r
239\r
240**/\r
241EFI_STATUS\r
242Ip6SendFrame (\r
243 IN IP6_INTERFACE *Interface,\r
244 IN IP6_PROTOCOL *IpInstance OPTIONAL,\r
245 IN NET_BUF *Packet,\r
246 IN EFI_IPv6_ADDRESS *NextHop,\r
247 IN IP6_FRAME_CALLBACK CallBack,\r
248 IN VOID *Context\r
249 );\r
250\r
251/**\r
252 The heartbeat timer of IP6 service instance. It times out\r
253 all of its IP6 children's received-but-not-delivered and\r
254 transmitted-but-not-recycle packets.\r
255\r
256 @param[in] Event The IP6 service instance's heart beat timer.\r
257 @param[in] Context The IP6 service instance.\r
258\r
259**/\r
260VOID\r
261EFIAPI\r
262Ip6TimerTicking (\r
263 IN EFI_EVENT Event,\r
264 IN VOID *Context\r
265 );\r
266\r
267#endif\r