2 * FST module - auxiliary definitions
3 * Copyright (c) 2014, Qualcomm Atheros, Inc.
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
10 #define FST_INTERNAL_H
12 #include "utils/includes.h"
13 #include "utils/common.h"
14 #include "common/defs.h"
15 #include "common/ieee802_11_defs.h"
16 #include "fst/fst_iface.h"
17 #include "fst/fst_group.h"
18 #include "fst/fst_session.h"
20 #define fst_printf(level, format, ...) \
21 wpa_printf((level), "FST: " format, ##__VA_ARGS__)
23 #define fst_printf_group(group, level, format, ...) \
24 wpa_printf((level), "FST: %s: " format, \
25 fst_group_get_id(group), ##__VA_ARGS__)
27 #define fst_printf_iface(iface, level, format, ...) \
28 fst_printf_group(fst_iface_get_group(iface), (level), "%s: " format, \
29 fst_iface_get_name(iface), ##__VA_ARGS__)
31 static inline enum mb_band_id
32 fst_hw_mode_to_band(enum hostapd_hw_mode mode)
35 case HOSTAPD_MODE_IEEE80211B:
36 case HOSTAPD_MODE_IEEE80211G:
37 return MB_BAND_ID_WIFI_2_4GHZ;
38 case HOSTAPD_MODE_IEEE80211A:
39 return MB_BAND_ID_WIFI_5GHZ;
40 case HOSTAPD_MODE_IEEE80211AD:
41 return MB_BAND_ID_WIFI_60GHZ;
44 return MB_BAND_ID_WIFI_2_4GHZ;
48 #define IE_HEADER_SIZE ((u8) (2 * sizeof(u8)))
49 #define IE_BUFFER_LENGTH(ie_len_val) ((size_t) ((ie_len_val) + IE_HEADER_SIZE))
51 static inline const u8 *
52 fst_mbie_get_peer_addr(const struct multi_band_ie *mbie)
54 const u8 *peer_addr = NULL;
56 switch (MB_CTRL_ROLE(mbie->mb_ctrl)) {
58 peer_addr = mbie->bssid;
60 case MB_STA_ROLE_NON_PCP_NON_AP:
61 if (mbie->mb_ctrl & MB_CTRL_STA_MAC_PRESENT &&
62 IE_BUFFER_LENGTH(mbie->len) >= sizeof(*mbie) + ETH_ALEN)
63 peer_addr = (const u8 *) &mbie[1];
72 struct fst_ctrl_handle {
74 struct dl_list global_ctrls_lentry;
77 extern struct dl_list fst_global_ctrls_list;
79 #define foreach_fst_ctrl_call(clb, ...) \
81 struct fst_ctrl_handle *__fst_ctrl_h; \
82 dl_list_for_each(__fst_ctrl_h, &fst_global_ctrls_list, \
83 struct fst_ctrl_handle, global_ctrls_lentry) \
84 if (__fst_ctrl_h->ctrl.clb) \
85 __fst_ctrl_h->ctrl.clb(__VA_ARGS__);\
88 #endif /* FST_INTERNAL_H */