#include "utils/includes.h"
#include "utils/common.h"
#include "utils/eloop.h"
#include "dbus_common.h"
#include "dbus_common_i.h"
#include "dbus_new.h"
#include "dbus_new_helpers.h"
Go to the source code of this file.
Defines | |
#define | MAX_SIG_LEN 256 |
#define | WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT 5000 |
Functions | |
static unsigned int | fill_dict_with_properties (DBusMessageIter *dict_iter, const struct wpa_dbus_property_desc *props, const char *interface, const void *user_data) |
static void | flush_object_timeout_handler (void *eloop_ctx, void *timeout_ctx) |
void | free_dbus_object_desc (struct wpa_dbus_object_desc *obj_dsc) |
static void | free_dbus_object_desc_cb (DBusConnection *connection, void *obj_dsc) |
static DBusMessage * | get_all_properties (DBusMessage *message, char *interface, struct wpa_dbus_object_desc *obj_dsc) |
static int | is_signature_correct (DBusMessage *message, const struct wpa_dbus_method_desc *method_dsc) |
static DBusHandlerResult | message_handler (DBusConnection *connection, DBusMessage *message, void *user_data) |
static DBusMessage * | msg_method_handler (DBusMessage *message, struct wpa_dbus_object_desc *obj_dsc) |
static DBusMessage * | properties_get (DBusMessage *message, const struct wpa_dbus_property_desc *dsc, void *user_data) |
static DBusMessage * | properties_get_all (DBusMessage *message, char *interface, struct wpa_dbus_object_desc *obj_dsc) |
static DBusMessage * | properties_get_or_set (DBusMessage *message, DBusMessageIter *iter, char *interface, struct wpa_dbus_object_desc *obj_dsc) |
static DBusMessage * | properties_handler (DBusMessage *message, struct wpa_dbus_object_desc *obj_dsc) |
static DBusMessage * | properties_set (DBusMessage *message, const struct wpa_dbus_property_desc *dsc, void *user_data) |
static void | put_changed_properties (const struct wpa_dbus_object_desc *obj_dsc, const char *interface, DBusMessageIter *dict_iter) |
static void | recursive_flush_changed_properties (DBusConnection *con, const char *path) |
static void | recursive_iter_copy (DBusMessageIter *from, DBusMessageIter *to) |
static void | send_prop_changed_signal (DBusConnection *con, const char *path, const char *interface, const 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) |
void | wpa_dbus_flush_all_changed_properties (DBusConnection *con) |
void | wpa_dbus_flush_object_changed_properties (DBusConnection *con, 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_mark_property_changed (struct wpas_dbus_priv *iface, const char *path, const char *interface, const char *property) |
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) |
#define MAX_SIG_LEN 256 |
#define WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT 5000 |
Definition at line 789 of file dbus_new_helpers.c.
static unsigned int fill_dict_with_properties | ( | DBusMessageIter * | dict_iter, |
const struct wpa_dbus_property_desc * | props, | ||
const char * | interface, | ||
const void * | user_data | ||
) | [static] |
Definition at line 88 of file dbus_new_helpers.c.
static void flush_object_timeout_handler | ( | void * | eloop_ctx, |
void * | timeout_ctx | ||
) | [static] |
Definition at line 701 of file dbus_new_helpers.c.
void free_dbus_object_desc | ( | struct wpa_dbus_object_desc * | obj_dsc | ) |
free_dbus_object_desc - Frees object description data structure : DBus connection : Object description to free
Frees each of properties, methods and signals description lists and the object description structure itself.
Definition at line 455 of file dbus_new_helpers.c.
static void free_dbus_object_desc_cb | ( | DBusConnection * | connection, |
void * | obj_dsc | ||
) | [static] |
Definition at line 470 of file dbus_new_helpers.c.
static DBusMessage* get_all_properties | ( | DBusMessage * | message, |
char * | interface, | ||
struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 145 of file dbus_new_helpers.c.
static int is_signature_correct | ( | DBusMessage * | message, |
const struct wpa_dbus_method_desc * | method_dsc | ||
) | [static] |
Definition at line 180 of file dbus_new_helpers.c.
static DBusHandlerResult message_handler | ( | DBusConnection * | connection, |
DBusMessage * | message, | ||
void * | user_data | ||
) | [static] |
message_handler - Handles incoming DBus messages : DBus connection on which message was received : Received message : pointer to description of object to which message was sent Returns: Returns information whether message was handled or not
Reads message interface and method name, then checks if they matches one of the special cases i.e. introspection call or properties get/getall/set methods and handles it. Else it iterates over registered methods list and tries to match method's name and interface to those read from message If appropriate method was found its handler function is called and response is sent. Otherwise, the DBUS_ERROR_UNKNOWN_METHOD error message will be sent.
Definition at line 392 of file dbus_new_helpers.c.
static DBusMessage* msg_method_handler | ( | DBusMessage * | message, |
struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 338 of file dbus_new_helpers.c.
static DBusMessage* properties_get | ( | DBusMessage * | message, |
const struct wpa_dbus_property_desc * | dsc, | ||
void * | user_data | ||
) | [static] |
Definition at line 218 of file dbus_new_helpers.c.
static DBusMessage* properties_get_all | ( | DBusMessage * | message, |
char * | interface, | ||
struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 207 of file dbus_new_helpers.c.
static DBusMessage* properties_get_or_set | ( | DBusMessage * | message, |
DBusMessageIter * | iter, | ||
char * | interface, | ||
struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 251 of file dbus_new_helpers.c.
static DBusMessage* properties_handler | ( | DBusMessage * | message, |
struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 298 of file dbus_new_helpers.c.
static DBusMessage* properties_set | ( | DBusMessage * | message, |
const struct wpa_dbus_property_desc * | dsc, | ||
void * | user_data | ||
) | [static] |
Definition at line 234 of file dbus_new_helpers.c.
static void put_changed_properties | ( | const struct wpa_dbus_object_desc * | obj_dsc, |
const char * | interface, | ||
DBusMessageIter * | dict_iter | ||
) | [static] |
Definition at line 614 of file dbus_new_helpers.c.
static void recursive_flush_changed_properties | ( | DBusConnection * | con, |
const char * | path | ||
) | [static] |
Definition at line 712 of file dbus_new_helpers.c.
static void recursive_iter_copy | ( | DBusMessageIter * | from, |
DBusMessageIter * | to | ||
) | [static] |
recursive_iter_copy - Reads arguments from one iterator and writes to another recursively : iterator to read from : iterator to write to
Copies one iterator's elements to another. If any element in iterator is of container type, its content is copied recursively
Definition at line 35 of file dbus_new_helpers.c.
static void send_prop_changed_signal | ( | DBusConnection * | con, |
const char * | path, | ||
const char * | interface, | ||
const struct wpa_dbus_object_desc * | obj_dsc | ||
) | [static] |
Definition at line 666 of file dbus_new_helpers.c.
int wpa_dbus_ctrl_iface_init | ( | struct wpas_dbus_priv * | iface, |
char * | dbus_path, | ||
char * | dbus_service, | ||
struct wpa_dbus_object_desc * | obj_desc | ||
) |
wpa_dbus_ctrl_iface_init - Initialize dbus control interface : Pointer to application specific data structure : DBus path to interface object : DBus service name to register with : a pointer to function which will handle dbus messages coming on interface Returns: 0 on success, -1 on failure
Initialize the dbus control interface and start receiving commands from external programs over the bus.
Definition at line 487 of file dbus_new_helpers.c.
void wpa_dbus_flush_all_changed_properties | ( | DBusConnection * | con | ) |
wpa_dbus_flush_all_changed_properties - Send all PropertiesChanged signals : DBus connection
Traverses through all registered objects and sends PropertiesChanged for each properties.
Definition at line 742 of file dbus_new_helpers.c.
void wpa_dbus_flush_object_changed_properties | ( | DBusConnection * | con, |
const char * | path | ||
) |
wpa_dbus_flush_object_changed_properties - Send PropertiesChanged for object : DBus connection : path to a DBus object for which PropertiesChanged will be sent.
Iterates over all properties registered with object and for each interface containing properties marked as changed, sends a PropertiesChanged signal containing names and new values of properties that have changed.
You need to call this function after wpa_dbus_mark_property_changed() if you want to send PropertiesChanged signal immediately (i.e., without waiting timeout to expire). PropertiesChanged signal for an object is sent automatically short time after first marking property as changed. All PropertiesChanged signals are sent automatically after responding on DBus message, so if you marked a property changed as a result of DBus call (e.g., param setter), you usually do not need to call this function.
Definition at line 765 of file dbus_new_helpers.c.
void wpa_dbus_get_object_properties | ( | struct wpas_dbus_priv * | iface, |
const char * | path, | ||
const char * | interface, | ||
DBusMessageIter * | dict_iter | ||
) |
Definition at line 859 of file dbus_new_helpers.c.
void wpa_dbus_mark_property_changed | ( | struct wpas_dbus_priv * | iface, |
const char * | path, | ||
const char * | interface, | ||
const char * | property | ||
) |
Definition at line 805 of file dbus_new_helpers.c.
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 | ||
) |
wpa_dbus_register_object_per_iface - Register a new object with dbus : pointer to dbus private data : DBus path to object : interface name : description of object's methods, signals and properties Returns: 0 on success, -1 on error
Registers a new interface with dbus and assigns it a dbus object path.
Definition at line 549 of file dbus_new_helpers.c.
int wpa_dbus_unregister_object_per_iface | ( | struct wpas_dbus_priv * | ctrl_iface, |
const char * | path | ||
) |
wpa_dbus_unregister_object_per_iface - Unregisters DBus object : Pointer to dbus private data : DBus path to object which will be unregistered Returns: Zero on success and -1 on failure
Unregisters DBus object given by its path
Definition at line 592 of file dbus_new_helpers.c.