summaryrefslogtreecommitdiff
path: root/sys/net80211
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-06-16 13:17:06 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-06-16 13:17:06 +0000
commitec94a1bef7e993d9fe603d73f204d4ca10a666db (patch)
tree5020ac1511e8feab320a71788baf7c9700bc6960 /sys/net80211
parentea153cc43d871c3ad1608f57c9bcca0f138e2a74 (diff)
constify
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211.c19
-rw-r--r--sys/net80211/ieee80211_amrr.c4
-rw-r--r--sys/net80211/ieee80211_amrr.h4
-rw-r--r--sys/net80211/ieee80211_crypto.c8
-rw-r--r--sys/net80211/ieee80211_input.c17
-rw-r--r--sys/net80211/ieee80211_ioctl.c14
-rw-r--r--sys/net80211/ieee80211_node.c45
-rw-r--r--sys/net80211/ieee80211_node.h26
-rw-r--r--sys/net80211/ieee80211_proto.c17
-rw-r--r--sys/net80211/ieee80211_proto.h12
-rw-r--r--sys/net80211/ieee80211_rssadapt.c32
-rw-r--r--sys/net80211/ieee80211_rssadapt.h16
-rw-r--r--sys/net80211/ieee80211_var.h9
13 files changed, 118 insertions, 105 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 4a10b850812..605e7f9b219 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.c,v 1.22 2007/06/16 11:56:20 damien Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.23 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
@@ -197,7 +197,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags)
* Convert channel to IEEE channel number.
*/
u_int
-ieee80211_chan2ieee(struct ieee80211com *ic, struct ieee80211_channel *c)
+ieee80211_chan2ieee(struct ieee80211com *ic, const struct ieee80211_channel *c)
{
struct ifnet *ifp = &ic->ic_if;
if (ic->ic_channels <= c && c <= &ic->ic_channels[IEEE80211_CHAN_MAX])
@@ -255,7 +255,7 @@ ieee80211_media_init(struct ifnet *ifp,
struct ieee80211com *ic = (void *)ifp;
struct ifmediareq imr;
int i, j, mode, rate, maxrate, mword, mopt, r;
- struct ieee80211_rateset *rs;
+ const struct ieee80211_rateset *rs;
struct ieee80211_rateset allrates;
/*
@@ -533,7 +533,7 @@ void
ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr)
{
struct ieee80211com *ic = (void *)ifp;
- struct ieee80211_node *ni = NULL;
+ const struct ieee80211_node *ni = NULL;
imr->ifm_status = IFM_AVALID;
imr->ifm_active = IFM_IEEE80211;
@@ -592,13 +592,13 @@ ieee80211_watchdog(struct ifnet *ifp)
ifp->if_timer = 1;
}
-struct ieee80211_rateset ieee80211_std_rateset_11a =
+const struct ieee80211_rateset ieee80211_std_rateset_11a =
{ 8, { 12, 18, 24, 36, 48, 72, 96, 108 } };
-struct ieee80211_rateset ieee80211_std_rateset_11b =
+const struct ieee80211_rateset ieee80211_std_rateset_11b =
{ 4, { 2, 4, 11, 22 } };
-struct ieee80211_rateset ieee80211_std_rateset_11g =
+const struct ieee80211_rateset ieee80211_std_rateset_11g =
{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
/*
@@ -658,7 +658,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode)
IEEE80211_CHAN_FHSS, /* IEEE80211_MODE_FH */
IEEE80211_CHAN_T, /* IEEE80211_MODE_TURBO */
};
- struct ieee80211_channel *c;
+ const struct ieee80211_channel *c;
u_int modeflags;
int i;
@@ -783,7 +783,8 @@ ieee80211_next_mode(struct ifnet *ifp)
* XXX never returns turbo modes -dcy
*/
enum ieee80211_phymode
-ieee80211_chan2mode(struct ieee80211com *ic, struct ieee80211_channel *chan)
+ieee80211_chan2mode(struct ieee80211com *ic,
+ const struct ieee80211_channel *chan)
{
/*
* NB: this assumes the channel would not be supplied to us
diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c
index 8cda148c058..ad5f4e0f4e6 100644
--- a/sys/net80211/ieee80211_amrr.c
+++ b/sys/net80211/ieee80211_amrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_amrr.c,v 1.2 2006/11/26 19:46:28 deraadt Exp $ */
+/* $OpenBSD: ieee80211_amrr.c,v 1.3 2007/06/16 13:17:05 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -51,7 +51,7 @@
do { (amn)->amn_txcnt = (amn)->amn_retrycnt = 0; } while (0)
void
-ieee80211_amrr_node_init(struct ieee80211_amrr *amrr,
+ieee80211_amrr_node_init(const struct ieee80211_amrr *amrr,
struct ieee80211_amrr_node *amn)
{
amn->amn_success = 0;
diff --git a/sys/net80211/ieee80211_amrr.h b/sys/net80211/ieee80211_amrr.h
index dc2dd6147ab..8adfccb635c 100644
--- a/sys/net80211/ieee80211_amrr.h
+++ b/sys/net80211/ieee80211_amrr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_amrr.h,v 1.3 2006/06/17 19:34:31 damien Exp $ */
+/* $OpenBSD: ieee80211_amrr.h,v 1.4 2007/06/16 13:17:05 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -50,7 +50,7 @@ struct ieee80211_amrr_node {
u_int amn_retrycnt;
};
-void ieee80211_amrr_node_init(struct ieee80211_amrr *,
+void ieee80211_amrr_node_init(const struct ieee80211_amrr *,
struct ieee80211_amrr_node *);
void ieee80211_amrr_choose(struct ieee80211_amrr *, struct ieee80211_node *,
struct ieee80211_amrr_node *);
diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c
index fd7eb8a931d..dc053db2a0d 100644
--- a/sys/net80211/ieee80211_crypto.c
+++ b/sys/net80211/ieee80211_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_crypto.c,v 1.11 2007/06/16 11:56:20 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto.c,v 1.12 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung Exp $ */
/*-
@@ -67,7 +67,7 @@
#define arc4_encrypt(_c,_d,_s,_l) rc4_crypt(_c,_s,_d,_l)
void ieee80211_crc_init(void);
-u_int32_t ieee80211_crc_update(u_int32_t crc, u_int8_t *buf, int len);
+u_int32_t ieee80211_crc_update(u_int32_t, const u_int8_t *, int);
void
ieee80211_crypto_attach(struct ifnet *ifp)
@@ -318,9 +318,9 @@ ieee80211_crc_init(void)
*/
u_int32_t
-ieee80211_crc_update(u_int32_t crc, u_int8_t *buf, int len)
+ieee80211_crc_update(u_int32_t crc, const u_int8_t *buf, int len)
{
- u_int8_t *endbuf;
+ const u_int8_t *endbuf;
for (endbuf = buf + len; buf < endbuf; buf++)
crc = ieee80211_crc_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 08918813bcd..ee765768eba 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -1,5 +1,5 @@
/* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */
-/* $OpenBSD: ieee80211_input.c,v 1.25 2007/06/16 11:59:58 damien Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.26 2007/06/16 13:17:05 damien Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -69,7 +69,7 @@ const struct timeval ieee80211_merge_print_intvl = {
int ieee80211_setup_rates(struct ieee80211com *, struct ieee80211_node *,
- u_int8_t *, u_int8_t *, int);
+ const u_int8_t *, const u_int8_t *, int);
void ieee80211_auth_open(struct ieee80211com *, struct ieee80211_frame *,
struct ieee80211_node *, int, u_int32_t, u_int16_t, u_int16_t);
void ieee80211_recv_pspoll(struct ieee80211com *, struct mbuf *, int,
@@ -564,7 +564,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m)
*/
int
ieee80211_setup_rates(struct ieee80211com *ic, struct ieee80211_node *ni,
- u_int8_t *rates, u_int8_t *xrates, int flags)
+ const u_int8_t *rates, const u_int8_t *xrates, int flags)
{
struct ieee80211_rateset *rs = &ni->ni_rates;
@@ -624,8 +624,11 @@ ieee80211_setup_rates(struct ieee80211com *ic, struct ieee80211_node *ni,
#ifdef IEEE80211_DEBUG
void
+ieee80211_ssid_mismatch(struct ieee80211com *, const char *,
+ u_int8_t[IEEE80211_ADDR_LEN], const u_int8_t *);
+void
ieee80211_ssid_mismatch(struct ieee80211com *ic, const char *tag,
- u_int8_t mac[IEEE80211_ADDR_LEN], u_int8_t *ssid)
+ u_int8_t mac[IEEE80211_ADDR_LEN], const u_int8_t *ssid)
{
printf("[%s] %s req ssid mismatch: ", ether_sprintf(mac), tag);
ieee80211_print_essid(ssid + 2, ssid[1]);
@@ -920,8 +923,8 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
#define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP)
struct ifnet *ifp = &ic->ic_if;
struct ieee80211_frame *wh;
- u_int8_t *frm, *efrm;
- u_int8_t *ssid, *rates, *xrates;
+ const u_int8_t *frm, *efrm;
+ const u_int8_t *ssid, *rates, *xrates;
int is_new, reassoc, resp;
wh = mtod(m0, struct ieee80211_frame *);
@@ -930,7 +933,7 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
case IEEE80211_FC0_SUBTYPE_BEACON: {
- u_int8_t *tstamp, *bintval, *capinfo, *country;
+ const u_int8_t *tstamp, *bintval, *capinfo, *country;
u_int8_t chan, bchan, fhindex, erp;
u_int16_t fhdwell;
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index f836a44b989..b19c3a5a69e 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.17 2007/06/06 19:31:07 damien Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.18 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -54,13 +54,13 @@
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_ioctl.h>
-void ieee80211_node2req(struct ieee80211com *, struct ieee80211_node *,
- struct ieee80211_nodereq *);
-void ieee80211_req2node(struct ieee80211com *, struct ieee80211_nodereq *,
- struct ieee80211_node *);
+void ieee80211_node2req(struct ieee80211com *,
+ const struct ieee80211_node *, struct ieee80211_nodereq *);
+void ieee80211_req2node(struct ieee80211com *,
+ const struct ieee80211_nodereq *, struct ieee80211_node *);
void
-ieee80211_node2req(struct ieee80211com *ic, struct ieee80211_node *ni,
+ieee80211_node2req(struct ieee80211com *ic, const struct ieee80211_node *ni,
struct ieee80211_nodereq *nr)
{
/* Node address and name information */
@@ -102,7 +102,7 @@ ieee80211_node2req(struct ieee80211com *ic, struct ieee80211_node *ni,
}
void
-ieee80211_req2node(struct ieee80211com *ic, struct ieee80211_nodereq *nr,
+ieee80211_req2node(struct ieee80211com *ic, const struct ieee80211_nodereq *nr,
struct ieee80211_node *ni)
{
/* Node address and name information */
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 4f46661b7a0..72108d075b2 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.23 2007/06/16 11:59:58 damien Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.24 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -73,9 +73,9 @@ void ieee80211_node_free(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_copy(struct ieee80211com *, struct ieee80211_node *,
const struct ieee80211_node *);
u_int8_t ieee80211_node_getrssi(struct ieee80211com *,
- struct ieee80211_node *);
+ const struct ieee80211_node *);
void ieee80211_setup_node(struct ieee80211com *, struct ieee80211_node *,
- u_int8_t *);
+ const u_int8_t *);
void ieee80211_free_node(struct ieee80211com *, struct ieee80211_node *);
struct ieee80211_node *ieee80211_alloc_node_helper(struct ieee80211com *);
void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *);
@@ -543,18 +543,20 @@ ieee80211_node_copy(struct ieee80211com *ic,
}
u_int8_t
-ieee80211_node_getrssi(struct ieee80211com *ic, struct ieee80211_node *ni)
+ieee80211_node_getrssi(struct ieee80211com *ic,
+ const struct ieee80211_node *ni)
{
return ni->ni_rssi;
}
void
ieee80211_setup_node(struct ieee80211com *ic,
- struct ieee80211_node *ni, u_int8_t *macaddr)
+ struct ieee80211_node *ni, const u_int8_t *macaddr)
{
int s;
- IEEE80211_DPRINTF(("%s %s\n", __func__, ether_sprintf(macaddr)));
+ IEEE80211_DPRINTF(("%s %s\n", __func__,
+ ether_sprintf((u_int8_t *)macaddr)));
IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr);
ieee80211_node_newstate(ni, IEEE80211_STA_CACHE);
@@ -576,7 +578,7 @@ ieee80211_setup_node(struct ieee80211com *ic,
}
struct ieee80211_node *
-ieee80211_alloc_node(struct ieee80211com *ic, u_int8_t *macaddr)
+ieee80211_alloc_node(struct ieee80211com *ic, const u_int8_t *macaddr)
{
struct ieee80211_node *ni = ieee80211_alloc_node_helper(ic);
if (ni != NULL)
@@ -587,7 +589,7 @@ ieee80211_alloc_node(struct ieee80211com *ic, u_int8_t *macaddr)
}
struct ieee80211_node *
-ieee80211_dup_bss(struct ieee80211com *ic, u_int8_t *macaddr)
+ieee80211_dup_bss(struct ieee80211com *ic, const u_int8_t *macaddr)
{
struct ieee80211_node *ni = ieee80211_alloc_node_helper(ic);
if (ni != NULL) {
@@ -603,7 +605,7 @@ ieee80211_dup_bss(struct ieee80211com *ic, u_int8_t *macaddr)
}
struct ieee80211_node *
-ieee80211_find_node(struct ieee80211com *ic, u_int8_t *macaddr)
+ieee80211_find_node(struct ieee80211com *ic, const u_int8_t *macaddr)
{
struct ieee80211_node ni;
@@ -619,7 +621,7 @@ ieee80211_find_node(struct ieee80211com *ic, u_int8_t *macaddr)
* returning the node.
*/
struct ieee80211_node *
-ieee80211_find_txnode(struct ieee80211com *ic, u_int8_t *macaddr)
+ieee80211_find_txnode(struct ieee80211com *ic, const u_int8_t *macaddr)
{
struct ieee80211_node *ni;
int s;
@@ -685,8 +687,8 @@ ieee80211_find_txnode(struct ieee80211com *ic, u_int8_t *macaddr)
* otherwise.
*/
static __inline int
-ieee80211_needs_rxnode(struct ieee80211com *ic, struct ieee80211_frame *wh,
- u_int8_t **bssid)
+ieee80211_needs_rxnode(struct ieee80211com *ic,
+ const struct ieee80211_frame *wh, const u_int8_t **bssid)
{
struct ieee80211_node *bss = ic->ic_bss;
int monitor, rc = 0;
@@ -745,11 +747,12 @@ ieee80211_needs_rxnode(struct ieee80211com *ic, struct ieee80211_frame *wh,
* the node.
*/
struct ieee80211_node *
-ieee80211_find_rxnode(struct ieee80211com *ic, struct ieee80211_frame *wh)
+ieee80211_find_rxnode(struct ieee80211com *ic,
+ const struct ieee80211_frame *wh)
{
struct ieee80211_node *ni;
const static u_int8_t zero[IEEE80211_ADDR_LEN];
- u_int8_t *bssid;
+ const u_int8_t *bssid;
int s;
if (!ieee80211_needs_rxnode(ic, wh, &bssid))
@@ -776,14 +779,15 @@ ieee80211_find_rxnode(struct ieee80211com *ic, struct ieee80211_frame *wh)
(*ic->ic_newassoc)(ic, ni, 1);
IEEE80211_DPRINTF(("%s: faked-up node %p for %s\n", __func__, ni,
- ether_sprintf(wh->i_addr2)));
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
return ieee80211_ref_node(ni);
}
struct ieee80211_node *
-ieee80211_find_node_for_beacon(struct ieee80211com *ic, u_int8_t *macaddr,
- struct ieee80211_channel *chan, char *ssid, u_int8_t rssi)
+ieee80211_find_node_for_beacon(struct ieee80211com *ic,
+ const u_int8_t *macaddr, const struct ieee80211_channel *chan,
+ const char *ssid, u_int8_t rssi)
{
struct ieee80211_node *ni, *keep = NULL;
int s, score = 0;
@@ -913,11 +917,11 @@ ieee80211_iterate_nodes(struct ieee80211com *ic, ieee80211_iter_func *f,
* Check if the specified node supports ERP.
*/
int
-ieee80211_iserp_sta(struct ieee80211_node *ni)
+ieee80211_iserp_sta(const struct ieee80211_node *ni)
{
#define N(a) (sizeof (a) / sizeof (a)[0])
static const u_int8_t rates[] = { 2, 4, 11, 22, 12, 24, 48 };
- struct ieee80211_rateset *rs = &ni->ni_rates;
+ const struct ieee80211_rateset *rs = &ni->ni_rates;
int i, j;
/*
@@ -1126,7 +1130,8 @@ ieee80211_node_leave(struct ieee80211com *ic, struct ieee80211_node *ni)
* Compare nodes in the tree by lladdr
*/
int
-ieee80211_node_cmp(struct ieee80211_node *b1, struct ieee80211_node *b2)
+ieee80211_node_cmp(const struct ieee80211_node *b1,
+ const struct ieee80211_node *b2)
{
return (memcmp(b1->ni_macaddr, b2->ni_macaddr, IEEE80211_ADDR_LEN));
}
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
index 8713fc067b3..071fe84763d 100644
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.h,v 1.12 2007/06/07 20:24:42 damien Exp $ */
+/* $OpenBSD: ieee80211_node.h,v 1.13 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */
/*-
@@ -44,9 +44,9 @@ struct ieee80211_rateset {
u_int8_t rs_rates[IEEE80211_RATE_MAXSIZE];
};
-extern struct ieee80211_rateset ieee80211_std_rateset_11a;
-extern struct ieee80211_rateset ieee80211_std_rateset_11b;
-extern struct ieee80211_rateset ieee80211_std_rateset_11g;
+extern const struct ieee80211_rateset ieee80211_std_rateset_11a;
+extern const struct ieee80211_rateset ieee80211_std_rateset_11b;
+extern const struct ieee80211_rateset ieee80211_std_rateset_11g;
enum ieee80211_node_state {
IEEE80211_STA_CACHE, /* cached node */
@@ -174,18 +174,19 @@ extern void ieee80211_next_scan(struct ifnet *);
extern void ieee80211_end_scan(struct ifnet *);
extern void ieee80211_reset_scan(struct ifnet *);
extern struct ieee80211_node *ieee80211_alloc_node(struct ieee80211com *,
- u_int8_t *);
+ const u_int8_t *);
extern struct ieee80211_node *ieee80211_dup_bss(struct ieee80211com *,
- u_int8_t *);
+ const u_int8_t *);
extern struct ieee80211_node *ieee80211_find_node(struct ieee80211com *,
- u_int8_t *);
+ const u_int8_t *);
extern struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
- struct ieee80211_frame *);
+ const struct ieee80211_frame *);
extern struct ieee80211_node *ieee80211_find_txnode(struct ieee80211com *,
- u_int8_t *);
+ const u_int8_t *);
extern struct ieee80211_node *
ieee80211_find_node_for_beacon(struct ieee80211com *,
- u_int8_t *, struct ieee80211_channel *, char *, u_int8_t);
+ const u_int8_t *, const struct ieee80211_channel *,
+ const char *, u_int8_t);
extern struct ieee80211_node * ieee80211_lookup_node(struct ieee80211com *,
u_int8_t *, struct ieee80211_channel *);
extern void ieee80211_release_node(struct ieee80211com *,
@@ -195,7 +196,7 @@ typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
extern void ieee80211_iterate_nodes(struct ieee80211com *ic,
ieee80211_iter_func *, void *);
extern void ieee80211_clean_nodes(struct ieee80211com *);
-extern int ieee80211_iserp_sta(struct ieee80211_node *);
+extern int ieee80211_iserp_sta(const struct ieee80211_node *);
extern void ieee80211_node_join(struct ieee80211com *,
struct ieee80211_node *, int);
@@ -206,7 +207,8 @@ extern int ieee80211_match_bss(struct ieee80211com *,
extern void ieee80211_create_ibss(struct ieee80211com* ,
struct ieee80211_channel *);
-extern int ieee80211_node_cmp(struct ieee80211_node *, struct ieee80211_node *);
+extern int ieee80211_node_cmp(const struct ieee80211_node *,
+ const struct ieee80211_node *);
RB_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
#endif /* _NET80211_IEEE80211_NODE_H_ */
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 27069916f05..6156c6e83fd 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_proto.c,v 1.16 2007/06/16 11:56:20 damien Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.17 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
@@ -65,20 +65,20 @@
#define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2)
-const char *ieee80211_mgt_subtype_name[] = {
+const char * const ieee80211_mgt_subtype_name[] = {
"assoc_req", "assoc_resp", "reassoc_req", "reassoc_resp",
"probe_req", "probe_resp", "reserved#6", "reserved#7",
"beacon", "atim", "disassoc", "auth",
"deauth", "reserved#13", "reserved#14", "reserved#15"
};
-const char *ieee80211_state_name[IEEE80211_S_MAX] = {
+const char * const ieee80211_state_name[IEEE80211_S_MAX] = {
"INIT", /* IEEE80211_S_INIT */
"SCAN", /* IEEE80211_S_SCAN */
"AUTH", /* IEEE80211_S_AUTH */
"ASSOC", /* IEEE80211_S_ASSOC */
"RUN" /* IEEE80211_S_RUN */
};
-const char *ieee80211_phymode_name[] = {
+const char * const ieee80211_phymode_name[] = {
"auto", /* IEEE80211_MODE_AUTO */
"11a", /* IEEE80211_MODE_11A */
"11b", /* IEEE80211_MODE_11B */
@@ -123,10 +123,10 @@ ieee80211_proto_detach(struct ifnet *ifp)
}
void
-ieee80211_print_essid(u_int8_t *essid, int len)
+ieee80211_print_essid(const u_int8_t *essid, int len)
{
int i;
- u_int8_t *p;
+ const u_int8_t *p;
if (len > IEEE80211_NWID_LEN)
len = IEEE80211_NWID_LEN;
@@ -148,7 +148,7 @@ ieee80211_print_essid(u_int8_t *essid, int len)
}
void
-ieee80211_dump_pkt(u_int8_t *buf, int len, int rate, int rssi)
+ieee80211_dump_pkt(const u_int8_t *buf, int len, int rate, int rssi)
{
struct ieee80211_frame *wh;
int i;
@@ -214,7 +214,8 @@ ieee80211_fix_rate(struct ieee80211com *ic, struct ieee80211_node *ni,
#define RV(v) ((v) & IEEE80211_RATE_VAL)
int i, j, ignore, error;
int okrate, badrate, fixedrate;
- struct ieee80211_rateset *srs, *nrs;
+ const struct ieee80211_rateset *srs;
+ struct ieee80211_rateset *nrs;
u_int8_t r;
/*
diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h
index cb73f35283d..eabd6ab59c1 100644
--- a/sys/net80211/ieee80211_proto.h
+++ b/sys/net80211/ieee80211_proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_proto.h,v 1.13 2007/06/07 20:20:15 damien Exp $ */
+/* $OpenBSD: ieee80211_proto.h,v 1.14 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */
/*-
@@ -49,8 +49,9 @@ enum ieee80211_state {
#define IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \
((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg))
-extern const char *ieee80211_mgt_subtype_name[];
-extern const char *ieee80211_phymode_name[];
+extern const char * const ieee80211_mgt_subtype_name[];
+extern const char * const ieee80211_state_name[IEEE80211_S_MAX];
+extern const char * const ieee80211_phymode_name[];
extern void ieee80211_proto_attach(struct ifnet *);
extern void ieee80211_proto_detach(struct ifnet *);
@@ -83,12 +84,11 @@ extern u_int8_t *ieee80211_add_xrates(u_int8_t *frm,
const struct ieee80211_rateset *);
extern u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
extern u_int8_t *ieee80211_add_erp(u_int8_t *, struct ieee80211com *);
-extern void ieee80211_print_essid(u_int8_t *, int);
-extern void ieee80211_dump_pkt(u_int8_t *, int, int, int);
+extern void ieee80211_print_essid(const u_int8_t *, int);
+extern void ieee80211_dump_pkt(const u_int8_t *, int, int, int);
extern int ieee80211_ibss_merge(struct ieee80211com *,
struct ieee80211_node *, u_int64_t);
extern void ieee80211_reset_erp(struct ieee80211com *);
extern void ieee80211_set_shortslottime(struct ieee80211com *, int);
-extern const char *ieee80211_state_name[IEEE80211_S_MAX];
#endif /* _NET80211_IEEE80211_PROTO_H_ */
diff --git a/sys/net80211/ieee80211_rssadapt.c b/sys/net80211/ieee80211_rssadapt.c
index 1d85d0fbe8b..1bb268bca12 100644
--- a/sys/net80211/ieee80211_rssadapt.c
+++ b/sys/net80211/ieee80211_rssadapt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_rssadapt.c,v 1.5 2006/11/26 19:46:28 deraadt Exp $ */
+/* $OpenBSD: ieee80211_rssadapt.c,v 1.6 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_rssadapt.c,v 1.7 2004/05/25 04:33:59 dyoung Exp $ */
/*-
@@ -84,8 +84,8 @@ static struct ieee80211_rssadapt_expavgctl master_expavgctl = {
int
ieee80211_rssadapt_choose(struct ieee80211_rssadapt *ra,
- struct ieee80211_rateset *rs, struct ieee80211_frame *wh, u_int len,
- int fixed_rate, const char *dvname, int do_not_adapt)
+ const struct ieee80211_rateset *rs, const struct ieee80211_frame *wh,
+ u_int len, int fixed_rate, const char *dvname, int do_not_adapt)
{
u_int16_t (*thrs)[IEEE80211_RATE_SIZE];
int flags = 0, i, rateidx = 0, thridx, top;
@@ -127,7 +127,7 @@ out:
#ifdef IEEE80211_DEBUG
if (ieee80211_rssadapt_debug && dvname != NULL) {
printf("%s: dst %s threshold[%d, %d.%d] %d < %d\n",
- dvname, ether_sprintf(wh->i_addr1), len,
+ dvname, ether_sprintf((u_int8_t *)wh->i_addr1), len,
(rs->rs_rates[rateidx] & IEEE80211_RATE_VAL) / 2,
(rs->rs_rates[rateidx] & IEEE80211_RATE_VAL) * 5 % 10,
(*thrs)[rateidx], ra->ra_avg_rssi);
@@ -154,8 +154,8 @@ ieee80211_rssadapt_updatestats(struct ieee80211_rssadapt *ra)
}
void
-ieee80211_rssadapt_input(struct ieee80211com *ic, struct ieee80211_node *ni,
- struct ieee80211_rssadapt *ra, int rssi)
+ieee80211_rssadapt_input(struct ieee80211com *ic,
+ const struct ieee80211_node *ni, struct ieee80211_rssadapt *ra, int rssi)
{
#ifdef IEEE80211_DEBUG
int last_avg_rssi = ra->ra_avg_rssi;
@@ -165,7 +165,7 @@ ieee80211_rssadapt_input(struct ieee80211com *ic, struct ieee80211_node *ni,
ra->ra_avg_rssi, (rssi << 8));
RSSADAPT_PRINTF(("%s: src %s rssi %d avg %d -> %d\n",
- ic->ic_if.if_xname, ether_sprintf(ni->ni_macaddr),
+ ic->ic_if.if_xname, ether_sprintf((u_int8_t *)ni->ni_macaddr),
rssi, last_avg_rssi, ra->ra_avg_rssi));
}
@@ -177,10 +177,10 @@ ieee80211_rssadapt_input(struct ieee80211com *ic, struct ieee80211_node *ni,
*/
void
ieee80211_rssadapt_lower_rate(struct ieee80211com *ic,
- struct ieee80211_node *ni, struct ieee80211_rssadapt *ra,
- struct ieee80211_rssdesc *id)
+ const struct ieee80211_node *ni, struct ieee80211_rssadapt *ra,
+ const struct ieee80211_rssdesc *id)
{
- struct ieee80211_rateset *rs = &ni->ni_rates;
+ const struct ieee80211_rateset *rs = &ni->ni_rates;
u_int16_t last_thr;
u_int i, thridx, top;
@@ -189,7 +189,7 @@ ieee80211_rssadapt_lower_rate(struct ieee80211com *ic,
if (id->id_rateidx >= rs->rs_nrates) {
RSSADAPT_PRINTF(("ieee80211_rssadapt_lower_rate: "
"%s rate #%d > #%d out of bounds\n",
- ether_sprintf(ni->ni_macaddr), id->id_rateidx,
+ ether_sprintf((u_int8_t *)ni->ni_macaddr), id->id_rateidx,
rs->rs_nrates - 1));
return;
}
@@ -208,7 +208,7 @@ ieee80211_rssadapt_lower_rate(struct ieee80211com *ic,
(id->id_rssi << 8));
RSSADAPT_PRINTF(("%s: dst %s rssi %d threshold[%d, %d.%d] %d -> %d\n",
- ic->ic_if.if_xname, ether_sprintf(ni->ni_macaddr),
+ ic->ic_if.if_xname, ether_sprintf((u_int8_t *)ni->ni_macaddr),
id->id_rssi, id->id_len,
(rs->rs_rates[id->id_rateidx] & IEEE80211_RATE_VAL) / 2,
(rs->rs_rates[id->id_rateidx] & IEEE80211_RATE_VAL) * 5 % 10,
@@ -217,11 +217,11 @@ ieee80211_rssadapt_lower_rate(struct ieee80211com *ic,
void
ieee80211_rssadapt_raise_rate(struct ieee80211com *ic,
- struct ieee80211_rssadapt *ra, struct ieee80211_rssdesc *id)
+ struct ieee80211_rssadapt *ra, const struct ieee80211_rssdesc *id)
{
u_int16_t (*thrs)[IEEE80211_RATE_SIZE], newthr, oldthr;
- struct ieee80211_node *ni = id->id_node;
- struct ieee80211_rateset *rs = &ni->ni_rates;
+ const struct ieee80211_node *ni = id->id_node;
+ const struct ieee80211_rateset *rs = &ni->ni_rates;
int i, rate, top;
#ifdef IEEE80211_DEBUG
int j;
@@ -262,7 +262,7 @@ ieee80211_rssadapt_raise_rate(struct ieee80211com *ic,
#ifdef IEEE80211_DEBUG
if (RSSADAPT_DO_PRINT()) {
printf("%s: dst %s thresholds\n", ic->ic_if.if_xname,
- ether_sprintf(ni->ni_macaddr));
+ ether_sprintf((u_int8_t *)ni->ni_macaddr));
for (i = 0; i < IEEE80211_RSSADAPT_BKTS; i++) {
printf("%d-byte", IEEE80211_RSSADAPT_BKT0 <<
(IEEE80211_RSSADAPT_BKTPOWER * i));
diff --git a/sys/net80211/ieee80211_rssadapt.h b/sys/net80211/ieee80211_rssadapt.h
index 983c813a780..67b92e67749 100644
--- a/sys/net80211/ieee80211_rssadapt.h
+++ b/sys/net80211/ieee80211_rssadapt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_rssadapt.h,v 1.3 2006/06/17 19:26:00 damien Exp $ */
+/* $OpenBSD: ieee80211_rssadapt.h,v 1.4 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_rssadapt.h,v 1.3 2004/05/06 03:03:20 dyoung Exp $ */
/*-
@@ -89,16 +89,16 @@ struct ieee80211_rssdesc {
};
void ieee80211_rssadapt_updatestats(struct ieee80211_rssadapt *);
-void ieee80211_rssadapt_input(struct ieee80211com *, struct ieee80211_node *,
- struct ieee80211_rssadapt *, int);
+void ieee80211_rssadapt_input(struct ieee80211com *,
+ const struct ieee80211_node *, struct ieee80211_rssadapt *, int);
void ieee80211_rssadapt_lower_rate(struct ieee80211com *,
- struct ieee80211_node *, struct ieee80211_rssadapt *,
- struct ieee80211_rssdesc *);
+ const struct ieee80211_node *, struct ieee80211_rssadapt *,
+ const struct ieee80211_rssdesc *);
void ieee80211_rssadapt_raise_rate(struct ieee80211com *,
- struct ieee80211_rssadapt *, struct ieee80211_rssdesc *);
+ struct ieee80211_rssadapt *, const struct ieee80211_rssdesc *);
int ieee80211_rssadapt_choose(struct ieee80211_rssadapt *,
- struct ieee80211_rateset *, struct ieee80211_frame *, u_int, int,
- const char *, int);
+ const struct ieee80211_rateset *, const struct ieee80211_frame *,
+ u_int, int, const char *, int);
#ifdef IEEE80211_DEBUG
extern int ieee80211_rssadapt_debug;
#endif /* IEEE80211_DEBUG */
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 2b3937d1dda..393592ab371 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_var.h,v 1.21 2007/06/11 19:35:24 damien Exp $ */
+/* $OpenBSD: ieee80211_var.h,v 1.22 2007/06/16 13:17:05 damien Exp $ */
/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
/*-
@@ -199,7 +199,7 @@ struct ieee80211com {
struct ieee80211_node *,
const struct ieee80211_node *);
u_int8_t (*ic_node_getrssi)(struct ieee80211com *,
- struct ieee80211_node *);
+ const struct ieee80211_node *);
u_int8_t ic_max_rssi;
struct ieee80211_tree ic_tree;
int ic_nnodes; /* length of ic_nnodes */
@@ -288,12 +288,13 @@ int ieee80211_rate2media(struct ieee80211com *, int,
enum ieee80211_phymode);
int ieee80211_media2rate(int);
u_int ieee80211_mhz2ieee(u_int, u_int);
-u_int ieee80211_chan2ieee(struct ieee80211com *, struct ieee80211_channel *);
+u_int ieee80211_chan2ieee(struct ieee80211com *,
+ const struct ieee80211_channel *);
u_int ieee80211_ieee2mhz(u_int, u_int);
int ieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode);
enum ieee80211_phymode ieee80211_next_mode(struct ifnet *);
enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *,
- struct ieee80211_channel *);
+ const struct ieee80211_channel *);
#ifdef IEEE80211_DEBUG
extern int ieee80211_debug;