eapol/eapol_framework/eapol_symbian/am/include/eap_am_type_leap_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 
       
    20 #ifndef EAP_AM_TYPE_LEAP_SYMBIAN_H
       
    21 #define EAP_AM_TYPE_LEAP_SYMBIAN_H
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include "eap_am_tools_symbian.h"
       
    26 #include "abs_eap_base_type.h"
       
    27 #include "eap_am_type_leap.h"
       
    28 #include "eap_am_network_id.h"
       
    29 #include "EapLeapNotifierStructs.h"
       
    30 #include <EapType.h>
       
    31 #include <d32dbms.h>
       
    32 
       
    33 const TUint KDefaultTimeoutLEAP = 120000;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * Class that implements the operating system dependent portion of EAP LEAP protocol.
       
    39 * For Symbian OS.
       
    40 */
       
    41 class EAP_EXPORT eap_am_type_leap_symbian_c
       
    42 : public CActive, public eap_am_type_leap_c
       
    43 {
       
    44 private:
       
    45 	//--------------------------------------------------
       
    46 
       
    47 	eap_am_tools_symbian_c * const m_am_tools;
       
    48 
       
    49 	abs_eap_base_type_c * const m_partner;
       
    50 
       
    51 	RDbs m_session;
       
    52 
       
    53 	RDbNamedDatabase m_database;
       
    54 
       
    55 	RNotifier m_notifier;
       
    56 
       
    57 	TEapLeapUsernamePasswordInfo * m_input_output_data_ptr;
       
    58 
       
    59 	TPckg<TEapLeapUsernamePasswordInfo> * m_input_output_pckg_ptr;
       
    60 
       
    61 	eap_am_network_id_c m_receive_network_id;
       
    62 
       
    63 	TIndexType m_index_type;
       
    64 	
       
    65 	TInt m_index;
       
    66 
       
    67 	eap_type_value_e m_tunneling_type;
       
    68 
       
    69 	bool m_is_client;
       
    70 
       
    71 	bool m_is_valid;
       
    72 
       
    73 	bool m_is_identity_query;
       
    74 
       
    75 	bool * m_password_prompt_enabled;
       
    76 
       
    77 	eap_variable_data_c * m_username_utf8;
       
    78 
       
    79 	eap_variable_data_c * m_password_utf8;
       
    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 	/**
       
    99 	 * Stores current universal time as the the full authentication time
       
   100 	 * in the database. Leaves if storing fails.
       
   101 	 */
       
   102 	void store_authentication_timeL();
       
   103 	 
       
   104 	bool is_session_validL();	
       
   105 
       
   106 
       
   107 	//--------------------------------------------------
       
   108 protected:
       
   109 	//--------------------------------------------------
       
   110 
       
   111 	eap_am_type_leap_symbian_c(
       
   112 		abs_eap_am_tools_c * const m_am_tools,
       
   113 		abs_eap_base_type_c * const partner,
       
   114 		const TIndexType aIndexType,
       
   115 		const TInt aIndex,
       
   116 		const eap_type_value_e aTunnelingType,
       
   117 		const bool aIsClient,
       
   118 		const eap_am_network_id_c * const receive_network_id);
       
   119 
       
   120 	void ConstructL();
       
   121 
       
   122 	void RunL();
       
   123 	
       
   124 	void DoCancel();
       
   125 
       
   126 	eap_status_e update_username_password();
       
   127 
       
   128 	void eap_am_type_leap_symbian_c::type_configure_updateL();
       
   129 
       
   130 	void type_configure_readL(
       
   131 		eap_config_string field,
       
   132 		const u32_t field_length,
       
   133 		eap_variable_data_c * const data);
       
   134 
       
   135 	//--------------------------------------------------
       
   136 public:
       
   137 	//--------------------------------------------------
       
   138 
       
   139 	static eap_am_type_leap_symbian_c* NewL(
       
   140 		abs_eap_am_tools_c * const aTools,
       
   141 		abs_eap_base_type_c * const aPartner,
       
   142 		const TIndexType aIndexType,
       
   143 		const TInt aIndex,
       
   144 		const eap_type_value_e aTunnelingType,
       
   145 		const bool aIsClient,
       
   146 		const eap_am_network_id_c * const receive_network_id);
       
   147 
       
   148 	// 
       
   149 	EAP_FUNC_IMPORT virtual ~eap_am_type_leap_symbian_c();
       
   150 
       
   151 	eap_status_e show_username_password_dialog(
       
   152 		eap_variable_data_c &username,
       
   153 		eap_variable_data_c &password,
       
   154 		bool &password_prompt_enabled,
       
   155 		bool is_identity_query);
       
   156 
       
   157 	EAP_FUNC_IMPORT eap_status_e configure();
       
   158 
       
   159 	EAP_FUNC_IMPORT eap_status_e reset();
       
   160 
       
   161 	EAP_FUNC_IMPORT void set_is_valid();
       
   162 
       
   163 	EAP_FUNC_IMPORT bool get_is_valid();
       
   164 
       
   165 	EAP_FUNC_IMPORT eap_status_e type_configure_read(
       
   166 		const eap_configuration_field_c * const field,
       
   167 		eap_variable_data_c * const data);
       
   168 
       
   169 	EAP_FUNC_IMPORT eap_status_e type_configure_write(
       
   170 		const eap_configuration_field_c * const field,
       
   171 		eap_variable_data_c * const data);
       
   172 
       
   173 	EAP_FUNC_IMPORT eap_status_e shutdown();
       
   174 
       
   175 	EAP_FUNC_IMPORT eap_status_e read_auth_failure_string(
       
   176 		eap_variable_data_c &string);
       
   177 
       
   178 	EAP_FUNC_IMPORT eap_status_e get_memory_store_key(
       
   179 		eap_variable_data_c * const memory_store_key);
       
   180 
       
   181 	/**
       
   182 	 * Returns true if the full authenticated session is valid.
       
   183 	 * It finds the difference between current time and the 
       
   184 	 * last full authentication time. If the difference is less than the
       
   185 	 * Maximum Session Validity Time, then session is valid, returns true.
       
   186 	 * Otherwise returns false. 
       
   187 	 * Full authentication (using pw query) should be done if the session is not valid.
       
   188 	 */
       
   189 	bool is_session_valid();
       
   190 	
       
   191 	/**
       
   192 	 * Stores current universal time as the the full authentication time
       
   193 	 * in the database by calling the leaving function store_authentication_time_L.
       
   194 	 * Returns appropriate error if storing fails. eap_status_ok for successful storing.
       
   195 	 */
       
   196 	eap_status_e store_authentication_time();
       
   197 
       
   198 }; // class eap_am_type_leap_symbian_c
       
   199 
       
   200 
       
   201 #endif // EAP_AM_TYPE_LEAP_SYMBIAN_H
       
   202 
       
   203 // End of File