eapol/eapol_framework/eapol_common/type/radius/include/eap_radius_payloads.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    22 #if !defined(_EAP_RADIUS_RESULT_H_)
    22 #if !defined(_EAP_RADIUS_RESULT_H_)
    23 #define _EAP_RADIUS_RESULT_H_
    23 #define _EAP_RADIUS_RESULT_H_
    24 
    24 
    25 #include "eap_variable_data.h"
    25 #include "eap_variable_data.h"
    26 #include "eap_am_export.h"
    26 #include "eap_am_export.h"
       
    27 // Start: added by script change_export_macros.sh.
       
    28 #if defined(EAP_NO_EXPORT_EAP_RADIUS_PAYLOADS_H)
       
    29 	#define EAP_CLASS_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_NONSHARABLE 
       
    30 	#define EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H 
       
    31 	#define EAP_C_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H 
       
    32 	#define EAP_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H 
       
    33 	#define EAP_C_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H 
       
    34 #elif defined(EAP_EXPORT_EAP_RADIUS_PAYLOADS_H)
       
    35 	#define EAP_CLASS_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_EXPORT 
       
    36 	#define EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_FUNC_EXPORT 
       
    37 	#define EAP_C_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_C_FUNC_EXPORT 
       
    38 	#define EAP_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H EAP_C_FUNC_EXPORT 
       
    40 #else
       
    41 	#define EAP_CLASS_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_IMPORT 
       
    42 	#define EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_FUNC_IMPORT 
       
    43 	#define EAP_C_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H EAP_C_FUNC_IMPORT 
       
    44 	#define EAP_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H 
       
    45 	#define EAP_C_FUNC_EXPORT_EAP_RADIUS_PAYLOADS_H 
       
    46 #endif
       
    47 // End: added by script change_export_macros.sh.
    27 #include "eap_radius_header.h"
    48 #include "eap_radius_header.h"
    28 #include "eap_radius_attribute_header.h"
    49 #include "eap_radius_attribute_header.h"
    29 #include "eap_core_map.h"
    50 #include "eap_core_map.h"
    30 
    51 
    31 
    52 
    32 class EAP_EXPORT eap_radius_variable_data_c
    53 class EAP_CLASS_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_variable_data_c
    33 {
    54 {
    34 private:
    55 private:
    35 	//--------------------------------------------------
    56 	//--------------------------------------------------
    36 
    57 
    37 	abs_eap_am_tools_c * const m_am_tools;
    58 	abs_eap_am_tools_c * const m_am_tools;
    46 
    67 
    47 	//--------------------------------------------------
    68 	//--------------------------------------------------
    48 public:
    69 public:
    49 	//--------------------------------------------------
    70 	//--------------------------------------------------
    50 
    71 
    51 	EAP_FUNC_IMPORT virtual ~eap_radius_variable_data_c();
    72 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H virtual ~eap_radius_variable_data_c();
    52 
    73 
    53 	EAP_FUNC_IMPORT eap_radius_variable_data_c(abs_eap_am_tools_c * const tools);
    74 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_variable_data_c(abs_eap_am_tools_c * const tools);
    54 
    75 
    55 	EAP_FUNC_IMPORT eap_status_e set_buffer(
    76 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_status_e set_buffer(
    56 		const eap_diameter_avp_code_c current_payload,
    77 		const eap_diameter_avp_code_c current_payload,
    57 		const u8_t * const buffer,
    78 		const u8_t * const buffer,
    58 		const u32_t buffer_length,
    79 		const u32_t buffer_length,
    59 		const bool free_buffer,
    80 		const bool free_buffer,
    60 		const bool is_writable);
    81 		const bool is_writable);
    61 
    82 
    62 	EAP_FUNC_IMPORT eap_status_e add_data(
    83 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_status_e add_data(
    63 		const u8_t * const buffer,
    84 		const u8_t * const buffer,
    64 		const u32_t buffer_length);
    85 		const u32_t buffer_length);
    65 
    86 
    66 	EAP_FUNC_IMPORT u32_t get_data_length() const;
    87 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H u32_t get_data_length() const;
    67 
    88 
    68 	EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const;
    89 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H u8_t * get_data(const u32_t data_length) const;
    69 
    90 
    70 	EAP_FUNC_IMPORT eap_variable_data_c * get_payload_buffer();
    91 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_variable_data_c * get_payload_buffer();
    71 
    92 
    72 	EAP_FUNC_IMPORT eap_diameter_avp_code_c get_payload_type() const;
    93 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_diameter_avp_code_c get_payload_type() const;
    73 
    94 
    74 	EAP_FUNC_IMPORT void set_payload_type(const eap_diameter_avp_code_c type);
    95 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H void set_payload_type(const eap_diameter_avp_code_c type);
    75 
    96 
    76 	EAP_FUNC_IMPORT eap_radius_variable_data_c * copy() const;
    97 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_variable_data_c * copy() const;
    77 
    98 
    78 	EAP_FUNC_IMPORT  void object_increase_reference_count();
    99 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H  void object_increase_reference_count();
    79 
   100 
    80 	//--------------------------------------------------
   101 	//--------------------------------------------------
    81 }; // class eap_radius_variable_data_c
   102 }; // class eap_radius_variable_data_c
    82 
   103 
    83 
   104 
    84 //--------------------------------------------------
   105 //--------------------------------------------------
    85 
   106 
    86 
   107 
    87 // 
   108 // 
    88 class EAP_EXPORT eap_radius_payloads_c
   109 class EAP_CLASS_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_payloads_c
    89 : public abs_eap_core_map_c
   110 : public abs_eap_core_map_c
    90 {
   111 {
    91 private:
   112 private:
    92 	//--------------------------------------------------
   113 	//--------------------------------------------------
    93 
   114 
   104 
   125 
   105 	//--------------------------------------------------
   126 	//--------------------------------------------------
   106 public:
   127 public:
   107 	//--------------------------------------------------
   128 	//--------------------------------------------------
   108 
   129 
   109 	EAP_FUNC_IMPORT virtual ~eap_radius_payloads_c();
   130 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H virtual ~eap_radius_payloads_c();
   110 
   131 
   111 	EAP_FUNC_IMPORT eap_radius_payloads_c(
   132 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_payloads_c(
   112 		abs_eap_am_tools_c * const tools);
   133 		abs_eap_am_tools_c * const tools);
   113 
   134 
   114 	EAP_FUNC_IMPORT eap_radius_variable_data_c * get_payload(
   135 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_radius_variable_data_c * get_payload(
   115 		const eap_diameter_avp_code_c current_payload);
   136 		const eap_diameter_avp_code_c current_payload);
   116 
   137 
   117 	EAP_FUNC_IMPORT eap_status_e add_payload(
   138 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_status_e add_payload(
   118 		const eap_diameter_avp_code_c current_payload,
   139 		const eap_diameter_avp_code_c current_payload,
   119 		const u8_t * const data,
   140 		const u8_t * const data,
   120 		const u32_t data_length,
   141 		const u32_t data_length,
   121 		const bool free_buffer,
   142 		const bool free_buffer,
   122 		const bool is_writable,
   143 		const bool is_writable,
   128 	 * Payloads are stored to p_radius_payloads.
   149 	 * Payloads are stored to p_radius_payloads.
   129 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   150 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   130 	 * function returns eap_status_header_corrupted.
   151 	 * function returns eap_status_header_corrupted.
   131 	 * Also error is returned when illegal payload attribute is recognised.
   152 	 * Also error is returned when illegal payload attribute is recognised.
   132 	 */
   153 	 */
   133 	EAP_FUNC_IMPORT eap_status_e parse_radius_payload(
   154 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_status_e parse_radius_payload(
   134 		const eap_radius_attribute_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   155 		const eap_radius_attribute_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   135 		u32_t * const buffer_length ///< This is the length of the buffer. This must match with the length of all payloads.
   156 		u32_t * const buffer_length ///< This is the length of the buffer. This must match with the length of all payloads.
   136 		);
   157 		);
   137 
   158 
   138 	/**
   159 	/**
   139 	 * This function parses each payload attributes.
   160 	 * This function parses each payload attributes.
   140 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   161 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   141 	 * If payload attribute is unknown function returns eap_status_unsupported_payload.
   162 	 * If payload attribute is unknown function returns eap_status_unsupported_payload.
   142 	 */
   163 	 */
   143 	EAP_FUNC_IMPORT eap_status_e parse_generic_payload(
   164 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H eap_status_e parse_generic_payload(
   144 		const eap_diameter_avp_code_c current_payload, ///< This is the type of current payload attribute.
   165 		const eap_diameter_avp_code_c current_payload, ///< This is the type of current payload attribute.
   145 		const eap_radius_attribute_header_c * const payload ///< This is the current parsed payload.
   166 		const eap_radius_attribute_header_c * const payload ///< This is the current parsed payload.
   146 		);
   167 		);
   147 
   168 
   148 
   169 
   149 	EAP_FUNC_IMPORT bool get_is_valid() const;
   170 	EAP_FUNC_VISIBILITY_EAP_RADIUS_PAYLOADS_H bool get_is_valid() const;
   150 
   171 
   151 	//--------------------------------------------------
   172 	//--------------------------------------------------
   152 }; // class eap_radius_payloads_c
   173 }; // class eap_radius_payloads_c
   153 
   174 
   154 
   175