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