eapol/eapol_framework/eapol_common/include/eapol_handle_tlv_message_data.h
branchRCL_3
changeset 19 c74b3d9f6b9e
parent 18 bad0cc58d154
equal deleted inserted replaced
18:bad0cc58d154 19:c74b3d9f6b9e
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: %
    19 * %version: 25.1.2 %
    20 */
    20 */
    21 
    21 
    22 #if !defined(_EAPOL_HANDLE_TLV_MESSAGE_DATA_H_)
    22 #if !defined(_EAP_CREATE_TLV_MESSAGE_DATA_H_)
    23 #define _EAPOL_HANDLE_TLV_MESSAGE_DATA_H_
    23 #define _EAP_CREATE_TLV_MESSAGE_DATA_H_
    24 
    24 
    25 #include "eap_am_types.h"
    25 #include "eap_am_types.h"
    26 #include "eap_tools.h"
    26 #include "eap_tools.h"
    27 #include "eap_array.h"
    27 #include "eap_array.h"
    28 #include "eap_process_tlv_message_data.h"
    28 #include "eap_tlv_message_data.h"
    29 #include "eap_expanded_type.h"
    29 #include "eap_expanded_type.h"
       
    30 
       
    31 
       
    32 enum eapol_tlv_message_type_e
       
    33 {
       
    34 	eapol_tlv_message_type_none                                 = 0,
       
    35 	eapol_tlv_message_type_array                                = 1,
       
    36 	eapol_tlv_message_type_boolean                              = 2,
       
    37 	eapol_tlv_message_type_eap_protocol_layer                   = 3,
       
    38 	eapol_tlv_message_type_eap_state_notification               = 4,
       
    39 	eapol_tlv_message_type_eap_status                           = 5,
       
    40 	eapol_tlv_message_type_eap_type                             = 6,
       
    41 	eapol_tlv_message_type_eapol_key_802_11_authentication_mode = 7,
       
    42 	eapol_tlv_message_type_eapol_key_authentication_type        = 8,
       
    43 	eapol_tlv_message_type_eapol_key_type                       = 9,
       
    44 	eapol_tlv_message_type_eapol_tkip_mic_failure_type          = 10,
       
    45 	eapol_tlv_message_type_eapol_wlan_authentication_state      = 11,
       
    46 	eapol_tlv_message_type_error                                = 12,
       
    47 	eapol_tlv_message_type_function                             = 13,
       
    48 	eapol_tlv_message_type_network_id                           = 14,
       
    49 	eapol_tlv_message_type_network_key                          = 15,
       
    50 	eapol_tlv_message_type_protected_setup_credential           = 16,
       
    51 	eapol_tlv_message_type_RSNA_cipher                          = 17,
       
    52 	eapol_tlv_message_type_session_key                          = 18,
       
    53 	eapol_tlv_message_type_u8_t                                 = 19,
       
    54 	eapol_tlv_message_type_u16_t                                = 20,
       
    55 	eapol_tlv_message_type_u32_t                                = 21,
       
    56 	eapol_tlv_message_type_u64_t                                = 22,
       
    57 	eapol_tlv_message_type_variable_data                        = 23,
       
    58 };
       
    59 
       
    60 
       
    61 enum eapol_tlv_message_type_function_e
       
    62 {
       
    63 	eapol_tlv_message_type_function_none                                        = 0,
       
    64 	eapol_tlv_message_type_function_check_pmksa_cache                           = 1,
       
    65 	eapol_tlv_message_type_function_start_authentication                        = 2,
       
    66 	eapol_tlv_message_type_function_complete_association                        = 3,
       
    67 	eapol_tlv_message_type_function_disassociation                              = 4,
       
    68 	eapol_tlv_message_type_function_start_preauthentication                     = 5,
       
    69 	eapol_tlv_message_type_function_start_reassociation                         = 6,
       
    70 	eapol_tlv_message_type_function_complete_reassociation                      = 7,
       
    71 	eapol_tlv_message_type_function_start_WPXM_reassociation                    = 8,
       
    72 	eapol_tlv_message_type_function_complete_WPXM_reassociation                 = 9,
       
    73 	eapol_tlv_message_type_function_packet_process                              = 10,
       
    74 	eapol_tlv_message_type_function_tkip_mic_failure                            = 11,
       
    75 	eapol_tlv_message_type_function_eap_acknowledge                             = 12,
       
    76 	eapol_tlv_message_type_function_update_header_offset                        = 13,
       
    77 	eapol_tlv_message_type_function_complete_check_pmksa_cache                  = 14,
       
    78 	eapol_tlv_message_type_function_packet_send                                 = 15,
       
    79 	eapol_tlv_message_type_function_associate                                   = 16,
       
    80 	eapol_tlv_message_type_function_disassociate                                = 17,
       
    81 	eapol_tlv_message_type_function_packet_data_session_key                     = 18,
       
    82 	eapol_tlv_message_type_function_state_notification                          = 19,
       
    83 	eapol_tlv_message_type_function_reassociate                                 = 20,
       
    84 	eapol_tlv_message_type_function_update_wlan_database_reference_values       = 21,
       
    85 	eapol_tlv_message_type_function_complete_start_WPXM_reassociation           = 22,
       
    86 	eapol_tlv_message_type_function_new_protected_setup_credentials             = 23,
       
    87 	eapol_tlv_message_type_function_illegal_value, // Keep this the last value.
       
    88 };
       
    89 
       
    90 
       
    91 enum eapol_message_payload_index_e
       
    92 {
       
    93 	eapol_message_payload_index_function        = 0,
       
    94 	eapol_message_payload_index_first_parameter = 1,
       
    95 };
       
    96 
    30 
    97 
    31 /** @file */
    98 /** @file */
    32 
    99 
    33 class eap_variable_data_c;
   100 class eap_variable_data_c;
    34 class eap_am_network_id_c;
   101 class eap_am_network_id_c;
    43 
   110 
    44 
   111 
    45 /// This class defines functions to add and parse message data composed
   112 /// This class defines functions to add and parse message data composed
    46 /// of Attribute-Value Pairs (See eap_tlv_header_c) to/from eap_tlv_message_data_c object.
   113 /// of Attribute-Value Pairs (See eap_tlv_header_c) to/from eap_tlv_message_data_c object.
    47 class EAP_EXPORT eapol_handle_tlv_message_data_c
   114 class EAP_EXPORT eapol_handle_tlv_message_data_c
    48 : public eap_process_tlv_message_data_c
   115 : public eap_tlv_message_data_c
    49 {
   116 {
    50 private:
   117 private:
    51 	//--------------------------------------------------
   118 	//--------------------------------------------------
    52 
   119 
    53 	abs_eap_am_tools_c * const m_am_tools;
   120 	abs_eap_am_tools_c * const m_am_tools;
    70 	/**
   137 	/**
    71 	 * The constructor of the eapol_handle_tlv_message_data_c class simply initializes the attributes.
   138 	 * The constructor of the eapol_handle_tlv_message_data_c class simply initializes the attributes.
    72 	 */
   139 	 */
    73 	EAP_FUNC_IMPORT eapol_handle_tlv_message_data_c(
   140 	EAP_FUNC_IMPORT eapol_handle_tlv_message_data_c(
    74 		abs_eap_am_tools_c * const tools);
   141 		abs_eap_am_tools_c * const tools);
       
   142 
       
   143 	/**
       
   144 	 * This function should increase reference count.
       
   145 	 */
       
   146 	EAP_FUNC_IMPORT void object_increase_reference_count();
       
   147 
       
   148 	/**
       
   149 	 * This function should first decrease reference count
       
   150 	 * and second return the remaining reference count.
       
   151 	 * Reference count must not be decreased when it is zero.
       
   152 	 */
       
   153 	EAP_FUNC_IMPORT u32_t object_decrease_reference_count();
    75 
   154 
    76 	/**
   155 	/**
    77 	 * Object must indicate it's validity.
   156 	 * Object must indicate it's validity.
    78 	 * If object initialization fails this function must return false.
   157 	 * If object initialization fails this function must return false.
    79 	 * @return This function returns the validity of this object.
   158 	 * @return This function returns the validity of this object.
    80 	 */
   159 	 */
    81 	EAP_FUNC_IMPORT bool get_is_valid();
   160 	EAP_FUNC_IMPORT bool get_is_valid();
    82 
   161 
       
   162 	//- - - - - - - - - - - - - - - - - - - - - - - - - 
       
   163 
       
   164 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   165 		const eap_am_network_id_c * const network_id) const;
       
   166 
       
   167 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   168 		const abs_eap_state_notification_c * const state) const;
       
   169 
       
   170 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   171 		const eapol_session_key_c * const session_key) const;
       
   172 
       
   173 #if defined(USE_EAP_SIMPLE_CONFIG)
       
   174 
       
   175 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   176 		network_key_and_index_c * key) const;
       
   177 
       
   178 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   179 		EAP_TEMPLATE_CONST eap_array_c<network_key_and_index_c> * network_keys) const;
       
   180 
       
   181 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   182 		simple_config_credential_c * const credential) const;
       
   183 
       
   184 	EAP_FUNC_IMPORT u32_t get_payload_size(
       
   185 		EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array) const;
       
   186 
       
   187 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
       
   188 
       
   189 	//- - - - - - - - - - - - - - - - - - - - - - - - - 
       
   190 
       
   191 	EAP_FUNC_IMPORT eap_status_e add_structured_parameter_header(
       
   192 		const eapol_tlv_message_type_e type,
       
   193 		const u32_t length);
       
   194 
       
   195 
       
   196 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   197 		const eapol_tlv_message_type_e type,
       
   198 		const u32_t integer);
       
   199 
       
   200 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   201 		const u64_t long_integer);
       
   202 
       
   203 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   204 		const u32_t integer);
       
   205 
       
   206 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   207 		const u16_t integer);
       
   208 
       
   209 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   210 		const u8_t byte_integer);
       
   211 
       
   212 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   213 		const bool boolean);
       
   214 
       
   215 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   216 		const eap_status_e status);
       
   217 
       
   218 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   219 		const eapol_tlv_message_type_function_e function);
       
   220 
       
   221 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   222 		const eap_variable_data_c * const variable_data);
       
   223 
       
   224 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   225 		const eap_am_network_id_c * const network_id);
       
   226 
       
   227 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   228 		const eap_buf_chain_wr_c * const packet_buffer);
       
   229 
       
   230 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   231 		const eapol_session_key_c * const session_key);
       
   232 
       
   233 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   234 		const abs_eap_state_notification_c * const state);
       
   235 
       
   236 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   237 		const eap_type_value_e eap_type);
       
   238 
       
   239 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   240 		const eap_general_header_base_c * const packet_data);
       
   241 	
       
   242 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   243 		const eap_tlv_header_c * const credential_header,
       
   244 		simple_config_credential_c * const credential);
       
   245 
       
   246 #if defined(USE_EAP_SIMPLE_CONFIG)
       
   247 
       
   248 	EAP_FUNC_IMPORT eap_status_e add_parameter_data(
       
   249 		EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array);
       
   250 	
       
   251 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
       
   252 
       
   253 	//- - - - - - - - - - - - - - - - - - - - - - - - - 
       
   254 
       
   255 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   256 		const eap_tlv_header_c * const integer_header,
       
   257 		u64_t * const value);
       
   258 
       
   259 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   260 		const eap_tlv_header_c * const integer_header,
       
   261 		u32_t * const value);
       
   262 
       
   263 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   264 		const eap_tlv_header_c * const integer_header,
       
   265 		u16_t * const value);
       
   266 
       
   267 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   268 		const eap_tlv_header_c * const integer_header,
       
   269 		u8_t * const value);
       
   270 
       
   271 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   272 		const eap_tlv_header_c * const function_header,
       
   273 		eapol_tlv_message_type_function_e * const function);
       
   274 
       
   275 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   276 		const eap_tlv_header_c * const network_id_header,
       
   277 		eap_am_network_id_c * const new_network_id);
       
   278 
       
   279 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   280 		const eap_tlv_header_c * const variable_data_header,
       
   281 		eap_variable_data_c * const variable_data);
       
   282 
       
   283 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   284 		const eap_tlv_header_c * const session_key_header,
       
   285 		eapol_session_key_c * const session_key);
       
   286 	
       
   287 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   288 		const eap_tlv_header_c * const state_header,
       
   289 		eap_state_notification_c * * const state);
       
   290 
       
   291 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   292 		const eap_tlv_header_c * const eap_type_header,
       
   293 		eap_type_value_e * const eap_type);
       
   294 
       
   295 #if defined(USE_EAP_SIMPLE_CONFIG)
       
   296 
       
   297 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   298 		const eap_tlv_header_c * const network_key_header,
       
   299 		network_key_and_index_c * const network_key);
       
   300 
       
   301 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   302 		const eap_tlv_header_c * const network_keys_array_header,
       
   303 		eap_array_c<network_key_and_index_c> * const network_keys_array);
       
   304 
       
   305 	EAP_FUNC_IMPORT eap_status_e get_parameter_data(
       
   306 		const eap_tlv_header_c * const credential_array_header,
       
   307 		eap_array_c<simple_config_credential_c> * const credential_array);
       
   308 
       
   309 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
       
   310 
       
   311 	//- - - - - - - - - - - - - - - - - - - - - - - - - 
       
   312 
       
   313 	EAP_FUNC_IMPORT eap_const_string get_type_string(const eapol_tlv_message_type_e type);
       
   314 
       
   315 	EAP_FUNC_IMPORT eap_const_string get_function_string(const eapol_tlv_message_type_function_e function);
       
   316 
    83 	// 
   317 	// 
    84 	//--------------------------------------------------
   318 	//--------------------------------------------------
    85 }; // class eapol_handle_tlv_message_data_c
   319 }; // class eapol_handle_tlv_message_data_c
    86 
   320 
    87 
   321 
    88 //--------------------------------------------------
   322 //--------------------------------------------------
    89 
   323 
    90 #endif //#if !defined(_EAPOL_HANDLE_TLV_MESSAGE_DATA_H_)
   324 #endif //#if !defined(_EAP_CREATE_TLV_MESSAGE_DATA_H_)
    91 
   325 
    92 
   326 
    93 // End.
   327 // End.