eapol/eapol_framework/eapol_common/include/eap_tlv_header.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    23 #define _EAP_TLV_HEADER_H_
    23 #define _EAP_TLV_HEADER_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_general_header_base.h"
    27 #include "eap_general_header_base.h"
       
    28 #include "eap_am_export.h"
       
    29 // Start: added by script change_export_macros.sh.
       
    30 #if defined(EAP_NO_EXPORT_EAP_TLV_HEADER_H)
       
    31 	#define EAP_CLASS_VISIBILITY_EAP_TLV_HEADER_H EAP_NONSHARABLE 
       
    32 	#define EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H 
       
    33 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_HEADER_H 
       
    34 	#define EAP_FUNC_EXPORT_EAP_TLV_HEADER_H 
       
    35 	#define EAP_C_FUNC_EXPORT_EAP_TLV_HEADER_H 
       
    36 #elif defined(EAP_EXPORT_EAP_TLV_HEADER_H)
       
    37 	#define EAP_CLASS_VISIBILITY_EAP_TLV_HEADER_H EAP_EXPORT 
       
    38 	#define EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_HEADER_H EAP_C_FUNC_EXPORT 
       
    40 	#define EAP_FUNC_EXPORT_EAP_TLV_HEADER_H EAP_FUNC_EXPORT 
       
    41 	#define EAP_C_FUNC_EXPORT_EAP_TLV_HEADER_H EAP_C_FUNC_EXPORT 
       
    42 #else
       
    43 	#define EAP_CLASS_VISIBILITY_EAP_TLV_HEADER_H EAP_IMPORT 
       
    44 	#define EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H EAP_FUNC_IMPORT 
       
    45 	#define EAP_C_FUNC_VISIBILITY_EAP_TLV_HEADER_H EAP_C_FUNC_IMPORT 
       
    46 	#define EAP_FUNC_EXPORT_EAP_TLV_HEADER_H 
       
    47 	#define EAP_C_FUNC_EXPORT_EAP_TLV_HEADER_H 
       
    48 #endif
       
    49 // End: added by script change_export_macros.sh.
       
    50 
    28 
    51 
    29 /** @file */
    52 /** @file */
    30 
    53 
    31 
    54 
    32 typedef u32_t eap_tlv_type_t;
    55 typedef u32_t eap_tlv_type_t;
    58  * 32-bits Type;                   This is a type of value.
    81  * 32-bits Type;                   This is a type of value.
    59  * 32-bits value length (Length);  This is a length field, the length (in bytes) of the following value.
    82  * 32-bits value length (Length);  This is a length field, the length (in bytes) of the following value.
    60  * @endcode
    83  * @endcode
    61  * 
    84  * 
    62  */
    85  */
    63 class EAP_EXPORT eap_tlv_header_c
    86 class EAP_CLASS_VISIBILITY_EAP_TLV_HEADER_H eap_tlv_header_c
    64 : public eap_general_header_base_c
    87 : public eap_general_header_base_c
    65 {
    88 {
    66 private:
    89 private:
    67 	//--------------------------------------------------
    90 	//--------------------------------------------------
    68 
    91 
    85 	//--------------------------------------------------
   108 	//--------------------------------------------------
    86 
   109 
    87 	/**
   110 	/**
    88 	 * The destructor of the eap_tlv_header_c class does nothing.
   111 	 * The destructor of the eap_tlv_header_c class does nothing.
    89 	 */
   112 	 */
    90 	EAP_FUNC_IMPORT virtual ~eap_tlv_header_c();
   113 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H virtual ~eap_tlv_header_c();
    91 
   114 
    92 	/**
   115 	/**
    93 	 * The constructor of the eap_tlv_header_c class simply initializes the attributes.
   116 	 * The constructor of the eap_tlv_header_c class simply initializes the attributes.
    94 	 */
   117 	 */
    95 	EAP_FUNC_IMPORT eap_tlv_header_c(
   118 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_tlv_header_c(
    96 		abs_eap_am_tools_c * const tools,
   119 		abs_eap_am_tools_c * const tools,
    97 		void * const header_begin,
   120 		void * const header_begin,
    98 		const u32_t header_buffer_length);
   121 		const u32_t header_buffer_length);
    99 
   122 
   100 	/**
   123 	/**
   101 	 * This function returns the type.
   124 	 * This function returns the type.
   102 	 */
   125 	 */
   103 	EAP_FUNC_IMPORT eap_tlv_type_t get_type() const;
   126 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_tlv_type_t get_type() const;
   104 
   127 
   105 	/**
   128 	/**
   106 	 * This function returns the data length of value.
   129 	 * This function returns the data length of value.
   107 	 */
   130 	 */
   108 	EAP_FUNC_IMPORT u32_t get_value_length() const;
   131 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H u32_t get_value_length() const;
   109 
   132 
   110 	/**
   133 	/**
   111 	 * This function returns the header length of TLV.
   134 	 * This function returns the header length of TLV.
   112 	 */
   135 	 */
   113 	EAP_FUNC_IMPORT static u32_t get_header_length();
   136 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H static u32_t get_header_length();
   114 
   137 
   115 	/**
   138 	/**
   116 	 * This function returns pointer to the offset of value.
   139 	 * This function returns pointer to the offset of value.
   117 	 * @param offset is the offset of queried data in bytes.
   140 	 * @param offset is the offset of queried data in bytes.
   118 	 * @param contignuous_bytes is the length of queried data in bytes.
   141 	 * @param contignuous_bytes is the length of queried data in bytes.
   119 	 */
   142 	 */
   120 	EAP_FUNC_IMPORT u8_t * get_value_offset(const u32_t offset, const u32_t contignuous_bytes) const;
   143 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H u8_t * get_value_offset(const u32_t offset, const u32_t contignuous_bytes) const;
   121 
   144 
   122 
   145 
   123 	/**
   146 	/**
   124 	 * This function returns pointer to begin of value.
   147 	 * This function returns pointer to begin of value.
   125 	 * @param contignuous_bytes is the length of queried data in bytes.
   148 	 * @param contignuous_bytes is the length of queried data in bytes.
   126 	 */
   149 	 */
   127 	EAP_FUNC_IMPORT u8_t * get_value(const u32_t contignuous_bytes) const;
   150 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H u8_t * get_value(const u32_t contignuous_bytes) const;
   128 
   151 
   129 
   152 
   130 	/**
   153 	/**
   131 	 * This function checks the header is valid.
   154 	 * This function checks the header is valid.
   132 	 */
   155 	 */
   133 	EAP_FUNC_IMPORT eap_status_e check_header() const;
   156 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_status_e check_header() const;
   134 
   157 
   135 	/**
   158 	/**
   136 	 * This function returns the type.
   159 	 * This function returns the type.
   137 	 */
   160 	 */
   138 	EAP_FUNC_IMPORT eap_status_e set_type(const eap_tlv_type_t type);
   161 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_status_e set_type(const eap_tlv_type_t type);
   139 
   162 
   140 	/**
   163 	/**
   141 	 * This function sets the value length.
   164 	 * This function sets the value length.
   142 	 */
   165 	 */
   143 	EAP_FUNC_IMPORT eap_status_e set_value_length(const u32_t value_length);
   166 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_status_e set_value_length(const u32_t value_length);
   144 
   167 
   145 	/**
   168 	/**
   146 	 * This function resets the TLV header.
   169 	 * This function resets the TLV header.
   147 	 */
   170 	 */
   148 	EAP_FUNC_IMPORT eap_status_e reset_header(
   171 	EAP_FUNC_VISIBILITY_EAP_TLV_HEADER_H eap_status_e reset_header(
   149 		const eap_tlv_type_t type,
   172 		const eap_tlv_type_t type,
   150 		const u32_t value_length);
   173 		const u32_t value_length);
   151 
   174 
   152 	// 
   175 	// 
   153 	//--------------------------------------------------
   176 	//--------------------------------------------------