5 * Copyright (C) 2007-2012 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __CONNMAN_DBUS_H
23 #define __CONNMAN_DBUS_H
25 #include <dbus/dbus.h>
31 #define CONNMAN_SERVICE "net.connman"
32 #define CONNMAN_PATH "/net/connman"
34 #define CONNMAN_DEBUG_INTERFACE CONNMAN_SERVICE ".Debug"
35 #define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error"
36 #define CONNMAN_AGENT_INTERFACE CONNMAN_SERVICE ".Agent"
37 #define CONNMAN_COUNTER_INTERFACE CONNMAN_SERVICE ".Counter"
39 #define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
40 #define CONNMAN_MANAGER_PATH "/"
42 #define CONNMAN_CLOCK_INTERFACE CONNMAN_SERVICE ".Clock"
43 #define CONNMAN_TASK_INTERFACE CONNMAN_SERVICE ".Task"
44 #define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
45 #define CONNMAN_PROVIDER_INTERFACE CONNMAN_SERVICE ".Provider"
46 #define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
47 #define CONNMAN_SESSION_INTERFACE CONNMAN_SERVICE ".Session"
48 #define CONNMAN_NOTIFICATION_INTERFACE CONNMAN_SERVICE ".Notification"
49 #define CONNMAN_PEER_INTERFACE CONNMAN_SERVICE ".Peer"
50 #if defined TIZEN_EXT_WIFI_MESH
51 #define CONNMAN_MESH_INTERFACE CONNMAN_SERVICE ".Mesh"
54 #define CONNMAN_PRIVILEGE_MODIFY 1
55 #define CONNMAN_PRIVILEGE_SECRET 2
57 typedef void (* connman_dbus_append_cb_t) (DBusMessageIter *iter,
60 DBusConnection *connman_dbus_get_connection(void);
62 void connman_dbus_property_append_basic(DBusMessageIter *iter,
63 const char *key, int type, void *val);
64 void connman_dbus_property_append_dict(DBusMessageIter *iter, const char *key,
65 connman_dbus_append_cb_t function, void *user_data);
66 void connman_dbus_property_append_array(DBusMessageIter *iter,
67 const char *key, int type,
68 connman_dbus_append_cb_t function, void *user_data);
69 void connman_dbus_property_append_fixed_array(DBusMessageIter *iter,
70 const char *key, int type, void *val, int len);
72 dbus_bool_t connman_dbus_property_changed_basic(const char *path,
73 const char *interface, const char *key,
75 dbus_bool_t connman_dbus_property_changed_dict(const char *path,
76 const char *interface, const char *key,
77 connman_dbus_append_cb_t function, void *user_data);
78 dbus_bool_t connman_dbus_property_changed_array(const char *path,
79 const char *interface, const char *key, int type,
80 connman_dbus_append_cb_t function, void *user_data);
82 dbus_bool_t connman_dbus_setting_changed_basic(const char *owner,
83 const char *path, const char *key,
85 dbus_bool_t connman_dbus_setting_changed_dict(const char *owner,
86 const char *path, const char *key,
87 connman_dbus_append_cb_t function,
89 dbus_bool_t connman_dbus_setting_changed_array(const char *owner,
90 const char *path, const char *key, int type,
91 connman_dbus_append_cb_t function,
94 static inline void connman_dbus_dict_open(DBusMessageIter *iter,
95 DBusMessageIter *dict)
97 dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
98 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
99 DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
100 DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
103 static inline void connman_dbus_dict_open_variant(DBusMessageIter *iter,
104 DBusMessageIter *dict)
106 dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
107 DBUS_TYPE_ARRAY_AS_STRING
108 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
109 DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
110 DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
113 static inline void connman_dbus_array_open(DBusMessageIter *iter,
114 DBusMessageIter *dict)
116 dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
117 DBUS_TYPE_ARRAY_AS_STRING
118 DBUS_TYPE_STRING_AS_STRING,
122 static inline void connman_dbus_dict_close(DBusMessageIter *iter,
123 DBusMessageIter *dict)
125 dbus_message_iter_close_container(iter, dict);
128 static inline void connman_dbus_dict_append_basic(DBusMessageIter *dict,
129 const char *key, int type, void *val)
131 DBusMessageIter entry;
133 dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
135 connman_dbus_property_append_basic(&entry, key, type, val);
136 dbus_message_iter_close_container(dict, &entry);
139 static inline void connman_dbus_dict_append_dict(DBusMessageIter *dict,
140 const char *key, connman_dbus_append_cb_t function,
143 DBusMessageIter entry;
145 dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
147 connman_dbus_property_append_dict(&entry, key, function, user_data);
148 dbus_message_iter_close_container(dict, &entry);
151 static inline void connman_dbus_dict_append_array(DBusMessageIter *dict,
152 const char *key, int type, connman_dbus_append_cb_t function,
155 DBusMessageIter entry;
157 dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
159 connman_dbus_property_append_array(&entry, key,
160 type, function, user_data);
161 dbus_message_iter_close_container(dict, &entry);
164 static inline void connman_dbus_dict_append_fixed_array(DBusMessageIter *dict,
165 const char *key, int type, void *val, int len)
167 DBusMessageIter entry;
169 dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
171 connman_dbus_property_append_fixed_array(&entry, key, type, val, len);
172 dbus_message_iter_close_container(dict, &entry);
175 dbus_bool_t connman_dbus_validate_ident(const char *ident);
176 char *connman_dbus_encode_string(const char *value);
178 typedef void (* connman_dbus_get_connection_unix_user_cb_t) (unsigned int uid,
179 void *user_data, int err);
181 int connman_dbus_get_connection_unix_user(DBusConnection *connection,
182 const char *bus_name,
183 connman_dbus_get_connection_unix_user_cb_t func,
186 int connman_dbus_get_connection_unix_user_sync(DBusConnection *connection,
187 const char *bus_name,
188 unsigned int *user_id);
190 typedef void (* connman_dbus_get_context_cb_t) (const unsigned char *context,
191 void *user_data, int err);
193 int connman_dbus_get_selinux_context(DBusConnection *connection,
195 connman_dbus_get_context_cb_t func,
198 void connman_dbus_reply_pending(DBusMessage *pending,
199 int error, const char *path);
205 #endif /* __CONNMAN_DBUS_H */