eapol/eapol_framework/eapol_common/type/securid/include/eap_type_securid.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_TYPE_SECURID_H
       
    20 #define EAP_TYPE_SECURID_H
       
    21 
       
    22 #include "eap_base_type.h"
       
    23 
       
    24 #include "abs_eap_am_type_securid.h"
       
    25 #include "eap_am_type_securid.h"
       
    26 #include "eap_am_network_id.h"
       
    27 
       
    28 #include "eap_type_securid_state.h"
       
    29 
       
    30 /// This class is implementation of SecurID EAP-type.
       
    31 class EAP_EXPORT eap_type_securid_c
       
    32 : public abs_eap_am_type_securid_c 
       
    33 , public eap_base_type_c
       
    34 {
       
    35 
       
    36 private:
       
    37 
       
    38 	/// This is pointer to adaptation module of SecurID EAP type.
       
    39 	eap_am_type_securid_c * const m_am_type_securid;
       
    40 
       
    41 	/// This indicates whether this object was generated successfully.
       
    42 	bool m_is_valid;
       
    43 
       
    44 	/// This indicates whether this object is client (true) or server (false).
       
    45 	/// In terms of EAP-protocol whether this network entity is EAP-supplicant (true) or EAP-authenticator (false).
       
    46 	bool m_is_client;
       
    47 
       
    48 	eap_type_value_e m_eap_type;
       
    49 
       
    50 	bool m_free_am_type_securid;
       
    51 
       
    52 	bool m_use_EAP_FAST_response;
       
    53 
       
    54 	/// This is pointer to the tools class.
       
    55 	abs_eap_am_tools_c * const m_am_tools;
       
    56 
       
    57 	eap_am_network_id_c m_send_network_id;
       
    58 
       
    59 	u8_t m_identifier;
       
    60 
       
    61 	eap_variable_data_c m_identity;
       
    62 
       
    63 	// Server only:
       
    64 	eap_variable_data_c m_passcode;
       
    65 	eap_variable_data_c m_pincode;
       
    66 
       
    67 	bool m_is_first_passcode_query;
       
    68 	bool m_is_first_pincode_query;
       
    69 
       
    70 	bool m_identity_asked;
       
    71 	bool m_is_pending;
       
    72 
       
    73 	eap_type_securid_state_c m_state;
       
    74 
       
    75 	bool m_is_reauthentication;
       
    76 
       
    77 	u32_t m_offset, m_mtu_length, m_trailer_length;
       
    78 
       
    79 	bool m_use_eap_expanded_type;
       
    80 
       
    81 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
       
    82 	bool m_skip_user_interactions;
       
    83 #endif //#if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
       
    84 
       
    85 
       
    86 	EAP_FUNC_IMPORT eap_status_e finish_successful_authentication();
       
    87 
       
    88 	EAP_FUNC_IMPORT eap_status_e finish_unsuccessful_authentication(
       
    89 		const bool authentication_cancelled);
       
    90 
       
    91 	EAP_FUNC_IMPORT eap_status_e complete_eap_identity_query(
       
    92 		const eap_variable_data_c * const identity);
       
    93 
       
    94 	EAP_FUNC_IMPORT eap_status_e client_securid_complete_passcode_query(
       
    95 		const eap_variable_data_c * const passcode);
       
    96 
       
    97 	EAP_FUNC_IMPORT eap_status_e client_securid_complete_pincode_query(
       
    98 		const eap_variable_data_c * const pincode,
       
    99 		const eap_variable_data_c * const passcode);
       
   100 
       
   101 	EAP_FUNC_IMPORT eap_status_e client_gtc_complete_user_input_query(
       
   102 		const eap_variable_data_c * const input);
       
   103 
       
   104 	EAP_FUNC_IMPORT eap_status_e remove_username_store();
       
   105 
       
   106 	/**
       
   107 	 * This function processes the SecurID packets.
       
   108 	 */
       
   109 	EAP_FUNC_IMPORT eap_status_e securid_packet_process(
       
   110 		eap_header_wr_c * const eap, ///< This is pointer to EAP header and data.
       
   111 		const u32_t eap_packet_length ///< This is length of received EAP packet.
       
   112 		);
       
   113 
       
   114 	/**
       
   115 	 * This function tells if the object is a client or a server..
       
   116 	 */
       
   117 	EAP_FUNC_IMPORT bool get_is_client();
       
   118 
       
   119 	eap_buf_chain_wr_c * create_send_packet(u32_t length);
       
   120 
       
   121 	eap_status_e packet_send(
       
   122 		eap_buf_chain_wr_c * const data,
       
   123 		const u32_t data_length);
       
   124 
       
   125 	eap_status_e client_packet_process(
       
   126 		eap_header_wr_c * const received_eap,
       
   127 		const u32_t eap_packet_length);
       
   128 
       
   129 	eap_status_e client_securid_packet_process(
       
   130 		eap_header_wr_c * const eap,
       
   131 		const u32_t eap_packet_length);
       
   132 
       
   133 	eap_status_e client_gtc_packet_process(
       
   134 		eap_header_wr_c * const eap,
       
   135 		const u32_t eap_packet_length);
       
   136 
       
   137 #ifdef EAP_SECURID_SERVER
       
   138 
       
   139 	eap_status_e server_packet_process(
       
   140 		eap_header_wr_c * const received_eap,
       
   141 		const u32_t eap_packet_length);
       
   142 
       
   143 #endif
       
   144 
       
   145 protected:
       
   146 
       
   147 public:
       
   148 
       
   149 	/**
       
   150 	 * Destructor cancels all timers and deletes member attributes.
       
   151 	 */
       
   152 	EAP_FUNC_IMPORT virtual ~eap_type_securid_c();
       
   153 
       
   154 	/**
       
   155 	 * Constructor initializes all member attributes.
       
   156 	 */
       
   157 	EAP_FUNC_IMPORT eap_type_securid_c(
       
   158 		abs_eap_am_tools_c * const tools,
       
   159 		abs_eap_base_type_c * const partner,
       
   160 		eap_am_type_securid_c * const am_type_securid,
       
   161 		const bool free_am_type_securid,
       
   162 		const eap_type_value_e current_eap_type,
       
   163 		const bool is_client_when_true,
       
   164 		const eap_am_network_id_c * const receive_network_id);
       
   165 
       
   166 	/**
       
   167 	 * The partner class calls this function when EAP/SecurID packet is received.
       
   168 	 * see also eap_base_type_c::packet_process().
       
   169 	 */
       
   170 	EAP_FUNC_IMPORT eap_status_e packet_process(
       
   171 		const eap_am_network_id_c * const receive_network_id, ///< This is the network identity of the received EAP packet.
       
   172 		eap_header_wr_c * const eap, ///< This is pointer to EAP header and data.
       
   173 		const u32_t eap_packet_length ///< This is length of received EAP packet.
       
   174 		);
       
   175 
       
   176 
       
   177 	// This is commented in eap_base_type_c::get_is_valid().
       
   178 	EAP_FUNC_IMPORT bool get_is_valid();
       
   179 	
       
   180 	EAP_FUNC_IMPORT void set_is_valid();
       
   181 
       
   182 	/**
       
   183 	 * This function resets the reused eap_type_securid_c object.
       
   184 	 */
       
   185 	EAP_FUNC_IMPORT eap_status_e reset();
       
   186 
       
   187 	EAP_FUNC_IMPORT eap_status_e shutdown();
       
   188 
       
   189 	EAP_FUNC_IMPORT eap_status_e configure();
       
   190 
       
   191 	// This is commented in eap_base_type_c::query_eap_identity().
       
   192 	EAP_FUNC_IMPORT eap_status_e query_eap_identity(
       
   193 		const bool must_be_synchronous,
       
   194 		eap_variable_data_c * const identity,
       
   195 		const eap_am_network_id_c * const receive_network_id,
       
   196 		const u8_t eap_identifier);
       
   197 
       
   198 	EAP_FUNC_IMPORT eap_status_e set_initial_eap_identifier(
       
   199 		const eap_am_network_id_c * const receive_network_id,
       
   200 		const u8_t initial_identifier);
       
   201 
       
   202 	// This is commented in eap_base_type_c::eap_acknowledge().
       
   203 	EAP_FUNC_IMPORT eap_status_e eap_acknowledge(
       
   204 		const eap_am_network_id_c * const receive_network_id);
       
   205 
       
   206 }; // class eap_type_securid_c
       
   207 
       
   208 #endif // EAP_TYPE_SECURID_H
       
   209 
       
   210 //--------------------------------------------------
       
   211 
       
   212 
       
   213 // End.