dbus_new_helpers.h
Go to the documentation of this file.
00001 /*
00002  * WPA Supplicant / dbus-based control interface
00003  * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
00004  * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License version 2 as
00008  * published by the Free Software Foundation.
00009  *
00010  * Alternatively, this software may be distributed under the terms of BSD
00011  * license.
00012  *
00013  * See README and COPYING for more details.
00014  */
00015 
00016 #ifndef WPA_DBUS_CTRL_H
00017 #define WPA_DBUS_CTRL_H
00018 
00019 #include <dbus/dbus.h>
00020 
00021 typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
00022                                                void *user_data);
00023 typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
00024 
00025 typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
00026                                                   const void *user_data);
00027 
00028 struct wpa_dbus_object_desc {
00029         DBusConnection *connection;
00030         char *path;
00031 
00032         /* list of methods, properties and signals registered with object */
00033         const struct wpa_dbus_method_desc *methods;
00034         const struct wpa_dbus_signal_desc *signals;
00035         const struct wpa_dbus_property_desc *properties;
00036 
00037         /* property changed flags */
00038         u8 *prop_changed_flags;
00039 
00040         /* argument for method handlers and properties
00041          * getter and setter functions */
00042         void *user_data;
00043         /* function used to free above argument */
00044         WPADBusArgumentFreeFunction user_data_free_func;
00045 };
00046 
00047 enum dbus_prop_access { R, W, RW };
00048 
00049 enum dbus_arg_direction { ARG_IN, ARG_OUT };
00050 
00051 struct wpa_dbus_argument {
00052         char *name;
00053         char *type;
00054         enum dbus_arg_direction dir;
00055 };
00056 
00057 #define END_ARGS { NULL, NULL, ARG_IN }
00058 
00062 struct wpa_dbus_method_desc {
00063         /* method name */
00064         const char *dbus_method;
00065         /* method interface */
00066         const char *dbus_interface;
00067         /* method handling function */
00068         WPADBusMethodHandler method_handler;
00069         /* array of arguments */
00070         struct wpa_dbus_argument args[3];
00071 };
00072 
00076 struct wpa_dbus_signal_desc {
00077         /* signal name */
00078         const char *dbus_signal;
00079         /* signal interface */
00080         const char *dbus_interface;
00081         /* array of arguments */
00082         struct wpa_dbus_argument args[3];
00083 };
00084 
00088 struct wpa_dbus_property_desc {
00089         /* property name */
00090         const char *dbus_property;
00091         /* property interface */
00092         const char *dbus_interface;
00093         /* property type signature in DBus type notation */
00094         const char *type;
00095         /* property getter function */
00096         WPADBusPropertyAccessor getter;
00097         /* property setter function */
00098         WPADBusPropertyAccessor setter;
00099         /* property access permissions */
00100         enum dbus_prop_access access;
00101 };
00102 
00103 
00104 #define WPAS_DBUS_OBJECT_PATH_MAX 150
00105 #define WPAS_DBUS_INTERFACE_MAX 150
00106 #define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
00107 
00108 #define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
00109 #define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
00110 #define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
00111 #define WPA_DBUS_PROPERTIES_GET "Get"
00112 #define WPA_DBUS_PROPERTIES_SET "Set"
00113 #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
00114 
00115 void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
00116 
00117 int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
00118                              char *dbus_service,
00119                              struct wpa_dbus_object_desc *obj_desc);
00120 
00121 int wpa_dbus_register_object_per_iface(
00122         struct wpas_dbus_priv *ctrl_iface,
00123         const char *path, const char *ifname,
00124         struct wpa_dbus_object_desc *obj_desc);
00125 
00126 int wpa_dbus_unregister_object_per_iface(
00127         struct wpas_dbus_priv *ctrl_iface,
00128         const char *path);
00129 
00130 void wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
00131                                     const char *path, const char *interface,
00132                                     DBusMessageIter *dict_iter);
00133 
00134 
00135 void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
00136 
00137 void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
00138                                               const char *path);
00139 
00140 void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
00141                                     const char *path, const char *interface,
00142                                     const char *property);
00143 
00144 DBusMessage * wpa_dbus_introspect(DBusMessage *message,
00145                                   struct wpa_dbus_object_desc *obj_dsc);
00146 
00147 #endif /* WPA_DBUS_CTRL_H */


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:25:12