|
1 /* |
|
2 * Copyright (c) 2002-2005 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 "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 to dig information from scan results. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HSSSCANINFO_H |
|
21 #define HSSSCANINFO_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include "hssscanlistiterator.h" |
|
26 |
|
27 // CONSTANTS |
|
28 const TUint8 BSSID_LENGTH = 6; |
|
29 const TUint16 SCAN_CAPABILITY_BIT_MASK_ESS = 0x0001; |
|
30 const TUint16 SCAN_CAPABILITY_BIT_MASK_PRIVACY = 0x0010; |
|
31 const TUint8 SCAN_IE_OUI_LENGTH = 3; |
|
32 const TUint8 TIMESTAMP_LENGTH = 8; |
|
33 |
|
34 // LOCAL DATATYPES |
|
35 |
|
36 typedef enum _HssScanError |
|
37 { |
|
38 HssScanError_Ok, |
|
39 HssScanError_IeNotFound |
|
40 |
|
41 } HssScanError; |
|
42 |
|
43 typedef enum _HssSecurityMode |
|
44 { |
|
45 HssSecurityModeOpen, |
|
46 HssSecurityModeWep, |
|
47 HssSecurityMode802_1x, |
|
48 HssSecurityModeWpaEap, |
|
49 HssSecurityModeWpaPsk, |
|
50 HssSecurityModeWpa2Eap, |
|
51 HssSecurityModeWpa2Psk |
|
52 } HssSecurityMode; |
|
53 |
|
54 typedef enum _HssOperatingMode |
|
55 { |
|
56 HssOperatingModeInfra, |
|
57 HssOperatingModeAdhoc |
|
58 } HssOperatingMode; |
|
59 |
|
60 typedef TUint8 HssIeOui[SCAN_IE_OUI_LENGTH]; |
|
61 |
|
62 // LOCAL CONSTANTS |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 |
|
66 // CLASS DECLARATION |
|
67 |
|
68 /** |
|
69 * Wrapper class to parse data fields from scan info. |
|
70 */ |
|
71 class HssScanInfo : public HssScanListIterator |
|
72 { |
|
73 public: // Methods |
|
74 |
|
75 // Constructors and destructor |
|
76 |
|
77 /** |
|
78 * C++ default constructor. |
|
79 */ |
|
80 HssScanInfo( const HssScanList& scan_list); |
|
81 |
|
82 // New methods |
|
83 |
|
84 /** |
|
85 * Return the signal noise ratio of the received (info) packet. |
|
86 * @return Signal noise ratio (SNR). |
|
87 */ |
|
88 inline TUint8 SignalNoiseRatio() const; |
|
89 |
|
90 /** |
|
91 * Return RX level of the received (info) packet. |
|
92 * @return RX level. |
|
93 */ |
|
94 inline TUint8 RXLevel() const; |
|
95 |
|
96 /** |
|
97 * Return BSSID of the scan info. |
|
98 * @param bssid (OUT) ID of the access point or IBSS network. |
|
99 */ |
|
100 inline void BSSID( TUint8 bssid[BSSID_LENGTH] ) const; |
|
101 |
|
102 |
|
103 /** |
|
104 * Get beacon interval of the network. |
|
105 * @return the beacon interval. |
|
106 */ |
|
107 inline TUint16 BeaconInterval() const; |
|
108 |
|
109 /** |
|
110 * Get capability of the network (see IEEE 802.11 section 7.3.1.4. |
|
111 * @return The capability information. |
|
112 */ |
|
113 inline TUint16 Capability() const; |
|
114 |
|
115 /** |
|
116 * Return whether the privacy bit is enabled in AP capabilities. |
|
117 * @return Whether the privacy is enabled. ETrue when enabled, EFalse when disabled. |
|
118 */ |
|
119 inline TBool Privacy() const; |
|
120 |
|
121 /** |
|
122 * Return the operating mode of the AP. |
|
123 * @return The operating mode of the AP. |
|
124 */ |
|
125 inline HssOperatingMode OperatingMode() const; |
|
126 |
|
127 /** |
|
128 * Return the security mode of the AP. |
|
129 * @return The security mode of the AP. |
|
130 */ |
|
131 HssSecurityMode SecurityMode(); |
|
132 |
|
133 /** |
|
134 * Return the timestamp field of the frame. |
|
135 */ |
|
136 inline void Timestamp( TUint8 timestamp[TIMESTAMP_LENGTH] ) const; |
|
137 |
|
138 /** |
|
139 * Return requested information element. |
|
140 * @param ie Id of the requested IE data. See 802dot11.h |
|
141 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
142 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
143 * @return General error message. |
|
144 */ |
|
145 HssScanError InformationElement( TUint8 ie, |
|
146 TUint8& length, |
|
147 const TUint8** data ); |
|
148 /** |
|
149 * Return WPA information element. |
|
150 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
151 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
152 * @return General error message. |
|
153 */ |
|
154 HssScanError WpaIE( TUint8& length, |
|
155 const TUint8** data ); |
|
156 |
|
157 /** |
|
158 * Return the first information element. |
|
159 * @param ie (OUT) Id of the IE. See 802dot11.h. |
|
160 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
161 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
162 * @return General error message. |
|
163 */ |
|
164 HssScanError FirstIE( TUint8& ie, |
|
165 TUint8& length, |
|
166 const TUint8** data ); |
|
167 /** |
|
168 * Return next information element. |
|
169 * @param ie (OUT) Id of the IE. See 802dot11.h. |
|
170 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
171 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
172 * @return General error message. |
|
173 */ |
|
174 HssScanError NextIE( TUint8& ie, |
|
175 TUint8& length, |
|
176 const TUint8** data ); |
|
177 |
|
178 /** |
|
179 * Return requested information element data. |
|
180 * @param ie_id (IN) Id of the requested IE data. See 802dot11.h |
|
181 * @param ie_oui (IN) OUI of the requested IE data. See 802dot11.h |
|
182 * @param ie_oui_type (IN) OUI Type of the requested IE data. See 802dot11.h |
|
183 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
184 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
185 * @return General error message. |
|
186 */ |
|
187 HssScanError InformationElement( TUint8 ie_id, |
|
188 const HssIeOui& ie_oui, |
|
189 TUint8 ie_oui_type, |
|
190 TUint8& ie_length, |
|
191 const TUint8** ie_data ); |
|
192 |
|
193 /** |
|
194 * Return requested information element data. |
|
195 * @param ie_id (IN) Id of the requested IE data. See 802dot11.h |
|
196 * @param ie_oui (IN) OUI of the requested IE data. See 802dot11.h |
|
197 * @param ie_oui_type (IN) OUI Type of the requested IE data. See 802dot11.h |
|
198 * @param ie_oui_subtype (IN) OUI Subtype of the requested IE data. See 802dot11.h |
|
199 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
200 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
201 * @return General error message. |
|
202 */ |
|
203 HssScanError InformationElement( TUint8 ie_id, |
|
204 const HssIeOui& ie_oui, |
|
205 TUint8 ie_oui_type, |
|
206 TUint8 ie_oui_subtype, |
|
207 TUint8& ie_length, |
|
208 const TUint8** ie_data ); |
|
209 |
|
210 private: //Methods |
|
211 |
|
212 // Prohibit copy constructor if not deriving from CBase. |
|
213 HssScanInfo( const HssScanInfo& ); |
|
214 // Prohibit assigment operator if not deriving from CBase. |
|
215 HssScanInfo& operator= ( const HssScanInfo& ); |
|
216 |
|
217 /** |
|
218 * Return current information element. |
|
219 * @param ie (OUT) Id of the IE. See 802dot11.h. |
|
220 * @param length (OUT) Length of the IE. Zero if IE not found. |
|
221 * @param data (OUT) Pointer to the beginning of the IE data. NULL if IE not found. |
|
222 * @return General error message. |
|
223 */ |
|
224 HssScanError CurrentIE( TUint8& ie, |
|
225 TUint8& length, |
|
226 const TUint8** data ) const; |
|
227 |
|
228 private: // Data |
|
229 /** Iterator for going through IEs of scan info. */ |
|
230 const TUint8* ie_iter_m; |
|
231 }; |
|
232 |
|
233 #include "hssscaninfo.inl" |
|
234 |
|
235 #endif // HssSCANINFO_H |
|
236 |
|
237 // End of File |