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