1*325151a3SRui Paulo /* 2*325151a3SRui Paulo * FST module - FST interface object definitions 3*325151a3SRui Paulo * Copyright (c) 2014, Qualcomm Atheros, Inc. 4*325151a3SRui Paulo * 5*325151a3SRui Paulo * This software may be distributed under the terms of the BSD license. 6*325151a3SRui Paulo * See README for more details. 7*325151a3SRui Paulo */ 8*325151a3SRui Paulo 9*325151a3SRui Paulo 10*325151a3SRui Paulo #ifndef FST_IFACE_H 11*325151a3SRui Paulo #define FST_IFACE_H 12*325151a3SRui Paulo 13*325151a3SRui Paulo #include "utils/includes.h" 14*325151a3SRui Paulo #include "utils/common.h" 15*325151a3SRui Paulo #include "list.h" 16*325151a3SRui Paulo #include "fst.h" 17*325151a3SRui Paulo 18*325151a3SRui Paulo struct fst_iface { 19*325151a3SRui Paulo struct fst_group *group; 20*325151a3SRui Paulo struct fst_wpa_obj iface_obj; 21*325151a3SRui Paulo u8 own_addr[ETH_ALEN]; 22*325151a3SRui Paulo struct wpabuf *mb_ie; 23*325151a3SRui Paulo char ifname[IFNAMSIZ + 1]; 24*325151a3SRui Paulo struct fst_iface_cfg cfg; 25*325151a3SRui Paulo struct dl_list group_lentry; 26*325151a3SRui Paulo }; 27*325151a3SRui Paulo 28*325151a3SRui Paulo struct fst_iface * fst_iface_create(struct fst_group *g, const char *ifname, 29*325151a3SRui Paulo const u8 *own_addr, 30*325151a3SRui Paulo const struct fst_wpa_obj *iface_obj, 31*325151a3SRui Paulo const struct fst_iface_cfg *cfg); 32*325151a3SRui Paulo void fst_iface_delete(struct fst_iface *i); 33*325151a3SRui Paulo 34*325151a3SRui Paulo static inline struct fst_group * fst_iface_get_group(struct fst_iface *i) 35*325151a3SRui Paulo { 36*325151a3SRui Paulo return i->group; 37*325151a3SRui Paulo } 38*325151a3SRui Paulo 39*325151a3SRui Paulo static inline const char * fst_iface_get_name(struct fst_iface *i) 40*325151a3SRui Paulo { 41*325151a3SRui Paulo return i->ifname; 42*325151a3SRui Paulo } 43*325151a3SRui Paulo 44*325151a3SRui Paulo static inline const u8 * fst_iface_get_addr(struct fst_iface *i) 45*325151a3SRui Paulo { 46*325151a3SRui Paulo return i->own_addr; 47*325151a3SRui Paulo } 48*325151a3SRui Paulo 49*325151a3SRui Paulo static inline const char * fst_iface_get_group_id(struct fst_iface *i) 50*325151a3SRui Paulo { 51*325151a3SRui Paulo return i->cfg.group_id; 52*325151a3SRui Paulo } 53*325151a3SRui Paulo 54*325151a3SRui Paulo static inline u8 fst_iface_get_priority(struct fst_iface *i) 55*325151a3SRui Paulo { 56*325151a3SRui Paulo return i->cfg.priority; 57*325151a3SRui Paulo } 58*325151a3SRui Paulo 59*325151a3SRui Paulo static inline u32 fst_iface_get_llt(struct fst_iface *i) 60*325151a3SRui Paulo { 61*325151a3SRui Paulo return i->cfg.llt; 62*325151a3SRui Paulo } 63*325151a3SRui Paulo 64*325151a3SRui Paulo static inline const struct wpabuf * fst_iface_get_mbie(struct fst_iface *i) 65*325151a3SRui Paulo { 66*325151a3SRui Paulo return i->mb_ie; 67*325151a3SRui Paulo } 68*325151a3SRui Paulo 69*325151a3SRui Paulo static inline const u8 * fst_iface_get_bssid(struct fst_iface *i) 70*325151a3SRui Paulo { 71*325151a3SRui Paulo return i->iface_obj.get_bssid(i->iface_obj.ctx); 72*325151a3SRui Paulo } 73*325151a3SRui Paulo 74*325151a3SRui Paulo static inline void fst_iface_get_channel_info(struct fst_iface *i, 75*325151a3SRui Paulo enum hostapd_hw_mode *hw_mode, 76*325151a3SRui Paulo u8 *channel) 77*325151a3SRui Paulo { 78*325151a3SRui Paulo i->iface_obj.get_channel_info(i->iface_obj.ctx, hw_mode, channel); 79*325151a3SRui Paulo } 80*325151a3SRui Paulo 81*325151a3SRui Paulo static inline int fst_iface_get_hw_modes(struct fst_iface *i, 82*325151a3SRui Paulo struct hostapd_hw_modes **modes) 83*325151a3SRui Paulo { 84*325151a3SRui Paulo return i->iface_obj.get_hw_modes(i->iface_obj.ctx, modes); 85*325151a3SRui Paulo } 86*325151a3SRui Paulo 87*325151a3SRui Paulo static inline void fst_iface_set_ies(struct fst_iface *i, 88*325151a3SRui Paulo const struct wpabuf *fst_ies) 89*325151a3SRui Paulo { 90*325151a3SRui Paulo i->iface_obj.set_ies(i->iface_obj.ctx, fst_ies); 91*325151a3SRui Paulo } 92*325151a3SRui Paulo 93*325151a3SRui Paulo static inline int fst_iface_send_action(struct fst_iface *i, 94*325151a3SRui Paulo const u8 *addr, struct wpabuf *data) 95*325151a3SRui Paulo { 96*325151a3SRui Paulo return i->iface_obj.send_action(i->iface_obj.ctx, addr, data); 97*325151a3SRui Paulo } 98*325151a3SRui Paulo 99*325151a3SRui Paulo static inline const struct wpabuf * 100*325151a3SRui Paulo fst_iface_get_peer_mb_ie(struct fst_iface *i, const u8 *addr) 101*325151a3SRui Paulo { 102*325151a3SRui Paulo return i->iface_obj.get_mb_ie(i->iface_obj.ctx, addr); 103*325151a3SRui Paulo } 104*325151a3SRui Paulo 105*325151a3SRui Paulo static inline void fst_iface_update_mb_ie(struct fst_iface *i, 106*325151a3SRui Paulo const u8 *addr, 107*325151a3SRui Paulo const u8 *buf, size_t size) 108*325151a3SRui Paulo { 109*325151a3SRui Paulo return i->iface_obj.update_mb_ie(i->iface_obj.ctx, addr, buf, size); 110*325151a3SRui Paulo } 111*325151a3SRui Paulo 112*325151a3SRui Paulo static inline const u8 * fst_iface_get_peer_first(struct fst_iface *i, 113*325151a3SRui Paulo struct fst_get_peer_ctx **ctx, 114*325151a3SRui Paulo Boolean mb_only) 115*325151a3SRui Paulo { 116*325151a3SRui Paulo return i->iface_obj.get_peer_first(i->iface_obj.ctx, ctx, mb_only); 117*325151a3SRui Paulo } 118*325151a3SRui Paulo 119*325151a3SRui Paulo static inline const u8 * fst_iface_get_peer_next(struct fst_iface *i, 120*325151a3SRui Paulo struct fst_get_peer_ctx **ctx, 121*325151a3SRui Paulo Boolean mb_only) 122*325151a3SRui Paulo { 123*325151a3SRui Paulo return i->iface_obj.get_peer_next(i->iface_obj.ctx, ctx, mb_only); 124*325151a3SRui Paulo } 125*325151a3SRui Paulo 126*325151a3SRui Paulo Boolean fst_iface_is_connected(struct fst_iface *iface, const u8 *addr); 127*325151a3SRui Paulo void fst_iface_attach_mbie(struct fst_iface *i, struct wpabuf *mbie); 128*325151a3SRui Paulo enum mb_band_id fst_iface_get_band_id(struct fst_iface *i); 129*325151a3SRui Paulo 130*325151a3SRui Paulo static inline void * fst_iface_get_wpa_obj_ctx(struct fst_iface *i) 131*325151a3SRui Paulo { 132*325151a3SRui Paulo return i->iface_obj.ctx; 133*325151a3SRui Paulo } 134*325151a3SRui Paulo 135*325151a3SRui Paulo #endif /* FST_IFACE_H */ 136