eapol/eapol_framework/eapol_common/type/tls_peap/tls/include/tls_message.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    25 #include "eap_tools.h"
    25 #include "eap_tools.h"
    26 #include "eap_array.h"
    26 #include "eap_array.h"
    27 #include "tls_record_message.h"
    27 #include "tls_record_message.h"
    28 #include "abs_tls_message_hash.h"
    28 #include "abs_tls_message_hash.h"
    29 #include "abs_tls_apply_cipher_spec.h"
    29 #include "abs_tls_apply_cipher_spec.h"
       
    30 #include "eap_am_export.h"
       
    31 // Start: added by script change_export_macros.sh.
       
    32 #if defined(EAP_NO_EXPORT_TLS_MESSAGE_H)
       
    33 	#define EAP_CLASS_VISIBILITY_TLS_MESSAGE_H EAP_NONSHARABLE 
       
    34 	#define EAP_FUNC_VISIBILITY_TLS_MESSAGE_H 
       
    35 	#define EAP_C_FUNC_VISIBILITY_TLS_MESSAGE_H 
       
    36 	#define EAP_FUNC_EXPORT_TLS_MESSAGE_H 
       
    37 	#define EAP_C_FUNC_EXPORT_TLS_MESSAGE_H 
       
    38 #elif defined(EAP_EXPORT_TLS_MESSAGE_H)
       
    39 	#define EAP_CLASS_VISIBILITY_TLS_MESSAGE_H EAP_EXPORT 
       
    40 	#define EAP_FUNC_VISIBILITY_TLS_MESSAGE_H EAP_FUNC_EXPORT 
       
    41 	#define EAP_C_FUNC_VISIBILITY_TLS_MESSAGE_H EAP_C_FUNC_EXPORT 
       
    42 	#define EAP_FUNC_EXPORT_TLS_MESSAGE_H EAP_FUNC_EXPORT 
       
    43 	#define EAP_C_FUNC_EXPORT_TLS_MESSAGE_H EAP_C_FUNC_EXPORT 
       
    44 #else
       
    45 	#define EAP_CLASS_VISIBILITY_TLS_MESSAGE_H EAP_IMPORT 
       
    46 	#define EAP_FUNC_VISIBILITY_TLS_MESSAGE_H EAP_FUNC_IMPORT 
       
    47 	#define EAP_C_FUNC_VISIBILITY_TLS_MESSAGE_H EAP_C_FUNC_IMPORT 
       
    48 	#define EAP_FUNC_EXPORT_TLS_MESSAGE_H 
       
    49 	#define EAP_C_FUNC_EXPORT_TLS_MESSAGE_H 
       
    50 #endif
       
    51 // End: added by script change_export_macros.sh.
       
    52 
    30 
    53 
    31 /** @file */
    54 /** @file */
    32 
    55 
    33 
    56 
    34 //----------------------------------------------------------------------------
    57 //----------------------------------------------------------------------------
    43  * Analysed messages are skipped during the asyncronous
    66  * Analysed messages are skipped during the asyncronous
    44  * analyse of messages. Asyncronous analyse is needed
    67  * analyse of messages. Asyncronous analyse is needed
    45  * because of the PKI functions are asyncronous in
    68  * because of the PKI functions are asyncronous in
    46  * Symbian.
    69  * Symbian.
    47  */
    70  */
    48 class EAP_EXPORT tls_message_c
    71 class EAP_CLASS_VISIBILITY_TLS_MESSAGE_H tls_message_c
    49 {
    72 {
    50 private:
    73 private:
    51 	//--------------------------------------------------
    74 	//--------------------------------------------------
    52 
    75 
    53 	/// This is pointer to the tools class. @see abs_eap_am_tools_c.
    76 	/// This is pointer to the tools class. @see abs_eap_am_tools_c.
    92 	//--------------------------------------------------
   115 	//--------------------------------------------------
    93 
   116 
    94 	/**
   117 	/**
    95 	 * The destructor of the tls_message_c class does nothing special.
   118 	 * The destructor of the tls_message_c class does nothing special.
    96 	 */
   119 	 */
    97 	EAP_FUNC_IMPORT virtual ~tls_message_c();
   120 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H virtual ~tls_message_c();
    98 
   121 
    99 	/**
   122 	/**
   100 	 * The constructor of the tls_message_c class simply initializes the attributes.
   123 	 * The constructor of the tls_message_c class simply initializes the attributes.
   101 	 */
   124 	 */
   102 	EAP_FUNC_IMPORT tls_message_c(
   125 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H tls_message_c(
   103 		abs_eap_am_tools_c * const tools,
   126 		abs_eap_am_tools_c * const tools,
   104 		abs_tls_message_hash_c * const message_hash,
   127 		abs_tls_message_hash_c * const message_hash,
   105 		abs_tls_apply_cipher_spec_c * const apply_cipher_spec,
   128 		abs_tls_apply_cipher_spec_c * const apply_cipher_spec,
   106 		abs_tls_change_cipher_spec_c * const change_cipher_spec,
   129 		abs_tls_change_cipher_spec_c * const change_cipher_spec,
   107 		const bool is_client);
   130 		const bool is_client);
   108 
   131 
   109 	/**
   132 	/**
   110 	 * This function resets this object.
   133 	 * This function resets this object.
   111 	 */
   134 	 */
   112 	EAP_FUNC_IMPORT eap_status_e reset();
   135 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e reset();
   113 
   136 
   114 	/**
   137 	/**
   115 	 * This function returns the index of message where analyse must continue.
   138 	 * This function returns the index of message where analyse must continue.
   116 	 */
   139 	 */
   117 	EAP_FUNC_IMPORT u32_t get_analyse_index() const;
   140 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H u32_t get_analyse_index() const;
   118 
   141 
   119 	/**
   142 	/**
   120 	 * This function saves the index of message where analyse must continue.
   143 	 * This function saves the index of message where analyse must continue.
   121 	 */
   144 	 */
   122 	EAP_FUNC_IMPORT void save_analyse_index(const u32_t analyse_index);
   145 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H void save_analyse_index(const u32_t analyse_index);
   123 
   146 
   124 	/**
   147 	/**
   125 	 * This function copies the received TLS-message data and EAP-identifier.
   148 	 * This function copies the received TLS-message data and EAP-identifier.
   126 	 * EAP-identifier is needed in XP PEAPv0. That stupid version uses
   149 	 * EAP-identifier is needed in XP PEAPv0. That stupid version uses
   127 	 * same EAP-identifier with PEAP header and tunneled EAP-header.
   150 	 * same EAP-identifier with PEAP header and tunneled EAP-header.
   128 	 */
   151 	 */
   129 	EAP_FUNC_IMPORT eap_status_e set_tls_message_data(
   152 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e set_tls_message_data(
   130 		eap_variable_data_c * const tls_message_data,
   153 		eap_variable_data_c * const tls_message_data,
   131 		const u8_t received_eap_identifier);
   154 		const u8_t received_eap_identifier);
   132 
   155 
   133 	/**
   156 	/**
   134 	 * This function returns the TLS-message data.
   157 	 * This function returns the TLS-message data.
   135 	 */
   158 	 */
   136 	EAP_FUNC_IMPORT eap_variable_data_c * get_tls_message_data();
   159 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_variable_data_c * get_tls_message_data();
   137 
   160 
   138 	/**
   161 	/**
   139 	 * This function returns the EAP-identifier.
   162 	 * This function returns the EAP-identifier.
   140 	 */
   163 	 */
   141 	EAP_FUNC_IMPORT u8_t get_received_eap_identifier();
   164 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H u8_t get_received_eap_identifier();
   142 
   165 
   143 	/**
   166 	/**
   144 	 * This function adds TLS-record to m_record_messages.
   167 	 * This function adds TLS-record to m_record_messages.
   145 	 * Parameter free_record tells whether record must be freed in destructor.
   168 	 * Parameter free_record tells whether record must be freed in destructor.
   146 	 */
   169 	 */
   147 	EAP_FUNC_IMPORT eap_status_e add_record_message(
   170 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e add_record_message(
   148 		tls_record_message_c * const record,
   171 		tls_record_message_c * const record,
   149 		const bool free_record,
   172 		const bool free_record,
   150 		const bool includes_tls_handshake_message);
   173 		const bool includes_tls_handshake_message);
   151 
   174 
   152 	/**
   175 	/**
   153 	 * This function fragments TLS-protocol messages to one or more TLS-record messages.
   176 	 * This function fragments TLS-protocol messages to one or more TLS-record messages.
   154 	 */
   177 	 */
   155 	EAP_FUNC_IMPORT eap_status_e fragment_tls_records(
   178 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e fragment_tls_records(
   156 		tls_record_message_c * const tls_record_message,
   179 		tls_record_message_c * const tls_record_message,
   157 		eap_array_c<tls_record_message_c> * const tls_fragments);
   180 		eap_array_c<tls_record_message_c> * const tls_fragments);
   158 
   181 
   159 	/**
   182 	/**
   160 	 * This function adds data of every TLS-record to tls_message_buffer.
   183 	 * This function adds data of every TLS-record to tls_message_buffer.
   161 	 */
   184 	 */
   162 	EAP_FUNC_IMPORT eap_status_e add_message_data(
   185 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e add_message_data(
   163 		eap_variable_data_c * const tls_message_buffer,
   186 		eap_variable_data_c * const tls_message_buffer,
   164 		bool * const includes_tls_handshake_message);
   187 		bool * const includes_tls_handshake_message);
   165 
   188 
   166 	/**
   189 	/**
   167 	 * This function returns count of the TLS-records.
   190 	 * This function returns count of the TLS-records.
   168 	 */
   191 	 */
   169 	EAP_FUNC_IMPORT u32_t get_record_message_count() const;
   192 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H u32_t get_record_message_count() const;
   170 
   193 
   171 	/**
   194 	/**
   172 	 * This function returns pointer to the TLS-record selected by index.
   195 	 * This function returns pointer to the TLS-record selected by index.
   173 	 */
   196 	 */
   174 	EAP_FUNC_IMPORT tls_record_message_c * get_record_message(
   197 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H tls_record_message_c * get_record_message(
   175 		const u32_t index) const;
   198 		const u32_t index) const;
   176 
   199 
   177 	/**
   200 	/**
   178 	 * This function removes the TLS-record selected by index.
   201 	 * This function removes the TLS-record selected by index.
   179 	 */
   202 	 */
   180 	EAP_FUNC_IMPORT eap_status_e remove_record_message(
   203 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H eap_status_e remove_record_message(
   181 		const u32_t index);
   204 		const u32_t index);
   182 
   205 
   183 	/**
   206 	/**
   184 	 * This function returns pointer to the last TLS-record.
   207 	 * This function returns pointer to the last TLS-record.
   185 	 */
   208 	 */
   186 	EAP_FUNC_IMPORT tls_record_message_c * get_last_record_message() const;
   209 	EAP_FUNC_VISIBILITY_TLS_MESSAGE_H tls_record_message_c * get_last_record_message() const;
   187 
   210 
   188 	// 
   211 	// 
   189 	//--------------------------------------------------
   212 	//--------------------------------------------------
   190 }; // class tls_message_c
   213 }; // class tls_message_c
   191 
   214