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