utils: fix segfault in iwinfo_hardware_id_from_mtd()
[project/iwinfo.git] / api / broadcom.h
1 /*
2  * Custom OID/ioctl definitions for
3  * Broadcom 802.11abg Networking Device Driver
4  *
5  * Definitions subject to change without notice.
6  *
7  * Copyright 2006, Broadcom Corporation
8  * All Rights Reserved.
9  *
10  * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11  * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
12  * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13  * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14  *
15  */
16
17 #ifndef _BROADCOM_H
18 #define _BROADCOM_H
19
20 #define WL_MCSSET_LEN                           16
21 #define WL_MAX_STA_COUNT                        32
22
23 #define WL_BSS_RSSI_OFFSET                      82
24 #define WL_BSS_NOISE_OFFSET                     84
25
26 #define WLC_IOCTL_MAGIC                         0x14e46c77
27 #define WLC_IOCTL_MAXLEN                        8192
28
29 #define WLC_CNTRY_BUF_SZ                        4
30
31 #define WLC_GET_MAGIC                           0
32 #define WLC_GET_RATE                            12
33 #define WLC_GET_INFRA                           19
34 #define WLC_GET_AUTH                            21
35 #define WLC_GET_BSSID                           23
36 #define WLC_GET_SSID                            25
37 #define WLC_GET_CHANNEL                         29
38 #define WLC_GET_PHYTYPE                         39
39 #define WLC_GET_PASSIVE                         48
40 #define WLC_GET_COUNTRY                         83
41 #define WLC_GET_REVINFO                         98
42 #define WLC_GET_AP                              117
43 #define WLC_GET_RSSI                            127
44 #define WLC_GET_WSEC                            133
45 #define WLC_GET_PHY_NOISE                       135
46 #define WLC_GET_BSS_INFO                        136
47 #define WLC_GET_BANDLIST                        140
48 #define WLC_GET_ASSOCLIST                       159
49 #define WLC_GET_WPA_AUTH                        164
50 #define WLC_GET_COUNTRY_LIST                    261
51 #define WLC_GET_VAR                             262
52
53 #define WLC_PHY_TYPE_A                          0
54 #define WLC_PHY_TYPE_B                          1
55 #define WLC_PHY_TYPE_G                          2
56 #define WLC_PHY_TYPE_N                          4
57 #define WLC_PHY_TYPE_LP                         5
58 #define WLC_PHY_TYPE_HT                         7
59 #define WLC_PHY_TYPE_AC                         11
60
61 #define WLC_BAND_5G                             1
62 #define WLC_BAND_2G                             2
63 #define WLC_BAND_ALL                            3
64
65
66 struct wl_ether_addr {
67         uint8_t                                 octet[6];
68 };
69
70 struct wl_maclist {
71         uint                                    count;
72         struct wl_ether_addr    ea[1];
73 };
74
75 typedef struct wl_sta_rssi {
76         int                                             rssi;
77         char                                    mac[6];
78         uint16_t                                foo;
79 } wl_sta_rssi_t;
80
81 #define WL_NUMRATES     255 /* max # of rates in a rateset */
82 typedef struct wl_rateset {
83     uint32_t                            count;          /* # rates in this set */
84     uint8_t                             rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
85 } wl_rateset_t;
86
87 typedef struct wl_sta_info {
88     uint16_t                            ver;        /* version of this struct */
89     uint16_t                            len;        /* length in bytes of this structure */
90     uint16_t                            cap;        /* sta's advertised capabilities */
91     uint32_t                            flags;      /* flags defined below */
92     uint32_t                            idle;       /* time since data pkt rx'd from sta */
93     unsigned char                       ea[6];      /* Station address */
94     wl_rateset_t                        rateset;    /* rateset in use */
95     uint32_t                            in;             /* seconds elapsed since associated */
96     uint32_t                            listen_interval_inms; /* Min Listen interval in ms for this STA */
97     uint32_t                            tx_pkts;    /* # of packets transmitted */
98     uint32_t                            tx_failures;    /* # of packets failed */
99     uint32_t                            rx_ucast_pkts;  /* # of unicast packets received */
100     uint32_t                            rx_mcast_pkts;  /* # of multicast packets received */
101     uint32_t                            tx_rate;    /* Rate of last successful tx frame */
102     uint32_t                            rx_rate;    /* Rate of last successful rx frame */
103 } wl_sta_info_t;
104
105 typedef struct wlc_ssid {
106         uint32_t                                ssid_len;
107         unsigned char                   ssid[32];
108 } wlc_ssid_t;
109
110 /* Linux network driver ioctl encoding */
111 typedef struct wl_ioctl {
112         uint32_t                                cmd;    /* common ioctl definition */
113         void                                    *buf;   /* pointer to user buffer */
114         uint32_t                                len;    /* length of user buffer */
115         uint8_t                                 set;    /* get or set request (optional) */
116         uint32_t                                used;   /* bytes read or written (optional) */
117         uint32_t                                needed; /* bytes needed (optional) */
118 } wl_ioctl_t;
119
120 /* Revision info */
121 typedef struct wlc_rev_info {
122         uint            vendorid;       /* PCI vendor id */
123         uint            deviceid;       /* device id of chip */
124         uint            radiorev;       /* radio revision */
125         uint            chiprev;        /* chip revision */
126         uint            corerev;        /* core revision */
127         uint            boardid;        /* board identifier (usu. PCI sub-device id) */
128         uint            boardvendor;    /* board vendor (usu. PCI sub-vendor id) */
129         uint            boardrev;       /* board revision */
130         uint            driverrev;      /* driver version */
131         uint            ucoderev;       /* microcode version */
132         uint            bus;            /* bus type */
133         uint            chipnum;        /* chip number */
134         uint            phytype;        /* phy type */
135         uint            phyrev;         /* phy revision */
136         uint            anarev;         /* anacore rev */
137 } wlc_rev_info_t;
138
139 typedef struct wl_country_list {
140         uint32_t buflen;
141         uint32_t band_set;
142         uint32_t band;
143         uint32_t count;
144         char country_abbrev[1];
145 } wl_country_list_t;
146
147
148 #endif