xref: /dragonfly/contrib/wpa_supplicant/src/fst/fst_ctrl_aux.h (revision 3a84a4273475ed07d0ab1c2dfeffdfedef35d9cd)
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_reason {
39           REASON_TEARDOWN,
40           REASON_SETUP,
41           REASON_SWITCH,
42           REASON_STT,
43           REASON_REJECT,
44           REASON_ERROR_PARAMS,
45           REASON_RESET,
46           REASON_DETACH_IFACE,
47 };
48 
49 enum fst_initiator {
50           FST_INITIATOR_UNDEFINED,
51           FST_INITIATOR_LOCAL,
52           FST_INITIATOR_REMOTE,
53 };
54 
55 union fst_event_extra {
56           struct fst_event_extra_iface_state {
57                     Boolean attached;
58                     char ifname[FST_MAX_INTERFACE_SIZE];
59                     char group_id[FST_MAX_GROUP_ID_SIZE];
60           } iface_state; /* for EVENT_FST_IFACE_STATE_CHANGED */
61           struct fst_event_extra_peer_state {
62                     Boolean connected;
63                     char ifname[FST_MAX_INTERFACE_SIZE];
64                     u8 addr[ETH_ALEN];
65           } peer_state; /* for EVENT_PEER_STATE_CHANGED */
66           struct fst_event_extra_session_state {
67                     enum fst_session_state old_state;
68                     enum fst_session_state new_state;
69                     union fst_session_state_switch_extra {
70                               struct {
71                                         enum fst_reason reason;
72                                         u8 reject_code; /* REASON_REJECT */
73                                         /* REASON_SWITCH,
74                                          * REASON_TEARDOWN,
75                                          * REASON_REJECT
76                                          */
77                                         enum fst_initiator initiator;
78                               } to_initial;
79                     } extra;
80           } session_state; /* for EVENT_FST_SESSION_STATE_CHANGED */
81 };
82 
83 /* helpers - prints enum in string form */
84 #define FST_NAME_UNKNOWN "UNKNOWN"
85 
86 const char * fst_get_str_name(unsigned index, const char *names[],
87                                     size_t names_size);
88 
89 const char * fst_session_event_type_name(enum fst_event_type);
90 const char * fst_reason_name(enum fst_reason reason);
91 const char * fst_session_state_name(enum fst_session_state state);
92 
93 #endif /* FST_CTRL_AUX_H */
94