aboutsummaryrefslogtreecommitdiffstats
path: root/src/fst/fst_group.h
blob: 3a87c0bc91c91720ceebacfd826d237d43efa97a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * FST module - FST group object definitions
 * Copyright (c) 2014, Qualcomm Atheros, Inc.
 *
 * This software may be distributed under the terms of the BSD license.
 * See README for more details.
 */

#ifndef FST_GROUP_H
#define FST_GROUP_H

struct fst_group {
	char group_id[IFNAMSIZ + 1];
	struct dl_list ifaces;
	u8 dialog_token;
	u32 fsts_id;
	struct dl_list global_groups_lentry;
};

struct session_transition_ie;

#define foreach_fst_group_iface(g, i) \
	dl_list_for_each((i), &(g)->ifaces, struct fst_iface, group_lentry)

struct fst_group * fst_group_create(const char *group_id);
void fst_group_attach_iface(struct fst_group *g, struct fst_iface *i);
void fst_group_detach_iface(struct fst_group *g, struct fst_iface *i);
void fst_group_delete(struct fst_group *g);

void fst_group_update_ie(struct fst_group *g);

static inline Boolean fst_group_has_ifaces(struct fst_group *g)
{
	return !dl_list_empty(&g->ifaces);
}

static inline struct fst_iface * fst_group_first_iface(struct fst_group *g)
{
	return dl_list_first(&g->ifaces, struct fst_iface, group_lentry);
}

static inline const char * fst_group_get_id(struct fst_group *g)
{
	return g->group_id;
}

Boolean fst_group_delete_if_empty(struct fst_group *group);
struct fst_iface * fst_group_get_iface_by_name(struct fst_group *g,
					       const char *ifname);
struct fst_iface *
fst_group_find_new_iface_by_stie(struct fst_group *g,
				 struct fst_iface *iface,
				 const u8 *peer_addr,
				 const struct session_transition_ie *stie,
				 u8 *iface_peer_addr);
struct fst_iface *
fst_group_get_new_iface_by_stie_and_mbie(
	struct fst_group *g, const u8 *mb_ies_buff, size_t mb_ies_size,
	const struct session_transition_ie *stie, u8 *iface_peer_addr);
u8  fst_group_assign_dialog_token(struct fst_group *g);
u32 fst_group_assign_fsts_id(struct fst_group *g);

extern struct dl_list fst_global_groups_list;

#define foreach_fst_group(g) \
	dl_list_for_each((g), &fst_global_groups_list, \
			 struct fst_group, global_groups_lentry)

static inline struct fst_group * fst_first_group(void)
{
	return dl_list_first(&fst_global_groups_list, struct fst_group,
			     global_groups_lentry);
}

#endif /* FST_GROUP_H */