eapol/eapol_framework/eapol_common/type/tls_peap/tls/include/tls_base_record.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 
       
    21 #if !defined(_TLS_BASE_RECORD_H_)
       
    22 #define _TLS_BASE_RECORD_H_
       
    23 
       
    24 
       
    25 #include "tls_peap_types.h"
       
    26 #include "eap_array.h"
       
    27 #include "eap_header.h"
       
    28 
       
    29 class abs_tls_base_record_c;
       
    30 class abs_eap_am_tools_c;
       
    31 class eap_am_network_id_c;
       
    32 class tls_record_header_c;
       
    33 class eap_rogue_ap_entry_c;
       
    34 
       
    35 
       
    36 /// The tls_base_record_c class declares pure virtual functions 
       
    37 /// a user class of TLS-record class could call.
       
    38 class EAP_EXPORT tls_base_record_c
       
    39 {
       
    40 private:
       
    41 	//--------------------------------------------------
       
    42 
       
    43 	/// This is back pointer to object which created this object.
       
    44 	/// The tls_base_record_c object sends packets to the network using m_type_partner object.
       
    45 	/// @see abs_tls_base_record_c.
       
    46 	abs_tls_base_record_c *m_type_partner;
       
    47 
       
    48 	/// This is pointer to the tools class. @see abs_eap_am_tools_c.
       
    49 	abs_eap_am_tools_c * const m_am_tools;
       
    50 
       
    51 	/**
       
    52 	 * The set_is_valid() function sets the state of the object valid.
       
    53 	 * The creator of this object calls this function after it is initialized. 
       
    54 	 */
       
    55 	virtual void set_is_valid() = 0;
       
    56 
       
    57 	//--------------------------------------------------
       
    58 protected:
       
    59 	//--------------------------------------------------
       
    60 
       
    61 	//--------------------------------------------------
       
    62 public:
       
    63 	//--------------------------------------------------
       
    64 
       
    65 	/**
       
    66 	 * The destructor of the tls_base_record_c class does nothing special.
       
    67 	 */
       
    68 	EAP_FUNC_IMPORT virtual ~tls_base_record_c();
       
    69 
       
    70 	/**
       
    71 	 * The constructor of the tls_base_record_c class simply initializes the attributes.
       
    72 	 * @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
       
    73 	 * @param partner is back pointer to object which created this object.
       
    74 	 * The tls_base_record_c object sends packets to the network using m_type_partner object.
       
    75 	 */
       
    76 	EAP_FUNC_IMPORT tls_base_record_c(
       
    77 		abs_eap_am_tools_c * const tools /*,
       
    78 		abs_tls_base_record_c * const partner */);
       
    79 
       
    80 	/**
       
    81 	 * Type partner is object below the tls_base_record_c object.
       
    82 	 * @return The get_type_partner() function returns the pointer to the partner class.
       
    83 	 */
       
    84 	EAP_FUNC_IMPORT abs_tls_base_record_c * get_type_partner();
       
    85 
       
    86 	EAP_FUNC_IMPORT void set_type_partner(abs_tls_base_record_c * const partner);
       
    87 
       
    88 	virtual void set_peap_version(
       
    89 		const peap_version_e peap_version, ///< This is the PEAP version (PEAPv2, PEAPv1, XP PEAPv0), yes very nice to have many different versions.
       
    90 		const bool use_tppd_tls_peap, ///< Of course some vendors have own TLS/PEAP quirks.
       
    91 		const bool use_tppd_peapv1_acknowledge_hack) = 0;
       
    92 
       
    93 	/**
       
    94 	 * The configure() function is called after the constructor of the 
       
    95 	 * object is successfully executed. During the function call the object 
       
    96 	 * could query the configuration. Each derived class must define this function.
       
    97 	 */
       
    98 	virtual eap_status_e configure() = 0;
       
    99 
       
   100 	/**
       
   101 	 * The shutdown() function is called before the destructor of the 
       
   102 	 * object is executed. During the function call the object 
       
   103 	 * could shutdown the operations, for example cancel timers.
       
   104 	 * Each derived class must define this function.
       
   105 	 */
       
   106 	virtual eap_status_e shutdown() = 0;
       
   107 
       
   108 	/**
       
   109 	 * This function sets the NAI realm.
       
   110 	 */
       
   111 	virtual eap_status_e set_nai_realm(const eap_variable_data_c * const NAI_realm) = 0;
       
   112 
       
   113 	/**
       
   114 	 * This function sends starts EAP-TLS/PEAP after a start message is received.
       
   115 	 */
       
   116 	virtual eap_status_e start_tls_peap_authentication(
       
   117 		const eap_variable_data_c * const received_authority_identity_payload
       
   118 		) = 0;
       
   119 
       
   120 	/**
       
   121 	 * This function starts the tunneled EAP-type within PEAP.
       
   122 	 */
       
   123 	virtual eap_status_e start_peap_tunneled_authentication(
       
   124 		const eap_am_network_id_c * const receive_network_id,
       
   125 		const u8_t received_eap_identifier,
       
   126 		const tls_session_type_e tls_session_type) = 0;
       
   127 
       
   128 	/**
       
   129 	 * This function processes the received packet.
       
   130 	 * @param tls_packet points to the buffer of the whole reassembled TLS-packet.
       
   131 	 */
       
   132 	virtual eap_status_e packet_process(
       
   133 		eap_variable_data_c * const tls_packet,
       
   134 		const u8_t received_eap_identifier) = 0;
       
   135 
       
   136 	/**
       
   137 	 * This function indicates the plain text EAP-Success or EAP-Failure packet is received.
       
   138 	 * @param receive_network_id includes the addresses (network identity) and packet type.
       
   139 	 * @param received_eap_identifier is the EAP-Identifier of the received EAP-Success packet.
       
   140 	 */
       
   141 	virtual eap_status_e plain_eap_success_failure_packet_received(
       
   142 		const eap_am_network_id_c * const receive_network_id,
       
   143 		const eap_code_value_e received_eap_code,
       
   144 		const u8_t received_eap_identifier) = 0;
       
   145 
       
   146 	/**
       
   147 	 * This function indicates the empty Ack packet is received.
       
   148 	 * This is used in TTLS.
       
   149 	 * @param receive_network_id includes the addresses (network identity) and packet type.
       
   150 	 * @param received_eap_identifier is the EAP-Identifier of the received EAP-Success packet.
       
   151 	 */
       
   152 	virtual eap_status_e empty_ack_packet_received(
       
   153 		const eap_am_network_id_c * const receive_network_id,
       
   154 		const u8_t received_eap_identifier) = 0;
       
   155 
       
   156 	/**
       
   157 	 * Object must indicate it's validity.
       
   158 	 * If object initialization fails this function must return false.
       
   159 	 * @return This function returns the validity of this object.
       
   160 	 */
       
   161 	virtual bool get_is_valid() = 0;
       
   162 
       
   163 	/**
       
   164 	 * This function resets the reused tls_base_record_c object.
       
   165 	 */
       
   166 	virtual eap_status_e reset() = 0;
       
   167 
       
   168 	virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0;
       
   169 
       
   170 	/**
       
   171 	 * This function reads the authority identity (A-ID) of server.
       
   172 	 * This is used in EAP-FAST.
       
   173 	 */
       
   174 	virtual eap_status_e read_authority_identity(eap_variable_data_c * const authority_identity_payload) = 0;
       
   175 
       
   176 	//--------------------------------------------------
       
   177 }; // class tls_base_record_c
       
   178 
       
   179 #endif //#if !defined(_TLS_BASE_RECORD_H_)
       
   180 
       
   181 //--------------------------------------------------
       
   182 
       
   183 
       
   184 
       
   185 // End.