Commit | Line | Data |
---|---|---|
fa6173a0 LH |
1 | /***************************************************************************** |
2 | ||
3 | (c) Cambridge Silicon Radio Limited 2012 | |
4 | All rights reserved and confidential information of CSR | |
5 | ||
6 | Refer to LICENSE.txt included with this source for details | |
7 | on the license terms. | |
8 | ||
9 | *****************************************************************************/ | |
10 | ||
11 | /* Note: this is an auto-generated file. */ | |
4bcb20f8 | 12 | #include <linux/string.h> |
55a27055 | 13 | #include <linux/slab.h> |
fa6173a0 | 14 | #include "csr_msgconv.h" |
fa6173a0 LH |
15 | |
16 | #ifdef CSR_WIFI_NME_ENABLE | |
17 | #ifdef CSR_WIFI_AP_ENABLE | |
18 | ||
19 | #include "csr_wifi_nme_ap_prim.h" | |
20 | #include "csr_wifi_nme_ap_serialize.h" | |
21 | ||
22 | void CsrWifiNmeApPfree(void *ptr) | |
23 | { | |
55a27055 | 24 | kfree(ptr); |
fa6173a0 LH |
25 | } |
26 | ||
27 | ||
d4fda8db | 28 | size_t CsrWifiNmeApConfigSetReqSizeof(void *msg) |
fa6173a0 LH |
29 | { |
30 | CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) msg; | |
d4fda8db | 31 | size_t bufferSize = 2; |
fa6173a0 LH |
32 | |
33 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ | |
8c87f69a | 34 | bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */ |
5379b13d | 35 | bufferSize += 1; /* u8 primitive->apConfig.apStrictGtkRekey */ |
8c87f69a GKH |
36 | bufferSize += 2; /* u16 primitive->apConfig.apGmkTimeout */ |
37 | bufferSize += 2; /* u16 primitive->apConfig.apResponseTimeout */ | |
7e6f5794 | 38 | bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */ |
fa6173a0 | 39 | bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */ |
8c87f69a | 40 | bufferSize += 2; /* u16 primitive->apMacConfig.beaconInterval */ |
7e6f5794 | 41 | bufferSize += 1; /* u8 primitive->apMacConfig.dtimPeriod */ |
8c87f69a | 42 | bufferSize += 2; /* u16 primitive->apMacConfig.maxListenInterval */ |
7e6f5794 GKH |
43 | bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */ |
44 | bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */ | |
fa6173a0 | 45 | bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ |
5379b13d | 46 | bufferSize += 1; /* u8 primitive->apMacConfig.shortSlotTimeEnabled */ |
fa6173a0 | 47 | bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ |
5379b13d | 48 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmEnabled */ |
fa6173a0 | 49 | { |
8c87f69a | 50 | u16 i2; |
fa6173a0 LH |
51 | for (i2 = 0; i2 < 4; i2++) |
52 | { | |
7e6f5794 GKH |
53 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMin */ |
54 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */ | |
55 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */ | |
8c87f69a | 56 | bufferSize += 2; /* u16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ |
5379b13d | 57 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ |
fa6173a0 LH |
58 | } |
59 | } | |
60 | { | |
8c87f69a | 61 | u16 i2; |
fa6173a0 LH |
62 | for (i2 = 0; i2 < 4; i2++) |
63 | { | |
7e6f5794 GKH |
64 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ |
65 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ | |
66 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ | |
8c87f69a | 67 | bufferSize += 2; /* u16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ |
5379b13d | 68 | bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ |
fa6173a0 LH |
69 | } |
70 | } | |
71 | bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ | |
7e6f5794 | 72 | bufferSize += 1; /* u8 primitive->apMacConfig.macAddressListCount */ |
fa6173a0 | 73 | { |
8c87f69a | 74 | u16 i2; |
fa6173a0 LH |
75 | for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) |
76 | { | |
7e6f5794 | 77 | bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */ |
fa6173a0 LH |
78 | } |
79 | } | |
5379b13d GKH |
80 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.greenfieldSupported */ |
81 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.shortGi20MHz */ | |
7e6f5794 | 82 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rxStbc */ |
5379b13d | 83 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rifsModeAllowed */ |
7e6f5794 | 84 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.htProtection */ |
5379b13d | 85 | bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.dualCtsProtection */ |
fa6173a0 LH |
86 | return bufferSize; |
87 | } | |
88 | ||
89 | ||
d4fda8db | 90 | u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
91 | { |
92 | CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; | |
93 | *len = 0; | |
94 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a | 95 | CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGroupkeyTimeout); |
7e6f5794 | 96 | CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apStrictGtkRekey); |
8c87f69a GKH |
97 | CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGmkTimeout); |
98 | CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apResponseTimeout); | |
7e6f5794 GKH |
99 | CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apRetransLimit); |
100 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.phySupportedBitmap); | |
8c87f69a | 101 | CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.beaconInterval); |
7e6f5794 | 102 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.dtimPeriod); |
8c87f69a | 103 | CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.maxListenInterval); |
7e6f5794 | 104 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.supportedRatesCount); |
8c87f69a | 105 | CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((u16) (20))); |
7e6f5794 GKH |
106 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.preamble); |
107 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.shortSlotTimeEnabled); | |
108 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.ctsProtectionType); | |
109 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmEnabled); | |
fa6173a0 | 110 | { |
8c87f69a | 111 | u16 i2; |
fa6173a0 LH |
112 | for (i2 = 0; i2 < 4; i2++) |
113 | { | |
7e6f5794 GKH |
114 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMin); |
115 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMax); | |
116 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].aifs); | |
8c87f69a | 117 | CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApParams[i2].txopLimit); |
7e6f5794 | 118 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); |
fa6173a0 LH |
119 | } |
120 | } | |
121 | { | |
8c87f69a | 122 | u16 i2; |
fa6173a0 LH |
123 | for (i2 = 0; i2 < 4; i2++) |
124 | { | |
7e6f5794 GKH |
125 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); |
126 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); | |
127 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].aifs); | |
8c87f69a | 128 | CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); |
7e6f5794 | 129 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); |
fa6173a0 LH |
130 | } |
131 | } | |
7e6f5794 GKH |
132 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.accessType); |
133 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.macAddressListCount); | |
fa6173a0 | 134 | { |
8c87f69a | 135 | u16 i2; |
fa6173a0 LH |
136 | for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) |
137 | { | |
8c87f69a | 138 | CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((u16) (6))); |
fa6173a0 LH |
139 | } |
140 | } | |
7e6f5794 GKH |
141 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.greenfieldSupported); |
142 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.shortGi20MHz); | |
143 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rxStbc); | |
144 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rifsModeAllowed); | |
145 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.htProtection); | |
146 | CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.dualCtsProtection); | |
fa6173a0 LH |
147 | return(ptr); |
148 | } | |
149 | ||
150 | ||
d4fda8db | 151 | void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) |
fa6173a0 | 152 | { |
786eeeb3 | 153 | CsrWifiNmeApConfigSetReq *primitive = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); |
d4fda8db | 154 | size_t offset; |
fa6173a0 LH |
155 | offset = 0; |
156 | ||
157 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a | 158 | CsrUint16Des((u16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); |
7e6f5794 | 159 | CsrUint8Des((u8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); |
8c87f69a GKH |
160 | CsrUint16Des((u16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); |
161 | CsrUint16Des((u16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); | |
7e6f5794 GKH |
162 | CsrUint8Des((u8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); |
163 | CsrUint8Des((u8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); | |
8c87f69a | 164 | CsrUint16Des((u16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); |
7e6f5794 | 165 | CsrUint8Des((u8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); |
8c87f69a | 166 | CsrUint16Des((u16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); |
7e6f5794 | 167 | CsrUint8Des((u8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); |
8c87f69a | 168 | CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((u16) (20))); |
7e6f5794 GKH |
169 | CsrUint8Des((u8 *) &primitive->apMacConfig.preamble, buffer, &offset); |
170 | CsrUint8Des((u8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); | |
171 | CsrUint8Des((u8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); | |
172 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); | |
fa6173a0 | 173 | { |
8c87f69a | 174 | u16 i2; |
fa6173a0 LH |
175 | for (i2 = 0; i2 < 4; i2++) |
176 | { | |
7e6f5794 GKH |
177 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); |
178 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); | |
179 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); | |
8c87f69a | 180 | CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); |
7e6f5794 | 181 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); |
fa6173a0 LH |
182 | } |
183 | } | |
184 | { | |
8c87f69a | 185 | u16 i2; |
fa6173a0 LH |
186 | for (i2 = 0; i2 < 4; i2++) |
187 | { | |
7e6f5794 GKH |
188 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); |
189 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); | |
190 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); | |
8c87f69a | 191 | CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); |
7e6f5794 | 192 | CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); |
fa6173a0 LH |
193 | } |
194 | } | |
7e6f5794 GKH |
195 | CsrUint8Des((u8 *) &primitive->apMacConfig.accessType, buffer, &offset); |
196 | CsrUint8Des((u8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset); | |
fa6173a0 LH |
197 | primitive->apMacConfig.macAddressList = NULL; |
198 | if (primitive->apMacConfig.macAddressListCount) | |
199 | { | |
786eeeb3 | 200 | primitive->apMacConfig.macAddressList = kmalloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount, GFP_KERNEL); |
fa6173a0 LH |
201 | } |
202 | { | |
8c87f69a | 203 | u16 i2; |
fa6173a0 LH |
204 | for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) |
205 | { | |
8c87f69a | 206 | CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((u16) (6))); |
fa6173a0 LH |
207 | } |
208 | } | |
7e6f5794 GKH |
209 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); |
210 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset); | |
211 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset); | |
212 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset); | |
213 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset); | |
214 | CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset); | |
fa6173a0 LH |
215 | |
216 | return primitive; | |
217 | } | |
218 | ||
219 | ||
220 | void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer) | |
221 | { | |
222 | CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) voidPrimitivePointer; | |
55a27055 GKH |
223 | kfree(primitive->apMacConfig.macAddressList); |
224 | kfree(primitive); | |
fa6173a0 LH |
225 | } |
226 | ||
227 | ||
d4fda8db | 228 | size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg) |
fa6173a0 | 229 | { |
d4fda8db | 230 | size_t bufferSize = 2; |
fa6173a0 LH |
231 | |
232 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ | |
8c87f69a | 233 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 LH |
234 | bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */ |
235 | bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */ | |
7e6f5794 | 236 | bufferSize += 8; /* u8 primitive->pin[8] */ |
fa6173a0 LH |
237 | return bufferSize; |
238 | } | |
239 | ||
240 | ||
d4fda8db | 241 | u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
242 | { |
243 | CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; | |
244 | *len = 0; | |
245 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a GKH |
246 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
247 | CsrUint16Ser(ptr, len, (u16) primitive->selectedDevicePasswordId); | |
248 | CsrUint16Ser(ptr, len, (u16) primitive->selectedConfigMethod); | |
249 | CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((u16) (8))); | |
fa6173a0 LH |
250 | return(ptr); |
251 | } | |
252 | ||
253 | ||
d4fda8db | 254 | void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length) |
fa6173a0 | 255 | { |
786eeeb3 | 256 | CsrWifiNmeApWpsRegisterReq *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); |
d4fda8db | 257 | size_t offset; |
fa6173a0 LH |
258 | offset = 0; |
259 | ||
260 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a GKH |
261 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
262 | CsrUint16Des((u16 *) &primitive->selectedDevicePasswordId, buffer, &offset); | |
263 | CsrUint16Des((u16 *) &primitive->selectedConfigMethod, buffer, &offset); | |
264 | CsrMemCpyDes(primitive->pin, buffer, &offset, ((u16) (8))); | |
fa6173a0 LH |
265 | |
266 | return primitive; | |
267 | } | |
268 | ||
269 | ||
d4fda8db | 270 | size_t CsrWifiNmeApStartReqSizeof(void *msg) |
fa6173a0 LH |
271 | { |
272 | CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) msg; | |
d4fda8db | 273 | size_t bufferSize = 2; |
fa6173a0 LH |
274 | |
275 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ | |
8c87f69a | 276 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 | 277 | bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ |
5379b13d | 278 | bufferSize += 1; /* u8 primitive->cloakSsid */ |
7e6f5794 GKH |
279 | bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ |
280 | bufferSize += 1; /* u8 primitive->ssid.length */ | |
fa6173a0 | 281 | bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */ |
7e6f5794 | 282 | bufferSize += 1; /* u8 primitive->channel */ |
fa6173a0 LH |
283 | bufferSize += 1; /* CsrWifiSmeApAuthType primitive->apCredentials.authType */ |
284 | switch (primitive->apCredentials.authType) | |
285 | { | |
286 | case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: | |
7e6f5794 | 287 | bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */ |
fa6173a0 LH |
288 | break; |
289 | case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: | |
290 | bufferSize += 1; /* CsrWifiSmeWepCredentialType primitive->apCredentials.nmeAuthType.authwep.wepKeyType */ | |
291 | switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) | |
292 | { | |
293 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: | |
294 | bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType */ | |
7e6f5794 GKH |
295 | bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */ |
296 | bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */ | |
297 | bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */ | |
298 | bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */ | |
299 | bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */ | |
fa6173a0 LH |
300 | break; |
301 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: | |
302 | bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType */ | |
7e6f5794 GKH |
303 | bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */ |
304 | bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */ | |
305 | bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */ | |
306 | bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */ | |
307 | bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */ | |
fa6173a0 LH |
308 | break; |
309 | default: | |
310 | break; | |
311 | } | |
312 | break; | |
313 | case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: | |
314 | bufferSize += 1; /* CsrWifiSmeApAuthSupportMask primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport */ | |
315 | bufferSize += 2; /* CsrWifiSmeApRsnCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities */ | |
316 | bufferSize += 2; /* CsrWifiSmeApWapiCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities */ | |
317 | bufferSize += 1; /* CsrWifiNmeApPersCredentialType primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase */ | |
318 | switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) | |
319 | { | |
320 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: | |
8c87f69a | 321 | bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ |
7e6f5794 | 322 | bufferSize += 32; /* u8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ |
fa6173a0 LH |
323 | break; |
324 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: | |
8c87f69a | 325 | bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ |
4bcb20f8 | 326 | bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase ? strlen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ |
fa6173a0 LH |
327 | break; |
328 | default: | |
329 | break; | |
330 | } | |
331 | break; | |
332 | default: | |
333 | break; | |
334 | } | |
7e6f5794 | 335 | bufferSize += 1; /* u8 primitive->maxConnections */ |
fa6173a0 | 336 | bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->p2pGoParam.groupCapability */ |
7e6f5794 GKH |
337 | bufferSize += 3; /* u8 primitive->p2pGoParam.operatingChanList.country[3] */ |
338 | bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ | |
fa6173a0 | 339 | { |
8c87f69a | 340 | u16 i3; |
fa6173a0 LH |
341 | for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) |
342 | { | |
7e6f5794 GKH |
343 | bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ |
344 | bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */ | |
345 | bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ | |
fa6173a0 LH |
346 | } |
347 | } | |
5379b13d | 348 | bufferSize += 1; /* u8 primitive->p2pGoParam.opPsEnabled */ |
7e6f5794 | 349 | bufferSize += 1; /* u8 primitive->p2pGoParam.ctWindow */ |
fa6173a0 | 350 | bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */ |
5379b13d GKH |
351 | bufferSize += 1; /* u8 primitive->p2pGoParam.allowNoaWithNonP2pDevices */ |
352 | bufferSize += 1; /* u8 primitive->wpsEnabled */ | |
fa6173a0 LH |
353 | return bufferSize; |
354 | } | |
355 | ||
356 | ||
d4fda8db | 357 | u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
358 | { |
359 | CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; | |
360 | *len = 0; | |
361 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a | 362 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
7e6f5794 GKH |
363 | CsrUint8Ser(ptr, len, (u8) primitive->apType); |
364 | CsrUint8Ser(ptr, len, (u8) primitive->cloakSsid); | |
8c87f69a | 365 | CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); |
7e6f5794 GKH |
366 | CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); |
367 | CsrUint8Ser(ptr, len, (u8) primitive->ifIndex); | |
368 | CsrUint8Ser(ptr, len, (u8) primitive->channel); | |
369 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.authType); | |
fa6173a0 LH |
370 | switch (primitive->apCredentials.authType) |
371 | { | |
372 | case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: | |
7e6f5794 | 373 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty); |
fa6173a0 LH |
374 | break; |
375 | case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: | |
7e6f5794 | 376 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType); |
fa6173a0 LH |
377 | switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) |
378 | { | |
379 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: | |
7e6f5794 GKH |
380 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); |
381 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); | |
8c87f69a GKH |
382 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((u16) (13))); |
383 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((u16) (13))); | |
384 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((u16) (13))); | |
385 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((u16) (13))); | |
fa6173a0 LH |
386 | break; |
387 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: | |
7e6f5794 GKH |
388 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); |
389 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); | |
8c87f69a GKH |
390 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((u16) (5))); |
391 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((u16) (5))); | |
392 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((u16) (5))); | |
393 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((u16) (5))); | |
fa6173a0 LH |
394 | break; |
395 | default: | |
396 | break; | |
397 | } | |
398 | break; | |
399 | case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: | |
7e6f5794 | 400 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); |
8c87f69a GKH |
401 | CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); |
402 | CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); | |
7e6f5794 | 403 | CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); |
fa6173a0 LH |
404 | switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) |
405 | { | |
406 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: | |
8c87f69a GKH |
407 | CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode); |
408 | CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((u16) (32))); | |
fa6173a0 LH |
409 | break; |
410 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: | |
8c87f69a | 411 | CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode); |
fa6173a0 LH |
412 | CsrCharStringSer(ptr, len, primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); |
413 | break; | |
414 | default: | |
415 | break; | |
416 | } | |
417 | break; | |
418 | default: | |
419 | break; | |
420 | } | |
7e6f5794 GKH |
421 | CsrUint8Ser(ptr, len, (u8) primitive->maxConnections); |
422 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.groupCapability); | |
8c87f69a | 423 | CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((u16) (3))); |
7e6f5794 | 424 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); |
fa6173a0 | 425 | { |
8c87f69a | 426 | u16 i3; |
fa6173a0 LH |
427 | for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) |
428 | { | |
7e6f5794 GKH |
429 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); |
430 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); | |
fa6173a0 LH |
431 | if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) |
432 | { | |
8c87f69a | 433 | CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); |
fa6173a0 LH |
434 | } |
435 | } | |
436 | } | |
7e6f5794 GKH |
437 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.opPsEnabled); |
438 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.ctWindow); | |
439 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.noaConfigMethod); | |
440 | CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.allowNoaWithNonP2pDevices); | |
441 | CsrUint8Ser(ptr, len, (u8) primitive->wpsEnabled); | |
fa6173a0 LH |
442 | return(ptr); |
443 | } | |
444 | ||
445 | ||
d4fda8db | 446 | void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) |
fa6173a0 | 447 | { |
786eeeb3 | 448 | CsrWifiNmeApStartReq *primitive = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); |
d4fda8db | 449 | size_t offset; |
fa6173a0 LH |
450 | offset = 0; |
451 | ||
452 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a | 453 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
7e6f5794 GKH |
454 | CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); |
455 | CsrUint8Des((u8 *) &primitive->cloakSsid, buffer, &offset); | |
8c87f69a | 456 | CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); |
7e6f5794 GKH |
457 | CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); |
458 | CsrUint8Des((u8 *) &primitive->ifIndex, buffer, &offset); | |
459 | CsrUint8Des((u8 *) &primitive->channel, buffer, &offset); | |
460 | CsrUint8Des((u8 *) &primitive->apCredentials.authType, buffer, &offset); | |
fa6173a0 LH |
461 | switch (primitive->apCredentials.authType) |
462 | { | |
463 | case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: | |
7e6f5794 | 464 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset); |
fa6173a0 LH |
465 | break; |
466 | case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: | |
7e6f5794 | 467 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset); |
fa6173a0 LH |
468 | switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) |
469 | { | |
470 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: | |
7e6f5794 GKH |
471 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); |
472 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); | |
8c87f69a GKH |
473 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((u16) (13))); |
474 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((u16) (13))); | |
475 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((u16) (13))); | |
476 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((u16) (13))); | |
fa6173a0 LH |
477 | break; |
478 | case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: | |
7e6f5794 GKH |
479 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); |
480 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); | |
8c87f69a GKH |
481 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((u16) (5))); |
482 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((u16) (5))); | |
483 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((u16) (5))); | |
484 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((u16) (5))); | |
fa6173a0 LH |
485 | break; |
486 | default: | |
487 | break; | |
488 | } | |
489 | break; | |
490 | case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: | |
7e6f5794 | 491 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); |
8c87f69a GKH |
492 | CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); |
493 | CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); | |
7e6f5794 | 494 | CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); |
fa6173a0 LH |
495 | switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) |
496 | { | |
497 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: | |
8c87f69a GKH |
498 | CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset); |
499 | CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((u16) (32))); | |
fa6173a0 LH |
500 | break; |
501 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: | |
8c87f69a | 502 | CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset); |
fa6173a0 LH |
503 | CsrCharStringDes(&primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase, buffer, &offset); |
504 | break; | |
505 | default: | |
506 | break; | |
507 | } | |
508 | break; | |
509 | default: | |
510 | break; | |
511 | } | |
7e6f5794 GKH |
512 | CsrUint8Des((u8 *) &primitive->maxConnections, buffer, &offset); |
513 | CsrUint8Des((u8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); | |
8c87f69a | 514 | CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((u16) (3))); |
7e6f5794 | 515 | CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); |
fa6173a0 LH |
516 | primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; |
517 | if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) | |
518 | { | |
786eeeb3 | 519 | primitive->p2pGoParam.operatingChanList.channelEntryList = kmalloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount, GFP_KERNEL); |
fa6173a0 LH |
520 | } |
521 | { | |
8c87f69a | 522 | u16 i3; |
fa6173a0 LH |
523 | for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) |
524 | { | |
7e6f5794 GKH |
525 | CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); |
526 | CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); | |
fa6173a0 LH |
527 | if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) |
528 | { | |
786eeeb3 | 529 | primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = kmalloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, GFP_KERNEL); |
8c87f69a | 530 | CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); |
fa6173a0 LH |
531 | } |
532 | else | |
533 | { | |
534 | primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; | |
535 | } | |
536 | } | |
537 | } | |
7e6f5794 GKH |
538 | CsrUint8Des((u8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset); |
539 | CsrUint8Des((u8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset); | |
540 | CsrUint8Des((u8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset); | |
541 | CsrUint8Des((u8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset); | |
542 | CsrUint8Des((u8 *) &primitive->wpsEnabled, buffer, &offset); | |
fa6173a0 LH |
543 | |
544 | return primitive; | |
545 | } | |
546 | ||
547 | ||
548 | void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) | |
549 | { | |
550 | CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) voidPrimitivePointer; | |
551 | switch (primitive->apCredentials.authType) | |
552 | { | |
553 | case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: | |
554 | switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) | |
555 | { | |
556 | case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: | |
55a27055 | 557 | kfree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); |
fa6173a0 LH |
558 | break; |
559 | default: | |
560 | break; | |
561 | } | |
562 | break; | |
563 | default: | |
564 | break; | |
565 | } | |
566 | { | |
8c87f69a | 567 | u16 i3; |
fa6173a0 LH |
568 | for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) |
569 | { | |
55a27055 | 570 | kfree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); |
fa6173a0 LH |
571 | } |
572 | } | |
55a27055 GKH |
573 | kfree(primitive->p2pGoParam.operatingChanList.channelEntryList); |
574 | kfree(primitive); | |
fa6173a0 LH |
575 | } |
576 | ||
577 | ||
d4fda8db | 578 | size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) |
fa6173a0 | 579 | { |
d4fda8db | 580 | size_t bufferSize = 2; |
fa6173a0 LH |
581 | |
582 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */ | |
583 | { | |
8c87f69a | 584 | u16 i1; |
fa6173a0 LH |
585 | for (i1 = 0; i1 < 4; i1++) |
586 | { | |
7e6f5794 GKH |
587 | bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMin */ |
588 | bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */ | |
589 | bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */ | |
8c87f69a | 590 | bufferSize += 2; /* u16 primitive->wmmApParams[i1].txopLimit */ |
5379b13d | 591 | bufferSize += 1; /* u8 primitive->wmmApParams[i1].admissionControlMandatory */ |
fa6173a0 LH |
592 | } |
593 | } | |
594 | { | |
8c87f69a | 595 | u16 i1; |
fa6173a0 LH |
596 | for (i1 = 0; i1 < 4; i1++) |
597 | { | |
7e6f5794 GKH |
598 | bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMin */ |
599 | bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */ | |
600 | bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */ | |
8c87f69a | 601 | bufferSize += 2; /* u16 primitive->wmmApBcParams[i1].txopLimit */ |
5379b13d | 602 | bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].admissionControlMandatory */ |
fa6173a0 LH |
603 | } |
604 | } | |
605 | return bufferSize; | |
606 | } | |
607 | ||
608 | ||
d4fda8db | 609 | u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
610 | { |
611 | CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg; | |
612 | *len = 0; | |
613 | CsrUint16Ser(ptr, len, primitive->common.type); | |
614 | { | |
8c87f69a | 615 | u16 i1; |
fa6173a0 LH |
616 | for (i1 = 0; i1 < 4; i1++) |
617 | { | |
7e6f5794 GKH |
618 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMin); |
619 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMax); | |
620 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].aifs); | |
8c87f69a | 621 | CsrUint16Ser(ptr, len, (u16) primitive->wmmApParams[i1].txopLimit); |
7e6f5794 | 622 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].admissionControlMandatory); |
fa6173a0 LH |
623 | } |
624 | } | |
625 | { | |
8c87f69a | 626 | u16 i1; |
fa6173a0 LH |
627 | for (i1 = 0; i1 < 4; i1++) |
628 | { | |
7e6f5794 GKH |
629 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMin); |
630 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMax); | |
631 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].aifs); | |
8c87f69a | 632 | CsrUint16Ser(ptr, len, (u16) primitive->wmmApBcParams[i1].txopLimit); |
7e6f5794 | 633 | CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].admissionControlMandatory); |
fa6173a0 LH |
634 | } |
635 | } | |
636 | return(ptr); | |
637 | } | |
638 | ||
639 | ||
d4fda8db | 640 | void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length) |
fa6173a0 | 641 | { |
786eeeb3 | 642 | CsrWifiNmeApWmmParamUpdateReq *primitive = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); |
d4fda8db | 643 | size_t offset; |
fa6173a0 LH |
644 | offset = 0; |
645 | ||
646 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
647 | { | |
8c87f69a | 648 | u16 i1; |
fa6173a0 LH |
649 | for (i1 = 0; i1 < 4; i1++) |
650 | { | |
7e6f5794 GKH |
651 | CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); |
652 | CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); | |
653 | CsrUint8Des((u8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); | |
8c87f69a | 654 | CsrUint16Des((u16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); |
7e6f5794 | 655 | CsrUint8Des((u8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); |
fa6173a0 LH |
656 | } |
657 | } | |
658 | { | |
8c87f69a | 659 | u16 i1; |
fa6173a0 LH |
660 | for (i1 = 0; i1 < 4; i1++) |
661 | { | |
7e6f5794 GKH |
662 | CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); |
663 | CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); | |
664 | CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); | |
8c87f69a | 665 | CsrUint16Des((u16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); |
7e6f5794 | 666 | CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); |
fa6173a0 LH |
667 | } |
668 | } | |
669 | ||
670 | return primitive; | |
671 | } | |
672 | ||
673 | ||
d4fda8db | 674 | size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg) |
fa6173a0 | 675 | { |
d4fda8db | 676 | size_t bufferSize = 2; |
fa6173a0 LH |
677 | |
678 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ | |
8c87f69a | 679 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
7e6f5794 | 680 | bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */ |
5379b13d | 681 | bufferSize += 1; /* u8 primitive->keepBlocking */ |
fa6173a0 LH |
682 | return bufferSize; |
683 | } | |
684 | ||
685 | ||
d4fda8db | 686 | u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
687 | { |
688 | CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; | |
689 | *len = 0; | |
690 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a GKH |
691 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
692 | CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((u16) (6))); | |
7e6f5794 | 693 | CsrUint8Ser(ptr, len, (u8) primitive->keepBlocking); |
fa6173a0 LH |
694 | return(ptr); |
695 | } | |
696 | ||
697 | ||
d4fda8db | 698 | void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length) |
fa6173a0 | 699 | { |
786eeeb3 | 700 | CsrWifiNmeApStaRemoveReq *primitive = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); |
d4fda8db | 701 | size_t offset; |
fa6173a0 LH |
702 | offset = 0; |
703 | ||
704 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a GKH |
705 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
706 | CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((u16) (6))); | |
7e6f5794 | 707 | CsrUint8Des((u8 *) &primitive->keepBlocking, buffer, &offset); |
fa6173a0 LH |
708 | |
709 | return primitive; | |
710 | } | |
711 | ||
712 | ||
d4fda8db | 713 | size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) |
fa6173a0 | 714 | { |
d4fda8db | 715 | size_t bufferSize = 2; |
fa6173a0 LH |
716 | |
717 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ | |
8c87f69a | 718 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 LH |
719 | bufferSize += 2; /* CsrResult primitive->status */ |
720 | return bufferSize; | |
721 | } | |
722 | ||
723 | ||
d4fda8db | 724 | u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
725 | { |
726 | CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; | |
727 | *len = 0; | |
728 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a GKH |
729 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
730 | CsrUint16Ser(ptr, len, (u16) primitive->status); | |
fa6173a0 LH |
731 | return(ptr); |
732 | } | |
733 | ||
734 | ||
d4fda8db | 735 | void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length) |
fa6173a0 | 736 | { |
786eeeb3 | 737 | CsrWifiNmeApWpsRegisterCfm *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); |
d4fda8db | 738 | size_t offset; |
fa6173a0 LH |
739 | offset = 0; |
740 | ||
741 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a GKH |
742 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
743 | CsrUint16Des((u16 *) &primitive->status, buffer, &offset); | |
fa6173a0 LH |
744 | |
745 | return primitive; | |
746 | } | |
747 | ||
748 | ||
d4fda8db | 749 | size_t CsrWifiNmeApStartCfmSizeof(void *msg) |
fa6173a0 | 750 | { |
d4fda8db | 751 | size_t bufferSize = 2; |
fa6173a0 LH |
752 | |
753 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ | |
8c87f69a | 754 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 | 755 | bufferSize += 2; /* CsrResult primitive->status */ |
7e6f5794 GKH |
756 | bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ |
757 | bufferSize += 1; /* u8 primitive->ssid.length */ | |
fa6173a0 LH |
758 | return bufferSize; |
759 | } | |
760 | ||
761 | ||
d4fda8db | 762 | u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
763 | { |
764 | CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; | |
765 | *len = 0; | |
766 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a GKH |
767 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
768 | CsrUint16Ser(ptr, len, (u16) primitive->status); | |
769 | CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); | |
7e6f5794 | 770 | CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); |
fa6173a0 LH |
771 | return(ptr); |
772 | } | |
773 | ||
774 | ||
d4fda8db | 775 | void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length) |
fa6173a0 | 776 | { |
786eeeb3 | 777 | CsrWifiNmeApStartCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); |
d4fda8db | 778 | size_t offset; |
fa6173a0 LH |
779 | offset = 0; |
780 | ||
781 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a GKH |
782 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
783 | CsrUint16Des((u16 *) &primitive->status, buffer, &offset); | |
784 | CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); | |
7e6f5794 | 785 | CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); |
fa6173a0 LH |
786 | |
787 | return primitive; | |
788 | } | |
789 | ||
790 | ||
d4fda8db | 791 | size_t CsrWifiNmeApStopCfmSizeof(void *msg) |
fa6173a0 | 792 | { |
d4fda8db | 793 | size_t bufferSize = 2; |
fa6173a0 LH |
794 | |
795 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ | |
8c87f69a | 796 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 LH |
797 | bufferSize += 2; /* CsrResult primitive->status */ |
798 | return bufferSize; | |
799 | } | |
800 | ||
801 | ||
d4fda8db | 802 | u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
803 | { |
804 | CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; | |
805 | *len = 0; | |
806 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a GKH |
807 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
808 | CsrUint16Ser(ptr, len, (u16) primitive->status); | |
fa6173a0 LH |
809 | return(ptr); |
810 | } | |
811 | ||
812 | ||
d4fda8db | 813 | void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length) |
fa6173a0 | 814 | { |
786eeeb3 | 815 | CsrWifiNmeApStopCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); |
d4fda8db | 816 | size_t offset; |
fa6173a0 LH |
817 | offset = 0; |
818 | ||
819 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a GKH |
820 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
821 | CsrUint16Des((u16 *) &primitive->status, buffer, &offset); | |
fa6173a0 LH |
822 | |
823 | return primitive; | |
824 | } | |
825 | ||
826 | ||
d4fda8db | 827 | size_t CsrWifiNmeApStopIndSizeof(void *msg) |
fa6173a0 | 828 | { |
d4fda8db | 829 | size_t bufferSize = 2; |
fa6173a0 LH |
830 | |
831 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ | |
8c87f69a | 832 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 LH |
833 | bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ |
834 | bufferSize += 2; /* CsrResult primitive->status */ | |
835 | return bufferSize; | |
836 | } | |
837 | ||
838 | ||
d4fda8db | 839 | u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
840 | { |
841 | CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; | |
842 | *len = 0; | |
843 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a | 844 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
7e6f5794 | 845 | CsrUint8Ser(ptr, len, (u8) primitive->apType); |
8c87f69a | 846 | CsrUint16Ser(ptr, len, (u16) primitive->status); |
fa6173a0 LH |
847 | return(ptr); |
848 | } | |
849 | ||
850 | ||
d4fda8db | 851 | void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length) |
fa6173a0 | 852 | { |
786eeeb3 | 853 | CsrWifiNmeApStopInd *primitive = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); |
d4fda8db | 854 | size_t offset; |
fa6173a0 LH |
855 | offset = 0; |
856 | ||
857 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a | 858 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
7e6f5794 | 859 | CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); |
8c87f69a | 860 | CsrUint16Des((u16 *) &primitive->status, buffer, &offset); |
fa6173a0 LH |
861 | |
862 | return primitive; | |
863 | } | |
864 | ||
865 | ||
d4fda8db | 866 | size_t CsrWifiNmeApStationIndSizeof(void *msg) |
fa6173a0 | 867 | { |
d4fda8db | 868 | size_t bufferSize = 2; |
fa6173a0 LH |
869 | |
870 | /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ | |
8c87f69a | 871 | bufferSize += 2; /* u16 primitive->interfaceTag */ |
fa6173a0 | 872 | bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ |
7e6f5794 GKH |
873 | bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ |
874 | bufferSize += 6; /* u8 primitive->peerDeviceAddress.a[6] */ | |
fa6173a0 LH |
875 | return bufferSize; |
876 | } | |
877 | ||
878 | ||
d4fda8db | 879 | u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg) |
fa6173a0 LH |
880 | { |
881 | CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; | |
882 | *len = 0; | |
883 | CsrUint16Ser(ptr, len, primitive->common.type); | |
8c87f69a | 884 | CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); |
7e6f5794 | 885 | CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); |
8c87f69a GKH |
886 | CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); |
887 | CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((u16) (6))); | |
fa6173a0 LH |
888 | return(ptr); |
889 | } | |
890 | ||
891 | ||
d4fda8db | 892 | void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length) |
fa6173a0 | 893 | { |
786eeeb3 | 894 | CsrWifiNmeApStationInd *primitive = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); |
d4fda8db | 895 | size_t offset; |
fa6173a0 LH |
896 | offset = 0; |
897 | ||
898 | CsrUint16Des(&primitive->common.type, buffer, &offset); | |
8c87f69a | 899 | CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); |
7e6f5794 | 900 | CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); |
8c87f69a GKH |
901 | CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); |
902 | CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((u16) (6))); | |
fa6173a0 LH |
903 | |
904 | return primitive; | |
905 | } | |
906 | ||
907 | ||
908 | #endif /* CSR_WIFI_NME_ENABLE */ | |
909 | #endif /* CSR_WIFI_AP_ENABLE */ |