wpa_supplicant: new DBus API implementation
This patch implements the new DBus API. Both, the new and the previous API may work concurrently and may be turned on or off separately in .config file. Some features of the new API are: - more wpa_supplicant's events are signaled with DBus signals, - introspection data (requires libxml2 and may be disabled), - CurrentBSS and CurrentNetwork properties, - PropertyChanged signal for most of properties, - Relatively easy to extend. .config options for the new API are: CONFIG_CTRL_IFACE_DBUS_NEW=y and CONFIG_CTRL_IFACE_DBUS_INTRO=y for introspection. This commit misses couple of parts from the full implementation (these are still under review): - fetching all configuration parameters for learning WPS information - scan result BSS add/remove notification (register_bss() and unregister_bss() notification callbacks)
This commit is contained in:
parent
097c7b3723
commit
8fc2fb56e4
12 changed files with 7825 additions and 54 deletions
|
@ -1025,12 +1025,12 @@ OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_CTRL_IFACE_DBUS
|
ifdef CONFIG_CTRL_IFACE_DBUS
|
||||||
CFLAGS += -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE
|
DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE
|
||||||
OBJS += ctrl_iface_dbus.o ctrl_iface_dbus_handlers.o dbus_dict_helpers.o
|
DBUS_OBJS += ctrl_iface_dbus.o ctrl_iface_dbus_handlers.o
|
||||||
|
DBUS_OBJS += dbus_dict_helpers.o
|
||||||
ifndef DBUS_LIBS
|
ifndef DBUS_LIBS
|
||||||
DBUS_LIBS := $(shell pkg-config --libs dbus-1)
|
DBUS_LIBS := $(shell pkg-config --libs dbus-1)
|
||||||
endif
|
endif
|
||||||
LIBS += $(DBUS_LIBS)
|
|
||||||
ifndef DBUS_INCLUDE
|
ifndef DBUS_INCLUDE
|
||||||
DBUS_INCLUDE := $(shell pkg-config --cflags dbus-1)
|
DBUS_INCLUDE := $(shell pkg-config --cflags dbus-1)
|
||||||
endif
|
endif
|
||||||
|
@ -1045,9 +1045,32 @@ DBUS_VERSION_MINOR=0
|
||||||
endif
|
endif
|
||||||
DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
|
DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
|
||||||
DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
|
DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
|
||||||
CFLAGS += $(DBUS_INCLUDE)
|
DBUS_CFLAGS += $(DBUS_INCLUDE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
DBUS_OBJS ?= dbus_dict_helpers.o
|
||||||
|
DBUS_OBJS += ctrl_iface_dbus_new_helpers.o
|
||||||
|
DBUS_OBJS += ctrl_iface_dbus_new.o ctrl_iface_dbus_new_handlers.o
|
||||||
|
ifndef DBUS_LIBS
|
||||||
|
DBUS_LIBS := $(shell pkg-config --libs dbus-1)
|
||||||
|
endif
|
||||||
|
ifndef DBUS_INCLUDE
|
||||||
|
DBUS_INCLUDE := $(shell pkg-config --cflags dbus-1)
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_CTRL_IFACE_DBUS_INTRO
|
||||||
|
DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO
|
||||||
|
DBUS_INCLUDE += $(shell xml2-config --cflags)
|
||||||
|
DBUS_LIBS += $(shell xml2-config --libs)
|
||||||
|
endif
|
||||||
|
DBUS_CFLAGS += $(DBUS_INCLUDE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS += $(DBUS_OBJS)
|
||||||
|
CFLAGS += $(DBUS_CFLAGS)
|
||||||
|
LIBS += $(DBUS_LIBS)
|
||||||
|
|
||||||
ifdef CONFIG_READLINE
|
ifdef CONFIG_READLINE
|
||||||
CFLAGS += -DCONFIG_READLINE
|
CFLAGS += -DCONFIG_READLINE
|
||||||
LIBS_c += -lncurses -lreadline
|
LIBS_c += -lncurses -lreadline
|
||||||
|
|
|
@ -45,8 +45,8 @@ static DBusMessage * wpas_dbus_new_invalid_opts_error(DBusMessage *message,
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
|
|
||||||
reply = dbus_message_new_error(message, WPAS_ERROR_INVALID_OPTS,
|
reply = dbus_message_new_error(message, WPAS_ERROR_INVALID_OPTS,
|
||||||
"Did not receive correct message "
|
"Did not receive correct message "
|
||||||
"arguments.");
|
"arguments.");
|
||||||
if (arg != NULL)
|
if (arg != NULL)
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &arg,
|
dbus_message_append_args(reply, DBUS_TYPE_STRING, &arg,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
|
@ -77,10 +77,10 @@ static DBusMessage * wpas_dbus_new_success_reply(DBusMessage *message)
|
||||||
|
|
||||||
static void wpas_dbus_free_wpa_interface(struct wpa_interface *iface)
|
static void wpas_dbus_free_wpa_interface(struct wpa_interface *iface)
|
||||||
{
|
{
|
||||||
free((char *) iface->driver);
|
os_free((char *) iface->driver);
|
||||||
free((char *) iface->driver_param);
|
os_free((char *) iface->driver_param);
|
||||||
free((char *) iface->confname);
|
os_free((char *) iface->confname);
|
||||||
free((char *) iface->bridge_ifname);
|
os_free((char *) iface->bridge_ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
|
||||||
DBusMessage *reply = NULL;
|
DBusMessage *reply = NULL;
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
|
|
||||||
memset(&iface, 0, sizeof(iface));
|
os_memset(&iface, 0, sizeof(iface));
|
||||||
|
|
||||||
dbus_message_iter_init(message, &iter);
|
dbus_message_iter_init(message, &iter);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
|
||||||
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
|
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
|
||||||
goto error;
|
goto error;
|
||||||
dbus_message_iter_get_basic(&iter, &ifname);
|
dbus_message_iter_get_basic(&iter, &ifname);
|
||||||
if (!strlen(ifname))
|
if (!os_strlen(ifname))
|
||||||
goto error;
|
goto error;
|
||||||
iface.ifname = ifname;
|
iface.ifname = ifname;
|
||||||
|
|
||||||
|
@ -283,6 +283,7 @@ out:
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_global_set_debugparams- Set the debug params
|
* wpas_dbus_global_set_debugparams- Set the debug params
|
||||||
* @message: Pointer to incoming dbus message
|
* @message: Pointer to incoming dbus message
|
||||||
|
@ -306,23 +307,21 @@ DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
|
||||||
DBUS_TYPE_BOOLEAN, &debug_timestamp,
|
DBUS_TYPE_BOOLEAN, &debug_timestamp,
|
||||||
DBUS_TYPE_BOOLEAN, &debug_show_keys,
|
DBUS_TYPE_BOOLEAN, &debug_show_keys,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
reply = wpas_dbus_new_invalid_opts_error(message, NULL);
|
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wpa_supplicant_set_debug_params(global, debug_level,
|
if (wpa_supplicant_set_debug_params(global, debug_level,
|
||||||
debug_timestamp ? 1 : 0,
|
debug_timestamp ? 1 : 0,
|
||||||
debug_show_keys ? 1 : 0)) {
|
debug_show_keys ? 1 : 0)) {
|
||||||
reply = wpas_dbus_new_invalid_opts_error(message, NULL);
|
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = wpas_dbus_new_success_reply(message);
|
reply = wpas_dbus_new_success_reply(message);
|
||||||
|
|
||||||
out:
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_iface_scan - Request a wireless scan on an interface
|
* wpas_dbus_iface_scan - Request a wireless scan on an interface
|
||||||
* @message: Pointer to incoming dbus message
|
* @message: Pointer to incoming dbus message
|
||||||
|
@ -394,14 +393,14 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
||||||
/* Construct the object path for this network. Note that ':'
|
/* Construct the object path for this network. Note that ':'
|
||||||
* is not a valid character in dbus object paths.
|
* is not a valid character in dbus object paths.
|
||||||
*/
|
*/
|
||||||
snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_BSSIDS_PART "/"
|
"%s/" WPAS_DBUS_BSSIDS_PART "/"
|
||||||
WPAS_DBUS_BSSID_FORMAT,
|
WPAS_DBUS_BSSID_FORMAT,
|
||||||
wpa_supplicant_get_dbus_path(wpa_s),
|
wpa_supplicant_get_dbus_path(wpa_s),
|
||||||
MAC2STR(res->bssid));
|
MAC2STR(res->bssid));
|
||||||
dbus_message_iter_append_basic(&sub_iter,
|
dbus_message_iter_append_basic(&sub_iter,
|
||||||
DBUS_TYPE_OBJECT_PATH, &path);
|
DBUS_TYPE_OBJECT_PATH, &path);
|
||||||
free(path);
|
os_free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_close_container(&iter, &sub_iter);
|
dbus_message_iter_close_container(&iter, &sub_iter);
|
||||||
|
@ -551,8 +550,8 @@ DBusMessage * wpas_dbus_iface_capabilities(DBusMessage *message,
|
||||||
|
|
||||||
/* free returned method array */
|
/* free returned method array */
|
||||||
while (eap_methods[i])
|
while (eap_methods[i])
|
||||||
free(eap_methods[i++]);
|
os_free(eap_methods[i++]);
|
||||||
free(eap_methods);
|
os_free(eap_methods);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -834,17 +833,17 @@ DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
|
||||||
wpa_config_set_network_defaults(ssid);
|
wpa_config_set_network_defaults(ssid);
|
||||||
|
|
||||||
/* Construct the object path for this network. */
|
/* Construct the object path for this network. */
|
||||||
snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NETWORKS_PART "/%d",
|
"%s/" WPAS_DBUS_NETWORKS_PART "/%d",
|
||||||
wpa_supplicant_get_dbus_path(wpa_s),
|
wpa_supplicant_get_dbus_path(wpa_s),
|
||||||
ssid->id);
|
ssid->id);
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
||||||
&path, DBUS_TYPE_INVALID);
|
&path, DBUS_TYPE_INVALID);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(path);
|
os_free(path);
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,6 +879,7 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
|
||||||
reply = wpas_dbus_new_invalid_network_error(message);
|
reply = wpas_dbus_new_invalid_network_error(message);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the network is actually a child of this interface */
|
/* Ensure the network is actually a child of this interface */
|
||||||
if (strcmp(iface, wpa_supplicant_get_dbus_path(wpa_s)) != 0) {
|
if (strcmp(iface, wpa_supplicant_get_dbus_path(wpa_s)) != 0) {
|
||||||
reply = wpas_dbus_new_invalid_network_error(message);
|
reply = wpas_dbus_new_invalid_network_error(message);
|
||||||
|
@ -908,8 +908,8 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
|
||||||
reply = wpas_dbus_new_success_reply(message);
|
reply = wpas_dbus_new_success_reply(message);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(iface);
|
os_free(iface);
|
||||||
free(net_id);
|
os_free(net_id);
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,6 +920,7 @@ static const char *dont_quote[] = {
|
||||||
"bssid", NULL
|
"bssid", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static dbus_bool_t should_quote_opt(const char *key)
|
static dbus_bool_t should_quote_opt(const char *key)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -931,6 +932,7 @@ static dbus_bool_t should_quote_opt(const char *key)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_iface_set_network - Set options for a configured network
|
* wpas_dbus_iface_set_network - Set options for a configured network
|
||||||
* @message: Pointer to incoming dbus message
|
* @message: Pointer to incoming dbus message
|
||||||
|
@ -978,13 +980,13 @@ DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
ret = wpa_snprintf_hex(value, size,
|
ret = wpa_snprintf_hex(value, size,
|
||||||
(u8 *) entry.bytearray_value,
|
(u8 *) entry.bytearray_value,
|
||||||
entry.array_len);
|
entry.array_len);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else if (entry.type == DBUS_TYPE_STRING) {
|
} else if (entry.type == DBUS_TYPE_STRING) {
|
||||||
if (should_quote_opt(entry.key)) {
|
if (should_quote_opt(entry.key)) {
|
||||||
size = strlen(entry.str_value);
|
size = os_strlen(entry.str_value);
|
||||||
/* Zero-length option check */
|
/* Zero-length option check */
|
||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -992,12 +994,12 @@ DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
|
||||||
value = os_zalloc(size);
|
value = os_zalloc(size);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
ret = snprintf(value, size, "\"%s\"",
|
ret = os_snprintf(value, size, "\"%s\"",
|
||||||
entry.str_value);
|
entry.str_value);
|
||||||
if (ret < 0 || (size_t) ret != (size - 1))
|
if (ret < 0 || (size_t) ret != (size - 1))
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
value = strdup(entry.str_value);
|
value = os_strdup(entry.str_value);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -1005,14 +1007,16 @@ DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
|
||||||
value = os_zalloc(size);
|
value = os_zalloc(size);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
ret = snprintf(value, size, "%u", entry.uint32_value);
|
ret = os_snprintf(value, size, "%u",
|
||||||
|
entry.uint32_value);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else if (entry.type == DBUS_TYPE_INT32) {
|
} else if (entry.type == DBUS_TYPE_INT32) {
|
||||||
value = os_zalloc(size);
|
value = os_zalloc(size);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
ret = snprintf(value, size, "%d", entry.int32_value);
|
ret = os_snprintf(value, size, "%d",
|
||||||
|
entry.int32_value);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else
|
} else
|
||||||
|
@ -1021,17 +1025,17 @@ DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
|
||||||
if (wpa_config_set(ssid, entry.key, value, 0) < 0)
|
if (wpa_config_set(ssid, entry.key, value, 0) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((strcmp(entry.key, "psk") == 0 &&
|
if ((os_strcmp(entry.key, "psk") == 0 &&
|
||||||
value[0] == '"' && ssid->ssid_len) ||
|
value[0] == '"' && ssid->ssid_len) ||
|
||||||
(strcmp(entry.key, "ssid") == 0 && ssid->passphrase))
|
(os_strcmp(entry.key, "ssid") == 0 && ssid->passphrase))
|
||||||
wpa_config_update_psk(ssid);
|
wpa_config_update_psk(ssid);
|
||||||
|
|
||||||
free(value);
|
os_free(value);
|
||||||
wpa_dbus_dict_entry_clear(&entry);
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(value);
|
os_free(value);
|
||||||
reply = wpas_dbus_new_invalid_opts_error(message, entry.key);
|
reply = wpas_dbus_new_invalid_opts_error(message, entry.key);
|
||||||
wpa_dbus_dict_entry_clear(&entry);
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
break;
|
break;
|
||||||
|
@ -1101,7 +1105,7 @@ DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||||
char *iface_obj_path = NULL;
|
char *iface_obj_path = NULL;
|
||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
|
|
||||||
if (strlen(dbus_message_get_signature(message)) == 0) {
|
if (os_strlen(dbus_message_get_signature(message)) == 0) {
|
||||||
/* Any network */
|
/* Any network */
|
||||||
ssid = NULL;
|
ssid = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1126,7 +1130,7 @@ DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||||
}
|
}
|
||||||
/* Ensure the object path really points to this interface */
|
/* Ensure the object path really points to this interface */
|
||||||
obj_path = wpa_supplicant_get_dbus_path(wpa_s);
|
obj_path = wpa_supplicant_get_dbus_path(wpa_s);
|
||||||
if (strcmp(iface_obj_path, obj_path) != 0) {
|
if (os_strcmp(iface_obj_path, obj_path) != 0) {
|
||||||
reply = wpas_dbus_new_invalid_network_error(message);
|
reply = wpas_dbus_new_invalid_network_error(message);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1150,8 +1154,8 @@ DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||||
reply = wpas_dbus_new_success_reply(message);
|
reply = wpas_dbus_new_success_reply(message);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(iface_obj_path);
|
os_free(iface_obj_path);
|
||||||
free(network);
|
os_free(network);
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,6 +1282,7 @@ error:
|
||||||
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpas_dbus_iface_get_state - Get interface state
|
* wpas_dbus_iface_get_state - Get interface state
|
||||||
* @message: Pointer to incoming dbus message
|
* @message: Pointer to incoming dbus message
|
||||||
|
@ -1429,7 +1434,7 @@ DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
|
||||||
* Asks wpa_supplicant to remove one or more previously stored binary blobs.
|
* Asks wpa_supplicant to remove one or more previously stored binary blobs.
|
||||||
*/
|
*/
|
||||||
DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
|
DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s)
|
struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter, array;
|
DBusMessageIter iter, array;
|
||||||
char *err_msg = NULL;
|
char *err_msg = NULL;
|
||||||
|
@ -1445,7 +1450,7 @@ DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
dbus_message_iter_get_basic(&array, &name);
|
dbus_message_iter_get_basic(&array, &name);
|
||||||
if (!strlen(name))
|
if (!os_strlen(name))
|
||||||
err_msg = "Invalid blob name.";
|
err_msg = "Invalid blob name.";
|
||||||
|
|
||||||
if (wpa_config_remove_blob(wpa_s->conf, name) != 0)
|
if (wpa_config_remove_blob(wpa_s->conf, name) != 0)
|
||||||
|
@ -1455,10 +1460,9 @@ DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
|
||||||
dbus_message_iter_next(&array);
|
dbus_message_iter_next(&array);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err_msg) {
|
if (err_msg)
|
||||||
return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR,
|
return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR,
|
||||||
err_msg);
|
err_msg);
|
||||||
}
|
|
||||||
|
|
||||||
return wpas_dbus_new_success_reply(message);
|
return wpas_dbus_new_success_reply(message);
|
||||||
}
|
}
|
||||||
|
@ -1557,7 +1561,7 @@ DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
} else {
|
} else {
|
||||||
char npin[9];
|
char npin[9];
|
||||||
sprintf(npin, "%08d", ret);
|
os_snprintf(npin, sizeof(npin), "%08d", ret);
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &npin,
|
dbus_message_append_args(reply, DBUS_TYPE_STRING, &npin,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
2000
wpa_supplicant/ctrl_iface_dbus_new.c
Normal file
2000
wpa_supplicant/ctrl_iface_dbus_new.c
Normal file
File diff suppressed because it is too large
Load diff
142
wpa_supplicant/ctrl_iface_dbus_new.h
Normal file
142
wpa_supplicant/ctrl_iface_dbus_new.h
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* WPA Supplicant / dbus-based control interface
|
||||||
|
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||||
|
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Alternatively, this software may be distributed under the terms of BSD
|
||||||
|
* license.
|
||||||
|
*
|
||||||
|
* See README and COPYING for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CTRL_IFACE_DBUS_NEW_H
|
||||||
|
#define CTRL_IFACE_DBUS_NEW_H
|
||||||
|
|
||||||
|
struct wpa_global;
|
||||||
|
struct wpa_supplicant;
|
||||||
|
struct wpa_ssid;
|
||||||
|
struct wps_event_m2d;
|
||||||
|
struct wps_event_fail;
|
||||||
|
struct wps_credential;
|
||||||
|
|
||||||
|
enum wpas_dbus_prop {
|
||||||
|
WPAS_DBUS_PROP_AP_SCAN,
|
||||||
|
WPAS_DBUS_PROP_SCANNING,
|
||||||
|
WPAS_DBUS_PROP_CURRENT_BSS,
|
||||||
|
WPAS_DBUS_PROP_CURRENT_NETWORK,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wpas_dbus_callbacks {
|
||||||
|
struct ctrl_iface_dbus_new_priv * (*dbus_ctrl_init)(
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
void (*dbus_ctrl_deinit)(struct ctrl_iface_dbus_new_priv *iface);
|
||||||
|
|
||||||
|
void (*signal_interface_created)(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,
|
||||||
|
wpa_states new_state,
|
||||||
|
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]);
|
||||||
|
int (*unregister_bss)(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 bssid[ETH_ALEN]);
|
||||||
|
|
||||||
|
void (*signal_prop_changed)(struct wpa_supplicant *wpa_s,
|
||||||
|
enum wpas_dbus_prop property);
|
||||||
|
void (*signal_debug_params_changed)(struct wpa_global *global);
|
||||||
|
|
||||||
|
#ifdef CONFIG_WPS
|
||||||
|
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);
|
||||||
|
#endif /* CONFIG_WPS */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
|
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||||
|
|
||||||
|
#define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
|
||||||
|
#define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
|
||||||
|
#define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
|
||||||
|
#define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
|
||||||
|
#define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
|
||||||
|
#define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_IFACE_INTERFACE ".Network"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
|
||||||
|
#define WPAS_DBUS_NEW_IFACE_BSSID WPAS_DBUS_NEW_IFACE_INTERFACE ".BSS"
|
||||||
|
|
||||||
|
|
||||||
|
/* Errors */
|
||||||
|
#define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
|
||||||
|
WPAS_DBUS_NEW_INTERFACE ".UnknownError"
|
||||||
|
#define WPAS_DBUS_ERROR_INVALID_ARGS \
|
||||||
|
WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_ERROR_IFACE_EXISTS \
|
||||||
|
WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
|
||||||
|
#define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
|
||||||
|
WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_ERROR_NOT_CONNECTED \
|
||||||
|
WPAS_DBUS_NEW_IFACE_INTERFACE ".NotConnected"
|
||||||
|
#define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
|
||||||
|
WPAS_DBUS_NEW_IFACE_INTERFACE ".NetworkUnknown"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_ERROR_BLOB_EXISTS \
|
||||||
|
WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobExists"
|
||||||
|
#define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
|
||||||
|
WPAS_DBUS_NEW_IFACE_INTERFACE ".BlobUnknown"
|
||||||
|
|
||||||
|
#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
|
||||||
|
|
||||||
|
struct wpas_dbus_callbacks * wpas_dbus_get_callbacks(void);
|
||||||
|
const char * wpas_dbus_get_path(struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
||||||
|
static inline struct wpas_dbus_callbacks * wpas_dbus_get_callbacks(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
||||||
|
#endif /* CTRL_IFACE_DBUS_H_NEW */
|
3312
wpa_supplicant/ctrl_iface_dbus_new_handlers.c
Normal file
3312
wpa_supplicant/ctrl_iface_dbus_new_handlers.c
Normal file
File diff suppressed because it is too large
Load diff
142
wpa_supplicant/ctrl_iface_dbus_new_handlers.h
Normal file
142
wpa_supplicant/ctrl_iface_dbus_new_handlers.h
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
* WPA Supplicant / dbus-based control interface
|
||||||
|
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Alternatively, this software may be distributed under the terms of BSD
|
||||||
|
* license.
|
||||||
|
*
|
||||||
|
* See README and COPYING for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CTRL_IFACE_DBUS_NEW_HANDLERS_H
|
||||||
|
#define CTRL_IFACE_DBUS_NEW_HANDLERS_H
|
||||||
|
|
||||||
|
struct network_handler_args {
|
||||||
|
struct wpa_supplicant *wpa_s;
|
||||||
|
struct wpa_ssid *ssid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bss_handler_args {
|
||||||
|
struct wpa_supplicant *wpa_s;
|
||||||
|
u8 bssid[ETH_ALEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_debug_params(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_setter_debug_params(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_interfaces(DBusMessage *message,
|
||||||
|
struct wpa_global *global);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_eap_methods(DBusMessage *message,
|
||||||
|
void *nothing);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_disconnect(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_remove_blob(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_capabilities(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_state(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_scanning(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_ap_scan(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_setter_ap_scan(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_ifname(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_driver(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_bridge_ifname(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_bsss(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_networks(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_blobs(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *bss);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_bss_properties(DBusMessage *message,
|
||||||
|
struct bss_handler_args *bss);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_enabled(DBusMessage *message,
|
||||||
|
struct network_handler_args *net);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_setter_enabled(DBusMessage *message,
|
||||||
|
struct network_handler_args *net);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_network_properties(
|
||||||
|
DBusMessage *message, struct network_handler_args *net);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_setter_network_properties(
|
||||||
|
DBusMessage *message, struct network_handler_args *net);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_WPS
|
||||||
|
DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_process_credentials(
|
||||||
|
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_setter_process_credentials(
|
||||||
|
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_getter_credentials(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
|
#endif /* CTRL_IFACE_DBUS_HANDLERS_NEW_H */
|
1900
wpa_supplicant/ctrl_iface_dbus_new_helpers.c
Normal file
1900
wpa_supplicant/ctrl_iface_dbus_new_helpers.c
Normal file
File diff suppressed because it is too large
Load diff
140
wpa_supplicant/ctrl_iface_dbus_new_helpers.h
Normal file
140
wpa_supplicant/ctrl_iface_dbus_new_helpers.h
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
/*
|
||||||
|
* WPA Supplicant / dbus-based control interface
|
||||||
|
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||||
|
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Alternatively, this software may be distributed under the terms of BSD
|
||||||
|
* license.
|
||||||
|
*
|
||||||
|
* See README and COPYING for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WPA_DBUS_CTRL_H
|
||||||
|
#define WPA_DBUS_CTRL_H
|
||||||
|
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
|
struct ctrl_iface_dbus_new_priv {
|
||||||
|
DBusConnection *con;
|
||||||
|
int should_dispatch;
|
||||||
|
void *application_data;
|
||||||
|
|
||||||
|
u32 next_objid;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
|
||||||
|
void *user_data);
|
||||||
|
typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
|
||||||
|
|
||||||
|
typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
struct wpa_dbus_object_desc {
|
||||||
|
DBusConnection *connection;
|
||||||
|
struct wpa_dbus_method_desc *methods;
|
||||||
|
struct wpa_dbus_signal_desc *signals;
|
||||||
|
struct wpa_dbus_property_desc *properties;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum dbus_prop_access { R, W, RW };
|
||||||
|
|
||||||
|
enum dbus_arg_direction { ARG_IN, ARG_OUT };
|
||||||
|
|
||||||
|
struct wpa_dbus_argument {
|
||||||
|
char *name;
|
||||||
|
char *type;
|
||||||
|
enum dbus_arg_direction dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define END_ARGS { NULL, NULL, ARG_IN }
|
||||||
|
|
||||||
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
|
||||||
|
#ifndef SIGPOLL
|
||||||
|
#ifdef SIGIO
|
||||||
|
/*
|
||||||
|
* If we do not have SIGPOLL, try to use SIGIO instead. This is needed for
|
||||||
|
* FreeBSD.
|
||||||
|
*/
|
||||||
|
#define SIGPOLL SIGIO
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||||
|
#define WPAS_DBUS_INTERFACE_MAX 150
|
||||||
|
#define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
|
||||||
|
|
||||||
|
#define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
|
||||||
|
#define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
|
||||||
|
#define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||||
|
#define WPA_DBUS_PROPERTIES_GET "Get"
|
||||||
|
#define WPA_DBUS_PROPERTIES_SET "Set"
|
||||||
|
#define WPA_DBUS_PROPERTIES_GETALL "GetAll"
|
||||||
|
|
||||||
|
void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
|
||||||
|
|
||||||
|
struct ctrl_iface_dbus_new_priv *
|
||||||
|
wpa_dbus_ctrl_iface_init(void *application_data, char *dbus_path,
|
||||||
|
char *dbus_service,
|
||||||
|
struct wpa_dbus_object_desc *obj_desc);
|
||||||
|
|
||||||
|
void wpa_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_new_priv *iface);
|
||||||
|
|
||||||
|
int wpa_dbus_register_object_per_iface(
|
||||||
|
struct ctrl_iface_dbus_new_priv *ctrl_iface,
|
||||||
|
const char *path, const char *ifname,
|
||||||
|
struct wpa_dbus_object_desc *obj_desc);
|
||||||
|
|
||||||
|
int wpa_dbus_unregister_object_per_iface(
|
||||||
|
struct ctrl_iface_dbus_new_priv *ctrl_iface,
|
||||||
|
const char *path);
|
||||||
|
|
||||||
|
int wpa_dbus_method_register(struct wpa_dbus_object_desc *obj_dsc,
|
||||||
|
char *dbus_interface, char *dbus_method,
|
||||||
|
WPADBusMethodHandler method_handler,
|
||||||
|
void *handler_argument,
|
||||||
|
WPADBusArgumentFreeFunction argument_free_func,
|
||||||
|
struct wpa_dbus_argument args[]);
|
||||||
|
|
||||||
|
int wpa_dbus_signal_register(struct wpa_dbus_object_desc *obj_dsc,
|
||||||
|
char *dbus_interface, char *dbus_signal,
|
||||||
|
struct wpa_dbus_argument args[]);
|
||||||
|
|
||||||
|
int wpa_dbus_property_register(
|
||||||
|
struct wpa_dbus_object_desc *obj_dsc,
|
||||||
|
char *dbus_interface, char *dbus_property,
|
||||||
|
char *type,
|
||||||
|
WPADBusPropertyAccessor getter,
|
||||||
|
WPADBusPropertyAccessor setter,
|
||||||
|
void *user_data,
|
||||||
|
WPADBusArgumentFreeFunction user_datat_free_func,
|
||||||
|
enum dbus_prop_access access);
|
||||||
|
|
||||||
|
void wpa_dbus_signal_property_changed(struct ctrl_iface_dbus_new_priv *iface,
|
||||||
|
WPADBusPropertyAccessor property_getter,
|
||||||
|
void *getter_arg,
|
||||||
|
const char *path,
|
||||||
|
const char *interface_name,
|
||||||
|
const char *property_name);
|
||||||
|
|
||||||
|
/* Methods internal to the dbus control interface */
|
||||||
|
u32 wpa_dbus_next_objid(struct ctrl_iface_dbus_new_priv *iface);
|
||||||
|
|
||||||
|
|
||||||
|
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
||||||
|
static inline void wpa_dbus_signal_property_changed(
|
||||||
|
struct ctrl_iface_dbus_new_priv *iface,
|
||||||
|
WPADBusPropertyAccessor property_getter, void *getter_arg,
|
||||||
|
const char *path, const char *interface_name,
|
||||||
|
const char *property_name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
|
|
||||||
|
#endif /* WPA_DBUS_CTRL_H */
|
|
@ -7,10 +7,20 @@
|
||||||
|
|
||||||
<allow send_destination="fi.epitest.hostap.WPASupplicant"/>
|
<allow send_destination="fi.epitest.hostap.WPASupplicant"/>
|
||||||
<allow send_interface="fi.epitest.hostap.WPASupplicant"/>
|
<allow send_interface="fi.epitest.hostap.WPASupplicant"/>
|
||||||
|
|
||||||
|
<allow own="fi.w1.wpa_supplicant1"/>
|
||||||
|
|
||||||
|
<allow send_destination="fi.w1.wpa_supplicant1"/>
|
||||||
|
<allow send_interface="fi.w1.wpa_supplicant1"/>
|
||||||
|
|
||||||
</policy>
|
</policy>
|
||||||
<policy context="default">
|
<policy context="default">
|
||||||
<deny own="fi.epitest.hostap.WPASupplicant"/>
|
<deny own="fi.epitest.hostap.WPASupplicant"/>
|
||||||
<deny send_destination="fi.epitest.hostap.WPASupplicant"/>
|
<deny send_destination="fi.epitest.hostap.WPASupplicant"/>
|
||||||
<deny send_interface="fi.epitest.hostap.WPASupplicant"/>
|
<deny send_interface="fi.epitest.hostap.WPASupplicant"/>
|
||||||
|
|
||||||
|
<deny own="fi.w1.wpa_supplicant1"/>
|
||||||
|
<deny send_destination="fi.w1.wpa_supplicant1"/>
|
||||||
|
<deny send_interface="fi.w1.wpa_supplicant1"/>
|
||||||
</policy>
|
</policy>
|
||||||
</busconfig>
|
</busconfig>
|
||||||
|
|
|
@ -337,9 +337,17 @@ CONFIG_PEERKEY=y
|
||||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||||
|
|
||||||
# Add support for DBus control interface
|
# Add support for old DBus control interface
|
||||||
|
# (fi.epitest.hostap.WPASupplicant)
|
||||||
#CONFIG_CTRL_IFACE_DBUS=y
|
#CONFIG_CTRL_IFACE_DBUS=y
|
||||||
|
|
||||||
|
# Add support for new DBus control interface
|
||||||
|
# (fi.w1.hostap.wpa_supplicant1)
|
||||||
|
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||||
|
|
||||||
|
# Add introspection support for new DBus control interface (requires libxml2)
|
||||||
|
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||||
|
|
||||||
# Add support for loading EAP methods dynamically as shared libraries.
|
# Add support for loading EAP methods dynamically as shared libraries.
|
||||||
# When this option is enabled, each EAP method can be either included
|
# When this option is enabled, each EAP method can be either included
|
||||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||||
|
|
|
@ -19,15 +19,25 @@
|
||||||
#include "wpa_supplicant_i.h"
|
#include "wpa_supplicant_i.h"
|
||||||
#include "wps_supplicant.h"
|
#include "wps_supplicant.h"
|
||||||
#include "ctrl_iface_dbus.h"
|
#include "ctrl_iface_dbus.h"
|
||||||
|
#include "ctrl_iface_dbus_new.h"
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
|
|
||||||
int wpas_notify_supplicant_initialized(struct wpa_global *global)
|
int wpas_notify_supplicant_initialized(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
|
||||||
if (global->params.dbus_ctrl_interface) {
|
if (global->params.dbus_ctrl_interface) {
|
||||||
global->dbus_ctrl_iface =
|
global->dbus_ctrl_iface =
|
||||||
wpa_supplicant_dbus_ctrl_iface_init(global);
|
wpa_supplicant_dbus_ctrl_iface_init(global);
|
||||||
if (global->dbus_ctrl_iface == NULL)
|
if (global->dbus_ctrl_iface == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (cbs) {
|
||||||
|
global->dbus_new_ctrl_iface =
|
||||||
|
cbs->dbus_ctrl_init(global);
|
||||||
|
if (global->dbus_new_ctrl_iface == NULL)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -36,16 +46,26 @@ int wpas_notify_supplicant_initialized(struct wpa_global *global)
|
||||||
|
|
||||||
void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
|
void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
|
||||||
if (global->dbus_ctrl_iface)
|
if (global->dbus_ctrl_iface)
|
||||||
wpa_supplicant_dbus_ctrl_iface_deinit(global->dbus_ctrl_iface);
|
wpa_supplicant_dbus_ctrl_iface_deinit(global->dbus_ctrl_iface);
|
||||||
|
|
||||||
|
if (cbs && global->dbus_new_ctrl_iface)
|
||||||
|
cbs->dbus_ctrl_deinit(global->dbus_new_ctrl_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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))
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,56 +73,91 @@ int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
|
||||||
|
|
||||||
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 */
|
||||||
|
if (cbs)
|
||||||
|
cbs->unregister_interface(wpa_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
|
void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
wpa_states new_state, wpa_states old_state)
|
wpa_states new_state, 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 */
|
||||||
|
if (cbs)
|
||||||
|
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();
|
||||||
|
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();
|
||||||
|
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();
|
||||||
|
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();
|
||||||
|
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();
|
||||||
|
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 */
|
||||||
|
if (cbs)
|
||||||
|
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();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_scan_done(wpa_s, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,50 +173,79 @@ void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||||
void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
|
void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
|
||||||
const struct wps_credential *cred)
|
const struct wps_credential *cred)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_wps_credentials(wpa_s, cred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_m2d *m2d)
|
struct wps_event_m2d *m2d)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_wps_event_m2d(wpa_s, m2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
|
void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
struct wps_event_fail *fail)
|
struct wps_event_fail *fail)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_wps_event_fail(wpa_s, fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
|
void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_wps_event_success(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();
|
||||||
|
if (wpa_s->global->dbus_new_ctrl_iface && 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();
|
||||||
|
if (wpa_s->global->dbus_new_ctrl_iface && cbs)
|
||||||
|
cbs->unregister_network(wpa_s, ssid->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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();
|
||||||
|
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();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_blob_removed(wpa_s, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wpas_notify_debug_params_changed(struct wpa_global *global)
|
void wpas_notify_debug_params_changed(struct wpa_global *global)
|
||||||
{
|
{
|
||||||
|
struct wpas_dbus_callbacks *cbs = wpas_dbus_get_callbacks();
|
||||||
|
if (cbs)
|
||||||
|
cbs->signal_debug_params_changed(global);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,10 @@ struct wpa_global {
|
||||||
struct wpa_supplicant *ifaces;
|
struct wpa_supplicant *ifaces;
|
||||||
struct wpa_params params;
|
struct wpa_params params;
|
||||||
struct ctrl_iface_global_priv *ctrl_iface;
|
struct ctrl_iface_global_priv *ctrl_iface;
|
||||||
|
/* old DBus API data */
|
||||||
struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
|
struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
|
||||||
|
/* new DBus API data */
|
||||||
|
struct ctrl_iface_dbus_new_priv *dbus_new_ctrl_iface;
|
||||||
void **drv_priv;
|
void **drv_priv;
|
||||||
size_t drv_count;
|
size_t drv_count;
|
||||||
};
|
};
|
||||||
|
@ -305,6 +308,9 @@ struct wpa_supplicant {
|
||||||
#ifdef CONFIG_CTRL_IFACE_DBUS
|
#ifdef CONFIG_CTRL_IFACE_DBUS
|
||||||
char *dbus_path;
|
char *dbus_path;
|
||||||
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
||||||
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
char *dbus_new_path;
|
||||||
|
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||||
char bridge_ifname[16];
|
char bridge_ifname[16];
|
||||||
|
|
||||||
char *confname;
|
char *confname;
|
||||||
|
|
Loading…
Reference in a new issue