xref: /freebsd/contrib/wpa/src/fst/fst_iface.h (revision c1d255d3)
1325151a3SRui Paulo /*
2325151a3SRui Paulo  * FST module - FST interface object definitions
3325151a3SRui Paulo  * Copyright (c) 2014, Qualcomm Atheros, Inc.
4325151a3SRui Paulo  *
5325151a3SRui Paulo  * This software may be distributed under the terms of the BSD license.
6325151a3SRui Paulo  * See README for more details.
7325151a3SRui Paulo  */
8325151a3SRui Paulo 
9325151a3SRui Paulo 
10325151a3SRui Paulo #ifndef FST_IFACE_H
11325151a3SRui Paulo #define FST_IFACE_H
12325151a3SRui Paulo 
13325151a3SRui Paulo #include "utils/includes.h"
14325151a3SRui Paulo #include "utils/common.h"
15325151a3SRui Paulo #include "list.h"
16325151a3SRui Paulo #include "fst.h"
17325151a3SRui Paulo 
18325151a3SRui Paulo struct fst_iface {
19325151a3SRui Paulo 	struct fst_group *group;
20325151a3SRui Paulo 	struct fst_wpa_obj iface_obj;
21325151a3SRui Paulo 	u8 own_addr[ETH_ALEN];
22325151a3SRui Paulo 	struct wpabuf *mb_ie;
23325151a3SRui Paulo 	char ifname[IFNAMSIZ + 1];
24325151a3SRui Paulo 	struct fst_iface_cfg cfg;
25325151a3SRui Paulo 	struct dl_list group_lentry;
26325151a3SRui Paulo };
27325151a3SRui Paulo 
28325151a3SRui Paulo struct fst_iface * fst_iface_create(struct fst_group *g, const char *ifname,
29325151a3SRui Paulo 				    const u8 *own_addr,
30325151a3SRui Paulo 				    const struct fst_wpa_obj *iface_obj,
31325151a3SRui Paulo 				    const struct fst_iface_cfg *cfg);
32325151a3SRui Paulo void fst_iface_delete(struct fst_iface *i);
33325151a3SRui Paulo 
fst_iface_get_group(struct fst_iface * i)34325151a3SRui Paulo static inline struct fst_group * fst_iface_get_group(struct fst_iface *i)
35325151a3SRui Paulo {
36325151a3SRui Paulo 	return i->group;
37325151a3SRui Paulo }
38325151a3SRui Paulo 
fst_iface_get_name(struct fst_iface * i)39325151a3SRui Paulo static inline const char * fst_iface_get_name(struct fst_iface *i)
40325151a3SRui Paulo {
41325151a3SRui Paulo 	return i->ifname;
42325151a3SRui Paulo }
43325151a3SRui Paulo 
fst_iface_get_addr(struct fst_iface * i)44325151a3SRui Paulo static inline const u8 * fst_iface_get_addr(struct fst_iface *i)
45325151a3SRui Paulo {
46325151a3SRui Paulo 	return i->own_addr;
47325151a3SRui Paulo }
48325151a3SRui Paulo 
fst_iface_get_group_id(struct fst_iface * i)49325151a3SRui Paulo static inline const char * fst_iface_get_group_id(struct fst_iface *i)
50325151a3SRui Paulo {
51325151a3SRui Paulo 	return i->cfg.group_id;
52325151a3SRui Paulo }
53325151a3SRui Paulo 
fst_iface_get_priority(struct fst_iface * i)54325151a3SRui Paulo static inline u8 fst_iface_get_priority(struct fst_iface *i)
55325151a3SRui Paulo {
56325151a3SRui Paulo 	return i->cfg.priority;
57325151a3SRui Paulo }
58325151a3SRui Paulo 
fst_iface_get_llt(struct fst_iface * i)59325151a3SRui Paulo static inline u32 fst_iface_get_llt(struct fst_iface *i)
60325151a3SRui Paulo {
61325151a3SRui Paulo 	return i->cfg.llt;
62325151a3SRui Paulo }
63325151a3SRui Paulo 
fst_iface_get_mbie(struct fst_iface * i)64325151a3SRui Paulo static inline const struct wpabuf * fst_iface_get_mbie(struct fst_iface *i)
65325151a3SRui Paulo {
66325151a3SRui Paulo 	return i->mb_ie;
67325151a3SRui Paulo }
68325151a3SRui Paulo 
fst_iface_get_bssid(struct fst_iface * i)69325151a3SRui Paulo static inline const u8 * fst_iface_get_bssid(struct fst_iface *i)
70325151a3SRui Paulo {
71325151a3SRui Paulo 	return i->iface_obj.get_bssid(i->iface_obj.ctx);
72325151a3SRui Paulo }
73325151a3SRui Paulo 
fst_iface_get_channel_info(struct fst_iface * i,enum hostapd_hw_mode * hw_mode,u8 * channel)74325151a3SRui Paulo static inline void fst_iface_get_channel_info(struct fst_iface *i,
75325151a3SRui Paulo 					      enum hostapd_hw_mode *hw_mode,
76325151a3SRui Paulo 					      u8 *channel)
77325151a3SRui Paulo {
78325151a3SRui Paulo 	i->iface_obj.get_channel_info(i->iface_obj.ctx, hw_mode, channel);
79325151a3SRui Paulo }
80325151a3SRui Paulo 
fst_iface_get_hw_modes(struct fst_iface * i,struct hostapd_hw_modes ** modes)81325151a3SRui Paulo static inline int fst_iface_get_hw_modes(struct fst_iface *i,
82325151a3SRui Paulo 					 struct hostapd_hw_modes **modes)
83325151a3SRui Paulo {
84325151a3SRui Paulo 	return i->iface_obj.get_hw_modes(i->iface_obj.ctx, modes);
85325151a3SRui Paulo }
86325151a3SRui Paulo 
fst_iface_set_ies(struct fst_iface * i,const struct wpabuf * fst_ies)87325151a3SRui Paulo static inline void fst_iface_set_ies(struct fst_iface *i,
88325151a3SRui Paulo 				     const struct wpabuf *fst_ies)
89325151a3SRui Paulo {
90325151a3SRui Paulo 	i->iface_obj.set_ies(i->iface_obj.ctx, fst_ies);
91325151a3SRui Paulo }
92325151a3SRui Paulo 
fst_iface_send_action(struct fst_iface * i,const u8 * addr,struct wpabuf * data)93325151a3SRui Paulo static inline int fst_iface_send_action(struct fst_iface *i,
94325151a3SRui Paulo 					const u8 *addr, struct wpabuf *data)
95325151a3SRui Paulo {
96325151a3SRui Paulo 	return i->iface_obj.send_action(i->iface_obj.ctx, addr, data);
97325151a3SRui Paulo }
98325151a3SRui Paulo 
99325151a3SRui Paulo static inline const struct wpabuf *
fst_iface_get_peer_mb_ie(struct fst_iface * i,const u8 * addr)100325151a3SRui Paulo fst_iface_get_peer_mb_ie(struct fst_iface *i, const u8 *addr)
101325151a3SRui Paulo {
102325151a3SRui Paulo 	return i->iface_obj.get_mb_ie(i->iface_obj.ctx, addr);
103325151a3SRui Paulo }
104325151a3SRui Paulo 
fst_iface_update_mb_ie(struct fst_iface * i,const u8 * addr,const u8 * buf,size_t size)105325151a3SRui Paulo static inline void fst_iface_update_mb_ie(struct fst_iface *i,
106325151a3SRui Paulo 					  const u8 *addr,
107325151a3SRui Paulo 					  const u8 *buf, size_t size)
108325151a3SRui Paulo {
10985732ac8SCy Schubert 	i->iface_obj.update_mb_ie(i->iface_obj.ctx, addr, buf, size);
110325151a3SRui Paulo }
111325151a3SRui Paulo 
fst_iface_get_peer_first(struct fst_iface * i,struct fst_get_peer_ctx ** ctx,bool mb_only)112325151a3SRui Paulo static inline const u8 * fst_iface_get_peer_first(struct fst_iface *i,
113325151a3SRui Paulo 						  struct fst_get_peer_ctx **ctx,
114*c1d255d3SCy Schubert 						  bool mb_only)
115325151a3SRui Paulo {
116325151a3SRui Paulo 	return i->iface_obj.get_peer_first(i->iface_obj.ctx, ctx, mb_only);
117325151a3SRui Paulo }
118325151a3SRui Paulo 
fst_iface_get_peer_next(struct fst_iface * i,struct fst_get_peer_ctx ** ctx,bool mb_only)119325151a3SRui Paulo static inline const u8 * fst_iface_get_peer_next(struct fst_iface *i,
120325151a3SRui Paulo 						 struct fst_get_peer_ctx **ctx,
121*c1d255d3SCy Schubert 						 bool mb_only)
122325151a3SRui Paulo {
123325151a3SRui Paulo 	return i->iface_obj.get_peer_next(i->iface_obj.ctx, ctx, mb_only);
124325151a3SRui Paulo }
125325151a3SRui Paulo 
126*c1d255d3SCy Schubert bool fst_iface_is_connected(struct fst_iface *iface, const u8 *addr,
127*c1d255d3SCy Schubert 			    bool mb_only);
128325151a3SRui Paulo void fst_iface_attach_mbie(struct fst_iface *i, struct wpabuf *mbie);
129325151a3SRui Paulo enum mb_band_id fst_iface_get_band_id(struct fst_iface *i);
130325151a3SRui Paulo 
fst_iface_get_wpa_obj_ctx(struct fst_iface * i)131325151a3SRui Paulo static inline void * fst_iface_get_wpa_obj_ctx(struct fst_iface *i)
132325151a3SRui Paulo {
133325151a3SRui Paulo 	return i->iface_obj.ctx;
134325151a3SRui Paulo }
135325151a3SRui Paulo 
136325151a3SRui Paulo #endif /* FST_IFACE_H */
137