ieee80211_tdma.h revision 192468
1276485Snp/*- 2276485Snp * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting 3276485Snp * Copyright (c) 2007-2009 Intel Corporation 4276485Snp * All rights reserved. 5276485Snp * 6276485Snp * Redistribution and use in source and binary forms, with or without 7276485Snp * modification, are permitted provided that the following conditions 8276485Snp * are met: 9276485Snp * 1. Redistributions of source code must retain the above copyright 10276485Snp * notice, this list of conditions and the following disclaimer. 11276485Snp * 2. Redistributions in binary form must reproduce the above copyright 12276485Snp * notice, this list of conditions and the following disclaimer in the 13276485Snp * documentation and/or other materials provided with the distribution. 14276485Snp * 15276485Snp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16276485Snp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17276485Snp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18276485Snp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19276485Snp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20276485Snp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21276485Snp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22276485Snp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23276485Snp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24276485Snp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25276485Snp * 26276485Snp * $FreeBSD: head/sys/net80211/ieee80211_tdma.h 192468 2009-05-20 20:00:40Z sam $ 27276485Snp */ 28276485Snp#ifndef _NET80211_IEEE80211_TDMA_H_ 29276485Snp#define _NET80211_IEEE80211_TDMA_H_ 30276485Snp 31276485Snp/* 32276485Snp * TDMA-mode implementation definitions. 33276485Snp */ 34276485Snp 35276485Snp#define TDMA_SUBTYPE_PARAM 0x01 36276485Snp#define TDMA_VERSION_V2 2 37276485Snp#define TDMA_VERSION TDMA_VERSION_V2 38276485Snp 39276485Snp/* NB: we only support 2 right now but protocol handles up to 8 */ 40276485Snp#define TDMA_MAXSLOTS 2 /* max slots/sta's */ 41277226Snp 42277226Snp#define TDMA_PARAM_LEN_V2 sizeof(struct ieee80211_tdma_param) 43277226Snp 44277226Snp/* 45277226Snp * TDMA information element. 46276485Snp */ 47276485Snpstruct ieee80211_tdma_param { 48276485Snp u_int8_t tdma_id; /* IEEE80211_ELEMID_VENDOR */ 49276485Snp u_int8_t tdma_len; 50276485Snp u_int8_t tdma_oui[3]; /* TDMA_OUI */ 51276485Snp u_int8_t tdma_type; /* TDMA_OUI_TYPE */ 52276485Snp u_int8_t tdma_subtype; /* TDMA_SUBTYPE_PARAM */ 53276485Snp u_int8_t tdma_version; /* spec revision */ 54276485Snp u_int8_t tdma_slot; /* station slot # [0..7] */ 55276485Snp u_int8_t tdma_slotcnt; /* bss slot count [1..8] */ 56276485Snp u_int16_t tdma_slotlen; /* bss slot len (100us) */ 57276485Snp u_int8_t tdma_bintval; /* beacon interval (superframes) */ 58276485Snp u_int8_t tdma_inuse[1]; /* slot occupancy map */ 59276485Snp u_int8_t tdma_pad[2]; 60276485Snp u_int8_t tdma_tstamp[8]; /* timestamp from last beacon */ 61276485Snp} __packed; 62276485Snp 63276485Snp#ifdef _KERNEL 64276485Snp/* 65276485Snp * Implementation state. 66276485Snp */ 67276485Snpstruct ieee80211_tdma_state { 68276485Snp u_int tdma_slotlen; /* bss slot length (us) */ 69276485Snp uint8_t tdma_version; /* protocol version to use */ 70276485Snp uint8_t tdma_slotcnt; /* bss slot count */ 71276485Snp uint8_t tdma_bintval; /* beacon interval (slots) */ 72276485Snp uint8_t tdma_slot; /* station slot # */ 73276485Snp uint8_t tdma_inuse[1]; /* mask of slots in use */ 74276485Snp uint8_t tdma_active[1]; /* mask of active slots */ 75276485Snp int tdma_count; /* active/inuse countdown */ 76276485Snp void *tdma_peer; /* peer station cookie */ 77276485Snp struct timeval tdma_lastprint; /* time of last rate-limited printf */ 78276485Snp int tdma_fails; /* fail count for rate-limiting */ 79276485Snp 80276485Snp /* parent method pointers */ 81276485Snp int (*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state, 82276485Snp int arg); 83276485Snp void (*tdma_recv_mgmt)(struct ieee80211_node *, 84276485Snp struct mbuf *, int, int, int); 85276485Snp void (*tdma_opdetach)(struct ieee80211vap *); 86276485Snp}; 87276485Snp 88276485Snp#define TDMA_UPDATE_SLOT 0x0001 /* tdma_slot changed */ 89276485Snp#define TDMA_UPDATE_SLOTCNT 0x0002 /* tdma_slotcnt changed */ 90276485Snp#define TDMA_UPDATE_SLOTLEN 0x0004 /* tdma_slotlen changed */ 91276485Snp#define TDMA_UPDATE_BINTVAL 0x0008 /* tdma_bintval changed */ 92276485Snp 93276485Snpvoid ieee80211_tdma_vattach(struct ieee80211vap *); 94276485Snp 95276485Snpint ieee80211_tdma_getslot(struct ieee80211vap *vap); 96276485Snpvoid ieee80211_parse_tdma(struct ieee80211_node *ni, const uint8_t *ie); 97276485Snpuint8_t *ieee80211_add_tdma(uint8_t *frm, struct ieee80211vap *vap); 98276485Snpstruct ieee80211_beacon_offsets; 99276485Snpvoid ieee80211_tdma_update_beacon(struct ieee80211vap *vap, 100276485Snp struct ieee80211_beacon_offsets *bo); 101276485Snp#endif /* _KERNEL */ 102276485Snp#endif /* !_NET80211_IEEE80211_TDMA_H_ */ 103276485Snp