eapol/eapol_framework/eapol_common/am/include/eap_am_type_mschapv2.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_H_
       
    20 #define _EAP_AM_TYPE_MSCHAPV2_H_
       
    21 
       
    22 #include "abs_eap_am_type_mschapv2.h"
       
    23 
       
    24 enum eap_mschapv2_error_e {
       
    25 	EAP_MSCHAPV2_ERROR_RESTRICTED_LOGON_HOURS = 646,
       
    26 	EAP_MSCHAPV2_ERROR_ACCT_DISABLED          = 647,
       
    27 	EAP_MSCHAPV2_ERROR_PASSWD_EXPIRED         = 648,
       
    28 	EAP_MSCHAPV2_ERROR_NO_DIALIN_PERMISSION   = 649,
       
    29 	EAP_MSCHAPV2_ERROR_AUTHENTICATION_FAILURE = 691,
       
    30 	EAP_MSCHAPV2_ERROR_CHANGING_PASSWORD      = 709
       
    31 };
       
    32 
       
    33 /// This class is interface to adaptation module of Ms-Chap-v2.
       
    34 class EAP_EXPORT eap_am_type_mschapv2_c
       
    35 {
       
    36 private:
       
    37 	//--------------------------------------------------
       
    38 
       
    39 	abs_eap_am_type_mschapv2_c *m_am_partner;
       
    40 	abs_eap_am_tools_c *m_am_tools;
       
    41 
       
    42 	bool m_is_valid;
       
    43 
       
    44 	//--------------------------------------------------
       
    45 protected:
       
    46 	//--------------------------------------------------
       
    47 
       
    48 	//--------------------------------------------------
       
    49 public:
       
    50 	//--------------------------------------------------
       
    51 
       
    52 	// 
       
    53 	virtual ~eap_am_type_mschapv2_c()
       
    54 	{
       
    55 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    56 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    57 	}
       
    58 
       
    59 	eap_am_type_mschapv2_c(abs_eap_am_tools_c * const tools /*, abs_eap_am_type_mschapv2_c * const partner */)
       
    60 	: m_am_partner(0)
       
    61 	, m_am_tools(tools)
       
    62 	, m_is_valid(false)
       
    63 	{
       
    64 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    65 		set_is_valid();
       
    66 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    67 	}
       
    68 
       
    69 	virtual eap_status_e shutdown() = 0;
       
    70 
       
    71 	/** Function returns partner object of adaptation module of MSCHAPV2.
       
    72 	 *  Partner object is the MSCHAPV2 object.
       
    73 	 */
       
    74 	abs_eap_am_type_mschapv2_c * const get_am_partner()
       
    75 	{
       
    76 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    77 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    78 		return m_am_partner;
       
    79 	}
       
    80 
       
    81 	/** Function sets partner object of adaptation module of MSCHAPV2.
       
    82 	 *  Partner object is the MSCHAPV2 object.
       
    83 	 */
       
    84 	void set_am_partner(abs_eap_am_type_mschapv2_c * const partner)
       
    85 	{
       
    86 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    87 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    88 		m_am_partner = partner;
       
    89 	}
       
    90 
       
    91 	void set_is_valid()
       
    92 	{
       
    93 		m_is_valid = true;
       
    94 	}
       
    95 
       
    96 	bool get_is_valid()
       
    97 	{
       
    98 		return m_is_valid;
       
    99 	}
       
   100 
       
   101 	virtual eap_status_e type_configure_read(
       
   102 		const eap_configuration_field_c * const field,
       
   103 		eap_variable_data_c * const data) = 0;
       
   104 
       
   105 	virtual eap_status_e type_configure_write(
       
   106 		const eap_configuration_field_c * const field,
       
   107 		eap_variable_data_c * const data) = 0;
       
   108 
       
   109 	virtual eap_status_e configure() = 0;
       
   110 
       
   111 	virtual eap_status_e reset() = 0;
       
   112 
       
   113 	virtual eap_status_e show_username_password_dialog(
       
   114 		eap_variable_data_c & username,
       
   115 		eap_variable_data_c & password,
       
   116 		bool & password_prompt_enabled,
       
   117 		bool is_identity_query) = 0;
       
   118 
       
   119 	virtual eap_status_e show_change_password_dialog(
       
   120 		eap_variable_data_c & username,
       
   121 		eap_variable_data_c & old_password,
       
   122 		eap_variable_data_c & password,
       
   123 		bool & password_prompt_enabled) = 0;
       
   124 
       
   125 	virtual eap_status_e update_username_password() = 0;
       
   126 
       
   127 	virtual eap_status_e read_auth_failure_string(eap_mschapv2_error_e error_code, eap_variable_data_c &string) = 0;
       
   128 
       
   129 	/// This function queries unique key for memory store object of this access.
       
   130 	virtual eap_status_e get_memory_store_key(eap_variable_data_c * const memory_store_key) = 0;
       
   131 	
       
   132 	/**
       
   133 	 * Returns true if the full authenticated session is valid.
       
   134 	 * It finds the difference between current time and the 
       
   135 	 * last full authentication time. If the difference is less than the
       
   136 	 * Maximum Session Validity Time, then session is valid, returns true.
       
   137 	 * Otherwise returns false. 
       
   138 	 * Full authentication (using pw query) should be done if the session is not valid.
       
   139 	 */
       
   140 	virtual bool is_session_valid() = 0;
       
   141 	
       
   142 	/**
       
   143 	 * Stores current universal time as the the full authentication time
       
   144 	 * in the database.
       
   145 	 * Returns appropriate error if storing fails. eap_status_ok for successful storing.
       
   146 	 */
       
   147 	virtual eap_status_e store_authentication_time() = 0;
       
   148 	
       
   149 };
       
   150 
       
   151 EAP_C_FUNC_IMPORT  eap_am_type_mschapv2_c *new_eap_am_type_mschapv2(
       
   152 	abs_eap_am_tools_c * const tools,
       
   153 	abs_eap_base_type_c * const partner,
       
   154 	const eap_am_network_id_c * const receive_network_id);
       
   155 
       
   156 #endif