eapol/eapol_framework/eapol_common/type/tls_peap/tls/include/tls_base_application.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined(_TLS_BASE_APPLICATION_H_)
       
    22 #define _TLS_BASE_APPLICATION_H_
       
    23 
       
    24 #include "tls_peap_types.h"
       
    25 #include "eap_header.h"
       
    26 #include "eap_protocol_layer.h"
       
    27 
       
    28 class abs_tls_base_application_c;
       
    29 class abs_eap_am_tools_c;
       
    30 class eap_am_network_id_c;
       
    31 class tls_record_header_c;
       
    32 class abs_eap_state_notification_c;
       
    33 class tls_extension_c;
       
    34 class eap_fast_variable_data_c;
       
    35 
       
    36 
       
    37 /// The tls_base_application_c class declares pure virtual functions 
       
    38 /// a user class of TLS-application class could call.
       
    39 class EAP_EXPORT tls_base_application_c
       
    40 {
       
    41 private:
       
    42 	//--------------------------------------------------
       
    43 
       
    44 	/**
       
    45 	 * The set_is_valid() function sets the state of the object valid.
       
    46 	 * The creator of this object calls this function after it is initialized. 
       
    47 	 */
       
    48 	virtual void set_is_valid() = 0;
       
    49 
       
    50 	//--------------------------------------------------
       
    51 protected:
       
    52 	//--------------------------------------------------
       
    53 
       
    54 	//--------------------------------------------------
       
    55 public:
       
    56 	//--------------------------------------------------
       
    57 
       
    58 	/**
       
    59 	 * Destructor does nothing special.
       
    60 	 */
       
    61 	virtual ~tls_base_application_c();
       
    62 
       
    63 	/**
       
    64 	 * Application partner is object below the tls_base_application_c object.
       
    65 	 * @return The get_application_partner() function returns the pointer to the partner class.
       
    66 	 */
       
    67 	virtual abs_tls_base_application_c * get_application_partner() = 0;
       
    68 
       
    69 	/**
       
    70 	 * This function sets pointer to the partner class.
       
    71 	 * The partner that instantiates object of this type must call this function
       
    72 	 * to tell pointer to partner of this object.
       
    73 	 */
       
    74 	virtual eap_status_e set_application_partner(abs_tls_base_application_c * const partner) = 0;
       
    75 
       
    76 	/**
       
    77 	 * This function sets the PEAP version.
       
    78 	 */
       
    79 	virtual void set_peap_version(
       
    80 		const peap_version_e peap_version,
       
    81 		const bool use_tppd_tls_peap,
       
    82 		const bool use_tppd_peapv1_acknowledge_hack) = 0;
       
    83 
       
    84 	/**
       
    85 	 * The configure() function is called after the constructor of the 
       
    86 	 * object is successfully executed. During the function call the object 
       
    87 	 * could query the configuration. Each derived class must define this function.
       
    88 	 */
       
    89 	virtual eap_status_e configure() = 0;
       
    90 
       
    91 	/**
       
    92 	 * The shutdown() function is called before the destructor of the 
       
    93 	 * object is executed. During the function call the object 
       
    94 	 * could shutdown the operations, for example cancel timers.
       
    95 	 * Each derived class must define this function.
       
    96 	 */
       
    97 	virtual eap_status_e shutdown() = 0;
       
    98 
       
    99 	/**
       
   100 	 * This function starts the tunneled EAP-type within PEAP.
       
   101 	 */
       
   102 	virtual eap_status_e start_peap_tunneled_authentication(
       
   103 		const eap_am_network_id_c * const receive_network_id,
       
   104 		const bool is_client_when_true,
       
   105 		const u8_t received_eap_identifier,
       
   106 		const tls_session_type_e tls_session_type,
       
   107 		const bool tls_peap_server_authenticates_client_action) = 0;
       
   108 
       
   109 	/**
       
   110 	 * This function processes the received packet.
       
   111 	 * @param receive_network_id carries the addresses and type of the received packet.
       
   112 	 * @param packet includes the buffer of the whole reassembled EAP-packet.
       
   113 	 */
       
   114 	virtual eap_status_e packet_process(
       
   115 		eap_variable_data_c * const packet,
       
   116 		const u8_t received_eap_identifier) = 0;
       
   117 
       
   118 	/**
       
   119 	 * This function indicates the plain text EAP-Success or EAP-Failure packet is received.
       
   120 	 * @param receive_network_id includes the addresses (network identity) and packet type.
       
   121 	 * @param received_eap_identifier is the EAP-Identifier of the received EAP-Success packet.
       
   122 	 */
       
   123 	virtual eap_status_e plain_eap_success_failure_packet_received(
       
   124 		const eap_am_network_id_c * const receive_network_id,
       
   125 		const eap_code_value_e received_eap_code,
       
   126 		const u8_t received_eap_identifier) = 0;
       
   127 
       
   128 	/**
       
   129 	 * This function indicates the empty Ack packet is received.
       
   130 	 * This is used in TTLS.
       
   131 	 * @param receive_network_id includes the addresses (network identity) and packet type.
       
   132 	 * @param received_eap_identifier is the EAP-Identifier of the received EAP-Success packet.
       
   133 	 */
       
   134 	virtual eap_status_e empty_ack_packet_received(
       
   135 		const eap_am_network_id_c * const receive_network_id,
       
   136 		const u8_t received_eap_identifier) = 0;
       
   137 
       
   138 	/**
       
   139 	 * This function starts TTLS tunneled authentication.
       
   140 	 */
       
   141 	virtual eap_status_e start_ttls_tunneled_authentication(
       
   142 		const eap_am_network_id_c * const receive_network_id,
       
   143 		const u8_t received_eap_identifier) = 0;
       
   144 
       
   145 	/**
       
   146 	 * Object must indicate it's validity.
       
   147 	 * If object initialization fails this function must return false.
       
   148 	 * @return This function returns the validity of this object.
       
   149 	 */
       
   150 	virtual bool get_is_valid() = 0;
       
   151 
       
   152 	/**
       
   153 	 * This function resets the reused tls_base_application_c object.
       
   154 	 */
       
   155 	virtual eap_status_e reset() = 0;
       
   156 
       
   157 	virtual eap_status_e peap_tunnel_ready() = 0;
       
   158 
       
   159 	/**
       
   160 	 * This is notification of internal state transition.
       
   161 	 * This is used for telling tunneled EAP-type the TLS/PEAP-session was resumed.
       
   162 	 */
       
   163 	virtual void set_tunneled_state(
       
   164 		const tls_session_type_e tls_session_type) = 0;
       
   165 
       
   166 	/**
       
   167 	 * This function reads the authority identity (A-ID) of server.
       
   168 	 * This is used in EAP-FAST.
       
   169 	 */
       
   170 	virtual eap_status_e read_authority_identity(
       
   171 		eap_variable_data_c * const authority_identity_payload) = 0;
       
   172 
       
   173 	/**
       
   174 	 * This function saves the received User Authorization PAC-Opaque.
       
   175 	 * This is used in EAP-FAST.
       
   176 	 */
       
   177 	virtual eap_status_e save_user_authorization_pac_opaque(const tls_extension_c * const extension) = 0;
       
   178 
       
   179 	/**
       
   180 	 * Function queries tunnel PAC TLV for A-ID.
       
   181 	 * This function is completed by complete_query_tunnel_PAC() function call.
       
   182 	 */
       
   183 	virtual eap_status_e query_tunnel_PAC(
       
   184 		const eap_fast_variable_data_c * const in_A_ID_TLV) = 0;
       
   185 
       
   186 	/**
       
   187 	 * Function cancels query of tunnel PAC TLV for A-ID.
       
   188 	 */
       
   189 	virtual eap_status_e cancel_query_tunnel_PAC() = 0;
       
   190 
       
   191 	virtual eap_status_e complete_query_ttls_pap_username_and_password(
       
   192 		const eap_variable_data_c * const ttls_pap_username,
       
   193 		const eap_variable_data_c * const ttls_pap_password,
       
   194 		const eap_status_e query_result) = 0;
       
   195 
       
   196 	virtual eap_status_e complete_verify_ttls_pap_username_and_password(
       
   197 		const eap_status_e authentication_result,
       
   198 		const eap_variable_data_c * const ttls_pap_reply_message) = 0;
       
   199 
       
   200 	/**
       
   201 	 * This function is called when TLS-Alert message is received.
       
   202 	 * TLS-application module could record this event.
       
   203 	 */
       
   204 	virtual eap_status_e alert_received(
       
   205 		const tls_alert_level_e alert_level,
       
   206 		const tls_alert_description_e alert_description) = 0;
       
   207 
       
   208 	//--------------------------------------------------
       
   209 }; // class tls_base_application_c
       
   210 
       
   211 #endif //#if !defined(_TLS_BASE_APPLICATION_H_)
       
   212 
       
   213 //--------------------------------------------------
       
   214 
       
   215 
       
   216 
       
   217 // End.