lin
2025-07-31 065ea569db06206874bbfa18eb25ff6121aec09b
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
/* SPDX-License-Identifier: GPL-2.0 */
 
/******************************************************************************
 *
 * Copyright (C) 2020 SeekWave Technology Co.,Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 ******************************************************************************/
 
#ifndef __SKW_MLME_H__
#define __SKW_MLME_H__
 
#include "skw_iface.h"
 
struct skw_client {
   struct list_head list;
   struct skw_iface *iface;
   enum SKW_STATES state;
   u32 capa;
 
   u16 aid;
   u8 addr[ETH_ALEN];
 
   u8 *challenge;
   u64 cookie;
   unsigned long idle;
   u8 *assoc_req_ie;
   u16 assoc_req_ie_len;
   u16 last_seq_ctrl;
};
 
struct skw_element_info {
   struct {
       int len;
       u8 data[32];
   } ssid;
   const struct skw_element *support_rate;
   const struct skw_element *ext_rate;
   const struct skw_element *ht_capa;
   const struct skw_element *ht_oper;
   const struct skw_element *vht_capa;
   const struct skw_element *vht_oper;
   const struct skw_element *ext_capa;
   const struct skw_element *vendor_vht;
};
 
int skw_mgmt_frame_with_reason(struct skw_iface *iface, u8 *da, u64 *cookie, u8 *bssid,
           struct ieee80211_channel *ch, u16 stype, u16 reason, bool switchover);
 
int skw_ap_simple_reply(struct skw_iface *iface, struct skw_client *client,
           u16 stype, u16 reason);
 
static inline int skw_ap_send_deauth(struct skw_iface *iface,
                    struct skw_client *client, u16 reason)
{
   return skw_ap_simple_reply(iface, client,
                   IEEE80211_STYPE_DEAUTH, reason);
}
 
 
static inline int skw_ap_send_disassoc(struct skw_iface *iface,
                      struct skw_client *client, u16 code)
{
   return skw_ap_simple_reply(iface, client,
                   IEEE80211_STYPE_DISASSOC, code);
}
 
void skw_mlme_sta_tx_status(struct skw_iface *iface, u64 cookie,
              const u8 *frame, int frame_len, u16 ack);
int skw_mlme_sta_rx_mgmt(struct skw_iface *iface, int freq, int signal,
           void *frame, int frame_len);
int skw_process_auth_response(struct skw_iface *iface, int freq,
           int signal, void *frame, int frame_len);
int skw_ap_mgmt_handler(struct skw_iface *iface, void *frame, int frame_len);
void skw_mlme_ap_del_sta(struct wiphy *wiphy, struct net_device *ndev,
            const u8 *addr, u8 force);
int skw_mlme_ap_rx_mgmt(struct skw_iface *iface, u16 fc, int freq,
           int signal, void *frame, int frame_len);
void skw_mlme_ap_remove_client(struct skw_iface *iface, const u8 *addr);
void skw_mlme_ap_tx_status(struct skw_iface *iface, u64 cookie,
              const u8 *frame, int frame_len, u16 ack);
int skw_mlme_sta_rx_auth(struct skw_iface *iface, int freq, int signal,
            void *buf, int len);
 
int skw_mlme_sta_rx_assoc(struct skw_iface *iface, struct cfg80211_bss *bss,
             void *frame, int len, void *req_ie, int req_ie_len);
#endif