2009-11-09 22:51:59 +01:00
|
|
|
/*
|
|
|
|
* WPA Supplicant / dbus-based control interface
|
|
|
|
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
|
|
|
|
* Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of BSD
|
|
|
|
* license.
|
|
|
|
*
|
|
|
|
* See README and COPYING for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WPA_DBUS_CTRL_H
|
|
|
|
#define WPA_DBUS_CTRL_H
|
|
|
|
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
|
|
|
typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
|
|
|
|
void *user_data);
|
|
|
|
typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
|
|
|
|
|
|
|
|
typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
|
|
|
|
void *user_data);
|
|
|
|
|
|
|
|
struct wpa_dbus_object_desc {
|
|
|
|
DBusConnection *connection;
|
|
|
|
struct wpa_dbus_method_desc *methods;
|
|
|
|
struct wpa_dbus_signal_desc *signals;
|
|
|
|
struct wpa_dbus_property_desc *properties;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum dbus_prop_access { R, W, RW };
|
|
|
|
|
|
|
|
enum dbus_arg_direction { ARG_IN, ARG_OUT };
|
|
|
|
|
|
|
|
struct wpa_dbus_argument {
|
|
|
|
char *name;
|
|
|
|
char *type;
|
|
|
|
enum dbus_arg_direction dir;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define END_ARGS { NULL, NULL, ARG_IN }
|
|
|
|
|
|
|
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
|
|
|
|
|
|
|
#ifndef SIGPOLL
|
|
|
|
#ifdef SIGIO
|
|
|
|
/*
|
|
|
|
* If we do not have SIGPOLL, try to use SIGIO instead. This is needed for
|
|
|
|
* FreeBSD.
|
|
|
|
*/
|
|
|
|
#define SIGPOLL SIGIO
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
|
|
|
#define WPAS_DBUS_INTERFACE_MAX 150
|
|
|
|
#define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
|
|
|
|
|
|
|
|
#define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
|
|
|
|
#define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
|
|
|
|
#define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
|
|
|
#define WPA_DBUS_PROPERTIES_GET "Get"
|
|
|
|
#define WPA_DBUS_PROPERTIES_SET "Set"
|
|
|
|
#define WPA_DBUS_PROPERTIES_GETALL "GetAll"
|
|
|
|
|
|
|
|
void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
|
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
|
|
|
|
char *dbus_service,
|
|
|
|
struct wpa_dbus_object_desc *obj_desc);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
int wpa_dbus_register_object_per_iface(
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *ctrl_iface,
|
2009-11-09 22:51:59 +01:00
|
|
|
const char *path, const char *ifname,
|
|
|
|
struct wpa_dbus_object_desc *obj_desc);
|
|
|
|
|
|
|
|
int wpa_dbus_unregister_object_per_iface(
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *ctrl_iface,
|
2009-11-09 22:51:59 +01:00
|
|
|
const char *path);
|
|
|
|
|
|
|
|
int wpa_dbus_method_register(struct wpa_dbus_object_desc *obj_dsc,
|
2009-11-14 15:57:07 +01:00
|
|
|
const char *dbus_interface,
|
|
|
|
const char *dbus_method,
|
2009-11-09 22:51:59 +01:00
|
|
|
WPADBusMethodHandler method_handler,
|
|
|
|
void *handler_argument,
|
|
|
|
WPADBusArgumentFreeFunction argument_free_func,
|
2009-11-14 17:18:07 +01:00
|
|
|
const struct wpa_dbus_argument args[]);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
int wpa_dbus_signal_register(struct wpa_dbus_object_desc *obj_dsc,
|
2009-11-14 15:57:07 +01:00
|
|
|
const char *dbus_interface,
|
|
|
|
const char *dbus_signal,
|
2009-11-14 17:18:07 +01:00
|
|
|
const struct wpa_dbus_argument args[]);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
|
|
|
int wpa_dbus_property_register(
|
|
|
|
struct wpa_dbus_object_desc *obj_dsc,
|
2009-11-14 15:57:07 +01:00
|
|
|
const char *dbus_interface, const char *dbus_property,
|
|
|
|
const char *type,
|
2009-11-09 22:51:59 +01:00
|
|
|
WPADBusPropertyAccessor getter,
|
|
|
|
WPADBusPropertyAccessor setter,
|
|
|
|
void *user_data,
|
2009-11-14 15:57:07 +01:00
|
|
|
WPADBusArgumentFreeFunction user_data_free_func,
|
|
|
|
enum dbus_prop_access _access);
|
2009-11-09 22:51:59 +01:00
|
|
|
|
2009-12-30 23:15:56 +01:00
|
|
|
void wpa_dbus_signal_property_changed(struct wpas_dbus_priv *iface,
|
2009-11-09 22:51:59 +01:00
|
|
|
WPADBusPropertyAccessor property_getter,
|
|
|
|
void *getter_arg,
|
|
|
|
const char *path,
|
|
|
|
const char *interface_name,
|
|
|
|
const char *property_name);
|
|
|
|
|
|
|
|
|
|
|
|
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
|
|
|
|
|
|
|
static inline void wpa_dbus_signal_property_changed(
|
2009-12-30 23:15:56 +01:00
|
|
|
struct wpas_dbus_priv *iface,
|
2009-11-09 22:51:59 +01:00
|
|
|
WPADBusPropertyAccessor property_getter, void *getter_arg,
|
|
|
|
const char *path, const char *interface_name,
|
|
|
|
const char *property_name)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
|
|
|
|
|
|
|
|
#endif /* WPA_DBUS_CTRL_H */
|