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