+++ /dev/null
-/** @file\r
- EFI Multicast Trivial File Tranfer Protocol Definition\r
-\r
- Copyright (c) 2006, 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
- Module Name: Mtftp4.h\r
-\r
-**/\r
-\r
-#ifndef __EFI_MTFTP4_PROTOCOL_H__\r
-#define __EFI_MTFTP4_PROTOCOL_H__\r
-\r
-#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \\r
- { \\r
- 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } \\r
- }\r
-\r
-#define EFI_MTFTP4_PROTOCOL_GUID \\r
- { \\r
- 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b } \\r
- }\r
-\r
-typedef struct _EFI_MTFTP4_PROTOCOL EFI_MTFTP4_PROTOCOL;\r
-typedef struct _EFI_MTFTP4_TOKEN EFI_MTFTP4_TOKEN;\r
-\r
-//\r
-//MTFTP4 packet opcode definition\r
-//\r
-#define EFI_MTFTP4_OPCODE_RRQ 1\r
-#define EFI_MTFTP4_OPCODE_WRQ 2\r
-#define EFI_MTFTP4_OPCODE_DATA 3\r
-#define EFI_MTFTP4_OPCODE_ACK 4\r
-#define EFI_MTFTP4_OPCODE_ERROR 5\r
-#define EFI_MTFTP4_OPCODE_OACK 6\r
-#define EFI_MTFTP4_OPCODE_DIR 7\r
-#define EFI_MTFTP4_OPCODE_DATA8 8\r
-#define EFI_MTFTP4_OPCODE_ACK8 9\r
-\r
-//\r
-// MTFTP4 error code definition\r
-//\r
-#define EFI_MTFTP4_ERRORCODE_NOT_DEFINED 0\r
-#define EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND 1\r
-#define EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION 2\r
-#define EFI_MTFTP4_ERRORCODE_DISK_FULL 3\r
-#define EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION 4\r
-#define EFI_MTFTP4_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r
-#define EFI_MTFTP4_ERRORCODE_FILE_ALREADY_EXISTS 6\r
-#define EFI_MTFTP4_ERRORCODE_NO_SUCH_USER 7\r
-#define EFI_MTFTP4_ERRORCODE_REQUEST_DENIED 8\r
-\r
-//\r
-// MTFTP4 pacekt definitions\r
-//\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT8 Filename[1];\r
-} EFI_MTFTP4_REQ_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT8 Data[1];\r
-} EFI_MTFTP4_OACK_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT16 Block;\r
- UINT8 Data[1];\r
-} EFI_MTFTP4_DATA_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT16 Block[1];\r
-} EFI_MTFTP4_ACK_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT64 Block;\r
- UINT8 Data[1];\r
-} EFI_MTFTP4_DATA8_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT64 Block[1];\r
-} EFI_MTFTP4_ACK8_HEADER;\r
-\r
-typedef struct {\r
- UINT16 OpCode;\r
- UINT16 ErrorCode;\r
- UINT8 ErrorMessage[1];\r
-} EFI_MTFTP4_ERROR_HEADER;\r
-\r
-typedef union {\r
- UINT16 OpCode;\r
- EFI_MTFTP4_REQ_HEADER Rrq;\r
- EFI_MTFTP4_REQ_HEADER Wrq;\r
- EFI_MTFTP4_OACK_HEADER Oack;\r
- EFI_MTFTP4_DATA_HEADER Data;\r
- EFI_MTFTP4_ACK_HEADER Ack;\r
- EFI_MTFTP4_DATA8_HEADER Data8;\r
- EFI_MTFTP4_ACK8_HEADER Ack8;\r
- EFI_MTFTP4_ERROR_HEADER Error;\r
-} EFI_MTFTP4_PACKET;\r
-\r
-#pragma pack()\r
-\r
-//\r
-// MTFTP4 option definition\r
-//\r
-typedef struct {\r
- UINT8 *OptionStr;\r
- UINT8 *ValueStr;\r
-} EFI_MTFTP4_OPTION;\r
-\r
-\r
-typedef struct {\r
- BOOLEAN UseDefaultSetting;\r
- EFI_IPv4_ADDRESS StationIp;\r
- EFI_IPv4_ADDRESS SubnetMask;\r
- UINT16 LocalPort;\r
- EFI_IPv4_ADDRESS GatewayIp;\r
- EFI_IPv4_ADDRESS ServerIp;\r
- UINT16 InitialServerPort;\r
- UINT16 TryCount;\r
- UINT16 TimeoutValue;\r
-} EFI_MTFTP4_CONFIG_DATA;\r
-\r
-\r
-typedef struct {\r
- EFI_MTFTP4_CONFIG_DATA ConfigData;\r
- UINT8 SupportedOptionCount; \r
- UINT8 **SupportedOptoins;\r
- UINT8 UnsupportedOptionCount; \r
- UINT8 **UnsupportedOptoins;\r
-} EFI_MTFTP4_MODE_DATA;\r
-\r
-\r
-typedef struct {\r
- EFI_IPv4_ADDRESS GatewayIp;\r
- EFI_IPv4_ADDRESS ServerIp;\r
- UINT16 ServerPort;\r
- UINT16 TryCount;\r
- UINT16 TimeoutValue;\r
-} EFI_MTFTP4_OVERRIDE_DATA;\r
-\r
-//\r
-// Protocol interfaces definition\r
-//\r
-\r
-/**\r
- a callback function that is provided by the caller to intercept \r
- the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the\r
- EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept \r
- EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to \r
- EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory(). \r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param Token The token that the caller provided in the\r
- EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile()\r
- or ReadDirectory() function.\r
- @param PacketLen Indicates the length of the packet.\r
- @param Packet Pointer to an MTFTPv4 packet.\r
-\r
- @retval EFI_SUCCESS Operation sucess\r
- @retval Others Abort transfer process\r
-\r
-**/\r
-typedef \r
-EFI_STATUS \r
-(EFIAPI *EFI_MTFTP4_CHECK_PACKET)( \r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token,\r
- IN UINT16 PacketLen,\r
- IN EFI_MTFTP4_PACKET *Paket\r
- )\r
-;\r
-\r
-/**\r
- Timeout callback funtion. \r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param Token The token that is provided in the\r
- EFI_MTFTP4_PROTOCOL.ReadFile() or\r
- EFI_MTFTP4_PROTOCOL.WriteFile() or\r
- EFI_MTFTP4_PROTOCOL.ReadDirectory() functions\r
- by the caller.\r
- \r
- @retval EFI_SUCCESS Operation sucess\r
- @retval Others Aborts download process.\r
-\r
-**/\r
-typedef \r
-EFI_STATUS \r
-(EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)( \r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token\r
- )\r
-;\r
-\r
-/**\r
- a callback function that the caller provides to feed data to the\r
- EFI_MTFTP4_PROTOCOL.WriteFile() function.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param Token The token provided in the\r
- EFI_MTFTP4_PROTOCOL.WriteFile() by the caller.\r
- @param Length Indicates the length of the raw data wanted on input, and the\r
- length the data available on output.\r
- @param 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_MTFTP4_PACKET_NEEDED)( \r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token,\r
- IN OUT UINT16 *Length,\r
- OUT VOID **Buffer\r
- )\r
-;\r
-\r
-\r
-/**\r
- Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param ModeData Pointer to storage for the EFI MTFTPv4 Protocol driver mode data.\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_MTFTP4_GET_MODE_DATA)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- OUT EFI_MTFTP4_MODE_DATA *ModeData\r
- )\r
-;\r
-\r
-\r
-/**\r
- Initializes, changes, or resets the default operational setting for this \r
- EFI MTFTPv4 Protocol driver instance.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param MtftpConfigData Pointer to the configuration data structure.\r
-\r
- @retval EFI_SUCCESS The EFI MTFTPv4 Protocol driver was configured successfully.\r
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
- @retval EFI_ACCESS_DENIED The EFI configuration could not be changed at this time because\r
- there is one MTFTP background operation in progress.\r
- @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
- RARP, etc.) has not finished yet.\r
- @retval EFI_UNSUPPORTED A configuration protocol (DHCP, BOOTP, RARP, etc.) could not\r
- be located when clients choose to use the default address\r
- settings.\r
- @retval EFI_OUT_OF_RESOURCES The EFI MTFTPv4 Protocol driver instance data could not be\r
- allocated.\r
- @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI\r
- MTFTPv4 Protocol driver instance is not configured.\r
-\r
-**/\r
-typedef \r
-EFI_STATUS \r
-(EFIAPI *EFI_MTFTP4_CONFIGURE)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_CONFIG_DATA *MtftpConfigData OPTIONAL\r
- )\r
-; \r
- \r
- \r
-/**\r
- Gets information about a file from an MTFTPv4 server.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param OverrideData Data that is used to override the existing parameters. If NULL,\r
- the default parameters that were set in the\r
- EFI_MTFTP4_PROTOCOL.Configure() function are used.\r
- @param Filename Pointer to ASCIIZ file name string.\r
- @param ModeStr Pointer to ASCIIZ mode string. If NULL, "octet" will be used.\r
- @param OptionCount Number of option/value string pairs in OptionList.\r
- @param OptionList Pointer to array of option/value string pairs. Ignored if\r
- OptionCount is zero.\r
- @param PacketLength The number of bytes in the returned packet.\r
- @param Packet The pointer to the received packet. This buffer must be freed by\r
- the caller.\r
-\r
- @retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Buffer.\r
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
- @retval EFI_UNSUPPORTED One or more options in the OptionList are in the\r
- unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
- @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
- @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
- RARP, etc.) has not finished yet.\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 MTFTPv4 ERROR packet was received and is in the buffer.\r
- @retval EFI_ICMP_ERROR An ICMP ERROR packet was received and is in the Buffer.\r
- @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the buffer.\r
- @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server.\r
- @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
-\r
-**/\r
-typedef \r
-EFI_STATUS \r
-(EFIAPI *EFI_MTFTP4_GET_INFO)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData OPTIONAL,\r
- IN UINT8 *Filename,\r
- IN UINT8 *ModeStr OPTIONAL,\r
- IN UINT8 OptionCount,\r
- IN EFI_MTFTP4_OPTION *OptionList,\r
- OUT UINT32 *PacketLength,\r
- OUT EFI_MTFTP4_PACKET **Packet OPTIONAL\r
- )\r
-;\r
-\r
-/**\r
- Parses the options in an MTFTPv4 OACK packet.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param PacketLen Length of the OACK packet to be parsed.\r
- @param Packet Pointer to the OACK packet to be parsed.\r
- @param OptionCount Pointer to the number of options in following OptionList.\r
- @param OptionList Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot\r
- Service FreePool() to release each option if they are not\r
- 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 MTFTPv4 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 cannot 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_MTFTP4_PARSE_OPTIONS)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN UINT32 PacketLen,\r
- IN EFI_MTFTP4_PACKET *Packet,\r
- OUT UINT32 *OptionCount,\r
- OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL\r
- )\r
-; \r
-\r
-\r
-/**\r
- Downloads a file from an MTFTPv4 server.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param 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 MTFTPv4 server.\r
- @retval EFI_TFTP_ERROR An MTFTPv4 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_MTFTP4_READ_FILE)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token\r
- )\r
-; \r
- \r
-\r
-\r
-/**\r
- Sends a file to an MTFTPv4 server.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param 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 parameters are invalid.\r
- @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in\r
- the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
- @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
- @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
- RARP, etc.) is not finished yet.\r
- @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 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_MTFTP4_WRITE_FILE)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token\r
- )\r
-; \r
- \r
-\r
-/**\r
- Downloads a data file "directory" from an MTFTPv4 server. May be unsupported in some EFI\r
- implementations. \r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
- @param Token Pointer to the token structure to provide the parameters that are\r
- used in this operation.\r
-\r
- @retval EFI_SUCCESS The MTFTPv4 related file "directory" has been downloaded.\r
- @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
- @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in\r
- the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
- @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
- @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
- RARP, etc.) is not finished yet.\r
- @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 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_MTFTP4_READ_DIRECTORY)(\r
- IN EFI_MTFTP4_PROTOCOL *This,\r
- IN EFI_MTFTP4_TOKEN *Token\r
- )\r
-; \r
-\r
-/**\r
- Polls for incoming data packets and processes outgoing data packets.\r
-\r
- @param This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
-\r
- @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
- @retval EFI_NOT_STARTED This EFI MTFTPv4 Protocol instance has not been started.\r
- @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
- RARP, etc.) is not finished yet.\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_MTFTP4_POLL) (\r
- IN EFI_MTFTP4_PROTOCOL *This\r
- )\r
-; \r
- \r
- \r
-struct _EFI_MTFTP4_PROTOCOL {\r
- EFI_MTFTP4_GET_MODE_DATA GetModeData;\r
- EFI_MTFTP4_CONFIGURE Configure;\r
- EFI_MTFTP4_GET_INFO GetInfo;\r
- EFI_MTFTP4_PARSE_OPTIONS ParseOptions;\r
- EFI_MTFTP4_READ_FILE ReadFile;\r
- EFI_MTFTP4_WRITE_FILE WriteFile;\r
- EFI_MTFTP4_READ_DIRECTORY ReadDirectory;\r
- EFI_MTFTP4_POLL Poll;\r
-};\r
-\r
-struct _EFI_MTFTP4_TOKEN {\r
- OUT EFI_STATUS Status;\r
- IN EFI_EVENT Event;\r
- IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData;\r
- IN UINT8 *Filename;\r
- IN UINT8 *ModeStr;\r
- IN UINT32 OptionCount;\r
- IN EFI_MTFTP4_OPTION *OptionList;\r
- IN OUT UINT64 BufferSize;\r
- IN OUT VOID *Buffer;\r
- IN EFI_MTFTP4_CHECK_PACKET CheckPacket;\r
- IN EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback;\r
- IN EFI_MTFTP4_PACKET_NEEDED PacketNeeded;\r
-};\r
-\r
-extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid;\r
-extern EFI_GUID gEfiMtftp4ProtocolGuid; \r
-\r
-#endif\r
-\r