]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Copyright (c) 2006, Intel Corporation \r | |
3 | All rights reserved. This program and the accompanying materials \r | |
4 | are licensed and made available under the terms and conditions of the BSD License \r | |
5 | which accompanies this distribution. The full text of the license may be found at \r | |
6 | http://opensource.org/licenses/bsd-license.php \r | |
7 | \r | |
8 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
9 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
10 | \r | |
11 | Module Name: IP4.h\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __EFI_IP4_PROTOCOL_H__\r | |
16 | #define __EFI_IP4_PROTOCOL_H__\r | |
17 | \r | |
18 | #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \\r | |
19 | { \\r | |
20 | 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \\r | |
21 | }\r | |
22 | \r | |
23 | #define EFI_IP4_PROTOCOL_GUID \\r | |
24 | { \\r | |
25 | 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \\r | |
26 | }\r | |
27 | \r | |
28 | typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;\r | |
29 | \r | |
30 | typedef struct {\r | |
46dd23b8 | 31 | EFI_HANDLE InstanceHandle;\r |
878ddf1f | 32 | EFI_IPv4_ADDRESS Ip4Address;\r |
33 | EFI_IPv4_ADDRESS SubnetMask;\r | |
34 | } EFI_IP4_ADDRESS_PAIR; \r | |
35 | \r | |
36 | typedef struct {\r | |
37 | EFI_HANDLE DriverHandle;\r | |
38 | UINT32 AddressCount;\r | |
39 | EFI_IP4_ADDRESS_PAIR AddressPairs[1];\r | |
40 | } EFI_IP4_VARIABLE_DATA;\r | |
41 | \r | |
42 | typedef struct {\r | |
43 | UINT8 DefaultProtocol;\r | |
44 | BOOLEAN AcceptAnyProtocol;\r | |
45 | BOOLEAN AcceptIcmpErrors;\r | |
46 | BOOLEAN AcceptBroadcast;\r | |
47 | BOOLEAN AcceptPromiscuous;\r | |
48 | BOOLEAN UseDefaultAddress;\r | |
49 | EFI_IPv4_ADDRESS StationAddress;\r | |
50 | EFI_IPv4_ADDRESS SubnetMask;\r | |
51 | UINT8 TypeOfService;\r | |
52 | UINT8 TimeToLive;\r | |
53 | BOOLEAN DoNotFragment;\r | |
54 | BOOLEAN RawData;\r | |
55 | UINT32 ReceiveTimeout;\r | |
56 | UINT32 TransmitTimeout;\r | |
57 | } EFI_IP4_CONFIG_DATA;\r | |
58 | \r | |
59 | \r | |
60 | typedef struct {\r | |
61 | EFI_IPv4_ADDRESS SubnetAddress;\r | |
62 | EFI_IPv4_ADDRESS SubnetMask;\r | |
63 | EFI_IPv4_ADDRESS GatewayAddress;\r | |
64 | } EFI_IP4_ROUTE_TABLE;\r | |
65 | \r | |
66 | typedef struct {\r | |
67 | UINT8 Type;\r | |
68 | UINT8 Code;\r | |
69 | } EFI_IP4_ICMP_TYPE;\r | |
70 | \r | |
71 | typedef struct {\r | |
72 | BOOLEAN IsStarted;\r | |
73 | EFI_IP4_CONFIG_DATA ConfigData;\r | |
74 | BOOLEAN IsConfigured;\r | |
75 | UINT32 GroupCount;\r | |
76 | EFI_IPv4_ADDRESS *GroupTable;\r | |
77 | UINT32 RouteCount;\r | |
78 | EFI_IP4_ROUTE_TABLE *RouteTable;\r | |
79 | UINT32 IcmpTypeCount;\r | |
80 | EFI_IP4_ICMP_TYPE *IcmpTypeList;\r | |
81 | } EFI_IP4_MODE_DATA;\r | |
82 | \r | |
83 | #pragma pack(1)\r | |
84 | \r | |
85 | typedef struct {\r | |
878ddf1f | 86 | UINT8 HeaderLength:4;\r |
87 | UINT8 Version:4;\r | |
878ddf1f | 88 | UINT8 TypeOfService;\r |
89 | UINT16 TotalLength;\r | |
90 | UINT16 Identification;\r | |
91 | UINT16 Fragmentation;\r | |
92 | UINT8 TimeToLive;\r | |
93 | UINT8 Protocol;\r | |
94 | UINT16 Checksum;\r | |
95 | EFI_IPv4_ADDRESS SourceAddress;\r | |
96 | EFI_IPv4_ADDRESS DestinationAddress;\r | |
97 | } EFI_IP4_HEADER;\r | |
98 | #pragma pack()\r | |
99 | \r | |
100 | \r | |
101 | typedef struct {\r | |
102 | UINT32 FragmentLength;\r | |
103 | VOID *FragmentBuffer;\r | |
104 | } EFI_IP4_FRAGMENT_DATA;\r | |
105 | \r | |
106 | \r | |
107 | typedef struct {\r | |
108 | EFI_TIME TimeStamp;\r | |
109 | EFI_EVENT RecycleSignal;\r | |
110 | UINT32 HeaderLength;\r | |
111 | EFI_IP4_HEADER *Header;\r | |
112 | UINT32 OptionsLength;\r | |
113 | VOID *Options;\r | |
114 | UINT32 DataLength;\r | |
115 | UINT32 FragmentCount;\r | |
116 | EFI_IP4_FRAGMENT_DATA FragmentTable[1];\r | |
117 | } EFI_IP4_RECEIVE_DATA;\r | |
118 | \r | |
119 | \r | |
120 | typedef struct {\r | |
121 | EFI_IPv4_ADDRESS SourceAddress;\r | |
122 | EFI_IPv4_ADDRESS GatewayAddress;\r | |
123 | UINT8 Protocol;\r | |
124 | UINT8 TypeOfService;\r | |
125 | UINT8 TimeToLive;\r | |
126 | BOOLEAN DoNotFragment;\r | |
127 | } EFI_IP4_OVERRIDE_DATA;\r | |
128 | \r | |
129 | typedef struct {\r | |
130 | EFI_IPv4_ADDRESS DestinationAddress;\r | |
131 | EFI_IP4_OVERRIDE_DATA *OverrideData; //OPTIONAL\r | |
132 | UINT32 OptionsLength; //OPTIONAL\r | |
133 | VOID *OptionsBuffer; //OPTIONAL\r | |
134 | UINT32 TotalDataLength;\r | |
135 | UINT32 FragmentCount;\r | |
136 | EFI_IP4_FRAGMENT_DATA FragmentTable[1];\r | |
137 | } EFI_IP4_TRANSMIT_DATA;\r | |
138 | \r | |
139 | typedef struct {\r | |
140 | EFI_EVENT Event;\r | |
141 | EFI_STATUS Status;\r | |
142 | union {\r | |
143 | EFI_IP4_RECEIVE_DATA *RxData;\r | |
144 | EFI_IP4_TRANSMIT_DATA *TxData;\r | |
145 | } Packet;\r | |
146 | } EFI_IP4_COMPLETION_TOKEN;\r | |
147 | \r | |
148 | /**\r | |
149 | Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.\r | |
150 | \r | |
151 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
152 | @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.\r | |
153 | @param MnpConfigData Pointer to the managed network configuration data structure.\r | |
154 | @param SnpData Pointer to the simple network mode data structure.\r | |
155 | \r | |
156 | @retval EFI_SUCCESS The operation completed successfully.\r | |
157 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
158 | @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r | |
159 | \r | |
160 | **/\r | |
161 | typedef\r | |
162 | EFI_STATUS\r | |
163 | (EFIAPI *EFI_IP4_GET_MODE_DATA) (\r | |
164 | IN EFI_IP4_PROTOCOL *This,\r | |
165 | OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r | |
166 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r | |
167 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r | |
168 | )\r | |
169 | ; \r | |
170 | \r | |
171 | /**\r | |
172 | Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.\r | |
173 | \r | |
174 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
175 | @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.\r | |
176 | \r | |
177 | @retval EFI_SUCCESS The driver instance was successfully opened.\r | |
178 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
179 | RARP, etc.) is not finished yet.\r | |
180 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
181 | @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:\r | |
182 | A configuration protocol (DHCP, BOOTP, RARP, etc.) could\r | |
183 | not be located when clients choose to use the default IPv4\r | |
184 | address. This EFI IPv4 Protocol implementation does not\r | |
185 | support this requested filter or timeout setting.\r | |
186 | @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.\r | |
187 | @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the\r | |
188 | IPv4 address or subnet mask can be changed. The interface must\r | |
189 | also be stopped when switching to/from raw packet mode.\r | |
190 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4\r | |
191 | Protocol driver instance is not opened.\r | |
192 | \r | |
193 | **/\r | |
194 | typedef \r | |
195 | EFI_STATUS\r | |
196 | (EFIAPI *EFI_IP4_CONFIGURE) (\r | |
197 | IN EFI_IP4_PROTOCOL *This,\r | |
198 | IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL\r | |
199 | )\r | |
200 | ; \r | |
201 | \r | |
202 | /**\r | |
203 | Joins and leaves multicast groups.\r | |
204 | \r | |
205 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
206 | @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.\r | |
207 | @param GroupAddress Pointer to the IPv4 multicast address.\r | |
208 | \r | |
209 | @retval EFI_SUCCESS The operation completed successfully.\r | |
210 | @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r | |
211 | - This is NULL.\r | |
212 | - JoinFlag is TRUE and GroupAddress is NULL.\r | |
213 | - GroupAddress is not NULL and *GroupAddress is\r | |
214 | not a multicast IPv4 address.\r | |
215 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
216 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
217 | RARP, etc.) is not finished yet.\r | |
218 | @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.\r | |
219 | @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.\r | |
220 | @retval EFI_ALREADY_STARTED The group address is already in the group table (when\r | |
221 | JoinFlag is TRUE).\r | |
222 | @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).\r | |
223 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
224 | \r | |
225 | **/\r | |
226 | typedef \r | |
227 | EFI_STATUS\r | |
228 | (EFIAPI *EFI_IP4_GROUPS) (\r | |
229 | IN EFI_IP4_PROTOCOL *This,\r | |
230 | IN BOOLEAN JoinFlag,\r | |
231 | IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL\r | |
232 | )\r | |
233 | ; \r | |
234 | \r | |
235 | /**\r | |
236 | Adds and deletes routing table entries.\r | |
237 | \r | |
238 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
239 | @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to\r | |
240 | FALSE to add this route to the routing table. SubnetAddress\r | |
241 | and SubnetMask are used as the key to each route entry.\r | |
242 | @param SubnetAddress The address of the subnet that needs to be routed.\r | |
243 | @param SubnetMask The subnet mask of SubnetAddress.\r | |
244 | @param GatewayAddress The unicast gateway IPv4 address for this route.\r | |
245 | \r | |
246 | @retval EFI_SUCCESS The operation completed successfully.\r | |
247 | @retval EFI_NOT_STARTED The driver instance has not been started.\r | |
248 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
249 | RARP, etc.) is not finished yet.\r | |
250 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
251 | - This is NULL.\r | |
252 | - SubnetAddress is NULL.\r | |
253 | - SubnetMask is NULL.\r | |
254 | - GatewayAddress is NULL.\r | |
255 | - *SubnetAddress is not a valid subnet address.\r | |
256 | - *SubnetMask is not a valid subnet mask.\r | |
257 | - *GatewayAddress is not a valid unicast IPv4 address.\r | |
258 | @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.\r | |
259 | @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).\r | |
260 | @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when\r | |
261 | DeleteRoute is FALSE).\r | |
262 | \r | |
263 | **/\r | |
264 | typedef \r | |
265 | EFI_STATUS\r | |
266 | (EFIAPI *EFI_IP4_ROUTES) (\r | |
267 | IN EFI_IP4_PROTOCOL *This,\r | |
268 | IN BOOLEAN DeleteRoute,\r | |
269 | IN EFI_IPv4_ADDRESS *SubnetAddress,\r | |
270 | IN EFI_IPv4_ADDRESS *SubnetMask,\r | |
271 | IN EFI_IPv4_ADDRESS *GatewayAddress \r | |
272 | )\r | |
273 | ; \r | |
274 | \r | |
275 | /**\r | |
276 | Places outgoing data packets into the transmit queue.\r | |
277 | \r | |
278 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
279 | @param Token Pointer to the transmit token.\r | |
280 | \r | |
281 | @retval EFI_SUCCESS The data has been queued for transmission.\r | |
282 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
283 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
284 | RARP, etc.) is not finished yet.\r | |
285 | @retval EFI_INVALID_PARAMETER One or more pameters are invalid.\r | |
286 | @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event\r | |
287 | was already in the transmit queue.\r | |
288 | @retval EFI_NOT_READY The completion token could not be queued because the transmit\r | |
289 | queue is full. \r | |
290 | @retval EFI_NOT_FOUND Not route is found to destination address.\r | |
291 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.\r | |
292 | @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too\r | |
293 | short to transmit.\r | |
294 | @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is\r | |
295 | greater than MTU (or greater than the maximum packet size if\r | |
296 | Token.Packet.TxData.OverrideData.\r | |
297 | DoNotFragment is TRUE.)\r | |
298 | \r | |
299 | **/\r | |
300 | typedef \r | |
301 | EFI_STATUS\r | |
302 | (EFIAPI *EFI_IP4_TRANSMIT) (\r | |
303 | IN EFI_IP4_PROTOCOL *This,\r | |
304 | IN EFI_IP4_COMPLETION_TOKEN *Token\r | |
305 | )\r | |
306 | ; \r | |
307 | \r | |
308 | /**\r | |
309 | Places a receiving request into the receiving queue.\r | |
310 | \r | |
311 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
312 | @param Token Pointer to a token that is associated with the receive data descriptor.\r | |
313 | \r | |
314 | @retval EFI_SUCCESS The receive completion token was cached.\r | |
315 | @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.\r | |
316 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)\r | |
317 | is not finished yet.\r | |
318 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
319 | - This is NULL.\r | |
320 | - Token is NULL.\r | |
321 | - Token.Event is NULL.\r | |
322 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system\r | |
323 | resources (usually memory).\r | |
324 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
325 | The EFI IPv4 Protocol instance has been reset to startup defaults.\r | |
326 | EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already\r | |
327 | in the receive queue.\r | |
328 | @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r | |
329 | @retval EFI_ICMP_ERROR An ICMP error packet was received.\r | |
330 | \r | |
331 | **/\r | |
332 | typedef \r | |
333 | EFI_STATUS\r | |
334 | (EFIAPI *EFI_IP4_RECEIVE) (\r | |
335 | IN EFI_IP4_PROTOCOL *This,\r | |
336 | IN EFI_IP4_COMPLETION_TOKEN *Token\r | |
337 | )\r | |
338 | ; \r | |
339 | \r | |
340 | /**\r | |
341 | Abort an asynchronous transmit or receive request.\r | |
342 | \r | |
343 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
344 | @param Token Pointer to a token that has been issued by\r | |
345 | EFI_IP4_PROTOCOL.Transmit() or\r | |
346 | EFI_IP4_PROTOCOL.Receive(). If NULL, all pending\r | |
347 | tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is\r | |
348 | defined in EFI_IP4_PROTOCOL.Transmit().\r | |
349 | \r | |
350 | @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r | |
351 | Token.->Event was signaled. When Token is NULL, all\r | |
352 | pending requests were aborted and their events were signaled.\r | |
353 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
354 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
355 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
356 | RARP, etc.) is not finished yet.\r | |
357 | @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was\r | |
358 | not found in the transmit or receive queue. It has either completed\r | |
359 | or was not issued by Transmit() and Receive().\r | |
360 | \r | |
361 | **/\r | |
362 | typedef\r | |
363 | EFI_STATUS\r | |
364 | (EFIAPI *EFI_IP4_CANCEL) (\r | |
365 | IN EFI_IP4_PROTOCOL *This,\r | |
366 | IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL\r | |
367 | )\r | |
368 | ; \r | |
369 | \r | |
370 | /**\r | |
371 | Polls for incoming data packets and processes outgoing data packets.\r | |
372 | \r | |
373 | @param This Pointer to the EFI_IP4_PROTOCOL instance.\r | |
374 | \r | |
375 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
376 | @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.\r | |
377 | @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,\r | |
378 | RARP, etc.) is not finished yet.\r | |
379 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
380 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
381 | @retval EFI_NOT_READY No incoming or outgoing data is processed.\r | |
382 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r | |
383 | Consider increasing the polling rate.\r | |
384 | \r | |
385 | **/\r | |
386 | typedef \r | |
387 | EFI_STATUS\r | |
388 | (EFIAPI *EFI_IP4_POLL) (\r | |
389 | IN EFI_IP4_PROTOCOL *This\r | |
390 | )\r | |
391 | ; \r | |
392 | \r | |
393 | struct _EFI_IP4_PROTOCOL {\r | |
394 | EFI_IP4_GET_MODE_DATA GetModeData;\r | |
395 | EFI_IP4_CONFIGURE Configure;\r | |
396 | EFI_IP4_GROUPS Groups;\r | |
397 | EFI_IP4_ROUTES Routes;\r | |
398 | EFI_IP4_TRANSMIT Transmit;\r | |
399 | EFI_IP4_RECEIVE Receive;\r | |
400 | EFI_IP4_CANCEL Cancel;\r | |
401 | EFI_IP4_POLL Poll;\r | |
402 | };\r | |
403 | \r | |
404 | extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid;\r | |
405 | extern EFI_GUID gEfiIp4ProtocolGuid;\r | |
406 | \r | |
407 | #endif\r |