fst_ctrl_aux.h 2.5 KB

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