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