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