|
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 |
|
22 #if !defined( _EAP_AM_MEMORY_STORE_H_ ) |
|
23 #define _EAP_AM_MEMORY_STORE_H_ |
|
24 |
|
25 //#if !defined(NO_EAP_AM_MEMORY_STORE) |
|
26 |
|
27 #include "abs_eap_base_type.h" |
|
28 #include "eap_am_memory_store_data.h" |
|
29 #include "eap_core_map.h" |
|
30 #include "eap_tlv_message_data.h" |
|
31 |
|
32 |
|
33 /// This class is base class for data stored to memory store. |
|
34 /** |
|
35 * This class allows EAP objects store data to memory |
|
36 * between authentication sessions. |
|
37 */ |
|
38 class eap_am_memory_store_c |
|
39 : public abs_eap_am_memory_store_data_c |
|
40 , public abs_eap_base_timer_c |
|
41 { |
|
42 private: |
|
43 |
|
44 /// This is pointer to the tools class. |
|
45 abs_eap_am_tools_c * const m_am_tools; |
|
46 |
|
47 eap_core_map_c< |
|
48 eap_am_memory_store_tlv_data_c, |
|
49 abs_eap_am_memory_store_data_c, |
|
50 eap_variable_data_c> m_store_new; |
|
51 |
|
52 // This is counter to get unique timer IDs for each data stored. |
|
53 u32_t m_timer_id_counter; |
|
54 |
|
55 /// This indicates whether this object was generated successfully. |
|
56 bool m_is_valid; |
|
57 |
|
58 // This is documented in abs_eap_stack_interface_c::set_is_valid(). |
|
59 EAP_FUNC_IMPORT void set_is_valid(); |
|
60 |
|
61 public: |
|
62 |
|
63 EAP_FUNC_IMPORT virtual ~eap_am_memory_store_c(); |
|
64 |
|
65 EAP_FUNC_IMPORT eap_am_memory_store_c( |
|
66 abs_eap_am_tools_c * const tools); |
|
67 |
|
68 EAP_FUNC_IMPORT eap_status_e shutdown(); |
|
69 |
|
70 // This is documented in abs_eap_stack_interface_c::get_is_valid(). |
|
71 EAP_FUNC_IMPORT bool get_is_valid(); |
|
72 |
|
73 /// Memory store is visible only during the eap_am_tools_c object is alive. |
|
74 /// This function add flat data to memory store. |
|
75 /// You must format your data to eap_tlv_message_data_c object. |
|
76 /// Data is identified by key parameter. |
|
77 /// You can set timeout to data. Data will be automatically removed after timeout. |
|
78 /// Timeout value zero means no timeout is set. |
|
79 /// Serious WARNING: do use really good key values. |
|
80 /// Memory store is globally used by all EAP Core objects. |
|
81 /// Key must be good that other users do not use others data. |
|
82 /// Add the real data type as a string to the key and other identifiers |
|
83 /// that separate data between the other users that store same data type |
|
84 /// to the memory store. |
|
85 EAP_FUNC_IMPORT virtual eap_status_e add_data( |
|
86 const eap_variable_data_c * const key, |
|
87 const eap_tlv_message_data_c * const data, |
|
88 const u32_t timeout); |
|
89 |
|
90 /// Memory store is visible only during the eap_am_tools_c object is alive. |
|
91 /// This function gets data from memory store. |
|
92 /// Data is returned in eap_tlv_message_data_c object. |
|
93 /// Data is identified by key parameter. |
|
94 /// Serious WARNING: do use really good key values. |
|
95 /// Memory store is globally used by all EAP Core objects. |
|
96 /// Key must be good that other users do not use others data. |
|
97 /// Add the real data type as a string to the key and other identifiers |
|
98 /// that separate data between the other users that store same data type |
|
99 /// to the memory store. |
|
100 EAP_FUNC_IMPORT virtual eap_status_e get_data( |
|
101 const eap_variable_data_c * const key, |
|
102 eap_tlv_message_data_c * const data); |
|
103 |
|
104 /// Memory store is visible only during the eap_am_tools_c object is alive. |
|
105 /// This function removes data from memory store. |
|
106 /// Data is identified by key parameter. |
|
107 /// Serious WARNING: do use really good key values. |
|
108 /// Memory store is globally used by all EAP Core objects. |
|
109 /// Key must be good that other users do not use others data. |
|
110 /// Add the real data type as a string to the key and other identifiers |
|
111 /// that separate data between the other users that store same data type |
|
112 /// to the memory store. |
|
113 EAP_FUNC_IMPORT eap_status_e remove_data( |
|
114 const eap_variable_data_c * const key); |
|
115 |
|
116 |
|
117 /** |
|
118 * Function timer_expired() is called after the timer is elapsed. |
|
119 * @param id and data are set by caller of abs_eap_am_tools::set_timer() function. |
|
120 * @param id could be used to separate different timer events. |
|
121 * @param data could be pointer to any data that is needed in timer processing. |
|
122 */ |
|
123 EAP_FUNC_IMPORT eap_status_e timer_expired( |
|
124 const u32_t id, void *data); |
|
125 |
|
126 /** |
|
127 * This function is called when timer event is deleted. |
|
128 * Initialiser of the data must delete the data. |
|
129 * Only the initializer knows the real type of data. |
|
130 * @param id could be used to separate different timer events. |
|
131 * @param data could be pointer to any data that is needed in timer processing. |
|
132 */ |
|
133 EAP_FUNC_IMPORT eap_status_e timer_delete_data( |
|
134 const u32_t id, void *data); |
|
135 }; |
|
136 |
|
137 //#endif //#if !defined(NO_EAP_AM_MEMORY_STORE) |
|
138 |
|
139 #endif //#if !defined( _EAP_AM_MEMORY_STORE_H_ ) |
|
140 |
|
141 |
|
142 |
|
143 // End. |