Standardize on a single definition of auth_alg bitfield values
[hostap-gosc2009.git] / wpa_supplicant / dbus / dbus_new_helpers.h
blobf34fdc3c06cdf9413f060aa6141c07e0babadacd
1 /*
2 * WPA Supplicant / dbus-based control interface
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
11 * license.
13 * See README and COPYING for more details.
16 #ifndef WPA_DBUS_CTRL_H
17 #define WPA_DBUS_CTRL_H
19 #include <dbus/dbus.h>
21 typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
22 void *user_data);
23 typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
25 typedef DBusMessage * (* WPADBusPropertyAccessor)(DBusMessage *message,
26 const void *user_data);
28 struct wpa_dbus_object_desc {
29 DBusConnection *connection;
31 /* list of methods, properties and signals registered with object */
32 const struct wpa_dbus_method_desc *methods;
33 const struct wpa_dbus_signal_desc *signals;
34 const struct wpa_dbus_property_desc *properties;
36 /* argument for method handlers and properties
37 * getter and setter functions */
38 void *user_data;
39 /* function used to free above argument */
40 WPADBusArgumentFreeFunction user_data_free_func;
43 enum dbus_prop_access { R, W, RW };
45 enum dbus_arg_direction { ARG_IN, ARG_OUT };
47 struct wpa_dbus_argument {
48 char *name;
49 char *type;
50 enum dbus_arg_direction dir;
53 #define END_ARGS { NULL, NULL, ARG_IN }
55 /**
56 * struct wpa_dbus_method_desc - DBus method description
58 struct wpa_dbus_method_desc {
59 /* method name */
60 const char *dbus_method;
61 /* method interface */
62 const char *dbus_interface;
63 /* method handling function */
64 WPADBusMethodHandler method_handler;
65 /* array of arguments */
66 struct wpa_dbus_argument args[3];
69 /**
70 * struct wpa_dbus_signal_desc - DBus signal description
72 struct wpa_dbus_signal_desc {
73 /* signal name */
74 const char *dbus_signal;
75 /* signal interface */
76 const char *dbus_interface;
77 /* array of arguments */
78 struct wpa_dbus_argument args[3];
81 /**
82 * struct wpa_dbus_property_desc - DBus property description
84 struct wpa_dbus_property_desc {
85 /* property name */
86 const char *dbus_property;
87 /* property interface */
88 const char *dbus_interface;
89 /* property type signature in DBus type notation */
90 const char *type;
91 /* property getter function */
92 WPADBusPropertyAccessor getter;
93 /* property setter function */
94 WPADBusPropertyAccessor setter;
95 /* property access permissions */
96 enum dbus_prop_access access;
100 #define WPAS_DBUS_OBJECT_PATH_MAX 150
101 #define WPAS_DBUS_INTERFACE_MAX 150
102 #define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
104 #define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
105 #define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
106 #define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
107 #define WPA_DBUS_PROPERTIES_GET "Get"
108 #define WPA_DBUS_PROPERTIES_SET "Set"
109 #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
111 void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
113 int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
114 char *dbus_service,
115 struct wpa_dbus_object_desc *obj_desc);
117 int wpa_dbus_register_object_per_iface(
118 struct wpas_dbus_priv *ctrl_iface,
119 const char *path, const char *ifname,
120 struct wpa_dbus_object_desc *obj_desc);
122 int wpa_dbus_unregister_object_per_iface(
123 struct wpas_dbus_priv *ctrl_iface,
124 const char *path);
126 void wpa_dbus_signal_property_changed(struct wpas_dbus_priv *iface,
127 WPADBusPropertyAccessor property_getter,
128 void *getter_arg,
129 const char *path,
130 const char *interface_name,
131 const char *property_name);
133 void wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
134 const char *path, const char *interface,
135 DBusMessageIter *dict_iter);
137 DBusMessage * wpa_dbus_introspect(DBusMessage *message,
138 struct wpa_dbus_object_desc *obj_dsc);
140 #endif /* WPA_DBUS_CTRL_H */