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