hostapd: add support for enabling HE on channel switch
[openwrt/openwrt.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_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
51 void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
52 const u8 *addr, u8 token, u8 rep_mode,
53 struct rrm_measurement_beacon_report *rep,
54 size_t len);
55 void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
56 int chan_width, int cf1, int cf2);
57
58 void hostapd_ubus_add(struct hapd_interfaces *interfaces);
59 void hostapd_ubus_free(struct hapd_interfaces *interfaces);
60
61 #else
62
63 struct hostapd_ubus_bss {};
64
65 static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface)
66 {
67 }
68
69 static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface)
70 {
71 }
72
73 static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd)
74 {
75 }
76
77 static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd)
78 {
79 }
80
81 static inline void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
82 {
83 }
84
85 static inline void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
86 {
87 }
88
89 static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
90 {
91 return 0;
92 }
93
94 static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
95 {
96 }
97
98 static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
99 const u8 *addr, u8 token,
100 u8 rep_mode,
101 struct rrm_measurement_beacon_report *rep,
102 size_t len)
103 {
104 }
105 static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface *iface, int frequency,
106 int chan_width, int cf1, int cf2)
107 {
108 }
109
110 static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
111 {
112 }
113
114 static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces)
115 {
116 }
117 #endif
118
119 #endif