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