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