mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-29 10:48:22 -05:00
abd7a4e353
Instead of sending PropertiesChanged signals for each changed property separately, mark properties as changed and send aggregated PropertiesChanged signals for each interface in each object. Aggregated PropertiesChanged signal is sent - for all object after responding on DBus call - for specified object after manual call to wpa_dbus_flush_object_changed_properties() function - for each object separately after short timeout (currently 5 ms) which starts when first property in object is marked changed
148 lines
4.1 KiB
C
148 lines
4.1 KiB
C
/*
|
|
* 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,
|
|
const 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_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 }
|
|
|
|
/**
|
|
* 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[3];
|
|
};
|
|
|
|
/**
|
|
* 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[3];
|
|
};
|
|
|
|
/**
|
|
* 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;
|
|
/* property access permissions */
|
|
enum dbus_prop_access access;
|
|
};
|
|
|
|
|
|
#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);
|
|
|
|
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);
|
|
|
|
void wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
|
|
const char *path, const char *interface,
|
|
DBusMessageIter *dict_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);
|
|
|
|
#endif /* WPA_DBUS_CTRL_H */
|