hc
2024-08-12 233ab1bd4c5697f5cdec94e60206e8c6ac609b4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
/** @file hostsa_init.c
 *
 *  @brief This file defines the initialize /free  APIs for authenticator and supplicant.
 *
 * Copyright (C) 2014-2017, Marvell International Ltd.
 *
 * This software file (the "File") is distributed by Marvell International
 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
 * (the "License").  You may use, redistribute and/or modify this File in
 * accordance with the terms and conditions of the License, a copy of which
 * is available by writing to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
 *
 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
 * this warranty disclaimer.
 */
 
/******************************************************
Change log:
    03/07/2014: Initial version
******************************************************/
#include "mlan.h"
#ifdef STA_SUPPORT
#include "mlan_join.h"
#endif
#include "mlan_ioctl.h"
#include "mlan_util.h"
#include "mlan_fw.h"
#include "mlan_main.h"
#include "mlan_init.h"
#include "mlan_wmm.h"
#include "hostsa_def.h"
 
#include "authenticator_api.h"
 
/*********************
   Local Variables
 *********************/
 
/*********************
   Global Variables
 *********************/
 
/*********************
   Local Functions
 *********************/
 
/*********************
   Global Functions
 *********************/
 
/*********************
   Utility Handler
 *********************/
 
/**
 *  @brief alloc mlan buffer
 *
 *  @param pmlan_adapter   A void pointer
 *  @param data_len            request buffer len
 *  @param head_room        head room len
 *  @param malloc_flag        flag for mlan buffer
 
 *  @return          pointer to mlan buffer
 */
pmlan_buffer
hostsa_alloc_mlan_buffer(t_void *pmlan_adapter,
            t_u32 data_len, t_u32 head_room, t_u32 malloc_flag)
{
   mlan_adapter *pmadapter = (mlan_adapter *)pmlan_adapter;
   pmlan_buffer newbuf = MNULL;
 
   newbuf = wlan_alloc_mlan_buffer(pmadapter, data_len, head_room,
                   malloc_flag);
 
   return newbuf;
}
 
/**
 *  @brief free mlan buffer
 *
 *  @param pmlan_adapter   A void pointer
 *  @param pmbuf          a pointer to mlan buffer
 *
 *  @return
 */
void
hostsa_free_mlan_buffer(t_void *pmlan_adapter, mlan_buffer *pmbuf)
{
   mlan_adapter *pmadapter = (mlan_adapter *)pmlan_adapter;
 
   ENTER();
 
   wlan_free_mlan_buffer(pmadapter, pmbuf);
 
   LEAVE();
}
 
/**
 *  @brief send packet
 *
 *  @param pmlan_private   A void pointer
 *  @param pmbuf          a pointer to mlan buffer
 *  @param frameLen     paket len
 *
 *  @return
 */
void
hostsa_tx_packet(t_void *pmlan_private, pmlan_buffer pmbuf, t_u16 frameLen)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = pmpriv->adapter;
 
   ENTER();
 
   pmbuf->bss_index = pmpriv->bss_index;
   pmbuf->data_len = frameLen;
 
   wlan_add_buf_bypass_txqueue(pmadapter, pmbuf);
   wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
 
   LEAVE();
}
 
/**
 *  @brief set key to fw
 *
 *  @param pmlan_private   A void pointer
 *  @param encrypt_key     key structure
 *
 *  @return
 */
void
wlan_set_encrypt_key(t_void *pmlan_private, mlan_ds_encrypt_key *encrypt_key)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   mlan_status ret = MLAN_STATUS_SUCCESS;
 
   ENTER();
 
   if (!encrypt_key->key_len) {
       PRINTM(MCMND, "Skip set key with key_len = 0\n");
       LEAVE();
       return;
   }
 
   ret = wlan_prepare_cmd(priv,
                  HostCmd_CMD_802_11_KEY_MATERIAL,
                  HostCmd_ACT_GEN_SET,
                  KEY_INFO_ENABLED, MNULL, encrypt_key);
 
   if (ret == MLAN_STATUS_SUCCESS)
       wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
 
   LEAVE();
 
}
 
/**
 *  @brief clear key to fw
 *
 *  @param pmlan_private   A void pointer
 *
 *  @return
 */
void
wlan_clr_encrypt_key(t_void *pmlan_private)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   mlan_status ret = MLAN_STATUS_SUCCESS;
   mlan_ds_encrypt_key encrypt_key;
 
   ENTER();
 
   memset(priv->adapter, &encrypt_key, 0, sizeof(mlan_ds_encrypt_key));
   encrypt_key.key_disable = MTRUE;
   encrypt_key.key_flags = KEY_FLAG_REMOVE_KEY;
 
   ret = wlan_prepare_cmd(priv,
                  HostCmd_CMD_802_11_KEY_MATERIAL,
                  HostCmd_ACT_GEN_SET,
                  KEY_INFO_ENABLED, MNULL, &encrypt_key);
 
   if (ret == MLAN_STATUS_SUCCESS)
       wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
 
   LEAVE();
 
}
 
/**
 *  @brief send deauth frame
 *
 *  @param pmlan_private   A void pointer
 *  @param addr     destination mac address
 *  @param reason  deauth reason
 *
 *  @return
 */
void
hostsa_SendDeauth(t_void *pmlan_private, t_u8 *addr, t_u16 reason)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = pmpriv->adapter;
   mlan_status ret = MLAN_STATUS_SUCCESS;
   mlan_deauth_param deauth;
 
   ENTER();
 
   memcpy(pmadapter, deauth.mac_addr, addr, MLAN_MAC_ADDR_LENGTH);
   deauth.reason_code = reason;
 
   ret = wlan_prepare_cmd(pmpriv,
                  HOST_CMD_APCMD_STA_DEAUTH,
                  HostCmd_ACT_GEN_SET,
                  0, MNULL, (t_void *)&deauth);
   if (ret == MLAN_STATUS_SUCCESS)
       wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
               MNULL);
 
   LEAVE();
}
 
/**
 *  @brief deauth all connected stations
 *
 *  @param pmlan_private   A void pointer
 *  @param reason  deauth reason
 *
 *  @return
 */
void
ApDisAssocAllSta(void *pmlan_private, t_u16 reason)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = pmpriv->adapter;
   sta_node *sta_ptr;
 
   ENTER();
 
   sta_ptr = (sta_node *)util_peek_list(pmadapter->pmoal_handle,
                        &pmpriv->sta_list,
                        pmadapter->callbacks.
                        moal_spin_lock,
                        pmadapter->callbacks.
                        moal_spin_unlock);
 
   if (!sta_ptr) {
       LEAVE();
       return;
   }
 
   while (sta_ptr != (sta_node *)&pmpriv->sta_list) {
       hostsa_SendDeauth((t_void *)pmpriv, sta_ptr->mac_addr, reason);
       sta_ptr = sta_ptr->pnext;
   }
 
   LEAVE();
}
 
/**
 *  @brief get station entry
 *
 *  @param pmlan_private   A void pointer
 *  @param mac  pointer to station mac address
 *  @param ppconPtr    pointer to pointer to connection
 *
 *  @return
 */
void
Hostsa_get_station_entry(t_void *pmlan_private, t_u8 *mac, t_void **ppconPtr)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   sta_node *sta_ptr = MNULL;
 
   ENTER();
 
   sta_ptr = wlan_get_station_entry(priv, mac);
   if (sta_ptr)
       *ppconPtr = sta_ptr->cm_connectioninfo;
   else
       *ppconPtr = MNULL;
 
   LEAVE();
}
 
/**
 *  @brief find a connection
 *
 *  @param pmlan_private   A void pointer
 *  @param ppconPtr         a pointer to pointer to connection
 *  @param ppsta_node   a pointer to pointer to sta node
 *
 *  @return
 */
void
Hostsa_find_connection(t_void *pmlan_private, t_void **ppconPtr,
              t_void **ppsta_node)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   sta_node *sta_ptr = MNULL;
 
   ENTER();
 
   sta_ptr = (sta_node *)util_peek_list(priv->adapter->pmoal_handle,
                        &priv->sta_list,
                        priv->adapter->callbacks.
                        moal_spin_lock,
                        priv->adapter->callbacks.
                        moal_spin_unlock);
 
   if (!sta_ptr) {
       LEAVE();
       return;
   }
 
   *ppsta_node = (t_void *)sta_ptr;
   *ppconPtr = sta_ptr->cm_connectioninfo;
 
   LEAVE();
}
 
/**
 *  @brief find next connection
 *
 *  @param pmlan_private   A void pointer
 *  @param ppconPtr         a pointer to pointer to connection
 *  @param ppsta_node   a pointer to pointer to sta node
 *
 *  @return
 */
void
Hostsa_find_next_connection(t_void *pmlan_private, t_void **ppconPtr,
               t_void **ppsta_node)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   sta_node *sta_ptr = (sta_node *)*ppsta_node;
 
   ENTER();
   if (sta_ptr != (sta_node *)&priv->sta_list)
       sta_ptr = sta_ptr->pnext;
 
   *ppsta_node = MNULL;
   *ppconPtr = MNULL;
   if ((sta_ptr != MNULL) && (sta_ptr != (sta_node *)&priv->sta_list)) {
       *ppsta_node = (t_void *)sta_ptr;
       *ppconPtr = sta_ptr->cm_connectioninfo;
   }
   LEAVE();
}
 
/**
 *  @brief set management ie for beacon or probe response
 *
 *  @param pmlan_private   A void pointer
 *  @param pbuf                 ie buf
 *  @param len                   ie len
 *  @param clearIE             clear ie
 *
 *  @return
 */
void
Hostsa_set_mgmt_ie(t_void *pmlan_private, t_u8 *pbuf, t_u16 len, t_u8 clearIE)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = priv->adapter;
   mlan_ioctl_req *pioctl_req = MNULL;
   mlan_ds_misc_cfg *pds_misc_cfg = MNULL;
   custom_ie *pmgmt_ie = MNULL;
   mlan_status ret = MLAN_STATUS_SUCCESS;
 
   ENTER();
 
   if (pmadapter == MNULL) {
       LEAVE();
       return;
   }
 
   /* allocate buffer for mlan_ioctl_req and mlan_ds_misc_cfg */
   /* FYI - will be freed as part of cmd_response handler */
   ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle,
                          sizeof(mlan_ioctl_req) +
                          sizeof(mlan_ds_misc_cfg),
                          MLAN_MEM_DEF,
                          (t_u8 **)&pioctl_req);
   if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) {
       PRINTM(MERROR, "%s(): Could not allocate ioctl req\n",
              __func__);
       LEAVE();
       return;
   }
   pds_misc_cfg = (mlan_ds_misc_cfg *)((t_u8 *)pioctl_req +
                       sizeof(mlan_ioctl_req));
 
   /* prepare mlan_ioctl_req */
   memset(pmadapter, pioctl_req, 0x00, sizeof(mlan_ioctl_req));
   pioctl_req->req_id = MLAN_IOCTL_MISC_CFG;
   pioctl_req->action = MLAN_ACT_SET;
   pioctl_req->bss_index = priv->bss_index;
   pioctl_req->pbuf = (t_u8 *)pds_misc_cfg;
   pioctl_req->buf_len = sizeof(mlan_ds_misc_cfg);
 
   /* prepare mlan_ds_misc_cfg */
   memset(pmadapter, pds_misc_cfg, 0x00, sizeof(mlan_ds_misc_cfg));
   pds_misc_cfg->sub_command = MLAN_OID_MISC_CUSTOM_IE;
   pds_misc_cfg->param.cust_ie.type = TLV_TYPE_MGMT_IE;
   pds_misc_cfg->param.cust_ie.len = (sizeof(custom_ie) - MAX_IE_SIZE);
 
   /* configure custom_ie api settings */
   pmgmt_ie = (custom_ie *)&pds_misc_cfg->param.cust_ie.ie_data_list[0];
   pmgmt_ie->ie_index = 0xffff;    /* Auto index */
   pmgmt_ie->ie_length = len;
   pmgmt_ie->mgmt_subtype_mask = MBIT(8) | MBIT(5);    /* add IE for BEACON | PROBE_RSP */
   if (clearIE)
       pmgmt_ie->mgmt_subtype_mask = 0;
   memcpy(pmadapter, pmgmt_ie->ie_buffer, pbuf, len);
 
   pds_misc_cfg->param.cust_ie.len += pmgmt_ie->ie_length;
 
   DBG_HEXDUMP(MCMD_D, "authenticator: RSN or WPA IE",
           (t_u8 *)pmgmt_ie, pds_misc_cfg->param.cust_ie.len);
 
   ret = wlan_misc_ioctl_custom_ie_list(pmadapter, pioctl_req, MFALSE);
 
   if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) {
       PRINTM(MERROR,
              "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n",
              __func__, priv, priv->bss_index);
       /* TODO: how to handle this error case??  ignore & continue? */
   }
   /* free ioctl buffer memory before we leave */
   pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle,
                   (t_u8 *)pioctl_req);
 
}
 
t_void
StaControlledPortOpen(t_void *pmlan_private)
{
   mlan_private *priv = (mlan_private *)pmlan_private;
 
   PRINTM(MERROR, "StaControlledPortOpen\n");
   if (priv->port_ctrl_mode == MTRUE) {
       PRINTM(MINFO, "PORT_REL: port_status = OPEN\n");
       priv->port_open = MTRUE;
   }
   priv->adapter->scan_block = MFALSE;
   wlan_recv_event(priv, MLAN_EVENT_ID_FW_PORT_RELEASE, MNULL);
}
 
void
hostsa_StaSendDeauth(t_void *pmlan_private, t_u8 *addr, t_u16 reason)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = pmpriv->adapter;
   mlan_status ret = MLAN_STATUS_SUCCESS;
   mlan_deauth_param deauth;
 
   ENTER();
 
   memcpy(pmadapter, deauth.mac_addr, addr, MLAN_MAC_ADDR_LENGTH);
   deauth.reason_code = reason;
 
   ret = wlan_prepare_cmd(pmpriv,
                  HostCmd_CMD_802_11_DEAUTHENTICATE,
                  HostCmd_ACT_GEN_SET,
                  0, MNULL, (t_void *)&deauth);
   if (ret == MLAN_STATUS_SUCCESS)
       wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
               MNULL);
 
   LEAVE();
}
 
t_u8
Hostsa_get_bss_role(t_void *pmlan_private)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
 
   return GET_BSS_ROLE(pmpriv);
}
 
t_u8
Hostsa_get_intf_hr_len(t_void *pmlan_private)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
 
   return pmpriv->intf_hr_len;
}
 
/**
 *  @brief send event to moal to notice that 4 way handshake complete
 *
 *  @param pmlan_private   A void pointer
 *  @param addr  pointer to station mac address
 *
 *  @return
 */
t_void
Hostsa_sendEventRsnConnect(t_void *pmlan_private, t_u8 *addr)
{
   mlan_private *pmpriv = (mlan_private *)pmlan_private;
   mlan_adapter *pmadapter = pmpriv->adapter;
   t_u8 *event_buf = MNULL, *pos = MNULL;
   t_u32 event_cause = 0;
   mlan_event *pevent = MNULL;
   mlan_status ret = MLAN_STATUS_SUCCESS;
 
   ENTER();
 
   ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle,
                          MAX_EVENT_SIZE, MLAN_MEM_DEF,
                          &event_buf);
   if ((ret != MLAN_STATUS_SUCCESS) || !event_buf) {
       PRINTM(MERROR, "Could not allocate buffer for event buf\n");
       goto done;
   }
   pevent = (pmlan_event)event_buf;
   memset(pmadapter, event_buf, 0, MAX_EVENT_SIZE);
 
   pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU;
   pevent->bss_index = pmpriv->bss_index;
   event_cause = wlan_cpu_to_le32(0x51);    /*MICRO_AP_EV_ID_RSN_CONNECT */
   memcpy(pmadapter, (t_u8 *)pevent->event_buf,
          (t_u8 *)&event_cause, sizeof(event_cause));
   pos = pevent->event_buf + sizeof(event_cause) + 2;    /*reserved 2 byte */
   memcpy(pmadapter, (t_u8 *)pos, addr, MLAN_MAC_ADDR_LENGTH);
 
   pevent->event_len = MLAN_MAC_ADDR_LENGTH + sizeof(event_cause) + 2;
   wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_PASSTHRU, event_buf);
 
done:
   if (event_buf)
       pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle,
                       event_buf);
 
   LEAVE();
}
 
/**
 *  @brief This function initializes callbacks that hostsa interface uses.
 *
 *  @param pmpriv     A pointer to mlan_private structure
 *  @param putil_fns  A pointer to hostsa_util_fns structure
 *  @param pmlan_fns  A pointer to hostsa_mlan_fns structure
 *
 *  @return         MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
static t_void
hostsa_mlan_callbacks(IN pmlan_private pmpriv,
             IN hostsa_util_fns *putil_fns,
             IN hostsa_mlan_fns *pmlan_fns)
{
   pmlan_adapter pmadapter = pmpriv->adapter;
   pmlan_callbacks pcb = &pmadapter->callbacks;
 
   putil_fns->pmoal_handle = pmadapter->pmoal_handle;
   putil_fns->moal_malloc = pcb->moal_malloc;
   putil_fns->moal_mfree = pcb->moal_mfree;
   putil_fns->moal_memset = pcb->moal_memset;
   putil_fns->moal_memcpy = pcb->moal_memcpy;
   putil_fns->moal_memmove = pcb->moal_memmove;
   putil_fns->moal_memcmp = pcb->moal_memcmp;
   putil_fns->moal_udelay = pcb->moal_udelay;
   putil_fns->moal_get_system_time = pcb->moal_get_system_time;
   putil_fns->moal_init_timer = pcb->moal_init_timer;
   putil_fns->moal_free_timer = pcb->moal_free_timer;
   putil_fns->moal_start_timer = pcb->moal_start_timer;
   putil_fns->moal_stop_timer = pcb->moal_stop_timer;
   putil_fns->moal_init_lock = pcb->moal_init_lock;
   putil_fns->moal_free_lock = pcb->moal_free_lock;
   putil_fns->moal_spin_lock = pcb->moal_spin_lock;
   putil_fns->moal_spin_unlock = pcb->moal_spin_unlock;
   putil_fns->moal_print = pcb->moal_print;
   putil_fns->moal_print_netintf = pcb->moal_print_netintf;
 
   pmlan_fns->pmlan_private = pmpriv;
   pmlan_fns->pmlan_adapter = pmpriv->adapter;
   pmlan_fns->bss_index = pmpriv->bss_index;
   pmlan_fns->bss_type = pmpriv->bss_type;
#if 0
   pmlan_fns->mlan_add_buf_txqueue = mlan_add_buf_txqueue;
   pmlan_fns->mlan_select_wmm_queue = mlan_select_wmm_queue;
   pmlan_fns->mlan_write_data_complete = mlan_write_data_complete;
#endif
   pmlan_fns->hostsa_alloc_mlan_buffer = hostsa_alloc_mlan_buffer;
   pmlan_fns->hostsa_tx_packet = hostsa_tx_packet;
   pmlan_fns->hostsa_set_encrypt_key = wlan_set_encrypt_key;
   pmlan_fns->hostsa_clr_encrypt_key = wlan_clr_encrypt_key;
   pmlan_fns->hostsa_SendDeauth = hostsa_SendDeauth;
   pmlan_fns->Hostsa_DisAssocAllSta = ApDisAssocAllSta;
   pmlan_fns->hostsa_free_mlan_buffer = hostsa_free_mlan_buffer;
   pmlan_fns->Hostsa_get_station_entry = Hostsa_get_station_entry;
   pmlan_fns->Hostsa_set_mgmt_ie = Hostsa_set_mgmt_ie;
   pmlan_fns->Hostsa_find_connection = Hostsa_find_connection;
   pmlan_fns->Hostsa_find_next_connection = Hostsa_find_next_connection;
   pmlan_fns->Hostsa_StaControlledPortOpen = StaControlledPortOpen;
   pmlan_fns->hostsa_StaSendDeauth = hostsa_StaSendDeauth;
   pmlan_fns->Hostsa_get_bss_role = Hostsa_get_bss_role;
   pmlan_fns->Hostsa_get_intf_hr_len = Hostsa_get_intf_hr_len;
   pmlan_fns->Hostsa_sendEventRsnConnect = Hostsa_sendEventRsnConnect;
};
 
/**
 *  @brief Init hostsa data
 *
 *  @param pmpriv          A pointer to mlan_private structure
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
mlan_status
hostsa_init(pmlan_private pmpriv)
{
   hostsa_util_fns util_fns;
   hostsa_mlan_fns mlan_fns;
   mlan_status ret = MLAN_STATUS_SUCCESS;
 
   ENTER();
 
   hostsa_mlan_callbacks(pmpriv, &util_fns, &mlan_fns);
   ret = supplicant_authenticator_init(&pmpriv->psapriv, &util_fns,
                       &mlan_fns, pmpriv->curr_addr);
 
   LEAVE();
   return ret;
}
 
/**
 *  @brief Cleanup hostsa data
 *
 *  @param pmpriv     A pointer to mlan_private structure
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
mlan_status
hostsa_cleanup(pmlan_private pmpriv)
{
   mlan_status ret = MLAN_STATUS_SUCCESS;
 
   ENTER();
 
   supplicant_authenticator_free(pmpriv->psapriv);
 
   LEAVE();
   return ret;
}