ieee80211_tdma.h revision 190455
113240Sprr/*-
213240Sprr * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
313240Sprr * Copyright (c) 2007-2009 Intel Corporation
413240Sprr * All rights reserved.
513240Sprr *
613240Sprr * Redistribution and use in source and binary forms, with or without
713240Sprr * modification, are permitted provided that the following conditions
813240Sprr * are met:
913240Sprr * 1. Redistributions of source code must retain the above copyright
1013240Sprr *    notice, this list of conditions and the following disclaimer.
1113240Sprr * 2. Redistributions in binary form must reproduce the above copyright
1213240Sprr *    notice, this list of conditions and the following disclaimer in the
1313240Sprr *    documentation and/or other materials provided with the distribution.
1413240Sprr *
1513240Sprr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1613240Sprr * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1713240Sprr * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1813240Sprr * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1913240Sprr * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2013240Sprr * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2113240Sprr * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2213240Sprr * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2313240Sprr * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2413240Sprr * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2513240Sprr *
2613240Sprr * $FreeBSD: head/sys/net80211/ieee80211_tdma.h 190455 2009-03-26 21:29:03Z sam $
2713240Sprr */
2813240Sprr#ifndef _NET80211_IEEE80211_TDMA_H_
2913240Sprr#define _NET80211_IEEE80211_TDMA_H_
3013240Sprr
3113240Sprr/*
3213240Sprr * TDMA-mode implementation definitions.
3313240Sprr */
3413240Sprr
3513240Sprr#define	TDMA_SUBTYPE_PARAM	0x01
3613240Sprr#define	TDMA_VERSION_V2		2
3713240Sprr#define	TDMA_VERSION		TDMA_VERSION_V2
3813240Sprr
3913240Sprr/* NB: we only support 2 right now but protocol handles up to 8 */
4013240Sprr#define	TDMA_MAXSLOTS		2	/* max slots/sta's */
4113240Sprr
4213240Sprr#define	TDMA_PARAM_LEN_V2	sizeof(struct ieee80211_tdma_param)
4313240Sprr
4413240Sprr/*
4513240Sprr * TDMA information element.
4613240Sprr */
4713240Sprrstruct ieee80211_tdma_param {
4813240Sprr	u_int8_t	tdma_id;	/* IEEE80211_ELEMID_VENDOR */
4913240Sprr	u_int8_t	tdma_len;
5013240Sprr	u_int8_t	tdma_oui[3];	/* TDMA_OUI */
5113240Sprr	u_int8_t	tdma_type;	/* TDMA_OUI_TYPE */
5213240Sprr	u_int8_t	tdma_subtype;	/* TDMA_SUBTYPE_PARAM */
5313240Sprr	u_int8_t	tdma_version;	/* spec revision */
5413240Sprr	u_int8_t	tdma_slot;	/* station slot # [0..7] */
5513240Sprr	u_int8_t	tdma_slotcnt;	/* bss slot count [1..8] */
5613240Sprr	u_int16_t	tdma_slotlen;	/* bss slot len (100us) */
5713240Sprr	u_int8_t	tdma_bintval;	/* beacon interval (superframes) */
5813240Sprr	u_int8_t	tdma_inuse[1];	/* slot occupancy map */
5913240Sprr	u_int8_t	tdma_pad[2];
6013240Sprr	u_int8_t	tdma_tstamp[8];	/* timestamp from last beacon */
6113240Sprr} __packed;
6213240Sprr
6313240Sprr#ifdef _KERNEL
6413240Sprr/*
6513240Sprr * Implementation state.
6613240Sprr */
6713240Sprrstruct ieee80211_tdma_state {
6813240Sprr	u_int	tdma_slotlen;		/* bss slot length (us) */
6913240Sprr	uint8_t	tdma_version;		/* protocol version to use */
7013240Sprr	uint8_t	tdma_slotcnt;		/* bss slot count */
7113240Sprr	uint8_t	tdma_bintval;		/* beacon interval (slots) */
7213240Sprr	uint8_t	tdma_slot;		/* station slot # */
7313240Sprr	uint8_t	tdma_inuse[1];		/* mask of slots in use */
7413240Sprr	uint8_t	tdma_active[1];		/* mask of active slots */
7513240Sprr	int	tdma_count;		/* active/inuse countdown */
7613240Sprr	void	*tdma_peer;		/* peer station cookie */
7713240Sprr	struct timeval tdma_lastprint;	/* time of last rate-limited printf */
7813240Sprr	int	tdma_fails;		/* fail count for rate-limiting */
7913240Sprr
8013240Sprr	/* parent method pointers */
8113240Sprr	int	(*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state,
8213240Sprr		    int arg);
8313240Sprr	void	(*tdma_recv_mgmt)(struct ieee80211_node *,
8413240Sprr		    struct mbuf *, int, int, int, uint32_t);
8513240Sprr	void	(*tdma_opdetach)(struct ieee80211vap *);
8613240Sprr};
8713240Sprr
8813240Sprr#define	TDMA_UPDATE_SLOT	0x0001	/* tdma_slot changed */
8913240Sprr#define	TDMA_UPDATE_SLOTCNT	0x0002	/* tdma_slotcnt changed */
9013240Sprr#define	TDMA_UPDATE_SLOTLEN	0x0004	/* tdma_slotlen changed */
9113240Sprr#define	TDMA_UPDATE_BINTVAL	0x0008	/* tdma_bintval changed */
9213240Sprr
9313240Sprrvoid	ieee80211_tdma_vattach(struct ieee80211vap *);
9413240Sprr
9513240Sprrint	ieee80211_tdma_getslot(struct ieee80211vap *vap);
9613240Sprrvoid	ieee80211_parse_tdma(struct ieee80211_node *ni, const uint8_t *ie);
9713240Sprruint8_t *ieee80211_add_tdma(uint8_t *frm, struct ieee80211vap *vap);
9813240Sprrstruct ieee80211_beacon_offsets;
9913240Sprrvoid	ieee80211_tdma_update_beacon(struct ieee80211vap *vap,
10013240Sprr	    struct ieee80211_beacon_offsets *bo);
10113240Sprr#endif /* _KERNEL */
10213240Sprr#endif /* !_NET80211_IEEE80211_TDMA_H_ */
10313240Sprr