xref: /dflybsd-src/contrib/wpa_supplicant/src/fst/fst_group.h (revision 3a84a4273475ed07d0ab1c2dfeffdfedef35d9cd)
1*a1157835SDaniel Fojt /*
2*a1157835SDaniel Fojt  * FST module - FST group object definitions
3*a1157835SDaniel Fojt  * Copyright (c) 2014, Qualcomm Atheros, Inc.
4*a1157835SDaniel Fojt  *
5*a1157835SDaniel Fojt  * This software may be distributed under the terms of the BSD license.
6*a1157835SDaniel Fojt  * See README for more details.
7*a1157835SDaniel Fojt  */
8*a1157835SDaniel Fojt 
9*a1157835SDaniel Fojt #ifndef FST_GROUP_H
10*a1157835SDaniel Fojt #define FST_GROUP_H
11*a1157835SDaniel Fojt 
12*a1157835SDaniel Fojt struct fst_group {
13*a1157835SDaniel Fojt 	char group_id[IFNAMSIZ + 1];
14*a1157835SDaniel Fojt 	struct dl_list ifaces;
15*a1157835SDaniel Fojt 	u8 dialog_token;
16*a1157835SDaniel Fojt 	u32 fsts_id;
17*a1157835SDaniel Fojt 	struct dl_list global_groups_lentry;
18*a1157835SDaniel Fojt };
19*a1157835SDaniel Fojt 
20*a1157835SDaniel Fojt struct session_transition_ie;
21*a1157835SDaniel Fojt 
22*a1157835SDaniel Fojt #define foreach_fst_group_iface(g, i) \
23*a1157835SDaniel Fojt 	dl_list_for_each((i), &(g)->ifaces, struct fst_iface, group_lentry)
24*a1157835SDaniel Fojt 
25*a1157835SDaniel Fojt struct fst_group * fst_group_create(const char *group_id);
26*a1157835SDaniel Fojt void fst_group_attach_iface(struct fst_group *g, struct fst_iface *i);
27*a1157835SDaniel Fojt void fst_group_detach_iface(struct fst_group *g, struct fst_iface *i);
28*a1157835SDaniel Fojt void fst_group_delete(struct fst_group *g);
29*a1157835SDaniel Fojt 
30*a1157835SDaniel Fojt void fst_group_update_ie(struct fst_group *g);
31*a1157835SDaniel Fojt 
fst_group_has_ifaces(struct fst_group * g)32*a1157835SDaniel Fojt static inline Boolean fst_group_has_ifaces(struct fst_group *g)
33*a1157835SDaniel Fojt {
34*a1157835SDaniel Fojt 	return !dl_list_empty(&g->ifaces);
35*a1157835SDaniel Fojt }
36*a1157835SDaniel Fojt 
fst_group_first_iface(struct fst_group * g)37*a1157835SDaniel Fojt static inline struct fst_iface * fst_group_first_iface(struct fst_group *g)
38*a1157835SDaniel Fojt {
39*a1157835SDaniel Fojt 	return dl_list_first(&g->ifaces, struct fst_iface, group_lentry);
40*a1157835SDaniel Fojt }
41*a1157835SDaniel Fojt 
fst_group_get_id(struct fst_group * g)42*a1157835SDaniel Fojt static inline const char * fst_group_get_id(struct fst_group *g)
43*a1157835SDaniel Fojt {
44*a1157835SDaniel Fojt 	return g->group_id;
45*a1157835SDaniel Fojt }
46*a1157835SDaniel Fojt 
47*a1157835SDaniel Fojt Boolean fst_group_delete_if_empty(struct fst_group *group);
48*a1157835SDaniel Fojt struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
49*a1157835SDaniel Fojt 					       const char *ifname);
50*a1157835SDaniel Fojt struct fst_iface *
51*a1157835SDaniel Fojt fst_group_get_peer_other_connection(struct fst_iface *iface,
52*a1157835SDaniel Fojt 				    const u8 *peer_addr, u8 band_id,
53*a1157835SDaniel Fojt 				    u8 *other_peer_addr);
54*a1157835SDaniel Fojt u8  fst_group_assign_dialog_token(struct fst_group *g);
55*a1157835SDaniel Fojt u32 fst_group_assign_fsts_id(struct fst_group *g);
56*a1157835SDaniel Fojt 
57*a1157835SDaniel Fojt extern struct dl_list fst_global_groups_list;
58*a1157835SDaniel Fojt 
59*a1157835SDaniel Fojt #define foreach_fst_group(g) \
60*a1157835SDaniel Fojt 	dl_list_for_each((g), &fst_global_groups_list, \
61*a1157835SDaniel Fojt 			 struct fst_group, global_groups_lentry)
62*a1157835SDaniel Fojt 
fst_first_group(void)63*a1157835SDaniel Fojt static inline struct fst_group * fst_first_group(void)
64*a1157835SDaniel Fojt {
65*a1157835SDaniel Fojt 	return dl_list_first(&fst_global_groups_list, struct fst_group,
66*a1157835SDaniel Fojt 			     global_groups_lentry);
67*a1157835SDaniel Fojt }
68*a1157835SDaniel Fojt 
69*a1157835SDaniel Fojt #endif /* FST_GROUP_H */
70