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
12struct 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
20struct 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
25struct fst_group * fst_group_create(const char *group_id);
26void fst_group_attach_iface(struct fst_group *g, struct fst_iface *i);
27void fst_group_detach_iface(struct fst_group *g, struct fst_iface *i);
28void fst_group_delete(struct fst_group *g);
29
30void fst_group_update_ie(struct fst_group *g);
31
32static inline Boolean fst_group_has_ifaces(struct fst_group *g)
33{
34	return !dl_list_empty(&g->ifaces);
35}
36
37static 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
42static inline const char * fst_group_get_id(struct fst_group *g)
43{
44	return g->group_id;
45}
46
47Boolean fst_group_delete_if_empty(struct fst_group *group);
48struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
49					       const char *ifname);
50struct fst_iface *
51fst_group_get_peer_other_connection(struct fst_iface *iface,
52				    const u8 *peer_addr, u8 band_id,
53				    u8 *other_peer_addr);
54u8  fst_group_assign_dialog_token(struct fst_group *g);
55u32 fst_group_assign_fsts_id(struct fst_group *g);
56
57extern struct dl_list fst_global_groups_list;
58
59#define foreach_fst_group(g) \
60	dl_list_for_each((g), &fst_global_groups_list, \
61			 struct fst_group, global_groups_lentry)
62
63static inline struct fst_group * fst_first_group(void)
64{
65	return dl_list_first(&fst_global_groups_list, struct fst_group,
66			     global_groups_lentry);
67}
68
69#endif /* FST_GROUP_H */
70