eapol/eapol_framework/eapol_common/include/eap_tlv_message_data.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    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_tlv_header.h"
    28 #include "eap_tlv_header.h"
       
    29 #include "eap_am_export.h"
       
    30 // Start: added by script change_export_macros.sh.
       
    31 #if defined(EAP_NO_EXPORT_EAP_TLV_MESSAGE_DATA_H)
       
    32 	#define EAP_CLASS_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_NONSHARABLE 
       
    33 	#define EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H 
       
    34 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H 
       
    35 	#define EAP_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H 
       
    36 	#define EAP_C_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H 
       
    37 #elif defined(EAP_EXPORT_EAP_TLV_MESSAGE_DATA_H)
       
    38 	#define EAP_CLASS_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_EXPORT 
       
    39 	#define EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_FUNC_EXPORT 
       
    40 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_C_FUNC_EXPORT 
       
    41 	#define EAP_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H EAP_FUNC_EXPORT 
       
    42 	#define EAP_C_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H EAP_C_FUNC_EXPORT 
       
    43 #else
       
    44 	#define EAP_CLASS_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_IMPORT 
       
    45 	#define EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_FUNC_IMPORT 
       
    46 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H EAP_C_FUNC_IMPORT 
       
    47 	#define EAP_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H 
       
    48 	#define EAP_C_FUNC_EXPORT_EAP_TLV_MESSAGE_DATA_H 
       
    49 #endif
       
    50 // End: added by script change_export_macros.sh.
       
    51 
    29 
    52 
    30 /** @file */
    53 /** @file */
    31 
    54 
    32 
    55 
    33 //----------------------------------------------------------------------------
    56 //----------------------------------------------------------------------------
    73  * The next Attribute-Value Pair starts exactly after the previous
    96  * The next Attribute-Value Pair starts exactly after the previous
    74  * Value of previous Attribute-Value Pair.
    97  * Value of previous Attribute-Value Pair.
    75  * @endcode
    98  * @endcode
    76  * 
    99  * 
    77  */
   100  */
    78 class EAP_EXPORT eap_tlv_message_data_c
   101 class EAP_CLASS_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_tlv_message_data_c
    79 {
   102 {
    80 private:
   103 private:
    81 	//--------------------------------------------------
   104 	//--------------------------------------------------
    82 
   105 
    83 	abs_eap_am_tools_c * const m_am_tools;
   106 	abs_eap_am_tools_c * const m_am_tools;
    93 	//--------------------------------------------------
   116 	//--------------------------------------------------
    94 
   117 
    95 	/**
   118 	/**
    96 	 * The destructor of the eap_tlv_message_data_c class does nothing.
   119 	 * The destructor of the eap_tlv_message_data_c class does nothing.
    97 	 */
   120 	 */
    98 	EAP_FUNC_IMPORT virtual ~eap_tlv_message_data_c();
   121 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H virtual ~eap_tlv_message_data_c();
    99 
   122 
   100 	/**
   123 	/**
   101 	 * The constructor of the eap_tlv_message_data_c class simply initializes the attributes.
   124 	 * The constructor of the eap_tlv_message_data_c class simply initializes the attributes.
   102 	 */
   125 	 */
   103 	EAP_FUNC_IMPORT eap_tlv_message_data_c(
   126 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_tlv_message_data_c(
   104 		abs_eap_am_tools_c * const tools);
   127 		abs_eap_am_tools_c * const tools);
   105 
   128 
   106 	/**
   129 	/**
   107 	 * This function should increase reference count.
   130 	 * This function should increase reference count.
   108 	 */
   131 	 */
   109 	EAP_FUNC_IMPORT void object_increase_reference_count();
   132 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H void object_increase_reference_count();
   110 
   133 
   111 	/**
   134 	/**
   112 	 * This function should first decrease reference count
   135 	 * This function should first decrease reference count
   113 	 * and second return the remaining reference count.
   136 	 * and second return the remaining reference count.
   114 	 * Reference count must not be decreased when it is zero.
   137 	 * Reference count must not be decreased when it is zero.
   115 	 */
   138 	 */
   116 	EAP_FUNC_IMPORT u32_t object_decrease_reference_count();
   139 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H u32_t object_decrease_reference_count();
   117 
   140 
   118 	/**
   141 	/**
   119 	 * This function returns the pointer to the data.
   142 	 * This function returns the pointer to the data.
   120 	 * Empty message return NULL pointer.
   143 	 * Empty message return NULL pointer.
   121 	 */
   144 	 */
   122 	EAP_FUNC_IMPORT void * get_message_data() const;
   145 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H void * get_message_data() const;
   123 
   146 
   124 	/**
   147 	/**
   125 	 * This function returns the length of the data.
   148 	 * This function returns the length of the data.
   126 	 * Empty message return zero.
   149 	 * Empty message return zero.
   127 	 */
   150 	 */
   128 	EAP_FUNC_IMPORT u32_t get_message_data_length() const;
   151 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H u32_t get_message_data_length() const;
   129 
   152 
   130 	EAP_FUNC_IMPORT eap_status_e allocate_message_data_buffer(
   153 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e allocate_message_data_buffer(
   131 		const u32_t approximate_buffer_requirement);
   154 		const u32_t approximate_buffer_requirement);
   132 
   155 
   133 	/**
   156 	/**
   134 	 * This function copies message data.
   157 	 * This function copies message data.
   135 	 * Data must be formatted as EAP-TLV-message data.
   158 	 * Data must be formatted as EAP-TLV-message data.
   136 	 */
   159 	 */
   137 	EAP_FUNC_IMPORT eap_status_e copy_message_data(
   160 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e copy_message_data(
   138 		const u32_t length,
   161 		const u32_t length,
   139 		const void * const value);
   162 		const void * const value);
   140 
   163 
   141 	/**
   164 	/**
   142 	 * This function sets message data.
   165 	 * This function sets message data.
   143 	 * Note the data is referenced not copied.
   166 	 * Note the data is referenced not copied.
   144 	 * Data must be formatted as EAP-TLV-message data.
   167 	 * Data must be formatted as EAP-TLV-message data.
   145 	 */
   168 	 */
   146 	EAP_FUNC_IMPORT eap_status_e set_message_data(
   169 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e set_message_data(
   147 		const u32_t length,
   170 		const u32_t length,
   148 		const void * const value);
   171 		const void * const value);
   149 
   172 
   150 	/**
   173 	/**
   151 	 * This function adds data to message.
   174 	 * This function adds data to message.
   152 	 */
   175 	 */
   153 	EAP_FUNC_IMPORT eap_status_e add_message_data(
   176 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e add_message_data(
   154 		const eap_tlv_type_t type,
   177 		const eap_tlv_type_t type,
   155 		const u32_t length,
   178 		const u32_t length,
   156 		const void * const data);
   179 		const void * const data);
   157 
   180 
   158 	/**
   181 	/**
   159 	 * This function adds array of data to message.
   182 	 * This function adds array of data to message.
   160 	 */
   183 	 */
   161 	EAP_FUNC_IMPORT eap_status_e add_message_data_array(
   184 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e add_message_data_array(
   162 		const eap_tlv_type_t type,
   185 		const eap_tlv_type_t type,
   163 		const u32_t length_of_each_data_block,
   186 		const u32_t length_of_each_data_block,
   164 		eap_array_c<eap_variable_data_c> * const data_array);
   187 		eap_array_c<eap_variable_data_c> * const data_array);
   165 	
   188 	
   166 	/**
   189 	/**
   167 	 * This function adds header of structured data to message.
   190 	 * This function adds header of structured data to message.
   168 	 */
   191 	 */
   169 	EAP_FUNC_IMPORT eap_status_e add_message_header(
   192 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e add_message_header(
   170 		const eap_tlv_type_t type,
   193 		const eap_tlv_type_t type,
   171 		const u32_t length);
   194 		const u32_t length);
   172 
   195 
   173 	/**
   196 	/**
   174 	 * This function parses eap_tlv_header_c blocks from message to tlv_blocks.
   197 	 * This function parses eap_tlv_header_c blocks from message to tlv_blocks.
   175 	 */
   198 	 */
   176 	EAP_FUNC_IMPORT eap_status_e parse_message_data(
   199 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e parse_message_data(
   177 		eap_array_c<eap_tlv_header_c> * const tlv_blocks);
   200 		eap_array_c<eap_tlv_header_c> * const tlv_blocks);
   178 
   201 
   179 	/**
   202 	/**
   180 	 * Object must indicate it's validity.
   203 	 * Object must indicate it's validity.
   181 	 * If object initialization fails this function must return false.
   204 	 * If object initialization fails this function must return false.
   182 	 * @return This function returns the validity of this object.
   205 	 * @return This function returns the validity of this object.
   183 	 */
   206 	 */
   184 	EAP_FUNC_IMPORT bool get_is_valid();
   207 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H bool get_is_valid();
   185 
   208 
   186 	/**
   209 	/**
   187 	 * This function allocates buffer to message of specified type.
   210 	 * This function allocates buffer to message of specified type.
   188 	 * Function returns pointer to the value field of specified length.
   211 	 * Function returns pointer to the value field of specified length.
   189 	 */
   212 	 */
   190 	EAP_FUNC_IMPORT eap_status_e allocate_message_buffer(
   213 	EAP_FUNC_VISIBILITY_EAP_TLV_MESSAGE_DATA_H eap_status_e allocate_message_buffer(
   191 		const eap_tlv_type_t type,
   214 		const eap_tlv_type_t type,
   192 		const u32_t length,
   215 		const u32_t length,
   193 		void * * const buffer);
   216 		void * * const buffer);
   194 
   217 
   195 	// 
   218 	//