|
1 /* |
|
2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #if !defined(_EAP_RADIUS_RESULT_H_) |
|
22 #define _EAP_RADIUS_RESULT_H_ |
|
23 |
|
24 #include "eap_variable_data.h" |
|
25 #include "eap_am_export.h" |
|
26 #include "eap_radius_header.h" |
|
27 #include "eap_radius_attribute_header.h" |
|
28 #include "eap_core_map.h" |
|
29 |
|
30 |
|
31 class EAP_EXPORT eap_radius_variable_data_c |
|
32 { |
|
33 private: |
|
34 //-------------------------------------------------- |
|
35 |
|
36 abs_eap_am_tools_c * const m_am_tools; |
|
37 |
|
38 eap_variable_data_c m_data; |
|
39 |
|
40 eap_diameter_avp_code_c m_payload_type; |
|
41 |
|
42 //-------------------------------------------------- |
|
43 protected: |
|
44 //-------------------------------------------------- |
|
45 |
|
46 //-------------------------------------------------- |
|
47 public: |
|
48 //-------------------------------------------------- |
|
49 |
|
50 EAP_FUNC_IMPORT virtual ~eap_radius_variable_data_c(); |
|
51 |
|
52 EAP_FUNC_IMPORT eap_radius_variable_data_c(abs_eap_am_tools_c * const tools); |
|
53 |
|
54 EAP_FUNC_IMPORT eap_status_e set_buffer( |
|
55 const eap_diameter_avp_code_c current_payload, |
|
56 const u8_t * const buffer, |
|
57 const u32_t buffer_length, |
|
58 const bool free_buffer, |
|
59 const bool is_writable); |
|
60 |
|
61 EAP_FUNC_IMPORT eap_status_e add_data( |
|
62 const u8_t * const buffer, |
|
63 const u32_t buffer_length); |
|
64 |
|
65 EAP_FUNC_IMPORT u32_t get_data_length() const; |
|
66 |
|
67 EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const; |
|
68 |
|
69 EAP_FUNC_IMPORT eap_variable_data_c * get_payload_buffer(); |
|
70 |
|
71 EAP_FUNC_IMPORT eap_diameter_avp_code_c get_payload_type() const; |
|
72 |
|
73 EAP_FUNC_IMPORT void set_payload_type(const eap_diameter_avp_code_c type); |
|
74 |
|
75 EAP_FUNC_IMPORT eap_radius_variable_data_c * copy() const; |
|
76 |
|
77 EAP_FUNC_IMPORT void object_increase_reference_count(); |
|
78 |
|
79 //-------------------------------------------------- |
|
80 }; // class eap_radius_variable_data_c |
|
81 |
|
82 |
|
83 //-------------------------------------------------- |
|
84 |
|
85 |
|
86 // |
|
87 class EAP_EXPORT eap_radius_payloads_c |
|
88 : public abs_eap_core_map_c |
|
89 { |
|
90 private: |
|
91 //-------------------------------------------------- |
|
92 |
|
93 abs_eap_am_tools_c * const m_am_tools; |
|
94 |
|
95 /// This stores objects using eap_variable_data selector. |
|
96 eap_core_map_c<eap_radius_variable_data_c, abs_eap_core_map_c, eap_variable_data_c> m_payload_map; |
|
97 |
|
98 bool m_is_valid; |
|
99 |
|
100 //-------------------------------------------------- |
|
101 protected: |
|
102 //-------------------------------------------------- |
|
103 |
|
104 //-------------------------------------------------- |
|
105 public: |
|
106 //-------------------------------------------------- |
|
107 |
|
108 EAP_FUNC_IMPORT virtual ~eap_radius_payloads_c(); |
|
109 |
|
110 EAP_FUNC_IMPORT eap_radius_payloads_c( |
|
111 abs_eap_am_tools_c * const tools); |
|
112 |
|
113 EAP_FUNC_IMPORT eap_radius_variable_data_c * get_payload( |
|
114 const eap_diameter_avp_code_c current_payload); |
|
115 |
|
116 EAP_FUNC_IMPORT eap_status_e add_payload( |
|
117 const eap_diameter_avp_code_c current_payload, |
|
118 const u8_t * const data, |
|
119 const u32_t data_length, |
|
120 const bool free_buffer, |
|
121 const bool is_writable, |
|
122 const bool fragments_allowed); |
|
123 |
|
124 /** |
|
125 * This function parses the payloads starting from specified payload (p_payload). |
|
126 * Function parses all payloads from the buffer. |
|
127 * Payloads are stored to p_radius_payloads. |
|
128 * @return If the length of the buffer and sum of the length of all payloads does not match |
|
129 * function returns eap_status_header_corrupted. |
|
130 * Also error is returned when illegal payload attribute is recognised. |
|
131 */ |
|
132 EAP_FUNC_IMPORT eap_status_e parse_radius_payload( |
|
133 const eap_radius_attribute_header_c * const p_payload, ///< This is the start of the buffer and the first parsed payload. |
|
134 u32_t * const buffer_length ///< This is the length of the buffer. This must match with the length of all payloads. |
|
135 ); |
|
136 |
|
137 /** |
|
138 * This function parses each payload attributes. |
|
139 * @return If payload attribute is illegal function returns eap_status_header_corrupted. |
|
140 * If payload attribute is unknown function returns eap_status_unsupported_payload. |
|
141 */ |
|
142 EAP_FUNC_IMPORT eap_status_e parse_generic_payload( |
|
143 const eap_diameter_avp_code_c current_payload, ///< This is the type of current payload attribute. |
|
144 const eap_radius_attribute_header_c * const payload ///< This is the current parsed payload. |
|
145 ); |
|
146 |
|
147 |
|
148 EAP_FUNC_IMPORT bool get_is_valid() const; |
|
149 |
|
150 //-------------------------------------------------- |
|
151 }; // class eap_radius_payloads_c |
|
152 |
|
153 |
|
154 #endif //#if !defined(_EAP_RADIUS_RESULT_H_) |
|
155 |
|
156 //-------------------------------------------------- |
|
157 |
|
158 |
|
159 |
|
160 // End. |