9fc216484a96b48d3d5ba981cb20b632d1f6d83f
[platform/upstream/connman.git] / client / dbus_helpers.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2013  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  *
21  */
22
23 #ifndef __CONNMANCTL_DBUS_HELPERS_H
24 #define __CONNMANCTL_DBUS_HELPERS_H
25
26 #include <dbus/dbus.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define CONNMAN_SERVICE   "net.connman"
33 #define CONNMAN_PATH      "/"
34 #define VPN_SERVICE       CONNMAN_SERVICE ".vpn"
35 #define VPN_PATH          "/"
36
37 void __connmanctl_dbus_print(DBusMessageIter *iter, const char *pre,
38                 const char *dict, const char *sep);
39
40 typedef int (*connmanctl_dbus_method_return_func_t)(DBusMessageIter *iter,
41                 const char *error, void *user_data);
42 int __connmanctl_dbus_method_call(DBusConnection *connection,
43                 const char *service, const char *path, const char *interface,
44                 const char *method, connmanctl_dbus_method_return_func_t cb,
45                 void * user_data, int arg1, ...);
46
47 int __connmanctl_dbus_set_property(DBusConnection *connection,
48                 const char *path, const char *interface,
49                 connmanctl_dbus_method_return_func_t cb, void * user_data,
50                 const char *property, int type, void *value);
51
52 typedef void (*connmanctl_dbus_append_func_t)(DBusMessageIter *iter,
53                 void *user_data);
54
55 void __connmanctl_dbus_append_dict_entry(DBusMessageIter *iter,
56                 const char *property, int type, void *value);
57 int __connmanctl_dbus_set_property_dict(DBusConnection *connection,
58                 const char *path, const char *interface,
59                 connmanctl_dbus_method_return_func_t cb, void * user_data,
60                 const char *property, int type,
61                 connmanctl_dbus_append_func_t append_fn,
62                 void *append_user_data);
63
64 void __connmanctl_dbus_append_dict_string_array(DBusMessageIter *iter,
65                 const char *property, connmanctl_dbus_append_func_t append_fn,
66                 void *append_user_data);
67 int __connmanctl_dbus_set_property_array(DBusConnection *connection,
68                 const char *path, const char *interface,
69                 connmanctl_dbus_method_return_func_t cb, void *user_data,
70                 const char *property, int type,
71                 connmanctl_dbus_append_func_t append_fn,
72                 void *append_user_data);
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif