--- /dev/null
+/** @file\r
+ UEFI Multicast Trivial File Tranfer Protocol v6 Definition, which is built upon\r
+ the EFI UDPv6 Protocol and provides basic services for client-side unicast and/or\r
+ multicast TFTP operations.\r
+\r
+Copyright (c) 2008 - 2009, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __EFI_MTFTP6_PROTOCOL_H__\r
+#define __EFI_MTFTP6_PROTOCOL_H__\r
+\r
+\r
+#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \\r
+ { \\r
+ 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 } \\r
+ }\r
+\r
+#define EFI_MTFTP6_PROTOCOL_GUID \\r
+ { \\r
+ 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 } \\r
+ }\r
+\r
+typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;\r
+typedef struct _EFI_MTFTP6_TOKEN EFI_MTFTP6_TOKEN;\r
+\r
+///\r
+/// MTFTP Packet OpCodes\r
+///@{\r
+#define EFI_MTFTP6_OPCODE_RRQ 1 ///< The MTFTPv6 packet is a read request.\r
+#define EFI_MTFTP6_OPCODE_WRQ 2 ///< The MTFTPv6 packet is a write request.\r
+#define EFI_MTFTP6_OPCODE_DATA 3 ///< The MTFTPv6 packet is a data packet.\r
+#define EFI_MTFTP6_OPCODE_ACK 4 ///< The MTFTPv6 packet is an acknowledgement packet.\r
+#define EFI_MTFTP6_OPCODE_ERROR 5 ///< The MTFTPv6 packet is an error packet.\r
+#define EFI_MTFTP6_OPCODE_OACK 6 ///< The MTFTPv6 packet is an option acknowledgement packet.\r
+#define EFI_MTFTP6_OPCODE_DIR 7 ///< The MTFTPv6 packet is a directory query packet.\r
+#define EFI_MTFTP6_OPCODE_DATA8 8 ///< The MTFTPv6 packet is a data packet with a big block number. \r
+#define EFI_MTFTP6_OPCODE_ACK8 9 ///< The MTFTPv6 packet is an acknowledgement packet with a big block number.\r
+///@}\r
+\r
+///\r
+/// MTFTP ERROR Packet ErrorCodes\r
+///@{\r
+///\r
+/// The error code is not defined. See the error message in the packet (if any) for details. \r
+///\r
+#define EFI_MTFTP6_ERRORCODE_NOT_DEFINED 0\r
+///\r
+/// The file was not found.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND 1\r
+///\r
+/// There was an access violation.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION 2\r
+///\r
+/// The disk was full or its allocation was exceeded.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_DISK_FULL 3\r
+///\r
+/// The MTFTPv6 operation was illegal.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 6\r
+///\r
+/// The transfer ID is unknown.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r
+///\r
+/// The file already exists.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS 6\r
+///\r
+/// There is no such user.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER 7\r
+///\r
+/// The request has been denied due to option negotiation.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED 8\r
+///@}\r
+\r
+#pragma pack(1)\r
+\r
+///\r
+/// EFI_MTFTP6_REQ_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_RRQ for a read request\r
+ /// or OpCode = EFI_MTFTP6_OPCODE_WRQ for a write request.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The file name to be downloaded or uploaded.\r
+ ///\r
+ UINT8 Filename[1];\r
+} EFI_MTFTP6_REQ_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_OACK_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_OACK.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The option strings in the option acknowledgement packet.\r
+ ///\r
+ UINT8 Data[1];\r
+} EFI_MTFTP6_OACK_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_DATA_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// Block number of this data packet.\r
+ ///\r
+ UINT16 Block;\r
+ ///\r
+ /// The content of this data packet.\r
+ ///\r
+ UINT8 Data[1];\r
+} EFI_MTFTP6_DATA_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ACK_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The block number of the data packet that is being acknowledged.\r
+ ///\r
+ UINT16 Block[1];\r
+} EFI_MTFTP6_ACK_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_DATA8_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA8.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The block number of data packet.\r
+ ///\r
+ UINT64 Block;\r
+ ///\r
+ /// The content of this data packet.\r
+ ///\r
+ UINT8 Data[1];\r
+} EFI_MTFTP6_DATA8_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ACK8_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK8.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The block number of the data packet that is being acknowledged.\r
+ ///\r
+ UINT64 Block[1];\r
+} EFI_MTFTP6_ACK8_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ERROR_HEADER \r
+///\r
+typedef struct {\r
+ ///\r
+ /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.\r
+ ///\r
+ UINT16 OpCode;\r
+ ///\r
+ /// The error number as defined by the MTFTPv6 packet error codes. \r
+ ///\r
+ UINT16 ErrorCode;\r
+ ///\r
+ /// Error message string.\r
+ ///\r
+ UINT8 ErrorMessage[1];\r
+} EFI_MTFTP6_ERROR_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_PACKET \r
+///\r
+typedef union {\r
+ UINT16 OpCode; ///< Type of packets as defined by the MTFTPv6 packet opcodes.\r
+ EFI_MTFTP6_REQ_HEADER Rrq; ///< Read request packet header.\r
+ EFI_MTFTP6_REQ_HEADER Wrq; ///< write request packet header.\r
+ EFI_MTFTP6_OACK_HEADER Oack; ///< Option acknowledge packet header.\r
+ EFI_MTFTP6_DATA_HEADER Data; ///< Data packet header.\r
+ EFI_MTFTP6_ACK_HEADER Ack; ///< Acknowledgement packet header.\r
+ EFI_MTFTP6_DATA8_HEADER Data8; ///< Data packet header with big block number.\r
+ EFI_MTFTP6_ACK8_HEADER Ack8; ///< Acknowledgement header with big block number.\r
+ EFI_MTFTP6_ERROR_HEADER Error; ///< Error packet header.\r
+} EFI_MTFTP6_PACKET;\r
+\r
+#pragma pack()\r
+\r
+///\r
+/// EFI_MTFTP6_CONFIG_DATA\r
+///\r
+typedef struct {\r
+ ///\r
+ /// The local IP address to use. Set to zero to let the underlying IPv6 \r
+ /// driver choose a source address. If not zero it must be one of the \r
+ /// configured IP addresses in the underlying IPv6 driver.\r
+ ///\r
+ EFI_IPv6_ADDRESS StationIp;\r
+ ///\r
+ /// Local port number. Set to zero to use the automatically assigned port number.\r
+ ///\r
+ UINT16 LocalPort;\r
+ ///\r
+ /// The IP address of the MTFTPv6 server.\r
+ ///\r
+ EFI_IPv6_ADDRESS ServerIp;\r
+ ///\r
+ /// The initial MTFTPv6 server port number. Request packets are \r
+ /// sent to this port. This number is almost always 69 and using zero \r
+ /// defaults to 69.\r
+ UINT16 InitialServerPort;\r
+ ///\r
+ /// The number of times to transmit MTFTPv6 request packets and wait for a response.\r
+ ///\r
+ UINT16 TryCount;\r
+ ///\r
+ /// The number of seconds to wait for a response after sending the MTFTPv6 request packet. \r
+ ///\r
+ UINT16 TimeoutValue;\r
+} EFI_MTFTP6_CONFIG_DATA;\r
+\r
+///\r
+/// EFI_MTFTP6_MODE_DATA\r
+///\r
+typedef struct {\r
+ ///\r
+ /// The configuration data of this instance.\r
+ ///\r
+ EFI_MTFTP6_CONFIG_DATA ConfigData;\r
+ ///\r
+ /// The number of option strings in the following SupportedOptions array.\r
+ ///\r
+ UINT8 SupportedOptionCount;\r
+ ///\r
+ /// An array of option strings that are recognized and supported by \r
+ /// this EFI MTFTPv6 Protocol driver implementation. The buffer is \r
+ /// read only to the caller and the caller should NOT free the buffer.\r
+ ///\r
+ UINT8 **SupportedOptions;\r
+} EFI_MTFTP6_MODE_DATA;\r
+\r
+///\r
+/// EFI_MTFTP_OVERRIDE_DATA\r
+///\r
+typedef struct {\r
+ ///\r
+ /// IP address of the MTFTPv6 server. If set to all zero, the value that \r
+ /// was set by the EFI_MTFTP6_PROTOCOL.Configure() function will be used. \r
+ ///\r
+ EFI_IPv6_ADDRESS ServerIp;\r
+ ///\r
+ /// MTFTPv6 server port number. If set to zero, it will use the value \r
+ /// that was set by the EFI_MTFTP6_PROTOCOL.Configure() function. \r
+ ///\r
+ UINT16 ServerPort;\r
+ ///\r
+ /// Number of times to transmit MTFTPv6 request packets and wait \r
+ /// for a response. If set to zero, the value that was set by \r
+ /// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
+ ///\r
+ UINT16 TryCount;\r
+ ///\r
+ /// Number of seconds to wait for a response after sending the \r
+ /// MTFTPv6 request packet. If set to zero, the value that was set by \r
+ /// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
+ ///\r
+ UINT16 TimeoutValue;\r
+} EFI_MTFTP6_OVERRIDE_DATA;\r
+\r
+///\r
+/// EFI_MTFTP6_OPTION\r
+///\r
+typedef struct {\r
+ UINT8 *OptionStr; ///< Pointer to the ASCIIZ MTFTPv6 option string. \r
+ UINT8 *ValueStr; ///< Pointer to the ASCIIZ MTFTPv6 value string.\r
+} EFI_MTFTP6_OPTION;\r
+\r
+/**\r
+ EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r
+ timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r
+ EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r
+ \r
+ Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r
+ function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r
+ that is returned from this function will abort the current download process. \r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token The token that the caller provided in the EFI_MTFTP6_PROTOCOl.ReadFile(),\r
+ WriteFile() or ReadDirectory() function.\r
+ @param[in] PacketLen Indicates the length of the packet.\r
+ @param[in] Packet Pointer to an MTFTPv6 packet.\r
+\r
+ @retval EFI_SUCCESS Operation sucess.\r
+ @retval Others Aborts session.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_CHECK_PACKET)( \r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token,\r
+ IN UINT16 PacketLen,\r
+ IN EFI_MTFTP6_PACKET *Packet\r
+ );\r
+\r
+/**\r
+ EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r
+ timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r
+ EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r
+ \r
+ Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r
+ function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r
+ that is returned from this function will abort the current download process. \r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or \r
+ EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()\r
+ functions by the caller.\r
+\r
+ @retval EFI_SUCCESS Operation sucess.\r
+ @retval Others Aborts session.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)( \r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ EFI_MTFTP6_PACKET_NEEDED is a callback function that the caller provides to feed data to the \r
+ EFI_MTFTP6_PROTOCOL.WriteFile() function. \r
+ \r
+ EFI_MTFTP6_PACKET_NEEDED provides another mechanism for the caller to provide data to upload\r
+ other than a static buffer. The EFI MTFTP6 Protocol driver always calls EFI_MTFTP6_PACKET_NEEDED\r
+ to get packet data from the caller if no static buffer was given in the initial call to\r
+ EFI_MTFTP6_PROTOCOL.WriteFile() function. Setting *Length to zero signals the end of the session.\r
+ Returning a status code other than EFI_SUCCESS aborts the session.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token The token provided in the EFI_MTFTP6_PROTOCOL.WriteFile() by the caller.\r
+ @param[in, out] Length Indicates the length of the raw data wanted on input, and the \r
+ length the data available on output.\r
+ @param[out] Buffer Pointer to the buffer where the data is stored.\r
+\r
+ @retval EFI_SUCCESS Operation sucess.\r
+ @retval Others Aborts session.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_PACKET_NEEDED)( \r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token,\r
+ IN OUT UINT16 *Length,\r
+ OUT VOID **Buffer\r
+ );\r
+\r
+struct _EFI_MTFTP6_TOKEN {\r
+ ///\r
+ /// The status that is returned to the caller at the end of the operation \r
+ /// to indicate whether this operation completed successfully. \r
+ /// Defined Status values are listed below.\r
+ ///\r
+ EFI_STATUS Status;\r
+ ///\r
+ /// The event that will be signaled when the operation completes. If \r
+ /// set to NULL, the corresponding function will wait until the read or \r
+ /// write operation finishes. The type of Event must be EVT_NOTIFY_SIGNAL. \r
+ ///\r
+ EFI_EVENT Event;\r
+ ///\r
+ /// If not NULL, the data that will be used to override the existing \r
+ /// configure data. \r
+ ///\r
+ EFI_MTFTP6_OVERRIDE_DATA *OverrideData;\r
+ ///\r
+ /// Pointer to the ASCIIZ file name string.\r
+ ///\r
+ UINT8 *Filename;\r
+ ///\r
+ /// Pointer to the ASCIIZ mode string. If NULL, octet is used.\r
+ ///\r
+ UINT8 *ModeStr;\r
+ ///\r
+ /// Number of option/value string pairs.\r
+ ///\r
+ UINT32 OptionCount;\r
+ ///\r
+ /// Pointer to an array of option/value string pairs. Ignored if \r
+ /// OptionCount is zero. Both a remote server and this driver \r
+ /// implementation should support these options. If one or more \r
+ /// options are unrecognized by this implementation, it is sent to the \r
+ /// remote server without being changed.\r
+ ///\r
+ EFI_MTFTP6_OPTION *OptionList;\r
+ ///\r
+ /// On input, the size, in bytes, of Buffer. On output, the number \r
+ /// of bytes transferred.\r
+ ///\r
+ UINT64 BufferSize; \r
+ ///\r
+ /// Pointer to the data buffer. Data that is downloaded from the \r
+ /// MTFTPv6 server is stored here. Data that is uploaded to the \r
+ /// MTFTPv6 server is read from here. Ignored if BufferSize is zero.\r
+ ///\r
+ VOID *Buffer;\r
+ ///\r
+ /// Pointer to the context that will be used by CheckPacket, \r
+ /// TimeoutCallback and PacketNeeded.\r
+ ///\r
+ VOID *Context;\r
+ ///\r
+ /// Pointer to the callback function to check the contents of the \r
+ /// received packet. \r
+ ///\r
+ EFI_MTFTP6_CHECK_PACKET CheckPacket;\r
+ ///\r
+ /// Pointer to the function to be called when a timeout occurs.\r
+ ///\r
+ EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback;\r
+ ///\r
+ /// Pointer to the function to provide the needed packet contents. \r
+ /// Only used in WriteFile() operation.\r
+ ///\r
+ EFI_MTFTP6_PACKET_NEEDED PacketNeeded;\r
+};\r
+\r
+/**\r
+ Read the current operational settings.\r
+ \r
+ The GetModeData() function reads the current operational settings of this EFI MTFTPv6\r
+ Protocol driver instance.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[out] ModeData The buffer in which the EFI MTFTPv6 Protocol driver mode\r
+ data is returned.\r
+\r
+ @retval EFI_SUCCESS The configuration data was successfully returned.\r
+ @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r
+ @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_GET_MODE_DATA)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ OUT EFI_MTFTP6_MODE_DATA *ModeData\r
+ );\r
+\r
+/**\r
+ Initializes, changes, or resets the default operational setting for this EFI MTFTPv6\r
+ Protocol driver instance.\r
+ \r
+ The Configure() function is used to set and change the configuration data for this EFI \r
+ MTFTPv6 Protocol driver instance. The configuration data can be reset to startup defaults by calling \r
+ Configure() with MtftpConfigData set to NULL. Whenever the instance is reset, any \r
+ pending operation is aborted. By changing the EFI MTFTPv6 Protocol driver instance configuration \r
+ data, the client can connect to different MTFTPv6 servers. The configuration parameters in \r
+ MtftpConfigData are used as the default parameters in later MTFTPv6 operations and can be \r
+ overridden in later operations.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] MtftpConfigData Pointer to the configuration data structure. \r
+\r
+ @retval EFI_SUCCESS The EFI MTFTPv6 Protocol instance was configured successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+ - This is NULL.\r
+ - MtftpConfigData.StationIp is neither zero nor one \r
+ of the configured IP addresses in the underlying IPv6 driver.\r
+ - MtftpCofigData.ServerIp is not a valid IPv6 unicast address.\r
+ - The StationIP and LocalPort is already in use\r
+ @retval EFI_ACCESS_DENIED The configuration could not be changed at this time because there \r
+ is some MTFTP background operation in progress.\r
+ @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r
+ address for this instance, but no source address was available for use\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_CONFIGURE)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_CONFIG_DATA *MtftpConfigData OPTIONAL\r
+);\r
+\r
+/**\r
+ Get information about a file from an MTFTPv6 server.\r
+ \r
+ The GetInfo() function assembles an MTFTPv6 request packet with options, sends it to the \r
+ MTFTPv6 server, and may return an MTFTPv6 OACK, MTFTPv6 ERROR, or ICMP ERROR packet. \r
+ Retries occur only if no response packets are received from the MTFTPv6 server before the \r
+ timeout expires.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] OverrideData Data that is used to override the existing parameters. If NULL, the \r
+ default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()\r
+ function are used. \r
+ @param[in] Filename Pointer to ASCIIZ file name string.\r
+ @param[in] ModeStr Pointer to ASCIIZ mode string. If NULL, octet will be used \r
+ @param[in] OptionCount Number of option/value string pairs in OptionList.\r
+ @param[in] OptionList Pointer to array of option/value string pairs. Ignored if \r
+ OptionCount is zero.\r
+ @param[out] PacketLength The number of bytes in the returned packet.\r
+ @param[out] Packet The pointer to the received packet. This buffer must be freed by \r
+ the caller.\r
+\r
+ @retval EFI_SUCCESS An MTFTPv6 OACK packet was received and is in the Buffer.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - This is NULL.\r
+ - Filename is NULL\r
+ - OptionCount is not zero and OptionList is NULL.\r
+ - One or more options in OptionList have wrong format.\r
+ - PacketLength is NULL.\r
+ - OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+ @retval EFI_UNSUPPORTED One or more options in the OptionList are unsupported by \r
+ this implementation.\r
+ @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
+ @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r
+ address for this instance, but no source address was available for use.\r
+ @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received and is in the Packet.\r
+ @retval EFI_ICMP_ERROR An ICMP ERROR packet was received and the Packet is set to NULL.\r
+ @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received and is in the Packet.\r
+ @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r
+ @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_GET_INFO)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_OVERRIDE_DATA *OverrideData OPTIONAL,\r
+ IN UINT8 *Filename,\r
+ IN UINT8 *ModeStr OPTIONAL,\r
+ IN UINT8 OptionCount,\r
+ IN EFI_MTFTP6_OPTION *OptionList OPTIONAL,\r
+ OUT UINT32 *PacketLength,\r
+ OUT EFI_MTFTP6_PACKET **Packet OPTIONAL\r
+);\r
+\r
+/**\r
+ Parse the options in an MTFTPv6 OACK packet.\r
+\r
+ The ParseOptions() function parses the option fields in an MTFTPv6 OACK packet and \r
+ returns the number of options that were found and optionally a list of pointers to \r
+ the options in the packet.\r
+ If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned\r
+ and *OptionCount and *OptionList stop at the last valid option.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] PacketLen Length of the OACK packet to be parsed.\r
+ @param[in] Packet Pointer to the OACK packet to be parsed. \r
+ @param[out] OptionCount Pointer to the number of options in the following OptionList. \r
+ @param[out] OptionList Pointer to EFI_MTFTP6_OPTION storage. Each pointer in the \r
+ OptionList points to the corresponding MTFTP option buffer \r
+ in the Packet. Call the EFI Boot Service FreePool() to \r
+ release the OptionList if the options in this OptionList \r
+ are not needed any more. \r
+\r
+ @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and \r
+ OptionList parameters have been updated.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - PacketLen is 0.\r
+ - Packet is NULL or Packet is not a valid MTFTPv6 packet.\r
+ - OptionCount is NULL.\r
+ @retval EFI_NOT_FOUND No options were found in the OACK packet.\r
+ @retval EFI_OUT_OF_RESOURCES Storage for the OptionList array can not be allocated.\r
+ @retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_PARSE_OPTIONS)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN UINT32 PacketLen,\r
+ IN EFI_MTFTP6_PACKET *Packet,\r
+ OUT UINT32 *OptionCount,\r
+ OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL\r
+ );\r
+\r
+/**\r
+ Download a file from an MTFTPv6 server.\r
+\r
+ The ReadFile() function is used to initialize and start an MTFTPv6 download process and \r
+ optionally wait for completion. When the download operation completes, whether successfully or \r
+ not, the Token.Status field is updated by the EFI MTFTPv6 Protocol driver and then \r
+ Token.Event is signaled if it is not NULL.\r
+ \r
+ Data can be downloaded from the MTFTPv6 server into either of the following locations:\r
+ - A fixed buffer that is pointed to by Token.Buffer \r
+ - A download service function that is pointed to by Token.CheckPacket \r
+\r
+ If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r
+ will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token Pointer to the token structure to provide the parameters that are \r
+ used in this operation.\r
+\r
+ @retval EFI_SUCCESS The data file has been transferred successfully.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_BUFFER_TOO_SMALL BufferSize is not large enough to hold the downloaded data \r
+ in downloading process.\r
+ @retval EFI_ABORTED Current operation is aborted by user.\r
+ @retval EFI_ICMP_ERROR An ICMP ERROR packet was received.\r
+ @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r
+ @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received.\r
+ @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_READ_FILE)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ Send a file to an MTFTPv6 server. May be unsupported in some implementations.\r
+\r
+ The WriteFile() function is used to initialize an uploading operation with the given option list \r
+ and optionally wait for completion. If one or more of the options is not supported by the server, the \r
+ unsupported options are ignored and a standard TFTP process starts instead. When the upload \r
+ process completes, whether successfully or not, Token.Event is signaled, and the EFI MTFTPv6 \r
+ Protocol driver updates Token.Status.\r
+\r
+ The caller can supply the data to be uploaded in the following two modes:\r
+ - Through the user-provided buffer\r
+ - Through a callback function\r
+\r
+ With the user-provided buffer, the Token.BufferSize field indicates the length of the buffer, \r
+ and the driver will upload the data in the buffer. With an EFI_MTFTP6_PACKET_NEEDED \r
+ callback function, the driver will call this callback function to get more data from the user to upload. \r
+ See the definition of EFI_MTFTP6_PACKET_NEEDED for more information. These two modes \r
+ cannot be used at the same time. The callback function will be ignored if the user provides the \r
+ buffer.\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token Pointer to the token structure to provide the parameters that are \r
+ used in this operation.\r
+\r
+ @retval EFI_SUCCESS The upload session has started.\r
+ @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - This is NULL.\r
+ - Token is NULL.\r
+ - Token.Filename is NULL.\r
+ - Token.OptionCount is not zero and Token.OptionList is NULL.\r
+ - One or more options in Token.OptionList have wrong format.\r
+ - Token.Buffer and Token.PacketNeeded are both NULL.\r
+ - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+ @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not \r
+ supported by this implementation.\r
+ @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
+ @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r
+ address for this instance, but no source address was available for use.\r
+ @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
+ @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_WRITE_FILE)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token\r
+ );\r
+\r
+/**\r
+ Download a data file directory from an MTFTPv6 server. May be unsupported in some implementations.\r
+\r
+ The ReadDirectory() function is used to return a list of files on the MTFTPv6 server that are \r
+ logically (or operationally) related to Token.Filename. The directory request packet that is sent \r
+ to the server is built with the option list that was provided by caller, if present.\r
+ \r
+ The file information that the server returns is put into either of the following locations:\r
+ - A fixed buffer that is pointed to by Token.Buffer \r
+ - A download service function that is pointed to by Token.CheckPacket \r
+ \r
+ If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r
+ will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r
+ \r
+ The returned directory listing in the Token.Buffer or EFI_MTFTP6_PACKET consists of a list \r
+ of two or three variable-length ASCII strings, each terminated by a null character, for each file in the \r
+ directory. If the multicast option is involved, the first field of each directory entry is the static \r
+ multicast IP address and UDP port number that is associated with the file name. The format of the \r
+ field is ip:ip:ip:ip:port. If the multicast option is not involved, this field and its terminating \r
+ null character are not present.\r
+ \r
+ The next field of each directory entry is the file name and the last field is the file information string. \r
+ The information string contains the file size and the create/modify timestamp. The format of the \r
+ information string is filesize yyyy-mm-dd hh:mm:ss:ffff. The timestamp is \r
+ Coordinated Universal Time (UTC; also known as Greenwich Mean Time [GMT]).\r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+ @param[in] Token Pointer to the token structure to provide the parameters that are \r
+ used in this operation.\r
+\r
+ @retval EFI_SUCCESS The MTFTPv6 related file "directory" has been downloaded.\r
+ @retval EFI_UNSUPPORTED The EFI MTFTPv6 Protocol driver does not support this function.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - This is NULL.\r
+ - Token is NULL.\r
+ - Token.Filename is NULL.\r
+ - Token.OptionCount is not zero and Token.OptionList is NULL.\r
+ - One or more options in Token.OptionList have wrong format.\r
+ - Token.Buffer and Token.CheckPacket are both NULL.\r
+ - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+ @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not \r
+ supported by this implementation.\r
+ @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r
+ @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r
+ address for this instance, but no source address was available for use.\r
+ @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+ @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
+ @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(\r
+ IN EFI_MTFTP6_PROTOCOL *This,\r
+ IN EFI_MTFTP6_TOKEN *Token\r
+);\r
+\r
+/**\r
+ Polls for incoming data packets and processes outgoing data packets. \r
+\r
+ The Poll() function can be used by network drivers and applications to increase the rate that data \r
+ packets are moved between the communications device and the transmit and receive queues.\r
+ In some systems, the periodic timer event in the managed network driver may not poll the \r
+ underlying communications device fast enough to transmit and/or receive all data packets without \r
+ missing incoming packets or dropping outgoing packets. Drivers and applications that are \r
+ experiencing packet loss should try calling the Poll() function more often. \r
+\r
+ @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
+ @retval EFI_NOT_STARTED This EFI MTFTPv6 Protocol instance has not been started.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. \r
+ @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
+ Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MTFTP6_POLL)(\r
+ IN EFI_MTFTP6_PROTOCOL *This\r
+ );\r
+\r
+///\r
+/// The EFI_MTFTP6_PROTOCOL is designed to be used by UEFI drivers and applications to transmit \r
+/// and receive data files. The EFI MTFTPv6 Protocol driver uses the underlying EFI UDPv6 Protocol \r
+/// driver and EFI IPv6 Protocol driver.\r
+///\r
+struct _EFI_MTFTP6_PROTOCOL {\r
+ EFI_MTFTP6_GET_MODE_DATA GetModeData;\r
+ EFI_MTFTP6_CONFIGURE Configure;\r
+ EFI_MTFTP6_GET_INFO GetInfo;\r
+ EFI_MTFTP6_PARSE_OPTIONS ParseOptions;\r
+ EFI_MTFTP6_READ_FILE ReadFile;\r
+ EFI_MTFTP6_WRITE_FILE WriteFile;\r
+ EFI_MTFTP6_READ_DIRECTORY ReadDirectory;\r
+ EFI_MTFTP6_POLL Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiMtftp6ProtocolGuid;\r
+\r
+#endif\r
+\r