Restore the dbus directory that was not meant to be deleted in r252729.
This commit is contained in:
commit
d4f2939c85
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252733
1
contrib/wpa/wpa_supplicant/dbus/.gitignore
vendored
Normal file
1
contrib/wpa/wpa_supplicant/dbus/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
libwpadbus.a
|
73
contrib/wpa/wpa_supplicant/dbus/Makefile
Normal file
73
contrib/wpa/wpa_supplicant/dbus/Makefile
Normal file
@ -0,0 +1,73 @@
|
||||
all: libwpadbus.a
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.d
|
||||
rm -f libwpadbus.a
|
||||
|
||||
install:
|
||||
@echo Nothing to be made.
|
||||
|
||||
ifndef CC
|
||||
CC=gcc
|
||||
endif
|
||||
|
||||
ifndef CFLAGS
|
||||
CFLAGS = -MMD -O2 -Wall -g
|
||||
endif
|
||||
|
||||
PKG_CONFIG ?= pkg-config
|
||||
CFLAGS += -I../../src -I../../src/utils
|
||||
|
||||
|
||||
Q=@
|
||||
E=echo
|
||||
ifeq ($(V), 1)
|
||||
Q=
|
||||
E=true
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
|
||||
|
||||
ifdef CONFIG_WPS
|
||||
CFLAGS += -DCONFIG_WPS
|
||||
endif
|
||||
|
||||
CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW
|
||||
CFLAGS += -DCONFIG_CTRL_IFACE_DBUS
|
||||
|
||||
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
|
||||
CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO
|
||||
DBUS_INCLUDE += $(shell xml2-config --cflags)
|
||||
DBUS_LIBS += $(shell xml2-config --libs)
|
||||
endif
|
||||
|
||||
CFLAGS += $(DBUS_INCLUDE)
|
||||
|
||||
LIB_OBJS= \
|
||||
dbus_common.o \
|
||||
dbus_old.o \
|
||||
dbus_old_handlers.o \
|
||||
dbus_new.o \
|
||||
dbus_new_handlers.o \
|
||||
dbus_new_helpers.o \
|
||||
dbus_new_introspect.o \
|
||||
dbus_dict_helpers.o
|
||||
|
||||
ifdef CONFIG_WPS
|
||||
LIB_OBJS += dbus_old_handlers_wps.o
|
||||
LIB_OBJS += dbus_new_handlers_wps.o
|
||||
endif
|
||||
|
||||
libwpadbus.a: $(LIB_OBJS)
|
||||
$(AR) crT $@ $?
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
27
contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf
Normal file
27
contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy user="root">
|
||||
<allow own="fi.epitest.hostap.WPASupplicant"/>
|
||||
|
||||
<allow send_destination="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"/>
|
||||
<allow receive_sender="fi.w1.wpa_supplicant1" receive_type="signal"/>
|
||||
</policy>
|
||||
<policy context="default">
|
||||
<deny own="fi.epitest.hostap.WPASupplicant"/>
|
||||
<deny send_destination="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"/>
|
||||
<deny receive_sender="fi.w1.wpa_supplicant1" receive_type="signal"/>
|
||||
</policy>
|
||||
</busconfig>
|
365
contrib/wpa/wpa_supplicant/dbus/dbus_common.c
Normal file
365
contrib/wpa/wpa_supplicant/dbus/dbus_common.c
Normal file
@ -0,0 +1,365 @@
|
||||
/*
|
||||
* wpa_supplicant D-Bus control interface - common functionality
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "utils/eloop.h"
|
||||
#include "dbus_common.h"
|
||||
#include "dbus_common_i.h"
|
||||
#include "dbus_new.h"
|
||||
#include "dbus_old.h"
|
||||
|
||||
|
||||
#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
|
||||
|
||||
|
||||
static void dispatch_data(DBusConnection *con)
|
||||
{
|
||||
while (dbus_connection_get_dispatch_status(con) ==
|
||||
DBUS_DISPATCH_DATA_REMAINS)
|
||||
dbus_connection_dispatch(con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dispatch_initial_dbus_messages - Dispatch initial dbus messages after
|
||||
* claiming bus name
|
||||
* @eloop_ctx: the DBusConnection to dispatch on
|
||||
* @timeout_ctx: unused
|
||||
*
|
||||
* If clients are quick to notice that service claimed its bus name,
|
||||
* there may have been messages that came in before initialization was
|
||||
* all finished. Dispatch those here.
|
||||
*/
|
||||
static void dispatch_initial_dbus_messages(void *eloop_ctx, void *timeout_ctx)
|
||||
{
|
||||
DBusConnection *con = eloop_ctx;
|
||||
dispatch_data(con);
|
||||
}
|
||||
|
||||
|
||||
static void process_watch(struct wpas_dbus_priv *priv,
|
||||
DBusWatch *watch, eloop_event_type type)
|
||||
{
|
||||
dbus_connection_ref(priv->con);
|
||||
|
||||
priv->should_dispatch = 0;
|
||||
|
||||
if (type == EVENT_TYPE_READ)
|
||||
dbus_watch_handle(watch, DBUS_WATCH_READABLE);
|
||||
else if (type == EVENT_TYPE_WRITE)
|
||||
dbus_watch_handle(watch, DBUS_WATCH_WRITABLE);
|
||||
else if (type == EVENT_TYPE_EXCEPTION)
|
||||
dbus_watch_handle(watch, DBUS_WATCH_ERROR);
|
||||
|
||||
if (priv->should_dispatch) {
|
||||
dispatch_data(priv->con);
|
||||
priv->should_dispatch = 0;
|
||||
}
|
||||
|
||||
dbus_connection_unref(priv->con);
|
||||
}
|
||||
|
||||
|
||||
static void process_watch_exception(int sock, void *eloop_ctx, void *sock_ctx)
|
||||
{
|
||||
process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_EXCEPTION);
|
||||
}
|
||||
|
||||
|
||||
static void process_watch_read(int sock, void *eloop_ctx, void *sock_ctx)
|
||||
{
|
||||
process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_READ);
|
||||
}
|
||||
|
||||
|
||||
static void process_watch_write(int sock, void *eloop_ctx, void *sock_ctx)
|
||||
{
|
||||
process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_WRITE);
|
||||
}
|
||||
|
||||
|
||||
static dbus_bool_t add_watch(DBusWatch *watch, void *data)
|
||||
{
|
||||
struct wpas_dbus_priv *priv = data;
|
||||
unsigned int flags;
|
||||
int fd;
|
||||
|
||||
if (!dbus_watch_get_enabled(watch))
|
||||
return TRUE;
|
||||
|
||||
flags = dbus_watch_get_flags(watch);
|
||||
fd = dbus_watch_get_unix_fd(watch);
|
||||
|
||||
eloop_register_sock(fd, EVENT_TYPE_EXCEPTION, process_watch_exception,
|
||||
priv, watch);
|
||||
|
||||
if (flags & DBUS_WATCH_READABLE) {
|
||||
eloop_register_sock(fd, EVENT_TYPE_READ, process_watch_read,
|
||||
priv, watch);
|
||||
}
|
||||
if (flags & DBUS_WATCH_WRITABLE) {
|
||||
eloop_register_sock(fd, EVENT_TYPE_WRITE, process_watch_write,
|
||||
priv, watch);
|
||||
}
|
||||
|
||||
dbus_watch_set_data(watch, priv, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void remove_watch(DBusWatch *watch, void *data)
|
||||
{
|
||||
unsigned int flags;
|
||||
int fd;
|
||||
|
||||
flags = dbus_watch_get_flags(watch);
|
||||
fd = dbus_watch_get_unix_fd(watch);
|
||||
|
||||
eloop_unregister_sock(fd, EVENT_TYPE_EXCEPTION);
|
||||
|
||||
if (flags & DBUS_WATCH_READABLE)
|
||||
eloop_unregister_sock(fd, EVENT_TYPE_READ);
|
||||
if (flags & DBUS_WATCH_WRITABLE)
|
||||
eloop_unregister_sock(fd, EVENT_TYPE_WRITE);
|
||||
|
||||
dbus_watch_set_data(watch, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void watch_toggled(DBusWatch *watch, void *data)
|
||||
{
|
||||
if (dbus_watch_get_enabled(watch))
|
||||
add_watch(watch, data);
|
||||
else
|
||||
remove_watch(watch, data);
|
||||
}
|
||||
|
||||
|
||||
static void process_timeout(void *eloop_ctx, void *sock_ctx)
|
||||
{
|
||||
DBusTimeout *timeout = sock_ctx;
|
||||
dbus_timeout_handle(timeout);
|
||||
}
|
||||
|
||||
|
||||
static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)
|
||||
{
|
||||
struct wpas_dbus_priv *priv = data;
|
||||
if (!dbus_timeout_get_enabled(timeout))
|
||||
return TRUE;
|
||||
|
||||
eloop_register_timeout(0, dbus_timeout_get_interval(timeout) * 1000,
|
||||
process_timeout, priv, timeout);
|
||||
|
||||
dbus_timeout_set_data(timeout, priv, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void remove_timeout(DBusTimeout *timeout, void *data)
|
||||
{
|
||||
struct wpas_dbus_priv *priv = data;
|
||||
eloop_cancel_timeout(process_timeout, priv, timeout);
|
||||
dbus_timeout_set_data(timeout, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void timeout_toggled(DBusTimeout *timeout, void *data)
|
||||
{
|
||||
if (dbus_timeout_get_enabled(timeout))
|
||||
add_timeout(timeout, data);
|
||||
else
|
||||
remove_timeout(timeout, data);
|
||||
}
|
||||
|
||||
|
||||
static void process_wakeup_main(int sig, void *signal_ctx)
|
||||
{
|
||||
struct wpas_dbus_priv *priv = signal_ctx;
|
||||
|
||||
if (sig != SIGPOLL || !priv->con)
|
||||
return;
|
||||
|
||||
if (dbus_connection_get_dispatch_status(priv->con) !=
|
||||
DBUS_DISPATCH_DATA_REMAINS)
|
||||
return;
|
||||
|
||||
/* Only dispatch once - we do not want to starve other events */
|
||||
dbus_connection_ref(priv->con);
|
||||
dbus_connection_dispatch(priv->con);
|
||||
dbus_connection_unref(priv->con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wakeup_main - Attempt to wake our mainloop up
|
||||
* @data: dbus control interface private data
|
||||
*
|
||||
* Try to wake up the main eloop so it will process
|
||||
* dbus events that may have happened.
|
||||
*/
|
||||
static void wakeup_main(void *data)
|
||||
{
|
||||
struct wpas_dbus_priv *priv = data;
|
||||
|
||||
/* Use SIGPOLL to break out of the eloop select() */
|
||||
raise(SIGPOLL);
|
||||
priv->should_dispatch = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* integrate_with_eloop - Register our mainloop integration with dbus
|
||||
* @connection: connection to the system message bus
|
||||
* @priv: a dbus control interface data structure
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
static int integrate_with_eloop(struct wpas_dbus_priv *priv)
|
||||
{
|
||||
if (!dbus_connection_set_watch_functions(priv->con, add_watch,
|
||||
remove_watch, watch_toggled,
|
||||
priv, NULL) ||
|
||||
!dbus_connection_set_timeout_functions(priv->con, add_timeout,
|
||||
remove_timeout,
|
||||
timeout_toggled, priv,
|
||||
NULL)) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Failed to set callback "
|
||||
"functions");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (eloop_register_signal(SIGPOLL, process_wakeup_main, priv))
|
||||
return -1;
|
||||
dbus_connection_set_wakeup_main_function(priv->con, wakeup_main,
|
||||
priv, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int wpas_dbus_init_common(struct wpas_dbus_priv *priv)
|
||||
{
|
||||
DBusError error;
|
||||
int ret = 0;
|
||||
|
||||
/* Get a reference to the system bus */
|
||||
dbus_error_init(&error);
|
||||
priv->con = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
|
||||
if (!priv->con) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Could not acquire the system "
|
||||
"bus: %s - %s", error.name, error.message);
|
||||
ret = -1;
|
||||
}
|
||||
dbus_error_free(&error);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int wpas_dbus_init_common_finish(struct wpas_dbus_priv *priv)
|
||||
{
|
||||
/* Tell dbus about our mainloop integration functions */
|
||||
integrate_with_eloop(priv);
|
||||
|
||||
/*
|
||||
* Dispatch initial DBus messages that may have come in since the bus
|
||||
* name was claimed above. Happens when clients are quick to notice the
|
||||
* service.
|
||||
*
|
||||
* FIXME: is there a better solution to this problem?
|
||||
*/
|
||||
eloop_register_timeout(0, 50, dispatch_initial_dbus_messages,
|
||||
priv->con, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void wpas_dbus_deinit_common(struct wpas_dbus_priv *priv)
|
||||
{
|
||||
if (priv->con) {
|
||||
eloop_cancel_timeout(dispatch_initial_dbus_messages,
|
||||
priv->con, NULL);
|
||||
dbus_connection_set_watch_functions(priv->con, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
dbus_connection_set_timeout_functions(priv->con, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
dbus_connection_unref(priv->con);
|
||||
}
|
||||
|
||||
os_free(priv);
|
||||
}
|
||||
|
||||
|
||||
struct wpas_dbus_priv * wpas_dbus_init(struct wpa_global *global)
|
||||
{
|
||||
struct wpas_dbus_priv *priv;
|
||||
|
||||
priv = os_zalloc(sizeof(*priv));
|
||||
if (priv == NULL)
|
||||
return NULL;
|
||||
priv->global = global;
|
||||
|
||||
if (wpas_dbus_init_common(priv) < 0) {
|
||||
wpas_dbus_deinit(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||
if (wpas_dbus_ctrl_iface_init(priv) < 0) {
|
||||
wpas_dbus_deinit(priv);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS
|
||||
if (wpa_supplicant_dbus_ctrl_iface_init(priv) < 0) {
|
||||
wpas_dbus_deinit(priv);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
||||
|
||||
if (wpas_dbus_init_common_finish(priv) < 0) {
|
||||
wpas_dbus_deinit(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return priv;
|
||||
}
|
||||
|
||||
|
||||
void wpas_dbus_deinit(struct wpas_dbus_priv *priv)
|
||||
{
|
||||
if (priv == NULL)
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||
wpas_dbus_ctrl_iface_deinit(priv);
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS
|
||||
/* TODO: is any deinit needed? */
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
||||
|
||||
wpas_dbus_deinit_common(priv);
|
||||
}
|
20
contrib/wpa/wpa_supplicant/dbus/dbus_common.h
Normal file
20
contrib/wpa/wpa_supplicant/dbus/dbus_common.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* wpa_supplicant D-Bus control interface - common definitions
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef DBUS_COMMON_H
|
||||
#define DBUS_COMMON_H
|
||||
|
||||
struct wpas_dbus_priv;
|
||||
struct wpa_global;
|
||||
|
||||
struct wpas_dbus_priv * wpas_dbus_init(struct wpa_global *global);
|
||||
void wpas_dbus_deinit(struct wpas_dbus_priv *priv);
|
||||
|
||||
#endif /* DBUS_COMMON_H */
|
28
contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h
Normal file
28
contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* wpa_supplicant D-Bus control interface - internal definitions
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef DBUS_COMMON_I_H
|
||||
#define DBUS_COMMON_I_H
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
struct wpas_dbus_priv {
|
||||
DBusConnection *con;
|
||||
int should_dispatch;
|
||||
struct wpa_global *global;
|
||||
u32 next_objid;
|
||||
int dbus_new_initialized;
|
||||
|
||||
#if defined(CONFIG_CTRL_IFACE_DBUS_NEW) && defined(CONFIG_AP)
|
||||
int dbus_noc_refcnt;
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW && CONFIG_AP */
|
||||
};
|
||||
|
||||
#endif /* DBUS_COMMON_I_H */
|
1104
contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c
Normal file
1104
contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c
Normal file
File diff suppressed because it is too large
Load Diff
163
contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h
Normal file
163
contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef DBUS_DICT_HELPERS_H
|
||||
#define DBUS_DICT_HELPERS_H
|
||||
|
||||
#include "wpabuf.h"
|
||||
|
||||
/*
|
||||
* Adding a dict to a DBusMessage
|
||||
*/
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
|
||||
DBusMessageIter *iter_dict);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
|
||||
DBusMessageIter *iter_dict);
|
||||
|
||||
const char * wpa_dbus_type_as_string(const int type);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
|
||||
const char *key, const char *value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
|
||||
const char *key, const char value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_bool_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_int16_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_uint16_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_int32_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_uint32_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_int64_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const dbus_uint64_t value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const double value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const char *value);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const char *value,
|
||||
const dbus_uint32_t value_len);
|
||||
|
||||
/* Manual construction and addition of array elements */
|
||||
dbus_bool_t wpa_dbus_dict_begin_array(DBusMessageIter *iter_dict,
|
||||
const char *key, const char *type,
|
||||
DBusMessageIter *iter_dict_entry,
|
||||
DBusMessageIter *iter_dict_val,
|
||||
DBusMessageIter *iter_array);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
DBusMessageIter *iter_dict_entry,
|
||||
DBusMessageIter *iter_dict_val,
|
||||
DBusMessageIter *iter_array);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
|
||||
const char *elem);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_bin_array_add_element(DBusMessageIter *iter_array,
|
||||
const u8 *value,
|
||||
size_t value_len);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_end_array(DBusMessageIter *iter_dict,
|
||||
DBusMessageIter *iter_dict_entry,
|
||||
DBusMessageIter *iter_dict_val,
|
||||
DBusMessageIter *iter_array);
|
||||
|
||||
static inline dbus_bool_t
|
||||
wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
|
||||
DBusMessageIter *iter_dict_entry,
|
||||
DBusMessageIter *iter_dict_val,
|
||||
DBusMessageIter *iter_array)
|
||||
{
|
||||
return wpa_dbus_dict_end_array(iter_dict, iter_dict_entry,
|
||||
iter_dict_val, iter_array);
|
||||
}
|
||||
|
||||
/* Convenience function to add a whole string list */
|
||||
dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const char **items,
|
||||
const dbus_uint32_t num_items);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_append_wpabuf_array(DBusMessageIter *iter_dict,
|
||||
const char *key,
|
||||
const struct wpabuf **items,
|
||||
const dbus_uint32_t num_items);
|
||||
|
||||
/*
|
||||
* Reading a dict from a DBusMessage
|
||||
*/
|
||||
|
||||
#define WPAS_DBUS_TYPE_BINARRAY (DBUS_NUMBER_OF_TYPES + 100)
|
||||
|
||||
struct wpa_dbus_dict_entry {
|
||||
int type; /** the dbus type of the dict entry's value */
|
||||
int array_type; /** the dbus type of the array elements if the dict
|
||||
entry value contains an array, or the special
|
||||
WPAS_DBUS_TYPE_BINARRAY */
|
||||
const char *key; /** key of the dict entry */
|
||||
|
||||
/** Possible values of the property */
|
||||
union {
|
||||
char *str_value;
|
||||
char byte_value;
|
||||
dbus_bool_t bool_value;
|
||||
dbus_int16_t int16_value;
|
||||
dbus_uint16_t uint16_value;
|
||||
dbus_int32_t int32_value;
|
||||
dbus_uint32_t uint32_value;
|
||||
dbus_int64_t int64_value;
|
||||
dbus_uint64_t uint64_value;
|
||||
double double_value;
|
||||
char *bytearray_value;
|
||||
char **strarray_value;
|
||||
struct wpabuf **binarray_value;
|
||||
};
|
||||
dbus_uint32_t array_len; /** length of the array if the dict entry's
|
||||
value contains an array */
|
||||
};
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
|
||||
DBusMessageIter *iter_dict,
|
||||
DBusError *error);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
|
||||
struct wpa_dbus_dict_entry *entry);
|
||||
|
||||
dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict);
|
||||
|
||||
void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry);
|
||||
|
||||
#endif /* DBUS_DICT_HELPERS_H */
|
3710
contrib/wpa/wpa_supplicant/dbus/dbus_new.c
Normal file
3710
contrib/wpa/wpa_supplicant/dbus/dbus_new.c
Normal file
File diff suppressed because it is too large
Load Diff
498
contrib/wpa/wpa_supplicant/dbus/dbus_new.h
Normal file
498
contrib/wpa/wpa_supplicant/dbus/dbus_new.h
Normal file
@ -0,0 +1,498 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef CTRL_IFACE_DBUS_NEW_H
|
||||
#define CTRL_IFACE_DBUS_NEW_H
|
||||
|
||||
#include "common/defs.h"
|
||||
#include "p2p/p2p.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_STATE,
|
||||
WPAS_DBUS_PROP_CURRENT_BSS,
|
||||
WPAS_DBUS_PROP_CURRENT_NETWORK,
|
||||
WPAS_DBUS_PROP_CURRENT_AUTH_MODE,
|
||||
WPAS_DBUS_PROP_BSSS,
|
||||
WPAS_DBUS_PROP_DISCONNECT_REASON,
|
||||
};
|
||||
|
||||
enum wpas_dbus_bss_prop {
|
||||
WPAS_DBUS_BSS_PROP_SIGNAL,
|
||||
WPAS_DBUS_BSS_PROP_FREQ,
|
||||
WPAS_DBUS_BSS_PROP_MODE,
|
||||
WPAS_DBUS_BSS_PROP_PRIVACY,
|
||||
WPAS_DBUS_BSS_PROP_RATES,
|
||||
WPAS_DBUS_BSS_PROP_WPA,
|
||||
WPAS_DBUS_BSS_PROP_RSN,
|
||||
WPAS_DBUS_BSS_PROP_WPS,
|
||||
WPAS_DBUS_BSS_PROP_IES,
|
||||
};
|
||||
|
||||
#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_INTERFACE ".Network"
|
||||
|
||||
#define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
|
||||
#define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS"
|
||||
|
||||
#define WPAS_DBUS_NEW_IFACE_P2PDEVICE \
|
||||
WPAS_DBUS_NEW_IFACE_INTERFACE ".P2PDevice"
|
||||
|
||||
/*
|
||||
* Groups correspond to P2P groups where this device is a GO (owner)
|
||||
*/
|
||||
#define WPAS_DBUS_NEW_P2P_GROUPS_PART "Groups"
|
||||
#define WPAS_DBUS_NEW_IFACE_P2P_GROUP WPAS_DBUS_NEW_INTERFACE ".Group"
|
||||
|
||||
/*
|
||||
* Different dbus object for persistent groups so they do not get confused
|
||||
* with regular (configured) network objects.
|
||||
*/
|
||||
#define WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "PersistentGroups"
|
||||
#define WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP \
|
||||
WPAS_DBUS_NEW_INTERFACE ".PersistentGroup"
|
||||
|
||||
#define WPAS_DBUS_NEW_P2P_PEERS_PART "Peers"
|
||||
#define WPAS_DBUS_NEW_IFACE_P2P_PEER WPAS_DBUS_NEW_INTERFACE ".Peer"
|
||||
|
||||
#define WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "Members"
|
||||
#define WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER \
|
||||
WPAS_DBUS_NEW_INTERFACE ".GroupMember"
|
||||
|
||||
/* 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_INTERFACE ".NotConnected"
|
||||
#define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
|
||||
WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown"
|
||||
|
||||
#define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNAVAILABLE \
|
||||
WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnavailable"
|
||||
#define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNSUPPORTED \
|
||||
WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnsupported"
|
||||
#define WPAS_DBUS_ERROR_CONNECT_UNSPECIFIED_ERROR \
|
||||
WPAS_DBUS_NEW_INTERFACE ".ConnectUnspecifiedError"
|
||||
|
||||
#define WPAS_DBUS_ERROR_BLOB_EXISTS \
|
||||
WPAS_DBUS_NEW_INTERFACE ".BlobExists"
|
||||
#define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
|
||||
WPAS_DBUS_NEW_INTERFACE ".BlobUnknown"
|
||||
|
||||
#define WPAS_DBUS_ERROR_SUBSCRIPTION_IN_USE \
|
||||
WPAS_DBUS_NEW_INTERFACE ".SubscriptionInUse"
|
||||
#define WPAS_DBUS_ERROR_NO_SUBSCRIPTION \
|
||||
WPAS_DBUS_NEW_INTERFACE ".NoSubscription"
|
||||
#define WPAS_DBUS_ERROR_SUBSCRIPTION_EPERM \
|
||||
WPAS_DBUS_NEW_INTERFACE ".SubscriptionNotYou"
|
||||
|
||||
|
||||
void wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv);
|
||||
void wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv);
|
||||
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||
|
||||
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
|
||||
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_prop_changed(struct wpa_supplicant *wpa_s,
|
||||
enum wpas_dbus_prop property);
|
||||
void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||
enum wpas_dbus_bss_prop property,
|
||||
unsigned int id);
|
||||
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_network_request(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype,
|
||||
const char *default_text);
|
||||
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);
|
||||
|
||||
int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr);
|
||||
void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr);
|
||||
int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr);
|
||||
void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr);
|
||||
void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
|
||||
const char *role);
|
||||
void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr, int request,
|
||||
enum p2p_prov_disc_status status,
|
||||
u16 config_methods,
|
||||
unsigned int generated_pin);
|
||||
void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
|
||||
const u8 *src, u16 dev_passwd_id);
|
||||
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||
const struct wpa_ssid *ssid,
|
||||
int client, int network_id);
|
||||
void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
|
||||
struct p2p_go_neg_results *res);
|
||||
void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
|
||||
const struct wpa_ssid *ssid);
|
||||
int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
|
||||
int nid);
|
||||
void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
|
||||
int status, const u8 *bssid);
|
||||
void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
|
||||
const u8 *p2p_if_addr);
|
||||
void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
|
||||
const u8 *p2p_if_addr);
|
||||
void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
|
||||
const u8 *member);
|
||||
void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
|
||||
int freq, const u8 *sa, u8 dialog_token,
|
||||
u16 update_indic, const u8 *tlvs,
|
||||
size_t tlvs_len);
|
||||
void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
|
||||
const u8 *sa, u16 update_indic,
|
||||
const u8 *tlvs, size_t tlvs_len);
|
||||
void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
|
||||
const u8 *member);
|
||||
void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
|
||||
struct wps_event_fail *fail);
|
||||
void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth, const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert);
|
||||
void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
|
||||
const u8 *addr, const u8 *dst, const u8 *bssid,
|
||||
const u8 *ie, size_t ie_len, u32 ssi_signal);
|
||||
void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
|
||||
const char *status, const char *parameter);
|
||||
|
||||
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||
|
||||
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_bss_signal_prop_changed(
|
||||
struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property,
|
||||
unsigned int id)
|
||||
{
|
||||
}
|
||||
|
||||
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_network_request(
|
||||
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype, const char *default_txt)
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
|
||||
const char *role)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr, int request,
|
||||
enum p2p_prov_disc_status status,
|
||||
u16 config_methods,
|
||||
unsigned int generated_pin)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_p2p_go_neg_req(
|
||||
struct wpa_supplicant *wpa_s,
|
||||
const u8 *src,
|
||||
u16 dev_passwd_id)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||
const struct wpa_ssid *ssid,
|
||||
int client, int network_id)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int wpas_dbus_register_persistent_group(
|
||||
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int wpas_dbus_unregister_persistent_group(
|
||||
struct wpa_supplicant *wpa_s, int nid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
|
||||
struct p2p_go_neg_results *res)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
|
||||
const struct wpa_ssid *ssid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_p2p_invitation_result(
|
||||
struct wpa_supplicant *wpa_s, int status,
|
||||
const u8 *bssid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
|
||||
const u8 *p2p_if_addr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, int freq,
|
||||
const u8 *sa, u8 dialog_token, u16 update_indic,
|
||||
const u8 *tlvs, size_t tlvs_len)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
|
||||
const u8 *sa, u16 update_indic,
|
||||
const u8 *tlvs, size_t tlvs_len)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
|
||||
const u8 *p2p_if_addr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
|
||||
const u8 *member)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
|
||||
const u8 *dev_addr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
|
||||
const u8 *member)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
|
||||
struct wps_event_fail *fail)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth,
|
||||
const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
|
||||
const u8 *addr, const u8 *dst,
|
||||
const u8 *bssid,
|
||||
const u8 *ie, size_t ie_len,
|
||||
u32 ssi_signal)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
|
||||
const char *status,
|
||||
const char *parameter)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||
|
||||
#endif /* CTRL_IFACE_DBUS_H_NEW */
|
3759
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c
Normal file
3759
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c
Normal file
File diff suppressed because it is too large
Load Diff
285
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h
Normal file
285
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README 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;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
dbus_bool_t wpas_dbus_simple_property_getter(DBusMessageIter *iter,
|
||||
const int type,
|
||||
const void *val,
|
||||
DBusError *error);
|
||||
|
||||
dbus_bool_t wpas_dbus_simple_property_setter(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
const int type, void *val);
|
||||
|
||||
dbus_bool_t wpas_dbus_simple_array_property_getter(DBusMessageIter *iter,
|
||||
const int type,
|
||||
const void *array,
|
||||
size_t array_len,
|
||||
DBusError *error);
|
||||
|
||||
dbus_bool_t wpas_dbus_simple_array_array_property_getter(DBusMessageIter *iter,
|
||||
const int type,
|
||||
struct wpabuf **array,
|
||||
size_t array_len,
|
||||
DBusError *error);
|
||||
|
||||
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);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_debug_level(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_debug_timestamp(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_debug_show_keys(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_debug_level(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_debug_timestamp(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_debug_show_keys(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_interfaces(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_disconnect(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
DBusMessageIter *iter,
|
||||
DBusError *error);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_remove_all_networks(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_network_reply(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_handler_flush_bss(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_state(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_scanning(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_ap_scan(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_disconnect_reason(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_expire_age(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_bss_expire_age(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_expire_count(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_bss_expire_count(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_country(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_scan_interval(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_scan_interval(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_ifname(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_driver(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bridge_ifname(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_current_bss(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_current_network(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_current_auth_mode(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bsss(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_networks(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_blobs(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_bssid(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_ssid(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_privacy(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_mode(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_signal(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_frequency(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_rates(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_wpa(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_rsn(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_wps(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_ies(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_enabled(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_enabled(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_network_properties(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_network_properties(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
DBusMessage * wpas_dbus_error_invalid_args(DBusMessage *message,
|
||||
const char *arg);
|
||||
DBusMessage * wpas_dbus_error_unknown_error(DBusMessage *message,
|
||||
const char *arg);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_subscribe_preq(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
DBusMessage * wpas_dbus_handler_unsubscribe_preq(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
#endif /* CTRL_IFACE_DBUS_HANDLERS_NEW_H */
|
2438
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
Normal file
2438
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
Normal file
File diff suppressed because it is too large
Load Diff
211
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
Normal file
211
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
Normal file
@ -0,0 +1,211 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface for p2p
|
||||
* Copyright (c) 2011-2012, Intel Corporation
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef DBUS_NEW_HANDLERS_P2P_H
|
||||
#define DBUS_NEW_HANDLERS_P2P_H
|
||||
|
||||
struct peer_handler_args {
|
||||
struct wpa_supplicant *wpa_s;
|
||||
u8 p2p_device_addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct groupmember_handler_args {
|
||||
struct wpa_supplicant *wpa_s;
|
||||
u8 member_addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
/*
|
||||
* P2P Device methods
|
||||
*/
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_find(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_stop_find(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_rejectpeer(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_listen(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_extendedlisten(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_presence_request(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_prov_disc_req(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_group_add(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_connect(
|
||||
DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_invite(
|
||||
DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_disconnect(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_flush(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_add_service(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_delete_service(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_flush_service(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_service_sd_req(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_service_sd_res(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_service_sd_cancel_req(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_service_update(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage *wpas_dbus_handler_p2p_serv_disc_external(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
/*
|
||||
* P2P Device property accessor methods.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peers(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_role(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peergo(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* P2P Peer properties.
|
||||
*/
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
|
||||
DBusMessageIter *iter, DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_config_method(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_group_capability(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_secondary_device_types(
|
||||
DBusMessageIter *iter, DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_vendor_extension(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* P2P Group properties
|
||||
*/
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_members(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_ssid(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_bssid(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_frequency(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* P2P Persistent Groups and properties
|
||||
*/
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_persistent_groups(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_persistent_group_properties(DBusMessageIter *iter,
|
||||
DBusError *error, void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_setter_persistent_group_properties(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_add_persistent_group(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_remove_persistent_group(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_handler_remove_all_persistent_groups(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
|
||||
#endif /* DBUS_NEW_HANDLERS_P2P_H */
|
391
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c
Normal file
391
contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c
Normal file
@ -0,0 +1,391 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface (WPS)
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "../config.h"
|
||||
#include "../wpa_supplicant_i.h"
|
||||
#include "../wps_supplicant.h"
|
||||
#include "../driver_i.h"
|
||||
#include "../ap.h"
|
||||
#include "dbus_new_helpers.h"
|
||||
#include "dbus_new.h"
|
||||
#include "dbus_new_handlers.h"
|
||||
#include "dbus_dict_helpers.h"
|
||||
|
||||
|
||||
struct wps_start_params {
|
||||
int role; /* 0 - not set, 1 - enrollee, 2 - registrar */
|
||||
int type; /* 0 - not set, 1 - pin, 2 - pbc */
|
||||
u8 *bssid;
|
||||
char *pin;
|
||||
u8 *p2p_dev_addr;
|
||||
};
|
||||
|
||||
|
||||
static int wpas_dbus_handler_wps_role(DBusMessage *message,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
DBusMessageIter variant_iter;
|
||||
char *val;
|
||||
|
||||
dbus_message_iter_recurse(entry_iter, &variant_iter);
|
||||
if (dbus_message_iter_get_arg_type(&variant_iter) !=
|
||||
DBUS_TYPE_STRING) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Role type, "
|
||||
"string required");
|
||||
*reply = wpas_dbus_error_invalid_args(message,
|
||||
"Role must be a string");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_get_basic(&variant_iter, &val);
|
||||
if (os_strcmp(val, "enrollee") == 0)
|
||||
params->role = 1;
|
||||
else if (os_strcmp(val, "registrar") == 0)
|
||||
params->role = 2;
|
||||
else {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Uknown role %s", val);
|
||||
*reply = wpas_dbus_error_invalid_args(message, val);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int wpas_dbus_handler_wps_type(DBusMessage *message,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
DBusMessageIter variant_iter;
|
||||
char *val;
|
||||
|
||||
dbus_message_iter_recurse(entry_iter, &variant_iter);
|
||||
if (dbus_message_iter_get_arg_type(&variant_iter) !=
|
||||
DBUS_TYPE_STRING) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Type type, "
|
||||
"string required");
|
||||
*reply = wpas_dbus_error_invalid_args(message,
|
||||
"Type must be a string");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_get_basic(&variant_iter, &val);
|
||||
if (os_strcmp(val, "pin") == 0)
|
||||
params->type = 1;
|
||||
else if (os_strcmp(val, "pbc") == 0)
|
||||
params->type = 2;
|
||||
else {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Unknown type %s",
|
||||
val);
|
||||
*reply = wpas_dbus_error_invalid_args(message, val);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int wpas_dbus_handler_wps_bssid(DBusMessage *message,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
DBusMessageIter variant_iter, array_iter;
|
||||
int len;
|
||||
|
||||
dbus_message_iter_recurse(entry_iter, &variant_iter);
|
||||
if (dbus_message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_ARRAY ||
|
||||
dbus_message_iter_get_element_type(&variant_iter) !=
|
||||
DBUS_TYPE_BYTE) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Bssid type, "
|
||||
"byte array required");
|
||||
*reply = wpas_dbus_error_invalid_args(
|
||||
message, "Bssid must be a byte array");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_recurse(&variant_iter, &array_iter);
|
||||
dbus_message_iter_get_fixed_array(&array_iter, ¶ms->bssid, &len);
|
||||
if (len != ETH_ALEN) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Stsrt - Wrong Bssid length "
|
||||
"%d", len);
|
||||
*reply = wpas_dbus_error_invalid_args(message,
|
||||
"Bssid is wrong length");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int wpas_dbus_handler_wps_pin(DBusMessage *message,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
DBusMessageIter variant_iter;
|
||||
|
||||
dbus_message_iter_recurse(entry_iter, &variant_iter);
|
||||
if (dbus_message_iter_get_arg_type(&variant_iter) !=
|
||||
DBUS_TYPE_STRING) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Pin type, "
|
||||
"string required");
|
||||
*reply = wpas_dbus_error_invalid_args(message,
|
||||
"Pin must be a string");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_get_basic(&variant_iter, ¶ms->pin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
static int wpas_dbus_handler_wps_p2p_dev_addr(DBusMessage *message,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
DBusMessageIter variant_iter, array_iter;
|
||||
int len;
|
||||
|
||||
dbus_message_iter_recurse(entry_iter, &variant_iter);
|
||||
if (dbus_message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_ARRAY ||
|
||||
dbus_message_iter_get_element_type(&variant_iter) !=
|
||||
DBUS_TYPE_BYTE) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong "
|
||||
"P2PDeviceAddress type, byte array required");
|
||||
*reply = wpas_dbus_error_invalid_args(
|
||||
message, "P2PDeviceAddress must be a byte array");
|
||||
return -1;
|
||||
}
|
||||
dbus_message_iter_recurse(&variant_iter, &array_iter);
|
||||
dbus_message_iter_get_fixed_array(&array_iter, ¶ms->p2p_dev_addr,
|
||||
&len);
|
||||
if (len != ETH_ALEN) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong "
|
||||
"P2PDeviceAddress length %d", len);
|
||||
*reply = wpas_dbus_error_invalid_args(message,
|
||||
"P2PDeviceAddress "
|
||||
"has wrong length");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
|
||||
static int wpas_dbus_handler_wps_start_entry(DBusMessage *message, char *key,
|
||||
DBusMessageIter *entry_iter,
|
||||
struct wps_start_params *params,
|
||||
DBusMessage **reply)
|
||||
{
|
||||
if (os_strcmp(key, "Role") == 0)
|
||||
return wpas_dbus_handler_wps_role(message, entry_iter,
|
||||
params, reply);
|
||||
else if (os_strcmp(key, "Type") == 0)
|
||||
return wpas_dbus_handler_wps_type(message, entry_iter,
|
||||
params, reply);
|
||||
else if (os_strcmp(key, "Bssid") == 0)
|
||||
return wpas_dbus_handler_wps_bssid(message, entry_iter,
|
||||
params, reply);
|
||||
else if (os_strcmp(key, "Pin") == 0)
|
||||
return wpas_dbus_handler_wps_pin(message, entry_iter,
|
||||
params, reply);
|
||||
#ifdef CONFIG_P2P
|
||||
else if (os_strcmp(key, "P2PDeviceAddress") == 0)
|
||||
return wpas_dbus_handler_wps_p2p_dev_addr(message, entry_iter,
|
||||
params, reply);
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - unknown key %s", key);
|
||||
*reply = wpas_dbus_error_invalid_args(message, key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_handler_wps_start - Start WPS configuration
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: %wpa_supplicant data structure
|
||||
* Returns: DBus message dictionary on success or DBus error on failure
|
||||
*
|
||||
* Handler for "Start" method call. DBus dictionary argument contains
|
||||
* information about role (enrollee or registrar), authorization method
|
||||
* (pin or push button) and optionally pin and bssid. Returned message
|
||||
* has a dictionary argument which may contain newly generated pin (optional).
|
||||
*/
|
||||
DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
DBusMessageIter iter, dict_iter, entry_iter;
|
||||
struct wps_start_params params;
|
||||
char *key;
|
||||
char npin[9] = { '\0' };
|
||||
int ret;
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
dbus_message_iter_init(message, &iter);
|
||||
|
||||
dbus_message_iter_recurse(&iter, &dict_iter);
|
||||
while (dbus_message_iter_get_arg_type(&dict_iter) ==
|
||||
DBUS_TYPE_DICT_ENTRY) {
|
||||
dbus_message_iter_recurse(&dict_iter, &entry_iter);
|
||||
|
||||
dbus_message_iter_get_basic(&entry_iter, &key);
|
||||
dbus_message_iter_next(&entry_iter);
|
||||
|
||||
if (wpas_dbus_handler_wps_start_entry(message, key,
|
||||
&entry_iter,
|
||||
¶ms, &reply))
|
||||
return reply;
|
||||
|
||||
dbus_message_iter_next(&dict_iter);
|
||||
}
|
||||
|
||||
if (params.role == 0) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Role not specified");
|
||||
return wpas_dbus_error_invalid_args(message,
|
||||
"Role not specified");
|
||||
} else if (params.role == 1 && params.type == 0) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Type not specified");
|
||||
return wpas_dbus_error_invalid_args(message,
|
||||
"Type not specified");
|
||||
} else if (params.role == 2 && params.pin == NULL) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Pin required for "
|
||||
"registrar role");
|
||||
return wpas_dbus_error_invalid_args(
|
||||
message, "Pin required for registrar role.");
|
||||
}
|
||||
|
||||
if (params.role == 2)
|
||||
ret = wpas_wps_start_reg(wpa_s, params.bssid, params.pin,
|
||||
NULL);
|
||||
else if (params.type == 1) {
|
||||
#ifdef CONFIG_AP
|
||||
if (wpa_s->ap_iface)
|
||||
ret = wpa_supplicant_ap_wps_pin(wpa_s,
|
||||
params.bssid,
|
||||
params.pin,
|
||||
npin, sizeof(npin), 0);
|
||||
else
|
||||
#endif /* CONFIG_AP */
|
||||
{
|
||||
ret = wpas_wps_start_pin(wpa_s, params.bssid,
|
||||
params.pin, 0,
|
||||
DEV_PW_DEFAULT);
|
||||
if (ret > 0)
|
||||
os_snprintf(npin, sizeof(npin), "%08d", ret);
|
||||
}
|
||||
} else {
|
||||
#ifdef CONFIG_AP
|
||||
if (wpa_s->ap_iface)
|
||||
ret = wpa_supplicant_ap_wps_pbc(wpa_s,
|
||||
params.bssid,
|
||||
params.p2p_dev_addr);
|
||||
else
|
||||
#endif /* CONFIG_AP */
|
||||
ret = wpas_wps_start_pbc(wpa_s, params.bssid, 0);
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start wpas_wps_failed in "
|
||||
"role %s and key %s",
|
||||
(params.role == 1 ? "enrollee" : "registrar"),
|
||||
(params.type == 0 ? "" :
|
||||
(params.type == 1 ? "pin" : "pbc")));
|
||||
return wpas_dbus_error_unknown_error(message,
|
||||
"WPS start failed");
|
||||
}
|
||||
|
||||
reply = dbus_message_new_method_return(message);
|
||||
if (!reply) {
|
||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||
NULL);
|
||||
}
|
||||
|
||||
dbus_message_iter_init_append(reply, &iter);
|
||||
if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
|
||||
dbus_message_unref(reply);
|
||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (os_strlen(npin) > 0) {
|
||||
if (!wpa_dbus_dict_append_string(&dict_iter, "Pin", npin)) {
|
||||
dbus_message_unref(reply);
|
||||
return dbus_message_new_error(message,
|
||||
DBUS_ERROR_NO_MEMORY,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
||||
dbus_message_unref(reply);
|
||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_process_credentials - Check if credentials are processed
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: %wpa_supplicant data structure
|
||||
* Returns: TRUE on success, FALSE on failure
|
||||
*
|
||||
* Getter for "ProcessCredentials" property. Returns returned boolean will be
|
||||
* true if wps_cred_processing configuration field is not equal to 1 or false
|
||||
* if otherwise.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = user_data;
|
||||
dbus_bool_t process = (wpa_s->conf->wps_cred_processing != 1);
|
||||
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
|
||||
&process, error);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_setter_process_credentials - Set credentials_processed conf param
|
||||
* @iter: Pointer to incoming dbus message iter
|
||||
* @error: Location to store error on failure
|
||||
* @user_data: Function specific data
|
||||
* Returns: TRUE on success, FALSE on failure
|
||||
*
|
||||
* Setter for "ProcessCredentials" property. Sets credentials_processed on 2
|
||||
* if boolean argument is true or on 1 if otherwise.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = user_data;
|
||||
dbus_bool_t process_credentials, old_pc;
|
||||
|
||||
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
|
||||
&process_credentials))
|
||||
return FALSE;
|
||||
|
||||
old_pc = (wpa_s->conf->wps_cred_processing != 1);
|
||||
wpa_s->conf->wps_cred_processing = (process_credentials ? 2 : 1);
|
||||
|
||||
if ((wpa_s->conf->wps_cred_processing != 1) != old_pc)
|
||||
wpa_dbus_mark_property_changed(wpa_s->global->dbus,
|
||||
wpa_s->dbus_new_path,
|
||||
WPAS_DBUS_NEW_IFACE_WPS,
|
||||
"ProcessCredentials");
|
||||
|
||||
return TRUE;
|
||||
}
|
1061
contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c
Normal file
1061
contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c
Normal file
File diff suppressed because it is too large
Load Diff
150
contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h
Normal file
150
contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef WPA_DBUS_CTRL_H
|
||||
#define WPA_DBUS_CTRL_H
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
|
||||
void *user_data);
|
||||
typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
|
||||
|
||||
typedef dbus_bool_t (* WPADBusPropertyAccessor)(DBusMessageIter *iter,
|
||||
DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
struct wpa_dbus_object_desc {
|
||||
DBusConnection *connection;
|
||||
char *path;
|
||||
|
||||
/* list of methods, properties and signals registered with object */
|
||||
const struct wpa_dbus_method_desc *methods;
|
||||
const struct wpa_dbus_signal_desc *signals;
|
||||
const struct wpa_dbus_property_desc *properties;
|
||||
|
||||
/* property changed flags */
|
||||
u8 *prop_changed_flags;
|
||||
|
||||
/* argument for method handlers and properties
|
||||
* getter and setter functions */
|
||||
void *user_data;
|
||||
/* function used to free above argument */
|
||||
WPADBusArgumentFreeFunction user_data_free_func;
|
||||
};
|
||||
|
||||
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 }
|
||||
|
||||
/**
|
||||
* struct wpa_dbus_method_desc - DBus method description
|
||||
*/
|
||||
struct wpa_dbus_method_desc {
|
||||
/* method name */
|
||||
const char *dbus_method;
|
||||
/* method interface */
|
||||
const char *dbus_interface;
|
||||
/* method handling function */
|
||||
WPADBusMethodHandler method_handler;
|
||||
/* array of arguments */
|
||||
struct wpa_dbus_argument args[4];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wpa_dbus_signal_desc - DBus signal description
|
||||
*/
|
||||
struct wpa_dbus_signal_desc {
|
||||
/* signal name */
|
||||
const char *dbus_signal;
|
||||
/* signal interface */
|
||||
const char *dbus_interface;
|
||||
/* array of arguments */
|
||||
struct wpa_dbus_argument args[4];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wpa_dbus_property_desc - DBus property description
|
||||
*/
|
||||
struct wpa_dbus_property_desc {
|
||||
/* property name */
|
||||
const char *dbus_property;
|
||||
/* property interface */
|
||||
const char *dbus_interface;
|
||||
/* property type signature in DBus type notation */
|
||||
const char *type;
|
||||
/* property getter function */
|
||||
WPADBusPropertyAccessor getter;
|
||||
/* property setter function */
|
||||
WPADBusPropertyAccessor setter;
|
||||
};
|
||||
|
||||
|
||||
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||
#define WPAS_DBUS_INTERFACE_MAX 150
|
||||
#define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
|
||||
#define WPAS_DBUS_AUTH_MODE_MAX 64
|
||||
|
||||
#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);
|
||||
|
||||
int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
|
||||
char *dbus_service,
|
||||
struct wpa_dbus_object_desc *obj_desc);
|
||||
|
||||
int wpa_dbus_register_object_per_iface(
|
||||
struct wpas_dbus_priv *ctrl_iface,
|
||||
const char *path, const char *ifname,
|
||||
struct wpa_dbus_object_desc *obj_desc);
|
||||
|
||||
int wpa_dbus_unregister_object_per_iface(
|
||||
struct wpas_dbus_priv *ctrl_iface,
|
||||
const char *path);
|
||||
|
||||
dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
|
||||
const char *path,
|
||||
const char *interface,
|
||||
DBusMessageIter *iter);
|
||||
|
||||
|
||||
void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
|
||||
|
||||
void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
|
||||
const char *path);
|
||||
|
||||
void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
|
||||
const char *path, const char *interface,
|
||||
const char *property);
|
||||
|
||||
DBusMessage * wpa_dbus_introspect(DBusMessage *message,
|
||||
struct wpa_dbus_object_desc *obj_dsc);
|
||||
|
||||
char *wpas_dbus_new_decompose_object_path(const char *path,
|
||||
int p2p_persistent_group,
|
||||
char **network,
|
||||
char **bssid);
|
||||
|
||||
DBusMessage *wpas_dbus_reply_new_from_error(DBusMessage *message,
|
||||
DBusError *error,
|
||||
const char *fallback_name,
|
||||
const char *fallback_string);
|
||||
|
||||
#endif /* WPA_DBUS_CTRL_H */
|
279
contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c
Normal file
279
contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c
Normal file
@ -0,0 +1,279 @@
|
||||
/*
|
||||
* wpa_supplicant - D-Bus introspection
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
||||
* Copyright (c) 2010, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "utils/list.h"
|
||||
#include "utils/wpabuf.h"
|
||||
#include "dbus_common_i.h"
|
||||
#include "dbus_new_helpers.h"
|
||||
|
||||
|
||||
struct interfaces {
|
||||
struct dl_list list;
|
||||
char *dbus_interface;
|
||||
struct wpabuf *xml;
|
||||
};
|
||||
|
||||
|
||||
static struct interfaces * add_interface(struct dl_list *list,
|
||||
const char *dbus_interface)
|
||||
{
|
||||
struct interfaces *iface;
|
||||
|
||||
dl_list_for_each(iface, list, struct interfaces, list) {
|
||||
if (os_strcmp(iface->dbus_interface, dbus_interface) == 0)
|
||||
return iface; /* already in the list */
|
||||
}
|
||||
|
||||
iface = os_zalloc(sizeof(struct interfaces));
|
||||
if (!iface)
|
||||
return NULL;
|
||||
iface->xml = wpabuf_alloc(6000);
|
||||
if (iface->xml == NULL) {
|
||||
os_free(iface);
|
||||
return NULL;
|
||||
}
|
||||
wpabuf_printf(iface->xml, "<interface name=\"%s\">", dbus_interface);
|
||||
dl_list_add_tail(list, &iface->list);
|
||||
iface->dbus_interface = os_strdup(dbus_interface);
|
||||
return iface;
|
||||
}
|
||||
|
||||
|
||||
static void add_arg(struct wpabuf *xml, const char *name, const char *type,
|
||||
const char *direction)
|
||||
{
|
||||
wpabuf_printf(xml, "<arg name=\"%s\"", name);
|
||||
if (type)
|
||||
wpabuf_printf(xml, " type=\"%s\"", type);
|
||||
if (direction)
|
||||
wpabuf_printf(xml, " direction=\"%s\"", direction);
|
||||
wpabuf_put_str(xml, "/>");
|
||||
}
|
||||
|
||||
|
||||
static void add_entry(struct wpabuf *xml, const char *type, const char *name,
|
||||
const struct wpa_dbus_argument *args, int include_dir)
|
||||
{
|
||||
const struct wpa_dbus_argument *arg;
|
||||
|
||||
if (args == NULL || args->name == NULL) {
|
||||
wpabuf_printf(xml, "<%s name=\"%s\"/>", type, name);
|
||||
return;
|
||||
}
|
||||
wpabuf_printf(xml, "<%s name=\"%s\">", type, name);
|
||||
for (arg = args; arg && arg->name; arg++) {
|
||||
add_arg(xml, arg->name, arg->type,
|
||||
include_dir ? (arg->dir == ARG_IN ? "in" : "out") :
|
||||
NULL);
|
||||
}
|
||||
wpabuf_printf(xml, "</%s>", type);
|
||||
}
|
||||
|
||||
|
||||
static void add_property(struct wpabuf *xml,
|
||||
const struct wpa_dbus_property_desc *dsc)
|
||||
{
|
||||
wpabuf_printf(xml, "<property name=\"%s\" type=\"%s\" "
|
||||
"access=\"%s%s\"/>",
|
||||
dsc->dbus_property, dsc->type,
|
||||
dsc->getter ? "read" : "",
|
||||
dsc->setter ? "write" : "");
|
||||
}
|
||||
|
||||
|
||||
static void extract_interfaces_methods(
|
||||
struct dl_list *list, const struct wpa_dbus_method_desc *methods)
|
||||
{
|
||||
const struct wpa_dbus_method_desc *dsc;
|
||||
struct interfaces *iface;
|
||||
for (dsc = methods; dsc && dsc->dbus_method; dsc++) {
|
||||
iface = add_interface(list, dsc->dbus_interface);
|
||||
if (iface)
|
||||
add_entry(iface->xml, "method", dsc->dbus_method,
|
||||
dsc->args, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void extract_interfaces_signals(
|
||||
struct dl_list *list, const struct wpa_dbus_signal_desc *signals)
|
||||
{
|
||||
const struct wpa_dbus_signal_desc *dsc;
|
||||
struct interfaces *iface;
|
||||
for (dsc = signals; dsc && dsc->dbus_signal; dsc++) {
|
||||
iface = add_interface(list, dsc->dbus_interface);
|
||||
if (iface)
|
||||
add_entry(iface->xml, "signal", dsc->dbus_signal,
|
||||
dsc->args, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void extract_interfaces_properties(
|
||||
struct dl_list *list, const struct wpa_dbus_property_desc *properties)
|
||||
{
|
||||
const struct wpa_dbus_property_desc *dsc;
|
||||
struct interfaces *iface;
|
||||
for (dsc = properties; dsc && dsc->dbus_property; dsc++) {
|
||||
iface = add_interface(list, dsc->dbus_interface);
|
||||
if (iface)
|
||||
add_property(iface->xml, dsc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* extract_interfaces - Extract interfaces from methods, signals and props
|
||||
* @list: Interface list to be filled
|
||||
* @obj_dsc: Description of object from which interfaces will be extracted
|
||||
*
|
||||
* Iterates over all methods, signals, and properties registered with an
|
||||
* object and collects all declared DBus interfaces and create interfaces'
|
||||
* node in XML root node for each. Returned list elements contain interface
|
||||
* name and XML node of corresponding interface.
|
||||
*/
|
||||
static void extract_interfaces(struct dl_list *list,
|
||||
struct wpa_dbus_object_desc *obj_dsc)
|
||||
{
|
||||
extract_interfaces_methods(list, obj_dsc->methods);
|
||||
extract_interfaces_signals(list, obj_dsc->signals);
|
||||
extract_interfaces_properties(list, obj_dsc->properties);
|
||||
}
|
||||
|
||||
|
||||
static void add_interfaces(struct dl_list *list, struct wpabuf *xml)
|
||||
{
|
||||
struct interfaces *iface, *n;
|
||||
dl_list_for_each_safe(iface, n, list, struct interfaces, list) {
|
||||
if (wpabuf_len(iface->xml) + 20 < wpabuf_tailroom(xml)) {
|
||||
wpabuf_put_buf(xml, iface->xml);
|
||||
wpabuf_put_str(xml, "</interface>");
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "dbus: Not enough room for "
|
||||
"add_interfaces inspect data: tailroom %u, "
|
||||
"add %u",
|
||||
(unsigned int) wpabuf_tailroom(xml),
|
||||
(unsigned int) wpabuf_len(iface->xml));
|
||||
}
|
||||
dl_list_del(&iface->list);
|
||||
wpabuf_free(iface->xml);
|
||||
os_free(iface->dbus_interface);
|
||||
os_free(iface);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void add_child_nodes(struct wpabuf *xml, DBusConnection *con,
|
||||
const char *path)
|
||||
{
|
||||
char **children;
|
||||
int i;
|
||||
|
||||
/* add child nodes to introspection tree */
|
||||
dbus_connection_list_registered(con, path, &children);
|
||||
for (i = 0; children[i]; i++)
|
||||
wpabuf_printf(xml, "<node name=\"%s\"/>", children[i]);
|
||||
dbus_free_string_array(children);
|
||||
}
|
||||
|
||||
|
||||
static void add_introspectable_interface(struct wpabuf *xml)
|
||||
{
|
||||
wpabuf_printf(xml, "<interface name=\"%s\">"
|
||||
"<method name=\"%s\">"
|
||||
"<arg name=\"data\" type=\"s\" direction=\"out\"/>"
|
||||
"</method>"
|
||||
"</interface>",
|
||||
WPA_DBUS_INTROSPECTION_INTERFACE,
|
||||
WPA_DBUS_INTROSPECTION_METHOD);
|
||||
}
|
||||
|
||||
|
||||
static void add_properties_interface(struct wpabuf *xml)
|
||||
{
|
||||
wpabuf_printf(xml, "<interface name=\"%s\">",
|
||||
WPA_DBUS_PROPERTIES_INTERFACE);
|
||||
|
||||
wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_GET);
|
||||
add_arg(xml, "interface", "s", "in");
|
||||
add_arg(xml, "propname", "s", "in");
|
||||
add_arg(xml, "value", "v", "out");
|
||||
wpabuf_put_str(xml, "</method>");
|
||||
|
||||
wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_GETALL);
|
||||
add_arg(xml, "interface", "s", "in");
|
||||
add_arg(xml, "props", "a{sv}", "out");
|
||||
wpabuf_put_str(xml, "</method>");
|
||||
|
||||
wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_SET);
|
||||
add_arg(xml, "interface", "s", "in");
|
||||
add_arg(xml, "propname", "s", "in");
|
||||
add_arg(xml, "value", "v", "in");
|
||||
wpabuf_put_str(xml, "</method>");
|
||||
|
||||
wpabuf_put_str(xml, "</interface>");
|
||||
}
|
||||
|
||||
|
||||
static void add_wpas_interfaces(struct wpabuf *xml,
|
||||
struct wpa_dbus_object_desc *obj_dsc)
|
||||
{
|
||||
struct dl_list ifaces;
|
||||
dl_list_init(&ifaces);
|
||||
extract_interfaces(&ifaces, obj_dsc);
|
||||
add_interfaces(&ifaces, xml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_dbus_introspect - Responds for Introspect calls on object
|
||||
* @message: Message with Introspect call
|
||||
* @obj_dsc: Object description on which Introspect was called
|
||||
* Returns: Message with introspection result XML string as only argument
|
||||
*
|
||||
* Iterates over all methods, signals and properties registered with
|
||||
* object and generates introspection data for the object as XML string.
|
||||
*/
|
||||
DBusMessage * wpa_dbus_introspect(DBusMessage *message,
|
||||
struct wpa_dbus_object_desc *obj_dsc)
|
||||
{
|
||||
|
||||
DBusMessage *reply;
|
||||
struct wpabuf *xml;
|
||||
|
||||
xml = wpabuf_alloc(10000);
|
||||
if (xml == NULL)
|
||||
return NULL;
|
||||
|
||||
wpabuf_put_str(xml, "<?xml version=\"1.0\"?>\n");
|
||||
wpabuf_put_str(xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
|
||||
wpabuf_put_str(xml, "<node>");
|
||||
|
||||
add_introspectable_interface(xml);
|
||||
add_properties_interface(xml);
|
||||
add_wpas_interfaces(xml, obj_dsc);
|
||||
add_child_nodes(xml, obj_dsc->connection,
|
||||
dbus_message_get_path(message));
|
||||
|
||||
wpabuf_put_str(xml, "</node>\n");
|
||||
|
||||
reply = dbus_message_new_method_return(message);
|
||||
if (reply) {
|
||||
const char *intro_str = wpabuf_head(xml);
|
||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &intro_str,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
wpabuf_free(xml);
|
||||
|
||||
return reply;
|
||||
}
|
743
contrib/wpa/wpa_supplicant/dbus/dbus_old.c
Normal file
743
contrib/wpa/wpa_supplicant/dbus/dbus_old.c
Normal file
@ -0,0 +1,743 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "eloop.h"
|
||||
#include "wps/wps.h"
|
||||
#include "../config.h"
|
||||
#include "../wpa_supplicant_i.h"
|
||||
#include "../bss.h"
|
||||
#include "dbus_old.h"
|
||||
#include "dbus_old_handlers.h"
|
||||
#include "dbus_common_i.h"
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_decompose_object_path - Decompose an interface object path into parts
|
||||
* @path: The dbus object path
|
||||
* @network: (out) the configured network this object path refers to, if any
|
||||
* @bssid: (out) the scanned bssid this object path refers to, if any
|
||||
* Returns: The object path of the network interface this path refers to
|
||||
*
|
||||
* For a given object path, decomposes the object path into object id, network,
|
||||
* and BSSID parts, if those parts exist.
|
||||
*/
|
||||
char * wpas_dbus_decompose_object_path(const char *path, char **network,
|
||||
char **bssid)
|
||||
{
|
||||
const unsigned int dev_path_prefix_len =
|
||||
strlen(WPAS_DBUS_PATH_INTERFACES "/");
|
||||
char *obj_path_only;
|
||||
char *next_sep;
|
||||
|
||||
/* Be a bit paranoid about path */
|
||||
if (!path || strncmp(path, WPAS_DBUS_PATH_INTERFACES "/",
|
||||
dev_path_prefix_len))
|
||||
return NULL;
|
||||
|
||||
/* Ensure there's something at the end of the path */
|
||||
if ((path + dev_path_prefix_len)[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
obj_path_only = os_strdup(path);
|
||||
if (obj_path_only == NULL)
|
||||
return NULL;
|
||||
|
||||
next_sep = strchr(obj_path_only + dev_path_prefix_len, '/');
|
||||
if (next_sep != NULL) {
|
||||
const char *net_part = strstr(next_sep,
|
||||
WPAS_DBUS_NETWORKS_PART "/");
|
||||
const char *bssid_part = strstr(next_sep,
|
||||
WPAS_DBUS_BSSIDS_PART "/");
|
||||
|
||||
if (network && net_part) {
|
||||
/* Deal with a request for a configured network */
|
||||
const char *net_name = net_part +
|
||||
strlen(WPAS_DBUS_NETWORKS_PART "/");
|
||||
*network = NULL;
|
||||
if (strlen(net_name))
|
||||
*network = os_strdup(net_name);
|
||||
} else if (bssid && bssid_part) {
|
||||
/* Deal with a request for a scanned BSSID */
|
||||
const char *bssid_name = bssid_part +
|
||||
strlen(WPAS_DBUS_BSSIDS_PART "/");
|
||||
if (strlen(bssid_name))
|
||||
*bssid = os_strdup(bssid_name);
|
||||
else
|
||||
*bssid = NULL;
|
||||
}
|
||||
|
||||
/* Cut off interface object path before "/" */
|
||||
*next_sep = '\0';
|
||||
}
|
||||
|
||||
return obj_path_only;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_new_invalid_iface_error - Return a new invalid interface error message
|
||||
* @message: Pointer to incoming dbus message this error refers to
|
||||
* Returns: A dbus error message
|
||||
*
|
||||
* Convenience function to create and return an invalid interface error
|
||||
*/
|
||||
DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message)
|
||||
{
|
||||
return dbus_message_new_error(message, WPAS_ERROR_INVALID_IFACE,
|
||||
"wpa_supplicant knows nothing about "
|
||||
"this interface.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_new_invalid_network_error - Return a new invalid network error message
|
||||
* @message: Pointer to incoming dbus message this error refers to
|
||||
* Returns: a dbus error message
|
||||
*
|
||||
* Convenience function to create and return an invalid network error
|
||||
*/
|
||||
DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message)
|
||||
{
|
||||
return dbus_message_new_error(message, WPAS_ERROR_INVALID_NETWORK,
|
||||
"The requested network does not exist.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_new_invalid_bssid_error - Return a new invalid bssid error message
|
||||
* @message: Pointer to incoming dbus message this error refers to
|
||||
* Returns: a dbus error message
|
||||
*
|
||||
* Convenience function to create and return an invalid bssid error
|
||||
*/
|
||||
static DBusMessage * wpas_dbus_new_invalid_bssid_error(DBusMessage *message)
|
||||
{
|
||||
return dbus_message_new_error(message, WPAS_ERROR_INVALID_BSSID,
|
||||
"The BSSID requested was invalid.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dispatch_network_method - dispatch messages for configured networks
|
||||
* @message: the incoming dbus message
|
||||
* @wpa_s: a network interface's data
|
||||
* @network_id: id of the configured network we're interested in
|
||||
* Returns: a reply dbus message, or a dbus error message
|
||||
*
|
||||
* This function dispatches all incoming dbus messages for configured networks.
|
||||
*/
|
||||
static DBusMessage * wpas_dispatch_network_method(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
int network_id)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
const char *method = dbus_message_get_member(message);
|
||||
struct wpa_ssid *ssid;
|
||||
|
||||
ssid = wpa_config_get_network(wpa_s->conf, network_id);
|
||||
if (ssid == NULL)
|
||||
return wpas_dbus_new_invalid_network_error(message);
|
||||
|
||||
if (!strcmp(method, "set"))
|
||||
reply = wpas_dbus_iface_set_network(message, wpa_s, ssid);
|
||||
else if (!strcmp(method, "enable"))
|
||||
reply = wpas_dbus_iface_enable_network(message, wpa_s, ssid);
|
||||
else if (!strcmp(method, "disable"))
|
||||
reply = wpas_dbus_iface_disable_network(message, wpa_s, ssid);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dispatch_bssid_method - dispatch messages for scanned networks
|
||||
* @message: the incoming dbus message
|
||||
* @wpa_s: a network interface's data
|
||||
* @bssid: bssid of the scanned network we're interested in
|
||||
* Returns: a reply dbus message, or a dbus error message
|
||||
*
|
||||
* This function dispatches all incoming dbus messages for scanned networks.
|
||||
*/
|
||||
static DBusMessage * wpas_dispatch_bssid_method(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
const char *bssid_txt)
|
||||
{
|
||||
u8 bssid[ETH_ALEN];
|
||||
struct wpa_bss *bss;
|
||||
|
||||
if (hexstr2bin(bssid_txt, bssid, ETH_ALEN) < 0)
|
||||
return wpas_dbus_new_invalid_bssid_error(message);
|
||||
|
||||
bss = wpa_bss_get_bssid(wpa_s, bssid);
|
||||
if (bss == NULL)
|
||||
return wpas_dbus_new_invalid_bssid_error(message);
|
||||
|
||||
/* Dispatch the method call against the scanned bssid */
|
||||
if (os_strcmp(dbus_message_get_member(message), "properties") == 0)
|
||||
return wpas_dbus_bssid_properties(message, wpa_s, bss);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_iface_message_handler - Dispatch messages for interfaces or networks
|
||||
* @connection: Connection to the system message bus
|
||||
* @message: An incoming dbus message
|
||||
* @user_data: A pointer to a dbus control interface data structure
|
||||
* Returns: Whether or not the message was handled
|
||||
*
|
||||
* This function dispatches all incoming dbus messages for network interfaces,
|
||||
* or objects owned by them, such as scanned BSSIDs and configured networks.
|
||||
*/
|
||||
static DBusHandlerResult wpas_iface_message_handler(DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
void *user_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = user_data;
|
||||
const char *method = dbus_message_get_member(message);
|
||||
const char *path = dbus_message_get_path(message);
|
||||
const char *msg_interface = dbus_message_get_interface(message);
|
||||
char *iface_obj_path = NULL;
|
||||
char *network = NULL;
|
||||
char *bssid = NULL;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
/* Caller must specify a message interface */
|
||||
if (!msg_interface)
|
||||
goto out;
|
||||
|
||||
iface_obj_path = wpas_dbus_decompose_object_path(path, &network,
|
||||
&bssid);
|
||||
if (iface_obj_path == NULL) {
|
||||
reply = wpas_dbus_new_invalid_iface_error(message);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Make sure the message's object path actually refers to the
|
||||
* wpa_supplicant structure it's supposed to (which is wpa_s)
|
||||
*/
|
||||
if (wpa_supplicant_get_iface_by_dbus_path(wpa_s->global,
|
||||
iface_obj_path) != wpa_s) {
|
||||
reply = wpas_dbus_new_invalid_iface_error(message);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (network && !strcmp(msg_interface, WPAS_DBUS_IFACE_NETWORK)) {
|
||||
/* A method for one of this interface's configured networks */
|
||||
int nid = strtoul(network, NULL, 10);
|
||||
if (errno != EINVAL)
|
||||
reply = wpas_dispatch_network_method(message, wpa_s,
|
||||
nid);
|
||||
else
|
||||
reply = wpas_dbus_new_invalid_network_error(message);
|
||||
} else if (bssid && !strcmp(msg_interface, WPAS_DBUS_IFACE_BSSID)) {
|
||||
/* A method for one of this interface's scanned BSSIDs */
|
||||
reply = wpas_dispatch_bssid_method(message, wpa_s, bssid);
|
||||
} else if (!strcmp(msg_interface, WPAS_DBUS_IFACE_INTERFACE)) {
|
||||
/* A method for an interface only. */
|
||||
if (!strcmp(method, "scan"))
|
||||
reply = wpas_dbus_iface_scan(message, wpa_s);
|
||||
else if (!strcmp(method, "scanResults"))
|
||||
reply = wpas_dbus_iface_scan_results(message, wpa_s);
|
||||
else if (!strcmp(method, "addNetwork"))
|
||||
reply = wpas_dbus_iface_add_network(message, wpa_s);
|
||||
else if (!strcmp(method, "removeNetwork"))
|
||||
reply = wpas_dbus_iface_remove_network(message, wpa_s);
|
||||
else if (!strcmp(method, "selectNetwork"))
|
||||
reply = wpas_dbus_iface_select_network(message, wpa_s);
|
||||
else if (!strcmp(method, "capabilities"))
|
||||
reply = wpas_dbus_iface_capabilities(message, wpa_s);
|
||||
else if (!strcmp(method, "disconnect"))
|
||||
reply = wpas_dbus_iface_disconnect(message, wpa_s);
|
||||
else if (!strcmp(method, "setAPScan"))
|
||||
reply = wpas_dbus_iface_set_ap_scan(message, wpa_s);
|
||||
else if (!strcmp(method, "setSmartcardModules"))
|
||||
reply = wpas_dbus_iface_set_smartcard_modules(message,
|
||||
wpa_s);
|
||||
else if (!strcmp(method, "state"))
|
||||
reply = wpas_dbus_iface_get_state(message, wpa_s);
|
||||
else if (!strcmp(method, "scanning"))
|
||||
reply = wpas_dbus_iface_get_scanning(message, wpa_s);
|
||||
else if (!strcmp(method, "setBlobs"))
|
||||
reply = wpas_dbus_iface_set_blobs(message, wpa_s);
|
||||
else if (!strcmp(method, "removeBlobs"))
|
||||
reply = wpas_dbus_iface_remove_blobs(message, wpa_s);
|
||||
#ifdef CONFIG_WPS
|
||||
else if (!os_strcmp(method, "wpsPbc"))
|
||||
reply = wpas_dbus_iface_wps_pbc(message, wpa_s);
|
||||
else if (!os_strcmp(method, "wpsPin"))
|
||||
reply = wpas_dbus_iface_wps_pin(message, wpa_s);
|
||||
else if (!os_strcmp(method, "wpsReg"))
|
||||
reply = wpas_dbus_iface_wps_reg(message, wpa_s);
|
||||
#endif /* CONFIG_WPS */
|
||||
else if (!os_strcmp(method, "flush"))
|
||||
reply = wpas_dbus_iface_flush(message, wpa_s);
|
||||
}
|
||||
|
||||
/* If the message was handled, send back the reply */
|
||||
if (reply) {
|
||||
if (!dbus_message_get_no_reply(message))
|
||||
dbus_connection_send(connection, reply, NULL);
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
|
||||
out:
|
||||
os_free(iface_obj_path);
|
||||
os_free(network);
|
||||
os_free(bssid);
|
||||
return reply ? DBUS_HANDLER_RESULT_HANDLED :
|
||||
DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_message_handler - dispatch incoming dbus messages
|
||||
* @connection: connection to the system message bus
|
||||
* @message: an incoming dbus message
|
||||
* @user_data: a pointer to a dbus control interface data structure
|
||||
* Returns: whether or not the message was handled
|
||||
*
|
||||
* This function dispatches all incoming dbus messages to the correct
|
||||
* handlers, depending on what the message's target object path is,
|
||||
* and what the method call is.
|
||||
*/
|
||||
static DBusHandlerResult wpas_message_handler(DBusConnection *connection,
|
||||
DBusMessage *message, void *user_data)
|
||||
{
|
||||
struct wpas_dbus_priv *ctrl_iface = user_data;
|
||||
const char *method;
|
||||
const char *path;
|
||||
const char *msg_interface;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
method = dbus_message_get_member(message);
|
||||
path = dbus_message_get_path(message);
|
||||
msg_interface = dbus_message_get_interface(message);
|
||||
if (!method || !path || !ctrl_iface || !msg_interface)
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
/* Validate the method interface */
|
||||
if (strcmp(msg_interface, WPAS_DBUS_INTERFACE) != 0)
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
if (!strcmp(path, WPAS_DBUS_PATH)) {
|
||||
/* dispatch methods against our global dbus interface here */
|
||||
if (!strcmp(method, "addInterface")) {
|
||||
reply = wpas_dbus_global_add_interface(
|
||||
message, ctrl_iface->global);
|
||||
} else if (!strcmp(method, "removeInterface")) {
|
||||
reply = wpas_dbus_global_remove_interface(
|
||||
message, ctrl_iface->global);
|
||||
} else if (!strcmp(method, "getInterface")) {
|
||||
reply = wpas_dbus_global_get_interface(
|
||||
message, ctrl_iface->global);
|
||||
} else if (!strcmp(method, "setDebugParams")) {
|
||||
reply = wpas_dbus_global_set_debugparams(
|
||||
message, ctrl_iface->global);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the message was handled, send back the reply */
|
||||
if (reply) {
|
||||
if (!dbus_message_get_no_reply(message))
|
||||
dbus_connection_send(connection, reply, NULL);
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
|
||||
return reply ? DBUS_HANDLER_RESULT_HANDLED :
|
||||
DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_dbus_notify_scan_results - Send a scan results signal
|
||||
* @wpa_s: %wpa_supplicant network interface data
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Notify listeners that this interface has updated scan results.
|
||||
*/
|
||||
void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
||||
DBusMessage *_signal;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"ScanResultsAvailable");
|
||||
if (_signal == NULL) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
|
||||
"results signal");
|
||||
return;
|
||||
}
|
||||
dbus_connection_send(iface->con, _signal, NULL);
|
||||
dbus_message_unref(_signal);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_dbus_notify_state_change - Send a state change signal
|
||||
* @wpa_s: %wpa_supplicant network interface data
|
||||
* @new_state: new state wpa_supplicant is entering
|
||||
* @old_state: old state wpa_supplicant is leaving
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Notify listeners that wpa_supplicant has changed state
|
||||
*/
|
||||
void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
||||
enum wpa_states new_state,
|
||||
enum wpa_states old_state)
|
||||
{
|
||||
struct wpas_dbus_priv *iface;
|
||||
DBusMessage *_signal = NULL;
|
||||
const char *new_state_str, *old_state_str;
|
||||
|
||||
if (wpa_s->dbus_path == NULL)
|
||||
return; /* Skip signal since D-Bus setup is not yet ready */
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (wpa_s->global == NULL)
|
||||
return;
|
||||
iface = wpa_s->global->dbus;
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
/* Only send signal if state really changed */
|
||||
if (new_state == old_state)
|
||||
return;
|
||||
|
||||
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"StateChange");
|
||||
if (_signal == NULL) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||
"could not create dbus signal; likely out of "
|
||||
"memory");
|
||||
return;
|
||||
}
|
||||
|
||||
new_state_str = wpa_supplicant_state_txt(new_state);
|
||||
old_state_str = wpa_supplicant_state_txt(old_state);
|
||||
if (new_state_str == NULL || old_state_str == NULL) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||
"Could not convert state strings");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!dbus_message_append_args(_signal,
|
||||
DBUS_TYPE_STRING, &new_state_str,
|
||||
DBUS_TYPE_STRING, &old_state_str,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||
"Not enough memory to construct state change "
|
||||
"signal");
|
||||
goto out;
|
||||
}
|
||||
|
||||
dbus_connection_send(iface->con, _signal, NULL);
|
||||
|
||||
out:
|
||||
dbus_message_unref(_signal);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_dbus_notify_scanning - send scanning status
|
||||
* @wpa_s: %wpa_supplicant network interface data
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Notify listeners of interface scanning state changes
|
||||
*/
|
||||
void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
||||
DBusMessage *_signal;
|
||||
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"Scanning");
|
||||
if (_signal == NULL) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
|
||||
"results signal");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbus_message_append_args(_signal,
|
||||
DBUS_TYPE_BOOLEAN, &scanning,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
dbus_connection_send(iface->con, _signal, NULL);
|
||||
} else {
|
||||
wpa_printf(MSG_ERROR, "dbus: Not enough memory to construct "
|
||||
"signal");
|
||||
}
|
||||
dbus_message_unref(_signal);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_WPS
|
||||
void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||
const struct wps_credential *cred)
|
||||
{
|
||||
struct wpas_dbus_priv *iface;
|
||||
DBusMessage *_signal = NULL;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (wpa_s->global == NULL)
|
||||
return;
|
||||
iface = wpa_s->global->dbus;
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"WpsCred");
|
||||
if (_signal == NULL) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_wps_cred: "
|
||||
"Could not create dbus signal; likely out of "
|
||||
"memory");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dbus_message_append_args(_signal,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
|
||||
&cred->cred_attr, cred->cred_attr_len,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_wps_cred: "
|
||||
"Not enough memory to construct signal");
|
||||
goto out;
|
||||
}
|
||||
|
||||
dbus_connection_send(iface->con, _signal, NULL);
|
||||
|
||||
out:
|
||||
dbus_message_unref(_signal);
|
||||
}
|
||||
#else /* CONFIG_WPS */
|
||||
void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||
const struct wps_credential *cred)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth, const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert)
|
||||
{
|
||||
struct wpas_dbus_priv *iface;
|
||||
DBusMessage *_signal = NULL;
|
||||
const char *hash;
|
||||
const char *cert_hex;
|
||||
int cert_hex_len;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (wpa_s->global == NULL)
|
||||
return;
|
||||
iface = wpa_s->global->dbus;
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||
WPAS_DBUS_IFACE_INTERFACE,
|
||||
"Certification");
|
||||
if (_signal == NULL) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_certification: "
|
||||
"Could not create dbus signal; likely out of "
|
||||
"memory");
|
||||
return;
|
||||
}
|
||||
|
||||
hash = cert_hash ? cert_hash : "";
|
||||
cert_hex = cert ? wpabuf_head(cert) : "";
|
||||
cert_hex_len = cert ? wpabuf_len(cert) : 0;
|
||||
|
||||
if (!dbus_message_append_args(_signal,
|
||||
DBUS_TYPE_INT32,&depth,
|
||||
DBUS_TYPE_STRING, &subject,
|
||||
DBUS_TYPE_STRING, &hash,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
|
||||
&cert_hex, cert_hex_len,
|
||||
DBUS_TYPE_INVALID)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"dbus: wpa_supplicant_dbus_notify_certification: "
|
||||
"Not enough memory to construct signal");
|
||||
goto out;
|
||||
}
|
||||
|
||||
dbus_connection_send(iface->con, _signal, NULL);
|
||||
|
||||
out:
|
||||
dbus_message_unref(_signal);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_dbus_ctrl_iface_init - Initialize dbus control interface
|
||||
* @global: Pointer to global data from wpa_supplicant_init()
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Initialize the dbus control interface and start receiving commands from
|
||||
* external programs over the bus.
|
||||
*/
|
||||
int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface)
|
||||
{
|
||||
DBusError error;
|
||||
int ret = -1;
|
||||
DBusObjectPathVTable wpas_vtable = {
|
||||
NULL, &wpas_message_handler, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/* Register the message handler for the global dbus interface */
|
||||
if (!dbus_connection_register_object_path(iface->con,
|
||||
WPAS_DBUS_PATH, &wpas_vtable,
|
||||
iface)) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||
"handler");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Register our service with the message bus */
|
||||
dbus_error_init(&error);
|
||||
switch (dbus_bus_request_name(iface->con, WPAS_DBUS_SERVICE,
|
||||
0, &error)) {
|
||||
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
|
||||
ret = 0;
|
||||
break;
|
||||
case DBUS_REQUEST_NAME_REPLY_EXISTS:
|
||||
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
||||
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
|
||||
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||
"already registered");
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||
"%s %s", error.name, error.message);
|
||||
break;
|
||||
}
|
||||
dbus_error_free(&error);
|
||||
|
||||
if (ret != 0)
|
||||
return -1;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Providing DBus service '" WPAS_DBUS_SERVICE
|
||||
"'.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_register_new_iface - Register a new interface with dbus
|
||||
* @wpa_s: %wpa_supplicant interface description structure to register
|
||||
* Returns: 0 on success, -1 on error
|
||||
*
|
||||
* Registers a new interface with dbus and assigns it a dbus object path.
|
||||
*/
|
||||
int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus;
|
||||
DBusConnection * con;
|
||||
u32 next;
|
||||
DBusObjectPathVTable vtable = {
|
||||
NULL, &wpas_iface_message_handler, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (ctrl_iface == NULL)
|
||||
return 0;
|
||||
|
||||
con = ctrl_iface->con;
|
||||
next = ctrl_iface->next_objid++;
|
||||
|
||||
/* Create and set the interface's object path */
|
||||
wpa_s->dbus_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||
if (wpa_s->dbus_path == NULL)
|
||||
return -1;
|
||||
os_snprintf(wpa_s->dbus_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||
WPAS_DBUS_PATH_INTERFACES "/%u",
|
||||
next);
|
||||
|
||||
/* Register the message handler for the interface functions */
|
||||
if (!dbus_connection_register_fallback(con, wpa_s->dbus_path, &vtable,
|
||||
wpa_s)) {
|
||||
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||
"handler for interface %s", wpa_s->ifname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_unregister_iface - Unregister an interface from dbus
|
||||
* @wpa_s: wpa_supplicant interface structure
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Unregisters the interface with dbus
|
||||
*/
|
||||
int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
struct wpas_dbus_priv *ctrl_iface;
|
||||
DBusConnection *con;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (wpa_s == NULL || wpa_s->global == NULL)
|
||||
return 0;
|
||||
ctrl_iface = wpa_s->global->dbus;
|
||||
if (ctrl_iface == NULL)
|
||||
return 0;
|
||||
|
||||
con = ctrl_iface->con;
|
||||
if (!dbus_connection_unregister_object_path(con, wpa_s->dbus_path))
|
||||
return -1;
|
||||
|
||||
os_free(wpa_s->dbus_path);
|
||||
wpa_s->dbus_path = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_get_iface_by_dbus_path - Get a new network interface
|
||||
* @global: Pointer to global data from wpa_supplicant_init()
|
||||
* @path: Pointer to a dbus object path representing an interface
|
||||
* Returns: Pointer to the interface or %NULL if not found
|
||||
*/
|
||||
struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
|
||||
struct wpa_global *global, const char *path)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s;
|
||||
|
||||
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
||||
if (strcmp(wpa_s->dbus_path, path) == 0)
|
||||
return wpa_s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
137
contrib/wpa/wpa_supplicant/dbus/dbus_old.h
Normal file
137
contrib/wpa/wpa_supplicant/dbus/dbus_old.h
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef CTRL_IFACE_DBUS_H
|
||||
#define CTRL_IFACE_DBUS_H
|
||||
|
||||
struct wps_credential;
|
||||
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS
|
||||
|
||||
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||
|
||||
#define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant"
|
||||
#define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant"
|
||||
#define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant"
|
||||
|
||||
#define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces"
|
||||
#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
|
||||
|
||||
#define WPAS_DBUS_NETWORKS_PART "Networks"
|
||||
#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
|
||||
|
||||
#define WPAS_DBUS_BSSIDS_PART "BSSIDs"
|
||||
#define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID"
|
||||
|
||||
|
||||
/* Errors */
|
||||
#define WPAS_ERROR_INVALID_NETWORK \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
|
||||
#define WPAS_ERROR_INVALID_BSSID \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
|
||||
|
||||
#define WPAS_ERROR_INVALID_OPTS \
|
||||
WPAS_DBUS_INTERFACE ".InvalidOptions"
|
||||
#define WPAS_ERROR_INVALID_IFACE \
|
||||
WPAS_DBUS_INTERFACE ".InvalidInterface"
|
||||
|
||||
#define WPAS_ERROR_ADD_ERROR \
|
||||
WPAS_DBUS_INTERFACE ".AddError"
|
||||
#define WPAS_ERROR_EXISTS_ERROR \
|
||||
WPAS_DBUS_INTERFACE ".ExistsError"
|
||||
#define WPAS_ERROR_REMOVE_ERROR \
|
||||
WPAS_DBUS_INTERFACE ".RemoveError"
|
||||
|
||||
#define WPAS_ERROR_SCAN_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".ScanError"
|
||||
#define WPAS_ERROR_ADD_NETWORK_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
|
||||
#define WPAS_ERROR_INTERNAL_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".InternalError"
|
||||
#define WPAS_ERROR_REMOVE_NETWORK_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
|
||||
|
||||
#define WPAS_ERROR_WPS_PBC_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError"
|
||||
#define WPAS_ERROR_WPS_PIN_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".WpsPinError"
|
||||
#define WPAS_ERROR_WPS_REG_ERROR \
|
||||
WPAS_DBUS_IFACE_INTERFACE ".WpsRegError"
|
||||
|
||||
#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
|
||||
|
||||
struct wpa_global;
|
||||
struct wpa_supplicant;
|
||||
|
||||
int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface);
|
||||
void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
|
||||
void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s);
|
||||
void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
||||
enum wpa_states new_state,
|
||||
enum wpa_states old_state);
|
||||
void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||
const struct wps_credential *cred);
|
||||
void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth, const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert);
|
||||
|
||||
char * wpas_dbus_decompose_object_path(const char *path, char **network,
|
||||
char **bssid);
|
||||
|
||||
int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
|
||||
int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
|
||||
|
||||
|
||||
/* Methods internal to the dbus control interface */
|
||||
struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
|
||||
struct wpa_global *global, const char *path);
|
||||
|
||||
#else /* CONFIG_CTRL_IFACE_DBUS */
|
||||
|
||||
static inline void
|
||||
wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
}
|
||||
|
||||
#define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0)
|
||||
|
||||
static inline void
|
||||
wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||
const struct wps_credential *cred)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void
|
||||
wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
|
||||
int depth, const char *subject,
|
||||
const char *cert_hash,
|
||||
const struct wpabuf *cert)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int
|
||||
wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
||||
|
||||
#endif /* CTRL_IFACE_DBUS_H */
|
1462
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c
Normal file
1462
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c
Normal file
File diff suppressed because it is too large
Load Diff
101
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h
Normal file
101
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef CTRL_IFACE_DBUS_HANDLERS_H
|
||||
#define CTRL_IFACE_DBUS_HANDLERS_H
|
||||
|
||||
struct wpa_bss;
|
||||
|
||||
DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
|
||||
DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
|
||||
|
||||
DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
|
||||
struct wpa_global *global);
|
||||
|
||||
DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
|
||||
struct wpa_global *global);
|
||||
|
||||
DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
|
||||
struct wpa_global *global);
|
||||
|
||||
DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
|
||||
struct wpa_global *global);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
struct wpa_bss *bss);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_capabilities(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_enable_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_disable_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_disconnect(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_set_ap_scan(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_set_smartcard_modules(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_get_scanning(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_wps_pbc(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_wps_reg(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_iface_flush(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_new_success_reply(DBusMessage *message);
|
||||
DBusMessage * wpas_dbus_new_invalid_opts_error(DBusMessage *message,
|
||||
const char *arg);
|
||||
|
||||
#endif /* CTRL_IFACE_DBUS_HANDLERS_H */
|
||||
|
157
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c
Normal file
157
contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* WPA Supplicant / dbus-based control interface (WPS)
|
||||
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "../config.h"
|
||||
#include "../wpa_supplicant_i.h"
|
||||
#include "../wps_supplicant.h"
|
||||
#include "dbus_old.h"
|
||||
#include "dbus_old_handlers.h"
|
||||
|
||||
/**
|
||||
* wpas_dbus_iface_wps_pbc - Request credentials using WPS PBC method
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: %wpa_supplicant data structure
|
||||
* Returns: A dbus message containing a UINT32 indicating success (1) or
|
||||
* failure (0)
|
||||
*
|
||||
* Handler function for "wpsPbc" method call
|
||||
*/
|
||||
DBusMessage * wpas_dbus_iface_wps_pbc(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
char *arg_bssid = NULL;
|
||||
u8 bssid[ETH_ALEN];
|
||||
int ret = 0;
|
||||
|
||||
if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
|
||||
DBUS_TYPE_INVALID))
|
||||
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||
|
||||
if (!os_strcmp(arg_bssid, "any"))
|
||||
ret = wpas_wps_start_pbc(wpa_s, NULL, 0);
|
||||
else if (!hwaddr_aton(arg_bssid, bssid))
|
||||
ret = wpas_wps_start_pbc(wpa_s, bssid, 0);
|
||||
else {
|
||||
return wpas_dbus_new_invalid_opts_error(message,
|
||||
"Invalid BSSID");
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
return dbus_message_new_error(message,
|
||||
WPAS_ERROR_WPS_PBC_ERROR,
|
||||
"Could not start PBC "
|
||||
"negotiation");
|
||||
}
|
||||
|
||||
return wpas_dbus_new_success_reply(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_iface_wps_pin - Establish the PIN number of the enrollee
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: %wpa_supplicant data structure
|
||||
* Returns: A dbus message containing a UINT32 indicating success (1) or
|
||||
* failure (0)
|
||||
*
|
||||
* Handler function for "wpsPin" method call
|
||||
*/
|
||||
DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
char *arg_bssid;
|
||||
char *pin = NULL;
|
||||
u8 bssid[ETH_ALEN], *_bssid = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
|
||||
DBUS_TYPE_STRING, &pin, DBUS_TYPE_INVALID))
|
||||
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||
|
||||
if (!os_strcmp(arg_bssid, "any"))
|
||||
_bssid = NULL;
|
||||
else if (!hwaddr_aton(arg_bssid, bssid))
|
||||
_bssid = bssid;
|
||||
else {
|
||||
return wpas_dbus_new_invalid_opts_error(message,
|
||||
"Invalid BSSID");
|
||||
}
|
||||
|
||||
if (os_strlen(pin) > 0)
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, pin, 0,
|
||||
DEV_PW_DEFAULT);
|
||||
else
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, NULL, 0,
|
||||
DEV_PW_DEFAULT);
|
||||
|
||||
if (ret < 0) {
|
||||
return dbus_message_new_error(message,
|
||||
WPAS_ERROR_WPS_PIN_ERROR,
|
||||
"Could not init PIN");
|
||||
}
|
||||
|
||||
reply = dbus_message_new_method_return(message);
|
||||
if (reply == NULL)
|
||||
return NULL;
|
||||
|
||||
if (ret == 0) {
|
||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &pin,
|
||||
DBUS_TYPE_INVALID);
|
||||
} else {
|
||||
char npin[9];
|
||||
os_snprintf(npin, sizeof(npin), "%08d", ret);
|
||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &npin,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_iface_wps_reg - Request credentials using the PIN of the AP
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: %wpa_supplicant data structure
|
||||
* Returns: A dbus message containing a UINT32 indicating success (1) or
|
||||
* failure (0)
|
||||
*
|
||||
* Handler function for "wpsReg" method call
|
||||
*/
|
||||
DBusMessage * wpas_dbus_iface_wps_reg(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
char *arg_bssid;
|
||||
char *pin = NULL;
|
||||
u8 bssid[ETH_ALEN];
|
||||
int ret = 0;
|
||||
|
||||
if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
|
||||
DBUS_TYPE_STRING, &pin, DBUS_TYPE_INVALID))
|
||||
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||
|
||||
if (!os_strcmp(arg_bssid, "any"))
|
||||
ret = wpas_wps_start_reg(wpa_s, NULL, pin, NULL);
|
||||
else if (!hwaddr_aton(arg_bssid, bssid))
|
||||
ret = wpas_wps_start_reg(wpa_s, bssid, pin, NULL);
|
||||
else {
|
||||
return wpas_dbus_new_invalid_opts_error(message,
|
||||
"Invalid BSSID");
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
return dbus_message_new_error(message,
|
||||
WPAS_ERROR_WPS_PBC_ERROR,
|
||||
"Could not request credentials");
|
||||
}
|
||||
|
||||
return wpas_dbus_new_success_reply(message);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
[D-BUS Service]
|
||||
Name=fi.epitest.hostap.WPASupplicant
|
||||
Exec=@BINDIR@/wpa_supplicant -u
|
||||
User=root
|
||||
SystemdService=wpa_supplicant.service
|
@ -0,0 +1,5 @@
|
||||
[D-BUS Service]
|
||||
Name=fi.w1.wpa_supplicant1
|
||||
Exec=@BINDIR@/wpa_supplicant -u
|
||||
User=root
|
||||
SystemdService=wpa_supplicant.service
|
Loading…
Reference in New Issue
Block a user