gboolean net_get_tcpdump_state(void *handle, gboolean *is_tcpdump_running);
/**
+ * \brief Get vconf value via dbus.
+ *
+ * \param[in] handle libnet-client handle.
+ * \param[in] key Vconf key.
+ * \param[in] type Vconf data type(string, int, bool).
+ * \param[out] ret Return value.
+ * \param[out] int_value Vconf value for int or bool type.
+ * \param[out] str_value Vconf value for string type.
+ *
+ ******************************************************************************************/
+int net_get_vconf_value(void *handle, const char *key, const char *type,
+ int *ret, int *int_value, char **str_value);
+
+/**
* \}
*/
return Error;
}
+EXPORT_API int net_get_vconf_value(void *handle, const char *key, const char *type,
+ int *ret, int *int_value, char **str_value)
+{
+ __NETWORK_FUNC_ENTER__;
+ net_err_t ret_error = NET_ERR_NONE;
+ network_info_t *network_info = (network_info_t *)handle;
+
+ ret_error = _net_dbus_get_vconf_value(network_info, key, type, ret, int_value, str_value);
+
+ if (ret_error != NET_ERR_NONE)
+ NETWORK_LOG(NETWORK_ERROR, "net_get_vconf_value failed");
+
+ __NETWORK_FUNC_EXIT__;
+ return ret_error;
+}
+
/**
* @fn EXPORT_API int net_close_mesh_connection(const char *profile_name)
*
GDBusConnection *connection = NULL;
gboolean created = FALSE;
- if (network_info == NULL || network_info->connection == NULL) {
+ if ((network_info == NULL || network_info->connection == NULL) &&
+ access(CONTAINER_FILE, F_OK) == 0) {
+
+ connection = g_dbus_connection_new_for_address_sync(
+ DBUS_HOST_SYSTEM_BUS_ADDRESS,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+ NULL, NULL, &error);
+ created = TRUE;
+ } else if (network_info == NULL || network_info->connection == NULL) {
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (connection == NULL) {
- /* LCOV_EXCL_START */
- if (error != NULL) {
- NETWORK_LOG(NETWORK_ERROR,
- "Failed to connect to the D-BUS daemon [%s]", error->message);
- g_error_free(error);
- }
- /* LCOV_EXCL_STOP */
- return NULL;
- }
created = TRUE;
} else {
connection = network_info->connection;
created = FALSE;
}
+ if (connection == NULL) {
+ /* LCOV_EXCL_START */
+ if (error != NULL) {
+ NETWORK_LOG(NETWORK_ERROR,
+ "Failed to connect to the D-BUS daemon [%s]", error->message);
+ g_error_free(error);
+ }
+ /* LCOV_EXCL_STOP */
+ return NULL;
+ }
+
reply = g_dbus_connection_call_sync(connection,
dest,
path,
__NETWORK_FUNC_EXIT__;
return Error;
}
+
+int _net_dbus_get_vconf_value(network_info_t *network_info,
+ const char *key, const char *type, int *ret, int *int_value, char **str_value)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t ret_error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *params = NULL;
+
+ params = g_variant_new("(ss)", key, type);
+ message = _net_invoke_dbus_method(network_info,
+ NETCONFIG_SERVICE, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "RequestVconfValue", params, &ret_error);
+
+ if (message == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Failed to get vconf value, key: %s", key);
+ __NETWORK_FUNC_EXIT__;
+ return ret_error;
+ }
+
+ g_variant_get(message, "(iis)", ret, int_value, str_value);
+
+ NETWORK_LOG(NETWORK_HIGH, "Vconf key: %s, type: %s, ret: %d, int_value: %d, str_value: %s",
+ key, type, *ret, *int_value, *str_value);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return ret_error;
+}