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