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