|
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(_TLS_EXTENSION_H_) |
|
22 #define _TLS_EXTENSION_H_ |
|
23 |
|
24 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
25 |
|
26 #include "eap_tools.h" |
|
27 #include "eap_array.h" |
|
28 #include "eap_variable_data.h" |
|
29 #if defined(USE_FAST_EAP_TYPE) |
|
30 #include "eap_fast_tlv_header.h" |
|
31 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
32 |
|
33 /** @file */ |
|
34 |
|
35 /** |
|
36 * This is enumeration of TLS competion actions. |
|
37 */ |
|
38 enum tls_extension_type_e |
|
39 { |
|
40 tls_extension_type_none = 65535, ///< Initialization value means no type. |
|
41 tls_extension_type_server_name = 0, ///< Server Name Indication, see RFC 4366 |
|
42 tls_extension_type_max_frame_length = 1, ///< Maximum Fragment Length Negotiation, see RFC 4366 |
|
43 tls_extension_type_client_certificate_url = 2, ///< Client Certificate URLs, see RFC 4366 |
|
44 tls_extension_type_trusted_ca_keys = 3, ///< Trusted CA Indication, see RFC 4366 |
|
45 tls_extension_type_truncated_hmac = 4, ///< Truncated HMAC, see RFC 4366 |
|
46 tls_extension_type_status_request = 5, ///< Certificate Status Request, see RFC 4366 |
|
47 tls_extension_type_session_ticket = 35, ///< Session Ticket, see RFC 4507 |
|
48 }; |
|
49 |
|
50 //---------------------------------------------------------------------------- |
|
51 |
|
52 |
|
53 /// This class defines one TLS completion action. |
|
54 class EAP_EXPORT tls_extension_c |
|
55 : public eap_variable_data_c |
|
56 { |
|
57 private: |
|
58 //-------------------------------------------------- |
|
59 |
|
60 /// This is pointer to the tools class. @see abs_eap_am_tools_c. |
|
61 abs_eap_am_tools_c * const m_am_tools; |
|
62 |
|
63 /// This variable stores the lifetime hint of extension. |
|
64 u32_t m_lifetime_hint; |
|
65 |
|
66 /// This variable stores the type of extension. |
|
67 tls_extension_type_e m_type; |
|
68 |
|
69 #if defined(USE_FAST_EAP_TYPE) |
|
70 /// This variable stores the PAC-Type for fast access. |
|
71 eap_fast_pac_type_e m_pac_type; |
|
72 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
73 |
|
74 /// This indicates whether this object was generated successfully. |
|
75 bool m_is_valid; |
|
76 |
|
77 /** |
|
78 * The set_is_valid() function sets the state of the object valid. |
|
79 * The creator of this object calls this function after it is initialized. |
|
80 */ |
|
81 EAP_FUNC_IMPORT void set_is_valid(); |
|
82 |
|
83 //-------------------------------------------------- |
|
84 protected: |
|
85 //-------------------------------------------------- |
|
86 |
|
87 //-------------------------------------------------- |
|
88 public: |
|
89 //-------------------------------------------------- |
|
90 |
|
91 /** |
|
92 * Destructor does nothing special. |
|
93 */ |
|
94 EAP_FUNC_IMPORT virtual ~tls_extension_c(); |
|
95 |
|
96 /** |
|
97 * Constructor initializes object. |
|
98 */ |
|
99 EAP_FUNC_IMPORT tls_extension_c( |
|
100 abs_eap_am_tools_c * const tools); |
|
101 |
|
102 /** |
|
103 * Function copies the object. |
|
104 */ |
|
105 tls_extension_c * copy() const; |
|
106 |
|
107 /** |
|
108 * Object must indicate it's validity. |
|
109 * If object initialization fails this function must return false. |
|
110 * @return This function returns the validity of this object. |
|
111 */ |
|
112 EAP_FUNC_IMPORT bool get_is_valid(); |
|
113 |
|
114 /** |
|
115 * This function sets the extension lifitime hint. |
|
116 */ |
|
117 EAP_FUNC_IMPORT void set_lifetime_hint(const u32_t lifetime_hint); |
|
118 |
|
119 /** |
|
120 * This function gets the extension lifetime hint. |
|
121 */ |
|
122 EAP_FUNC_IMPORT u32_t get_lifetime_hint() const; |
|
123 |
|
124 /** |
|
125 * This function sets the extension type. |
|
126 */ |
|
127 EAP_FUNC_IMPORT void set_type(const tls_extension_type_e type); |
|
128 |
|
129 /** |
|
130 * This function gets the extension type. |
|
131 */ |
|
132 EAP_FUNC_IMPORT tls_extension_type_e get_type() const; |
|
133 |
|
134 #if defined(USE_FAST_EAP_TYPE) |
|
135 |
|
136 /// This function stores the PAC-Type for fast access. |
|
137 EAP_FUNC_IMPORT void set_pac_type(const eap_fast_pac_type_e pac_type); |
|
138 |
|
139 /// This function returns the PAC-Type for fast access. |
|
140 EAP_FUNC_IMPORT eap_fast_pac_type_e get_pac_type() const; |
|
141 |
|
142 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
143 |
|
144 /** |
|
145 * This function gets the debug string of the extension type. |
|
146 */ |
|
147 EAP_FUNC_IMPORT static eap_const_string get_type_string(tls_extension_type_e type); |
|
148 |
|
149 /** |
|
150 * This function gets the extension from the array of extensions. |
|
151 */ |
|
152 EAP_FUNC_IMPORT static const tls_extension_c * get_tls_extension( |
|
153 const tls_extension_type_e tls_extension_type, |
|
154 EAP_TEMPLATE_CONST eap_array_c<tls_extension_c> * const tls_extensions, |
|
155 abs_eap_am_tools_c * const am_tools); |
|
156 |
|
157 #if defined(USE_FAST_EAP_TYPE) |
|
158 /** |
|
159 * This function gets the extension from the array of extensions. |
|
160 */ |
|
161 EAP_FUNC_IMPORT static const tls_extension_c * get_tls_extension( |
|
162 const tls_extension_type_e tls_extension_type, |
|
163 const eap_fast_pac_type_e pac_type, |
|
164 EAP_TEMPLATE_CONST eap_array_c<tls_extension_c> * const tls_extensions, |
|
165 abs_eap_am_tools_c * const am_tools); |
|
166 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
167 |
|
168 // |
|
169 //-------------------------------------------------- |
|
170 }; // class tls_extension_c |
|
171 |
|
172 |
|
173 //-------------------------------------------------- |
|
174 |
|
175 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
|
176 |
|
177 #endif //#if !defined(_TLS_EXTENSION_H_) |
|
178 |
|
179 // End. |