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