+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)
+ return FALSE;
+
+ if (!headed_plugin)
+ return FALSE;
+
+ return headed_plugin->send_notification_to_net_popup(noti, ssid);
+}
+
+int netconfig_send_message_to_net_popup(const char *title,
+ const char *content, const char *type, const char *ssid)
+{
+ if (!netconfig_plugin_headed_enabled)
+ return 0;
+
+ if (!headed_plugin)
+ return 0;
+
+ return headed_plugin->send_message_to_net_popup(title, content, type, ssid);
+}
+
+int netconfig_send_restriction_to_net_popup(const char *title,
+ const char *type, const char *restriction)
+{
+ if (!netconfig_plugin_headed_enabled)
+ return 0;
+
+ if (!headed_plugin)
+ return 0;
+
+ return headed_plugin->send_restriction_to_net_popup(title, type, restriction);
+}
+
+void netconfig_set_system_event(int sys_evt, int evt_key, int evt_val)
+{
+ if (!netconfig_plugin_headed_enabled)
+ return;
+
+ if (!headed_plugin)
+ return;
+
+ headed_plugin->set_system_event(sys_evt, evt_key, evt_val);
+}
+
+void __netconfig_pop_wifi_connected_poppup(const char *ssid)
+{
+ if (!netconfig_plugin_headed_enabled)
+ return;
+
+ if (!headed_plugin)
+ return;
+
+ headed_plugin->pop_wifi_connected_poppup(ssid);
+}
+
+void netconfig_get_telephony_network_type(int *svctype, int *pstype)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return;
+
+ if (!telephony_plugin)
+ return;
+
+ telephony_plugin->get_telephony_network_type(svctype, pstype);
+}
+
+gboolean __netconfig_wifi_get_sim_imsi(Wifi *wifi, GDBusMethodInvocation *context)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return FALSE;
+
+ if (!telephony_plugin)
+ return FALSE;
+
+ return telephony_plugin->wifi_get_sim_imsi(wifi, context);
+}
+
+netconfig_error_e __netconfig_wifi_req_aka_auth(GArray *rand_data, GArray *autn_data,
+ GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return NETCONFIG_ERROR_INTERNAL;
+
+ if (!telephony_plugin)
+ return NETCONFIG_ERROR_INTERNAL;
+
+ return telephony_plugin->wifi_req_aka_auth(rand_data, autn_data, context, data);
+}
+
+gboolean __netconfig_wifi_req_sim_auth(GArray *rand_data,
+ GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return FALSE;
+
+ if (!telephony_plugin)
+ return FALSE;
+
+ return telephony_plugin->wifi_req_sim_auth(rand_data, context, data);
+}
+
+gboolean netconfig_tapi_check_sim_state(void)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return FALSE;
+
+ if (!telephony_plugin)
+ return FALSE;
+
+ return telephony_plugin->tapi_check_sim_state();
+}
+
+gboolean __netconfig_wifi_get_aka_authdata(Wifi *wifi,
+ GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return FALSE;
+
+ if (!telephony_plugin)
+ return FALSE;
+
+ return telephony_plugin->wifi_get_aka_authdata(wifi, context, data);
+}
+
+gboolean __netconfig_wifi_get_sim_authdata(Wifi *wifi,
+ GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+ if (!netconfig_plugin_telephony_enabled)
+ return FALSE;
+
+ if (!telephony_plugin)
+ return FALSE;
+
+ return telephony_plugin->wifi_get_sim_authdata(wifi, context, data);
+}
+
+void netconfig_set_vconf_int(const char * key, int value)
+{
+ int ret = 0;
+
+ DBG("[%s: %d]", key, value);
+
+ ret = vconf_set_int(key, value);
+ if (ret != VCONF_OK)
+ ERR("Failed to set");
+}
+
+void netconfig_set_vconf_str(const char * key, const char * value)
+{
+ int ret = 0;
+
+ DBG("[%s: %s]", key, value);
+
+ ret = vconf_set_str(key, value);
+ if (ret != VCONF_OK)
+ ERR("Failed to set");
+}
+
+int netconfig_vconf_get_int(const char * key, int *value)
+{
+ int ret = 0;
+
+ ret = vconf_get_int(key, value);
+ if (ret != VCONF_OK) {
+ ERR("Failed to get vconfkey [%s] value", key);
+ return -1;
+ }
+
+ return 0;
+}
+
+int netconfig_vconf_get_bool(const char * key, int *value)
+{
+ int ret = 0;
+
+ ret = vconf_get_bool(key, value);
+ if (ret != VCONF_OK) {
+ ERR("Failed to get vconfkey [%s] value", key);
+ return -1;
+ }
+
+ return 0;
+}
+
+char* netconfig_get_env(const char *key)
+{
+ FILE *fp;
+ char buf[256], *entry = NULL, *value = NULL, *last;
+ int len = 0;
+
+ if (!key)
+ return NULL;
+
+ fp = fopen(NETCONFIG_TIZEN_SYSTEM_ENV, "r");
+ if (!fp)
+ return NULL;
+
+ while (fgets(buf, sizeof(buf), fp)) {
+ entry = buf;
+ entry = strtok_r(entry, "=", &last);
+ if (entry) {
+ if (strstr(entry, key)) {
+ entry = strtok_r(NULL, "\n", &last);
+ if (entry) {
+ len = strlen(entry);
+ value = (char*)malloc(len+1);
+ g_strlcpy(value, entry, len+1);
+ } else {
+ value = (char*)malloc(sizeof(char));
+ g_strlcpy(value, "\n", sizeof(char));
+ }
+ break;
+ }