1 /* $NetBSD: ieee80211_sysctl.h,v 1.9 2009/10/19 23:19:39 rmind Exp $ */
2 /*-
3  * Copyright (c) 2005 David Young.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or
6  * without modification, are permitted provided that the following
7  * conditions are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  *    copyright notice, this list of conditions and the following
12  *    disclaimer in the documentation and/or other materials provided
13  *    with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
19  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
26  * OF SUCH DAMAGE.
27  */
28 #ifndef _NET80211_IEEE80211_SYSCTL_H_
29 #define _NET80211_IEEE80211_SYSCTL_H_
30 
31 #include <net80211/_ieee80211.h>
32 
33 /* sysctl(9) interface to net80211 client/peer records */
34 
35 /* Name index, offset from net.link.ieee80211.node. */
36 
37 #define   IEEE80211_SYSCTL_NODENAME_IF            0
38 #define   IEEE80211_SYSCTL_NODENAME_OP            1
39 #define   IEEE80211_SYSCTL_NODENAME_ARG           2
40 #define   IEEE80211_SYSCTL_NODENAME_TYPE                    3
41 #define   IEEE80211_SYSCTL_NODENAME_ELTSIZE       4
42 #define   IEEE80211_SYSCTL_NODENAME_ELTCOUNT      5
43 #define   IEEE80211_SYSCTL_NODENAMELEN            6
44 
45 /* Record type numbers. */
46 #define   IEEE80211_SYSCTL_T_NODE                 0         /* client/peer record */
47 #define   IEEE80211_SYSCTL_T_RSSADAPT   1         /* rssadapt(9) record
48                                                              * (optional)
49                                                              */
50 #define   IEEE80211_SYSCTL_T_DRVSPEC    2         /* driver-specific record
51                                                              * (optional)
52                                                              */
53 
54 #define   IEEE80211_SYSCTL_OP_ALL                 0
55 
56 /* Every record begins with this information. */
57 struct ieee80211_node_sysctlhdr {
58 /*00*/    u_int16_t sh_ifindex;
59 /*02*/    u_int8_t  sh_macaddr[IEEE80211_ADDR_LEN];
60 /*08*/    u_int8_t  sh_bssid[IEEE80211_ADDR_LEN];
61 };
62 
63 /* Exportable node. */
64 struct ieee80211_node_sysctl {
65 /*00*/    u_int16_t ns_ifindex;
66 /*02*/    u_int8_t  ns_macaddr[IEEE80211_ADDR_LEN];
67 /*08*/    u_int8_t  ns_bssid[IEEE80211_ADDR_LEN];
68 /*0e*/    u_int16_t ns_capinfo;         /* capabilities */
69 /*10*/    u_int32_t ns_flags; /* properties of this node,
70                                                    * IEEE80211_NODE_SYSCTL_F_*
71                                                    */
72 /*14*/    u_int16_t ns_freq;
73 /*16*/    u_int16_t ns_chanflags;
74 /*18*/    u_int16_t ns_chanidx;
75 /*1a*/    u_int8_t  ns_rssi;  /* recv ssi */
76 /*1b*/    u_int8_t  ns_esslen;
77 /*1c*/    u_int8_t  ns_essid[IEEE80211_NWID_LEN];
78 /*3c*/    u_int8_t  ns_rsvd0; /* reserved */
79 /*3d*/    u_int8_t  ns_erp;             /* 11g only */
80 /*3e*/    u_int16_t ns_associd;         /* assoc response */
81 /*40*/    u_int32_t ns_inact; /* inactivity mark count */
82 /*44*/    u_int32_t ns_rstamp;          /* recv timestamp */
83 /*48*/    struct ieee80211_rateset ns_rates;      /* negotiated rate set */
84 /*58*/    u_int16_t ns_txrate;          /* index to ns_rates[] */
85 /*5a*/    u_int16_t ns_intval;          /* beacon interval */
86 /*5c*/    u_int8_t  ns_tstamp[8];       /* from last rcv'd beacon */
87 /*64*/    u_int16_t ns_txseq; /* seq to be transmitted */
88 /*66*/    u_int16_t ns_rxseq; /* seq previous received */
89 /*68*/    u_int16_t ns_fhdwell;         /* FH only */
90 /*6a*/    u_int8_t  ns_fhindex;         /* FH only */
91 /*6b*/    u_int8_t  ns_fails; /* failure count to associate */
92 /*6c*/
93 #ifdef notyet
94           /* DTIM and contention free period (CFP) */
95           u_int8_t  ns_dtimperiod;
96           u_int8_t  ns_cfpperiod;       /* # of DTIMs between CFPs */
97           u_int16_t ns_cfpduremain;     /* remaining cfp duration */
98           u_int16_t ns_cfpmaxduration;/* max CFP duration in TU */
99           u_int16_t ns_nextdtim;        /* time to next DTIM */
100           u_int16_t ns_timoffset;
101 #endif
102 } __packed;
103 
104 #ifdef __NetBSD__
105 enum ieee80211_node_walk_state {
106           IEEE80211_WALK_BSS = 0,
107           IEEE80211_WALK_SCAN,
108           IEEE80211_WALK_STA
109 };
110 
111 struct ieee80211_node_walk {
112           struct ieee80211com           *nw_ic;
113           struct ieee80211_node_table   *nw_nt;
114           struct ieee80211_node                   *nw_ni;
115           u_short                                 nw_ifindex;
116 };
117 #endif /* __NetBSD__ */
118 
119 #define   IEEE80211_NODE_SYSCTL_F_BSS   0x00000001          /* this node is the
120                                                                        * ic->ic_bss
121                                                                        */
122 #define   IEEE80211_NODE_SYSCTL_F_STA   0x00000002          /* this node is in
123                                                                        * the neighbor/sta
124                                                                        * table
125                                                                        */
126 #define   IEEE80211_NODE_SYSCTL_F_SCAN  0x00000004          /* this node is in
127                                                                        * the scan table
128                                                                        */
129 #endif /* !_NET80211_IEEE80211_SYSCTL_H_ */
130