xref: /freebsd-src/contrib/wpa/src/fst/fst_session.h (revision c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5)
1325151a3SRui Paulo /*
2325151a3SRui Paulo  * FST module - FST Session related 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 #ifndef FST_SESSION_H
10325151a3SRui Paulo #define FST_SESSION_H
11325151a3SRui Paulo 
12325151a3SRui Paulo #define FST_DEFAULT_SESSION_TIMEOUT_TU 255 /* u8 */
13325151a3SRui Paulo 
14325151a3SRui Paulo struct fst_iface;
15325151a3SRui Paulo struct fst_group;
16325151a3SRui Paulo struct fst_session;
17325151a3SRui Paulo enum fst_session_state;
18325151a3SRui Paulo 
19325151a3SRui Paulo int  fst_session_global_init(void);
20325151a3SRui Paulo void fst_session_global_deinit(void);
21325151a3SRui Paulo void fst_session_global_on_iface_detached(struct fst_iface *iface);
22325151a3SRui Paulo struct fst_session *
23325151a3SRui Paulo fst_session_global_get_first_by_group(struct fst_group *g);
24325151a3SRui Paulo 
25325151a3SRui Paulo struct fst_session * fst_session_create(struct fst_group *g);
26325151a3SRui Paulo void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface,
27*c1d255d3SCy Schubert 			   bool is_old);
28325151a3SRui Paulo void fst_session_set_llt(struct fst_session *s, u32 llt);
29325151a3SRui Paulo void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr,
30*c1d255d3SCy Schubert 			       bool is_old);
31325151a3SRui Paulo int fst_session_initiate_setup(struct fst_session *s);
32325151a3SRui Paulo int fst_session_respond(struct fst_session *s, u8 status_code);
33325151a3SRui Paulo int fst_session_initiate_switch(struct fst_session *s);
34325151a3SRui Paulo void fst_session_handle_action(struct fst_session *s, struct fst_iface *iface,
35325151a3SRui Paulo 			       const struct ieee80211_mgmt *mgmt,
36325151a3SRui Paulo 			       size_t frame_len);
37325151a3SRui Paulo int fst_session_tear_down_setup(struct fst_session *s);
38325151a3SRui Paulo void fst_session_reset(struct fst_session *s);
39325151a3SRui Paulo void fst_session_delete(struct fst_session *s);
40325151a3SRui Paulo 
41325151a3SRui Paulo struct fst_group * fst_session_get_group(struct fst_session *s);
42*c1d255d3SCy Schubert struct fst_iface * fst_session_get_iface(struct fst_session *s, bool is_old);
43*c1d255d3SCy Schubert const u8 * fst_session_get_peer_addr(struct fst_session *s, bool is_old);
44325151a3SRui Paulo u32 fst_session_get_id(struct fst_session *s);
45325151a3SRui Paulo u32 fst_session_get_llt(struct fst_session *s);
46325151a3SRui Paulo enum fst_session_state fst_session_get_state(struct fst_session *s);
47325151a3SRui Paulo 
48325151a3SRui Paulo struct fst_session *fst_session_get_by_id(u32 id);
49325151a3SRui Paulo 
50325151a3SRui Paulo typedef void (*fst_session_enum_clb)(struct fst_group *g, struct fst_session *s,
51325151a3SRui Paulo 				     void *ctx);
52325151a3SRui Paulo 
53325151a3SRui Paulo void fst_session_enum(struct fst_group *g, fst_session_enum_clb clb, void *ctx);
54325151a3SRui Paulo 
55325151a3SRui Paulo void fst_session_on_action_rx(struct fst_iface *iface,
56325151a3SRui Paulo 			      const struct ieee80211_mgmt *mgmt, size_t len);
57325151a3SRui Paulo 
58325151a3SRui Paulo 
59325151a3SRui Paulo int fst_session_set_str_ifname(struct fst_session *s, const char *ifname,
60*c1d255d3SCy Schubert 			       bool is_old);
61325151a3SRui Paulo int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac,
62*c1d255d3SCy Schubert 				  bool is_old);
63325151a3SRui Paulo int fst_session_set_str_llt(struct fst_session *s, const char *llt_str);
64325151a3SRui Paulo 
65325151a3SRui Paulo #ifdef CONFIG_FST_TEST
66325151a3SRui Paulo 
67325151a3SRui Paulo #define FST_FSTS_ID_NOT_FOUND ((u32) -1)
68325151a3SRui Paulo 
69325151a3SRui Paulo int fst_test_req_send_fst_request(const char *params);
70325151a3SRui Paulo int fst_test_req_send_fst_response(const char *params);
71325151a3SRui Paulo int fst_test_req_send_ack_request(const char *params);
72325151a3SRui Paulo int fst_test_req_send_ack_response(const char *params);
73325151a3SRui Paulo int fst_test_req_send_tear_down(const char *params);
74325151a3SRui Paulo u32 fst_test_req_get_fsts_id(const char *params);
75325151a3SRui Paulo int fst_test_req_get_local_mbies(const char *request, char *buf,
76325151a3SRui Paulo 				 size_t buflen);
77325151a3SRui Paulo 
78325151a3SRui Paulo #endif /* CONFIG_FST_TEST */
79325151a3SRui Paulo 
80325151a3SRui Paulo #endif /* FST_SESSION_H */
81