|
1 /* |
|
2 * Copyright (c) 2005-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: Class for parsing WPA IEs. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_FRAME_WPA_IE_H |
|
20 #define CORE_FRAME_WPA_IE_H |
|
21 |
|
22 #include "abs_core_wpx_adaptation.h" |
|
23 #include "core_frame_dot11_ie.h" |
|
24 #include "core_types.h" |
|
25 |
|
26 /** |
|
27 * Class for parsing and generating WPA IEs. |
|
28 * |
|
29 * @since S60 v3.1 |
|
30 */ |
|
31 NONSHARABLE_CLASS( core_frame_wpa_ie_c ) : public core_frame_dot11_ie_c |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Factory for creating a parser instance. |
|
38 * |
|
39 * @since S60 v3.1 |
|
40 * @param wpx_adaptation WPX adaptation. |
|
41 * @param ie Pointer to the IE data. |
|
42 * @return A pointer to the created IE instance. |
|
43 */ |
|
44 static core_frame_wpa_ie_c* instance( |
|
45 abs_core_wpx_adaptation_c& wpx_adaptation, |
|
46 const core_frame_dot11_ie_c& ie ); |
|
47 |
|
48 /** |
|
49 * Factory for creating an IE with the given parameters. |
|
50 * |
|
51 * @since S60 v3.1 |
|
52 * @param wpx_adaptation WPX adaptation. |
|
53 * @param group_cipher Used group cipher. |
|
54 * @param pairwise_cipher Used pairwise cipher. |
|
55 * @param key_management Used key management suite. |
|
56 * @param pmkid_length Length of optional PMKID data. |
|
57 * @param pmkid_data Pointer to the buffer of optional PMKID data. |
|
58 * @return A pointer to the created IE instance. |
|
59 */ |
|
60 static core_frame_wpa_ie_c* instance( |
|
61 abs_core_wpx_adaptation_c& wpx_adaptation, |
|
62 core_cipher_suite_e group_cipher, |
|
63 core_cipher_suite_e pairwise_cipher, |
|
64 core_key_management_e key_management ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~core_frame_wpa_ie_c(); |
|
70 |
|
71 /** |
|
72 * Return the supported group cipher. |
|
73 * @return The supported group cipher. |
|
74 */ |
|
75 u8_t group_cipher_suite() const; |
|
76 |
|
77 /** |
|
78 * Return the supported pairwise ciphers. |
|
79 * @param The supported pairwise ciphers. |
|
80 */ |
|
81 u8_t pairwise_cipher_suites() const; |
|
82 |
|
83 /** |
|
84 * Return the supported key management suites. |
|
85 * @param The supported key management suites. |
|
86 */ |
|
87 u8_t key_management_suites() const; |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * Convert OUI to core_cipher_suite_e type. |
|
93 * @param oui OUI to convert. |
|
94 * @return OUI convert to core_cipher_suite_e type. |
|
95 */ |
|
96 core_cipher_suite_e cipher_oui_to_enum( |
|
97 const u8_t* oui ) const; |
|
98 |
|
99 /** |
|
100 * Convert OUI to core_key_management_e type. |
|
101 * @param oui OUI to convert. |
|
102 * @return OUI converted to core_key_management_e type. |
|
103 */ |
|
104 core_key_management_e key_management_oui_to_enum( |
|
105 const u8_t* oui ) const; |
|
106 |
|
107 /** |
|
108 * Return the "raw" value for the given group cipher. |
|
109 * @param cipher The cipher to return the value to. |
|
110 * @return The "raw" value for the given group cipher. |
|
111 */ |
|
112 u8_t get_raw_group_cipher( |
|
113 core_cipher_suite_e cipher ) const; |
|
114 |
|
115 /** |
|
116 * Return the "raw" value for the given pairwise cipher. |
|
117 * @param cipher The cipher to return the value to. |
|
118 * @return The "raw" value for the given pairwise cipher. |
|
119 */ |
|
120 u8_t get_raw_pairwise_cipher( |
|
121 core_cipher_suite_e cipher ) const; |
|
122 |
|
123 /** |
|
124 * Return the "raw" value for the given key management suite. |
|
125 * @param key_management The key management suite to return the value to. |
|
126 * @return The "raw" value for the given key management suite. |
|
127 */ |
|
128 u8_t get_raw_key_management( |
|
129 core_key_management_e key_management ) const; |
|
130 |
|
131 /** |
|
132 * Generate a 802.11i (RSN) IE. |
|
133 * |
|
134 * @param group_cipher Used group cipher. |
|
135 * @param pairwise_cipher Used pairwise cipher. |
|
136 * @param key_management Used key management suite. |
|
137 * @param pmkid_length Length of optional PMKID data. |
|
138 * @param pmkid_data Pointer to the buffer of optional PMKID data. |
|
139 */ |
|
140 void generate( |
|
141 core_cipher_suite_e group_cipher, |
|
142 core_cipher_suite_e pairwise_cipher, |
|
143 core_key_management_e key_management ); |
|
144 |
|
145 /** |
|
146 * Constructor |
|
147 * |
|
148 * @param wpx_adaptation WPX adaptation. |
|
149 * @param data_length Length of the IE data. |
|
150 * @param data Pointer to the IE data. |
|
151 */ |
|
152 core_frame_wpa_ie_c( |
|
153 abs_core_wpx_adaptation_c& wpx_adaptation, |
|
154 u16_t data_length, |
|
155 const u8_t* data, |
|
156 u16_t max_data_length ); |
|
157 |
|
158 private: // data |
|
159 |
|
160 /** WPX adaptation instance. */ |
|
161 abs_core_wpx_adaptation_c& wpx_adaptation_m; |
|
162 |
|
163 }; |
|
164 |
|
165 #endif // CORE_FRAME_WPA_IE_H |