*
* Connection Manager
*
- * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
+ * Copyright (C) 2007-2012 Intel Corporation. All rights reserved.
*
* 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
#ifndef __CONNMAN_DBUS_H
#define __CONNMAN_DBUS_H
+#include <dbus/dbus.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <dbus/dbus.h>
+#define CONNMAN_SERVICE "net.connman"
+#define CONNMAN_PATH "/net/connman"
+
+#define CONNMAN_DEBUG_INTERFACE CONNMAN_SERVICE ".Debug"
+#define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error"
+#define CONNMAN_AGENT_INTERFACE CONNMAN_SERVICE ".Agent"
+#define CONNMAN_COUNTER_INTERFACE CONNMAN_SERVICE ".Counter"
-#define CONNMAN_SERVICE "org.moblin.connman"
+#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
+#define CONNMAN_MANAGER_PATH "/"
-#define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error"
+#define CONNMAN_CLOCK_INTERFACE CONNMAN_SERVICE ".Clock"
+#define CONNMAN_TASK_INTERFACE CONNMAN_SERVICE ".Task"
+#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
+#define CONNMAN_PROVIDER_INTERFACE CONNMAN_SERVICE ".Provider"
+#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
+#define CONNMAN_SESSION_INTERFACE CONNMAN_SERVICE ".Session"
+#define CONNMAN_NOTIFICATION_INTERFACE CONNMAN_SERVICE ".Notification"
+#define CONNMAN_PEER_INTERFACE CONNMAN_SERVICE ".Peer"
-#define CONNMAN_AGENT_INTERFACE CONNMAN_SERVICE ".Agent"
+#define CONNMAN_PRIVILEGE_MODIFY 1
+#define CONNMAN_PRIVILEGE_SECRET 2
-#define CONNMAN_ELEMENT_INTERFACE CONNMAN_SERVICE ".Element"
+typedef void (* connman_dbus_append_cb_t) (DBusMessageIter *iter,
+ void *user_data);
-#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile"
+DBusConnection *connman_dbus_get_connection(void);
-#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
-#define CONNMAN_MANAGER_PATH "/"
+void connman_dbus_property_append_basic(DBusMessageIter *iter,
+ const char *key, int type, void *val);
+void connman_dbus_property_append_dict(DBusMessageIter *iter, const char *key,
+ connman_dbus_append_cb_t function, void *user_data);
+void connman_dbus_property_append_array(DBusMessageIter *iter,
+ const char *key, int type,
+ connman_dbus_append_cb_t function, void *user_data);
+void connman_dbus_property_append_fixed_array(DBusMessageIter *iter,
+ const char *key, int type, void *val, int len);
-#define CONNMAN_IFACE_INTERFACE CONNMAN_SERVICE ".Interface"
-#define CONNMAN_IFACE_BASEPATH "/interface"
+dbus_bool_t connman_dbus_property_changed_basic(const char *path,
+ const char *interface, const char *key,
+ int type, void *val);
+dbus_bool_t connman_dbus_property_changed_dict(const char *path,
+ const char *interface, const char *key,
+ connman_dbus_append_cb_t function, void *user_data);
+dbus_bool_t connman_dbus_property_changed_array(const char *path,
+ const char *interface, const char *key, int type,
+ connman_dbus_append_cb_t function, void *user_data);
-#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network"
+dbus_bool_t connman_dbus_setting_changed_basic(const char *owner,
+ const char *path, const char *key,
+ int type, void *val);
+dbus_bool_t connman_dbus_setting_changed_dict(const char *owner,
+ const char *path, const char *key,
+ connman_dbus_append_cb_t function,
+ void *user_data);
+dbus_bool_t connman_dbus_setting_changed_array(const char *owner,
+ const char *path, const char *key, int type,
+ connman_dbus_append_cb_t function,
+ void *user_data);
-extern void connman_dbus_dict_append_array(DBusMessageIter *dict,
- const char *key, int type, void *val, int len);
-extern void connman_dbus_dict_append_variant(DBusMessageIter *dict,
- const char *key, int type, void *val);
+static inline void connman_dbus_dict_open(DBusMessageIter *iter,
+ DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
+}
+
+static inline void connman_dbus_dict_open_variant(DBusMessageIter *iter,
+ DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
+}
+
+static inline void connman_dbus_array_open(DBusMessageIter *iter,
+ DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING,
+ dict);
+}
+
+static inline void connman_dbus_dict_close(DBusMessageIter *iter,
+ DBusMessageIter *dict)
+{
+ dbus_message_iter_close_container(iter, dict);
+}
+
+static inline void connman_dbus_dict_append_basic(DBusMessageIter *dict,
+ const char *key, int type, void *val)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+ connman_dbus_property_append_basic(&entry, key, type, val);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
+static inline void connman_dbus_dict_append_dict(DBusMessageIter *dict,
+ const char *key, connman_dbus_append_cb_t function,
+ void *user_data)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+ connman_dbus_property_append_dict(&entry, key, function, user_data);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
+static inline void connman_dbus_dict_append_array(DBusMessageIter *dict,
+ const char *key, int type, connman_dbus_append_cb_t function,
+ void *user_data)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+ connman_dbus_property_append_array(&entry, key,
+ type, function, user_data);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
+static inline void connman_dbus_dict_append_fixed_array(DBusMessageIter *dict,
+ const char *key, int type, void *val, int len)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+ connman_dbus_property_append_fixed_array(&entry, key, type, val, len);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
+dbus_bool_t connman_dbus_validate_ident(const char *ident);
+char *connman_dbus_encode_string(const char *value);
+
+typedef void (* connman_dbus_get_connection_unix_user_cb_t) (unsigned int uid,
+ void *user_data, int err);
+
+int connman_dbus_get_connection_unix_user(DBusConnection *connection,
+ const char *bus_name,
+ connman_dbus_get_connection_unix_user_cb_t func,
+ void *user_data);
+
+typedef void (* connman_dbus_get_context_cb_t) (const unsigned char *context,
+ void *user_data, int err);
+
+int connman_dbus_get_selinux_context(DBusConnection *connection,
+ const char *service,
+ connman_dbus_get_context_cb_t func,
+ void *user_data);
#ifdef __cplusplus
}