hostapd: ubus: add bss-color to get_status
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / src / src / ap / ubus.h
1 /*
2 * hostapd / ubus support
3 * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8 #ifndef __HOSTAPD_UBUS_H
9 #define __HOSTAPD_UBUS_H
10
11 enum hostapd_ubus_event_type {
12 HOSTAPD_UBUS_PROBE_REQ,
13 HOSTAPD_UBUS_AUTH_REQ,
14 HOSTAPD_UBUS_ASSOC_REQ,
15 HOSTAPD_UBUS_TYPE_MAX
16 };
17
18 struct hostapd_ubus_request {
19 enum hostapd_ubus_event_type type;
20 const struct ieee80211_mgmt *mgmt_frame;
21 const struct ieee802_11_elems *elems;
22 int ssi_signal; /* dBm */
23 const u8 *addr;
24 };
25
26 struct hostapd_iface;
27 struct hostapd_data;
28 struct hapd_interfaces;
29 struct rrm_measurement_beacon_report;
30
31 #ifdef UBUS_SUPPORT
32
33 #include <libubox/avl.h>
34 #include <libubus.h>
35
36 struct hostapd_ubus_bss {
37 struct ubus_object obj;
38 struct avl_tree banned;
39 int notify_response;
40 };
41
42 void hostapd_ubus_add_iface(struct hostapd_iface *iface);
43 void hostapd_ubus_free_iface(struct hostapd_iface *iface);
44 void hostapd_ubus_add_bss(struct hostapd_data *hapd);
45 void hostapd_ubus_free_bss(struct hostapd_data *hapd);
46 void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
47 void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
48
49 int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
50 void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len);
51 void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
52 void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
53 const u8 *addr, u8 token, u8 rep_mode,
54 struct rrm_measurement_beacon_report *rep,
55 size_t len);
56 void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
57 int chan_width, int cf1, int cf2);
58
59 void hostapd_ubus_notify_bss_transition_response(
60 struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code,
61 u8 bss_termination_delay, const u8 *target_bssid,
62 const u8 *candidate_list, u16 candidate_list_len);
63 void hostapd_ubus_add(struct hapd_interfaces *interfaces);
64 void hostapd_ubus_free(struct hapd_interfaces *interfaces);
65 int hostapd_ubus_notify_bss_transition_query(
66 struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason,
67 const u8 *candidate_list, u16 candidate_list_len);
68
69 #else
70
71 struct hostapd_ubus_bss {};
72
73 static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface)
74 {
75 }
76
77 static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface)
78 {
79 }
80
81 static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd)
82 {
83 }
84
85 static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd)
86 {
87 }
88
89 static inline void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
90 {
91 }
92
93 static inline void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
94 {
95 }
96
97 static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
98 {
99 return 0;
100 }
101
102 static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len)
103 {
104 }
105
106 static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
107 {
108 }
109
110 static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
111 const u8 *addr, u8 token,
112 u8 rep_mode,
113 struct rrm_measurement_beacon_report *rep,
114 size_t len)
115 {
116 }
117 static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
118 int chan_width, int cf1, int cf2)
119 {
120 }
121
122 static inline void hostapd_ubus_notify_bss_transition_response(
123 struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code,
124 u8 bss_termination_delay, const u8 *target_bssid,
125 const u8 *candidate_list, u16 candidate_list_len)
126 {
127 }
128
129 static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
130 {
131 }
132
133 static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces)
134 {
135 }
136
137 static inline int hostapd_ubus_notify_bss_transition_query(
138 struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason,
139 const u8 *candidate_list, u16 candidate_list_len)
140 {
141 return 0;
142 }
143 #endif
144
145 #endif