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