xref: /freebsd/contrib/wpa/src/fst/fst_group.h (revision b1f92fa22938fe29ab7e53692ffe0ed7a0ecc4d0)
1 /*
2  * FST module - FST group 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 #ifndef FST_GROUP_H
10 #define FST_GROUP_H
11 
12 struct fst_group {
13 	char group_id[IFNAMSIZ + 1];
14 	struct dl_list ifaces;
15 	u8 dialog_token;
16 	u32 fsts_id;
17 	struct dl_list global_groups_lentry;
18 };
19 
20 struct session_transition_ie;
21 
22 #define foreach_fst_group_iface(g, i) \
23 	dl_list_for_each((i), &(g)->ifaces, struct fst_iface, group_lentry)
24 
25 struct fst_group * fst_group_create(const char *group_id);
26 void fst_group_attach_iface(struct fst_group *g, struct fst_iface *i);
27 void fst_group_detach_iface(struct fst_group *g, struct fst_iface *i);
28 void fst_group_delete(struct fst_group *g);
29 
30 void fst_group_update_ie(struct fst_group *g);
31 
32 static inline Boolean fst_group_has_ifaces(struct fst_group *g)
33 {
34 	return !dl_list_empty(&g->ifaces);
35 }
36 
37 static inline struct fst_iface * fst_group_first_iface(struct fst_group *g)
38 {
39 	return dl_list_first(&g->ifaces, struct fst_iface, group_lentry);
40 }
41 
42 static inline const char * fst_group_get_id(struct fst_group *g)
43 {
44 	return g->group_id;
45 }
46 
47 Boolean fst_group_delete_if_empty(struct fst_group *group);
48 struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
49 					       const char *ifname);
50 struct fst_iface *
51 fst_group_find_new_iface_by_stie(struct fst_group *g,
52 				 struct fst_iface *iface,
53 				 const u8 *peer_addr,
54 				 const struct session_transition_ie *stie,
55 				 u8 *iface_peer_addr);
56 struct fst_iface *
57 fst_group_get_new_iface_by_stie_and_mbie(
58 	struct fst_group *g, const u8 *mb_ies_buff, size_t mb_ies_size,
59 	const struct session_transition_ie *stie, u8 *iface_peer_addr);
60 u8  fst_group_assign_dialog_token(struct fst_group *g);
61 u32 fst_group_assign_fsts_id(struct fst_group *g);
62 
63 extern struct dl_list fst_global_groups_list;
64 
65 #define foreach_fst_group(g) \
66 	dl_list_for_each((g), &fst_global_groups_list, \
67 			 struct fst_group, global_groups_lentry)
68 
69 static inline struct fst_group * fst_first_group(void)
70 {
71 	return dl_list_first(&fst_global_groups_list, struct fst_group,
72 			     global_groups_lentry);
73 }
74 
75 #endif /* FST_GROUP_H */
76