eapol/eapol_framework/eapol_common/include/eapol_header.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    26 #include "eap_tools.h"
    26 #include "eap_tools.h"
    27 #include "eap_am_tools.h"
    27 #include "eap_am_tools.h"
    28 #include "eap_header.h"
    28 #include "eap_header.h"
    29 #include "eap_general_header_base.h"
    29 #include "eap_general_header_base.h"
    30 #include "eapol_key_types.h"
    30 #include "eapol_key_types.h"
       
    31 #include "eap_am_export.h"
       
    32 // Start: added by script change_export_macros.sh.
       
    33 #if defined(EAP_NO_EXPORT_EAPOL_HEADER_H)
       
    34 	#define EAP_CLASS_VISIBILITY_EAPOL_HEADER_H EAP_NONSHARABLE 
       
    35 	#define EAP_FUNC_VISIBILITY_EAPOL_HEADER_H 
       
    36 	#define EAP_C_FUNC_VISIBILITY_EAPOL_HEADER_H 
       
    37 	#define EAP_FUNC_EXPORT_EAPOL_HEADER_H 
       
    38 	#define EAP_C_FUNC_EXPORT_EAPOL_HEADER_H 
       
    39 #elif defined(EAP_EXPORT_EAPOL_HEADER_H)
       
    40 	#define EAP_CLASS_VISIBILITY_EAPOL_HEADER_H EAP_EXPORT 
       
    41 	#define EAP_FUNC_VISIBILITY_EAPOL_HEADER_H EAP_FUNC_EXPORT 
       
    42 	#define EAP_C_FUNC_VISIBILITY_EAPOL_HEADER_H EAP_C_FUNC_EXPORT 
       
    43 	#define EAP_FUNC_EXPORT_EAPOL_HEADER_H EAP_FUNC_EXPORT 
       
    44 	#define EAP_C_FUNC_EXPORT_EAPOL_HEADER_H EAP_C_FUNC_EXPORT 
       
    45 #else
       
    46 	#define EAP_CLASS_VISIBILITY_EAPOL_HEADER_H EAP_IMPORT 
       
    47 	#define EAP_FUNC_VISIBILITY_EAPOL_HEADER_H EAP_FUNC_IMPORT 
       
    48 	#define EAP_C_FUNC_VISIBILITY_EAPOL_HEADER_H EAP_C_FUNC_IMPORT 
       
    49 	#define EAP_FUNC_EXPORT_EAPOL_HEADER_H 
       
    50 	#define EAP_C_FUNC_EXPORT_EAPOL_HEADER_H 
       
    51 #endif
       
    52 // End: added by script change_export_macros.sh.
       
    53 
    31 
    54 
    32 /** @file */
    55 /** @file */
    33 
    56 
    34 /**
    57 /**
    35  * Enumeration of EAPOL Protocol Version.
    58  * Enumeration of EAPOL Protocol Version.
    69  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    92  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    70  *  |  Data ...
    93  *  |  Data ...
    71  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    94  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    72  * @endcode
    95  * @endcode
    73  */
    96  */
    74 class EAP_EXPORT eapol_header_base_c
    97 class EAP_CLASS_VISIBILITY_EAPOL_HEADER_H eapol_header_base_c
    75 : public eap_general_header_base_c
    98 : public eap_general_header_base_c
    76 {
    99 {
    77 private:
   100 private:
    78 	//--------------------------------------------------
   101 	//--------------------------------------------------
    79 
   102 
    98 	//--------------------------------------------------
   121 	//--------------------------------------------------
    99 public:
   122 public:
   100 	//--------------------------------------------------
   123 	//--------------------------------------------------
   101 
   124 
   102 	/// Destructor does nothing special.
   125 	/// Destructor does nothing special.
   103 	EAP_FUNC_IMPORT virtual ~eapol_header_base_c();
   126 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H virtual ~eapol_header_base_c();
   104 
   127 
   105 	/// Constructor does nothing special.
   128 	/// Constructor does nothing special.
   106 	/// The tools parameter is pointer to tools object.
   129 	/// The tools parameter is pointer to tools object.
   107 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   130 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   108 	/// The header_buffer_length parameter is length of the header_buffer.
   131 	/// The header_buffer_length parameter is length of the header_buffer.
   109 	EAP_FUNC_IMPORT eapol_header_base_c(
   132 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eapol_header_base_c(
   110 		abs_eap_am_tools_c * const tools,
   133 		abs_eap_am_tools_c * const tools,
   111 		void * const header_buffer,
   134 		void * const header_buffer,
   112 		const u32_t header_buffer_length);
   135 		const u32_t header_buffer_length);
   113 
   136 
   114 	/// This function returns the Protocol Version field of EAPOL header.
   137 	/// This function returns the Protocol Version field of EAPOL header.
   115 	EAP_FUNC_IMPORT eapol_protocol_version_e get_version() const;
   138 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eapol_protocol_version_e get_version() const;
   116 
   139 
   117 	/// This function returns the packet type field of EAPOL header.
   140 	/// This function returns the packet type field of EAPOL header.
   118 	EAP_FUNC_IMPORT eapol_packet_type_e get_packet_type() const;
   141 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eapol_packet_type_e get_packet_type() const;
   119 
   142 
   120 	/// This function returns the data length of the EAPOL-packet.
   143 	/// This function returns the data length of the EAPOL-packet.
   121 	EAP_FUNC_IMPORT u16_t get_data_length() const;
   144 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H u16_t get_data_length() const;
   122 
   145 
   123 	/// This function returns the header length of the EAPOL-packet.
   146 	/// This function returns the header length of the EAPOL-packet.
   124 	EAP_FUNC_IMPORT static u32_t get_header_length();
   147 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H static u32_t get_header_length();
   125 
   148 
   126 	/// This function returns pointer to the data of the EAPOL-packet.
   149 	/// This function returns pointer to the data of the EAPOL-packet.
   127 	EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const;
   150 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H u8_t * get_data(const u32_t data_length) const;
   128 
   151 
   129 	/// This function sets the Protocol Version field of the EAPOL-header.
   152 	/// This function sets the Protocol Version field of the EAPOL-header.
   130 	EAP_FUNC_IMPORT void set_version(const eapol_protocol_version_e p_version);
   153 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H void set_version(const eapol_protocol_version_e p_version);
   131 
   154 
   132 	/// This function sets the packet type field of the EAPOL-header.
   155 	/// This function sets the packet type field of the EAPOL-header.
   133 	EAP_FUNC_IMPORT void set_packet_type(const eapol_packet_type_e p_packet_type);
   156 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H void set_packet_type(const eapol_packet_type_e p_packet_type);
   134 
   157 
   135 	/// This function sets the data length field of the EAPOL-header.
   158 	/// This function sets the data length field of the EAPOL-header.
   136 	EAP_FUNC_IMPORT void set_data_length(const u16_t p_data_length);
   159 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H void set_data_length(const u16_t p_data_length);
   137 
   160 
   138 	/// This function returns debug string of the type of the EAPOL-packet.
   161 	/// This function returns debug string of the type of the EAPOL-packet.
   139 	EAP_FUNC_IMPORT eap_const_string get_type_string() const;
   162 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eap_const_string get_type_string() const;
   140 
   163 
   141 	/// This function checks the validity of EAPOL-header.
   164 	/// This function checks the validity of EAPOL-header.
   142 	EAP_FUNC_IMPORT eap_status_e check_header() const;
   165 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eap_status_e check_header() const;
   143 
   166 
   144 	// 
   167 	// 
   145 	//--------------------------------------------------
   168 	//--------------------------------------------------
   146 }; // class eapol_header_base_c
   169 }; // class eapol_header_base_c
   147 
   170 
   148 
   171 
   149 
   172 
   150 
   173 
   151 /// This is read only EAPOL header.
   174 /// This is read only EAPOL header.
   152 /// @{ This class can be removed. eapol_header_base_c could be used instead. }
   175 /// @{ This class can be removed. eapol_header_base_c could be used instead. }
   153 class EAP_EXPORT eapol_header_rd_c
   176 class EAP_CLASS_VISIBILITY_EAPOL_HEADER_H eapol_header_rd_c
   154 : public eapol_header_base_c
   177 : public eapol_header_base_c
   155 {
   178 {
   156 private:
   179 private:
   157 	//--------------------------------------------------
   180 	//--------------------------------------------------
   158 
   181 
   166 	//--------------------------------------------------
   189 	//--------------------------------------------------
   167 public:
   190 public:
   168 	//--------------------------------------------------
   191 	//--------------------------------------------------
   169 
   192 
   170 	/// Destructor does nothing special.
   193 	/// Destructor does nothing special.
   171 	EAP_FUNC_IMPORT virtual ~eapol_header_rd_c();
   194 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H virtual ~eapol_header_rd_c();
   172 
   195 
   173 	/// Constructor does nothing special.
   196 	/// Constructor does nothing special.
   174 	/// The tools parameter is pointer to tools object.
   197 	/// The tools parameter is pointer to tools object.
   175 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   198 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   176 	/// The header_buffer_length parameter is length of the header_buffer.
   199 	/// The header_buffer_length parameter is length of the header_buffer.
   177 	EAP_FUNC_IMPORT eapol_header_rd_c(
   200 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eapol_header_rd_c(
   178 		abs_eap_am_tools_c * const tools,
   201 		abs_eap_am_tools_c * const tools,
   179 		u8_t * const header_buffer,
   202 		u8_t * const header_buffer,
   180 		const u32_t header_buffer_length);
   203 		const u32_t header_buffer_length);
   181 
   204 
   182 	/// This function returns pointer to the header of the EAP-packet included in the EAPOL-packet.
   205 	/// This function returns pointer to the header of the EAP-packet included in the EAPOL-packet.
   183 	EAP_FUNC_IMPORT u8_t * get_eap_header() const;
   206 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H u8_t * get_eap_header() const;
   184 
   207 
   185 	// 
   208 	// 
   186 	//--------------------------------------------------
   209 	//--------------------------------------------------
   187 }; // class eapol_header_rd_c
   210 }; // class eapol_header_rd_c
   188 
   211 
   189 
   212 
   190 
   213 
   191 
   214 
   192 /// This is read and write EAPOL header.
   215 /// This is read and write EAPOL header.
   193 /// @{ This class can be removed. eapol_header_base_c could be used instead. }
   216 /// @{ This class can be removed. eapol_header_base_c could be used instead. }
   194 class EAP_EXPORT eapol_header_wr_c
   217 class EAP_CLASS_VISIBILITY_EAPOL_HEADER_H eapol_header_wr_c
   195 : public eapol_header_base_c
   218 : public eapol_header_base_c
   196 {
   219 {
   197 private:
   220 private:
   198 	//--------------------------------------------------
   221 	//--------------------------------------------------
   199 
   222 
   207 	//--------------------------------------------------
   230 	//--------------------------------------------------
   208 public:
   231 public:
   209 	//--------------------------------------------------
   232 	//--------------------------------------------------
   210 
   233 
   211 	/// Destructor does nothing special.
   234 	/// Destructor does nothing special.
   212 	EAP_FUNC_IMPORT virtual ~eapol_header_wr_c();
   235 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H virtual ~eapol_header_wr_c();
   213 
   236 
   214 	/// Constructor does nothing special.
   237 	/// Constructor does nothing special.
   215 	/// The tools parameter is pointer to tools object.
   238 	/// The tools parameter is pointer to tools object.
   216 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   239 	/// The header_buffer parameter is pointer to buffer of EAPOL-packet including header and data.
   217 	/// The header_buffer_length parameter is length of the header_buffer.
   240 	/// The header_buffer_length parameter is length of the header_buffer.
   218 	EAP_FUNC_IMPORT eapol_header_wr_c(
   241 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H eapol_header_wr_c(
   219 		abs_eap_am_tools_c * const tools,
   242 		abs_eap_am_tools_c * const tools,
   220 		u8_t * const header_buffer,
   243 		u8_t * const header_buffer,
   221 		const u32_t header_buffer_length);
   244 		const u32_t header_buffer_length);
   222 
   245 
   223 	/// This function returns pointer to the header of the EAP-packet included in the EAPOL-packet.
   246 	/// This function returns pointer to the header of the EAP-packet included in the EAPOL-packet.
   224 	EAP_FUNC_IMPORT u8_t * get_eap_header();
   247 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H u8_t * get_eap_header();
   225 
   248 
   226 	/// This function resets the EAPOL-header.
   249 	/// This function resets the EAPOL-header.
   227 	/// The buffer_length parameter is the length of the EAPOL-header and the following data buffer.
   250 	/// The buffer_length parameter is the length of the EAPOL-header and the following data buffer.
   228 	EAP_FUNC_IMPORT void reset_header(u16_t buffer_length);
   251 	EAP_FUNC_VISIBILITY_EAPOL_HEADER_H void reset_header(u16_t buffer_length);
   229 
   252 
   230 	// 
   253 	// 
   231 	//--------------------------------------------------
   254 	//--------------------------------------------------
   232 }; // class eapol_header_wr_c
   255 }; // class eapol_header_wr_c
   233 
   256