1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2007-2009 Intel Corporation
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30 #ifndef _NET80211_IEEE80211_TDMA_H_
31 #define _NET80211_IEEE80211_TDMA_H_
32
33 /*
34 * TDMA-mode implementation definitions.
35 */
36
37 #define TDMA_SUBTYPE_PARAM 0x01
38 #define TDMA_VERSION_V2 2
39 #define TDMA_VERSION TDMA_VERSION_V2
40
41 /* NB: we only support 2 right now but protocol handles up to 8 */
42 #define TDMA_MAXSLOTS 2 /* max slots/sta's */
43
44 #define TDMA_PARAM_LEN_V2 sizeof(struct ieee80211_tdma_param)
45
46 /*
47 * TDMA information element.
48 */
49 struct ieee80211_tdma_param {
50 u_int8_t tdma_id; /* IEEE80211_ELEMID_VENDOR */
51 u_int8_t tdma_len;
52 u_int8_t tdma_oui[3]; /* TDMA_OUI */
53 u_int8_t tdma_type; /* TDMA_OUI_TYPE */
54 u_int8_t tdma_subtype; /* TDMA_SUBTYPE_PARAM */
55 u_int8_t tdma_version; /* spec revision */
56 u_int8_t tdma_slot; /* station slot # [0..7] */
57 u_int8_t tdma_slotcnt; /* bss slot count [1..8] */
58 u_int16_t tdma_slotlen; /* bss slot len (100us) */
59 u_int8_t tdma_bintval; /* beacon interval (superframes) */
60 u_int8_t tdma_inuse[1]; /* slot occupancy map */
61 u_int8_t tdma_pad[2];
62 u_int8_t tdma_tstamp[8]; /* timestamp from last beacon */
63 } __packed;
64
65 #ifdef _KERNEL
66 /*
67 * Implementation state.
68 */
69 struct ieee80211_tdma_state {
70 u_int tdma_slotlen; /* bss slot length (us) */
71 uint8_t tdma_version; /* protocol version to use */
72 uint8_t tdma_slotcnt; /* bss slot count */
73 uint8_t tdma_bintval; /* beacon interval (slots) */
74 uint8_t tdma_slot; /* station slot # */
75 uint8_t tdma_inuse[1]; /* mask of slots in use */
76 uint8_t tdma_active[1]; /* mask of active slots */
77 int tdma_count; /* active/inuse countdown */
78 void *tdma_peer; /* peer station cookie */
79 struct timeval tdma_lastprint; /* time of last rate-limited printf */
80 int tdma_fails; /* fail count for rate-limiting */
81
82 /* parent method pointers */
83 int (*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state,
84 int arg);
85 void (*tdma_recv_mgmt)(struct ieee80211_node *,
86 struct mbuf *, int,
87 const struct ieee80211_rx_stats *rxs, int, int);
88 void (*tdma_opdetach)(struct ieee80211vap *);
89 };
90
91 #define TDMA_UPDATE_SLOT 0x0001 /* tdma_slot changed */
92 #define TDMA_UPDATE_SLOTCNT 0x0002 /* tdma_slotcnt changed */
93 #define TDMA_UPDATE_SLOTLEN 0x0004 /* tdma_slotlen changed */
94 #define TDMA_UPDATE_BINTVAL 0x0008 /* tdma_bintval changed */
95
96 void ieee80211_tdma_vattach(struct ieee80211vap *);
97
98 int ieee80211_tdma_getslot(struct ieee80211vap *vap);
99 void ieee80211_parse_tdma(struct ieee80211_node *ni, const uint8_t *ie);
100 uint8_t *ieee80211_add_tdma(uint8_t *frm, struct ieee80211vap *vap);
101 struct ieee80211_beacon_offsets;
102 void ieee80211_tdma_update_beacon(struct ieee80211vap *vap,
103 struct ieee80211_beacon_offsets *bo);
104 #endif /* _KERNEL */
105 #endif /* !_NET80211_IEEE80211_TDMA_H_ */
Cache object: f8f950a7e260827c6c31ed3c1fd2b1fe
|