Merge "Add dbus method for getting wifi passphrase" into tizen
[platform/core/connectivity/net-config.git] / include / netdbus.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __NETCONFIG_NETDBUS_H__
21 #define __NETCONFIG_NETDBUS_H__
22
23 #include <glib.h>
24 #include <gio/gio.h>
25 #include <glib-object.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #define DBUS_REPLY_TIMEOUT              (120 * 1000)
32 #define NETCONFIG_DBUS_REPLY_TIMEOUT    (15 * 1000)
33 #define DBUS_INTERFACE_PROPERTIES       "org.freedesktop.DBus.Properties"
34
35 #define NETCONFIG_SERVICE                               "net.netconfig"
36
37 #define CONNMAN_SERVICE                                 "net.connman"
38 #define CONNMAN_PATH                                    "/net/connman"
39
40 #define CONNMAN_CLOCK_INTERFACE                 CONNMAN_SERVICE ".Clock"
41 #define CONNMAN_ERROR_INTERFACE                 CONNMAN_SERVICE ".Error"
42 #define CONNMAN_MANAGER_INTERFACE               CONNMAN_SERVICE ".Manager"
43 #define CONNMAN_SERVICE_INTERFACE               CONNMAN_SERVICE ".Service"
44 #define CONNMAN_TECHNOLOGY_INTERFACE    CONNMAN_SERVICE ".Technology"
45 #define CONNMAN_MANAGER_PATH                    "/"
46
47 #define CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX CONNMAN_PATH "/service/cellular_"
48 #define CONNMAN_WIFI_SERVICE_PROFILE_PREFIX             CONNMAN_PATH "/service/wifi_"
49 #define CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX CONNMAN_PATH "/service/ethernet_"
50 #define CONNMAN_BLUETOOTH_SERVICE_PROFILE_PREFIX \
51                                                                                         CONNMAN_PATH "/service/bluetooth_"
52
53 #define CONNMAN_CELLULAR_TECHNOLOGY_PREFIX      CONNMAN_PATH "/technology/cellular"
54 #define CONNMAN_WIFI_TECHNOLOGY_PREFIX          CONNMAN_PATH "/technology/wifi"
55 #define CONNMAN_ETHERNET_TECHNOLOGY_PREFIX      CONNMAN_PATH "/technology/ethernet"
56 #define CONNMAN_BLUETOOTH_TECHNOLOGY_PREFIX     CONNMAN_PATH "/technology/bluetooth"
57
58 #define NETCONFIG_WIFI_INTERFACE                "net.netconfig.wifi"
59 #define NETCONFIG_WIFI_PATH                     "/net/netconfig/wifi"
60 #define NETCONFIG_NETWORK_STATE_PATH            "/net/netconfig/network"
61 #define NETCONFIG_NETWORK_STATISTICS_PATH       "/net/netconfig/network_statistics"
62 #define NETCONFIG_NETWORK_PATH                  "/net/netconfig/network"
63 #define NETCONFIG_NETWORK_INTERFACE             "net.netconfig.network"
64 #define NETCONFIG_BATTERY_INTERFACE             "net.netconfig.battery"
65 #define NETCONFIG_VPNSVC_PATH           "/net/netconfig/vpnsvc"
66 #define NETCONFIG_VPNSVC_INTERFACE      "net.netconfig.vpnsvc"
67 #define NETCONFIG_MPTCP_PATH            "/net/netconfig/mptcp"
68 #define NETCONFIG_MPTCP_INTERFACE       "net.netconfig.mptcp"
69 #define NETCONFIG_ETHERNET_PATH         "/net/netconfig/ethernet"
70 #define NETCONFIG_ETHERNET_INTERFACE    "net.netconfig.ethernet"
71 #define NETCONFIG_CLOCK_PATH            "/net/netconfig/clock"
72 #define NETCONFIG_CLOCK_INTERFACE       "net.netconfig.clock"
73
74 #define CONTAINER_FILE "/run/systemd/container"
75 #define DBUS_HOST_SYSTEM_BUS_ADDRESS "unix:path=/run/host/dbus/system_bus_socket"
76
77 #define DBUS_PATH_MAX_BUFLEN            512
78 #define DBUS_STATE_MAX_BUFLEN           64
79
80 typedef enum {
81         NETCONFIG_DBUS_RESULT_GET_BGSCAN_MODE,
82         NETCONFIG_DBUS_RESULT_DEFAULT_TECHNOLOGY,
83 } netconfig_dbus_result_type;
84
85 typedef void (*got_name_cb)(void);
86
87 GDBusObjectManagerServer        *netdbus_get_wifi_manager(void);
88 GDBusObjectManagerServer        *netdbus_get_state_manager(void);
89 GDBusObjectManagerServer        *netdbus_get_statistics_manager(void);
90 GDBusObjectManagerServer        *netdbus_get_vpn_manager(void);
91 GDBusObjectManagerServer        *netdbus_get_mptcp_manager(void);
92 GDBusObjectManagerServer        *netdbus_get_ethernet_manager(void);
93 GDBusObjectManagerServer        *netdbus_get_clock_manager(void);
94
95 GDBusConnection                         *netdbus_get_connection(void);
96 GCancellable                            *netdbus_get_cancellable(void);
97 void netconfig_gdbus_pending_call_ref(void);
98 void netconfig_gdbus_pending_call_unref(void);
99 int netconfig_create_gdbus_call(GDBusConnection *conn);
100
101 gboolean netconfig_is_cellular_internet_profile(const char *profile);
102 gboolean netconfig_is_cellular_profile(const char *profile);
103 gboolean netconfig_is_wifi_profile(const char *profile);
104 gboolean netconfig_is_ethernet_profile(const char *profile);
105 gboolean netconfig_is_bluetooth_profile(const char *profile);
106
107 gboolean netconfig_invoke_dbus_method_nonblock(const char *dest, const char *path,
108                 const char *interface_name, const char *method, GVariant *params,
109                 GAsyncReadyCallback notify_func, void *user_data);
110 GVariant *netconfig_invoke_dbus_method(const char *dest, const char *path,
111                 const char *interface_name, const char *method,
112                 GVariant *params);
113 gboolean netconfig_dbus_emit_signal(const gchar *destination_bus_name,
114                 const gchar *object_path,
115                 const gchar *interface_name,
116                 const gchar *signal_name,
117                 GVariant *params);
118
119 int             setup_gdbus(got_name_cb cb);
120 void    cleanup_gdbus(void);
121
122 #ifdef __cplusplus
123 }
124 #endif
125
126 #endif /* __NETCONFIG_NETDBUS_H__ */