eapol/eapol_framework/eapol_symbian/am/include/eap_am_type_mschapv2_symbian.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 #ifndef _EAP_AM_TYPE_MSCHAPV2_SYMBIAN_H_
       
    20 #define _EAP_AM_TYPE_MSCHAPV2_SYMBIAN_H_
       
    21 
       
    22 //  INCLUDES
       
    23 #include "eap_am_tools_symbian.h"
       
    24 #include "abs_eap_base_type.h"
       
    25 #include "eap_am_type_mschapv2.h"
       
    26 #include "eap_type_mschapv2.h"
       
    27 #include "EapMsChapV2NotifierStructs.h"
       
    28 #include <EapType.h>
       
    29 #include <d32dbms.h>
       
    30 
       
    31 const TUint KDefaultTimeoutEAPMsChapV2 = 120000;
       
    32 
       
    33 /**
       
    34 * Class that implements the operating system dependent portion of EAP Ms-Chap-v2 protocol.
       
    35 * For Symbian OS.
       
    36 */
       
    37 class EAP_EXPORT eap_am_type_mschapv2_symbian_c
       
    38 : public CActive, public eap_am_type_mschapv2_c
       
    39 {
       
    40 private:
       
    41 	//--------------------------------------------------
       
    42 	eap_am_tools_symbian_c * const m_am_tools;
       
    43 
       
    44 	abs_eap_base_type_c * const m_partner;
       
    45 
       
    46 	RDbs m_session;
       
    47 
       
    48 	RDbNamedDatabase m_database;
       
    49 
       
    50 	enum TState 
       
    51 	{
       
    52 		EHandlingUsernamePasswordQuery,
       
    53 		EHandlingChangePasswordQuery,
       
    54 	};
       
    55 
       
    56 	TState m_state;
       
    57 
       
    58 	RNotifier m_notifier;
       
    59 
       
    60 	eap_variable_data_c * m_username_utf8;
       
    61 	eap_variable_data_c * m_password_utf8;
       
    62 	eap_variable_data_c * m_old_password_utf8;
       
    63 	bool * m_password_prompt_enabled;
       
    64 	bool m_is_identity_query;
       
    65 
       
    66 	TEapMsChapV2UsernamePasswordInfo * m_username_password_io_ptr;
       
    67 	TPckg<TEapMsChapV2UsernamePasswordInfo> * m_username_password_io_pckg_ptr;
       
    68 
       
    69 	eap_am_network_id_c m_receive_network_id;
       
    70 
       
    71 	TIndexType m_index_type;
       
    72 	
       
    73 	TInt m_index;
       
    74 
       
    75 	eap_type_value_e m_tunneling_type;
       
    76 
       
    77 	bool m_is_client;
       
    78 
       
    79 	bool m_is_valid;
       
    80 
       
    81 	bool m_shutdown_was_called;
       
    82 	
       
    83 	bool m_is_notifier_connected; // Tells if notifier server is connected.
       
    84 
       
    85 	// This holds the max session time read from the configuration file.
       
    86 	TInt64 m_max_session_time;
       
    87 
       
    88 	// This is the vendor-type for tunneling EAP type.
       
    89 	// Valid for both expanded and non-expanded EAP types.
       
    90 	// This is used since m_tunneling_type can not be used in the same way 
       
    91 	// in expanded and non-expanded cases. 
       
    92 	// Unlike EAP type, Tunneling type is still non-expanded
       
    93 	// for both cases especially for using in the EAP databases.
       
    94 	u32_t m_tunneling_vendor_type;	
       
    95 
       
    96 	void send_error_notification(const eap_status_e error);
       
    97 
       
    98 	bool is_session_validL();
       
    99 	
       
   100 	/**
       
   101 	 * Stores current universal time as the the full authentication time
       
   102 	 * in the database. Leaves if storing fails.
       
   103 	 */
       
   104 	void store_authentication_timeL();	
       
   105 
       
   106 	//--------------------------------------------------
       
   107 protected:
       
   108 	//--------------------------------------------------
       
   109 
       
   110 	eap_am_type_mschapv2_symbian_c(
       
   111 		abs_eap_am_tools_c * const m_am_tools,
       
   112 		abs_eap_base_type_c * const partner,
       
   113 		const TIndexType aIndexType,
       
   114 		const TInt aIndex,
       
   115 		const eap_type_value_e aTunnelingType,
       
   116 		const bool aIsClient,
       
   117 		const eap_am_network_id_c * const receive_network_id);
       
   118 
       
   119 	void ConstructL();
       
   120 
       
   121 	void RunL();
       
   122 	
       
   123 	void DoCancel();
       
   124 
       
   125 	void type_configure_updateL();
       
   126 
       
   127 	//--------------------------------------------------
       
   128 public:
       
   129 	//--------------------------------------------------
       
   130 
       
   131 	static eap_am_type_mschapv2_symbian_c* NewL(
       
   132 		abs_eap_am_tools_c * const aTools,
       
   133 		abs_eap_base_type_c * const aPartner,
       
   134 		const TIndexType aIndexType,
       
   135 		const TInt aIndex,
       
   136 		const eap_type_value_e aTunnelingType,
       
   137 		const bool aIsClient,
       
   138 		const eap_am_network_id_c * const receive_network_id);
       
   139 
       
   140 	// 
       
   141 	EAP_FUNC_IMPORT virtual ~eap_am_type_mschapv2_symbian_c();
       
   142 
       
   143 	eap_status_e show_username_password_dialog(
       
   144 		eap_variable_data_c & username,
       
   145 		eap_variable_data_c & password,
       
   146 		bool & password_prompt_enabled,
       
   147 		bool is_identity_query);
       
   148 
       
   149 	eap_status_e show_change_password_dialog(
       
   150 		eap_variable_data_c & username,
       
   151 		eap_variable_data_c & old_password,
       
   152 		eap_variable_data_c & password,
       
   153 		bool & password_prompt_enabled);
       
   154 
       
   155 	// 
       
   156 	EAP_FUNC_IMPORT eap_status_e configure();
       
   157 
       
   158 	EAP_FUNC_IMPORT eap_status_e reset();
       
   159 
       
   160 	EAP_FUNC_IMPORT eap_status_e update_username_password();	
       
   161 
       
   162 	EAP_FUNC_IMPORT void set_is_valid();
       
   163 
       
   164 	EAP_FUNC_IMPORT bool get_is_valid();
       
   165 
       
   166 	EAP_FUNC_IMPORT eap_status_e type_configure_read(
       
   167 		const eap_configuration_field_c * const field,
       
   168 		eap_variable_data_c * const data);
       
   169 
       
   170 	void type_configure_readL(
       
   171 		eap_config_string field,
       
   172 		const u32_t field_length,
       
   173 		eap_variable_data_c * const data);
       
   174 
       
   175 	EAP_FUNC_IMPORT eap_status_e type_configure_write(
       
   176 		const eap_configuration_field_c * const field,
       
   177 		eap_variable_data_c * const data);
       
   178 
       
   179 	EAP_FUNC_IMPORT eap_status_e shutdown();
       
   180 
       
   181 	EAP_FUNC_IMPORT eap_status_e read_auth_failure_string(eap_mschapv2_error_e error_code, eap_variable_data_c &string);
       
   182 
       
   183 	EAP_FUNC_IMPORT eap_status_e get_memory_store_key(eap_variable_data_c * const memory_store_key);
       
   184 	
       
   185 	/**
       
   186 	 * Returns true if the full authenticated session is valid.
       
   187 	 * It finds the difference between current time and the 
       
   188 	 * last full authentication time. If the difference is less than the
       
   189 	 * Maximum Session Validity Time, then session is valid, returns true.
       
   190 	 * Otherwise returns false. 
       
   191 	 * Full authentication (using pw query) should be done if the session is not valid.
       
   192 	 */
       
   193 	bool is_session_valid();
       
   194 	
       
   195 	/**
       
   196 	 * Stores current universal time as the the full authentication time
       
   197 	 * in the database by calling the leaving function store_authentication_time_L.
       
   198 	 * Returns appropriate error if storing fails. eap_status_ok for successful storing.
       
   199 	 */
       
   200 	eap_status_e store_authentication_time();	
       
   201 
       
   202 }; // class eap_am_type_mschapv2_symbian_c
       
   203 
       
   204 
       
   205 #endif // _EAP_AM_TYPE_MSCHAPV2_SYMBIAN_H_
       
   206 
       
   207 // End of file