2 * hostapd / ubus support
3 * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
8 #ifndef __HOSTAPD_UBUS_H
9 #define __HOSTAPD_UBUS_H
11 enum hostapd_ubus_event_type
{
12 HOSTAPD_UBUS_PROBE_REQ
,
13 HOSTAPD_UBUS_AUTH_REQ
,
14 HOSTAPD_UBUS_ASSOC_REQ
,
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 */
28 struct hapd_interfaces
;
29 struct rrm_measurement_beacon_report
;
33 #include <libubox/avl.h>
36 struct hostapd_ubus_bss
{
37 struct ubus_object obj
;
38 struct avl_tree banned
;
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
);
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
,
56 void hostapd_ubus_notify_radar_detected(struct hostapd_iface
*iface
, int frequency
,
57 int chan_width
, int cf1
, int cf2
);
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 void hostapd_ubus_notify_authorized(struct hostapd_data
*hapd
, struct sta_info
*sta
,
69 const char *auth_alg
);
73 struct hostapd_ubus_bss
{};
75 static inline void hostapd_ubus_add_iface(struct hostapd_iface
*iface
)
79 static inline void hostapd_ubus_free_iface(struct hostapd_iface
*iface
)
83 static inline void hostapd_ubus_add_bss(struct hostapd_data
*hapd
)
87 static inline void hostapd_ubus_free_bss(struct hostapd_data
*hapd
)
91 static inline void hostapd_ubus_add_vlan(struct hostapd_data
*hapd
, struct hostapd_vlan
*vlan
)
95 static inline void hostapd_ubus_remove_vlan(struct hostapd_data
*hapd
, struct hostapd_vlan
*vlan
)
99 static inline int hostapd_ubus_handle_event(struct hostapd_data
*hapd
, struct hostapd_ubus_request
*req
)
104 static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data
*hapd
, const u8
*data
, size_t len
)
108 static inline void hostapd_ubus_notify(struct hostapd_data
*hapd
, const char *type
, const u8
*mac
)
112 static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data
*hapd
,
113 const u8
*addr
, u8 token
,
115 struct rrm_measurement_beacon_report
*rep
,
119 static inline void hostapd_ubus_notify_radar_detected(struct hostapd_iface
*iface
, int frequency
,
120 int chan_width
, int cf1
, int cf2
)
124 static inline void hostapd_ubus_notify_bss_transition_response(
125 struct hostapd_data
*hapd
, const u8
*addr
, u8 dialog_token
, u8 status_code
,
126 u8 bss_termination_delay
, const u8
*target_bssid
,
127 const u8
*candidate_list
, u16 candidate_list_len
)
131 static inline void hostapd_ubus_add(struct hapd_interfaces
*interfaces
)
135 static inline void hostapd_ubus_free(struct hapd_interfaces
*interfaces
)
139 static inline int hostapd_ubus_notify_bss_transition_query(
140 struct hostapd_data
*hapd
, const u8
*addr
, u8 dialog_token
, u8 reason
,
141 const u8
*candidate_list
, u16 candidate_list_len
)
147 hostapd_ubus_notify_authorized(struct hostapd_data
*hapd
, struct sta_info
*sta
,
148 const char *auth_alg
)