dbus: Remove wpas_dbus_callbacks abstraction
This callback structure was specific to the new D-Bus API which makes it more or less pointless. It is just simpler to call the notification functions directly. More proper design could be to use a generic mechanism for registering notification callbacks into notify.c, but that is not yet available and should not be designed just based on a single user.
This commit is contained in:
parent
bad0dc3c0c
commit
52bdd880a3
3 changed files with 189 additions and 213 deletions
|
@ -146,8 +146,7 @@ static void wpas_dbus_signal_interface_removed(struct wpa_supplicant *wpa_s)
|
||||||
*
|
*
|
||||||
* Notify listeners about finishing a scan
|
* Notify listeners about finishing a scan
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success)
|
||||||
int success)
|
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
|
@ -338,7 +337,7 @@ static void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Notify listeners about adding a new blob
|
* Notify listeners about adding a new blob
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
wpas_dbus_signal_blob(wpa_s, name, "BlobAdded");
|
wpas_dbus_signal_blob(wpa_s, name, "BlobAdded");
|
||||||
|
@ -352,7 +351,7 @@ static void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Notify listeners about removing blob
|
* Notify listeners about removing blob
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved");
|
wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved");
|
||||||
|
@ -474,8 +473,7 @@ static void wpas_dbus_signal_network_removed(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Notify listeners about selecting a network
|
* Notify listeners about selecting a network
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id)
|
||||||
int id)
|
|
||||||
{
|
{
|
||||||
wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE);
|
wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE);
|
||||||
}
|
}
|
||||||
|
@ -489,7 +487,7 @@ static void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Notify listeners that wpa_supplicant has changed state
|
* Notify listeners that wpa_supplicant has changed state
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
enum wpa_states new_state,
|
enum wpa_states new_state,
|
||||||
enum wpa_states old_state)
|
enum wpa_states old_state)
|
||||||
{
|
{
|
||||||
|
@ -585,8 +583,8 @@ out:
|
||||||
* Sends PropertyChanged signals containing new value of Enabled property
|
* Sends PropertyChanged signals containing new value of Enabled property
|
||||||
* for specified network
|
* for specified network
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_network_enabled_changed(
|
void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct network_handler_args args = {wpa_s, ssid};
|
struct network_handler_args args = {wpa_s, ssid};
|
||||||
|
@ -612,7 +610,7 @@ static void wpas_dbus_signal_network_enabled_changed(
|
||||||
*
|
*
|
||||||
* Sends Event dbus signal with name "success" and empty dict as arguments
|
* Sends Event dbus signal with name "success" and empty dict as arguments
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
|
void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
|
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
|
@ -665,7 +663,7 @@ out:
|
||||||
* Sends Event dbus signal with name "fail" and dictionary containing
|
* Sends Event dbus signal with name "fail" and dictionary containing
|
||||||
* "msg field with fail message number (int32) as arguments
|
* "msg field with fail message number (int32) as arguments
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_fail *fail)
|
struct wps_event_fail *fail)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -720,7 +718,7 @@ out:
|
||||||
* Sends Event dbus signal with name "m2d" and dictionary containing
|
* Sends Event dbus signal with name "m2d" and dictionary containing
|
||||||
* fields of wps_event_m2d structure.
|
* fields of wps_event_m2d structure.
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_m2d *m2d)
|
struct wps_event_m2d *m2d)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -798,7 +796,7 @@ out:
|
||||||
*
|
*
|
||||||
* Sends signal with credentials in directory argument
|
* Sends signal with credentials in directory argument
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
const struct wps_credential *cred)
|
const struct wps_credential *cred)
|
||||||
{
|
{
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
|
@ -915,7 +913,7 @@ nomem:
|
||||||
* Sends ProertyChanged signals with path, interface and arguments
|
* Sends ProertyChanged signals with path, interface and arguments
|
||||||
* depending on which property has changed.
|
* depending on which property has changed.
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||||
enum wpas_dbus_prop property)
|
enum wpas_dbus_prop property)
|
||||||
{
|
{
|
||||||
WPADBusPropertyAccessor getter;
|
WPADBusPropertyAccessor getter;
|
||||||
|
@ -969,7 +967,7 @@ static void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Sends ProertyChanged signals informing that debug level has changed.
|
* Sends ProertyChanged signals informing that debug level has changed.
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_debug_level_changed(struct wpa_global *global)
|
void wpas_dbus_signal_debug_level_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
wpa_dbus_signal_property_changed(global->dbus,
|
wpa_dbus_signal_property_changed(global->dbus,
|
||||||
(WPADBusPropertyAccessor)
|
(WPADBusPropertyAccessor)
|
||||||
|
@ -986,7 +984,7 @@ static void wpas_dbus_signal_debug_level_changed(struct wpa_global *global)
|
||||||
*
|
*
|
||||||
* Sends ProertyChanged signals informing that debug timestamp has changed.
|
* Sends ProertyChanged signals informing that debug timestamp has changed.
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global)
|
void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
wpa_dbus_signal_property_changed(global->dbus,
|
wpa_dbus_signal_property_changed(global->dbus,
|
||||||
(WPADBusPropertyAccessor)
|
(WPADBusPropertyAccessor)
|
||||||
|
@ -1003,7 +1001,7 @@ static void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global)
|
||||||
*
|
*
|
||||||
* Sends ProertyChanged signals informing that debug show_keys has changed.
|
* Sends ProertyChanged signals informing that debug show_keys has changed.
|
||||||
*/
|
*/
|
||||||
static void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global)
|
void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
wpa_dbus_signal_property_changed(global->dbus,
|
wpa_dbus_signal_property_changed(global->dbus,
|
||||||
(WPADBusPropertyAccessor)
|
(WPADBusPropertyAccessor)
|
||||||
|
@ -1249,7 +1247,7 @@ static const struct wpas_dbus_signal wpas_dbus_network_signals[] = {
|
||||||
*
|
*
|
||||||
* Registers network representing object with dbus
|
* Registers network representing object with dbus
|
||||||
*/
|
*/
|
||||||
static int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
|
@ -1322,7 +1320,7 @@ err:
|
||||||
*
|
*
|
||||||
* Unregisters network representing object from dbus
|
* Unregisters network representing object from dbus
|
||||||
*/
|
*/
|
||||||
static int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
|
int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
char *net_obj_path;
|
char *net_obj_path;
|
||||||
|
@ -1429,7 +1427,7 @@ static const struct wpas_dbus_signal wpas_dbus_bss_signals[] = {
|
||||||
*
|
*
|
||||||
* Unregisters BSS representing object from dbus
|
* Unregisters BSS representing object from dbus
|
||||||
*/
|
*/
|
||||||
static int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
||||||
u8 bssid[ETH_ALEN], unsigned int id)
|
u8 bssid[ETH_ALEN], unsigned int id)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
|
@ -1476,7 +1474,7 @@ static int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
||||||
*
|
*
|
||||||
* Registers BSS representing object with dbus
|
* Registers BSS representing object with dbus
|
||||||
*/
|
*/
|
||||||
static int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
||||||
u8 bssid[ETH_ALEN], unsigned int id)
|
u8 bssid[ETH_ALEN], unsigned int id)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
|
@ -1764,7 +1762,7 @@ static const struct wpas_dbus_signal wpas_dbus_interface_signals[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
|
int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct wpa_dbus_object_desc *obj_desc = NULL;
|
struct wpa_dbus_object_desc *obj_desc = NULL;
|
||||||
|
@ -1819,7 +1817,7 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
|
|
||||||
|
@ -1845,54 +1843,6 @@ static int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct wpas_dbus_callbacks callbacks =
|
|
||||||
{
|
|
||||||
.signal_interface_added = wpas_dbus_signal_interface_added,
|
|
||||||
.signal_interface_removed = wpas_dbus_signal_interface_removed,
|
|
||||||
|
|
||||||
.register_interface = wpas_dbus_register_interface,
|
|
||||||
.unregister_interface = wpas_dbus_unregister_interface,
|
|
||||||
|
|
||||||
.signal_scan_done = wpas_dbus_signal_scan_done,
|
|
||||||
|
|
||||||
.signal_blob_added = wpas_dbus_signal_blob_added,
|
|
||||||
.signal_blob_removed = wpas_dbus_signal_blob_removed,
|
|
||||||
|
|
||||||
.signal_network_selected = wpas_dbus_signal_network_selected,
|
|
||||||
|
|
||||||
.signal_state_changed = wpas_dbus_signal_state_changed,
|
|
||||||
.register_network = wpas_dbus_register_network,
|
|
||||||
.unregister_network = wpas_dbus_unregister_network,
|
|
||||||
|
|
||||||
.signal_network_enabled_changed =
|
|
||||||
wpas_dbus_signal_network_enabled_changed,
|
|
||||||
|
|
||||||
.register_bss = wpas_dbus_register_bss,
|
|
||||||
.unregister_bss = wpas_dbus_unregister_bss,
|
|
||||||
|
|
||||||
.signal_prop_changed = wpas_dbus_signal_prop_changed,
|
|
||||||
|
|
||||||
.signal_debug_level_changed = wpas_dbus_signal_debug_level_changed,
|
|
||||||
.signal_debug_timestamp_changed =
|
|
||||||
wpas_dbus_signal_debug_timestamp_changed,
|
|
||||||
.signal_debug_show_keys_changed =
|
|
||||||
wpas_dbus_signal_debug_show_keys_changed,
|
|
||||||
|
|
||||||
#ifdef CONFIG_WPS
|
|
||||||
.signal_wps_event_success = wpas_dbus_signal_wps_event_success,
|
|
||||||
.signal_wps_event_fail = wpas_dbus_signal_wps_event_fail,
|
|
||||||
.signal_wps_event_m2d = wpas_dbus_signal_wps_event_m2d,
|
|
||||||
.signal_wps_credentials = wpas_dbus_signal_wps_cred,
|
|
||||||
#endif /* CONFIG_WPS */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct wpas_dbus_callbacks * wpas_dbus_get_callbacks(void)
|
|
||||||
{
|
|
||||||
return &callbacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_get_path - Get an interface's dbus path
|
* wpas_dbus_get_path - Get an interface's dbus path
|
||||||
* @wpa_s: %wpa_supplicant interface structure
|
* @wpa_s: %wpa_supplicant interface structure
|
||||||
|
|
|
@ -31,58 +31,6 @@ enum wpas_dbus_prop {
|
||||||
WPAS_DBUS_PROP_CURRENT_NETWORK,
|
WPAS_DBUS_PROP_CURRENT_NETWORK,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wpas_dbus_callbacks {
|
|
||||||
void (*signal_interface_added)(struct wpa_supplicant *wpa_s);
|
|
||||||
void (*signal_interface_removed)(struct wpa_supplicant *wpa_s);
|
|
||||||
|
|
||||||
int (*register_interface)(struct wpa_supplicant *wpa_s);
|
|
||||||
int (*unregister_interface)(struct wpa_supplicant *wpa_s);
|
|
||||||
|
|
||||||
void (*signal_scan_done)(struct wpa_supplicant *wpa_s, int success);
|
|
||||||
|
|
||||||
void (*signal_blob_added)(struct wpa_supplicant *wpa_s,
|
|
||||||
const char *name);
|
|
||||||
void (*signal_blob_removed)(struct wpa_supplicant *wpa_s,
|
|
||||||
const char *name);
|
|
||||||
|
|
||||||
void (*signal_network_selected)(struct wpa_supplicant *wpa_s, int id);
|
|
||||||
|
|
||||||
void (*signal_state_changed)(struct wpa_supplicant *wpa_s,
|
|
||||||
enum wpa_states new_state,
|
|
||||||
enum wpa_states old_state);
|
|
||||||
|
|
||||||
int (*register_network)(struct wpa_supplicant *wpa_s,
|
|
||||||
struct wpa_ssid *ssid);
|
|
||||||
int (*unregister_network)(struct wpa_supplicant *wpa_s,
|
|
||||||
int nid);
|
|
||||||
|
|
||||||
void (*signal_network_enabled_changed)(struct wpa_supplicant *wpa_s,
|
|
||||||
struct wpa_ssid *ssid);
|
|
||||||
|
|
||||||
int (*register_bss)(struct wpa_supplicant *wpa_s, u8 bssid[ETH_ALEN],
|
|
||||||
unsigned int id);
|
|
||||||
int (*unregister_bss)(struct wpa_supplicant *wpa_s,
|
|
||||||
u8 bssid[ETH_ALEN], unsigned int id);
|
|
||||||
|
|
||||||
void (*signal_prop_changed)(struct wpa_supplicant *wpa_s,
|
|
||||||
enum wpas_dbus_prop property);
|
|
||||||
|
|
||||||
void (*signal_debug_level_changed)(struct wpa_global *global);
|
|
||||||
void (*signal_debug_timestamp_changed)(struct wpa_global *global);
|
|
||||||
void (*signal_debug_show_keys_changed)(struct wpa_global *global);
|
|
||||||
|
|
||||||
void (*signal_wps_event_success)(struct wpa_supplicant *wpa_s);
|
|
||||||
void (*signal_wps_event_fail)(struct wpa_supplicant *wpa_s,
|
|
||||||
struct wps_event_fail *fail);
|
|
||||||
void (*signal_wps_event_m2d)(struct wpa_supplicant *wpa_s,
|
|
||||||
struct wps_event_m2d *m2d);
|
|
||||||
void (*signal_wps_credentials)(struct wpa_supplicant *wpa_s,
|
|
||||||
const struct wps_credential *cred);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
|
||||||
|
|
||||||
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||||
|
|
||||||
#define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
|
#define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
|
||||||
|
@ -121,17 +69,148 @@ struct wpas_dbus_callbacks {
|
||||||
#define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
|
#define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
|
||||||
WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobUnknown"
|
WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobUnknown"
|
||||||
|
|
||||||
struct wpas_dbus_callbacks * wpas_dbus_get_callbacks(void);
|
|
||||||
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
|
||||||
const char * wpas_dbus_get_path(struct wpa_supplicant *wpa_s);
|
const char * wpas_dbus_get_path(struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
|
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
|
||||||
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
|
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
|
||||||
|
|
||||||
|
int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s);
|
||||||
|
int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s);
|
||||||
|
void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
|
enum wpa_states new_state,
|
||||||
|
enum wpa_states old_state);
|
||||||
|
void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||||
|
enum wpas_dbus_prop property);
|
||||||
|
void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_ssid *ssid);
|
||||||
|
void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
|
||||||
|
void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
|
||||||
|
void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
|
const struct wps_credential *cred);
|
||||||
|
void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wps_event_m2d *m2d);
|
||||||
|
void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wps_event_fail *fail);
|
||||||
|
void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
|
||||||
|
int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_ssid *ssid);
|
||||||
|
int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
|
||||||
|
int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 bssid[ETH_ALEN], unsigned int id);
|
||||||
|
int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 bssid[ETH_ALEN], unsigned int id);
|
||||||
|
void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
||||||
|
const char *name);
|
||||||
|
void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
|
||||||
|
const char *name);
|
||||||
|
void wpas_dbus_signal_debug_level_changed(struct wpa_global *global);
|
||||||
|
void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
|
||||||
|
void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
|
||||||
|
|
||||||
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
||||||
static inline struct wpas_dbus_callbacks * wpas_dbus_get_callbacks(void)
|
static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||||
|
enum wpas_dbus_prop property)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_network_enabled_changed(
|
||||||
|
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_network_selected(
|
||||||
|
struct wpa_supplicant *wpa_s, int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
|
||||||
|
int success)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
|
const struct wps_credential *cred)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wps_event_m2d *m2d)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_wps_event_fail(
|
||||||
|
struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_wps_event_success(
|
||||||
|
struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_ssid *ssid)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s,
|
||||||
|
int nid)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 bssid[ETH_ALEN], unsigned int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 bssid[ETH_ALEN], unsigned int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_debug_level_changed(
|
||||||
|
struct wpa_global *global)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_debug_timestamp_changed(
|
||||||
|
struct wpa_global *global)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void wpas_dbus_signal_debug_show_keys_changed(
|
||||||
|
struct wpa_global *global)
|
||||||
{
|
{
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
|
@ -49,29 +49,23 @@ void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
|
||||||
|
|
||||||
int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
|
int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
|
||||||
|
|
||||||
if (wpas_dbus_register_iface(wpa_s))
|
if (wpas_dbus_register_iface(wpa_s))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (cbs && cbs->register_interface(wpa_s))
|
if (wpas_dbus_register_interface(wpa_s))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
|
void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
|
||||||
|
|
||||||
/* unregister interface in old DBus ctrl iface */
|
/* unregister interface in old DBus ctrl iface */
|
||||||
wpas_dbus_unregister_iface(wpa_s);
|
wpas_dbus_unregister_iface(wpa_s);
|
||||||
|
|
||||||
/* unregister interface in new DBus ctrl iface */
|
/* unregister interface in new DBus ctrl iface */
|
||||||
if (cbs)
|
wpas_dbus_unregister_interface(wpa_s);
|
||||||
cbs->unregister_interface(wpa_s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,77 +73,59 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
enum wpa_states new_state,
|
enum wpa_states new_state,
|
||||||
enum wpa_states old_state)
|
enum wpa_states old_state)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
|
||||||
|
|
||||||
/* notify the old DBus API */
|
/* notify the old DBus API */
|
||||||
wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
|
wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
|
||||||
old_state);
|
old_state);
|
||||||
|
|
||||||
/* notify the new DBus API */
|
/* notify the new DBus API */
|
||||||
if (cbs)
|
wpas_dbus_signal_state_changed(wpa_s, new_state, old_state);
|
||||||
cbs->signal_state_changed(wpa_s, new_state, old_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
|
void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_prop_changed(wpa_s,
|
|
||||||
WPAS_DBUS_PROP_CURRENT_NETWORK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
|
void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
|
void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_network_enabled_changed(wpa_s, ssid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
|
void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_network_selected(wpa_s, ssid->id);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_network_selected(wpa_s, ssid->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
|
void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
|
||||||
/* notify the old DBus API */
|
/* notify the old DBus API */
|
||||||
wpa_supplicant_dbus_notify_scanning(wpa_s);
|
wpa_supplicant_dbus_notify_scanning(wpa_s);
|
||||||
/* notify the new DBus API */
|
/* notify the new DBus API */
|
||||||
if (cbs)
|
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
|
||||||
cbs->signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
|
void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_scan_done(wpa_s, success);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_scan_done(wpa_s, success);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,15 +142,10 @@ void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
|
||||||
const struct wps_credential *cred)
|
const struct wps_credential *cred)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
|
||||||
#endif /* CONFIG_WPS */
|
|
||||||
|
|
||||||
/* notify the old DBus API */
|
/* notify the old DBus API */
|
||||||
wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
|
wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
|
||||||
/* notify the new DBus API */
|
/* notify the new DBus API */
|
||||||
#ifdef CONFIG_WPS
|
wpas_dbus_signal_wps_cred(wpa_s, cred);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_wps_credentials(wpa_s, cred);
|
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,9 +154,7 @@ void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_m2d *m2d)
|
struct wps_event_m2d *m2d)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_wps_event_m2d(wpa_s, m2d);
|
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,9 +163,7 @@ void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_fail *fail)
|
struct wps_event_fail *fail)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_wps_event_fail(wpa_s, fail);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_wps_event_fail(wpa_s, fail);
|
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,9 +171,7 @@ void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
|
void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_wps_event_success(wpa_s);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_wps_event_success(wpa_s);
|
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,27 +179,21 @@ void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
|
void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_register_network(wpa_s, ssid);
|
||||||
if (wpa_s->global->dbus && cbs)
|
|
||||||
cbs->register_network(wpa_s, ssid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
|
void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_unregister_network(wpa_s, ssid->id);
|
||||||
if (wpa_s->global->dbus && cbs)
|
|
||||||
cbs->unregister_network(wpa_s, ssid->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
|
void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
|
||||||
u8 bssid[], unsigned int id)
|
u8 bssid[], unsigned int id)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_register_bss(wpa_s, bssid, id);
|
||||||
if (cbs)
|
|
||||||
cbs->register_bss(wpa_s, bssid, id);
|
|
||||||
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
|
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
|
||||||
id, MAC2STR(bssid));
|
id, MAC2STR(bssid));
|
||||||
}
|
}
|
||||||
|
@ -243,9 +202,7 @@ void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
|
||||||
void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
|
void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
|
||||||
u8 bssid[], unsigned int id)
|
u8 bssid[], unsigned int id)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_unregister_bss(wpa_s, bssid, id);
|
||||||
if (cbs)
|
|
||||||
cbs->unregister_bss(wpa_s, bssid, id);
|
|
||||||
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
|
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
|
||||||
id, MAC2STR(bssid));
|
id, MAC2STR(bssid));
|
||||||
}
|
}
|
||||||
|
@ -253,39 +210,29 @@ void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
|
void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_blob_added(wpa_s, name);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_blob_added(wpa_s, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
|
void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_blob_removed(wpa_s, name);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_blob_removed(wpa_s, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_debug_level_changed(struct wpa_global *global)
|
void wpas_notify_debug_level_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_debug_level_changed(global);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_debug_level_changed(global);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
|
void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_debug_timestamp_changed(global);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_debug_timestamp_changed(global);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
|
void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
wpas_dbus_signal_debug_show_keys_changed(global);
|
||||||
if (cbs)
|
|
||||||
cbs->signal_debug_show_keys_changed(global);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue