eapol/eapol_framework/eapol_common/include/eap_method_settings.h
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     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-settings class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 23 %
       
    20 */
       
    21 
       
    22 #ifndef _EAP_METHOD_SETTINGS_H_
       
    23 #define _EAP_METHOD_SETTINGS_H_
       
    24 
       
    25 #include "eap_am_tools.h"
       
    26 #include "eap_expanded_type.h"
       
    27 #include "eap_variable_data.h"
       
    28 #include "eap_array.h"
       
    29 
       
    30 //-------------------------------------------------------------------------------
       
    31 
       
    32 class eap_certificate_entry_c
       
    33 {
       
    34 
       
    35 private:
       
    36 
       
    37 	/// This is pointer to the tools class.
       
    38 	abs_eap_am_tools_c * const m_am_tools;
       
    39 
       
    40 public:
       
    41 
       
    42 	eap_certificate_entry_c(
       
    43 		abs_eap_am_tools_c * const tools);
       
    44 
       
    45 	virtual ~eap_certificate_entry_c();
       
    46 
       
    47 	enum eap_certificate_type_e
       
    48 	{
       
    49 		eap_certificate_type_none,
       
    50 		eap_certificate_type_user,
       
    51 		eap_certificate_type_CA,
       
    52 	};
       
    53 
       
    54 	bool get_is_valid();
       
    55 
       
    56 	bool get_is_valid_data();
       
    57 
       
    58 	eap_certificate_entry_c * copy();
       
    59 
       
    60 	void trace() const;
       
    61 
       
    62 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
    63 
       
    64 	// Specifies whether this entry describes user or CA certificate (mandatory)
       
    65 	eap_certificate_type_e m_CertType;
       
    66 
       
    67 	// Subject name in distinguished name ASCII form. This is optional.
       
    68 	// For example "/C=US/O=Some organization/CN=Some common name".	
       
    69 	bool m_SubjectNamePresent;
       
    70 	eap_variable_data_c m_SubjectName;
       
    71 
       
    72 	// Issuer name in distinguished name ASCII form. This is optional.
       
    73 	// For example "/C=US/O=Some organization/CN=Some common name".
       
    74 	bool m_IssuerNamePresent;
       
    75 	eap_variable_data_c m_IssuerName;
       
    76 
       
    77 	// Serial number in ASCII form. This is optional.
       
    78 	bool m_SerialNumberPresent;
       
    79 	eap_variable_data_c m_SerialNumber;
       
    80 
       
    81 	// Subject key in binary form. This is mandatory.
       
    82 	bool m_SubjectKeyIDPresent;
       
    83 	eap_variable_data_c m_SubjectKeyID;
       
    84 
       
    85 	// Thumbprint in binary form. This is optional.
       
    86 	bool m_ThumbprintPresent;
       
    87 	eap_variable_data_c m_Thumbprint;
       
    88 
       
    89 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
    90 
       
    91 	// This holds only the certificate label. This is the text UI will show.
       
    92 	bool m_LabelPresent;
       
    93 	eap_variable_data_c m_Label;
       
    94 
       
    95 	// Primary name of the certificate if any, UI uses this.
       
    96 	bool m_PrimaryNamePresent;
       
    97 	eap_variable_data_c m_PrimaryName;
       
    98 
       
    99 	// Secondary name of the certificate if any, UI uses this.
       
   100 	bool m_SecondaryNamePresent;
       
   101 	eap_variable_data_c m_SecondaryName;
       
   102 
       
   103 	// UI uses this to indicate enabled certificate.
       
   104 	bool m_iIsEnabledPresent;
       
   105 	bool m_iIsEnabled;
       
   106 
       
   107 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   108 };
       
   109 
       
   110 //-------------------------------------------------------------------------------
       
   111 
       
   112 class eap_method_values_c
       
   113 {
       
   114 
       
   115 private:
       
   116 
       
   117 	/// This is pointer to the tools class.
       
   118 	abs_eap_am_tools_c * const m_am_tools;
       
   119 
       
   120 protected:
       
   121 
       
   122 	abs_eap_am_tools_c * get_am_tools() const;
       
   123 
       
   124 public:
       
   125 
       
   126 	eap_method_values_c(
       
   127 		abs_eap_am_tools_c * const tools);
       
   128 
       
   129 	virtual ~eap_method_values_c();
       
   130 
       
   131 	bool m_is_valid;
       
   132 
       
   133 	/// Status of the operation.
       
   134 	eap_status_e m_completion_status;
       
   135 
       
   136 	/// Specifies the EAP-method these settings are for. 
       
   137 	eap_type_value_e m_EAPType;
       
   138 
       
   139 	/// Specifies the index type (bearer protocol) these settings are for.
       
   140 	/// Values are ELan or EVpn.
       
   141 	u32_t m_IndexType;
       
   142 
       
   143 	/// Specifies unique index in the settings of the bearer protocol.
       
   144 	u32_t m_Index;
       
   145 
       
   146 	/// Use automatic Ca certificate.
       
   147 	bool m_UseAutomaticCACertificatePresent;
       
   148 	bool m_UseAutomaticCACertificate;
       
   149 
       
   150 	/// Use automatic username.
       
   151 	bool m_UseAutomaticUsernamePresent;
       
   152 	bool m_UseAutomaticUsername;
       
   153 
       
   154 	/// Use automatic realm.
       
   155 	bool m_UseAutomaticRealmPresent;
       
   156 	bool m_UseAutomaticRealm;
       
   157 
       
   158 	/// Username in ASCII format
       
   159 	bool m_UsernamePresent;
       
   160 	eap_variable_data_c m_Username_fix;
       
   161 
       
   162 	/// Get: Whether password is stored in database.
       
   163 	/// Set: Whether password must be cleared from database.
       
   164 	bool m_PasswordExistPresent;
       
   165 	bool m_PasswordExist;
       
   166 
       
   167 	/// Password in ASCII format
       
   168 	bool m_PasswordPresent;
       
   169 	eap_variable_data_c m_Password;
       
   170 
       
   171 	/// Realm in ASCII format
       
   172 	bool m_RealmPresent;
       
   173 	eap_variable_data_c m_Realm;
       
   174 
       
   175 	/// Use pseudonym identities in EAP-SIM/AKA
       
   176 	bool m_UsePseudonymsPresent;
       
   177 	bool m_UsePseudonyms;
       
   178 
       
   179 	/// Whether EAP-TLS/TTLS/PEAP should verify server realm
       
   180 	bool m_VerifyServerRealmPresent;
       
   181 	bool m_VerifyServerRealm;
       
   182 
       
   183 	/// Whether EAP-TLS/TTLS/PEAP should require client authentication
       
   184 	bool m_RequireClientAuthenticationPresent;
       
   185 	bool m_RequireClientAuthentication;
       
   186 
       
   187 	/// General session validity time (in minutes)
       
   188 	bool m_SessionValidityTimePresent;
       
   189 	u32_t m_SessionValidityTime;
       
   190 
       
   191 	/// An array of allowed cipher suites for EAP-TLS/TTLS/PEAP. 
       
   192 	/// Refer to RFC2246 chapter A.5 for the values.
       
   193 	bool m_CipherSuitesPresent;
       
   194 	eap_array_c<u16_t> m_CipherSuites;
       
   195 
       
   196 	/// Which EAP-PEAP versions are allowed
       
   197 	bool m_PEAPVersionsPresent;
       
   198 	bool m_PEAPv0Allowed;
       
   199 	bool m_PEAPv1Allowed;
       
   200 	bool m_PEAPv2Allowed;
       
   201 
       
   202   	/// Array listing the allowed certificates for EAP-TLS/TTLS/PEAP.
       
   203   	/// Subject key ID and Certificate type are the only mandatory certificate 
       
   204   	/// details needed at the moment.
       
   205   	bool m_CertificatesPresent;
       
   206 	eap_array_c<eap_certificate_entry_c> m_Certificates;
       
   207 
       
   208 	/// Array listing the allowed encapsulated EAP types (in priority order).
       
   209 	/// Use EAP type values from eap_type_value_e.
       
   210 	bool m_EnabledEncapsulatedEAPTypesPresent;
       
   211 	eap_array_c<eap_type_value_e> m_EnabledEncapsulatedEAPTypes;
       
   212 
       
   213 	/// Array listing the disabled encapsulated EAP types.
       
   214 	/// Use EAP type values from eap_type_value_e.
       
   215 	bool m_DisabledEncapsulatedEAPTypesPresent;
       
   216 	eap_array_c<eap_type_value_e> m_DisabledEncapsulatedEAPTypes;
       
   217 
       
   218 	/// Whether Authenticated provisioning mode allowed or not in EAP-FAST.
       
   219 	bool m_AuthProvModeAllowedPresent;
       
   220 	bool m_AuthProvModeAllowed;
       
   221 
       
   222 	/// Whether Unauthenticated provisioning mode allowed or not in EAP-FAST.
       
   223 	bool m_UnauthProvModeAllowedPresent;
       
   224 	bool m_UnauthProvModeAllowed;
       
   225 
       
   226 	/// PAC group reference in ASCII format for EAP-FAST.
       
   227 	bool m_PACGroupReferencePresent;
       
   228 	eap_variable_data_c m_PACGroupReference;
       
   229 
       
   230 	/// Whether to Warn (or Prompt) for ADHP (Authenticated Diffie-Hellman Protocol) 
       
   231 	/// auto-provisioning when there is no PAC at all. EAP-FAST specific.
       
   232 	bool m_WarnADHPNoPACPresent;
       
   233 	bool m_WarnADHPNoPAC;
       
   234 
       
   235 	/// Whether to Warn (or Prompt) for ADHP auto-provisioning when 
       
   236 	/// there is no PAC that matches the A-ID sent by server. EAP-FAST specific.
       
   237 	bool m_WarnADHPNoMatchingPACPresent;
       
   238 	bool m_WarnADHPNoMatchingPAC;
       
   239 
       
   240 	/// Whether to Warn (or Prompt) when client encouters a server that has provisioned 
       
   241 	/// the client with a PAC before but is not currently selected as the default server. 
       
   242 	/// EAP-FAST specific.
       
   243 	bool m_WarnNotDefaultServerPresent;
       
   244 	bool m_WarnNotDefaultServer;
       
   245 
       
   246 	// Array listing the active and disabled EAP types (in priority order).
       
   247 	// Use EAP type values from eap_type_value_e.
       
   248 	bool m_SelectedEAPTypesPresent;
       
   249 	eap_array_c<eap_type_value_e> m_active_eap_methods;
       
   250 	eap_array_c<eap_type_value_e> m_disabled_eap_methods;
       
   251 
       
   252 	bool m_TunnelingTypePresent;
       
   253 	eap_type_value_e m_TunnelingType;
       
   254 
       
   255 	bool m_DestinationIndexAndTypePresent;
       
   256 	u32_t m_DestinationIndexType;
       
   257 	u32_t m_DestinationIndex;
       
   258 
       
   259 	bool m_MethodInfoPresent;
       
   260 	eap_variable_data_c m_KReleaseDate;
       
   261 	eap_variable_data_c m_KEapTypeVersion;
       
   262 	eap_variable_data_c m_KManufacturer;
       
   263 
       
   264 	bool m_ButtonIdPresent; // JPH: remove this
       
   265 	i32_t m_ButtonId; // JPH: remove this
       
   266 
       
   267 	bool m_ShowPassWordPromptPresent;
       
   268 	bool m_ShowPassWordPrompt;
       
   269 
       
   270 	bool m_UseIdentityPrivacyPresent;
       
   271 	bool m_UseIdentityPrivacy;
       
   272 
       
   273 };
       
   274 
       
   275 //-------------------------------------------------------------------------------
       
   276 
       
   277 class eap_method_settings_c
       
   278 : public eap_method_values_c
       
   279 {
       
   280 public:
       
   281 
       
   282 	eap_method_settings_c(
       
   283 		abs_eap_am_tools_c * const tools);
       
   284 
       
   285 	eap_method_settings_c(
       
   286 		abs_eap_am_tools_c * const tools,
       
   287 		const eap_method_settings_c * const init);
       
   288 
       
   289 	virtual ~eap_method_settings_c();
       
   290 
       
   291 	void trace() const;
       
   292 
       
   293 };
       
   294 
       
   295 //-------------------------------------------------------------------------------
       
   296 
       
   297 #if defined(USE_EAP_TRACE)
       
   298 
       
   299 	#define EAP_TRACE_METHOD_SETTINGS(settings) { (settings)->trace(); }
       
   300 
       
   301 #else
       
   302 
       
   303 	#define EAP_TRACE_METHOD_SETTINGS(settings)
       
   304 
       
   305 #endif //#if defined(USE_EAP_TRACE)
       
   306 
       
   307 
       
   308 //-------------------------------------------------------------------------------
       
   309 
       
   310 #endif //#ifndef _EAP_METHOD_SETTINGS_H_
       
   311 
       
   312 // End of file