From badd7e61a86feb50421a3a1aec9ea8b651c3ede8 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Wed, 26 Aug 2009 09:15:18 +0000 Subject: Added definitions of EFI EAP Protocol, EFI EAP Management Protocol and EFI FTPv4 Protocol. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9200 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Protocol/Eap.h | 151 +++++++++ MdePkg/Include/Protocol/EapManagement.h | 400 ++++++++++++++++++++++++ MdePkg/Include/Protocol/Ftp4.h | 521 ++++++++++++++++++++++++++++++++ MdePkg/MdePkg.dec | 12 + 4 files changed, 1084 insertions(+) create mode 100644 MdePkg/Include/Protocol/Eap.h create mode 100644 MdePkg/Include/Protocol/EapManagement.h create mode 100644 MdePkg/Include/Protocol/Ftp4.h (limited to 'MdePkg') diff --git a/MdePkg/Include/Protocol/Eap.h b/MdePkg/Include/Protocol/Eap.h new file mode 100644 index 0000000000..99c2b865ec --- /dev/null +++ b/MdePkg/Include/Protocol/Eap.h @@ -0,0 +1,151 @@ +/** @file + EFI EAP(Extended Authenticaton Protocol) Protocol Definition + The EFI EAP Protocol is used to abstract the ability to configure and extend the + EAP framework. + The definitions in this file are defined in UEFI Specification 2.3, which have + not been verified by one implementation yet. + + Copyright (c) 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. + +**/ + +#ifndef __EFI_EAP_PROTOCOL_H__ +#define __EFI_EAP_PROTOCOL_H__ + + +#define EFI_EAP_PROTOCOL_GUID \ + { \ + 0x5d9f96db, 0xe731, 0x4caa, {0xa0, 0xd, 0x72, 0xe1, 0x87, 0xcd, 0x77, 0x62 } \ + } + +typedef struct _EFI_EAP_PROTOCOL EFI_EAP_PROTOCOL; + +/// +/// Type for the identification number assigned to the Port by the +/// System in which the Port resides. +/// +typedef VOID * EFI_PORT_HANDLE; + +/// +/// EAP Authentication Method Type (RFC 2284 Section 3) +///@{ +#define EFI_EAP_TYPE_MD5 0x4 ///< REQUIRED +#define EFI_EAP_TYPE_OTP 0x5 ///< OPTIONAL +#define EFI_EAP_TYPE_TOKEN_CARD 0x6 ///< OPTIONAL +///@} + + +/** + One user provided EAP authentication method. + + Build EAP response packet in response to the EAP request packet specified by + (RequestBuffer, RequestSize). + + @param[in] PortNumber Specified the Port where the EAP request packet comes. + @param[in] RequestBuffer Pointer to the most recently received EAP- Request packet. + @param[in] RequestSize Packet size in bytes for the most recently received + EAP-Request packet. + @param[in] Buffer Pointer to the buffer to hold the built packet. + @param[in, out] BufferSize Pointer to the buffer size in bytes. + On input, it is the buffer size provided by the caller. + On output, it is the buffer size in fact needed to contain + the packet. + + @retval EFI_SUCCESS The required EAP response packet is built successfully. + @retval others Failures are encountered during the packet building process. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_BUILD_RESPONSE_PACKET)( + IN EFI_PORT_HANDLE PortNumber, + IN UINT8 *RequestBuffer, + IN UINTN RequestSize, + IN UINT8 *Buffer, + IN OUT UINTN *BufferSize + ); + +/** + Set the desired EAP authentication method for the Port. + + The SetDesiredAuthMethod() function sets the desired EAP authentication method indicated + by EapAuthType for the Port. + + If EapAuthType is an invalid EAP authentication type, then EFI_INVALID_PARAMETER is + returned. + If the EAP authentication method of EapAuthType is unsupported by the Ports, then this + function will return EFI_UNSUPPORTED. + + @param[in] This A pointer to the EFI_EAP_PROTOCOL instance that indicates + the calling context. + @param[in] EapAuthType The type of the EAP authentication method to register. It should + be the type value defined by RFC. See RFC 2284 for details. + @param[in] Handler The handler of the EAP authentication method to register. + + @retval EFI_SUCCESS The EAP authentication method of EapAuthType is + registered successfully. + @retval EFI_INVALID_PARAMETER EapAuthType is an invalid EAP authentication type. + @retval EFI_OUT_OF_RESOURCES There is not enough system memory to perform the registration. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_SET_DESIRED_AUTHENTICATION_METHOD)( + IN struct _EFI_EAP_PROTOCOL *This, + IN UINT8 EapAuthType + ); + +/** + Register an EAP authentication method. + + The RegisterAuthMethod() function registers the user provided EAP authentication method, + the type of which is EapAuthType and the handler of which is Handler. + + If EapAuthType is an invalid EAP authentication type, then EFI_INVALID_PARAMETER is + returned. + If there is not enough system memory to perform the registration, then + EFI_OUT_OF_RESOURCES is returned. + + @param[in] This A pointer to the EFI_EAP_PROTOCOL instance that indicates + the calling context. + @param[in] EapAuthType The type of the EAP authentication method to register. It should + be the type value defined by RFC. See RFC 2284 for details. + @param[in] Handler The handler of the EAP authentication method to register. + + @retval EFI_SUCCESS The EAP authentication method of EapAuthType is + registered successfully. + @retval EFI_INVALID_PARAMETER EapAuthType is an invalid EAP authentication type. + @retval EFI_OUT_OF_RESOURCES There is not enough system memory to perform the registration. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_REGISTER_AUTHENTICATION_METHOD)( + IN struct _EFI_EAP_PROTOCOL *This, + IN UINT8 EapAuthType, + IN EFI_EAP_BUILD_RESPONSE_PACKET Handler + ); + +/// +/// EFI_EAP_PROTOCOL +/// is used to configure the desired EAP authentication method for the EAP +/// framework and extend the EAP framework by registering new EAP authentication +/// method on a Port. The EAP framework is built on a per-Port basis. Herein, a +/// Port means a NIC. For the details of EAP protocol, please refer to RFC 2284. +/// +struct _EFI_EAP_PROTOCOL { + EFI_EAP_SET_DESIRED_AUTHENTICATION_METHOD SetDesiredAuthMethod; + EFI_EAP_REGISTER_AUTHENTICATION_METHOD RegisterAuthMethod; +}; + +extern EFI_GUID gEfiEapProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/EapManagement.h b/MdePkg/Include/Protocol/EapManagement.h new file mode 100644 index 0000000000..fc67a15aa0 --- /dev/null +++ b/MdePkg/Include/Protocol/EapManagement.h @@ -0,0 +1,400 @@ +/** @file + EFI EAP Management Protocol Definition + The EFI EAP Management Protocol is designed to provide ease of management and + ease of test for EAPOL state machine. It is intended for the supplicant side. + It conforms to IEEE 802.1x specification. + The definitions in this file are defined in UEFI Specification 2.3, which have + not been verified by one implementation yet. + + Copyright (c) 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. + +**/ + +#ifndef __EFI_EAP_MANAGEMENT_PROTOCOL_H__ +#define __EFI_EAP_MANAGEMENT_PROTOCOL_H__ + +#include + +#define EFI_EAP_MANAGEMENT_PROTOCOL_GUID \ + { \ + 0xbb62e663, 0x625d, 0x40b2, {0xa0, 0x88, 0xbb, 0xe8, 0x36, 0x23, 0xa2, 0x45 } \ + } + +typedef struct _EFI_EAP_MANAGEMENT_PROTOCOL EFI_EAP_MANAGEMENT_PROTOCOL; + +/// +/// PAE Capabilities +/// +///@{ +#define PAE_SUPPORT_AUTHENTICATOR 0x01 +#define PAE_SUPPORT_SUPPLICANT 0x02 +///@} + +/// +/// EFI_EAPOL_PORT_INFO +/// +typedef struct _EFI_EAPOL_PORT_INFO { + /// + /// The identification number assigned to the Port by the System in + /// which the Port resides. + /// + EFI_PORT_HANDLE PortNumber; + /// + /// The protocol version number of the EAPOL implementation + /// supported by the Port. + /// + UINT8 ProtocolVersion; + /// + /// The capabilities of the PAE associated with the Port. This field + /// indicates whether Authenticator functionality, Supplicant + /// functionality, both, or neither, is supported by the Port's PAE. + /// + UINT8 PaeCapabilities; +} EFI_EAPOL_PORT_INFO; + +/// +/// Supplicant PAE state machine (IEEE Std 802.1X Section 8.5.10) +/// +typedef enum _EFI_EAPOL_SUPPLICANT_PAE_STATE { + Logoff, + Disconnected, + Connecting, + Acquired, + Authenticating, + Held, + Authenticated, + MaxSupplicantPaeState +} EFI_EAPOL_SUPPLICANT_PAE_STATE; + +/// +/// Definitions for ValidFieldMask +/// +///@{ +#define AUTH_PERIOD_FIELD_VALID 0x01 +#define HELD_PERIOD_FIELD_VALID 0x02 +#define START_PERIOD_FIELD_VALID 0x04 +#define MAX_START_FIELD_VALID 0x08 +///@} + +/// +/// EFI_EAPOL_SUPPLICANT_PAE_CONFIGURATION +/// +typedef struct _EFI_EAPOL_SUPPLICANT_PAE_CONFIGURATION { + /// + /// Indicates which of the following fields are valid. + /// + UINT8 ValidFieldMask; + /// + /// The initial value for the authWhile timer. Its default value is 30s. + /// + UINTN AuthPeriod; + /// + /// The initial value for the heldWhile timer. Its default value is 60s. + /// + UINTN HeldPeriod; + /// + /// The initial value for the startWhen timer. Its default value is 30s. + /// + UINTN StartPeriod; + /// + /// The maximum number of successive EAPOL-Start messages will + /// be sent before the Supplicant assumes that there is no + /// Authenticator present. Its default value is 3. + /// + UINTN MaxStart; +} EFI_EAPOL_SUPPLICANT_PAE_CONFIGURATION; + +/// +/// Supplicant Statistics (IEEE Std 802.1X Section 9.5.2) +/// +typedef struct _EFI_EAPOL_SUPPLICANT_PAE_STATISTICS { + /// + /// The number of EAPOL frames of any type that have been received by this Supplican. + /// + UINTN EapolFramesReceived; + /// + /// The number of EAPOL frames of any type that have been transmitted by this Supplicant. + /// + UINTN EapolFramesTransmitted; + /// + /// The number of EAPOL Start frames that have been transmitted by this Supplicant. + /// + UINTN EapolStartFramesTransmitted; + /// + /// The number of EAPOL Logoff frames that have been transmitted by this Supplicant. + /// + UINTN EapolLogoffFramesTransmitted; + /// + /// The number of EAP Resp/Id frames that have been transmitted by this Supplicant. + /// + UINTN EapRespIdFramesTransmitted; + /// + /// The number of valid EAP Response frames (other than Resp/Id frames) that have been + /// transmitted by this Supplicant. + /// + UINTN EapResponseFramesTransmitted; + /// + /// The number of EAP Req/Id frames that have been received by this Supplicant. + /// + UINTN EapReqIdFramesReceived; + /// + /// The number of EAP Request frames (other than Rq/Id frames) that have been received + /// by this Supplicant. + /// + UINTN EapRequestFramesReceived; + /// + /// The number of EAPOL frames that have been received by this Supplicant in which the + /// frame type is not recognized. + /// + UINTN InvalidEapolFramesReceived; + /// + /// The number of EAPOL frames that have been received by this Supplicant in which the + /// Packet Body Length field (7.5.5) is invalid. + /// + UINTN EapLengthErrorFramesReceived; + /// + /// The protocol version number carried in the most recently received EAPOL frame. + /// + UINTN LastEapolFrameVersion; + /// + /// The source MAC address carried in the most recently received EAPOL frame. + /// + UINTN LastEapolFrameSource; +} EFI_EAPOL_SUPPLICANT_PAE_STATISTICS; + +/** + Read the system configuration information associated with the Port. + + The GetSystemConfiguration() function reads the system configuration + information associated with the Port, including the value of the + SystemAuthControl parameter of the System is returned in SystemAuthControl + and the Port's information is returned in the buffer pointed to by PortInfo. + The Port's information is optional. + If PortInfo is NULL, then reading the Port's information is ignored. + + If SystemAuthControl is NULL, then EFI_INVALID_PARAMETER is returned. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + @param[out] SystemAuthControl Returns the value of the SystemAuthControl + parameter of the System. + TRUE means Enabled. FALSE means Disabled. + @param[out] PortInfo Returns EFI_EAPOL_PORT_INFO structure to describe + the Port's information. This parameter can be NULL + to ignore reading the Port's information. + + @retval EFI_SUCCESS The system configuration information of the + Port is read successfully. + @retval EFI_INVALID_PARAMETER SystemAuthControl is NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_GET_SYSTEM_CONFIGURATION)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This, + OUT BOOLEAN *SystemAuthControl, + OUT EFI_EAPOL_PORT_INFO *PortInfo OPTIONAL + ); + +/** + Set the system configuration information associated with the Port. + + The SetSystemConfiguration() function sets the value of the SystemAuthControl + parameter of the System to SystemAuthControl. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + @param[in] SystemAuthControl The desired value of the SystemAuthControl + parameter of the System. + TRUE means Enabled. FALSE means Disabled. + + @retval EFI_SUCCESS The system configuration information of the + Port is set successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_SET_SYSTEM_CONFIGURATION)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This, + IN BOOLEAN SystemAuthControl + ); + +/** + Cause the EAPOL state machines for the Port to be initialized. + + The InitializePort() function causes the EAPOL state machines for the Port. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + + @retval EFI_SUCCESS The Port is initialized successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_INITIALIZE_PORT)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This + ); + +/** + Notify the EAPOL state machines for the Port that the user of the System has + logged on. + + The UserLogon() function notifies the EAPOL state machines for the Port. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + + @retval EFI_SUCCESS The Port is notified successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_USER_LOGON)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This + ); + +/** + Notify the EAPOL state machines for the Port that the user of the System has + logged off. + + The UserLogoff() function notifies the EAPOL state machines for the Port. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + + @retval EFI_SUCCESS The Port is notified successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_USER_LOGOFF)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This + ); + +/** + Read the status of the Supplicant PAE state machine for the Port, including the + current state and the configuration of the operational parameters. + + The GetSupplicantStatus() function reads the status of the Supplicant PAE state + machine for the Port, including the current state CurrentState and the configuration + of the operational parameters Configuration. The configuration of the operational + parameters is optional. If Configuration is NULL, then reading the configuration + is ignored. The operational parameters in Configuration to be read can also be + specified by Configuration.ValidFieldMask. + + If CurrentState is NULL, then EFI_INVALID_PARAMETER is returned. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + @param[out] CurrentState Returns the current state of the Supplicant PAE + state machine for the Port. + @param[in, out] Configuration Returns the configuration of the operational + parameters of the Supplicant PAE state machine + for the Port as required. This parameter can be + NULL to ignore reading the configuration. + On input, Configuration.ValidFieldMask specifies the + operational parameters to be read. + On output, Configuration returns the configuration + of the required operational parameters. + + @retval EFI_SUCCESS The configuration of the operational parameter + of the Supplicant PAE state machine for the Port + is set successfully. + @retval EFI_INVALID_PARAMETER CurrentState is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_GET_SUPPLICANT_STATUS)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This, + OUT EFI_EAPOL_SUPPLICANT_PAE_STATE *CurrentState, + IN OUT EFI_EAPOL_SUPPLICANT_PAE_CONFIGURATION *Configuration OPTIONAL + ); + +/** + Set the configuration of the operational parameter of the Supplicant PAE + state machine for the Port. + + The SetSupplicantConfiguration() function sets the configuration of the + operational Parameter of the Supplicant PAE state machine for the Port to + Configuration. The operational parameters in Configuration to be set can be + specified by Configuration.ValidFieldMask. + + If Configuration is NULL, then EFI_INVALID_PARAMETER is returned. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + @param[in] Configuration The desired configuration of the operational + parameters of the Supplicant PAE state machine + for the Port as required. + + @retval EFI_SUCCESS The configuration of the operational parameter + of the Supplicant PAE state machine for the Port + is set successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_SET_SUPPLICANT_CONFIGURATION)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This, + IN EFI_EAPOL_SUPPLICANT_PAE_CONFIGURATION *Configuration + ); + +/** + Read the statistical information regarding the operation of the Supplicant + associated with the Port. + + The GetSupplicantStatistics() function reads the statistical information + Statistics regarding the operation of the Supplicant associated with the Port. + + If Statistics is NULL, then EFI_INVALID_PARAMETER is returned. + + @param[in] This A pointer to the EFI_EAP_MANAGEMENT_PROTOCOL + instance that indicates the calling context. + @param[out] Statistics Returns the statistical information regarding the + operation of the Supplicant for the Port. + + @retval EFI_SUCCESS The statistical information regarding the operation + of the Supplicant for the Port is read successfully. + @retval EFI_INVALID_PARAMETER Statistics is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EAP_GET_SUPPLICANT_STATISTICS)( + IN struct _EFI_EAP_MANAGEMENT_PROTOCOL *This, + OUT EFI_EAPOL_SUPPLICANT_PAE_STATISTICS *Statistics + ); + +/// +/// EFI_EAP_MANAGEMENT_PROTOCOL +/// is used to control, configure and monitor EAPOL state machine on +/// a Port. EAPOL state machine is built on a per-Port basis. Herein, +/// a Port means a NIC. For the details of EAPOL, please refer to +/// IEEE 802.1x specification. +/// +struct _EFI_EAP_MANAGEMENT_PROTOCOL { + EFI_EAP_GET_SYSTEM_CONFIGURATION GetSystemConfiguration; + EFI_EAP_SET_SYSTEM_CONFIGURATION SetSystemConfiguration; + EFI_EAP_INITIALIZE_PORT InitializePort; + EFI_EAP_USER_LOGON UserLogon; + EFI_EAP_USER_LOGOFF UserLogoff; + EFI_EAP_GET_SUPPLICANT_STATUS GetSupplicantStatus; + EFI_EAP_SET_SUPPLICANT_CONFIGURATION SetSupplicantConfiguration; + EFI_EAP_GET_SUPPLICANT_STATISTICS GetSupplicantStatistics; +}; + +extern EFI_GUID gEfiEapManagementProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/Ftp4.h b/MdePkg/Include/Protocol/Ftp4.h new file mode 100644 index 0000000000..26e158c867 --- /dev/null +++ b/MdePkg/Include/Protocol/Ftp4.h @@ -0,0 +1,521 @@ +/** @file + EFI FTPv4 (File Transfer Protocol version 4) Protocol Definition + The EFI FTPv4 Protocol is used to locate communication devices that are + supported by an EFI FTPv4 Protocol driver and to create and destroy instances + of the EFI FTPv4 Protocol child protocol driver that can use the underlying + communication device. + The definitions in this file are defined in UEFI Specification 2.3, which have + not been verified by one implementation yet. + + Copyright (c) 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. + +**/ + +#ifndef __EFI_FTP4_PROTOCOL_H__ +#define __EFI_FTP4_PROTOCOL_H__ + + +#define EFI_FTP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xfaaecb1, 0x226e, 0x4782, {0xaa, 0xce, 0x7d, 0xb9, 0xbc, 0xbf, 0x4d, 0xaf } \ + } + +#define EFI_FTP4_PROTOCOL_GUID \ + { \ + 0xeb338826, 0x681b, 0x4295, {0xb3, 0x56, 0x2b, 0x36, 0x4c, 0x75, 0x7b, 0x9 } \ + } + +typedef struct _EFI_FTP4_PROTOCOL EFI_FTP4_PROTOCOL; + +/// +/// EFI_FTP4_CONNECTION_TOKEN +/// +typedef struct { + /// + /// The Event to signal after the connection is established and Status field is updated + /// by the EFI FTP v4 Protocol driver. The type of Event must be + /// EVENT_NOTIFY_SIGNAL, and its Task Priority Level (TPL) must be lower than or + /// equal to TPL_CALLBACK. If it is set to NULL, this function will not return until the + /// function completes. + /// + EFI_EVENT Event; + /// + /// The variable to receive the result of the completed operation. + /// EFI_SUCCESS: The FTP connection is established successfully + /// EFI_ACCESS_DENIED: The FTP server denied the access the user's request to access it. + /// EFI_CONNECTION_RESET: The connect fails because the connection is reset either by instance + /// itself or communication peer. + /// EFI_TIMEOUT: The connection establishment timer expired and no more specific + /// information is available. + /// EFI_NETWORK_UNREACHABLE: The active open fails because an ICMP network unreachable error is + /// received. + /// EFI_HOST_UNREACHABLE: The active open fails because an ICMP host unreachable error is + /// received. + /// EFI_PROTOCOL_UNREACHABLE: The active open fails because an ICMP protocol unreachable error is + /// received. + /// EFI_PORT_UNREACHABLE: The connection establishment timer times out and an ICMP port + /// unreachable error is received. + /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP + /// error is received. + /// EFI_DEVICE_ERROR: An unexpected system or network error occurred. + /// + EFI_STATUS Status; +} EFI_FTP4_CONNECTION_TOKEN; + +/// +/// EFI_FTP4_CONFIG_DATA +/// +typedef struct { + /// + /// Pointer to a ASCII string that contains user name. The caller is + /// responsible for freeing Username after GetModeData() is called. + /// + UINT8 *Username; + /// + /// Pointer to a ASCII string that contains password. The caller is + /// responsible for freeing Password after GetModeData() is called. + /// + UINT8 *Password; + /// + /// Set it to TRUE to initiate an active data connection. Set it to + /// FALSE to initiate a passive data connection. + /// + BOOLEAN Active; + /// + /// Boolean value indicating if default network settting used. + /// + BOOLEAN UseDefaultSetting; + /// + /// IP address of station if UseDefaultSetting is FALSE. + /// + EFI_IPv4_ADDRESS StationIp; + /// + /// Subnet mask of station if UseDefaultSetting is FALSE. + /// + EFI_IPv4_ADDRESS SubnetMask; + /// + /// IP address of gateway if UseDefaultSetting is FALSE. + /// + EFI_IPv4_ADDRESS GatewayIp; + /// + /// IP address of FTPv4 server. + /// + EFI_IPv4_ADDRESS ServerIp; + /// + /// FTPv4 server port number of control connection, and the default + /// value is 21 as convention. + /// + UINT16 ServerPort; + /// + /// FTPv4 server port number of data connection. If it is zero, use + /// (ServerPort - 1) by convention. + /// + UINT16 AltDataPort; + /// + /// A byte indicate the representation type. The right 4 bit is used for + /// first parameter, the left 4 bit is use for second parameter + /// - For the first parameter, 0x0 = image, 0x1 = EBCDIC, 0x2 = ASCII, 0x3 = local + /// - For the second parameter, 0x0 = Non-print, 0x1 = Telnet format effectors, 0x2 = + /// Carriage Control. + /// - If it is a local type, the second parameter is the local byte byte size. + /// - If it is a image type, the second parameter is undefined. + /// + UINT8 RepType; + /// + /// Defines the file structure in FTP used. 0x00 = file, 0x01 = record, 0x02 = page. + /// + UINT8 FileStruct; + /// + /// Defines the transifer mode used in FTP. 0x00 = stream, 0x01 = Block, 0x02 = Compressed. + /// + UINT8 TransMode; +} EFI_FTP4_CONFIG_DATA; + +typedef struct _EFI_FTP4_COMMAND_TOKEN EFI_FTP4_COMMAND_TOKEN; + +/** + Callback function when process inbound or outbound data. + + If it is receiving function that leads to inbound data, the callback function + is called when data buffer is full. Then, old data in the data buffer should be + flushed and new data is stored from the beginning of data buffer. + If it is a transmit function that lead to outbound data and the size of + Data in daata buffer has been transmitted, this callback function is called to + supply additional data to be transmitted. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token structure to provide the parameters that + are used in this operation. + @return User defined Status. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_DATA_CALLBACK)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_COMMAND_TOKEN *Token + ); + +/// +/// EFI_FTP4_COMMAND_TOKEN +/// +struct _EFI_FTP4_COMMAND_TOKEN { + /// + /// The Event to signal after request is finished and Status field + /// is updated by the EFI FTP v4 Protocol driver. The type of Event + /// must be EVT_NOTIFY_SIGNAL, and its Task Priority Level + /// (TPL) must be lower than or equal to TPL_CALLBACK. If it is + /// set to NULL, related function must wait until the function + /// completes. + /// + EFI_EVENT Event; + /// + /// Pointer to an ASCIIZ path name string. + /// + UINT8 *Pathname; + /// + /// The size of data buffer in bytes. + /// + UINT64 DataBufferSize; + /// + /// Pointer to the data buffer. Data downloaded from FTP server + /// through connection is downloaded here. + /// + VOID *DataBuffer; + /// + /// Pointer to a callback function. If it is receiving function that leads + /// to inbound data, the callback function is called when databuffer is + /// full. Then, old data in the data buffer should be flushed and new + /// data is stored from the beginning of data buffer. If it is a transmit + /// function that lead to outbound data and DataBufferSize of + /// Data in DataBuffer has been transmitted, this callback + /// function is called to supply additional data to be transmitted. The + /// size of additional data to be transmitted is indicated in + /// DataBufferSize, again. If there is no data remained, + /// DataBufferSize should be set to 0. + /// + EFI_FTP4_DATA_CALLBACK *DataCallback; + /// + /// Pointer to the parameter for DataCallback. + /// + VOID *Context; + /// + /// The variable to receive the result of the completed operation. + /// EFI_SUCCESS: The FTP command is completed successfully. + /// EFI_ACCESS_DENIED: The FTP server denied the access to the requested file. + /// EFI_CONNECTION_RESET: The connect fails because the connection is reset either + /// by instance itself or communication peer. + /// EFI_TIMEOUT: The connection establishment timer expired and no more + /// specific information is available. + /// EFI_NETWORK_UNREACHABLE: The active open fails because an ICMP network unreachable + /// error is received. + /// EFI_HOST_UNREACHABLE: The active open fails because an ICMP host unreachable + /// error is received. + /// EFI_PROTOCOL_UNREACHABLE: The active open fails because an ICMP protocol unreachable + /// error is received. + /// EFI_PORT_UNREACHABLE: The connection establishment timer times out and an ICMP port + /// unreachable error is received. + /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP + /// error is received. + /// EFI_DEVICE_ERROR: An unexpected system or network error occurred. + /// + EFI_STATUS Status; +}; + +/** + Gets the current operational settings. + + The GetModeData() function reads the current operational settings of this + EFI FTPv4 Protocol driver instance. EFI_FTP4_CONFIG_DATA is defined in the + EFI_FTP4_PROTOCOL.Configure. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[out] ModeData Pointer to storage for the EFI FTPv4 Protocol driver + mode data. The string buffers for Username and Password + in EFI_FTP4_CONFIG_DATA are allocated by the function, + and the caller should take the responsibility to free the + buffer later. + + @retval EFI_SUCCESS This function is called successfully. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - ModeData is NULL. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_GET_MODE_DATA)( + IN EFI_FTP4_PROTOCOL *This, + OUT EFI_FTP4_CONFIG_DATA *ModeData + ); + +/** + Disconnecting a FTP connection gracefully. + + The Connect() function will initiate a connection request to the remote FTP server + with the corresponding connection token. If this function returns EFI_SUCCESS, the + connection sequence is initiated successfully. If the connection succeeds or faild + due to any error, the Token->Event will be signaled and Token->Status will be updated + accordingly. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token used to establish control connection. + + @retval EFI_SUCCESS The connection sequence is successfully initiated. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - Token is NULL. + - Token->Event is NULL. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_CONNECT)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_CONNECTION_TOKEN *Token + ); + +/** + Disconnecting a FTP connection gracefully. + + The Close() function will initiate a close request to the remote FTP server with the + corresponding connection token. If this function returns EFI_SUCCESS, the control + connection with the remote FTP server is closed. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token used to close control connection. + + @retval EFI_SUCCESS The close request is successfully initiated. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - Token is NULL. + - Token->Event is NULL. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_CLOSE)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_CONNECTION_TOKEN *Token + ); + +/** + Sets or clears the operational parameters for the FTP child driver. + + The Configure() function will configure the connected FTP session with the + configuration setting specified in FtpConfigData. The configuration data can + be reset by calling Configure() with FtpConfigData set to NULL. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] FtpConfigData Pointer to configuration data that will be assigned to + the FTP child driver instance. If NULL, the FTP child + driver instance is reset to startup defaults and all + pending transmit and receive requests are flushed. + + @retval EFI_SUCCESS The FTPv4 driver was configured successfully. + @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE: + - This is NULL. + - FtpConfigData.RepType is invalid. + - FtpConfigData.FileStruct is invalid. + - FtpConfigData.TransMode is invalid. + - IP address in FtpConfigData is invalid. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_UNSUPPORTED One or more of the configuration parameters are not supported + by this implementation. + @retval EFI_OUT_OF_RESOURCES The EFI FTPv4 Protocol driver instance data could not be + allocated. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI FTPv4 + Protocol driver instance is not configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_CONFIGURE)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_CONFIG_DATA *FtpConfigData OPTIONAL + ); + + +/** + Downloads a file from an FTPv4 server. + + The ReadFile() function is used to initialize and start an FTPv4 download process + and optionally wait for completion. When the download operation completes, whether + successfully or not, the Token.Status field is updated by the EFI FTPv4 Protocol + driver and then Token.Event is signaled (if it is not NULL). + + Data will be downloaded from the FTPv4 server into Token.DataBuffer. If the file size + is larger than Token.DataBufferSize, Token.DataCallback will be called to allow for + processing data and then new data will be placed at the beginning of Token.DataBuffer. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token structure to provide the parameters that + are used in this operation. + + @retval EFI_SUCCESS The data file is being downloaded successfully. + @retval EFI_INVALID_PARAMETER One or more of the parameters is not valid. + - This is NULL. + - Token is NULL. + - Token.Pathname is NULL. + - Token. DataBuffer is NULL. + - Token. DataBufferSize is 0. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_READ_FILE)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_COMMAND_TOKEN *Token + ); + +/** + Uploads a file from an FTPv4 server. + + The WriteFile() function is used to initialize and start an FTPv4 upload process and + optionally wait for completion. When the upload operation completes, whether successfully + or not, the Token.Status field is updated by the EFI FTPv4 Protocol driver and then + Token.Event is signaled (if it is not NULL). Data to be uploaded to server is stored + into Token.DataBuffer. Token.DataBufferSize is the number bytes to be transferred. + If the file size is larger than Token.DataBufferSize, Token.DataCallback will be called + to allow for processing data and then new data will be placed at the beginning of + Token.DataBuffer. Token.DataBufferSize is updated to reflect the actual number of bytes + to be transferred. Token.DataBufferSize is set to 0 by the call back to indicate the + completion of data transfer. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token structure to provide the parameters that + are used in this operation. + + @retval EFI_SUCCESS TThe data file is being uploaded successfully. + @retval EFI_UNSUPPORTED The operation is not supported by this implementation. + @retval EFI_INVALID_PARAMETER One or more of the parameters is not valid. + - This is NULL. + - Token is NULL. + - Token.Pathname is NULL. + - Token. DataBuffer is NULL. + - Token. DataBufferSize is 0. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_WRITE_FILE)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_COMMAND_TOKEN *Token + ); + +/** + Download a data file "directory" from a FTPv4 server. May be unsupported in some EFI + implementations. + + The ReadDirectory() function is used to return a list of files on the FTPv4 server that + logically (or operationally) related to Token.Pathname, and optionally wait for completion. + When the download operation completes, whether successfully or not, the Token.Status field + is updated by the EFI FTPv4 Protocol driver and then Token.Event is signaled (if it is not + NULL). Data will be downloaded from the FTPv4 server into Token.DataBuffer. If the file size + is larger than Token.DataBufferSize, Token.DataCallback will be called to allow for processing + data and then new data will be placed at the beginning of Token.DataBuffer. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + @param[in] Token Pointer to the token structure to provide the parameters that + are used in this operation. + + @retval EFI_SUCCESS The file list information is being downloaded successfully. + @retval EFI_UNSUPPORTED The operation is not supported by this implementation. + @retval EFI_INVALID_PARAMETER One or more of the parameters is not valid. + - This is NULL. + - Token is NULL. + - Token. DataBuffer is NULL. + - Token. DataBufferSize is 0. + @retval EFI_NOT_STARTED The EFI FTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_READ_DIRECTORY)( + IN EFI_FTP4_PROTOCOL *This, + IN EFI_FTP4_COMMAND_TOKEN *Token + ); + +/** + Polls for incoming data packets and processes outgoing data packets. + + The Poll() function can be used by network drivers and applications to increase the + rate that data packets are moved between the communications device and the transmit + and receive queues. In some systems, the periodic timer event in the managed network + driver may not poll the underlying communications device fast enough to transmit + and/or receive all data packets without missing incoming packets or dropping outgoing + packets. Drivers and applications that are experiencing packet loss should try calling + the Poll() function more often. + + @param[in] This Pointer to the EFI_FTP4_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_NOT_STARTED This EFI FTPv4 Protocol instance has not been started. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR EapAuthType An unexpected system or network error occurred. + @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FTP4_POLL)( + IN EFI_FTP4_PROTOCOL *This + ); + +/// +/// EFI_FTP4_PROTOCOL +/// provides basic services for client-side FTP (File Transfer Protocol) +/// operations. +/// +struct _EFI_FTP4_PROTOCOL { + EFI_FTP4_GET_MODE_DATA GetModeData; + EFI_FTP4_CONNECT Connect; + EFI_FTP4_CLOSE Close; + EFI_FTP4_CONFIGURE Configure; + EFI_FTP4_READ_FILE ReadFile; + EFI_FTP4_WRITE_FILE WriteFile; + EFI_FTP4_READ_DIRECTORY ReadDirectory; + EFI_FTP4_POLL Poll; +}; + +extern EFI_GUID gEfiFtp4ServiceBindingProtocolGuid; +extern EFI_GUID gEfiFtp4ProtocolGuid; + +#endif + diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 5bc04e6701..28cb07f0bf 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -878,6 +878,18 @@ ## Include/Protocol/VlanConfig.h gEfiVlanConfigProtocolGuid = { 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74 }} + + ## Include/Protocol/Eap.h + gEfiEapProtocolGuid = { 0x5d9f96db, 0xe731, 0x4caa, {0xa0, 0xd, 0x72, 0xe1, 0x87, 0xcd, 0x77, 0x62 }} + + ## Include/Protocol/EapManagement.h + gEfiEapManagementProtocolGuid = { 0xbb62e663, 0x625d, 0x40b2, {0xa0, 0x88, 0xbb, 0xe8, 0x36, 0x23, 0xa2, 0x45 }} + + ## Include/Protocol/Ftp4.h + gEfiFtp4ServiceBindingProtocolGuid = { 0xfaaecb1, 0x226e, 0x4782, {0xaa, 0xce, 0x7d, 0xb9, 0xbc, 0xbf, 0x4d, 0xaf }} + + ## Include/Protocol/Ftp4.h + gEfiFtp4ProtocolGuid = { 0xeb338826, 0x681b, 0x4295, {0xb3, 0x56, 0x2b, 0x36, 0x4c, 0x75, 0x7b, 0x9 }} ## Include/Protocol/DriverHealth.h gEfiDriverHealthProtocolGuid = { 0x2a534210, 0x9280, 0x41d8, {0xae, 0x79, 0xca, 0xda, 0x1, 0xa2, 0xb1, 0x27 }} -- cgit v1.2.3