Merge 3.5-rc4 into staging-next
[firefly-linux-kernel-4.4.55.git] / drivers / staging / csr / csr_wifi_sme_ap_lib.h
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
13 #ifndef CSR_WIFI_SME_AP_LIB_H__
14 #define CSR_WIFI_SME_AP_LIB_H__
15
16 #include "csr_types.h"
17 #include "csr_pmem.h"
18 #include "csr_sched.h"
19 #include "csr_util.h"
20 #include "csr_msg_transport.h"
21
22 #include "csr_wifi_lib.h"
23
24 #include "csr_wifi_sme_ap_prim.h"
25 #include "csr_wifi_sme_task.h"
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #ifndef CSR_WIFI_AP_ENABLE
33 #error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_lib.h
34 #endif
35
36 /*----------------------------------------------------------------------------*
37  *  CsrWifiSmeApFreeUpstreamMessageContents
38  *
39  *  DESCRIPTION
40  *      Free the allocated memory in a CSR_WIFI_SME_AP upstream message. Does not
41  *      free the message itself, and can only be used for upstream messages.
42  *
43  *  PARAMETERS
44  *      Deallocates the resources in a CSR_WIFI_SME_AP upstream message
45  *----------------------------------------------------------------------------*/
46 void CsrWifiSmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message);
47
48 /*----------------------------------------------------------------------------*
49  *  CsrWifiSmeApFreeDownstreamMessageContents
50  *
51  *  DESCRIPTION
52  *      Free the allocated memory in a CSR_WIFI_SME_AP downstream message. Does not
53  *      free the message itself, and can only be used for downstream messages.
54  *
55  *  PARAMETERS
56  *      Deallocates the resources in a CSR_WIFI_SME_AP downstream message
57  *----------------------------------------------------------------------------*/
58 void CsrWifiSmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message);
59
60 /*----------------------------------------------------------------------------*
61  * Enum to string functions
62  *----------------------------------------------------------------------------*/
63 const CsrCharString* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value);
64 const CsrCharString* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value);
65 const CsrCharString* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value);
66 const CsrCharString* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value);
67 const CsrCharString* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value);
68 const CsrCharString* CsrWifiSmeApTypeToString(CsrWifiSmeApType value);
69
70
71 /*----------------------------------------------------------------------------*
72  * CsrPrim Type toString function.
73  * Converts a message type to the String name of the Message
74  *----------------------------------------------------------------------------*/
75 const CsrCharString* CsrWifiSmeApPrimTypeToString(CsrPrim msgType);
76
77 /*----------------------------------------------------------------------------*
78  * Lookup arrays for PrimType name Strings
79  *----------------------------------------------------------------------------*/
80 extern const CsrCharString *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT];
81 extern const CsrCharString *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT];
82
83 /*******************************************************************************
84
85   NAME
86     CsrWifiSmeApActiveBaGetReqSend
87
88   DESCRIPTION
89     This primitive used to retrieve information related to the active block
90     ack sessions
91
92   PARAMETERS
93     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
94     interfaceTag -
95
96 *******************************************************************************/
97 #define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \
98     msg__ = (CsrWifiSmeApActiveBaGetReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetReq)); \
99     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \
100     msg__->interfaceTag = (interfaceTag__);
101
102 #define CsrWifiSmeApActiveBaGetReqSendTo(dst__, src__, interfaceTag__) \
103     { \
104         CsrWifiSmeApActiveBaGetReq *msg__; \
105         CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__); \
106         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
107     }
108
109 #define CsrWifiSmeApActiveBaGetReqSend(src__, interfaceTag__) \
110     CsrWifiSmeApActiveBaGetReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
111
112 /*******************************************************************************
113
114   NAME
115     CsrWifiSmeApActiveBaGetCfmSend
116
117   DESCRIPTION
118     This primitive carries the information related to the active ba sessions
119
120   PARAMETERS
121     queue            - Destination Task Queue
122     interfaceTag     -
123     status           - Reports the result of the request
124     activeBaCount    - Number of active block ack session
125     activeBaSessions - Points to a buffer containing an array of
126                        CsrWifiSmeApBaSession structures.
127
128 *******************************************************************************/
129 #define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
130     msg__ = (CsrWifiSmeApActiveBaGetCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApActiveBaGetCfm)); \
131     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \
132     msg__->interfaceTag = (interfaceTag__); \
133     msg__->status = (status__); \
134     msg__->activeBaCount = (activeBaCount__); \
135     msg__->activeBaSessions = (activeBaSessions__);
136
137 #define CsrWifiSmeApActiveBaGetCfmSendTo(dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
138     { \
139         CsrWifiSmeApActiveBaGetCfm *msg__; \
140         CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__); \
141         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
142     }
143
144 #define CsrWifiSmeApActiveBaGetCfmSend(dst__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
145     CsrWifiSmeApActiveBaGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, activeBaCount__, activeBaSessions__)
146
147 /*******************************************************************************
148
149   NAME
150     CsrWifiSmeApBaDeleteReqSend
151
152   DESCRIPTION
153     This primitive is used to delete an active block ack session
154
155   PARAMETERS
156     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
157     interfaceTag -
158     reason       -
159     baSession    - BA session to be deleted
160
161 *******************************************************************************/
162 #define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \
163     msg__ = (CsrWifiSmeApBaDeleteReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteReq)); \
164     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \
165     msg__->interfaceTag = (interfaceTag__); \
166     msg__->reason = (reason__); \
167     msg__->baSession = (baSession__);
168
169 #define CsrWifiSmeApBaDeleteReqSendTo(dst__, src__, interfaceTag__, reason__, baSession__) \
170     { \
171         CsrWifiSmeApBaDeleteReq *msg__; \
172         CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__); \
173         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
174     }
175
176 #define CsrWifiSmeApBaDeleteReqSend(src__, interfaceTag__, reason__, baSession__) \
177     CsrWifiSmeApBaDeleteReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, reason__, baSession__)
178
179 /*******************************************************************************
180
181   NAME
182     CsrWifiSmeApBaDeleteCfmSend
183
184   DESCRIPTION
185     This primitive confirms the BA is deleted
186
187   PARAMETERS
188     queue        - Destination Task Queue
189     interfaceTag -
190     status       - Reports the result of the request
191     baSession    - deleted BA session
192
193 *******************************************************************************/
194 #define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \
195     msg__ = (CsrWifiSmeApBaDeleteCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBaDeleteCfm)); \
196     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \
197     msg__->interfaceTag = (interfaceTag__); \
198     msg__->status = (status__); \
199     msg__->baSession = (baSession__);
200
201 #define CsrWifiSmeApBaDeleteCfmSendTo(dst__, src__, interfaceTag__, status__, baSession__) \
202     { \
203         CsrWifiSmeApBaDeleteCfm *msg__; \
204         CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__); \
205         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
206     }
207
208 #define CsrWifiSmeApBaDeleteCfmSend(dst__, interfaceTag__, status__, baSession__) \
209     CsrWifiSmeApBaDeleteCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, baSession__)
210
211 /*******************************************************************************
212
213   NAME
214     CsrWifiSmeApBeaconingStartReqSend
215
216   DESCRIPTION
217     This primitive requests the SME to start AP or GO functionality
218
219   PARAMETERS
220     queue           - Message Source Task Queue (Cfm's will be sent to this Queue)
221     interfaceTag    -
222     initialPresence - Set to 0, if Not in a group fomration phase, set to 1 ,
223                       during group formation phase
224     apType          - apType : Legacy AP or P2PGO
225     cloakSsid       - cloakSsid flag.
226     ssid            - ssid.
227     ifIndex         - Radio Interface
228     channel         - channel.
229     maxConnections  - Maximum Stations + P2PClients allowed
230     apCredentials   - AP security credeitals used to advertise in beacon /probe
231                       response
232     smeApConfig     - AP configuration
233     p2pGoParam      - P2P specific GO parameters. Ignored if it is a leagacy AP
234
235 *******************************************************************************/
236 #define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
237     msg__ = (CsrWifiSmeApBeaconingStartReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartReq)); \
238     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \
239     msg__->interfaceTag = (interfaceTag__); \
240     msg__->initialPresence = (initialPresence__); \
241     msg__->apType = (apType__); \
242     msg__->cloakSsid = (cloakSsid__); \
243     msg__->ssid = (ssid__); \
244     msg__->ifIndex = (ifIndex__); \
245     msg__->channel = (channel__); \
246     msg__->maxConnections = (maxConnections__); \
247     msg__->apCredentials = (apCredentials__); \
248     msg__->smeApConfig = (smeApConfig__); \
249     msg__->p2pGoParam = (p2pGoParam__);
250
251 #define CsrWifiSmeApBeaconingStartReqSendTo(dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
252     { \
253         CsrWifiSmeApBeaconingStartReq *msg__; \
254         CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__); \
255         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
256     }
257
258 #define CsrWifiSmeApBeaconingStartReqSend(src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
259     CsrWifiSmeApBeaconingStartReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__)
260
261 /*******************************************************************************
262
263   NAME
264     CsrWifiSmeApBeaconingStartCfmSend
265
266   DESCRIPTION
267     This primitive confirms the completion of the request along with the
268     status
269
270   PARAMETERS
271     queue        - Destination Task Queue
272     interfaceTag -
273     status       -
274     secIeLength  -
275     secIe        -
276
277 *******************************************************************************/
278 #define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
279     msg__ = (CsrWifiSmeApBeaconingStartCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStartCfm)); \
280     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \
281     msg__->interfaceTag = (interfaceTag__); \
282     msg__->status = (status__); \
283     msg__->secIeLength = (secIeLength__); \
284     msg__->secIe = (secIe__);
285
286 #define CsrWifiSmeApBeaconingStartCfmSendTo(dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
287     { \
288         CsrWifiSmeApBeaconingStartCfm *msg__; \
289         CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__); \
290         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
291     }
292
293 #define CsrWifiSmeApBeaconingStartCfmSend(dst__, interfaceTag__, status__, secIeLength__, secIe__) \
294     CsrWifiSmeApBeaconingStartCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, secIeLength__, secIe__)
295
296 /*******************************************************************************
297
298   NAME
299     CsrWifiSmeApBeaconingStopReqSend
300
301   DESCRIPTION
302     This primitive requests the SME to STOP AP or P2PGO operation
303
304   PARAMETERS
305     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
306     interfaceTag -
307
308 *******************************************************************************/
309 #define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \
310     msg__ = (CsrWifiSmeApBeaconingStopReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopReq)); \
311     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \
312     msg__->interfaceTag = (interfaceTag__);
313
314 #define CsrWifiSmeApBeaconingStopReqSendTo(dst__, src__, interfaceTag__) \
315     { \
316         CsrWifiSmeApBeaconingStopReq *msg__; \
317         CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__); \
318         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
319     }
320
321 #define CsrWifiSmeApBeaconingStopReqSend(src__, interfaceTag__) \
322     CsrWifiSmeApBeaconingStopReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
323
324 /*******************************************************************************
325
326   NAME
327     CsrWifiSmeApBeaconingStopCfmSend
328
329   DESCRIPTION
330     This primitive confirms AP or P2PGO operation is terminated
331
332   PARAMETERS
333     queue        - Destination Task Queue
334     interfaceTag -
335     status       -
336
337 *******************************************************************************/
338 #define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
339     msg__ = (CsrWifiSmeApBeaconingStopCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApBeaconingStopCfm)); \
340     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \
341     msg__->interfaceTag = (interfaceTag__); \
342     msg__->status = (status__);
343
344 #define CsrWifiSmeApBeaconingStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
345     { \
346         CsrWifiSmeApBeaconingStopCfm *msg__; \
347         CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
348         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
349     }
350
351 #define CsrWifiSmeApBeaconingStopCfmSend(dst__, interfaceTag__, status__) \
352     CsrWifiSmeApBeaconingStopCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
353
354 /*******************************************************************************
355
356   NAME
357     CsrWifiSmeApErrorIndSend
358
359   DESCRIPTION
360     This primitve is sent by SME to indicate some error in AP operationi
361     after AP operations were started successfully and continuing the AP
362     operation may lead to undesired behaviour. It is the responsibility of
363     the upper layers to stop AP operation if needed
364
365   PARAMETERS
366     queue        - Destination Task Queue
367     interfaceTag - Range 0-1
368     apType       -
369     status       - Contains the error status
370
371 *******************************************************************************/
372 #define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
373     msg__ = (CsrWifiSmeApErrorInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApErrorInd)); \
374     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \
375     msg__->interfaceTag = (interfaceTag__); \
376     msg__->apType = (apType__); \
377     msg__->status = (status__);
378
379 #define CsrWifiSmeApErrorIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
380     { \
381         CsrWifiSmeApErrorInd *msg__; \
382         CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
383         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
384     }
385
386 #define CsrWifiSmeApErrorIndSend(dst__, interfaceTag__, apType__, status__) \
387     CsrWifiSmeApErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, apType__, status__)
388
389 /*******************************************************************************
390
391   NAME
392     CsrWifiSmeApStaConnectStartIndSend
393
394   DESCRIPTION
395     This primitive indicates that a stations request to join the group/BSS is
396     accepted
397
398   PARAMETERS
399     queue          - Destination Task Queue
400     interfaceTag   -
401     peerMacAddress -
402
403 *******************************************************************************/
404 #define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \
405     msg__ = (CsrWifiSmeApStaConnectStartInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaConnectStartInd)); \
406     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \
407     msg__->interfaceTag = (interfaceTag__); \
408     msg__->peerMacAddress = (peerMacAddress__);
409
410 #define CsrWifiSmeApStaConnectStartIndSendTo(dst__, src__, interfaceTag__, peerMacAddress__) \
411     { \
412         CsrWifiSmeApStaConnectStartInd *msg__; \
413         CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__); \
414         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
415     }
416
417 #define CsrWifiSmeApStaConnectStartIndSend(dst__, interfaceTag__, peerMacAddress__) \
418     CsrWifiSmeApStaConnectStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, peerMacAddress__)
419
420 /*******************************************************************************
421
422   NAME
423     CsrWifiSmeApStaDisconnectReqSend
424
425   DESCRIPTION
426     This primitive tells SME to deauth ot disassociate a particular station
427     within BSS
428
429   PARAMETERS
430     queue          - Message Source Task Queue (Cfm's will be sent to this Queue)
431     interfaceTag   -
432     deauthReason   -
433     disassocReason -
434     peerMacaddress -
435     keepBlocking   - If TRUE, the station is blocked. If FALSE and the station
436                      is connected, disconnect the station. If FALSE and the
437                      station is not connected, no action is taken.
438
439 *******************************************************************************/
440 #define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
441     msg__ = (CsrWifiSmeApStaDisconnectReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectReq)); \
442     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \
443     msg__->interfaceTag = (interfaceTag__); \
444     msg__->deauthReason = (deauthReason__); \
445     msg__->disassocReason = (disassocReason__); \
446     msg__->peerMacaddress = (peerMacaddress__); \
447     msg__->keepBlocking = (keepBlocking__);
448
449 #define CsrWifiSmeApStaDisconnectReqSendTo(dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
450     { \
451         CsrWifiSmeApStaDisconnectReq *msg__; \
452         CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__); \
453         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
454     }
455
456 #define CsrWifiSmeApStaDisconnectReqSend(src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
457     CsrWifiSmeApStaDisconnectReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__)
458
459 /*******************************************************************************
460
461   NAME
462     CsrWifiSmeApStaDisconnectCfmSend
463
464   DESCRIPTION
465     This primitive confirms the station is disconnected
466
467   PARAMETERS
468     queue          - Destination Task Queue
469     interfaceTag   -
470     status         -
471     peerMacaddress -
472
473 *******************************************************************************/
474 #define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \
475     msg__ = (CsrWifiSmeApStaDisconnectCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaDisconnectCfm)); \
476     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \
477     msg__->interfaceTag = (interfaceTag__); \
478     msg__->status = (status__); \
479     msg__->peerMacaddress = (peerMacaddress__);
480
481 #define CsrWifiSmeApStaDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__, peerMacaddress__) \
482     { \
483         CsrWifiSmeApStaDisconnectCfm *msg__; \
484         CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__); \
485         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
486     }
487
488 #define CsrWifiSmeApStaDisconnectCfmSend(dst__, interfaceTag__, status__, peerMacaddress__) \
489     CsrWifiSmeApStaDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, peerMacaddress__)
490
491 /*******************************************************************************
492
493   NAME
494     CsrWifiSmeApStaNotifyIndSend
495
496   DESCRIPTION
497     This primitive indicates that a station has joined or a previously joined
498     station has left the BSS/group
499
500   PARAMETERS
501     queue             - Destination Task Queue
502     interfaceTag      -
503     mediaStatus       -
504     peerMacAddress    -
505     peerDeviceAddress -
506     disassocReason    -
507     deauthReason      -
508     WpsRegistration   -
509     secIeLength       -
510     secIe             -
511     groupKeyId        -
512     seqNumber         -
513
514 *******************************************************************************/
515 #define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
516     msg__ = (CsrWifiSmeApStaNotifyInd *) CsrPmemAlloc(sizeof(CsrWifiSmeApStaNotifyInd)); \
517     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \
518     msg__->interfaceTag = (interfaceTag__); \
519     msg__->mediaStatus = (mediaStatus__); \
520     msg__->peerMacAddress = (peerMacAddress__); \
521     msg__->peerDeviceAddress = (peerDeviceAddress__); \
522     msg__->disassocReason = (disassocReason__); \
523     msg__->deauthReason = (deauthReason__); \
524     msg__->WpsRegistration = (WpsRegistration__); \
525     msg__->secIeLength = (secIeLength__); \
526     msg__->secIe = (secIe__); \
527     msg__->groupKeyId = (groupKeyId__); \
528     CsrMemCpy(msg__->seqNumber, (seqNumber__), sizeof(CsrUint16) * 8);
529
530 #define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
531     { \
532         CsrWifiSmeApStaNotifyInd *msg__; \
533         CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__); \
534         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
535     }
536
537 #define CsrWifiSmeApStaNotifyIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
538     CsrWifiSmeApStaNotifyIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__)
539
540 /*******************************************************************************
541
542   NAME
543     CsrWifiSmeApWmmParamUpdateReqSend
544
545   DESCRIPTION
546     Application uses this primitive to update the WMM parameters on the fly
547
548   PARAMETERS
549     queue         - Message Source Task Queue (Cfm's will be sent to this Queue)
550     interfaceTag  -
551     wmmApParams   - WMM parameters to be used for local firmware queue
552                     configuration
553     wmmApBcParams - WMM parameters to be advertised in beacon/probe response
554
555 *******************************************************************************/
556 #define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
557     msg__ = (CsrWifiSmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateReq)); \
558     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
559     msg__->interfaceTag = (interfaceTag__); \
560     CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
561     CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
562
563 #define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
564     { \
565         CsrWifiSmeApWmmParamUpdateReq *msg__; \
566         CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__); \
567         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
568     }
569
570 #define CsrWifiSmeApWmmParamUpdateReqSend(src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
571     CsrWifiSmeApWmmParamUpdateReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, wmmApParams__, wmmApBcParams__)
572
573 /*******************************************************************************
574
575   NAME
576     CsrWifiSmeApWmmParamUpdateCfmSend
577
578   DESCRIPTION
579     A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request
580
581   PARAMETERS
582     queue        - Destination Task Queue
583     interfaceTag -
584     status       -
585
586 *******************************************************************************/
587 #define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
588     msg__ = (CsrWifiSmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm)); \
589     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
590     msg__->interfaceTag = (interfaceTag__); \
591     msg__->status = (status__);
592
593 #define CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, src__, interfaceTag__, status__) \
594     { \
595         CsrWifiSmeApWmmParamUpdateCfm *msg__; \
596         CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
597         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
598     }
599
600 #define CsrWifiSmeApWmmParamUpdateCfmSend(dst__, interfaceTag__, status__) \
601     CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
602
603 /*******************************************************************************
604
605   NAME
606     CsrWifiSmeApWpsConfigurationReqSend
607
608   DESCRIPTION
609     This primitive passes the WPS information for the device to SME. This may
610     be accepted only if no interface is active.
611
612   PARAMETERS
613     queue     - Message Source Task Queue (Cfm's will be sent to this Queue)
614     wpsConfig - WPS config.
615
616 *******************************************************************************/
617 #define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \
618     msg__ = (CsrWifiSmeApWpsConfigurationReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationReq)); \
619     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \
620     msg__->wpsConfig = (wpsConfig__);
621
622 #define CsrWifiSmeApWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \
623     { \
624         CsrWifiSmeApWpsConfigurationReq *msg__; \
625         CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \
626         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
627     }
628
629 #define CsrWifiSmeApWpsConfigurationReqSend(src__, wpsConfig__) \
630     CsrWifiSmeApWpsConfigurationReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, wpsConfig__)
631
632 /*******************************************************************************
633
634   NAME
635     CsrWifiSmeApWpsConfigurationCfmSend
636
637   DESCRIPTION
638     Confirm.
639
640   PARAMETERS
641     queue  - Destination Task Queue
642     status - Status of the request.
643
644 *******************************************************************************/
645 #define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \
646     msg__ = (CsrWifiSmeApWpsConfigurationCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsConfigurationCfm)); \
647     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \
648     msg__->status = (status__);
649
650 #define CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, src__, status__) \
651     { \
652         CsrWifiSmeApWpsConfigurationCfm *msg__; \
653         CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \
654         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
655     }
656
657 #define CsrWifiSmeApWpsConfigurationCfmSend(dst__, status__) \
658     CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
659
660 /*******************************************************************************
661
662   NAME
663     CsrWifiSmeApWpsRegistrationFinishedReqSend
664
665   DESCRIPTION
666     This primitive tells SME that WPS registration procedure has finished
667
668   PARAMETERS
669     queue        - Message Source Task Queue (Cfm's will be sent to this Queue)
670     interfaceTag -
671
672 *******************************************************************************/
673 #define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \
674     msg__ = (CsrWifiSmeApWpsRegistrationFinishedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq)); \
675     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \
676     msg__->interfaceTag = (interfaceTag__);
677
678 #define CsrWifiSmeApWpsRegistrationFinishedReqSendTo(dst__, src__, interfaceTag__) \
679     { \
680         CsrWifiSmeApWpsRegistrationFinishedReq *msg__; \
681         CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__); \
682         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
683     }
684
685 #define CsrWifiSmeApWpsRegistrationFinishedReqSend(src__, interfaceTag__) \
686     CsrWifiSmeApWpsRegistrationFinishedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
687
688 /*******************************************************************************
689
690   NAME
691     CsrWifiSmeApWpsRegistrationFinishedCfmSend
692
693   DESCRIPTION
694     A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request
695
696   PARAMETERS
697     queue        - Destination Task Queue
698     interfaceTag -
699     status       -
700
701 *******************************************************************************/
702 #define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
703     msg__ = (CsrWifiSmeApWpsRegistrationFinishedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm)); \
704     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \
705     msg__->interfaceTag = (interfaceTag__); \
706     msg__->status = (status__);
707
708 #define CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, src__, interfaceTag__, status__) \
709     { \
710         CsrWifiSmeApWpsRegistrationFinishedCfm *msg__; \
711         CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
712         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
713     }
714
715 #define CsrWifiSmeApWpsRegistrationFinishedCfmSend(dst__, interfaceTag__, status__) \
716     CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
717
718 /*******************************************************************************
719
720   NAME
721     CsrWifiSmeApWpsRegistrationStartedReqSend
722
723   DESCRIPTION
724     This primitive tells SME that WPS registration procedure has started
725
726   PARAMETERS
727     queue                    - Message Source Task Queue (Cfm's will be sent to this Queue)
728     interfaceTag             -
729     SelectedDevicePasswordId -
730     SelectedconfigMethod     -
731
732 *******************************************************************************/
733 #define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
734     msg__ = (CsrWifiSmeApWpsRegistrationStartedReq *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq)); \
735     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \
736     msg__->interfaceTag = (interfaceTag__); \
737     msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \
738     msg__->SelectedconfigMethod = (SelectedconfigMethod__);
739
740 #define CsrWifiSmeApWpsRegistrationStartedReqSendTo(dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
741     { \
742         CsrWifiSmeApWpsRegistrationStartedReq *msg__; \
743         CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__); \
744         CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
745     }
746
747 #define CsrWifiSmeApWpsRegistrationStartedReqSend(src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
748     CsrWifiSmeApWpsRegistrationStartedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__)
749
750 /*******************************************************************************
751
752   NAME
753     CsrWifiSmeApWpsRegistrationStartedCfmSend
754
755   DESCRIPTION
756     A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request
757
758   PARAMETERS
759     queue        - Destination Task Queue
760     interfaceTag -
761     status       -
762
763 *******************************************************************************/
764 #define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
765     msg__ = (CsrWifiSmeApWpsRegistrationStartedCfm *) CsrPmemAlloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm)); \
766     CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \
767     msg__->interfaceTag = (interfaceTag__); \
768     msg__->status = (status__);
769
770 #define CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, src__, interfaceTag__, status__) \
771     { \
772         CsrWifiSmeApWpsRegistrationStartedCfm *msg__; \
773         CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
774         CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
775     }
776
777 #define CsrWifiSmeApWpsRegistrationStartedCfmSend(dst__, interfaceTag__, status__) \
778     CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
779
780
781 #ifdef __cplusplus
782 }
783 #endif
784
785 #endif /* CSR_WIFI_SME_AP_LIB_H__ */