22 #if !defined(_ASN1_TYPE_H_) |
22 #if !defined(_ASN1_TYPE_H_) |
23 #define _ASN1_TYPE_H_ |
23 #define _ASN1_TYPE_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_ASN1_DER_TYPE_H) |
|
29 #define EAP_CLASS_VISIBILITY_ASN1_DER_TYPE_H EAP_NONSHARABLE |
|
30 #define EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H |
|
31 #define EAP_C_FUNC_VISIBILITY_ASN1_DER_TYPE_H |
|
32 #define EAP_FUNC_EXPORT_ASN1_DER_TYPE_H |
|
33 #define EAP_C_FUNC_EXPORT_ASN1_DER_TYPE_H |
|
34 #elif defined(EAP_EXPORT_ASN1_DER_TYPE_H) |
|
35 #define EAP_CLASS_VISIBILITY_ASN1_DER_TYPE_H EAP_EXPORT |
|
36 #define EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H EAP_FUNC_EXPORT |
|
37 #define EAP_C_FUNC_VISIBILITY_ASN1_DER_TYPE_H EAP_C_FUNC_EXPORT |
|
38 #define EAP_FUNC_EXPORT_ASN1_DER_TYPE_H EAP_FUNC_EXPORT |
|
39 #define EAP_C_FUNC_EXPORT_ASN1_DER_TYPE_H EAP_C_FUNC_EXPORT |
|
40 #else |
|
41 #define EAP_CLASS_VISIBILITY_ASN1_DER_TYPE_H EAP_IMPORT |
|
42 #define EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H EAP_FUNC_IMPORT |
|
43 #define EAP_C_FUNC_VISIBILITY_ASN1_DER_TYPE_H EAP_C_FUNC_IMPORT |
|
44 #define EAP_FUNC_EXPORT_ASN1_DER_TYPE_H |
|
45 #define EAP_C_FUNC_EXPORT_ASN1_DER_TYPE_H |
|
46 #endif |
|
47 // End: added by script change_export_macros.sh. |
27 #include "eap_array.h" |
48 #include "eap_array.h" |
28 |
49 |
29 //-------------------------------------------------- |
50 //-------------------------------------------------- |
30 |
51 |
31 class asn1_type_const_c; |
52 class asn1_type_const_c; |
32 |
53 |
33 //-------------------------------------------------- |
54 //-------------------------------------------------- |
34 |
55 |
35 class EAP_EXPORT asn1_der_type_c |
56 class EAP_CLASS_VISIBILITY_ASN1_DER_TYPE_H asn1_der_type_c |
36 { |
57 { |
37 //-------------------------------------------------- |
58 //-------------------------------------------------- |
38 public: |
59 public: |
39 //-------------------------------------------------- |
60 //-------------------------------------------------- |
40 |
61 |
109 asn1_identifier_const_short_length_size = sizeof(u8_t), |
130 asn1_identifier_const_short_length_size = sizeof(u8_t), |
110 asn1_length_field_base = 256ul, |
131 asn1_length_field_base = 256ul, |
111 }; |
132 }; |
112 |
133 |
113 |
134 |
114 EAP_FUNC_IMPORT virtual ~asn1_der_type_c(); |
135 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H virtual ~asn1_der_type_c(); |
115 |
136 |
116 EAP_FUNC_IMPORT asn1_der_type_c( |
137 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H asn1_der_type_c( |
117 abs_eap_am_tools_c * const tools); |
138 abs_eap_am_tools_c * const tools); |
118 |
139 |
119 /** |
140 /** |
120 * The get_is_valid() function returns the status of the asn1_der_type_c object. |
141 * The get_is_valid() function returns the status of the asn1_der_type_c object. |
121 * @return True indicates the object is initialized. |
142 * @return True indicates the object is initialized. |
122 */ |
143 */ |
123 EAP_FUNC_IMPORT bool get_is_valid() const; |
144 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H bool get_is_valid() const; |
124 |
145 |
125 EAP_FUNC_IMPORT u32_t get_index() const; |
146 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H u32_t get_index() const; |
126 |
147 |
127 /** |
148 /** |
128 * The decode() function decodes ASN.1/DER data. |
149 * The decode() function decodes ASN.1/DER data. |
129 * @return eap_status_ok indicates successfull operation. |
150 * @return eap_status_ok indicates successfull operation. |
130 */ |
151 */ |
131 EAP_FUNC_IMPORT eap_status_e decode(const eap_variable_data_c * const asn1_der_data); |
152 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_status_e decode(const eap_variable_data_c * const asn1_der_data); |
132 |
153 |
133 /** |
154 /** |
134 * The get_class() returns Class of ASN.1/DER type. |
155 * The get_class() returns Class of ASN.1/DER type. |
135 */ |
156 */ |
136 EAP_FUNC_IMPORT asn1_class_e get_class() const; |
157 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H asn1_class_e get_class() const; |
137 |
158 |
138 /** |
159 /** |
139 * The get_pc() returns Primitiva/Constructed flag of ASN.1/DER type. |
160 * The get_pc() returns Primitiva/Constructed flag of ASN.1/DER type. |
140 */ |
161 */ |
141 EAP_FUNC_IMPORT asn1_pc_e get_pc() const; |
162 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H asn1_pc_e get_pc() const; |
142 |
163 |
143 /** |
164 /** |
144 * The get_pc() returns Tag of ASN.1/DER type. |
165 * The get_pc() returns Tag of ASN.1/DER type. |
145 */ |
166 */ |
146 EAP_FUNC_IMPORT asn1_tag_e get_tag() const; |
167 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H asn1_tag_e get_tag() const; |
147 |
168 |
148 /** |
169 /** |
149 * The get_pc() returns pointer to extented Tag of ASN.1/DER type. |
170 * The get_pc() returns pointer to extented Tag of ASN.1/DER type. |
150 */ |
171 */ |
151 EAP_FUNC_IMPORT eap_status_e get_extented_tag(const u8_t ** const extented_tag, u32_t * const extented_tag_size) const; |
172 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_status_e get_extented_tag(const u8_t ** const extented_tag, u32_t * const extented_tag_size) const; |
152 |
173 |
153 // Function returns count of octets in header of ASN.1/DER type. |
174 // Function returns count of octets in header of ASN.1/DER type. |
154 // This includes Identifier and Length octets. |
175 // This includes Identifier and Length octets. |
155 EAP_FUNC_IMPORT u32_t get_header_length() const; |
176 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H u32_t get_header_length() const; |
156 |
177 |
157 |
178 |
158 // Function returns count of octets in Contents of ASN.1/DER type. |
179 // Function returns count of octets in Contents of ASN.1/DER type. |
159 EAP_FUNC_IMPORT u32_t get_content_length() const; |
180 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H u32_t get_content_length() const; |
160 |
181 |
161 // Function returns pointer to Contents of ASN.1/DER type. |
182 // Function returns pointer to Contents of ASN.1/DER type. |
162 EAP_FUNC_IMPORT const u8_t * get_content() const; |
183 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const u8_t * get_content() const; |
163 |
184 |
164 |
185 |
165 // Function returns count of octets in full data of ASN.1/DER type, including Identifier, Length and Content. |
186 // Function returns count of octets in full data of ASN.1/DER type, including Identifier, Length and Content. |
166 EAP_FUNC_IMPORT u32_t get_full_data_length() const; |
187 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H u32_t get_full_data_length() const; |
167 |
188 |
168 // Function returns pointer to full data of ASN.1/DER type, including Identifier, Length and Content. |
189 // Function returns pointer to full data of ASN.1/DER type, including Identifier, Length and Content. |
169 EAP_FUNC_IMPORT const u8_t * get_full_data() const; |
190 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const u8_t * get_full_data() const; |
170 |
191 |
171 |
192 |
172 // Function returns pointer to array of ASN.1/DER sub types. |
193 // Function returns pointer to array of ASN.1/DER sub types. |
173 EAP_FUNC_IMPORT const eap_array_c<asn1_der_type_c> * get_sub_types() const; |
194 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const eap_array_c<asn1_der_type_c> * get_sub_types() const; |
174 |
195 |
175 // Function returns pointer to ASN.1/DER sub type. |
196 // Function returns pointer to ASN.1/DER sub type. |
176 EAP_FUNC_IMPORT const asn1_der_type_c * get_sub_type(const asn1_type_const_c * const asn1_type) const; |
197 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const asn1_der_type_c * get_sub_type(const asn1_type_const_c * const asn1_type) const; |
177 |
198 |
178 EAP_FUNC_IMPORT const asn1_der_type_c * get_previous_type() const; |
199 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const asn1_der_type_c * get_previous_type() const; |
179 |
200 |
180 EAP_FUNC_IMPORT const asn1_der_type_c * get_next_type() const; |
201 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H const asn1_der_type_c * get_next_type() const; |
181 |
202 |
182 EAP_FUNC_IMPORT u16_t get_count_of_sub_types() const; |
203 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H u16_t get_count_of_sub_types() const; |
183 |
204 |
184 EAP_FUNC_IMPORT void increase_count_of_sub_types(); |
205 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H void increase_count_of_sub_types(); |
185 |
206 |
186 EAP_FUNC_IMPORT eap_const_string get_class_string() const; |
207 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_const_string get_class_string() const; |
187 |
208 |
188 EAP_FUNC_IMPORT eap_const_string get_pc_string() const; |
209 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_const_string get_pc_string() const; |
189 |
210 |
190 EAP_FUNC_IMPORT eap_const_string get_tag_string() const; |
211 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_const_string get_tag_string() const; |
191 |
212 |
192 EAP_FUNC_IMPORT eap_status_e compare_object_identifier(const u8_t * const der_encoded_oid, const u32_t oid_length) const; |
213 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_status_e compare_object_identifier(const u8_t * const der_encoded_oid, const u32_t oid_length) const; |
193 |
214 |
194 EAP_FUNC_IMPORT eap_status_e compare_object_identifier(eap_const_string oid, const u32_t oid_length) const; |
215 EAP_FUNC_VISIBILITY_ASN1_DER_TYPE_H eap_status_e compare_object_identifier(eap_const_string oid, const u32_t oid_length) const; |
195 |
216 |
196 //-------------------------------------------------- |
217 //-------------------------------------------------- |
197 private: |
218 private: |
198 //-------------------------------------------------- |
219 //-------------------------------------------------- |
199 |
220 |