5fc1d74d25f83b3e9fbd5a35f5f1916cfe7ac2b7
[project/luci.git] / contrib / package / iwinfo / src / iwinfo_nl80211.h
1 /*
2  * iwinfo - Wireless Information Library - NL80211 Headers
3  *
4  *   Copyright (C) 2010 Jo-Philipp Wich <xm@subsignal.org>
5  *
6  * The iwinfo library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version 2
8  * as published by the Free Software Foundation.
9  *
10  * The iwinfo library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with the iwinfo library. If not, see http://www.gnu.org/licenses/.
17  */
18
19 #ifndef __IWINFO_NL80211_H_
20 #define __IWINFO_NL80211_H_
21
22 #include <errno.h>
23 #include <fcntl.h>
24 #include <unistd.h>
25 #include <string.h>
26 #include <dirent.h>
27 #include <signal.h>
28 #include <sys/socket.h>
29 #include <sys/un.h>
30 #include <net/if.h>
31 #include <netlink/netlink.h>
32 #include <netlink/genl/genl.h>
33 #include <netlink/genl/family.h>
34 #include <netlink/genl/ctrl.h>
35
36 #include "iwinfo.h"
37 #include "include/nl80211.h"
38
39 struct nl80211_state {
40         struct nl_sock *nl_sock;
41         struct nl_cache *nl_cache;
42         struct genl_family *nl80211;
43 };
44
45 struct nl80211_msg_conveyor {
46         int custom_cb;
47         struct nl_msg *msg;
48         struct nl_cb *cb;
49         struct genlmsghdr *hdr;
50         struct nlattr *attr[NL80211_ATTR_MAX + 1];
51 };
52
53 struct nl80211_rssi_rate {
54         int16_t rate;
55         int8_t  rssi;
56 };
57
58 struct nl80211_assoc_count {
59         struct iwinfo_assoclist_entry *entry;
60         int noise;
61         int count;
62 };
63
64 int nl80211_probe(const char *ifname);
65 int nl80211_get_mode(const char *ifname, char *buf);
66 int nl80211_get_ssid(const char *ifname, char *buf);
67 int nl80211_get_bssid(const char *ifname, char *buf);
68 int nl80211_get_country(const char *ifname, char *buf);
69 int nl80211_get_channel(const char *ifname, int *buf);
70 int nl80211_get_frequency(const char *ifname, int *buf);
71 int nl80211_get_txpower(const char *ifname, int *buf);
72 int nl80211_get_bitrate(const char *ifname, int *buf);
73 int nl80211_get_signal(const char *ifname, int *buf);
74 int nl80211_get_noise(const char *ifname, int *buf);
75 int nl80211_get_quality(const char *ifname, int *buf);
76 int nl80211_get_quality_max(const char *ifname, int *buf);
77 int nl80211_get_encryption(const char *ifname, char *buf);
78 int nl80211_get_assoclist(const char *ifname, char *buf, int *len);
79 int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len);
80 int nl80211_get_scanlist(const char *ifname, char *buf, int *len);
81 int nl80211_get_freqlist(const char *ifname, char *buf, int *len);
82 int nl80211_get_countrylist(const char *ifname, char *buf, int *len);
83 int nl80211_get_hwmodelist(const char *ifname, int *buf);
84 int nl80211_get_mbssid_support(const char *ifname, int *buf);
85 void nl80211_close(void);
86
87 #endif