eapol/eapol_framework/eapol_common/type/tls_peap/tls/include/tls_record_message.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    28 #include "tls_handshake_message.h"
    28 #include "tls_handshake_message.h"
    29 #include "tls_change_cipher_spec_message.h"
    29 #include "tls_change_cipher_spec_message.h"
    30 #include "tls_alert_message.h"
    30 #include "tls_alert_message.h"
    31 #include "tls_application_data_message.h"
    31 #include "tls_application_data_message.h"
    32 #include "abs_tls_message_hash.h"
    32 #include "abs_tls_message_hash.h"
       
    33 #include "eap_am_export.h"
       
    34 // Start: added by script change_export_macros.sh.
       
    35 #if defined(EAP_NO_EXPORT_TLS_RECORD_MESSAGE_H)
       
    36 	#define EAP_CLASS_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_NONSHARABLE 
       
    37 	#define EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H 
       
    38 	#define EAP_C_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H 
       
    39 	#define EAP_FUNC_EXPORT_TLS_RECORD_MESSAGE_H 
       
    40 	#define EAP_C_FUNC_EXPORT_TLS_RECORD_MESSAGE_H 
       
    41 #elif defined(EAP_EXPORT_TLS_RECORD_MESSAGE_H)
       
    42 	#define EAP_CLASS_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_EXPORT 
       
    43 	#define EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_FUNC_EXPORT 
       
    44 	#define EAP_C_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_C_FUNC_EXPORT 
       
    45 	#define EAP_FUNC_EXPORT_TLS_RECORD_MESSAGE_H EAP_FUNC_EXPORT 
       
    46 	#define EAP_C_FUNC_EXPORT_TLS_RECORD_MESSAGE_H EAP_C_FUNC_EXPORT 
       
    47 #else
       
    48 	#define EAP_CLASS_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_IMPORT 
       
    49 	#define EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_FUNC_IMPORT 
       
    50 	#define EAP_C_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H EAP_C_FUNC_IMPORT 
       
    51 	#define EAP_FUNC_EXPORT_TLS_RECORD_MESSAGE_H 
       
    52 	#define EAP_C_FUNC_EXPORT_TLS_RECORD_MESSAGE_H 
       
    53 #endif
       
    54 // End: added by script change_export_macros.sh.
       
    55 
    33 
    56 
    34 
    57 
    35 /** @file */
    58 /** @file */
    36 
    59 
    37 //----------------------------------------------------------------------------
    60 //----------------------------------------------------------------------------
    46  * Analysed records are skipped during the asyncronous
    69  * Analysed records are skipped during the asyncronous
    47  * analyse of records. Asyncronous analyse is needed
    70  * analyse of records. Asyncronous analyse is needed
    48  * because of the PKI functions are asyncronous in
    71  * because of the PKI functions are asyncronous in
    49  * Symbian.
    72  * Symbian.
    50  */
    73  */
    51 class EAP_EXPORT tls_record_message_c
    74 class EAP_CLASS_VISIBILITY_TLS_RECORD_MESSAGE_H tls_record_message_c
    52 {
    75 {
    53 private:
    76 private:
    54 	//--------------------------------------------------
    77 	//--------------------------------------------------
    55 
    78 
    56 	/// This is pointer to the tools class. @see abs_eap_am_tools_c.
    79 	/// This is pointer to the tools class. @see abs_eap_am_tools_c.
   105 
   128 
   106 	/**
   129 	/**
   107 	 * The set_is_valid() function sets the state of the object valid.
   130 	 * The set_is_valid() function sets the state of the object valid.
   108 	 * The creator of this object calls this function after it is initialized. 
   131 	 * The creator of this object calls this function after it is initialized. 
   109 	 */
   132 	 */
   110 	EAP_FUNC_IMPORT void set_is_valid();
   133 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H void set_is_valid();
   111 
   134 
   112 	//--------------------------------------------------
   135 	//--------------------------------------------------
   113 protected:
   136 protected:
   114 	//--------------------------------------------------
   137 	//--------------------------------------------------
   115 
   138 
   118 	//--------------------------------------------------
   141 	//--------------------------------------------------
   119 
   142 
   120 	/**
   143 	/**
   121 	 * The destructor of the tls_record_message_c class does nothing special.
   144 	 * The destructor of the tls_record_message_c class does nothing special.
   122 	 */
   145 	 */
   123 	EAP_FUNC_IMPORT virtual ~tls_record_message_c();
   146 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H virtual ~tls_record_message_c();
   124 
   147 
   125 	/**
   148 	/**
   126 	 * The constructor of the tls_record_c class simply initializes the attributes.
   149 	 * The constructor of the tls_record_c class simply initializes the attributes.
   127 	 */
   150 	 */
   128 	EAP_FUNC_IMPORT tls_record_message_c(
   151 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H tls_record_message_c(
   129 		abs_eap_am_tools_c * const tools,
   152 		abs_eap_am_tools_c * const tools,
   130 		abs_tls_message_hash_c * const message_hash,
   153 		abs_tls_message_hash_c * const message_hash,
   131 		const bool is_client);
   154 		const bool is_client);
   132 
   155 
   133 	/**
   156 	/**
   134 	 * Object must indicate it's validity.
   157 	 * Object must indicate it's validity.
   135 	 * If object initialization fails this function must return false.
   158 	 * If object initialization fails this function must return false.
   136 	 * @return This function returns the validity of this object.
   159 	 * @return This function returns the validity of this object.
   137 	 */
   160 	 */
   138 	EAP_FUNC_IMPORT bool get_is_valid();
   161 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H bool get_is_valid();
   139 
   162 
   140 
   163 
   141 	/**
   164 	/**
   142 	 * This function returns the index of message where analyse must continue.
   165 	 * This function returns the index of message where analyse must continue.
   143 	 */
   166 	 */
   144 	EAP_FUNC_IMPORT u32_t get_analyse_index() const;
   167 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_analyse_index() const;
   145 
   168 
   146 	/**
   169 	/**
   147 	 * This function saves the index of message where analyse must continue.
   170 	 * This function saves the index of message where analyse must continue.
   148 	 */
   171 	 */
   149 	EAP_FUNC_IMPORT void save_analyse_index(const u32_t analyse_index);
   172 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H void save_analyse_index(const u32_t analyse_index);
   150 
   173 
   151 
   174 
   152 	/**
   175 	/**
   153 	 * This function returns the flag that tells whether this record is parsed (true) or not (flase).
   176 	 * This function returns the flag that tells whether this record is parsed (true) or not (flase).
   154 	 */
   177 	 */
   155 	EAP_FUNC_IMPORT bool get_parsed_record() const;
   178 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H bool get_parsed_record() const;
   156 
   179 
   157 	/**
   180 	/**
   158 	 * This function sets the flag that tells this record is parsed.
   181 	 * This function sets the flag that tells this record is parsed.
   159 	 */
   182 	 */
   160 	EAP_FUNC_IMPORT void set_parsed_record();
   183 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H void set_parsed_record();
   161 
   184 
   162 
   185 
   163 	/**
   186 	/**
   164 	 * This function returns the flag that tells whether the TLS-record header is included to m_record_message_data (true) or not (flase).
   187 	 * This function returns the flag that tells whether the TLS-record header is included to m_record_message_data (true) or not (flase).
   165 	 */
   188 	 */
   166 	EAP_FUNC_IMPORT bool get_tls_record_header_is_included() const;
   189 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H bool get_tls_record_header_is_included() const;
   167 
   190 
   168 	/**
   191 	/**
   169 	 * This function sets the flag that tells whether the TLS-record header is included to m_record_message_data (true) or not (flase).
   192 	 * This function sets the flag that tells whether the TLS-record header is included to m_record_message_data (true) or not (flase).
   170 	 */
   193 	 */
   171 	EAP_FUNC_IMPORT void set_tls_record_header_is_included(const bool when_true_tls_record_header_is_included);
   194 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H void set_tls_record_header_is_included(const bool when_true_tls_record_header_is_included);
   172 
   195 
   173 
   196 
   174 	/**
   197 	/**
   175 	 * This function returns the flag that tells whether the cipher suite is applied to this record (true) or not (flase).
   198 	 * This function returns the flag that tells whether the cipher suite is applied to this record (true) or not (flase).
   176 	 */
   199 	 */
   177 	EAP_FUNC_IMPORT bool get_cipher_suite_applied() const;
   200 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H bool get_cipher_suite_applied() const;
   178 
   201 
   179 	/**
   202 	/**
   180 	 * This function sets the flag that tells the cipher suite is applied to this record.
   203 	 * This function sets the flag that tells the cipher suite is applied to this record.
   181 	 */
   204 	 */
   182 	EAP_FUNC_IMPORT void set_cipher_suite_applied();
   205 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H void set_cipher_suite_applied();
   183 
   206 
   184 
   207 
   185 	/**
   208 	/**
   186 	 * This function sets the protocol of this record.
   209 	 * This function sets the protocol of this record.
   187 	 */
   210 	 */
   188 	EAP_FUNC_IMPORT eap_status_e set_protocol(
   211 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e set_protocol(
   189 		tls_record_protocol_e protocol);
   212 		tls_record_protocol_e protocol);
   190 
   213 
   191 	/**
   214 	/**
   192 	 * This function sets the version of TLS.
   215 	 * This function sets the version of TLS.
   193 	 */
   216 	 */
   194 	EAP_FUNC_IMPORT eap_status_e set_version(
   217 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e set_version(
   195 		tls_version_e version);
   218 		tls_version_e version);
   196 
   219 
   197 	/**
   220 	/**
   198 	 * This function copies the appropriate fields of this record.
   221 	 * This function copies the appropriate fields of this record.
   199 	 */
   222 	 */
   200 	EAP_FUNC_IMPORT eap_status_e set_record_header_copy(
   223 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e set_record_header_copy(
   201 		const tls_record_header_c * const tls_record_header);
   224 		const tls_record_header_c * const tls_record_header);
   202 
   225 
   203 	/**
   226 	/**
   204 	 * This function sets the reference of TLS-record data.
   227 	 * This function sets the reference of TLS-record data.
   205 	 * NOTE this does not copy the message.
   228 	 * NOTE this does not copy the message.
   206 	 */
   229 	 */
   207 	EAP_FUNC_IMPORT eap_status_e set_record_message_data(
   230 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e set_record_message_data(
   208 			void * const data,
   231 			void * const data,
   209 			const u32_t data_length);
   232 			const u32_t data_length);
   210 
   233 
   211 	/**
   234 	/**
   212 	 * This function returns the reference of TLS-record data.
   235 	 * This function returns the reference of TLS-record data.
   213 	 * NOTE this is not a copy of the message.
   236 	 * NOTE this is not a copy of the message.
   214 	 */
   237 	 */
   215 	EAP_FUNC_IMPORT eap_variable_data_c * get_record_message_data();
   238 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_variable_data_c * get_record_message_data();
   216 
   239 
   217 	/**
   240 	/**
   218 	 * This function returns the protocol of TLS-record.
   241 	 * This function returns the protocol of TLS-record.
   219 	 */
   242 	 */
   220 	EAP_FUNC_IMPORT tls_record_protocol_e get_protocol() const;
   243 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H tls_record_protocol_e get_protocol() const;
   221 
   244 
   222 	/**
   245 	/**
   223 	 * This function returns the version of TLS-record.
   246 	 * This function returns the version of TLS-record.
   224 	 */
   247 	 */
   225 	EAP_FUNC_IMPORT tls_version_e get_version() const;
   248 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H tls_version_e get_version() const;
   226 
   249 
   227 	/**
   250 	/**
   228 	 * This function returns the data length of TLS-record.
   251 	 * This function returns the data length of TLS-record.
   229 	 */
   252 	 */
   230 	EAP_FUNC_IMPORT u32_t get_data_length() const;
   253 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_data_length() const;
   231 
   254 
   232 	/**
   255 	/**
   233 	 * This function adds the data length of TLS-record.
   256 	 * This function adds the data length of TLS-record.
   234 	 */
   257 	 */
   235 	EAP_FUNC_IMPORT eap_status_e add_data_length(const u32_t data_length);
   258 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_data_length(const u32_t data_length);
   236 
   259 
   237 	/**
   260 	/**
   238 	 * This function adds TLS-handshake message to this TLS-record.
   261 	 * This function adds TLS-handshake message to this TLS-record.
   239 	 */
   262 	 */
   240 	EAP_FUNC_IMPORT eap_status_e add_handshake_message(
   263 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_handshake_message(
   241 		tls_handshake_message_c * const handshake_message,
   264 		tls_handshake_message_c * const handshake_message,
   242 		const bool free_handshake_message);
   265 		const bool free_handshake_message);
   243 
   266 
   244 	/**
   267 	/**
   245 	 * This function adds TLS-change cipher spec message to this TLS-record.
   268 	 * This function adds TLS-change cipher spec message to this TLS-record.
   246 	 */
   269 	 */
   247 	EAP_FUNC_IMPORT eap_status_e add_change_cipher_spec_message(
   270 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_change_cipher_spec_message(
   248 		tls_change_cipher_spec_message_c * const change_cipher_spec_message,
   271 		tls_change_cipher_spec_message_c * const change_cipher_spec_message,
   249 		const bool free_change_cipher_spec_message);
   272 		const bool free_change_cipher_spec_message);
   250 
   273 
   251 	/**
   274 	/**
   252 	 * This function adds TLS-alert message to this TLS-record.
   275 	 * This function adds TLS-alert message to this TLS-record.
   253 	 */
   276 	 */
   254 	EAP_FUNC_IMPORT eap_status_e add_alert_message(
   277 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_alert_message(
   255 		tls_alert_message_c * const alert_message,
   278 		tls_alert_message_c * const alert_message,
   256 		const bool free_alert_message);
   279 		const bool free_alert_message);
   257 
   280 
   258 	/**
   281 	/**
   259 	 * This function adds TLS-application data message to this TLS-record.
   282 	 * This function adds TLS-application data message to this TLS-record.
   260 	 */
   283 	 */
   261 	EAP_FUNC_IMPORT eap_status_e add_application_data_message(
   284 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_application_data_message(
   262 		tls_application_data_message_c * const alert_message,
   285 		tls_application_data_message_c * const alert_message,
   263 		const bool free_alert_message);
   286 		const bool free_alert_message);
   264 
   287 
   265 	/**
   288 	/**
   266 	 * This function adds data of every TLS-protocol message to internal message buffer (m_record_message_data).
   289 	 * This function adds data of every TLS-protocol message to internal message buffer (m_record_message_data).
   267 	 */
   290 	 */
   268 	EAP_FUNC_IMPORT eap_status_e add_message_data();
   291 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H eap_status_e add_message_data();
   269 
   292 
   270 	/**
   293 	/**
   271 	 * This function returns count of the TLS-handshake messages.
   294 	 * This function returns count of the TLS-handshake messages.
   272 	 */
   295 	 */
   273 	EAP_FUNC_IMPORT u32_t get_handshake_count() const;
   296 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_handshake_count() const;
   274 
   297 
   275 	/**
   298 	/**
   276 	 * This function returns count of the TLS-change cipher spec messages.
   299 	 * This function returns count of the TLS-change cipher spec messages.
   277 	 */
   300 	 */
   278 	EAP_FUNC_IMPORT u32_t get_change_cipher_spec_count() const;
   301 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_change_cipher_spec_count() const;
   279 
   302 
   280 	/**
   303 	/**
   281 	 * This function returns count of the TLS-alert messages.
   304 	 * This function returns count of the TLS-alert messages.
   282 	 */
   305 	 */
   283 	EAP_FUNC_IMPORT u32_t get_alert_count() const;
   306 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_alert_count() const;
   284 
   307 
   285 	/**
   308 	/**
   286 	 * This function returns count of the TLS-application data messages.
   309 	 * This function returns count of the TLS-application data messages.
   287 	 */
   310 	 */
   288 	EAP_FUNC_IMPORT u32_t get_application_data_count() const;
   311 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H u32_t get_application_data_count() const;
   289 
   312 
   290 	/**
   313 	/**
   291 	 * This function returns the TLS-handshake message selected by index.
   314 	 * This function returns the TLS-handshake message selected by index.
   292 	 */
   315 	 */
   293 	EAP_FUNC_IMPORT tls_handshake_message_c * get_handshake(
   316 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H tls_handshake_message_c * get_handshake(
   294 		const u32_t index) EAP_TEMPLATE_CONST;
   317 		const u32_t index) EAP_TEMPLATE_CONST;
   295 
   318 
   296 	/**
   319 	/**
   297 	 * This function returns the TLS-change cipher spec message selected by index.
   320 	 * This function returns the TLS-change cipher spec message selected by index.
   298 	 */
   321 	 */
   299 	EAP_FUNC_IMPORT const tls_change_cipher_spec_message_c * get_change_cipher_spec(
   322 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H const tls_change_cipher_spec_message_c * get_change_cipher_spec(
   300 		const u32_t index) const;
   323 		const u32_t index) const;
   301 
   324 
   302 	/**
   325 	/**
   303 	 * This function returns the TLS-alert message selected by index.
   326 	 * This function returns the TLS-alert message selected by index.
   304 	 */
   327 	 */
   305 	EAP_FUNC_IMPORT const tls_alert_message_c * get_alert(
   328 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H const tls_alert_message_c * get_alert(
   306 		const u32_t index) const;
   329 		const u32_t index) const;
   307 
   330 
   308 	/**
   331 	/**
   309 	 * This function returns the TLS-application data message selected by index.
   332 	 * This function returns the TLS-application data message selected by index.
   310 	 */
   333 	 */
   311 	EAP_FUNC_IMPORT tls_application_data_message_c * get_application_data(
   334 	EAP_FUNC_VISIBILITY_TLS_RECORD_MESSAGE_H tls_application_data_message_c * get_application_data(
   312 		const u32_t index) const;
   335 		const u32_t index) const;
   313 
   336 
   314 	// 
   337 	// 
   315 	//--------------------------------------------------
   338 	//--------------------------------------------------
   316 }; // class tls_record_message_c
   339 }; // class tls_record_message_c