]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/TianoTools/Include/Protocol/Udp4.h
Remove the dependence to MdePkg
[mirror_edk2.git] / Tools / Source / TianoTools / Include / Protocol / Udp4.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: Udp4.h
12
13 **/
14
15 #ifndef __EFI_UDP4_PROTOCOL_H__
16 #define __EFI_UDP4_PROTOCOL_H__
17
18 //
19 //GUID definitions
20 //
21 #define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \
22 { \
23 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \
24 }
25
26 #define EFI_UDP4_PROTOCOL_GUID \
27 { \
28 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \
29 }
30
31 typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL;
32
33 typedef struct {
34 EFI_HANDLE InstanceHandle;
35 EFI_IPv4_ADDRESS LocalAddress;
36 UINT16 LocalPort;
37 EFI_IPv4_ADDRESS RemoteAddress;
38 UINT16 RemotePort;
39 } EFI_UDP4_SERVICE_POINT;
40
41 typedef struct {
42 EFI_HANDLE DriverHandle;
43 UINT32 ServiceCount;
44 EFI_UDP4_SERVICE_POINT Services[1];
45 } EFI_UDP4_VARIABLE_DATA;
46
47 //
48 //ICMP error definitions
49 //
50 #define EFI_NETWORK_UNREACHABLE EFIERR(100)
51 #define EFI_HOST_UNREACHABLE EFIERR(101)
52 #define EFI_PROTOCOL_UNREACHABLE EFIERR(102)
53 #define EFI_PORT_UNREACHABLE EFIERR(103)
54
55
56 typedef struct {
57 UINT32 FragmentLength;
58 VOID *FragmentBuffer;
59 } EFI_UDP4_FRAGMENT_DATA;
60
61 typedef struct {
62 EFI_IPv4_ADDRESS SourceAddress;
63 UINT16 SourcePort;
64 EFI_IPv4_ADDRESS DestinationAddress;
65 UINT16 DestinationPort;
66 } EFI_UDP4_SESSION_DATA;
67 typedef struct {
68 //
69 // Receiving Filters
70 //
71 BOOLEAN AcceptBroadcast;
72 BOOLEAN AcceptPromiscuous;
73 BOOLEAN AcceptAnyPort;
74 BOOLEAN AllowDuplicatePort;
75 //
76 // I/O parameters
77 //
78 UINT8 TypeOfService;
79 UINT8 TimeToLive;
80 BOOLEAN DoNotFragment;
81 UINT32 ReceiveTimeout;
82 UINT32 TransmitTimeout;
83 //
84 // Access Point
85 //
86 BOOLEAN UseDefaultAddress;
87 EFI_IPv4_ADDRESS StationAddress;
88 EFI_IPv4_ADDRESS SubnetMask;
89 UINT16 StationPort;
90 EFI_IPv4_ADDRESS RemoteAddress;
91 UINT16 RemotePort;
92 } EFI_UDP4_CONFIG_DATA;
93
94 typedef struct {
95 EFI_UDP4_SESSION_DATA *UdpSessionData; //OPTIONAL
96 EFI_IPv4_ADDRESS *GatewayAddress; //OPTIONAL
97 UINT32 DataLength;
98 UINT32 FragmentCount;
99 EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
100 } EFI_UDP4_TRANSMIT_DATA;
101
102 typedef struct {
103 EFI_TIME TimeStamp;
104 EFI_EVENT RecycleSignal;
105 EFI_UDP4_SESSION_DATA UdpSession;
106 UINT32 DataLength;
107 UINT32 FragmentCount;
108 EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
109 } EFI_UDP4_RECEIVE_DATA;
110
111
112 typedef struct {
113 EFI_EVENT Event;
114 EFI_STATUS Status;
115 union {
116 EFI_UDP4_RECEIVE_DATA *RxData;
117 EFI_UDP4_TRANSMIT_DATA *TxData;
118 } Packet;
119 } EFI_UDP4_COMPLETION_TOKEN;
120
121 /**
122 Reads the current operational settings.
123
124 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
125 @param Udp4ConfigData Pointer to the buffer to receive the current configuration data.
126 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
127 @param MnpConfigData Pointer to the managed network configuration data structure.
128 @param SnpModeData Pointer to the simple network mode data structure.
129
130 @retval EFI_SUCCESS The mode data was read.
131 @retval EFI_NOT_STARTED When Udp4ConfigData is queried, no configuration data is
132 available because this instance has not been started.
133 @retval EFI_INVALID_PARAMETER This is NULL.
134
135 **/
136 typedef
137 EFI_STATUS
138 (EFIAPI *EFI_UDP4_GET_MODE_DATA) (
139 IN EFI_UDP4_PROTOCOL *This,
140 OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
141 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
142 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
143 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
144 )
145 ;
146
147
148 /**
149 Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4
150 Protocol.
151
152 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
153 @param Udp4ConfigData Pointer to the buffer to receive the current configuration data.
154
155 @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
156 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
157 RARP, etc.) is not finished yet.
158 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
159 @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
160 and must be stopped/reset before it can be reconfigured.
161 @retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
162 and UdpConfigData.StationPort is already used by
163 other instance.
164 @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
165 EFI UDPv4 Protocol instance.
166 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
167 was not opened.
168
169 **/
170 typedef
171 EFI_STATUS
172 (EFIAPI *EFI_UDP4_CONFIGURE) (
173 IN EFI_UDP4_PROTOCOL *This,
174 IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
175 )
176 ;
177
178 /**
179 Joins and leaves multicast groups.
180
181 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
182 @param JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one
183 or all multicast groups.
184 @param MulticastAddress Pointer to multicast group address to join or leave.
185
186 @retval EFI_SUCCESS The operation completed successfully.
187 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
188 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
189 RARP, etc.) is not finished yet.
190 @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group.
191 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
192 - This is NULL.
193 - JoinFlag is TRUE and MulticastAddress is NULL.
194 - JoinFlag is TRUE and *MulticastAddress is not
195 a valid multicast address.
196 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
197 JoinFlag is TRUE).
198 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is
199 FALSE).
200 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
201
202 **/
203 typedef
204 EFI_STATUS
205 (EFIAPI *EFI_UDP4_GROUPS) (
206 IN EFI_UDP4_PROTOCOL *This,
207 IN BOOLEAN JoinFlag,
208 IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
209 )
210 ;
211
212 /**
213 Adds and deletes routing table entries.
214
215 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
216 @param DeleteRoute Set to TRUE to delete this route from the routing table.
217 Set to FALSE to add this route to the routing table.
218 @param SubnetAddress The destination network address that needs to be routed.
219 @param SubnetMask The subnet mask of SubnetAddress.
220 @param GatewayAddress The gateway IP address for this route.
221
222 @retval EFI_SUCCESS The operation completed successfully.
223 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
224 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
225 - RARP, etc.) is not finished yet.
226 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
227 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
228 @retval EFI_NOT_FOUND This route is not in the routing table.
229 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
230
231 **/
232 typedef
233 EFI_STATUS
234 (EFIAPI *EFI_UDP4_ROUTES) (
235 IN EFI_UDP4_PROTOCOL *This,
236 IN BOOLEAN DeleteRoute,
237 IN EFI_IPv4_ADDRESS *SubnetAddress,
238 IN EFI_IPv4_ADDRESS *SubnetMask,
239 IN EFI_IPv4_ADDRESS *GatewayAddress
240 )
241 ;
242
243 /**
244 Polls for incoming data packets and processes outgoing data packets.
245
246 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
247
248 @retval EFI_SUCCESS Incoming or outgoing data was processed.
249 @retval EFI_INVALID_PARAMETER This is NULL.
250 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
251 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
252
253 **/
254 typedef
255 EFI_STATUS
256 (EFIAPI *EFI_UDP4_POLL) (
257 IN EFI_UDP4_PROTOCOL *This
258 )
259 ;
260
261 /**
262 Places an asynchronous receive request into the receiving queue.
263
264 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
265 @param Token Pointer to a token that is associated with the receive data
266 descriptor.
267
268 @retval EFI_SUCCESS The receive completion token was cached.
269 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
270 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP, etc.)
271 is not finished yet.
272 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
273 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
274 resources (usually memory).
275 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
276 @retval EFI_ACCESS_DENIED A receive completion token with the same Token.Event was already in
277 the receive queue.
278 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
279
280 **/
281 typedef
282 EFI_STATUS
283 (EFIAPI *EFI_UDP4_RECEIVE) (
284 IN EFI_UDP4_PROTOCOL *This,
285 IN EFI_UDP4_COMPLETION_TOKEN *Token
286 )
287 ;
288
289 /**
290 Queues outgoing data packets into the transmit queue.
291
292 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
293 @param Token Pointer to the completion token that will be placed into the
294 transmit queue.
295
296 @retval EFI_SUCCESS The data has been queued for transmission.
297 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
298 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
299 RARP, etc.) is not finished yet.
300 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
301 @retval EFI_ACCESS_DENIED The transmit completion token with the same
302 Token.Event was already in the transmit queue.
303 @retval EFI_NOT_READY The completion token could not be queued because the
304 transmit queue is full.
305 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
306 @retval EFI_NOT_FOUND There is no route to the destination network or address.
307 @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP packet
308 size. Or the length of the IP header + UDP header + data
309 length is greater than MTU if DoNotFragment is TRUE.
310
311 **/
312 typedef
313 EFI_STATUS
314 (EFIAPI *EFI_UDP4_TRANSMIT) (
315 IN EFI_UDP4_PROTOCOL *This,
316 IN EFI_UDP4_COMPLETION_TOKEN *Token
317 )
318 ;
319
320 /**
321 Aborts an asynchronous transmit or receive request.
322
323 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
324 @param Token Pointer to a token that has been issued by
325 EFI_UDP4_PROTOCOL.Transmit() or
326 EFI_UDP4_PROTOCOL.Receive().If NULL, all pending
327 tokens are aborted.
328
329 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
330 was signaled. When Token is NULL, all pending requests are
331 aborted and their events are signaled.
332 @retval EFI_INVALID_PARAMETER This is NULL.
333 @retval EFI_NOT_STARTED This instance has not been started.
334 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
335 RARP, etc.) is not finished yet.
336 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
337 not found in the transmit or receive queue. It has either completed
338 or was not issued by Transmit() and Receive().
339
340 **/
341 typedef
342 EFI_STATUS
343 (EFIAPI *EFI_UDP4_CANCEL)(
344 IN EFI_UDP4_PROTOCOL *This,
345 IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
346 )
347 ;
348
349 struct _EFI_UDP4_PROTOCOL {
350 EFI_UDP4_GET_MODE_DATA GetModeData;
351 EFI_UDP4_CONFIGURE Configure;
352 EFI_UDP4_GROUPS Groups;
353 EFI_UDP4_ROUTES Routes;
354 EFI_UDP4_TRANSMIT Transmit;
355 EFI_UDP4_RECEIVE Receive;
356 EFI_UDP4_CANCEL Cancel;
357 EFI_UDP4_POLL Poll;
358 };
359
360 extern EFI_GUID gEfiUdp4ServiceBindingProtocolGuid;
361 extern EFI_GUID gEfiUdp4ProtocolGuid;
362
363 #endif