From 99c25d2c0da58028573edc2cc983852daeacbd1c Mon Sep 17 00:00:00 2001 From: Cheoleun Moon Date: Tue, 16 Mar 2021 19:24:40 +0900 Subject: [PATCH] Remove codes to launch mdnsd Change-Id: I9848812f74a59b98647cc9354badae2402a81025 --- gtest/gdbus.h | 1 - gtest/network_state.cpp | 21 ----- gtest/network_state.h | 1 - gtest/unittest.cpp | 20 ---- include/util.h | 2 - interfaces/netconfig-iface-network-state.xml | 3 - packaging/net-config.spec | 2 +- resources/etc/dbus-1/system.d/net-config.conf | 2 - src/network-state.c | 2 - src/utils/util.c | 91 ------------------- 10 files changed, 1 insertion(+), 144 deletions(-) diff --git a/gtest/gdbus.h b/gtest/gdbus.h index 6008b70..39c61e7 100755 --- a/gtest/gdbus.h +++ b/gtest/gdbus.h @@ -105,7 +105,6 @@ #define CHECK_GET_PRIVILEGE "CheckGetPrivilege" #define CHECK_PROFILE_PRIVILEGE "CheckProfilePrivilege" #define CHECK_INTERNET_Privilege "CheckInternetPrivilege" -#define LAUNCH_MDNS "LaunchMdns" #define DEVICE_POLICY_SET_WIFI "DevicePolicySetWifi" #define DEVICE_POLICY_GET_WIFI "DevicePolicyGetWifi" #define DEVICE_POLICY_SET_WIFI_PROFILE "DevicePolicySetWifiProfile" diff --git a/gtest/network_state.cpp b/gtest/network_state.cpp index 4fad5c8..c31ece5 100755 --- a/gtest/network_state.cpp +++ b/gtest/network_state.cpp @@ -105,27 +105,6 @@ error_e NetworkState::EthernetCableState(int *state) return ERROR_NONE; } -error_e NetworkState::LaunchMdns(const char *name) -{ - GVariant *message = NULL; - error_e error = ERROR_NONE; - - message = InvokeMethod(NETCONFIG_SERVICE, - NETCONFIG_NETWORK_PATH, - NETCONFIG_NETWORK_INTERFACE, - LAUNCH_MDNS, - g_variant_new("(s)", name), - &error); - - if (message == NULL) { - GLOGD("Failed to invoke dbus method"); - return error; - } - - g_variant_unref(message); - - return ERROR_NONE; -} error_e NetworkState::DevicePolicySetWifi(int state) { GVariant *message = NULL; diff --git a/gtest/network_state.h b/gtest/network_state.h index 7e33fb2..887fb7f 100755 --- a/gtest/network_state.h +++ b/gtest/network_state.h @@ -28,7 +28,6 @@ public: error_e RemoveRoute(const char *ip, const char *mask, const char *interface, const char *gateway, int family, gboolean *result); error_e EthernetCableState(int *state); - error_e LaunchMdns(const char *name); error_e DevicePolicySetWifi(int state); error_e DevicePolicyGetWifi(int *state); error_e DevicePolicySetWifiProfile(int state); diff --git a/gtest/unittest.cpp b/gtest/unittest.cpp index 679b8a8..356c9da 100755 --- a/gtest/unittest.cpp +++ b/gtest/unittest.cpp @@ -191,26 +191,6 @@ TEST(NetworkState, RemoveRoute_n) EXPECT_NE(ERROR_NONE, ret); } -TEST(NetworkState, LaunchMdns_p) -{ - error_e ret = ERROR_NONE; - NetworkState mgr; - const char *name = "gtest"; - - ret = mgr.LaunchMdns(name); - EXPECT_EQ(ERROR_NONE, ret); -} - -TEST(NetworkState, LaunchMdns_n) -{ - error_e ret = ERROR_NONE; - NetworkState mgr; - const char *name = "gtest"; - - ret = mgr.LaunchMdns(name); - EXPECT_EQ(ERROR_NONE, ret); -} - TEST(NetworkState, DevicePolicySetWifi_p1) { error_e ret = ERROR_NONE; diff --git a/include/util.h b/include/util.h index 436f49c..73f41c5 100755 --- a/include/util.h +++ b/include/util.h @@ -86,8 +86,6 @@ int netconfig_add_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gi int netconfig_del_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family); gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context); -gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context, - gchar *name); gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * data); int netconfig_send_message_to_net_popup(const char *title, diff --git a/interfaces/netconfig-iface-network-state.xml b/interfaces/netconfig-iface-network-state.xml index 57f7938..5b8b46a 100755 --- a/interfaces/netconfig-iface-network-state.xml +++ b/interfaces/netconfig-iface-network-state.xml @@ -23,9 +23,6 @@ - - - diff --git a/packaging/net-config.spec b/packaging/net-config.spec index 4f8059e..a16ef7d 100755 --- a/packaging/net-config.spec +++ b/packaging/net-config.spec @@ -1,6 +1,6 @@ Name: net-config Summary: TIZEN Network Configuration service -Version: 1.2.8 +Version: 1.2.9 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/resources/etc/dbus-1/system.d/net-config.conf b/resources/etc/dbus-1/system.d/net-config.conf index 2c8fd42..c651886 100755 --- a/resources/etc/dbus-1/system.d/net-config.conf +++ b/resources/etc/dbus-1/system.d/net-config.conf @@ -18,8 +18,6 @@ - - diff --git a/src/network-state.c b/src/network-state.c index 75dea27..eed90e3 100755 --- a/src/network-state.c +++ b/src/network-state.c @@ -1433,8 +1433,6 @@ void state_object_create_and_init(void) G_CALLBACK(handle_preferred_ipv6_address), NULL); g_signal_connect(netconfigstate, "handle-remove-route", G_CALLBACK(handle_remove_route), NULL); - g_signal_connect(netconfigstate, "handle-launch-mdns", - G_CALLBACK(handle_launch_mdns), NULL); g_signal_connect(netconfigstate, "handle-device-policy-set-wifi", G_CALLBACK(handle_device_policy_set_wifi), NULL); g_signal_connect(netconfigstate, "handle-device-policy-get-wifi", diff --git a/src/utils/util.c b/src/utils/util.c index bf7c4bc..a6d44a5 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -58,7 +58,6 @@ #define CONNMAN_WIFI_DEF_IFNAME "DefaultWifiInterface" static gboolean netconfig_device_picker_test = FALSE; -static int mdnsd_ref_count = 0; typedef struct { char *conn_name; int conn_id; @@ -955,96 +954,6 @@ gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context) return TRUE; } -int execute_mdnsd_script(char* op) -{ - const char *path = "/usr/bin/mdnsresponder-server.sh"; - char *const args[] = { "mdnsresponder-server.sh", op, NULL }; - char *const envs[] = { NULL }; - - return netconfig_execute_file(path, args, envs); -} - -static void __dnssd_conn_destroyed_cb(GDBusConnection *conn, - const gchar *Name, const gchar *path, const gchar *interface, - const gchar *sig, GVariant *param, gpointer user_data) -{ - gchar *name = NULL; - gchar *old = NULL; - gchar *new = NULL; - dnssd_conn_destroy_data *data = user_data; - GDBusConnection *connection = NULL; - connection = netdbus_get_connection(); - - if (param == NULL) - return; - - g_variant_get(param, "(sss)", &name, &old, &new); - - if (g_strcmp0(name, data->conn_name) == 0 && *new == '\0') { - DBG("Connection %s Destroyed: name %s id %d", data->conn_name, name, - data->conn_id); - mdnsd_ref_count--; - g_dbus_connection_signal_unsubscribe(connection, data->conn_id); - if (mdnsd_ref_count == 0) { - if (execute_mdnsd_script("stop") < 0) - ERR("Failed to stop mdnsresponder daemon"); - } - } - g_free(name); - g_free(old); - g_free(new); - g_free(data->conn_name); - g_free(data); - return; -} - -static void register_dnssd_conn_destroy_signal(gchar *name) -{ - dnssd_conn_destroy_data *data; - GDBusConnection *connection = NULL; - connection = netdbus_get_connection(); - - if (connection == NULL) { - ERR("Failed to get GDbus Connection"); - return; - } - - data = g_try_malloc0(sizeof(dnssd_conn_destroy_data)); - - if (data == NULL) { - ERR("Out of Memory!"); - return; - } - - data->conn_name = g_strdup(name); - - data->conn_id = g_dbus_connection_signal_subscribe(connection, - DBUS_SERVICE_DBUS, DBUS_INTERFACE_DBUS, - "NameOwnerChanged", NULL, name, - G_DBUS_SIGNAL_FLAGS_NONE, __dnssd_conn_destroyed_cb, - data, NULL); - return; -} - -gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context, - gchar *name) -{ - DBG("Launch mdnsresponder daemon"); - - if (execute_mdnsd_script("start") < 0) { - ERR("Failed to launch mdnsresponder daemon"); - netconfig_error_invalid_parameter(context); - return TRUE; - } - - mdnsd_ref_count++; - register_dnssd_conn_destroy_signal(name); - DBG("Ref mdnsresponder daemon. ref count: %d", mdnsd_ref_count); - - network_complete_launch_mdns(object, context); - return TRUE; -} - gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * ssid) { if (!netconfig_plugin_headed_enabled) -- 2.34.1