xref: /freebsd/contrib/wpa/src/fst/fst_ctrl_aux.h (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1 /*
2  * FST module - miscellaneous 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_CTRL_AUX_H
10 #define FST_CTRL_AUX_H
11 
12 #include "common/defs.h"
13 
14 /* FST module control interface API */
15 #define FST_INVALID_SESSION_ID ((u32) -1)
16 #define FST_MAX_GROUP_ID_SIZE   32
17 #define FST_MAX_INTERFACE_SIZE  32
18 
19 enum fst_session_state {
20 	FST_SESSION_STATE_INITIAL,
21 	FST_SESSION_STATE_SETUP_COMPLETION,
22 	FST_SESSION_STATE_TRANSITION_DONE,
23 	FST_SESSION_STATE_TRANSITION_CONFIRMED,
24 	FST_SESSION_STATE_LAST
25 };
26 
27 enum fst_event_type {
28 	EVENT_FST_IFACE_STATE_CHANGED,  /* An interface has been either attached
29 					 * to or detached from an FST group */
30 	EVENT_FST_ESTABLISHED,          /* FST Session has been established */
31 	EVENT_FST_SETUP,                /* FST Session request received */
32 	EVENT_FST_SESSION_STATE_CHANGED,/* FST Session state has been changed */
33 	EVENT_PEER_STATE_CHANGED        /* FST related generic event occurred,
34 					 * see struct fst_hostap_event_data for
35 					 *  more info */
36 };
37 
38 enum fst_initiator {
39 	FST_INITIATOR_UNDEFINED,
40 	FST_INITIATOR_LOCAL,
41 	FST_INITIATOR_REMOTE,
42 };
43 
44 union fst_event_extra {
45 	struct fst_event_extra_iface_state {
46 		Boolean attached;
47 		char ifname[FST_MAX_INTERFACE_SIZE];
48 		char group_id[FST_MAX_GROUP_ID_SIZE];
49 	} iface_state; /* for EVENT_FST_IFACE_STATE_CHANGED */
50 	struct fst_event_extra_peer_state {
51 		Boolean connected;
52 		char ifname[FST_MAX_INTERFACE_SIZE];
53 		u8 addr[ETH_ALEN];
54 	} peer_state; /* for EVENT_PEER_STATE_CHANGED */
55 	struct fst_event_extra_session_state {
56 		enum fst_session_state old_state;
57 		enum fst_session_state new_state;
58 		union fst_session_state_switch_extra {
59 			struct {
60 				enum fst_reason {
61 					REASON_TEARDOWN,
62 					REASON_SETUP,
63 					REASON_SWITCH,
64 					REASON_STT,
65 					REASON_REJECT,
66 					REASON_ERROR_PARAMS,
67 					REASON_RESET,
68 					REASON_DETACH_IFACE,
69 				} reason;
70 				u8 reject_code; /* REASON_REJECT */
71 				/* REASON_SWITCH,
72 				 * REASON_TEARDOWN,
73 				 * REASON_REJECT
74 				 */
75 				enum fst_initiator initiator;
76 			} to_initial;
77 		} extra;
78 	} session_state; /* for EVENT_FST_SESSION_STATE_CHANGED */
79 };
80 
81 /* helpers - prints enum in string form */
82 #define FST_NAME_UNKNOWN "UNKNOWN"
83 
84 const char * fst_get_str_name(unsigned index, const char *names[],
85 			      size_t names_size);
86 
87 const char * fst_session_event_type_name(enum fst_event_type);
88 const char * fst_reason_name(enum fst_reason reason);
89 const char * fst_session_state_name(enum fst_session_state state);
90 
91 #endif /* FST_CTRL_AUX_H */
92