eapol/eapol_framework/eapol_common/type/diameter/include/eap_diameter_payloads.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    22 #if !defined(_EAP_DIAMETER_RESULT_H_)
    22 #if !defined(_EAP_DIAMETER_RESULT_H_)
    23 #define _EAP_DIAMETER_RESULT_H_
    23 #define _EAP_DIAMETER_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_DIAMETER_PAYLOADS_H)
       
    29 	#define EAP_CLASS_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_NONSHARABLE 
       
    30 	#define EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H 
       
    31 	#define EAP_C_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H 
       
    32 	#define EAP_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H 
       
    33 	#define EAP_C_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H 
       
    34 #elif defined(EAP_EXPORT_EAP_DIAMETER_PAYLOADS_H)
       
    35 	#define EAP_CLASS_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_EXPORT 
       
    36 	#define EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_FUNC_EXPORT 
       
    37 	#define EAP_C_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_C_FUNC_EXPORT 
       
    38 	#define EAP_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H EAP_C_FUNC_EXPORT 
       
    40 #else
       
    41 	#define EAP_CLASS_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_IMPORT 
       
    42 	#define EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_FUNC_IMPORT 
       
    43 	#define EAP_C_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H EAP_C_FUNC_IMPORT 
       
    44 	#define EAP_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H 
       
    45 	#define EAP_C_FUNC_EXPORT_EAP_DIAMETER_PAYLOADS_H 
       
    46 #endif
       
    47 // End: added by script change_export_macros.sh.
    27 #include "eap_diameter_avp_header.h"
    48 #include "eap_diameter_avp_header.h"
    28 #include "eap_diameter_avp_code.h"
    49 #include "eap_diameter_avp_code.h"
    29 #include "eap_core_map.h"
    50 #include "eap_core_map.h"
    30 #include "eap_array.h"
    51 #include "eap_array.h"
    31 
    52 
    32 
    53 
    33 class EAP_EXPORT eap_diameter_variable_data_c
    54 class EAP_CLASS_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_variable_data_c
    34 {
    55 {
    35 private:
    56 private:
    36 	//--------------------------------------------------
    57 	//--------------------------------------------------
    37 
    58 
    38 	abs_eap_am_tools_c * const m_am_tools;
    59 	abs_eap_am_tools_c * const m_am_tools;
    49 
    70 
    50 	//--------------------------------------------------
    71 	//--------------------------------------------------
    51 public:
    72 public:
    52 	//--------------------------------------------------
    73 	//--------------------------------------------------
    53 
    74 
    54 	EAP_FUNC_IMPORT virtual ~eap_diameter_variable_data_c();
    75 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H virtual ~eap_diameter_variable_data_c();
    55 
    76 
    56 	EAP_FUNC_IMPORT eap_diameter_variable_data_c(abs_eap_am_tools_c * const tools);
    77 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_variable_data_c(abs_eap_am_tools_c * const tools);
    57 
    78 
    58 	EAP_FUNC_IMPORT eap_status_e set_buffer(
    79 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e set_buffer(
    59 		const eap_diameter_avp_code_c current_payload_code,
    80 		const eap_diameter_avp_code_c current_payload_code,
    60 		const bool is_mandatory,
    81 		const bool is_mandatory,
    61 		const u8_t * const buffer,
    82 		const u8_t * const buffer,
    62 		const u32_t buffer_length,
    83 		const u32_t buffer_length,
    63 		const bool free_buffer,
    84 		const bool free_buffer,
    64 		const bool is_writable);
    85 		const bool is_writable);
    65 
    86 
    66 	EAP_FUNC_IMPORT eap_status_e add_data(
    87 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e add_data(
    67 		const u8_t * const buffer,
    88 		const u8_t * const buffer,
    68 		const u32_t buffer_length);
    89 		const u32_t buffer_length);
    69 
    90 
    70 	EAP_FUNC_IMPORT u32_t get_data_length() const;
    91 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H u32_t get_data_length() const;
    71 
    92 
    72 	EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const;
    93 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H u8_t * get_data(const u32_t data_length) const;
    73 
    94 
    74 	EAP_FUNC_IMPORT eap_variable_data_c * get_payload_buffer();
    95 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_variable_data_c * get_payload_buffer();
    75 
    96 
    76 	EAP_FUNC_IMPORT eap_diameter_avp_code_c get_payload_code() const;
    97 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_avp_code_c get_payload_code() const;
    77 
    98 
    78 	EAP_FUNC_IMPORT bool get_is_mandatory() const;
    99 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H bool get_is_mandatory() const;
    79 
   100 
    80 	EAP_FUNC_IMPORT void set_payload_code(const eap_diameter_avp_code_c code);
   101 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H void set_payload_code(const eap_diameter_avp_code_c code);
    81 
   102 
    82 	EAP_FUNC_IMPORT eap_diameter_variable_data_c * copy() const;
   103 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_variable_data_c * copy() const;
    83 
   104 
    84 	EAP_FUNC_IMPORT  void object_increase_reference_count();
   105 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H  void object_increase_reference_count();
    85 
   106 
    86 	//--------------------------------------------------
   107 	//--------------------------------------------------
    87 }; // class eap_diameter_variable_data_c
   108 }; // class eap_diameter_variable_data_c
    88 
   109 
    89 
   110 
    90 //--------------------------------------------------
   111 //--------------------------------------------------
    91 
   112 
    92 
   113 
    93 // 
   114 // 
    94 class EAP_EXPORT eap_diameter_payloads_c
   115 class EAP_CLASS_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_payloads_c
    95 : public abs_eap_core_map_c
   116 : public abs_eap_core_map_c
    96 {
   117 {
    97 private:
   118 private:
    98 	//--------------------------------------------------
   119 	//--------------------------------------------------
    99 
   120 
   114 
   135 
   115 	//--------------------------------------------------
   136 	//--------------------------------------------------
   116 public:
   137 public:
   117 	//--------------------------------------------------
   138 	//--------------------------------------------------
   118 
   139 
   119 	EAP_FUNC_IMPORT virtual ~eap_diameter_payloads_c();
   140 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H virtual ~eap_diameter_payloads_c();
   120 
   141 
   121 	EAP_FUNC_IMPORT eap_diameter_payloads_c(
   142 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_payloads_c(
   122 		abs_eap_am_tools_c * const tools);
   143 		abs_eap_am_tools_c * const tools);
   123 
   144 
   124 	EAP_FUNC_IMPORT eap_diameter_variable_data_c * get_payload(
   145 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_diameter_variable_data_c * get_payload(
   125 		const eap_diameter_avp_code_c current_payload);
   146 		const eap_diameter_avp_code_c current_payload);
   126 
   147 
   127 	EAP_FUNC_IMPORT eap_status_e add_payload(
   148 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e add_payload(
   128 		const eap_diameter_avp_code_c current_payload,
   149 		const eap_diameter_avp_code_c current_payload,
   129 		const bool is_mandatory,
   150 		const bool is_mandatory,
   130 		const u8_t * const data,
   151 		const u8_t * const data,
   131 		const u32_t data_length,
   152 		const u32_t data_length,
   132 		const bool free_buffer,
   153 		const bool free_buffer,
   139 	 * Payloads are stored to p_radius_payloads.
   160 	 * Payloads are stored to p_radius_payloads.
   140 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   161 	 * @return If the length of the buffer and sum of the length of all payloads does not match
   141 	 * function returns eap_status_header_corrupted.
   162 	 * function returns eap_status_header_corrupted.
   142 	 * Also error is returned when illegal payload attribute is recognised.
   163 	 * Also error is returned when illegal payload attribute is recognised.
   143 	 */
   164 	 */
   144 	EAP_FUNC_IMPORT eap_status_e parse_diameter_payloads(
   165 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e parse_diameter_payloads(
   145 		const eap_diameter_avp_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   166 		const eap_diameter_avp_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload.
   146 		u32_t * const buffer_length ///< This is the length of the buffer. This must match with the length of all payloads.
   167 		u32_t * const buffer_length ///< This is the length of the buffer. This must match with the length of all payloads.
   147 		);
   168 		);
   148 
   169 
   149 	/**
   170 	/**
   150 	 * This function parses each payload attributes.
   171 	 * This function parses each payload attributes.
   151 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   172 	 * @return If payload attribute is illegal function returns eap_status_header_corrupted.
   152 	 * If payload attribute is unknown function returns eap_status_unsupported_payload.
   173 	 * If payload attribute is unknown function returns eap_status_unsupported_payload.
   153 	 */
   174 	 */
   154 	EAP_FUNC_IMPORT eap_status_e parse_generic_payload(
   175 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e parse_generic_payload(
   155 		const eap_diameter_avp_code_c current_payload, ///< This is the type of current payload attribute.
   176 		const eap_diameter_avp_code_c current_payload, ///< This is the type of current payload attribute.
   156 		const eap_diameter_avp_header_c * const payload ///< This is the current parsed payload.
   177 		const eap_diameter_avp_header_c * const payload ///< This is the current parsed payload.
   157 		);
   178 		);
   158 
   179 
   159 	/**
   180 	/**
   160 	 * This function checks all mandatory AVPs are used.
   181 	 * This function checks all mandatory AVPs are used.
   161 	 */
   182 	 */
   162 	EAP_FUNC_IMPORT eap_status_e check_mandatory_payloads(
   183 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e check_mandatory_payloads(
   163 		EAP_TEMPLATE_CONST eap_array_c<eap_diameter_avp_code_c> * const used_payloads);
   184 		EAP_TEMPLATE_CONST eap_array_c<eap_diameter_avp_code_c> * const used_payloads);
   164 
   185 
   165 	/**
   186 	/**
   166 	 * This function checks all required AVPs are received.
   187 	 * This function checks all required AVPs are received.
   167 	 */
   188 	 */
   168 	EAP_FUNC_IMPORT eap_status_e check_payloads_existense(
   189 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e check_payloads_existense(
   169 		EAP_TEMPLATE_CONST eap_array_c<eap_diameter_avp_code_c> * const needed_payloads);
   190 		EAP_TEMPLATE_CONST eap_array_c<eap_diameter_avp_code_c> * const needed_payloads);
   170 
   191 
   171 	EAP_FUNC_IMPORT bool get_is_valid() const;
   192 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H bool get_is_valid() const;
   172 
   193 
   173 	EAP_FUNC_IMPORT eap_status_e reset();
   194 	EAP_FUNC_VISIBILITY_EAP_DIAMETER_PAYLOADS_H eap_status_e reset();
   174 
   195 
   175 	//--------------------------------------------------
   196 	//--------------------------------------------------
   176 }; // class eap_diameter_payloads_c
   197 }; // class eap_diameter_payloads_c
   177 
   198 
   178 
   199