]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | UEFI Multicast Trivial File Transfer Protocol v6 Definition, which is built upon\r | |
3 | the EFI UDPv6 Protocol and provides basic services for client-side unicast and/or\r | |
4 | multicast TFTP operations.\r | |
5 | \r | |
6 | Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
7 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r | |
8 | \r | |
9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
10 | \r | |
11 | @par Revision Reference:\r | |
12 | This Protocol is introduced in UEFI Specification 2.2\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __EFI_MTFTP6_PROTOCOL_H__\r | |
17 | #define __EFI_MTFTP6_PROTOCOL_H__\r | |
18 | \r | |
19 | #define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \\r | |
20 | { \\r | |
21 | 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 } \\r | |
22 | }\r | |
23 | \r | |
24 | #define EFI_MTFTP6_PROTOCOL_GUID \\r | |
25 | { \\r | |
26 | 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 } \\r | |
27 | }\r | |
28 | \r | |
29 | typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;\r | |
30 | typedef struct _EFI_MTFTP6_TOKEN EFI_MTFTP6_TOKEN;\r | |
31 | \r | |
32 | ///\r | |
33 | /// MTFTP Packet OpCodes\r | |
34 | ///@{\r | |
35 | #define EFI_MTFTP6_OPCODE_RRQ 1 ///< The MTFTPv6 packet is a read request.\r | |
36 | #define EFI_MTFTP6_OPCODE_WRQ 2 ///< The MTFTPv6 packet is a write request.\r | |
37 | #define EFI_MTFTP6_OPCODE_DATA 3 ///< The MTFTPv6 packet is a data packet.\r | |
38 | #define EFI_MTFTP6_OPCODE_ACK 4 ///< The MTFTPv6 packet is an acknowledgement packet.\r | |
39 | #define EFI_MTFTP6_OPCODE_ERROR 5 ///< The MTFTPv6 packet is an error packet.\r | |
40 | #define EFI_MTFTP6_OPCODE_OACK 6 ///< The MTFTPv6 packet is an option acknowledgement packet.\r | |
41 | #define EFI_MTFTP6_OPCODE_DIR 7 ///< The MTFTPv6 packet is a directory query packet.\r | |
42 | #define EFI_MTFTP6_OPCODE_DATA8 8 ///< The MTFTPv6 packet is a data packet with a big block number.\r | |
43 | #define EFI_MTFTP6_OPCODE_ACK8 9 ///< The MTFTPv6 packet is an acknowledgement packet with a big block number.\r | |
44 | ///@}\r | |
45 | \r | |
46 | ///\r | |
47 | /// MTFTP ERROR Packet ErrorCodes\r | |
48 | ///@{\r | |
49 | ///\r | |
50 | /// The error code is not defined. See the error message in the packet (if any) for details.\r | |
51 | ///\r | |
52 | #define EFI_MTFTP6_ERRORCODE_NOT_DEFINED 0\r | |
53 | ///\r | |
54 | /// The file was not found.\r | |
55 | ///\r | |
56 | #define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND 1\r | |
57 | ///\r | |
58 | /// There was an access violation.\r | |
59 | ///\r | |
60 | #define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION 2\r | |
61 | ///\r | |
62 | /// The disk was full or its allocation was exceeded.\r | |
63 | ///\r | |
64 | #define EFI_MTFTP6_ERRORCODE_DISK_FULL 3\r | |
65 | ///\r | |
66 | /// The MTFTPv6 operation was illegal.\r | |
67 | ///\r | |
68 | #define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 4\r | |
69 | ///\r | |
70 | /// The transfer ID is unknown.\r | |
71 | ///\r | |
72 | #define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r | |
73 | ///\r | |
74 | /// The file already exists.\r | |
75 | ///\r | |
76 | #define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS 6\r | |
77 | ///\r | |
78 | /// There is no such user.\r | |
79 | ///\r | |
80 | #define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER 7\r | |
81 | ///\r | |
82 | /// The request has been denied due to option negotiation.\r | |
83 | ///\r | |
84 | #define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED 8\r | |
85 | ///@}\r | |
86 | \r | |
87 | #pragma pack(1)\r | |
88 | \r | |
89 | ///\r | |
90 | /// EFI_MTFTP6_REQ_HEADER\r | |
91 | ///\r | |
92 | typedef struct {\r | |
93 | ///\r | |
94 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_RRQ for a read request\r | |
95 | /// or OpCode = EFI_MTFTP6_OPCODE_WRQ for a write request.\r | |
96 | ///\r | |
97 | UINT16 OpCode;\r | |
98 | ///\r | |
99 | /// The file name to be downloaded or uploaded.\r | |
100 | ///\r | |
101 | UINT8 Filename[1];\r | |
102 | } EFI_MTFTP6_REQ_HEADER;\r | |
103 | \r | |
104 | ///\r | |
105 | /// EFI_MTFTP6_OACK_HEADER\r | |
106 | ///\r | |
107 | typedef struct {\r | |
108 | ///\r | |
109 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_OACK.\r | |
110 | ///\r | |
111 | UINT16 OpCode;\r | |
112 | ///\r | |
113 | /// The option strings in the option acknowledgement packet.\r | |
114 | ///\r | |
115 | UINT8 Data[1];\r | |
116 | } EFI_MTFTP6_OACK_HEADER;\r | |
117 | \r | |
118 | ///\r | |
119 | /// EFI_MTFTP6_DATA_HEADER\r | |
120 | ///\r | |
121 | typedef struct {\r | |
122 | ///\r | |
123 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA.\r | |
124 | ///\r | |
125 | UINT16 OpCode;\r | |
126 | ///\r | |
127 | /// Block number of this data packet.\r | |
128 | ///\r | |
129 | UINT16 Block;\r | |
130 | ///\r | |
131 | /// The content of this data packet.\r | |
132 | ///\r | |
133 | UINT8 Data[1];\r | |
134 | } EFI_MTFTP6_DATA_HEADER;\r | |
135 | \r | |
136 | ///\r | |
137 | /// EFI_MTFTP6_ACK_HEADER\r | |
138 | ///\r | |
139 | typedef struct {\r | |
140 | ///\r | |
141 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK.\r | |
142 | ///\r | |
143 | UINT16 OpCode;\r | |
144 | ///\r | |
145 | /// The block number of the data packet that is being acknowledged.\r | |
146 | ///\r | |
147 | UINT16 Block[1];\r | |
148 | } EFI_MTFTP6_ACK_HEADER;\r | |
149 | \r | |
150 | ///\r | |
151 | /// EFI_MTFTP6_DATA8_HEADER\r | |
152 | ///\r | |
153 | typedef struct {\r | |
154 | ///\r | |
155 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA8.\r | |
156 | ///\r | |
157 | UINT16 OpCode;\r | |
158 | ///\r | |
159 | /// The block number of data packet.\r | |
160 | ///\r | |
161 | UINT64 Block;\r | |
162 | ///\r | |
163 | /// The content of this data packet.\r | |
164 | ///\r | |
165 | UINT8 Data[1];\r | |
166 | } EFI_MTFTP6_DATA8_HEADER;\r | |
167 | \r | |
168 | ///\r | |
169 | /// EFI_MTFTP6_ACK8_HEADER\r | |
170 | ///\r | |
171 | typedef struct {\r | |
172 | ///\r | |
173 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK8.\r | |
174 | ///\r | |
175 | UINT16 OpCode;\r | |
176 | ///\r | |
177 | /// The block number of the data packet that is being acknowledged.\r | |
178 | ///\r | |
179 | UINT64 Block[1];\r | |
180 | } EFI_MTFTP6_ACK8_HEADER;\r | |
181 | \r | |
182 | ///\r | |
183 | /// EFI_MTFTP6_ERROR_HEADER\r | |
184 | ///\r | |
185 | typedef struct {\r | |
186 | ///\r | |
187 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.\r | |
188 | ///\r | |
189 | UINT16 OpCode;\r | |
190 | ///\r | |
191 | /// The error number as defined by the MTFTPv6 packet error codes.\r | |
192 | ///\r | |
193 | UINT16 ErrorCode;\r | |
194 | ///\r | |
195 | /// Error message string.\r | |
196 | ///\r | |
197 | UINT8 ErrorMessage[1];\r | |
198 | } EFI_MTFTP6_ERROR_HEADER;\r | |
199 | \r | |
200 | ///\r | |
201 | /// EFI_MTFTP6_PACKET\r | |
202 | ///\r | |
203 | typedef union {\r | |
204 | UINT16 OpCode; ///< Type of packets as defined by the MTFTPv6 packet opcodes.\r | |
205 | EFI_MTFTP6_REQ_HEADER Rrq; ///< Read request packet header.\r | |
206 | EFI_MTFTP6_REQ_HEADER Wrq; ///< write request packet header.\r | |
207 | EFI_MTFTP6_OACK_HEADER Oack; ///< Option acknowledge packet header.\r | |
208 | EFI_MTFTP6_DATA_HEADER Data; ///< Data packet header.\r | |
209 | EFI_MTFTP6_ACK_HEADER Ack; ///< Acknowledgement packet header.\r | |
210 | EFI_MTFTP6_DATA8_HEADER Data8; ///< Data packet header with big block number.\r | |
211 | EFI_MTFTP6_ACK8_HEADER Ack8; ///< Acknowledgement header with big block number.\r | |
212 | EFI_MTFTP6_ERROR_HEADER Error; ///< Error packet header.\r | |
213 | } EFI_MTFTP6_PACKET;\r | |
214 | \r | |
215 | #pragma pack()\r | |
216 | \r | |
217 | ///\r | |
218 | /// EFI_MTFTP6_CONFIG_DATA\r | |
219 | ///\r | |
220 | typedef struct {\r | |
221 | ///\r | |
222 | /// The local IP address to use. Set to zero to let the underlying IPv6\r | |
223 | /// driver choose a source address. If not zero it must be one of the\r | |
224 | /// configured IP addresses in the underlying IPv6 driver.\r | |
225 | ///\r | |
226 | EFI_IPv6_ADDRESS StationIp;\r | |
227 | ///\r | |
228 | /// Local port number. Set to zero to use the automatically assigned port number.\r | |
229 | ///\r | |
230 | UINT16 LocalPort;\r | |
231 | ///\r | |
232 | /// The IP address of the MTFTPv6 server.\r | |
233 | ///\r | |
234 | EFI_IPv6_ADDRESS ServerIp;\r | |
235 | ///\r | |
236 | /// The initial MTFTPv6 server port number. Request packets are\r | |
237 | /// sent to this port. This number is almost always 69 and using zero\r | |
238 | /// defaults to 69.\r | |
239 | UINT16 InitialServerPort;\r | |
240 | ///\r | |
241 | /// The number of times to transmit MTFTPv6 request packets and wait for a response.\r | |
242 | ///\r | |
243 | UINT16 TryCount;\r | |
244 | ///\r | |
245 | /// The number of seconds to wait for a response after sending the MTFTPv6 request packet.\r | |
246 | ///\r | |
247 | UINT16 TimeoutValue;\r | |
248 | } EFI_MTFTP6_CONFIG_DATA;\r | |
249 | \r | |
250 | ///\r | |
251 | /// EFI_MTFTP6_MODE_DATA\r | |
252 | ///\r | |
253 | typedef struct {\r | |
254 | ///\r | |
255 | /// The configuration data of this instance.\r | |
256 | ///\r | |
257 | EFI_MTFTP6_CONFIG_DATA ConfigData;\r | |
258 | ///\r | |
259 | /// The number of option strings in the following SupportedOptions array.\r | |
260 | ///\r | |
261 | UINT8 SupportedOptionCount;\r | |
262 | ///\r | |
263 | /// An array of null-terminated ASCII option strings that are recognized and supported by\r | |
264 | /// this EFI MTFTPv6 Protocol driver implementation. The buffer is\r | |
265 | /// read only to the caller and the caller should NOT free the buffer.\r | |
266 | ///\r | |
267 | UINT8 **SupportedOptions;\r | |
268 | } EFI_MTFTP6_MODE_DATA;\r | |
269 | \r | |
270 | ///\r | |
271 | /// EFI_MTFTP_OVERRIDE_DATA\r | |
272 | ///\r | |
273 | typedef struct {\r | |
274 | ///\r | |
275 | /// IP address of the MTFTPv6 server. If set to all zero, the value that\r | |
276 | /// was set by the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r | |
277 | ///\r | |
278 | EFI_IPv6_ADDRESS ServerIp;\r | |
279 | ///\r | |
280 | /// MTFTPv6 server port number. If set to zero, it will use the value\r | |
281 | /// that was set by the EFI_MTFTP6_PROTOCOL.Configure() function.\r | |
282 | ///\r | |
283 | UINT16 ServerPort;\r | |
284 | ///\r | |
285 | /// Number of times to transmit MTFTPv6 request packets and wait\r | |
286 | /// for a response. If set to zero, the value that was set by\r | |
287 | /// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.\r | |
288 | ///\r | |
289 | UINT16 TryCount;\r | |
290 | ///\r | |
291 | /// Number of seconds to wait for a response after sending the\r | |
292 | /// MTFTPv6 request packet. If set to zero, the value that was set by\r | |
293 | /// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r | |
294 | ///\r | |
295 | UINT16 TimeoutValue;\r | |
296 | } EFI_MTFTP6_OVERRIDE_DATA;\r | |
297 | \r | |
298 | ///\r | |
299 | /// EFI_MTFTP6_OPTION\r | |
300 | ///\r | |
301 | typedef struct {\r | |
302 | UINT8 *OptionStr; ///< Pointer to the null-terminated ASCII MTFTPv6 option string.\r | |
303 | UINT8 *ValueStr; ///< Pointer to the null-terminated ASCII MTFTPv6 value string.\r | |
304 | } EFI_MTFTP6_OPTION;\r | |
305 | \r | |
306 | /**\r | |
307 | EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the\r | |
308 | timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or\r | |
309 | EFI_MTFTP6_PROTOCOL.ReadDirectory() functions.\r | |
310 | \r | |
311 | Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r | |
312 | function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r | |
313 | that is returned from this function will abort the current download process.\r | |
314 | \r | |
315 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
316 | @param[in] Token The token that the caller provided in the EFI_MTFTP6_PROTOCOl.ReadFile(),\r | |
317 | WriteFile() or ReadDirectory() function.\r | |
318 | @param[in] PacketLen Indicates the length of the packet.\r | |
319 | @param[in] Packet Pointer to an MTFTPv6 packet.\r | |
320 | \r | |
321 | @retval EFI_SUCCESS Operation success.\r | |
322 | @retval Others Aborts session.\r | |
323 | \r | |
324 | **/\r | |
325 | typedef\r | |
326 | EFI_STATUS\r | |
327 | (EFIAPI *EFI_MTFTP6_CHECK_PACKET)(\r | |
328 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
329 | IN EFI_MTFTP6_TOKEN *Token,\r | |
330 | IN UINT16 PacketLen,\r | |
331 | IN EFI_MTFTP6_PACKET *Packet\r | |
332 | );\r | |
333 | \r | |
334 | /**\r | |
335 | EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the\r | |
336 | timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or\r | |
337 | EFI_MTFTP6_PROTOCOL.ReadDirectory() functions.\r | |
338 | \r | |
339 | Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r | |
340 | function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r | |
341 | that is returned from this function will abort the current download process.\r | |
342 | \r | |
343 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
344 | @param[in] Token The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or\r | |
345 | EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()\r | |
346 | functions by the caller.\r | |
347 | \r | |
348 | @retval EFI_SUCCESS Operation success.\r | |
349 | @retval Others Aborts session.\r | |
350 | \r | |
351 | **/\r | |
352 | typedef\r | |
353 | EFI_STATUS\r | |
354 | (EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)(\r | |
355 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
356 | IN EFI_MTFTP6_TOKEN *Token\r | |
357 | );\r | |
358 | \r | |
359 | /**\r | |
360 | EFI_MTFTP6_PACKET_NEEDED is a callback function that the caller provides to feed data to the\r | |
361 | EFI_MTFTP6_PROTOCOL.WriteFile() function.\r | |
362 | \r | |
363 | EFI_MTFTP6_PACKET_NEEDED provides another mechanism for the caller to provide data to upload\r | |
364 | other than a static buffer. The EFI MTFTP6 Protocol driver always calls EFI_MTFTP6_PACKET_NEEDED\r | |
365 | to get packet data from the caller if no static buffer was given in the initial call to\r | |
366 | EFI_MTFTP6_PROTOCOL.WriteFile() function. Setting *Length to zero signals the end of the session.\r | |
367 | Returning a status code other than EFI_SUCCESS aborts the session.\r | |
368 | \r | |
369 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
370 | @param[in] Token The token provided in the EFI_MTFTP6_PROTOCOL.WriteFile() by the caller.\r | |
371 | @param[in, out] Length Indicates the length of the raw data wanted on input, and the\r | |
372 | length the data available on output.\r | |
373 | @param[out] Buffer Pointer to the buffer where the data is stored.\r | |
374 | \r | |
375 | @retval EFI_SUCCESS Operation success.\r | |
376 | @retval Others Aborts session.\r | |
377 | \r | |
378 | **/\r | |
379 | typedef\r | |
380 | EFI_STATUS\r | |
381 | (EFIAPI *EFI_MTFTP6_PACKET_NEEDED)(\r | |
382 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
383 | IN EFI_MTFTP6_TOKEN *Token,\r | |
384 | IN OUT UINT16 *Length,\r | |
385 | OUT VOID **Buffer\r | |
386 | );\r | |
387 | \r | |
388 | struct _EFI_MTFTP6_TOKEN {\r | |
389 | ///\r | |
390 | /// The status that is returned to the caller at the end of the operation\r | |
391 | /// to indicate whether this operation completed successfully.\r | |
392 | /// Defined Status values are listed below.\r | |
393 | ///\r | |
394 | EFI_STATUS Status;\r | |
395 | ///\r | |
396 | /// The event that will be signaled when the operation completes. If\r | |
397 | /// set to NULL, the corresponding function will wait until the read or\r | |
398 | /// write operation finishes. The type of Event must be EVT_NOTIFY_SIGNAL.\r | |
399 | ///\r | |
400 | EFI_EVENT Event;\r | |
401 | ///\r | |
402 | /// If not NULL, the data that will be used to override the existing\r | |
403 | /// configure data.\r | |
404 | ///\r | |
405 | EFI_MTFTP6_OVERRIDE_DATA *OverrideData;\r | |
406 | ///\r | |
407 | /// Pointer to the null-terminated ASCII file name string.\r | |
408 | ///\r | |
409 | UINT8 *Filename;\r | |
410 | ///\r | |
411 | /// Pointer to the null-terminated ASCII mode string. If NULL, octet is used.\r | |
412 | ///\r | |
413 | UINT8 *ModeStr;\r | |
414 | ///\r | |
415 | /// Number of option/value string pairs.\r | |
416 | ///\r | |
417 | UINT32 OptionCount;\r | |
418 | ///\r | |
419 | /// Pointer to an array of option/value string pairs. Ignored if\r | |
420 | /// OptionCount is zero. Both a remote server and this driver\r | |
421 | /// implementation should support these options. If one or more\r | |
422 | /// options are unrecognized by this implementation, it is sent to the\r | |
423 | /// remote server without being changed.\r | |
424 | ///\r | |
425 | EFI_MTFTP6_OPTION *OptionList;\r | |
426 | ///\r | |
427 | /// On input, the size, in bytes, of Buffer. On output, the number\r | |
428 | /// of bytes transferred.\r | |
429 | ///\r | |
430 | UINT64 BufferSize;\r | |
431 | ///\r | |
432 | /// Pointer to the data buffer. Data that is downloaded from the\r | |
433 | /// MTFTPv6 server is stored here. Data that is uploaded to the\r | |
434 | /// MTFTPv6 server is read from here. Ignored if BufferSize is zero.\r | |
435 | ///\r | |
436 | VOID *Buffer;\r | |
437 | ///\r | |
438 | /// Pointer to the context that will be used by CheckPacket,\r | |
439 | /// TimeoutCallback and PacketNeeded.\r | |
440 | ///\r | |
441 | VOID *Context;\r | |
442 | ///\r | |
443 | /// Pointer to the callback function to check the contents of the\r | |
444 | /// received packet.\r | |
445 | ///\r | |
446 | EFI_MTFTP6_CHECK_PACKET CheckPacket;\r | |
447 | ///\r | |
448 | /// Pointer to the function to be called when a timeout occurs.\r | |
449 | ///\r | |
450 | EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback;\r | |
451 | ///\r | |
452 | /// Pointer to the function to provide the needed packet contents.\r | |
453 | /// Only used in WriteFile() operation.\r | |
454 | ///\r | |
455 | EFI_MTFTP6_PACKET_NEEDED PacketNeeded;\r | |
456 | };\r | |
457 | \r | |
458 | /**\r | |
459 | Read the current operational settings.\r | |
460 | \r | |
461 | The GetModeData() function reads the current operational settings of this EFI MTFTPv6\r | |
462 | Protocol driver instance.\r | |
463 | \r | |
464 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
465 | @param[out] ModeData The buffer in which the EFI MTFTPv6 Protocol driver mode\r | |
466 | data is returned.\r | |
467 | \r | |
468 | @retval EFI_SUCCESS The configuration data was successfully returned.\r | |
469 | @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r | |
470 | @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r | |
471 | \r | |
472 | **/\r | |
473 | typedef\r | |
474 | EFI_STATUS\r | |
475 | (EFIAPI *EFI_MTFTP6_GET_MODE_DATA)(\r | |
476 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
477 | OUT EFI_MTFTP6_MODE_DATA *ModeData\r | |
478 | );\r | |
479 | \r | |
480 | /**\r | |
481 | Initializes, changes, or resets the default operational setting for this EFI MTFTPv6\r | |
482 | Protocol driver instance.\r | |
483 | \r | |
484 | The Configure() function is used to set and change the configuration data for this EFI\r | |
485 | MTFTPv6 Protocol driver instance. The configuration data can be reset to startup defaults by calling\r | |
486 | Configure() with MtftpConfigData set to NULL. Whenever the instance is reset, any\r | |
487 | pending operation is aborted. By changing the EFI MTFTPv6 Protocol driver instance configuration\r | |
488 | data, the client can connect to different MTFTPv6 servers. The configuration parameters in\r | |
489 | MtftpConfigData are used as the default parameters in later MTFTPv6 operations and can be\r | |
490 | overridden in later operations.\r | |
491 | \r | |
492 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
493 | @param[in] MtftpConfigData Pointer to the configuration data structure.\r | |
494 | \r | |
495 | @retval EFI_SUCCESS The EFI MTFTPv6 Protocol instance was configured successfully.\r | |
496 | @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r | |
497 | - This is NULL.\r | |
498 | - MtftpConfigData.StationIp is neither zero nor one\r | |
499 | of the configured IP addresses in the underlying IPv6 driver.\r | |
500 | - MtftpCofigData.ServerIp is not a valid IPv6 unicast address.\r | |
501 | @retval EFI_ACCESS_DENIED - The configuration could not be changed at this time because there\r | |
502 | is some MTFTP background operation in progress.\r | |
503 | - MtftpCofigData.LocalPort is already in use.\r | |
504 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
505 | address for this instance, but no source address was available for use.\r | |
506 | @retval EFI_OUT_OF_RESOURCES The EFI MTFTPv6 Protocol driver instance data could not be\r | |
507 | allocated.\r | |
508 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI\r | |
509 | MTFTPv6 Protocol driver instance is not configured.\r | |
510 | \r | |
511 | \r | |
512 | **/\r | |
513 | typedef\r | |
514 | EFI_STATUS\r | |
515 | (EFIAPI *EFI_MTFTP6_CONFIGURE)(\r | |
516 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
517 | IN EFI_MTFTP6_CONFIG_DATA *MtftpConfigData OPTIONAL\r | |
518 | );\r | |
519 | \r | |
520 | /**\r | |
521 | Get information about a file from an MTFTPv6 server.\r | |
522 | \r | |
523 | The GetInfo() function assembles an MTFTPv6 request packet with options, sends it to the\r | |
524 | MTFTPv6 server, and may return an MTFTPv6 OACK, MTFTPv6 ERROR, or ICMP ERROR packet.\r | |
525 | Retries occur only if no response packets are received from the MTFTPv6 server before the\r | |
526 | timeout expires.\r | |
527 | \r | |
528 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
529 | @param[in] OverrideData Data that is used to override the existing parameters. If NULL, the\r | |
530 | default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()\r | |
531 | function are used.\r | |
532 | @param[in] Filename Pointer to null-terminated ASCII file name string.\r | |
533 | @param[in] ModeStr Pointer to null-terminated ASCII mode string. If NULL, octet will be used\r | |
534 | @param[in] OptionCount Number of option/value string pairs in OptionList.\r | |
535 | @param[in] OptionList Pointer to array of option/value string pairs. Ignored if\r | |
536 | OptionCount is zero.\r | |
537 | @param[out] PacketLength The number of bytes in the returned packet.\r | |
538 | @param[out] Packet The pointer to the received packet. This buffer must be freed by\r | |
539 | the caller.\r | |
540 | \r | |
541 | @retval EFI_SUCCESS An MTFTPv6 OACK packet was received and is in the Packet.\r | |
542 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
543 | - This is NULL.\r | |
544 | - Filename is NULL\r | |
545 | - OptionCount is not zero and OptionList is NULL.\r | |
546 | - One or more options in OptionList have wrong format.\r | |
547 | - PacketLength is NULL.\r | |
548 | - OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
549 | @retval EFI_UNSUPPORTED One or more options in the OptionList are unsupported by\r | |
550 | this implementation.\r | |
551 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
552 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
553 | address for this instance, but no source address was available for use.\r | |
554 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
555 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
556 | @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received and is in the Packet.\r | |
557 | @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received and the Packet is set to NULL.\r | |
558 | @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received and the Packet is set to NULL.\r | |
559 | @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received and the Packet is set to NULL.\r | |
560 | @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received and the Packet is set to NULL.\r | |
561 | @retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received and the Packet is set to NULL.\r | |
562 | @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received and is in the Packet.\r | |
563 | @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r | |
564 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
565 | @retval EFI_NO_MEDIA There was a media error.\r | |
566 | \r | |
567 | **/\r | |
568 | typedef\r | |
569 | EFI_STATUS\r | |
570 | (EFIAPI *EFI_MTFTP6_GET_INFO)(\r | |
571 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
572 | IN EFI_MTFTP6_OVERRIDE_DATA *OverrideData OPTIONAL,\r | |
573 | IN UINT8 *Filename,\r | |
574 | IN UINT8 *ModeStr OPTIONAL,\r | |
575 | IN UINT8 OptionCount,\r | |
576 | IN EFI_MTFTP6_OPTION *OptionList OPTIONAL,\r | |
577 | OUT UINT32 *PacketLength,\r | |
578 | OUT EFI_MTFTP6_PACKET **Packet OPTIONAL\r | |
579 | );\r | |
580 | \r | |
581 | /**\r | |
582 | Parse the options in an MTFTPv6 OACK packet.\r | |
583 | \r | |
584 | The ParseOptions() function parses the option fields in an MTFTPv6 OACK packet and\r | |
585 | returns the number of options that were found and optionally a list of pointers to\r | |
586 | the options in the packet.\r | |
587 | If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned\r | |
588 | and *OptionCount and *OptionList stop at the last valid option.\r | |
589 | \r | |
590 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
591 | @param[in] PacketLen Length of the OACK packet to be parsed.\r | |
592 | @param[in] Packet Pointer to the OACK packet to be parsed.\r | |
593 | @param[out] OptionCount Pointer to the number of options in the following OptionList.\r | |
594 | @param[out] OptionList Pointer to EFI_MTFTP6_OPTION storage. Each pointer in the\r | |
595 | OptionList points to the corresponding MTFTP option buffer\r | |
596 | in the Packet. Call the EFI Boot Service FreePool() to\r | |
597 | release the OptionList if the options in this OptionList\r | |
598 | are not needed any more.\r | |
599 | \r | |
600 | @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and\r | |
601 | OptionList parameters have been updated.\r | |
602 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
603 | - PacketLen is 0.\r | |
604 | - Packet is NULL or Packet is not a valid MTFTPv6 packet.\r | |
605 | - OptionCount is NULL.\r | |
606 | @retval EFI_NOT_FOUND No options were found in the OACK packet.\r | |
607 | @retval EFI_OUT_OF_RESOURCES Storage for the OptionList array can not be allocated.\r | |
608 | @retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.\r | |
609 | \r | |
610 | **/\r | |
611 | typedef\r | |
612 | EFI_STATUS\r | |
613 | (EFIAPI *EFI_MTFTP6_PARSE_OPTIONS)(\r | |
614 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
615 | IN UINT32 PacketLen,\r | |
616 | IN EFI_MTFTP6_PACKET *Packet,\r | |
617 | OUT UINT32 *OptionCount,\r | |
618 | OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL\r | |
619 | );\r | |
620 | \r | |
621 | /**\r | |
622 | Download a file from an MTFTPv6 server.\r | |
623 | \r | |
624 | The ReadFile() function is used to initialize and start an MTFTPv6 download process and\r | |
625 | optionally wait for completion. When the download operation completes, whether successfully or\r | |
626 | not, the Token.Status field is updated by the EFI MTFTPv6 Protocol driver and then\r | |
627 | Token.Event is signaled if it is not NULL.\r | |
628 | \r | |
629 | Data can be downloaded from the MTFTPv6 server into either of the following locations:\r | |
630 | - A fixed buffer that is pointed to by Token.Buffer\r | |
631 | - A download service function that is pointed to by Token.CheckPacket\r | |
632 | \r | |
633 | If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket\r | |
634 | will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r | |
635 | \r | |
636 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
637 | @param[in] Token Pointer to the token structure to provide the parameters that are\r | |
638 | used in this operation.\r | |
639 | \r | |
640 | @retval EFI_SUCCESS The data file has been transferred successfully.\r | |
641 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
642 | @retval EFI_BUFFER_TOO_SMALL BufferSize is not zero but not large enough to hold the\r | |
643 | downloaded data in downloading process.\r | |
644 | @retval EFI_ABORTED Current operation is aborted by user.\r | |
645 | @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received.\r | |
646 | @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received.\r | |
647 | @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received.\r | |
648 | @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received.\r | |
649 | @retval EFI_ICMP_ERROR An ICMP ERROR packet was received.\r | |
650 | @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r | |
651 | @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received.\r | |
652 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
653 | @retval EFI_NO_MEDIA There was a media error.\r | |
654 | \r | |
655 | **/\r | |
656 | typedef\r | |
657 | EFI_STATUS\r | |
658 | (EFIAPI *EFI_MTFTP6_READ_FILE)(\r | |
659 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
660 | IN EFI_MTFTP6_TOKEN *Token\r | |
661 | );\r | |
662 | \r | |
663 | /**\r | |
664 | Send a file to an MTFTPv6 server. May be unsupported in some implementations.\r | |
665 | \r | |
666 | The WriteFile() function is used to initialize an uploading operation with the given option list\r | |
667 | and optionally wait for completion. If one or more of the options is not supported by the server, the\r | |
668 | unsupported options are ignored and a standard TFTP process starts instead. When the upload\r | |
669 | process completes, whether successfully or not, Token.Event is signaled, and the EFI MTFTPv6\r | |
670 | Protocol driver updates Token.Status.\r | |
671 | \r | |
672 | The caller can supply the data to be uploaded in the following two modes:\r | |
673 | - Through the user-provided buffer\r | |
674 | - Through a callback function\r | |
675 | \r | |
676 | With the user-provided buffer, the Token.BufferSize field indicates the length of the buffer,\r | |
677 | and the driver will upload the data in the buffer. With an EFI_MTFTP6_PACKET_NEEDED\r | |
678 | callback function, the driver will call this callback function to get more data from the user to upload.\r | |
679 | See the definition of EFI_MTFTP6_PACKET_NEEDED for more information. These two modes\r | |
680 | cannot be used at the same time. The callback function will be ignored if the user provides the\r | |
681 | buffer.\r | |
682 | \r | |
683 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
684 | @param[in] Token Pointer to the token structure to provide the parameters that are\r | |
685 | used in this operation.\r | |
686 | \r | |
687 | @retval EFI_SUCCESS The upload session has started.\r | |
688 | @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r | |
689 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
690 | - This is NULL.\r | |
691 | - Token is NULL.\r | |
692 | - Token.Filename is NULL.\r | |
693 | - Token.OptionCount is not zero and Token.OptionList is NULL.\r | |
694 | - One or more options in Token.OptionList have wrong format.\r | |
695 | - Token.Buffer and Token.PacketNeeded are both NULL.\r | |
696 | - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
697 | @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not\r | |
698 | supported by this implementation.\r | |
699 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
700 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
701 | address for this instance, but no source address was available for use.\r | |
702 | @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r | |
703 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
704 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
705 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
706 | \r | |
707 | **/\r | |
708 | typedef\r | |
709 | EFI_STATUS\r | |
710 | (EFIAPI *EFI_MTFTP6_WRITE_FILE)(\r | |
711 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
712 | IN EFI_MTFTP6_TOKEN *Token\r | |
713 | );\r | |
714 | \r | |
715 | /**\r | |
716 | Download a data file directory from an MTFTPv6 server. May be unsupported in some implementations.\r | |
717 | \r | |
718 | The ReadDirectory() function is used to return a list of files on the MTFTPv6 server that are\r | |
719 | logically (or operationally) related to Token.Filename. The directory request packet that is sent\r | |
720 | to the server is built with the option list that was provided by caller, if present.\r | |
721 | \r | |
722 | The file information that the server returns is put into either of the following locations:\r | |
723 | - A fixed buffer that is pointed to by Token.Buffer\r | |
724 | - A download service function that is pointed to by Token.CheckPacket\r | |
725 | \r | |
726 | If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket\r | |
727 | will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r | |
728 | \r | |
729 | The returned directory listing in the Token.Buffer or EFI_MTFTP6_PACKET consists of a list\r | |
730 | of two or three variable-length ASCII strings, each terminated by a null character, for each file in the\r | |
731 | directory. If the multicast option is involved, the first field of each directory entry is the static\r | |
732 | multicast IP address and UDP port number that is associated with the file name. The format of the\r | |
733 | field is ip:ip:ip:ip:port. If the multicast option is not involved, this field and its terminating\r | |
734 | null character are not present.\r | |
735 | \r | |
736 | The next field of each directory entry is the file name and the last field is the file information string.\r | |
737 | The information string contains the file size and the create/modify timestamp. The format of the\r | |
738 | information string is filesize yyyy-mm-dd hh:mm:ss:ffff. The timestamp is\r | |
739 | Coordinated Universal Time (UTC; also known as Greenwich Mean Time [GMT]).\r | |
740 | \r | |
741 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
742 | @param[in] Token Pointer to the token structure to provide the parameters that are\r | |
743 | used in this operation.\r | |
744 | \r | |
745 | @retval EFI_SUCCESS The MTFTPv6 related file "directory" has been downloaded.\r | |
746 | @retval EFI_UNSUPPORTED The EFI MTFTPv6 Protocol driver does not support this function.\r | |
747 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
748 | - This is NULL.\r | |
749 | - Token is NULL.\r | |
750 | - Token.Filename is NULL.\r | |
751 | - Token.OptionCount is not zero and Token.OptionList is NULL.\r | |
752 | - One or more options in Token.OptionList have wrong format.\r | |
753 | - Token.Buffer and Token.CheckPacket are both NULL.\r | |
754 | - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
755 | @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not\r | |
756 | supported by this implementation.\r | |
757 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
758 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r | |
759 | address for this instance, but no source address was available for use.\r | |
760 | @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r | |
761 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
762 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
763 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
764 | \r | |
765 | **/\r | |
766 | typedef\r | |
767 | EFI_STATUS\r | |
768 | (EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(\r | |
769 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
770 | IN EFI_MTFTP6_TOKEN *Token\r | |
771 | );\r | |
772 | \r | |
773 | /**\r | |
774 | Polls for incoming data packets and processes outgoing data packets.\r | |
775 | \r | |
776 | The Poll() function can be used by network drivers and applications to increase the rate that data\r | |
777 | packets are moved between the communications device and the transmit and receive queues.\r | |
778 | In some systems, the periodic timer event in the managed network driver may not poll the\r | |
779 | underlying communications device fast enough to transmit and/or receive all data packets without\r | |
780 | missing incoming packets or dropping outgoing packets. Drivers and applications that are\r | |
781 | experiencing packet loss should try calling the Poll() function more often.\r | |
782 | \r | |
783 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
784 | \r | |
785 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
786 | @retval EFI_NOT_STARTED This EFI MTFTPv6 Protocol instance has not been started.\r | |
787 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
788 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
789 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r | |
790 | Consider increasing the polling rate.\r | |
791 | \r | |
792 | **/\r | |
793 | typedef\r | |
794 | EFI_STATUS\r | |
795 | (EFIAPI *EFI_MTFTP6_POLL)(\r | |
796 | IN EFI_MTFTP6_PROTOCOL *This\r | |
797 | );\r | |
798 | \r | |
799 | ///\r | |
800 | /// The EFI_MTFTP6_PROTOCOL is designed to be used by UEFI drivers and applications to transmit\r | |
801 | /// and receive data files. The EFI MTFTPv6 Protocol driver uses the underlying EFI UDPv6 Protocol\r | |
802 | /// driver and EFI IPv6 Protocol driver.\r | |
803 | ///\r | |
804 | struct _EFI_MTFTP6_PROTOCOL {\r | |
805 | EFI_MTFTP6_GET_MODE_DATA GetModeData;\r | |
806 | EFI_MTFTP6_CONFIGURE Configure;\r | |
807 | EFI_MTFTP6_GET_INFO GetInfo;\r | |
808 | EFI_MTFTP6_PARSE_OPTIONS ParseOptions;\r | |
809 | EFI_MTFTP6_READ_FILE ReadFile;\r | |
810 | EFI_MTFTP6_WRITE_FILE WriteFile;\r | |
811 | EFI_MTFTP6_READ_DIRECTORY ReadDirectory;\r | |
812 | EFI_MTFTP6_POLL Poll;\r | |
813 | };\r | |
814 | \r | |
815 | extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;\r | |
816 | extern EFI_GUID gEfiMtftp6ProtocolGuid;\r | |
817 | \r | |
818 | #endif\r |