this must not be included by drivers.
-/* $OpenBSD: ieee80211.c,v 1.31 2008/04/26 20:03:34 damien Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.32 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#ifdef IEEE80211_DEBUG
int ieee80211_debug = 0;
-/* $OpenBSD: ieee80211.h,v 1.35 2008/04/16 18:32:15 damien Exp $ */
+/* $OpenBSD: ieee80211.h,v 1.36 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
/*-
* number may be overridden by the driver and/or by
* user configuration.
*/
-#define IEEE80211_AID_MAX 2007
-#define IEEE80211_AID_DEF 1800
-
-#define IEEE80211_AID(b) ((b) &~ 0xc000)
-#define IEEE80211_AID_SET(b, w) \
- ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
-#define IEEE80211_AID_CLR(b, w) \
- ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
-#define IEEE80211_AID_ISSET(b, w) \
- ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
+#define IEEE80211_AID_MAX 2007
+#define IEEE80211_AID_DEF 1800
+#define IEEE80211_AID(b) ((b) &~ 0xc000)
/*
* RTS frame length parameters. The default is specified in
-/* $OpenBSD: ieee80211_amrr.c,v 1.3 2007/06/16 13:17:05 damien Exp $ */
+/* $OpenBSD: ieee80211_amrr.c,v 1.4 2008/07/21 19:27:26 damien Exp $ */
/*-
* Copyright (c) 2006
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#include <net80211/ieee80211_amrr.h>
#define is_success(amn) \
-/* $OpenBSD: ieee80211_crypto.c,v 1.42 2008/06/16 18:32:04 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto.c,v 1.43 2008/07/21 19:27:26 damien Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#include <dev/rndvar.h>
#include <crypto/arc4.h>
memcpy(pmkid, hash, IEEE80211_PMKID_LEN);
}
-/* unaligned big endian access */
-#define BE_READ_2(p) \
- ((u_int16_t) \
- ((((const u_int8_t *)(p))[0] << 8) | \
- (((const u_int8_t *)(p))[1])))
-
-#define BE_WRITE_2(p, v) do { \
- ((u_int8_t *)(p))[0] = (v) >> 8; \
- ((u_int8_t *)(p))[1] = (v) & 0xff; \
-} while (0)
-
/*
* Compute the Key MIC field of an EAPOL-Key frame using the specified Key
* Confirmation Key (KCK). The hash function can be either HMAC-MD5 or
/* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */
-/* $OpenBSD: ieee80211_input.c,v 1.82 2008/07/21 19:05:21 damien Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.83 2008/07/21 19:27:26 damien Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
int ieee80211_parse_edca_params_body(struct ieee80211com *,
const u_int8_t *);
return m;
}
-/* unaligned little endian access */
-#define LE_READ_2(p) \
- ((u_int16_t) \
- ((((const u_int8_t *)(p))[0]) | \
- (((const u_int8_t *)(p))[1] << 8)))
-#define LE_READ_4(p) \
- ((u_int32_t) \
- ((((const u_int8_t *)(p))[0]) | \
- (((const u_int8_t *)(p))[1] << 8) | \
- (((const u_int8_t *)(p))[2] << 16) | \
- (((const u_int8_t *)(p))[3] << 24)))
-
/*
* Parse an EDCA Parameter Set element (see 7.3.2.27).
*/
-/* $OpenBSD: ieee80211_node.c,v 1.34 2008/06/09 07:07:16 djm Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.35 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#include <dev/rndvar.h>
-/* $OpenBSD: ieee80211_output.c,v 1.60 2008/07/21 19:05:21 damien Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.61 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
enum ieee80211_edca_ac ieee80211_up_to_ac(struct ieee80211com *, int);
int ieee80211_classify(struct ieee80211com *, struct mbuf *);
return NULL;
}
-/* unaligned little endian access */
-#define LE_WRITE_2(p, v) do { \
- ((u_int8_t *)(p))[0] = (v) & 0xff; \
- ((u_int8_t *)(p))[1] = (v) >> 8; \
-} while (0)
-
/*
* Add a Capability Information field to a frame (see 7.3.1.4).
*/
+/* $OpenBSD: ieee80211_pae_input.c,v 1.2 2008/07/21 19:27:26 damien Exp $ */
+
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
*
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#include <dev/rndvar.h>
void ieee80211_recv_eapol_key_req(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
-/* unaligned big endian access */
-#define BE_READ_2(p) \
- ((u_int16_t)(p)[0] << 8 | (u_int16_t)(p)[1])
-
-#define BE_READ_8(p) \
- ((u_int64_t)(p)[0] << 56 | (u_int64_t)(p)[1] << 48 | \
- (u_int64_t)(p)[2] << 40 | (u_int64_t)(p)[3] << 32 | \
- (u_int64_t)(p)[4] << 24 | (u_int64_t)(p)[5] << 16 | \
- (u_int64_t)(p)[6] << 8 | (u_int64_t)(p)[7])
-
-/* unaligned little endian access */
-#define LE_READ_6(p) \
- ((u_int64_t)(p)[5] << 40 | (u_int64_t)(p)[4] << 32 | \
- (u_int64_t)(p)[3] << 24 | (u_int64_t)(p)[2] << 16 | \
- (u_int64_t)(p)[1] << 8 | (u_int64_t)(p)[0])
-
/*
* Process an incoming EAPOL frame. Notice that we are only interested in
* EAPOL-Key frames with an IEEE 802.11 or WPA descriptor type.
-/* $OpenBSD: ieee80211_pae_output.c,v 1.1 2008/07/21 19:05:21 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_output.c,v 1.2 2008/07/21 19:27:26 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
int ieee80211_send_eapol_key(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, const struct ieee80211_ptk *);
u_int8_t *ieee80211_add_pmkid_kde(u_int8_t *, const u_int8_t *);
struct mbuf *ieee80211_get_eapol_key(int, int, u_int);
-/* unaligned big endian access */
-#define BE_READ_2(p) \
- ((u_int16_t)(p)[0] << 8 | (u_int16_t)(p)[1])
-
-#define BE_WRITE_2(p, v) do { \
- (p)[0] = (v) >> 8; (p)[1] = (v); \
-} while (0)
-
-#define BE_WRITE_8(p, v) do { \
- (p)[0] = (v) >> 56; (p)[1] = (v) >> 48; \
- (p)[2] = (v) >> 40; (p)[3] = (v) >> 32; \
- (p)[4] = (v) >> 24; (p)[5] = (v) >> 16; \
- (p)[6] = (v) >> 8; (p)[7] = (v); \
-} while (0)
-
-/* unaligned little endian access */
-#define LE_WRITE_6(p, v) do { \
- (p)[5] = (v) >> 40; (p)[4] = (v) >> 32; \
- (p)[3] = (v) >> 24; (p)[2] = (v) >> 16; \
- (p)[1] = (v) >> 8; (p)[0] = (v); \
-} while (0)
-
/*
* Send an EAPOL-Key frame to node `ni'. If MIC or encryption is required,
* the PTK must be passed (otherwise it can be set to NULL.)
--- /dev/null
+/* $OpenBSD: ieee80211_priv.h,v 1.1 2008/07/21 19:27:26 damien Exp $ */
+
+/*-
+ * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NET80211_IEEE80211_PRIV_H_
+#define _NET80211_IEEE80211_PRIV_H_
+
+#ifdef IEEE80211_DEBUG
+extern int ieee80211_debug;
+#define IEEE80211_DPRINTF(X) do { if (ieee80211_debug) printf X; } while(0)
+#define IEEE80211_DPRINTF2(X) do { if (ieee80211_debug>1) printf X; } while(0)
+#else
+#define IEEE80211_DPRINTF(X)
+#define IEEE80211_DPRINTF2(X)
+#endif
+
+#define IEEE80211_AID_SET(b, w) \
+ ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
+#define IEEE80211_AID_CLR(b, w) \
+ ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
+#define IEEE80211_AID_ISSET(b, w) \
+ ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
+
+/* unaligned big endian access */
+#define BE_READ_2(p) \
+ ((u_int16_t) \
+ ((((const u_int8_t *)(p))[0] << 8) | \
+ (((const u_int8_t *)(p))[1])))
+
+#define BE_READ_8(p) \
+ ((u_int64_t)(p)[0] << 56 | (u_int64_t)(p)[1] << 48 | \
+ (u_int64_t)(p)[2] << 40 | (u_int64_t)(p)[3] << 32 | \
+ (u_int64_t)(p)[4] << 24 | (u_int64_t)(p)[5] << 16 | \
+ (u_int64_t)(p)[6] << 8 | (u_int64_t)(p)[7])
+
+#define BE_WRITE_2(p, v) do { \
+ ((u_int8_t *)(p))[0] = (v) >> 8; \
+ ((u_int8_t *)(p))[1] = (v) & 0xff; \
+} while (0)
+
+#define BE_WRITE_8(p, v) do { \
+ (p)[0] = (v) >> 56; (p)[1] = (v) >> 48; \
+ (p)[2] = (v) >> 40; (p)[3] = (v) >> 32; \
+ (p)[4] = (v) >> 24; (p)[5] = (v) >> 16; \
+ (p)[6] = (v) >> 8; (p)[7] = (v); \
+} while (0)
+
+/* unaligned little endian access */
+#define LE_READ_2(p) \
+ ((u_int16_t) \
+ ((((const u_int8_t *)(p))[0]) | \
+ (((const u_int8_t *)(p))[1] << 8)))
+
+#define LE_READ_4(p) \
+ ((u_int32_t) \
+ ((((const u_int8_t *)(p))[0]) | \
+ (((const u_int8_t *)(p))[1] << 8) | \
+ (((const u_int8_t *)(p))[2] << 16) | \
+ (((const u_int8_t *)(p))[3] << 24)))
+
+#define LE_READ_6(p) \
+ ((u_int64_t)(p)[5] << 40 | (u_int64_t)(p)[4] << 32 | \
+ (u_int64_t)(p)[3] << 24 | (u_int64_t)(p)[2] << 16 | \
+ (u_int64_t)(p)[1] << 8 | (u_int64_t)(p)[0])
+
+#define LE_WRITE_2(p, v) do { \
+ ((u_int8_t *)(p))[0] = (v) & 0xff; \
+ ((u_int8_t *)(p))[1] = (v) >> 8; \
+} while (0)
+
+#define LE_WRITE_4(p, v) do { \
+ (p)[3] = (v) >> 24; (p)[2] = (v) >> 16; \
+ (p)[1] = (v) >> 8; (p)[0] = (v); \
+} while (0)
+
+#define LE_WRITE_6(p, v) do { \
+ (p)[5] = (v) >> 40; (p)[4] = (v) >> 32; \
+ (p)[3] = (v) >> 24; (p)[2] = (v) >> 16; \
+ (p)[1] = (v) >> 8; (p)[0] = (v); \
+} while (0)
+
+#endif /* _NET80211_IEEE80211_PRIV_H_ */
-/* $OpenBSD: ieee80211_proto.c,v 1.25 2008/07/21 18:43:18 damien Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.26 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
#endif
#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_priv.h>
#include <dev/rndvar.h>
-/* $OpenBSD: ieee80211_var.h,v 1.39 2008/07/21 18:43:18 damien Exp $ */
+/* $OpenBSD: ieee80211_var.h,v 1.40 2008/07/21 19:27:26 damien Exp $ */
/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
/*-
enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *,
const struct ieee80211_channel *);
-#ifdef IEEE80211_DEBUG
-extern int ieee80211_debug;
-#define IEEE80211_DPRINTF(X) do { if (ieee80211_debug) printf X; } while(0)
-#define IEEE80211_DPRINTF2(X) do { if (ieee80211_debug>1) printf X; } while(0)
-#else
-#define IEEE80211_DPRINTF(X)
-#define IEEE80211_DPRINTF2(X)
-#endif
-
extern int ieee80211_cache_size;
#endif /* _NET80211_IEEE80211_VAR_H_ */