|
1 /* |
|
2 * Copyright (c) 2005-2009 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 parsing 802.11 IEs. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_FRAME_DOT11_IE_H |
|
20 #define CORE_FRAME_DOT11_IE_H |
|
21 |
|
22 #include "core_types.h" |
|
23 |
|
24 const u8_t CORE_FRAME_DOT11_IE_HEADER_LENGTH = 2; |
|
25 |
|
26 /** |
|
27 * Class parsing 802.11 IEs. |
|
28 * |
|
29 * This class acts as a base class for the various IE parsers. |
|
30 * |
|
31 * @since S60 v3.1 |
|
32 */ |
|
33 NONSHARABLE_CLASS( core_frame_dot11_ie_c ) |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 enum core_frame_dot11_ie_element_id_e |
|
39 { |
|
40 core_frame_dot11_ie_element_id_ssid = 0, |
|
41 core_frame_dot11_ie_element_id_supported_rates = 1, |
|
42 core_frame_dot11_ie_element_id_fh_parameter_set = 2, |
|
43 core_frame_dot11_ie_element_id_ds_parameter_set = 3, |
|
44 core_frame_dot11_ie_element_id_cf_paremeter_set = 4, |
|
45 core_frame_dot11_ie_element_id_tim = 5, |
|
46 core_frame_dot11_ie_element_id_ibss_parameter_set = 6, |
|
47 core_frame_dot11_ie_element_id_country = 7, |
|
48 core_frame_dot11_ie_element_id_hopping_pattern = 8, |
|
49 core_frame_dot11_ie_element_id_hopping_pattern_table = 9, |
|
50 core_frame_dot11_ie_element_id_request = 10, |
|
51 core_frame_dot11_ie_element_id_qbss_load = 11, |
|
52 core_frame_dot11_ie_element_id_challenge_text = 16, |
|
53 // Reserved for challenge text extension 17 - 31 |
|
54 core_frame_dot11_ie_element_id_power_constraint = 32, |
|
55 core_frame_dot11_ie_element_id_power_capability = 33, |
|
56 core_frame_dot11_ie_element_id_measurement_req = 38, |
|
57 core_frame_dot11_ie_element_id_measurement_resp = 39, |
|
58 core_frame_dot11_ie_element_id_erp_information = 42, |
|
59 core_frame_dot11_ie_element_id_rsn = 48, |
|
60 core_frame_dot11_ie_element_id_extended_rates = 50, |
|
61 core_frame_dot11_ie_element_id_ap_channel_report = 51, |
|
62 core_frame_dot11_ie_element_id_neighbor_report = 52, |
|
63 core_frame_dot11_ie_element_id_admission_capacity = 67, |
|
64 core_frame_dot11_ie_element_id_wapi = 68, |
|
65 core_frame_dot11_ie_element_id_rrm_capabilities = 70, |
|
66 core_frame_dot11_ie_element_id_wpa = 221, |
|
67 core_frame_dot11_ie_element_id_wmm_parameter = 221, |
|
68 core_frame_dot11_ie_element_id_wmm_tspec = 221 |
|
69 }; |
|
70 |
|
71 /** |
|
72 * Factory for creating a parser instance. |
|
73 * |
|
74 * @since S60 v3.1 |
|
75 * @param data_length Length of the IE data. |
|
76 * @param data Pointer to the IE data. |
|
77 * @param is_copied Whether the object should take a copy of the frame data. Default value is false_t. |
|
78 * @return Pointer to the created parser instance. |
|
79 */ |
|
80 static core_frame_dot11_ie_c* instance( |
|
81 u16_t data_length, |
|
82 const u8_t* data, |
|
83 bool_t is_copied = false_t ); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 virtual ~core_frame_dot11_ie_c(); |
|
89 |
|
90 /** |
|
91 * Return the element ID field of the IE. |
|
92 * |
|
93 * @since S60 v3.1 |
|
94 * @return The element ID field of the IE. |
|
95 */ |
|
96 u8_t element_id() const; |
|
97 |
|
98 /** |
|
99 * Return the length field of the IE. |
|
100 * |
|
101 * @since S60 v3.1 |
|
102 * @return The length field of the IE. |
|
103 */ |
|
104 u8_t length() const; |
|
105 |
|
106 /** |
|
107 * Return the data of the IE, including the IE headers. |
|
108 * |
|
109 * @since S60 v3.1 |
|
110 * @return The total length of the IE. |
|
111 */ |
|
112 u16_t data_length() const; |
|
113 |
|
114 /** |
|
115 * Return a pointer to the IE data. |
|
116 * |
|
117 * @since S60 v3.1 |
|
118 * @return A pointer to the IE data. |
|
119 */ |
|
120 const u8_t* data() const; |
|
121 |
|
122 protected: |
|
123 |
|
124 /** |
|
125 * Generate a IE header. |
|
126 * |
|
127 * @param element_id The element ID field of the header. |
|
128 */ |
|
129 void generate( |
|
130 u8_t element_id ); |
|
131 |
|
132 /** |
|
133 * Set the total length of the IE to the given value. |
|
134 * |
|
135 * @param length The total length of the IE. |
|
136 */ |
|
137 void set_length( |
|
138 u8_t length ); |
|
139 |
|
140 /** |
|
141 * Constructor |
|
142 * |
|
143 * @param data_length Length of the IE data. |
|
144 * @param data Pointer to the IE data. |
|
145 * @param max_data_length |
|
146 */ |
|
147 core_frame_dot11_ie_c( |
|
148 u16_t data_length, |
|
149 const u8_t* data, |
|
150 u16_t max_data_length ); |
|
151 |
|
152 protected: |
|
153 |
|
154 /** The length of the IE data. */ |
|
155 u16_t data_length_m; |
|
156 |
|
157 /** Pointer to the IE data. */ |
|
158 u8_t* data_m; |
|
159 |
|
160 /** The maximum IE length when generating an IE. */ |
|
161 u16_t max_data_length_m; |
|
162 |
|
163 }; |
|
164 |
|
165 #endif // CORE_FRAME_DOT11_IE_H |