summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h
blob: 16632d3b9c4c372bd7db4362613f6bcc0d25c4a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/*-
 * Copyright (c) 2010 The FreeBSD Foundation
 * All rights reserved.
 *
 * This software was developed by Shteryana Sotirova Shopova under
 * sponsorship from the FreeBSD Foundation.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#define	WLAN_IFMODE_MAX				WlanIfaceOperatingModeType_tdma
#define	WLAN_COUNTRY_CODE_SIZE			3
#define	WLAN_BGSCAN_IDLE_MIN			100 /* XXX */
#define	WLAN_SCAN_VALID_MIN			10 /* XXX */
#define	WLAN_TDMA_MAXSLOTS			2 /* XXX */

struct wlan_iface;

struct wlan_peer {
	uint8_t				pmac[IEEE80211_ADDR_LEN]; /* key */
	uint16_t			associd;
	uint16_t			vlan;
	uint16_t			frequency;
	uint32_t			fflags;
	uint8_t				txrate;
	int8_t				rssi;
	uint16_t			idle;
	uint16_t			txseqs;
	uint16_t			rxseqs;
	uint16_t			txpower;
	uint8_t				capinfo;
	uint32_t			state;
	uint16_t			local_id;
	uint16_t			peer_id;
	SLIST_ENTRY(wlan_peer)		wp;
};

SLIST_HEAD(wlan_peerlist, wlan_peer);

struct wlan_scan_result {
	uint8_t				ssid[IEEE80211_NWID_LEN + 1];
	uint8_t				bssid[IEEE80211_ADDR_LEN];
	uint8_t				opchannel;
	int8_t				rssi;
	uint16_t			frequency;
	int8_t				noise;
	uint16_t			bintval;
	uint8_t				capinfo;
	struct wlan_iface		*pwif;
	SLIST_ENTRY(wlan_scan_result)	wsr;
};

SLIST_HEAD(wlan_scanlist, wlan_scan_result);

struct wlan_mac_mac {
	uint8_t				mac[IEEE80211_ADDR_LEN];
	enum RowStatus			mac_status;
	SLIST_ENTRY(wlan_mac_mac)	wm;
};

SLIST_HEAD(wlan_maclist, wlan_mac_mac);

struct wlan_mesh_route {
	struct ieee80211req_mesh_route	imroute;
	enum RowStatus			mroute_status;
	SLIST_ENTRY(wlan_mesh_route)	wr;
};

SLIST_HEAD(wlan_mesh_routes, wlan_mesh_route);

struct wlan_iface {
	char				wname[IFNAMSIZ];
	uint32_t			index;
	char				pname[IFNAMSIZ];
	enum WlanIfaceOperatingModeType	mode;
	uint32_t			flags;
	uint8_t				dbssid[IEEE80211_ADDR_LEN];
	uint8_t				dlmac[IEEE80211_ADDR_LEN];
	enum RowStatus			status;
	enum wlanIfaceState		state;
	uint8_t				internal;

	uint32_t			drivercaps;
	uint32_t			cryptocaps;
	uint32_t			htcaps;

	uint32_t			packet_burst;
	uint8_t				country_code[WLAN_COUNTRY_CODE_SIZE];
	enum WlanRegDomainCode		reg_domain;
	uint8_t				desired_ssid[IEEE80211_NWID_LEN + 1];
	uint32_t			desired_channel;
	enum TruthValue			dyn_frequency;
	enum TruthValue			fast_frames;
	enum TruthValue			dturbo;
	int32_t				tx_power;
	int32_t				frag_threshold;
	int32_t				rts_threshold;
	enum TruthValue			priv_subscribe;
	enum TruthValue			bg_scan;
	int32_t				bg_scan_idle;
	int32_t				bg_scan_interval;
	int32_t				beacons_missed;
	uint8_t				desired_bssid[IEEE80211_ADDR_LEN];
	enum wlanIfaceRoamingMode	roam_mode;
	enum TruthValue			dot11d;
	enum TruthValue			dot11h;
	enum TruthValue			dynamic_wds;
	enum TruthValue			power_save;
	enum TruthValue			ap_bridge;
	int32_t				beacon_interval;
	int32_t				dtim_period;
	enum TruthValue			hide_ssid;
	enum TruthValue			inact_process;
	enum wlanIfaceDot11gProtMode	do11g_protect;
	enum TruthValue			dot11g_pure;
	enum TruthValue			dot11n_pure;
	enum WlanIfaceDot11nPduType	ampdu;
	int32_t				ampdu_density;
	int32_t				ampdu_limit;
	enum WlanIfaceDot11nPduType	amsdu;
	int32_t				amsdu_limit;
	enum TruthValue			ht_enabled;
	enum TruthValue			ht_compatible;
	enum wlanIfaceDot11nHTProtMode	ht_prot_mode;
	enum TruthValue			rifs;
	enum TruthValue			short_gi;
	enum wlanIfaceDot11nSMPSMode	smps_mode;
	int32_t				tdma_slot;
	int32_t				tdma_slot_count;
	int32_t				tdma_slot_length;
	int32_t				tdma_binterval;

	struct wlan_peerlist		peerlist;
	struct ieee80211_stats		stats;
	uint32_t			nchannels;
	struct ieee80211_channel	*chanlist;
	struct ieee80211_roamparams_req	roamparams;
	struct ieee80211_txparams_req	txparams;

	uint32_t			scan_flags;
	uint32_t			scan_duration;
	uint32_t			scan_mindwell;
	uint32_t			scan_maxdwell;
	enum wlanScanConfigStatus	scan_status;
	struct wlan_scanlist		scanlist;

	uint8_t				wepsupported;
	enum wlanWepMode		wepmode;
	int32_t				weptxkey;

	uint8_t				macsupported;
	enum wlanMACAccessControlPolicy	mac_policy;
	uint32_t			mac_nacls;
	struct wlan_maclist		mac_maclist;

	uint32_t			mesh_ttl;
	enum TruthValue			mesh_peering;
	enum TruthValue			mesh_forwarding;
	enum wlanMeshMetric		mesh_metric;
	enum wlanMeshPath		mesh_path;
	enum wlanHWMPRootMode		hwmp_root_mode;
	uint32_t			hwmp_max_hops;
	struct wlan_mesh_routes		mesh_routelist;
		
	SLIST_ENTRY(wlan_iface)		w_if;
};

enum wlan_syscl {
	WLAN_MESH_RETRY_TO = 0,
	WLAN_MESH_HOLDING_TO,
	WLAN_MESH_CONFIRM_TO,
	WLAN_MESH_MAX_RETRIES,
	WLAN_HWMP_TARGET_ONLY,
	WLAN_HWMP_REPLY_FORWARD,
	WLAN_HWMP_PATH_LIFETIME,
	WLAN_HWMP_ROOT_TO,
	WLAN_HWMP_ROOT_INT,
	WLAN_HWMP_RANN_INT,
	WLAN_HWMP_INACTIVITY_TO,
	WLAN_SYSCTL_MAX
};

struct wlan_config {
	int32_t				mesh_retryto;
	int32_t				mesh_holdingto;
	int32_t				mesh_confirmto;
	int32_t				mesh_maxretries;
	int32_t				hwmp_targetonly;
	int32_t				hwmp_replyforward;
	int32_t				hwmp_pathlifetime;
	int32_t				hwmp_roottimeout;
	int32_t				hwmp_rootint;
	int32_t				hwmp_rannint;
	int32_t				hwmp_inact;
};

int wlan_ioctl_init(void);
int wlan_kmodules_load(void);
int wlan_check_media(char *);
int wlan_config_state(struct wlan_iface *, uint8_t);
int wlan_get_opmode(struct wlan_iface *wif);
int wlan_get_local_addr(struct wlan_iface *wif);
int wlan_get_parent(struct wlan_iface *wif);
int wlan_get_driver_caps(struct wlan_iface *wif);
uint8_t wlan_channel_state_to_snmp(uint8_t cstate);
uint32_t wlan_channel_flags_to_snmp(uint32_t cflags);
int wlan_get_channel_list(struct wlan_iface *wif);
int wlan_get_roam_params(struct wlan_iface *wif);
int wlan_get_tx_params(struct wlan_iface *wif);
int wlan_set_tx_params(struct wlan_iface *wif, int32_t pmode);
int wlan_clone_create(struct wlan_iface *);
int wlan_clone_destroy(struct wlan_iface *wif);
int wlan_config_get_dssid(struct wlan_iface *wif);
int wlan_config_set_dssid(struct wlan_iface *wif, char *ssid, int slen);
int wlan_config_get_ioctl(struct wlan_iface *wif, int which);
int wlan_config_set_ioctl(struct wlan_iface *wif, int which, int val,
    char *strval, int len);
int wlan_set_scan_config(struct wlan_iface *wif);
int wlan_get_scan_results(struct wlan_iface *wif);
int wlan_get_stats(struct wlan_iface *wif);
int wlan_get_wepmode(struct wlan_iface *wif);
int wlan_set_wepmode(struct wlan_iface *wif);
int wlan_get_weptxkey(struct wlan_iface *wif);
int wlan_set_weptxkey(struct wlan_iface *wif);
int wlan_get_wepkeys(struct wlan_iface *wif);
int wlan_set_wepkeys(struct wlan_iface *wif);
int wlan_get_mac_policy(struct wlan_iface *wif);
int wlan_set_mac_policy(struct wlan_iface *wif);
int wlan_flush_mac_mac(struct wlan_iface *wif);
int wlan_get_mac_acl_macs(struct wlan_iface *wif);
int wlan_add_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);
int wlan_del_mac_acl_mac(struct wlan_iface *wif, struct wlan_mac_mac *mmac);

int32_t wlan_do_sysctl(struct wlan_config *cfg, enum wlan_syscl which, int set);
int wlan_mesh_config_get(struct wlan_iface *wif, int which);
int wlan_mesh_config_set(struct wlan_iface *wif, int which);
int wlan_mesh_flush_routes(struct wlan_iface *wif);
int wlan_mesh_add_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
int wlan_mesh_del_route(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
int wlan_mesh_get_routelist(struct wlan_iface *wif);
int wlan_hwmp_config_get(struct wlan_iface *wif, int which);
int wlan_hwmp_config_set(struct wlan_iface *wif, int which);

/* XXX: static */

int wlan_peer_set_vlan(struct wlan_iface *wif, struct wlan_peer *wip, int vlan);
int wlan_get_peerinfo(struct wlan_iface *wif);

/* XXX*/
struct wlan_peer *wlan_new_peer(const uint8_t *pmac);
void wlan_free_peer(struct wlan_peer *wip);
int wlan_add_peer(struct wlan_iface *wif, struct wlan_peer *wip);

struct wlan_scan_result * wlan_scan_new_result(const uint8_t *ssid,
    const uint8_t *bssid);
void wlan_scan_free_result(struct wlan_scan_result *sr);
int wlan_scan_add_result(struct wlan_iface *wif, struct wlan_scan_result *sr);

struct wlan_mac_mac *wlan_mac_new_mac(const uint8_t *mac);
void wlan_mac_free_mac(struct wlan_mac_mac *wmm);
int wlan_mac_add_mac(struct wlan_iface *wif, struct wlan_mac_mac *wmm);

struct wlan_mesh_route *wlan_mesh_new_route(const uint8_t *dstmac);
int wlan_mesh_add_rtentry(struct wlan_iface *wif, struct wlan_mesh_route *wmr);
void wlan_mesh_free_route(struct wlan_mesh_route *wmr);
OpenPOWER on IntegriCloud