if_wi_hostap.h revision 1.5
1/*	$OpenBSD: if_wi_hostap.h,v 1.5 2002/04/26 22:19:07 millert Exp $	*/
2
3/*
4 * Copyright (c) 2002
5 *	Thomas Skibo <skibo@pacbell.net>.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by Thomas Skibo.
18 * 4. Neither the name of the author nor the names of any co-contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY Thomas Skibo AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL Thomas Skibo OR HIS DRINKING PALS
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD: $
35 */
36
37#ifndef __WI_HOSTAP_H__
38#define __WI_HOSTAP_H__
39
40#define WIHAP_MAX_STATIONS	1800
41
42struct hostap_sta {
43	u_int8_t	addr[6];
44	u_int16_t	asid;
45	u_int16_t	flags;
46	u_int16_t	sig_info;	/* 15:8 signal, 7:0 noise */
47	u_int16_t	capinfo;
48	u_int8_t	rates;
49};
50
51#define HOSTAP_FLAGS_AUTHEN	0x0001
52#define HOSTAP_FLAGS_ASSOC	0x0002
53#define HOSTAP_FLAGS_PERM	0x0004
54#define	HOSTAP_FLAGS_BITS	"\20\01ASSOC\02AUTH\03PERM"
55
56#define SIOCHOSTAP_GET		_IOWR('i', 210, struct ifreq)
57#define SIOCHOSTAP_ADD		_IOWR('i', 211, struct ifreq)
58#define SIOCHOSTAP_DEL		_IOWR('i', 212, struct ifreq)
59#define SIOCHOSTAP_GETALL	_IOWR('i', 213, struct ifreq)
60#define SIOCHOSTAP_GFLAGS	_IOWR('i', 214, struct ifreq)
61#define SIOCHOSTAP_SFLAGS	_IOWR('i', 215, struct ifreq)
62
63/* Flags for SIOCHOSTAP_GFLAGS/SFLAGS */
64#define WIHAPFL_ACTIVE		0x0001
65#define WIHAPFL_MAC_FILT	0x0002
66
67/* Flags set inernally only: */
68#define WIHAPFL_CANTCHANGE	(WIHAPFL_ACTIVE)
69
70struct hostap_getall {
71	int		nstations;
72	struct hostap_sta *addr;
73	int		size;
74};
75
76
77
78#ifdef _KERNEL
79struct wihap_sta_info {
80	LIST_ENTRY(wihap_sta_info) list;
81	LIST_ENTRY(wihap_sta_info) hash;
82
83	struct wi_softc	*sc;
84	u_int8_t	addr[6];
85	u_short		flags;
86	struct timeout	tmo;
87
88	u_int16_t	asid;
89	u_int16_t	capinfo;
90	u_int16_t	sig_info;	/* 15:8 signal, 7:0 noise */
91	u_int8_t	rates;
92	u_int8_t	tx_curr_rate;
93	u_int8_t	tx_max_rate;
94	u_int32_t	*challenge;
95};
96
97#define WI_SIFLAGS_ASSOC	HOSTAP_FLAGS_ASSOC
98#define WI_SIFLAGS_AUTHEN	HOSTAP_FLAGS_AUTHEN
99#define WI_SIFLAGS_PERM		HOSTAP_FLAGS_PERM
100
101#define WI_STA_HASH_SIZE	113
102
103#if WI_STA_HASH_SIZE*16 >= 2007 /* will generate ASID's too large. */
104#error "WI_STA_HASH_SIZE too big"
105#endif
106#if WI_STA_HASH_SIZE*16 < WIHAP_MAX_STATIONS
107#error "WI_STA_HASH_SIZE too small"
108#endif
109
110struct wihap_info {
111	LIST_HEAD(sta_list, wihap_sta_info)	sta_list;
112	LIST_HEAD(sta_hash, wihap_sta_info)	sta_hash[WI_STA_HASH_SIZE];
113
114	u_int16_t		apflags;
115
116	int			n_stations;
117	u_int16_t		asid_inuse_mask[WI_STA_HASH_SIZE];
118
119	int			inactivity_time;
120};
121
122#define WIHAP_DFLT_INACTIVITY_TIME	(120) /* 2 minutes */
123
124struct wi_softc;
125struct wi_frame;
126
127void wihap_mgmt_input		__P((struct wi_softc *, struct wi_frame *,
128				     struct mbuf *));
129int  wihap_data_input		__P((struct wi_softc *, struct wi_frame *,
130				     struct mbuf *));
131int  wihap_check_tx		__P((struct wihap_info *, u_int8_t [],
132				     u_int8_t *));
133void wihap_init			__P((struct wi_softc *));
134void wihap_shutdown		__P((struct wi_softc *));
135int  wihap_ioctl		__P((struct wi_softc *, u_long, caddr_t));
136
137#endif /* _KERNEL */
138#endif /* __WI_HOSTAP_H__ */
139