Root/drivers/staging/csr/csr_wifi_nme_ap_serialize.c

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

Archive Download this file



interactive