2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef __NET_CONFIG_GDBUS_H__
17 #define __NET_CONFIG_GDBUS_H__
24 #define GMAINTIMEOUT 10000
25 #define DBUS_REPLY_TIMEOUT (120 * 1000)
27 #define NETCONFIG_SERVICE "net.netconfig"
30 #define NETCONFIG_WIFI_PATH "/net/netconfig/wifi"
31 #define NETCONFIG_WIFI_INTERFACE "net.netconfig.wifi"
33 #define GET_WIFI_STATE "GetWifiState"
34 #define LOAD_DRIVER "LoadDriver"
35 #define REMOVE_DRIVER "RemoveDriver"
36 #define IS_IP_CONFLICT_DETECT_ENABLED "IsIpConflictDetectEnabled"
37 #define SET_BGSCAN "SetBgscan"
38 #define GET_AUTOSCAN "GetAutoscan"
39 #define GET_IP_CONFLICT_STATE "GetIpConflictState"
40 #define GET_IP_CONFLICT_PERIOD "GetIpConflictPeriod"
41 #define GET_AUTOSCANMODE "GetAutoscanmode"
42 #define REQUEST_WPS_CONNECT "RequestWpsConnect"
43 #define NETLINK_SCAN "NetlinkScan"
44 #define GET_PASSPOINT "GetPasspoint"
45 #define SET_PASSPOINT "SetPasspoint"
46 #define GET_CONFIGIDS "GetConfigIds"
47 #define SAVE_CONFIGURATION "SaveConfiguration"
48 #define SAVE_EAP_CONFIGURATION "SaveEapConfiguration"
49 #define SET_IP_CONFLICT_PERIOD "SetIpConflictPeriod"
50 #define REMOVE_CONFIGURATION "RemoveConfiguration"
51 #define LOAD_CONFIGURATION "LoadConfiguration"
52 #define LOAD_EAP_CONFIGURATION "LoadEapConfiguration"
53 #define SET_CONFIG_FIELD "SetConfigField"
54 #define GET_CONFIG_PASSPHRASE "GetConfigPassphrase"
55 #define CREATE_EAP_CONFIG "CreateEapConfig"
56 #define DELETE_EAP_CONFIG "DeleteEapConfig"
57 #define IP_CONFLICT_SET_ENABLE "IpConflictSetEnable"
58 #define GET_SIM_IMSI "GetSimImsi"
59 #define REQ_SIM_AUTH "ReqSimAuth"
60 #define REQ_AKA_AUTH "ReqAkaAuth"
61 #define GET_SIM_AUTH "GetSimAuth"
62 #define CHECK_BLACKLIST "CheckBlackList"
63 #define TDLS_DISCONNECT "TdlsDisconnect"
64 #define TDLS_CONNECTED_PEER "TdlsConnectedPeer"
65 #define TDLS_CONNECT "TdlsConnect"
66 #define TDLS_DISCOVER "TdlsDiscover"
67 #define TDLS_CHANNEL_SWITCH "TdlsChannelSwitch"
68 #define TDLS_CANCEL_CHANNEL_SWITCH "TdlsCancelChannelSwitch"
69 #define ADD_VSIE "AddVsie"
70 #define GET_VSIE "GetVsie"
71 #define REMOVE_VSIE "RemoveVsie"
72 #define ENCRYPT_PASSPHRASE "EncryptPassphrase"
73 #define DECRYPT_PASSPHRASE "DecryptPassphrase"
75 #define NETCONFIG_WIFI_FIRMWARE_INTERFACE "net.netconfig.wifi.Firmware"
77 #define WIFI_FIRMWARE_STOP "Stop"
78 #define WIFI_FIRMWARE_START "Start"
81 #define NETCONFIG_VPNSVC_PATH "/net/netconfig/vpnsvc"
82 #define NETCONFIG_VPNSVC_INTERFACE "net.netconfig.vpnsvc"
84 #define VPN_INIT "vpn_init"
85 #define VPN_DEINIT "vpn_deinit"
86 #define VPN_PROTECT "vpn_protect"
87 #define VPN_UP "vpn_up"
88 #define VPN_DOWN "vpn_down"
89 #define VPN_BLOCK_NETWORKS "vpn_block_networks"
90 #define VPN_UNBLOCK_NETWORKS "vpn_unblock_networks"
91 #define VPN_UPDATE_SETTINGS "vpn_update_settings"
92 #define VPN_ADD_ROUTE "vpn_add_route"
93 #define VPN_REMOVE_ROUTE "vpn_remove_route"
94 #define VPN_ADD_DNS_SERVER "vpn_add_dns_server"
95 #define VPN_REMOVE_DNS_SERVER "vpn_remove_dns_server"
98 #define NETCONFIG_NETWORK_PATH "/net/netconfig/network"
99 #define NETCONFIG_NETWORK_INTERFACE "net.netconfig.network"
100 #define NETCONFIG_TCPDUMP_INTERFACE "net.netconfig.tcpdump"
102 #define ADD_ROUTE "AddRoute"
103 #define REMOVE_ROUTE "RemoveRoute"
104 #define ETHERNET_CABLE_STATE "EthernetCableState"
105 #define CHECK_GET_PRIVILEGE "CheckGetPrivilege"
106 #define CHECK_PROFILE_PRIVILEGE "CheckProfilePrivilege"
107 #define CHECK_INTERNET_Privilege "CheckInternetPrivilege"
108 #define LAUNCH_MDNS "LaunchMdns"
109 #define DEVICE_POLICY_SET_WIFI "DevicePolicySetWifi"
110 #define DEVICE_POLICY_GET_WIFI "DevicePolicyGetWifi"
111 #define DEVICE_POLICY_SET_WIFI_PROFILE "DevicePolicySetWifiProfile"
112 #define DEVICE_POLICY_GET_WIFI_PROFILE "DevicePolicyGetWifiProfile"
113 #define GET_METERED_INFO "GetMeteredInfo"
114 #define PREFERRED_IPV6_ADDRESS "PreferredIpv6Address"
115 #define GET_TCP_DUMPSTATE "GetTCPDumpState"
116 #define START_TCP_DUMP "StartTCPDump"
117 #define STOP_TCP_DUMP "StopTCPDump"
120 #define NETCONFIG_MPTCP_PATH "/net/netconfig/mptcp"
121 #define NETCONFIG_MPTCP_INTERFACE "net.netconfig.mptcp"
123 #define MPTCP_SUPPORTED "IsSupported"
124 #define MPTCP_SET_ENABLE "SetEnabled"
125 #define MPTCP_GET_ENABLED "GetEnabled"
126 #define MPTCP_SET_PATH_MANAGER "SetPathManager"
127 #define MPTCP_GET_PATH_MANAGER "GetPathManager"
128 #define MPTCP_SET_SCHEDULER "SetScheduler"
129 #define MPTCP_GET_SCHEDULER "GetScheduler"
131 /* network statistics */
132 #define NETCONFIG_NETWORK_STATISTICS_PATH "/net/netconfig/network_statistics"
133 #define NETCONFIG_NETWORK_STATISTICS_INTERFACE "net.netconfig.network_statistics"
135 #define GET_WIFI_TOTAL_TX_BYTES "GetWifiTotalTxBytes"
136 #define GET_WIFI_TOTAL_RX_BYTES "GetWifiTotalRxBytes"
137 #define GET_WIFI_LAST_TX_BYTES "GetWifiLastTxBytes"
138 #define GET_WIFI_LAST_RX_BYTES "GetWifiLastRxBytes"
139 #define RESET_CELLULAR_TOTAL_TX_BYTES "ResetCellularTotalTxBytes"
140 #define RESET_CELLULAR_TOTAL_RX_BYTES "ResetCellularTotalRxBytes"
141 #define RESET_CELLULAR_LAST_TX_BYTES "ResetCellularLastTxBytes"
142 #define RESET_CELLULAR_LAST_RX_BYTES "ResetCellularLastRxBytes"
143 #define RESET_WIFI_TOTAL_TX_BYTES "ResetWifiTotalTxBytes"
144 #define RESET_WIFI_TOTAL_RX_BYTES "ResetWifiTotalRxBytes"
145 #define RESET_WIFI_LAST_TX_BYTES "ResetWifiLastTxBytes"
146 #define RESET_WIFI_LAST_RX_BYTES "ResetWifiLastRxBytes"
150 GDBusConnection *m_pConnection;
151 GCancellable *m_pCancellable;
155 error_e Create(void);
156 error_e Destroy(void);
157 GDBusConnection *GetConnection(void);
158 GCancellable *GetCancellable(void);
159 error_e ConvertErrorStringToEnum(const char *error);
160 GVariant *InvokeMethod(const char *dest, const char *path,
161 const char *iface_name, const char *method, GVariant *params, error_e *dbus_error);
162 error_e InvokeMethodNonblock(const char *dest, const char *path,
163 const char *iface_name, const char *method, GVariant *params, int timeout,
164 GAsyncReadyCallback notify_func, void *user_data);
165 GVariant *InvokeMethod_with_fd(GUnixFDList *fd_list, const char *dest, const char *path,
166 const char *iface_name, const char *method, GVariant *params, error_e *dbus_error);
169 #endif /* __NET_CONFIG_GDBUS_H__ */