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