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