X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FProtocol%2FMtftp4.h;h=095b81b285fad393bb0552192d0ca98782dac96a;hb=3a7afaf648c2752377a240000dcad09a29719188;hp=75889f3c64a44ec501d61096a3de3103454eac81;hpb=842f5579c7e2a313f56c576e4c5150f7f4793079;p=mirror_edk2.git diff --git a/MdePkg/Include/Protocol/Mtftp4.h b/MdePkg/Include/Protocol/Mtftp4.h index 75889f3c64..095b81b285 100644 --- a/MdePkg/Include/Protocol/Mtftp4.h +++ b/MdePkg/Include/Protocol/Mtftp4.h @@ -1,14 +1,17 @@ /** @file EFI Multicast Trivial File Tranfer Protocol Definition - Copyright (c) 2006, Intel Corporation + Copyright (c) 2006 - 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Revision Reference: + This Protocol is introduced in UEFI Specification 2.0 **/ @@ -98,22 +101,49 @@ typedef struct { } EFI_MTFTP4_ERROR_HEADER; typedef union { + /// + /// Type of packets as defined by the MTFTPv4 packet opcodes. + /// UINT16 OpCode; + /// + /// Read request packet header. + /// EFI_MTFTP4_REQ_HEADER Rrq; + /// + /// Write request packet header. + /// EFI_MTFTP4_REQ_HEADER Wrq; + /// + /// Option acknowledge packet header. + /// EFI_MTFTP4_OACK_HEADER Oack; + /// + /// Data packet header. + /// EFI_MTFTP4_DATA_HEADER Data; + /// + /// Acknowledgement packet header. + /// EFI_MTFTP4_ACK_HEADER Ack; + /// + /// Data packet header with big block number. + /// EFI_MTFTP4_DATA8_HEADER Data8; + /// + /// Acknowledgement header with big block num. + /// EFI_MTFTP4_ACK8_HEADER Ack8; + /// + /// Error packet header. + /// EFI_MTFTP4_ERROR_HEADER Error; } EFI_MTFTP4_PACKET; #pragma pack() -// -// MTFTP4 option definition -// +/// +/// MTFTP4 option definition +/// typedef struct { UINT8 *OptionStr; UINT8 *ValueStr; @@ -155,7 +185,7 @@ typedef struct { // /** - a callback function that is provided by the caller to intercept + A callback function that is provided by the caller to intercept the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to @@ -179,8 +209,7 @@ EFI_STATUS IN EFI_MTFTP4_TOKEN *Token, IN UINT16 PacketLen, IN EFI_MTFTP4_PACKET *Paket - ) -; + ); /** Timeout callback funtion. @@ -201,11 +230,10 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)( IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token - ) -; + ); /** - a callback function that the caller provides to feed data to the + A callback function that the caller provides to feed data to the EFI_MTFTP4_PROTOCOL.WriteFile() function. @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. @@ -226,8 +254,7 @@ EFI_STATUS IN EFI_MTFTP4_TOKEN *Token, IN OUT UINT16 *Length, OUT VOID **Buffer - ) -; + ); /** @@ -246,8 +273,7 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_GET_MODE_DATA)( IN EFI_MTFTP4_PROTOCOL *This, OUT EFI_MTFTP4_MODE_DATA *ModeData - ) -; + ); /** @@ -277,8 +303,7 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_CONFIGURE)( IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_CONFIG_DATA *MtftpConfigData OPTIONAL - ) -; + ); /** @@ -297,20 +322,38 @@ EFI_STATUS @param Packet The pointer to the received packet. This buffer must be freed by the caller. - @retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Buffer. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_UNSUPPORTED One or more options in the OptionList are in the - unsupported list of structure EFI_MTFTP4_MODE_DATA. - @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started. - @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, - RARP, etc.) has not finished yet. - @retval EFI_ACCESS_DENIED The previous operation has not completed yet. - @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. - @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received and is in the buffer. - @retval EFI_ICMP_ERROR An ICMP ERROR packet was received and is in the Buffer. - @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the buffer. - @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. - @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + @retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Packet. + Note: It does not match UEFI 2.3 Specification. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - Filename is NULL. + - OptionCount is not zero and OptionList is NULL. + - One or more options in OptionList have wrong format. + - PacketLength is NULL. + - One or more IPv4 addresses in OverrideData are not valid + unicast IPv4 addresses if OverrideData is not NULL. + @retval EFI_UNSUPPORTED One or more options in the OptionList are in the + unsupported list of structure EFI_MTFTP4_MODE_DATA. + @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) has not finished yet. + @retval EFI_ACCESS_DENIED The previous operation has not completed yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received and is in the Packet. + @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received and the Packet is set to NULL. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received and the Packet is set to NULL. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received and the Packet is set to NULL. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received and the Packet is set to NULL. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received and is in the Buffer. + Note: It does not match UEFI 2.3 Specification. + @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the Packet. + Note: It does not match UEFI 2.3 Specification. + @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. **/ typedef @@ -324,8 +367,7 @@ EFI_STATUS IN EFI_MTFTP4_OPTION *OptionList, OUT UINT32 *PacketLength, OUT EFI_MTFTP4_PACKET **Packet OPTIONAL - ) -; + ); /** Parses the options in an MTFTPv4 OACK packet. @@ -335,8 +377,8 @@ EFI_STATUS @param Packet Pointer to the OACK packet to be parsed. @param OptionCount Pointer to the number of options in following OptionList. @param OptionList Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot - Service FreePool() to release each option if they are not - needed any more. + Service FreePool() to release the OptionList if the options + in this OptionList are not needed any more. @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and OptionList parameters have been updated. @@ -357,8 +399,7 @@ EFI_STATUS IN EFI_MTFTP4_PACKET *Packet, OUT UINT32 *OptionCount, OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL - ) -; + ); /** @@ -368,15 +409,25 @@ EFI_STATUS @param Token Pointer to the token structure to provide the parameters that are used in this operation. - @retval EFI_SUCCESS The data file has been transferred successfully. - @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. - @retval EFI_BUFFER_TOO_SMALL BufferSize is not large enough to hold the downloaded data - in downloading process. - @retval EFI_ABORTED Current operation is aborted by user. - @retval EFI_ICMP_ERROR An ICMP ERROR packet was received. - @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. - @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received. - @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + @retval EFI_SUCCESS The data file has been transferred successfully. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_BUFFER_TOO_SMALL BufferSize is not zero but not large enough to hold the + downloaded data in downloading process. + Note: It does not match UEFI 2.3 Specification. + @retval EFI_ABORTED Current operation is aborted by user. + @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received. + Note: It is not defined in UEFI 2.3 Specification. + @retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received. + Note: It does not match UEFI 2.3 Specification. + @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. + @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. **/ typedef @@ -384,8 +435,7 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_READ_FILE)( IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token - ) -; + ); @@ -415,8 +465,7 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_WRITE_FILE)( IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token - ) -; + ); /** @@ -446,8 +495,7 @@ EFI_STATUS (EFIAPI *EFI_MTFTP4_READ_DIRECTORY)( IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token - ) -; + ); /** Polls for incoming data packets and processes outgoing data packets. @@ -466,12 +514,15 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_MTFTP4_POLL) ( +(EFIAPI *EFI_MTFTP4_POLL)( IN EFI_MTFTP4_PROTOCOL *This - ) -; + ); - +/// +/// The EFI_MTFTP4_PROTOCOL is designed to be used by UEFI drivers and applications +/// to transmit and receive data files. The EFI MTFTPv4 Protocol driver uses +/// the underlying EFI UDPv4 Protocol driver and EFI IPv4 Protocol driver. +/// struct _EFI_MTFTP4_PROTOCOL { EFI_MTFTP4_GET_MODE_DATA GetModeData; EFI_MTFTP4_CONFIGURE Configure; @@ -484,18 +535,66 @@ struct _EFI_MTFTP4_PROTOCOL { }; struct _EFI_MTFTP4_TOKEN { - OUT EFI_STATUS Status; - IN EFI_EVENT Event; - IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData; - IN UINT8 *Filename; - IN UINT8 *ModeStr; - IN UINT32 OptionCount; - IN EFI_MTFTP4_OPTION *OptionList; - IN OUT UINT64 BufferSize; - IN OUT VOID *Buffer; - IN EFI_MTFTP4_CHECK_PACKET CheckPacket; - IN EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback; - IN EFI_MTFTP4_PACKET_NEEDED PacketNeeded; + /// + /// The status that is returned to the caller at the end of the operation + /// to indicate whether this operation completed successfully. + /// + EFI_STATUS Status; + /// + /// The event that will be signaled when the operation completes. If + /// set to NULL, the corresponding function will wait until the read or + /// write operation finishes. The type of Event must be + /// EVT_NOTIFY_SIGNAL. The Task Priority Level (TPL) of + /// Event must be lower than or equal to TPL_CALLBACK. + /// + EFI_EVENT Event; + /// + /// If not NULL, the data that will be used to override the existing configure data. + /// + EFI_MTFTP4_OVERRIDE_DATA *OverrideData; + /// + /// Pointer to the ASCIIZ file name string. + /// + UINT8 *Filename; + /// + /// Pointer to the ASCIIZ mode string. If NULL, "octet" is used. + /// + UINT8 *ModeStr; + /// + /// Number of option/value string pairs. + /// + UINT32 OptionCount; + /// + /// Pointer to an array of option/value string pairs. Ignored if OptionCount is zero. + /// + EFI_MTFTP4_OPTION *OptionList; + /// + /// Size of the data buffer. + /// + UINT64 BufferSize; + /// + /// Pointer to the data buffer. Data that is downloaded from the + /// MTFTPv4 server is stored here. Data that is uploaded to the + /// MTFTPv4 server is read from here. Ignored if BufferSize is zero. + /// + VOID *Buffer; + /// + /// Pointer to the context that will be used by CheckPacket, + /// TimeoutCallback and PacketNeeded. + /// + VOID *Context; + /// + /// Pointer to the callback function to check the contents of the received packet. + /// + EFI_MTFTP4_CHECK_PACKET CheckPacket; + /// + /// Pointer to the function to be called when a timeout occurs. + /// + EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback; + /// + /// Pointer to the function to provide the needed packet contents. + /// + EFI_MTFTP4_PACKET_NEEDED PacketNeeded; }; extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid;