]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Mtftp6.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
9344f092 9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
bce46f7e 10\r
11 @par Revision Reference:\r
5899caf0 12 This Protocol is introduced in UEFI Specification 2.2\r
5d6a636c 13\r
14**/\r
15\r
16#ifndef __EFI_MTFTP6_PROTOCOL_H__\r
17#define __EFI_MTFTP6_PROTOCOL_H__\r
18\r
5d6a636c 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
2f88bd3a
MK
29typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;\r
30typedef struct _EFI_MTFTP6_TOKEN EFI_MTFTP6_TOKEN;\r
5d6a636c 31\r
32///\r
33/// MTFTP Packet OpCodes\r
34///@{\r
2f88bd3a
MK
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
5d6a636c 44///@}\r
45\r
46///\r
47/// MTFTP ERROR Packet ErrorCodes\r
48///@{\r
49///\r
bce46f7e 50/// The error code is not defined. See the error message in the packet (if any) for details.\r
5d6a636c 51///\r
2f88bd3a 52#define EFI_MTFTP6_ERRORCODE_NOT_DEFINED 0\r
5d6a636c 53///\r
54/// The file was not found.\r
55///\r
2f88bd3a 56#define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND 1\r
5d6a636c 57///\r
58/// There was an access violation.\r
59///\r
2f88bd3a 60#define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION 2\r
5d6a636c 61///\r
62/// The disk was full or its allocation was exceeded.\r
63///\r
2f88bd3a 64#define EFI_MTFTP6_ERRORCODE_DISK_FULL 3\r
5d6a636c 65///\r
66/// The MTFTPv6 operation was illegal.\r
67///\r
2f88bd3a 68#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 4\r
5d6a636c 69///\r
70/// The transfer ID is unknown.\r
71///\r
2f88bd3a 72#define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r
5d6a636c 73///\r
74/// The file already exists.\r
75///\r
2f88bd3a 76#define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS 6\r
5d6a636c 77///\r
78/// There is no such user.\r
79///\r
2f88bd3a 80#define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER 7\r
5d6a636c 81///\r
82/// The request has been denied due to option negotiation.\r
83///\r
2f88bd3a 84#define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED 8\r
5d6a636c 85///@}\r
86\r
87#pragma pack(1)\r
88\r
89///\r
bce46f7e 90/// EFI_MTFTP6_REQ_HEADER\r
5d6a636c 91///\r
92typedef 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
bce46f7e 105/// EFI_MTFTP6_OACK_HEADER\r
5d6a636c 106///\r
107typedef 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
bce46f7e 119/// EFI_MTFTP6_DATA_HEADER\r
5d6a636c 120///\r
121typedef 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
bce46f7e 137/// EFI_MTFTP6_ACK_HEADER\r
5d6a636c 138///\r
139typedef 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
bce46f7e 151/// EFI_MTFTP6_DATA8_HEADER\r
5d6a636c 152///\r
153typedef 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
bce46f7e 169/// EFI_MTFTP6_ACK8_HEADER\r
5d6a636c 170///\r
171typedef 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
bce46f7e 183/// EFI_MTFTP6_ERROR_HEADER\r
5d6a636c 184///\r
185typedef struct {\r
186 ///\r
187 /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.\r
188 ///\r
189 UINT16 OpCode;\r
190 ///\r
bce46f7e 191 /// The error number as defined by the MTFTPv6 packet error codes.\r
5d6a636c 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
bce46f7e 201/// EFI_MTFTP6_PACKET\r
5d6a636c 202///\r
203typedef union {\r
2f88bd3a
MK
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
5d6a636c 213} EFI_MTFTP6_PACKET;\r
214\r
215#pragma pack()\r
216\r
217///\r
218/// EFI_MTFTP6_CONFIG_DATA\r
219///\r
220typedef struct {\r
221 ///\r
bce46f7e 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
5d6a636c 224 /// configured IP addresses in the underlying IPv6 driver.\r
225 ///\r
2f88bd3a 226 EFI_IPv6_ADDRESS StationIp;\r
5d6a636c 227 ///\r
228 /// Local port number. Set to zero to use the automatically assigned port number.\r
229 ///\r
2f88bd3a 230 UINT16 LocalPort;\r
5d6a636c 231 ///\r
232 /// The IP address of the MTFTPv6 server.\r
233 ///\r
2f88bd3a 234 EFI_IPv6_ADDRESS ServerIp;\r
5d6a636c 235 ///\r
bce46f7e 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
5d6a636c 238 /// defaults to 69.\r
2f88bd3a 239 UINT16 InitialServerPort;\r
5d6a636c 240 ///\r
241 /// The number of times to transmit MTFTPv6 request packets and wait for a response.\r
242 ///\r
2f88bd3a 243 UINT16 TryCount;\r
5d6a636c 244 ///\r
bce46f7e 245 /// The number of seconds to wait for a response after sending the MTFTPv6 request packet.\r
5d6a636c 246 ///\r
2f88bd3a 247 UINT16 TimeoutValue;\r
5d6a636c 248} EFI_MTFTP6_CONFIG_DATA;\r
249\r
250///\r
251/// EFI_MTFTP6_MODE_DATA\r
252///\r
253typedef struct {\r
254 ///\r
255 /// The configuration data of this instance.\r
256 ///\r
2f88bd3a 257 EFI_MTFTP6_CONFIG_DATA ConfigData;\r
5d6a636c 258 ///\r
259 /// The number of option strings in the following SupportedOptions array.\r
260 ///\r
2f88bd3a 261 UINT8 SupportedOptionCount;\r
5d6a636c 262 ///\r
4f077902 263 /// An array of null-terminated ASCII option strings that are recognized and supported by\r
bce46f7e 264 /// this EFI MTFTPv6 Protocol driver implementation. The buffer is\r
5d6a636c 265 /// read only to the caller and the caller should NOT free the buffer.\r
266 ///\r
2f88bd3a 267 UINT8 **SupportedOptions;\r
5d6a636c 268} EFI_MTFTP6_MODE_DATA;\r
269\r
270///\r
271/// EFI_MTFTP_OVERRIDE_DATA\r
272///\r
273typedef struct {\r
274 ///\r
bce46f7e 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
5d6a636c 277 ///\r
2f88bd3a 278 EFI_IPv6_ADDRESS ServerIp;\r
5d6a636c 279 ///\r
bce46f7e 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
5d6a636c 282 ///\r
2f88bd3a 283 UINT16 ServerPort;\r
5d6a636c 284 ///\r
bce46f7e 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
5d6a636c 287 /// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
288 ///\r
2f88bd3a 289 UINT16 TryCount;\r
5d6a636c 290 ///\r
bce46f7e 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
5d6a636c 293 /// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
294 ///\r
2f88bd3a 295 UINT16 TimeoutValue;\r
5d6a636c 296} EFI_MTFTP6_OVERRIDE_DATA;\r
297\r
298///\r
299/// EFI_MTFTP6_OPTION\r
300///\r
301typedef struct {\r
2f88bd3a
MK
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
5d6a636c 304} EFI_MTFTP6_OPTION;\r
305\r
306/**\r
bce46f7e 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
5d6a636c 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
bce46f7e 313 that is returned from this function will abort the current download process.\r
5d6a636c 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
00b7cc0f 321 @retval EFI_SUCCESS Operation success.\r
5d6a636c 322 @retval Others Aborts session.\r
323\r
324**/\r
325typedef\r
bce46f7e 326EFI_STATUS\r
327(EFIAPI *EFI_MTFTP6_CHECK_PACKET)(\r
5d6a636c 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
bce46f7e 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
5d6a636c 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
bce46f7e 341 that is returned from this function will abort the current download process.\r
5d6a636c 342\r
343 @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
bce46f7e 344 @param[in] Token The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or\r
5d6a636c 345 EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()\r
346 functions by the caller.\r
347\r
00b7cc0f 348 @retval EFI_SUCCESS Operation success.\r
5d6a636c 349 @retval Others Aborts session.\r
350\r
351**/\r
bce46f7e 352typedef\r
353EFI_STATUS\r
354(EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)(\r
5d6a636c 355 IN EFI_MTFTP6_PROTOCOL *This,\r
356 IN EFI_MTFTP6_TOKEN *Token\r
357 );\r
358\r
359/**\r
bce46f7e 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
5d6a636c 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
bce46f7e 371 @param[in, out] Length Indicates the length of the raw data wanted on input, and the\r
5d6a636c 372 length the data available on output.\r
373 @param[out] Buffer Pointer to the buffer where the data is stored.\r
374\r
00b7cc0f 375 @retval EFI_SUCCESS Operation success.\r
5d6a636c 376 @retval Others Aborts session.\r
377\r
378**/\r
bce46f7e 379typedef\r
380EFI_STATUS\r
381(EFIAPI *EFI_MTFTP6_PACKET_NEEDED)(\r
5d6a636c 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
388struct _EFI_MTFTP6_TOKEN {\r
389 ///\r
bce46f7e 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
5d6a636c 392 /// Defined Status values are listed below.\r
393 ///\r
2f88bd3a 394 EFI_STATUS Status;\r
5d6a636c 395 ///\r
bce46f7e 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
5d6a636c 399 ///\r
2f88bd3a 400 EFI_EVENT Event;\r
5d6a636c 401 ///\r
bce46f7e 402 /// If not NULL, the data that will be used to override the existing\r
403 /// configure data.\r
5d6a636c 404 ///\r
2f88bd3a 405 EFI_MTFTP6_OVERRIDE_DATA *OverrideData;\r
5d6a636c 406 ///\r
4f077902 407 /// Pointer to the null-terminated ASCII file name string.\r
5d6a636c 408 ///\r
2f88bd3a 409 UINT8 *Filename;\r
5d6a636c 410 ///\r
4f077902 411 /// Pointer to the null-terminated ASCII mode string. If NULL, octet is used.\r
5d6a636c 412 ///\r
2f88bd3a 413 UINT8 *ModeStr;\r
5d6a636c 414 ///\r
415 /// Number of option/value string pairs.\r
416 ///\r
2f88bd3a 417 UINT32 OptionCount;\r
5d6a636c 418 ///\r
bce46f7e 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
5d6a636c 423 /// remote server without being changed.\r
424 ///\r
2f88bd3a 425 EFI_MTFTP6_OPTION *OptionList;\r
5d6a636c 426 ///\r
bce46f7e 427 /// On input, the size, in bytes, of Buffer. On output, the number\r
5d6a636c 428 /// of bytes transferred.\r
429 ///\r
2f88bd3a 430 UINT64 BufferSize;\r
5d6a636c 431 ///\r
bce46f7e 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
5d6a636c 434 /// MTFTPv6 server is read from here. Ignored if BufferSize is zero.\r
435 ///\r
2f88bd3a 436 VOID *Buffer;\r
5d6a636c 437 ///\r
bce46f7e 438 /// Pointer to the context that will be used by CheckPacket,\r
5d6a636c 439 /// TimeoutCallback and PacketNeeded.\r
440 ///\r
2f88bd3a 441 VOID *Context;\r
5d6a636c 442 ///\r
bce46f7e 443 /// Pointer to the callback function to check the contents of the\r
444 /// received packet.\r
5d6a636c 445 ///\r
2f88bd3a 446 EFI_MTFTP6_CHECK_PACKET CheckPacket;\r
5d6a636c 447 ///\r
448 /// Pointer to the function to be called when a timeout occurs.\r
449 ///\r
2f88bd3a 450 EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback;\r
5d6a636c 451 ///\r
bce46f7e 452 /// Pointer to the function to provide the needed packet contents.\r
5d6a636c 453 /// Only used in WriteFile() operation.\r
454 ///\r
2f88bd3a 455 EFI_MTFTP6_PACKET_NEEDED PacketNeeded;\r
5d6a636c 456};\r
457\r
458/**\r
459 Read the current operational settings.\r
bce46f7e 460\r
5d6a636c 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
bce46f7e 473typedef\r
474EFI_STATUS\r
5d6a636c 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
bce46f7e 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
5d6a636c 490 overridden in later operations.\r
491\r
492 @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
bce46f7e 493 @param[in] MtftpConfigData Pointer to the configuration data structure.\r
5d6a636c 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
bce46f7e 498 - MtftpConfigData.StationIp is neither zero nor one\r
5d6a636c 499 of the configured IP addresses in the underlying IPv6 driver.\r
500 - MtftpCofigData.ServerIp is not a valid IPv6 unicast address.\r
bce46f7e 501 @retval EFI_ACCESS_DENIED - The configuration could not be changed at this time because there\r
abbfadd7 502 is some MTFTP background operation in progress.\r
503 - MtftpCofigData.LocalPort is already in use.\r
bce46f7e 504 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
abbfadd7 505 address for this instance, but no source address was available for use.\r
bce46f7e 506 @retval EFI_OUT_OF_RESOURCES The EFI MTFTPv6 Protocol driver instance data could not be\r
abbfadd7 507 allocated.\r
bce46f7e 508 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI\r
abbfadd7 509 MTFTPv6 Protocol driver instance is not configured.\r
510\r
5d6a636c 511\r
512**/\r
bce46f7e 513typedef\r
514EFI_STATUS\r
5d6a636c 515(EFIAPI *EFI_MTFTP6_CONFIGURE)(\r
516 IN EFI_MTFTP6_PROTOCOL *This,\r
01a54966 517 IN EFI_MTFTP6_CONFIG_DATA *MtftpConfigData OPTIONAL\r
2f88bd3a 518 );\r
5d6a636c 519\r
520/**\r
521 Get information about a file from an MTFTPv6 server.\r
bce46f7e 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
5d6a636c 526 timeout expires.\r
527\r
528 @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
bce46f7e 529 @param[in] OverrideData Data that is used to override the existing parameters. If NULL, the\r
5d6a636c 530 default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()\r
bce46f7e 531 function are used.\r
4f077902
SZ
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
5d6a636c 534 @param[in] OptionCount Number of option/value string pairs in OptionList.\r
bce46f7e 535 @param[in] OptionList Pointer to array of option/value string pairs. Ignored if\r
5d6a636c 536 OptionCount is zero.\r
537 @param[out] PacketLength The number of bytes in the returned packet.\r
bce46f7e 538 @param[out] Packet The pointer to the received packet. This buffer must be freed by\r
5d6a636c 539 the caller.\r
540\r
abbfadd7 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
bce46f7e 549 @retval EFI_UNSUPPORTED One or more options in the OptionList are unsupported by\r
abbfadd7 550 this implementation.\r
551 @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
bce46f7e 552 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
abbfadd7 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
c5c3e7e2 565 @retval EFI_NO_MEDIA There was a media error.\r
5d6a636c 566\r
567**/\r
bce46f7e 568typedef\r
569EFI_STATUS\r
5d6a636c 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
2f88bd3a 579 );\r
5d6a636c 580\r
581/**\r
582 Parse the options in an MTFTPv6 OACK packet.\r
583\r
bce46f7e 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
5d6a636c 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
bce46f7e 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
5d6a636c 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
bce46f7e 611typedef\r
612EFI_STATUS\r
5d6a636c 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
bce46f7e 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
5d6a636c 627 Token.Event is signaled if it is not NULL.\r
bce46f7e 628\r
5d6a636c 629 Data can be downloaded from the MTFTPv6 server into either of the following locations:\r
bce46f7e 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
5d6a636c 632\r
bce46f7e 633 If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket\r
5d6a636c 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
bce46f7e 637 @param[in] Token Pointer to the token structure to provide the parameters that are\r
5d6a636c 638 used in this operation.\r
639\r
abbfadd7 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
c5c3e7e2 653 @retval EFI_NO_MEDIA There was a media error.\r
5d6a636c 654\r
655**/\r
bce46f7e 656typedef\r
657EFI_STATUS\r
5d6a636c 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
bce46f7e 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
5d6a636c 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
bce46f7e 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
5d6a636c 681 buffer.\r
682\r
683 @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
bce46f7e 684 @param[in] Token Pointer to the token structure to provide the parameters that are\r
5d6a636c 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
bce46f7e 697 @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not\r
5d6a636c 698 supported by this implementation.\r
699 @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
bce46f7e 700 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
5d6a636c 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
bce46f7e 708typedef\r
709EFI_STATUS\r
5d6a636c 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
bce46f7e 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
5d6a636c 720 to the server is built with the option list that was provided by caller, if present.\r
bce46f7e 721\r
5d6a636c 722 The file information that the server returns is put into either of the following locations:\r
bce46f7e 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
5d6a636c 727 will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r
bce46f7e 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
5d6a636c 734 null character are not present.\r
bce46f7e 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
5d6a636c 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
bce46f7e 742 @param[in] Token Pointer to the token structure to provide the parameters that are\r
5d6a636c 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
bce46f7e 755 @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not\r
5d6a636c 756 supported by this implementation.\r
757 @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
bce46f7e 758 @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source\r
5d6a636c 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
bce46f7e 766typedef\r
767EFI_STATUS\r
5d6a636c 768(EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(\r
769 IN EFI_MTFTP6_PROTOCOL *This,\r
770 IN EFI_MTFTP6_TOKEN *Token\r
2f88bd3a 771 );\r
5d6a636c 772\r
773/**\r
bce46f7e 774 Polls for incoming data packets and processes outgoing data packets.\r
5d6a636c 775\r
bce46f7e 776 The Poll() function can be used by network drivers and applications to increase the rate that data\r
5d6a636c 777 packets are moved between the communications device and the transmit and receive queues.\r
bce46f7e 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
5d6a636c 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
bce46f7e 788 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
5d6a636c 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
793typedef\r
794EFI_STATUS\r
795(EFIAPI *EFI_MTFTP6_POLL)(\r
796 IN EFI_MTFTP6_PROTOCOL *This\r
797 );\r
798\r
799///\r
bce46f7e 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
5d6a636c 802/// driver and EFI IPv6 Protocol driver.\r
803///\r
804struct _EFI_MTFTP6_PROTOCOL {\r
2f88bd3a
MK
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
5d6a636c 813};\r
814\r
2f88bd3a
MK
815extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;\r
816extern EFI_GUID gEfiMtftp6ProtocolGuid;\r
5d6a636c 817\r
818#endif\r