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