eapol/eapol_framework/eapol_common/include/eap_expanded_type.h
changeset 52 c23bdf5a328a
parent 42 53085837e73a
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    22 #if !defined(_EAP_EXPANDED_TYPE_H_)
    22 #if !defined(_EAP_EXPANDED_TYPE_H_)
    23 #define _EAP_EXPANDED_TYPE_H_
    23 #define _EAP_EXPANDED_TYPE_H_
    24 
    24 
    25 
    25 
    26 #include "eap_general_header_base.h"
    26 #include "eap_general_header_base.h"
       
    27 #include "eap_am_export.h"
       
    28 // Start: added by script change_export_macros.sh.
       
    29 #if defined(EAP_NO_EXPORT_EAP_EXPANDED_TYPE_H)
       
    30 	#define EAP_CLASS_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_NONSHARABLE 
       
    31 	#define EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H 
       
    32 	#define EAP_C_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H 
       
    33 	#define EAP_FUNC_EXPORT_EAP_EXPANDED_TYPE_H 
       
    34 	#define EAP_C_FUNC_EXPORT_EAP_EXPANDED_TYPE_H 
       
    35 #elif defined(EAP_EXPORT_EAP_EXPANDED_TYPE_H)
       
    36 	#define EAP_CLASS_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_EXPORT 
       
    37 	#define EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_FUNC_EXPORT 
       
    38 	#define EAP_C_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_C_FUNC_EXPORT 
       
    39 	#define EAP_FUNC_EXPORT_EAP_EXPANDED_TYPE_H EAP_FUNC_EXPORT 
       
    40 	#define EAP_C_FUNC_EXPORT_EAP_EXPANDED_TYPE_H EAP_C_FUNC_EXPORT 
       
    41 #else
       
    42 	#define EAP_CLASS_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_IMPORT 
       
    43 	#define EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_FUNC_IMPORT 
       
    44 	#define EAP_C_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H EAP_C_FUNC_IMPORT 
       
    45 	#define EAP_FUNC_EXPORT_EAP_EXPANDED_TYPE_H 
       
    46 	#define EAP_C_FUNC_EXPORT_EAP_EXPANDED_TYPE_H 
       
    47 #endif
       
    48 // End: added by script change_export_macros.sh.
       
    49 
    27 
    50 
    28 
    51 
    29 /** @file */
    52 /** @file */
    30 
    53 
    31 //-----------------------------------------------------------------------------------------
    54 //-----------------------------------------------------------------------------------------
    93 
   116 
    94 //-----------------------------------------------------------------------------------------
   117 //-----------------------------------------------------------------------------------------
    95 //-----------------------------------------------------------------------------------------
   118 //-----------------------------------------------------------------------------------------
    96 //-----------------------------------------------------------------------------------------
   119 //-----------------------------------------------------------------------------------------
    97 
   120 
    98 class EAP_EXPORT eap_expanded_type_c
   121 class EAP_CLASS_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c
    99 {
   122 {
   100 
   123 
   101 public:
   124 public:
   102 
   125 
   103 	enum sizes
   126 	enum sizes
   107 		m_vendor_type_size = sizeof(u32_t),
   130 		m_vendor_type_size = sizeof(u32_t),
   108 		m_eap_expanded_type_size = m_ietf_type_size+m_vendor_id_size+m_vendor_type_size,
   131 		m_eap_expanded_type_size = m_ietf_type_size+m_vendor_id_size+m_vendor_type_size,
   109 	};
   132 	};
   110 
   133 
   111 	// This must not be virtual destructor.
   134 	// This must not be virtual destructor.
   112 	EAP_FUNC_IMPORT ~eap_expanded_type_c();
   135 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H ~eap_expanded_type_c();
   113 
   136 
   114 	EAP_FUNC_IMPORT eap_expanded_type_c();
   137 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c();
   115 
   138 
   116 	EAP_FUNC_IMPORT eap_expanded_type_c(
   139 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c(
   117 		const eap_type_vendor_id_e vendor_id,
   140 		const eap_type_vendor_id_e vendor_id,
   118 		const u32_t vendor_type);
   141 		const u32_t vendor_type);
   119 
   142 
   120 	EAP_FUNC_IMPORT eap_expanded_type_c(
   143 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c(
   121 		const eap_type_ietf_values_e type);
   144 		const eap_type_ietf_values_e type);
   122 
   145 
   123 	EAP_FUNC_IMPORT bool get_is_valid() const;
   146 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool get_is_valid() const;
   124 
   147 
   125 	EAP_FUNC_IMPORT bool get_is_valid_data() const;
   148 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool get_is_valid_data() const;
   126 
   149 
   127 	EAP_FUNC_IMPORT eap_expanded_type_c * copy() const;
   150 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c * copy() const;
   128 
   151 
   129 	EAP_FUNC_IMPORT static bool is_expanded_type(const eap_type_ietf_values_e eap_type);
   152 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H static bool is_expanded_type(const eap_type_ietf_values_e eap_type);
   130 
   153 
   131 	EAP_FUNC_IMPORT static bool is_ietf_type(const eap_expanded_type_c eap_type);
   154 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H static bool is_ietf_type(const eap_expanded_type_c eap_type);
   132 
   155 
   133 	EAP_FUNC_IMPORT eap_status_e get_type_data(
   156 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_status_e get_type_data(
   134 		abs_eap_am_tools_c * const am_tools,
   157 		abs_eap_am_tools_c * const am_tools,
   135 		eap_type_ietf_values_e * const type) const;
   158 		eap_type_ietf_values_e * const type) const;
   136 
   159 
   137 	EAP_FUNC_IMPORT eap_status_e get_type_data(
   160 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_status_e get_type_data(
   138 		abs_eap_am_tools_c * const am_tools,
   161 		abs_eap_am_tools_c * const am_tools,
   139 		eap_expanded_type_c * const type) const;
   162 		eap_expanded_type_c * const type) const;
   140 
   163 
   141 	EAP_FUNC_IMPORT eap_status_e get_expanded_type_data(
   164 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_status_e get_expanded_type_data(
   142 		abs_eap_am_tools_c * const am_tools,
   165 		abs_eap_am_tools_c * const am_tools,
   143 		eap_variable_data_c * const data) const;
   166 		eap_variable_data_c * const data) const;
   144 
   167 
   145 	EAP_FUNC_IMPORT eap_status_e set_expanded_type_data(
   168 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_status_e set_expanded_type_data(
   146 		abs_eap_am_tools_c * const am_tools,
   169 		abs_eap_am_tools_c * const am_tools,
   147 		const eap_variable_data_c * const data);
   170 		const eap_variable_data_c * const data);
   148 
   171 
   149 	EAP_FUNC_IMPORT eap_status_e set_expanded_type_data(
   172 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_status_e set_expanded_type_data(
   150 		abs_eap_am_tools_c * const am_tools,
   173 		abs_eap_am_tools_c * const am_tools,
   151 		const void * const data,
   174 		const void * const data,
   152 		const u32_t data_length);
   175 		const u32_t data_length);
   153 
   176 
   154 	EAP_FUNC_IMPORT void set_eap_type_values(
   177 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H void set_eap_type_values(
   155 		const eap_type_vendor_id_e vendor_id,
   178 		const eap_type_vendor_id_e vendor_id,
   156 		const u32_t vendor_type);
   179 		const u32_t vendor_type);
   157 
   180 
   158 	EAP_FUNC_IMPORT eap_type_vendor_id_e get_vendor_id() const;
   181 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_type_vendor_id_e get_vendor_id() const;
   159 
   182 
   160 	EAP_FUNC_IMPORT u32_t get_vendor_type() const;
   183 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H u32_t get_vendor_type() const;
   161 
   184 
   162 	EAP_FUNC_IMPORT static u32_t get_eap_expanded_type_size();
   185 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H static u32_t get_eap_expanded_type_size();
   163 
   186 
   164 	EAP_FUNC_IMPORT bool operator == (const eap_type_ietf_values_e right_type_value) const;
   187 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool operator == (const eap_type_ietf_values_e right_type_value) const;
   165 
   188 
   166 	EAP_FUNC_IMPORT bool operator != (const eap_type_ietf_values_e right_type_value) const;
   189 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool operator != (const eap_type_ietf_values_e right_type_value) const;
   167 
   190 
   168 	EAP_FUNC_IMPORT bool operator == (const eap_expanded_type_c &right_type_value) const;
   191 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool operator == (const eap_expanded_type_c &right_type_value) const;
   169 
   192 
   170 	EAP_FUNC_IMPORT bool operator != (const eap_expanded_type_c &right_type_value) const;
   193 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H bool operator != (const eap_expanded_type_c &right_type_value) const;
   171 
   194 
   172 	EAP_FUNC_IMPORT eap_expanded_type_c &operator = (const eap_type_ietf_values_e right_type_value);
   195 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c &operator = (const eap_type_ietf_values_e right_type_value);
   173 
   196 
   174 	EAP_FUNC_IMPORT eap_expanded_type_c &operator = (const eap_expanded_type_c &right_type_value);
   197 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c &operator = (const eap_expanded_type_c &right_type_value);
   175 
   198 
   176 	EAP_FUNC_IMPORT eap_expanded_type_c *operator & ();
   199 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H eap_expanded_type_c *operator & ();
   177 
   200 
   178 	EAP_FUNC_IMPORT const eap_expanded_type_c *operator & () const;
   201 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H const eap_expanded_type_c *operator & () const;
   179 
   202 
   180 	/// This function reads EAP-type from offset.
   203 	/// This function reads EAP-type from offset.
   181 	EAP_FUNC_IMPORT static eap_status_e read_type(
   204 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H static eap_status_e read_type(
   182 		abs_eap_am_tools_c * const am_tools,
   205 		abs_eap_am_tools_c * const am_tools,
   183 		const u32_t index,
   206 		const u32_t index,
   184 		const void * const buffer,
   207 		const void * const buffer,
   185 		const u32_t buffer_length,
   208 		const u32_t buffer_length,
   186 		eap_expanded_type_c * const type
   209 		eap_expanded_type_c * const type
   187 		);
   210 		);
   188 
   211 
   189 	/// This function writes EAP-type to offset.
   212 	/// This function writes EAP-type to offset.
   190 	EAP_FUNC_IMPORT static eap_status_e write_type(
   213 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H static eap_status_e write_type(
   191 		abs_eap_am_tools_c * const am_tools,
   214 		abs_eap_am_tools_c * const am_tools,
   192 		const u32_t index, ///< Index is from 0 to n. Index 0 is the first EAP type field after base EAP header.
   215 		const u32_t index, ///< Index is from 0 to n. Index 0 is the first EAP type field after base EAP header.
   193 		void * const buffer,
   216 		void * const buffer,
   194 		const u32_t buffer_length,
   217 		const u32_t buffer_length,
   195 		const bool write_extented_type_when_true, ///< True value writes always Extented Type.
   218 		const bool write_extented_type_when_true, ///< True value writes always Extented Type.
   196 		const eap_expanded_type_c p_type ///< The EAP type to be written.
   219 		const eap_expanded_type_c p_type ///< The EAP type to be written.
   197 		);
   220 		);
   198 
   221 
   199 	EAP_FUNC_IMPORT i32_t compare(const eap_expanded_type_c * const data) const;
   222 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H i32_t compare(const eap_expanded_type_c * const data) const;
   200 
   223 
   201 private:
   224 private:
   202 
   225 
   203 	eap_type_vendor_id_e   m_vendor_id; ///< Here we use only 24 least significant bits.
   226 	eap_type_vendor_id_e   m_vendor_id; ///< Here we use only 24 least significant bits.
   204 	u32_t                  m_vendor_type;
   227 	u32_t                  m_vendor_type;
   206 
   229 
   207 //-----------------------------------------------------------------------------------------
   230 //-----------------------------------------------------------------------------------------
   208 //-----------------------------------------------------------------------------------------
   231 //-----------------------------------------------------------------------------------------
   209 //-----------------------------------------------------------------------------------------
   232 //-----------------------------------------------------------------------------------------
   210 
   233 
   211 class EAP_EXPORT eap_static_expanded_type_c
   234 class EAP_CLASS_VISIBILITY_EAP_EXPANDED_TYPE_H eap_static_expanded_type_c
   212 {
   235 {
   213 public:
   236 public:
   214 
   237 
   215 	EAP_FUNC_IMPORT const eap_expanded_type_c & get_type() const;
   238 	EAP_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H const eap_expanded_type_c & get_type() const;
   216 
   239 
   217 public:
   240 public:
   218 
   241 
   219 	eap_type_vendor_id_e   m_vendor_id; ///< Here we use only 24 least significant bits.
   242 	eap_type_vendor_id_e   m_vendor_id; ///< Here we use only 24 least significant bits.
   220 	u32_t                  m_vendor_type;
   243 	u32_t                  m_vendor_type;
   258 
   281 
   259 
   282 
   260 typedef eap_expanded_type_c eap_type_value_e;
   283 typedef eap_expanded_type_c eap_type_value_e;
   261 
   284 
   262 
   285 
   263 EAP_C_FUNC_IMPORT u32_t convert_eap_type_to_u32_t(eap_type_value_e type);
   286 EAP_C_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H u32_t convert_eap_type_to_u32_t(eap_type_value_e type);
   264 
   287 
   265 EAP_C_FUNC_IMPORT u64_t convert_eap_type_to_u64_t(eap_type_value_e type);
   288 EAP_C_FUNC_VISIBILITY_EAP_EXPANDED_TYPE_H u64_t convert_eap_type_to_u64_t(eap_type_value_e type);
   266 
   289 
   267 
   290 
   268 //-----------------------------------------------------------------------------------------
   291 //-----------------------------------------------------------------------------------------
   269 //-----------------------------------------------------------------------------------------
   292 //-----------------------------------------------------------------------------------------
   270 //-----------------------------------------------------------------------------------------
   293 //-----------------------------------------------------------------------------------------