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