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