|
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: Declaration of the WlanElementLocator class. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 8 % |
|
20 */ |
|
21 |
|
22 #ifndef WLAN_ELEMENT_LOCATOR_H |
|
23 #define WLAN_ELEMENT_LOCATOR_H |
|
24 |
|
25 |
|
26 /** |
|
27 * Provides methods to locate 802.11 information elements. |
|
28 * |
|
29 * @lib wlanumac.lib |
|
30 * @since S60 v3.1 |
|
31 */ |
|
32 class WlanElementLocator |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 enum TWlanLocateStatus |
|
38 { |
|
39 EWlanLocateOk, |
|
40 EWlanLocateElementNotFound |
|
41 }; |
|
42 |
|
43 /** |
|
44 * Constructor. |
|
45 * |
|
46 * @since S60 3.1 |
|
47 * @param aStart (IN) beginning of the area from where to locate |
|
48 * elements |
|
49 * @param aLength (IN) length of the area to search |
|
50 */ |
|
51 WlanElementLocator( const TUint8* aStart, TUint16 aLength ); |
|
52 |
|
53 /** |
|
54 * Return requested information element data. |
|
55 * @param aIeId Id of the requested IE data. See 802dot11.h |
|
56 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
57 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
58 * NULL if IE not found. |
|
59 * @param aValidateLength (IN) If ETrue, the indicated length of the IE |
|
60 * data part is checked for validity against the relevant |
|
61 * specification. |
|
62 * If EFalse, the validity check is not done. |
|
63 * @return Locate status. |
|
64 */ |
|
65 TWlanLocateStatus InformationElement( |
|
66 TUint8 aIeId, |
|
67 TUint8& aIeLength, |
|
68 const TUint8** aIeData, |
|
69 TBool aValidateLength = ETrue ); |
|
70 |
|
71 /** |
|
72 * Return requested information element data. |
|
73 * |
|
74 * @since S60 3.2 |
|
75 * @param aIeId (IN) Id of the requested IE data. See 802dot11.h |
|
76 * @param aIeOui (IN) OUI of the requested IE data. See 802dot11.h |
|
77 * @param aIeOuiType (IN) OUI Type of the requested IE data. |
|
78 * See 802dot11.h |
|
79 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
80 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
81 * NULL if IE not found. |
|
82 * @return Locate status. |
|
83 */ |
|
84 TWlanLocateStatus InformationElement( |
|
85 TUint8 aIeId, |
|
86 const TIeOui& aIeOui, |
|
87 TUint8 aIeOuiType, |
|
88 TUint8& aIeLength, |
|
89 const TUint8** aIeData ); |
|
90 |
|
91 /** |
|
92 * Return requested information element data. |
|
93 * @param aIeId (IN) Id of the requested IE data. See 802dot11.h |
|
94 * @param aIeOui (IN) OUI of the requested IE data. See 802dot11.h |
|
95 * @param aIeOuiType (IN) OUI Type of the requested IE data. |
|
96 * See 802dot11.h |
|
97 * @param aIeOuiSubtype (IN) OUI Subtype of the requested IE data. |
|
98 * See 802dot11.h |
|
99 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
100 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
101 * NULL if IE not found. |
|
102 * @return Locate status. |
|
103 */ |
|
104 TWlanLocateStatus InformationElement( |
|
105 TUint8 aIeId, |
|
106 const TIeOui& aIeOui, |
|
107 TUint8 aIeOuiType, |
|
108 TUint8 aIeOuiSubtype, |
|
109 TUint8& aIeLength, |
|
110 const TUint8** aIeData ); |
|
111 |
|
112 private: |
|
113 |
|
114 /** |
|
115 * Return the first information element data. |
|
116 * @param aIeId (OUT) Id of the IE. See 802dot11.h. |
|
117 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
118 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
119 * NULL if IE not found. |
|
120 * @return Locate status. |
|
121 */ |
|
122 TWlanLocateStatus FirstIE( |
|
123 TUint8& aIeId, |
|
124 TUint8& aIeLength, |
|
125 const TUint8** aIeData ); |
|
126 |
|
127 /** |
|
128 * Return next information element data. |
|
129 * @param aIeId (OUT) Id of the IE. See 802dot11.h. |
|
130 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
131 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
132 * NULL if IE not found. |
|
133 * @return Locate status. |
|
134 */ |
|
135 TWlanLocateStatus NextIE( |
|
136 TUint8& aIeId, |
|
137 TUint8& aIeLength, |
|
138 const TUint8** aIeData ); |
|
139 |
|
140 /** |
|
141 * Return current information element data. |
|
142 * @param aIeId (OUT) Id of the IE. See 802dot11.h. |
|
143 * @param aIeLength (OUT) Length of the IE. Zero if IE not found. |
|
144 * @param aIeData (OUT) Pointer to the beginning of the IE data. |
|
145 * NULL if IE not found. |
|
146 * @return Locate status. |
|
147 */ |
|
148 TWlanLocateStatus CurrentIE( |
|
149 TUint8& aIeId, |
|
150 TUint8& aIeLength, |
|
151 const TUint8** aIeData ) const; |
|
152 |
|
153 /** |
|
154 * Validates the indicated length of the IE data part (aIeLength) against |
|
155 * the relevant specification. |
|
156 * @param aIeId (IN) Id of the IE. See 802dot11.h. |
|
157 * @param aIeLength (IN) Length of the IE. |
|
158 * @param aIeData (IN) Pointer to the beginning of the IE data. NULL |
|
159 * if not relevant for the validity check. |
|
160 * @param aIeOuiType (IN) OUI Type of the IE (if relevant) |
|
161 * @param aIeOuiSubtype (IN) OUI Subtype of the IE (if relevant) |
|
162 * @return |
|
163 */ |
|
164 WlanElementLocator::TWlanLocateStatus ValidIE( |
|
165 TUint8 aIeId, |
|
166 TUint8 aIeLength, |
|
167 const TUint8* aIeData = 0, |
|
168 TUint8 aIeOuiType = KWmmElemOuiType, |
|
169 TUint8 aIeOuiSubtype = KWmmInfoElemOuiSubType ) const; |
|
170 |
|
171 // Prohibit copy constructor. |
|
172 WlanElementLocator( const WlanElementLocator& ); |
|
173 // Prohibit assigment operator. |
|
174 WlanElementLocator& operator= |
|
175 ( const WlanElementLocator& ); |
|
176 |
|
177 private: // data |
|
178 |
|
179 /** start of the search area */ |
|
180 const TUint8* iStart; |
|
181 /** length of the search area */ |
|
182 TUint16 iLength; |
|
183 /** Iterator for going through elements */ |
|
184 const TUint8* iIterator; |
|
185 }; |
|
186 |
|
187 #endif // WLAN_ELEMENT_LOCATOR_H |