1325151a3SRui Paulo /* 2325151a3SRui Paulo * FST module - miscellaneous 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_CTRL_AUX_H 10325151a3SRui Paulo #define FST_CTRL_AUX_H 11325151a3SRui Paulo 12325151a3SRui Paulo #include "common/defs.h" 13325151a3SRui Paulo 14325151a3SRui Paulo /* FST module control interface API */ 15325151a3SRui Paulo #define FST_INVALID_SESSION_ID ((u32) -1) 16325151a3SRui Paulo #define FST_MAX_GROUP_ID_SIZE 32 17325151a3SRui Paulo #define FST_MAX_INTERFACE_SIZE 32 18325151a3SRui Paulo 19325151a3SRui Paulo enum fst_session_state { 20325151a3SRui Paulo FST_SESSION_STATE_INITIAL, 21325151a3SRui Paulo FST_SESSION_STATE_SETUP_COMPLETION, 22325151a3SRui Paulo FST_SESSION_STATE_TRANSITION_DONE, 23325151a3SRui Paulo FST_SESSION_STATE_TRANSITION_CONFIRMED, 24325151a3SRui Paulo FST_SESSION_STATE_LAST 25325151a3SRui Paulo }; 26325151a3SRui Paulo 27325151a3SRui Paulo enum fst_event_type { 28325151a3SRui Paulo EVENT_FST_IFACE_STATE_CHANGED, /* An interface has been either attached 29325151a3SRui Paulo * to or detached from an FST group */ 30325151a3SRui Paulo EVENT_FST_ESTABLISHED, /* FST Session has been established */ 31325151a3SRui Paulo EVENT_FST_SETUP, /* FST Session request received */ 32325151a3SRui Paulo EVENT_FST_SESSION_STATE_CHANGED,/* FST Session state has been changed */ 33325151a3SRui Paulo EVENT_PEER_STATE_CHANGED /* FST related generic event occurred, 34325151a3SRui Paulo * see struct fst_hostap_event_data for 35325151a3SRui Paulo * more info */ 36325151a3SRui Paulo }; 37325151a3SRui Paulo 3885732ac8SCy Schubert enum fst_reason { 3985732ac8SCy Schubert REASON_TEARDOWN, 4085732ac8SCy Schubert REASON_SETUP, 4185732ac8SCy Schubert REASON_SWITCH, 4285732ac8SCy Schubert REASON_STT, 4385732ac8SCy Schubert REASON_REJECT, 4485732ac8SCy Schubert REASON_ERROR_PARAMS, 4585732ac8SCy Schubert REASON_RESET, 4685732ac8SCy Schubert REASON_DETACH_IFACE, 4785732ac8SCy Schubert }; 4885732ac8SCy Schubert 49325151a3SRui Paulo enum fst_initiator { 50325151a3SRui Paulo FST_INITIATOR_UNDEFINED, 51325151a3SRui Paulo FST_INITIATOR_LOCAL, 52325151a3SRui Paulo FST_INITIATOR_REMOTE, 53325151a3SRui Paulo }; 54325151a3SRui Paulo 55325151a3SRui Paulo union fst_event_extra { 56325151a3SRui Paulo struct fst_event_extra_iface_state { 57*c1d255d3SCy Schubert bool attached; 58325151a3SRui Paulo char ifname[FST_MAX_INTERFACE_SIZE]; 59325151a3SRui Paulo char group_id[FST_MAX_GROUP_ID_SIZE]; 60325151a3SRui Paulo } iface_state; /* for EVENT_FST_IFACE_STATE_CHANGED */ 61325151a3SRui Paulo struct fst_event_extra_peer_state { 62*c1d255d3SCy Schubert bool connected; 63325151a3SRui Paulo char ifname[FST_MAX_INTERFACE_SIZE]; 64325151a3SRui Paulo u8 addr[ETH_ALEN]; 65325151a3SRui Paulo } peer_state; /* for EVENT_PEER_STATE_CHANGED */ 66325151a3SRui Paulo struct fst_event_extra_session_state { 67325151a3SRui Paulo enum fst_session_state old_state; 68325151a3SRui Paulo enum fst_session_state new_state; 69325151a3SRui Paulo union fst_session_state_switch_extra { 70325151a3SRui Paulo struct { 7185732ac8SCy Schubert enum fst_reason reason; 72325151a3SRui Paulo u8 reject_code; /* REASON_REJECT */ 73325151a3SRui Paulo /* REASON_SWITCH, 74325151a3SRui Paulo * REASON_TEARDOWN, 75325151a3SRui Paulo * REASON_REJECT 76325151a3SRui Paulo */ 77325151a3SRui Paulo enum fst_initiator initiator; 78325151a3SRui Paulo } to_initial; 79325151a3SRui Paulo } extra; 80325151a3SRui Paulo } session_state; /* for EVENT_FST_SESSION_STATE_CHANGED */ 81325151a3SRui Paulo }; 82325151a3SRui Paulo 83325151a3SRui Paulo /* helpers - prints enum in string form */ 84325151a3SRui Paulo #define FST_NAME_UNKNOWN "UNKNOWN" 85325151a3SRui Paulo 86325151a3SRui Paulo const char * fst_get_str_name(unsigned index, const char *names[], 87325151a3SRui Paulo size_t names_size); 88325151a3SRui Paulo 89325151a3SRui Paulo const char * fst_session_event_type_name(enum fst_event_type); 90325151a3SRui Paulo const char * fst_reason_name(enum fst_reason reason); 91325151a3SRui Paulo const char * fst_session_state_name(enum fst_session_state state); 92325151a3SRui Paulo 93325151a3SRui Paulo #endif /* FST_CTRL_AUX_H */ 94