2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <vconf-keys.h>
32 #include "wifi-agent.h"
33 #include "wifi-power.h"
34 #include "wifi-state.h"
35 #include "wifi-indicator.h"
36 #include "wifi-scan.h"
37 #include "wifi-bssid-scan.h"
38 #include "wifi-background-scan.h"
39 #include "netsupplicant.h"
40 #include "network-state.h"
41 #include "cellular-state.h"
42 #include "signal-handler.h"
43 #include "wifi-tdls.h"
45 #include "ip-conflict-detect.h"
46 #include "wifi-key-encryption.h"
47 #include "clatd-handler.h"
48 #if defined TIZEN_DEBUG_ENABLE
49 #include "network-dump.h"
50 #define NETWORK_LOG_DUMP_SCRIPT "/opt/var/lib/net-config/network_log_dump.sh"
51 #define MAX_SIZE_ERROR_BUFFER 256
54 #define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
55 #define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
56 #define SIGNAL_INTERFACE_REMOVED "InterfaceRemoved"
57 #define SIGNAL_SCAN_DONE "ScanDone"
58 #define SIGNAL_SCAN_CHANGED "ScanChanged"
59 #define SIGNAL_BSS_ADDED "BSSAdded"
60 #define SIGNAL_PROPERTIES_CHANGED "PropertiesChanged"
61 #define SIGNAL_PROPERTIES_DRIVER_HANGED "DriverHanged"
62 #define SIGNAL_PROPERTIES_SESSION_OVERLAPPED "SessionOverlapped"
63 #define SIGNAL_TDLS_CONNECTED "TDLSConnected"
64 #define SIGNAL_TDLS_DISCONNECTED "TDLSDisconnected"
65 #define SIGNAL_TDLS_PEER_FOUND "TDLSPeerFound"
67 #define SIGNAL_DPP_AUTH_SUCCESS "DPPAuthSuccess"
68 #define SIGNAL_DPP_AUTH_FAILED "DPPAuthFailed"
69 #define SIGNAL_DPP_NOT_COMPATIBLE "DPPNotCompatible"
70 #define SIGNAL_DPP_CONF_FAILED "DPPConfFailed"
71 #define SIGNAL_DPP_SCAN_PEER_QR "DPPScanPeerQrCode"
72 #define SIGNAL_DPP_NETWORK_ID "DPPNetworkID"
73 #define SIGNAL_DPP_CONF_SENT "DPPConfSent"
74 #define SIGNAL_DPP_CONF_RECEIVED "DPPConfReceived"
75 #define SIGNAL_DPP_CONF_OBJ "DPPConfObj"
77 #define SIGNAL_WPS_CONNECTED "WPSConnected"
78 #define SIGNAL_WPS_EVENT "Event"
79 #define SIGNAL_WPS_CREDENTIALS "Credentials"
81 #define CONNMAN_SIGNAL_SERVICES_CHANGED "ServicesChanged"
82 #define CONNMAN_SIGNAL_PROPERTY_CHANGED "PropertyChanged"
83 #define CONNMAN_SIGNAL_DEVICE_CHANGED "DeviceChanged"
84 #define CONNMAN_SIGNAL_DEVICE_DETECTED "DeviceDetected"
85 #define SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
86 #define NETCONFIG_SIGNAL_VCONF_CHANGED "VconfChanged"
89 #define MAX_SIG_LEN 64
90 #define TOTAL_CONN_SIGNALS 7
91 #define MAX_SOCKET_OPEN_RETRY 5
94 SIG_INTERFACE_REMOVED = 0,
95 SIG_PROPERTIES_CHANGED,
99 SIG_SESSION_OVERLAPPED,
101 SIG_TDLS_DISCONNECTED,
103 SIG_DPP_AUTH_SUCCESS,
105 SIG_DPP_NOT_COMPATIBLE,
107 SIG_DPP_SCAN_PEER_QR,
110 SIG_DPP_CONF_RECEIVED,
115 static int conn_subscription_ids[TOTAL_CONN_SIGNALS] = {0};
116 static const char supplicant_signals[SIG_MAX][MAX_SIG_LEN] = {
117 SIGNAL_INTERFACE_REMOVED,
118 SIGNAL_PROPERTIES_CHANGED,
121 SIGNAL_PROPERTIES_DRIVER_HANGED,
122 SIGNAL_PROPERTIES_SESSION_OVERLAPPED,
123 SIGNAL_TDLS_CONNECTED,
124 SIGNAL_TDLS_DISCONNECTED,
125 SIGNAL_TDLS_PEER_FOUND,
126 SIGNAL_DPP_AUTH_SUCCESS,
127 SIGNAL_DPP_AUTH_FAILED,
128 SIGNAL_DPP_NOT_COMPATIBLE,
129 SIGNAL_DPP_CONF_FAILED,
130 SIGNAL_DPP_SCAN_PEER_QR,
131 SIGNAL_DPP_NETWORK_ID,
132 SIGNAL_DPP_CONF_SENT,
133 SIGNAL_DPP_CONF_RECEIVED,
136 static const char *supplicant_iface_for_sig[SIG_MAX] = {
137 SUPPLICANT_INTERFACE,
138 SUPPLICANT_IFACE_INTERFACE,
139 SUPPLICANT_IFACE_INTERFACE,
140 SUPPLICANT_IFACE_INTERFACE,
141 SUPPLICANT_IFACE_INTERFACE,
142 SUPPLICANT_IFACE_INTERFACE,
143 SUPPLICANT_IFACE_INTERFACE,
144 SUPPLICANT_IFACE_INTERFACE,
145 SUPPLICANT_IFACE_INTERFACE,
146 SUPPLICANT_IFACE_DPP,
147 SUPPLICANT_IFACE_DPP,
148 SUPPLICANT_IFACE_DPP,
149 SUPPLICANT_IFACE_DPP,
150 SUPPLICANT_IFACE_DPP,
151 SUPPLICANT_IFACE_DPP,
152 SUPPLICANT_IFACE_DPP,
153 SUPPLICANT_IFACE_DPP,
154 SUPPLICANT_IFACE_DPP,
157 static int supp_subscription_ids[SIG_MAX] = {0};
158 #if defined TIZEN_DEBUG_ENABLE
159 static int dumpservice_subscription_id = 0;
161 static int netconfig_subscription_id = 0;
163 typedef void (*supplicant_signal_cb)(GDBusConnection *conn,
164 const gchar *name, const gchar *path, const gchar *interface,
165 const gchar *sig, GVariant *param, gpointer user_data);
166 typedef void (*connman_signal_cb)(GDBusConnection *conn,
167 const gchar *name, const gchar *path, const gchar *interface,
168 const gchar *sig, GVariant *param, gpointer user_data);
170 static void __netconfig_extract_ipv4_signal_data(GVariant *dictionary,
171 const gchar *profile)
174 const gchar *value = NULL;
175 GVariant *var = NULL;
177 GVariantBuilder *builder;
180 g_variant_iter_init(&iter, dictionary);
181 while (g_variant_iter_loop(&iter, "{sv}", &key, &var)) {
182 if (g_strcmp0(key, "Address") == 0) {
183 g_variant_get(var, "&s", &value);
184 char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP);
186 DBG("Old IPv4.Address [%s] Received new IPv4.Address [%s]", old_ip,
188 if (g_strcmp0(old_ip, value) != 0) {
189 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
192 netconfig_set_default_ipaddress(value);
193 netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, value, TRUE);
194 g_variant_builder_add(builder, "{sv}", "IPv4Address",
195 g_variant_new_string(value));
196 } else if (old_ip != NULL && strlen(old_ip) > 0) {
197 netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, "",TRUE);
198 g_variant_builder_add(builder, "{sv}", "IPv4Address",
199 g_variant_new_string(""));
202 params = g_variant_new("(@a{sv})",
203 g_variant_builder_end(builder));
205 g_variant_builder_unref(builder);
207 netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
208 NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
216 static void __netconfig_extract_ipv6_signal_data(GVariant *dictionary,
217 const gchar *profile)
220 const gchar *value = NULL;
221 GVariant *var = NULL;
223 GVariantBuilder *builder;
226 g_variant_iter_init(&iter, dictionary);
227 while (g_variant_iter_loop(&iter, "{sv}", &key, &var)) {
228 if (g_strcmp0(key, "Address") == 0) {
229 g_variant_get(var, "&s", &value);
230 char *old_ip6 = vconf_get_str(VCONFKEY_NETWORK_IP6);
232 DBG("Old IPv6.Address [%s] Received new IPv6.Address [%s]", old_ip6,
234 if (g_strcmp0(old_ip6, value) != 0) {
235 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
238 netconfig_set_default_ipaddress6(value);
239 netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, value, TRUE);
240 g_variant_builder_add(builder, "{sv}", "IPv6Address",
241 g_variant_new_string(value));
242 } else if (old_ip6 != NULL && strlen(old_ip6) > 0) {
243 netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, "", TRUE);
244 g_variant_builder_add(builder, "{sv}", "IPv6Address",
245 g_variant_new_string(""));
248 params = g_variant_new("(@a{sv})",
249 g_variant_builder_end(builder));
250 g_variant_builder_unref(builder);
252 netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
253 NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
261 #if defined TIZEN_DEBUG_ENABLE
262 static int __netconfig_handle_execute_file(const char *file_path,
263 char *const args[], char *const envs[])
269 register unsigned int index = 0;
270 char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
272 while (args[index] != NULL) {
273 DBG("%s", args[index]);
277 if (!(pid = fork())) {
278 DBG("pid(%d), ppid (%d)", getpid(), getppid());
279 DBG("Inside child, exec (%s) command", file_path);
282 if (execve(file_path, args, envs) == -1) {
283 DBG("Fail to execute command (%s)",
284 strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
287 } else if (pid > 0) {
288 if (waitpid(pid, &status, 0) == -1)
289 DBG("wait pid (%u) status (%d)", pid, status);
291 if (WIFEXITED(status)) {
292 rv = WEXITSTATUS(status);
293 DBG("exited, status=%d", rv);
294 } else if (WIFSIGNALED(status)) {
295 DBG("killed by signal %d", WTERMSIG(status));
296 } else if (WIFSTOPPED(status)) {
297 DBG("stopped by signal %d", WSTOPSIG(status));
298 } else if (WIFCONTINUED(status)) {
305 DBG("failed to fork(%s)",
306 strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
310 static int _start_dump()
313 gchar *path = NETWORK_LOG_DUMP_SCRIPT;
314 char *const args[] = { NETWORK_LOG_DUMP_SCRIPT, NULL };
315 char *const envs[] = { NULL };
317 rv = __netconfig_handle_execute_file(path, args, envs);
319 ERR("Fail to execute network log dump shell");
326 static char *__supplicant_get_interface_name(const gchar *path, const gchar *interface)
328 GVariant *params = NULL;
329 GVariant *reply = NULL, *var = NULL;;
330 char *interface_name = NULL;
332 params = g_variant_new("(ss)", interface, "Ifname");
334 reply = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
335 path, DBUS_INTERFACE_PROPERTIES, "Get", params);
337 ERR("Failed to get interface name");
341 g_variant_get(reply, "(v)", &var);
343 if (g_variant_is_of_type(var, G_VARIANT_TYPE_STRING)) {
344 interface_name = g_variant_dup_string(var, NULL);
345 DBG("%s [%s]", path, interface_name);
348 g_variant_unref(var);
349 g_variant_unref(reply);
351 return interface_name;
354 static void _technology_signal_cb(GDBusConnection *conn,
355 const gchar *name, const gchar *path, const gchar *interface,
356 const gchar *sig, GVariant *param, gpointer user_data)
359 GVariant *var = NULL;
360 GVariantIter *iter = NULL;
361 const gchar *svalue = NULL;
362 gboolean bvalue = FALSE;
364 DBG("%s %s", path, sig);
369 if (g_str_has_prefix(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) != TRUE)
372 if (g_strcmp0(sig, CONNMAN_SIGNAL_DEVICE_CHANGED) == 0) {
373 g_variant_get(param, "(a{sv})", &iter);
374 while (g_variant_iter_loop(iter, "{sv}", &key, &var)) {
375 if (g_strcmp0(key, "Ifname") == 0) {
376 svalue = g_variant_get_string(var, NULL);
377 DBG("Ifname [%s]", svalue);
378 } else if (g_strcmp0(key, "Powered") == 0) {
379 bvalue = g_variant_get_boolean(var);
380 DBG("Powered [%d]", bvalue);
382 wifi_state_update_power_state(svalue, bvalue);
383 } else if (g_strcmp0(key, "Connected") == 0) {
384 bvalue = g_variant_get_boolean(var);
385 DBG("Connected [%d]", bvalue);
387 wifi_state_set_connected(svalue, bvalue);
389 wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_CONNECTED);
391 wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_POWERED);
395 g_variant_iter_free(iter);
396 } else if (g_strcmp0(sig, CONNMAN_SIGNAL_DEVICE_DETECTED) == 0) {
397 wifi_state_update_device_list();
401 static void _service_signal_cb(GDBusConnection *conn,
402 const gchar *name, const gchar *path,
403 const gchar *interface, const gchar *sig,
404 GVariant *param, gpointer user_data)
406 gchar *sigvalue = NULL;
408 GVariant *variant = NULL, *var;
410 const gchar *value = NULL;
411 struct sock_data *sd = NULL;
414 unsigned char strength = 0;
415 const char *interface_name = NULL;
417 if (path == NULL || param == NULL)
420 g_variant_get(param, "(sv)", &sigvalue, &variant);
421 if (sigvalue == NULL)
424 if (g_strcmp0(sig, CONNMAN_SIGNAL_PROPERTY_CHANGED) != 0)
427 interface_name = netconfig_get_ifname(path);
429 if (g_strcmp0(sigvalue, "State") == 0) {
430 g_variant_get(variant, "s", &property);
432 DBG("[%s] %s", property, path);
434 if (netconfig_is_wifi_profile(path) == TRUE) {
437 netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
438 if (wifi_state == VCONFKEY_WIFI_OFF) {
443 if (g_strcmp0(property, "ready") == 0 || g_strcmp0(property, "online") == 0) {
444 netconfig_update_default_profile();
446 wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_CONNECTED);
448 } else if (g_strcmp0(property, "failure") == 0 ||
449 g_strcmp0(property, "disconnect") == 0 || g_strcmp0(property, "idle") == 0) {
450 if (g_strcmp0(property, "failure") == 0)
451 wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_FAILURE);
453 wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_IDLE);
455 if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
460 netconfig_update_default_profile();
462 } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) {
463 if (g_strcmp0(property, "association") == 0)
464 wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_ASSOCIATION);
466 wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_CONFIGURATION);
468 if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
473 netconfig_update_default_profile();
477 if (g_strcmp0(property, "ready") == 0 || g_strcmp0(property, "online") == 0) {
478 netconfig_update_default_profile();
480 if (netconfig_is_cellular_profile(netconfig_get_default_profile())) {
481 pf = netconfig_get_connected_cellular_internet_ipv6only_profile(NULL);
485 /* Enable clatd if it is not in running state */
486 DBG("Connected to ipv6 only cellular, enable clatd");
487 netconfig_clatd_enable();
491 if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path))
492 cellular_state_set_service_state(NETCONFIG_CELLULAR_ONLINE);
494 } else if (g_strcmp0(property, "failure") == 0 ||
495 g_strcmp0(property, "disconnect") == 0 || g_strcmp0(property, "idle") == 0) {
496 if (netconfig_get_default_profile() == NULL) {
501 if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path)) {
502 cellular_state_set_service_state(NETCONFIG_CELLULAR_IDLE);
504 /* Disable clatd if it is in running state */
505 DBG("disable clatd");
506 netconfig_clatd_disable();
509 if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
514 netconfig_update_default_profile();
515 } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) {
516 if (netconfig_get_default_profile() == NULL) {
521 if (netconfig_is_cellular_profile(path) && netconfig_is_cellular_internet_profile(path))
522 cellular_state_set_service_state(NETCONFIG_CELLULAR_CONNECTING);
524 if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
529 netconfig_update_default_profile();
533 if (netconfig_is_wifi_profile(path) || netconfig_is_ethernet_profile(path)) {
534 if (g_strcmp0(property, "ready") == 0) {
535 if (g_strcmp0(path, netconfig_get_default_profile()) == 0
536 && netconfig_get_default_is_internet())
537 netconfig_set_default_is_internet(FALSE);
539 for (idx = 0; idx < MAX_SOCKET_OPEN_RETRY; idx++) {
540 sd = start_ip_conflict_mon();
544 } else if (g_strcmp0(property, "online") == 0) {
545 if (g_strcmp0(path, netconfig_get_default_profile()) == 0)
546 netconfig_set_default_is_internet(TRUE);
548 stop_ip_conflict_mon();
553 } else if (g_strcmp0(sigvalue, "Proxy") == 0) {
554 if (g_strcmp0(path, netconfig_get_default_profile()) != 0)
557 if (!g_variant_is_of_type(variant, G_VARIANT_TYPE_ARRAY))
560 g_variant_get(variant, "a{sv}", &iter);
561 while (g_variant_iter_loop(iter, "{sv}", &property, &var)) {
562 GVariantBuilder *builder;
563 GVariant *sig_params;
564 if (g_strcmp0(property, "Servers") == 0) {
565 GVariantIter *iter_sub = NULL;
567 g_variant_get(var, "as", &iter_sub);
568 g_variant_iter_loop(iter_sub, "s", &value);
569 g_variant_iter_free(iter_sub);
571 DBG("Proxy - [%s]", value);
572 if (g_strcmp0(value, netconfig_get_default_proxy()) != 0) {
573 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
575 netconfig_set_default_proxy(value);
576 netconfig_set_vconf_str(VCONFKEY_NETWORK_PROXY, value, TRUE);
578 g_variant_builder_add(builder, "{sv}", "ProxyAddress",
579 g_variant_new_string(value));
581 sig_params = g_variant_new("(@a{sv})",
582 g_variant_builder_end(builder));
583 g_variant_builder_unref(builder);
585 netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
586 NETCONFIG_NETWORK_INTERFACE, "NetworkConfigChanged",
591 g_variant_unref(var);
593 } else if (g_strcmp0(property, "Method") == 0) {
594 value = g_variant_get_string(var, NULL);
595 DBG("Method - [%s]", value);
597 if (g_strcmp0(value, "direct") == 0) {
598 if (g_strcmp0("", netconfig_get_default_proxy()) != 0) {
599 builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
601 netconfig_set_default_proxy("");
602 netconfig_set_vconf_str(VCONFKEY_NETWORK_PROXY, "", TRUE);
604 g_variant_builder_add(builder, "{sv}", "ProxyAddress",
605 g_variant_new_string(""));
607 sig_params = g_variant_new("(@a{sv})",
608 g_variant_builder_end(builder));
609 g_variant_builder_unref(builder);
611 netconfig_dbus_emit_signal(NULL, NETCONFIG_NETWORK_PATH,
612 NETCONFIG_NETWORK_INTERFACE,
613 "NetworkConfigChanged", sig_params);
618 g_variant_unref(var);
623 g_variant_iter_free(iter);
624 } else if (g_strcmp0(sigvalue, "IPv4") == 0) {
625 if (g_strcmp0(path, netconfig_get_default_profile()) != 0)
628 __netconfig_extract_ipv4_signal_data(variant, path);
629 } else if (g_strcmp0(sigvalue, "IPv6") == 0) {
630 if (g_strcmp0(path, netconfig_get_default_profile()) != 0)
633 __netconfig_extract_ipv6_signal_data(variant, path);
634 } else if (g_strcmp0(sigvalue, "Strength") == 0) {
635 strength = g_variant_get_byte(variant);
637 netconfig_wifi_indicator_update(interface_name, path, strength - 120);
638 } else if (g_strcmp0(sigvalue, "Error") == 0) {
639 g_variant_get(variant, "s", &property);
640 INFO("[%s] Property : %s", sigvalue, property);
641 #if defined TIZEN_DEBUG_ENABLE
642 if (g_strcmp0(property, "dhcp-failed") == 0
643 || g_strcmp0(property, "connect-failed") == 0
644 || g_strcmp0(property, "login-failed") == 0
645 || g_strcmp0(property, "auth-failed") == 0
646 || g_strcmp0(property, "assoc-failed") == 0
647 || g_strcmp0(property, "invalid-key") == 0) {
659 g_variant_unref(variant);
664 static void _dbus_name_changed_cb(GDBusConnection *conn,
665 const gchar *Name, const gchar *path, const gchar *interface,
666 const gchar *sig, GVariant *param, gpointer user_data)
675 g_variant_get(param, "(sss)", &name, &old, &new);
677 if (g_strcmp0(name, CONNMAN_SERVICE) == 0 && *new == '\0') {
678 DBG("ConnMan destroyed: name %s, old %s, new %s", name, old, new);
680 connman_register_agent();
681 } else if (g_strcmp0(name, CLATD_SERVICE) == 0 && *new == '\0') {
682 DBG("Clat destroyed: name %s, old %s, new %s", name, old, new);
684 /* If clatd is terminated unexpectedly, reset and enable clat service. */
685 if (NETCONFIG_CELLULAR_ONLINE == cellular_state_get_service_state())
686 netconfig_clatd_reset();
687 } else if (g_strcmp0(name, SUPPLICANT_SERVICE) == 0 && *new == '\0') {
688 DBG("Supplicant destroyed: name %s, old %s, new %s", name, old, new);
689 __mark_supplicant_stopped();
698 static void _dbus_vconf_changed_cb(GDBusConnection *conn,
699 const gchar *Name, const gchar *path, const gchar *interface,
700 const gchar *sig, GVariant *param, gpointer user_data)
704 gchar *str_val = NULL;
710 g_variant_get(param, "(sssi)", &key, &type, &str_val, &int_val);
712 if (!key || key[0] == '\0')
715 DBG("VconfChanged key: %s, type: %s, str_val: %s, int_val: %d",
716 key, type, str_val, int_val);
718 if (g_strcmp0(type, "string") == 0 && str_val)
719 vconf_set_str(key, str_val);
720 else if (g_strcmp0(type, "int") == 0)
721 vconf_set_int(key, int_val);
722 else if (g_strcmp0(type, "bool") == 0)
723 vconf_set_bool(key, int_val);
731 static void _scan_changed_cb(GDBusConnection *conn,
732 const gchar *name, const gchar *path, const gchar *interface,
733 const gchar *sig, GVariant *param, gpointer user_data)
735 const char *key = NULL;
737 gboolean value = false;
739 if (g_strcmp0(sig, SIGNAL_SCAN_CHANGED) == 0) {
740 g_variant_get(param, "(sv)", &key, &var);
742 if (g_strcmp0(key, "scan_started") == 0)
744 else if (g_strcmp0(key, "scan_done") == 0)
747 DBG("Scan changed [%s]", (value == true) ? "Started" : "Done");
748 netconfig_battery_update_wifi_scan(value);
751 g_variant_unref(var);
755 static void _supplicant_interface_removed(GDBusConnection *conn,
756 const gchar *name, const gchar *path, const gchar *interface,
757 const gchar *sig, GVariant *param, gpointer user_data)
759 char *interface_name = NULL;
761 DBG("Interface removed handling!");
763 interface_name = __supplicant_get_interface_name(path, interface);
764 if (interface_name == NULL)
767 if (netconfig_wifi_bssidscan_get_mode(interface_name) == TRUE)
768 netconfig_wifi_bssid_signal_scanaborted(interface_name);
770 g_free(interface_name);
774 static void _supplicant_properties_changed(GDBusConnection *conn,
775 const gchar *name, const gchar *path, const gchar *interface,
776 const gchar *sig, GVariant *param, gpointer user_data)
778 DBG("Properties changed handling!");
780 const gchar *state = NULL;
781 GVariantIter *iter = NULL;
782 GVariant *variant = NULL;
783 gboolean scanning = FALSE;
784 char *interface_name = NULL;
789 interface_name = __supplicant_get_interface_name(path, interface);
790 if (interface_name == NULL)
793 g_variant_get(param, "(a{sv})", &iter);
794 while (g_variant_iter_loop(iter, "{sv}", &key, &variant)) {
795 if (g_strcmp0(key, "Scanning") == 0) {
796 scanning = g_variant_get_boolean(variant);
797 DBG("setting scanning %s", scanning ? "TRUE" : "FALSE");
798 if (scanning == TRUE)
799 netconfig_wifi_scan_set_scanning(interface_name, TRUE);
801 netconfig_wifi_scan_set_scanning(interface_name, FALSE);
803 g_variant_unref(variant);
808 } else if (g_strcmp0(key, "State") == 0) {
809 state = g_variant_get_string(variant, NULL);
811 DBG("Supplicant state : %s", state);
813 g_variant_unref(variant);
818 } else if (g_strcmp0(key, "DisconnectReason") == 0) {
819 int reason = g_variant_get_int32(variant);
820 DBG("Supplicant DisconnReason : %d", reason);
822 g_variant_unref(variant);
829 value = g_variant_print(variant, TRUE);
830 DBG("Supplicant %s : %s", key, value);
836 g_variant_iter_free(iter);
837 g_free(interface_name);
841 static void _supplicant_bss_added(GDBusConnection *conn,
842 const gchar *name, const gchar *path, const gchar *interface,
843 const gchar *sig, GVariant *param, gpointer user_data)
845 DBG("BSS added handling!");
846 wifi_state_set_bss_found(TRUE);
851 static void _supplicant_scan_done(GDBusConnection *conn,
852 const gchar *name, const gchar *path, const gchar *interface,
853 const gchar *sig, GVariant *param, gpointer user_data)
855 char *interface_name = NULL;
857 DBG("Scan Done handling!");
859 interface_name = __supplicant_get_interface_name(path, interface);
860 if (interface_name == NULL)
863 netconfig_wifi_scan_set_scanning(interface_name, FALSE);
865 if (netconfig_wifi_bssidscan_get_mode(interface_name) == TRUE) {
866 DBG("%s bssid scan done!", interface_name);
867 netconfig_wifi_bssid_signal_scandone(interface_name);
868 if (wifi_state_get_technology_state(interface_name)
869 < NETCONFIG_WIFI_TECH_POWERED) {
870 g_free(interface_name);
875 if (netconfig_wifi_bgscan_get_mode(interface_name) == TRUE) {
876 DBG("%s bgscan done!", interface_name);
877 if (wifi_state_get_technology_state(interface_name)
878 >= NETCONFIG_WIFI_TECH_POWERED) {
879 netconfig_wifi_bgscan_start(interface_name, FALSE);
882 wifi_start_timer_network_notification(interface_name);
885 g_free(interface_name);
889 static void _supplicant_driver_hanged(GDBusConnection *conn,
890 const gchar *name, const gchar *path, const gchar *interface,
891 const gchar *sig, GVariant *param, gpointer user_data)
893 char *interface_name = NULL;
895 DBG("Driver Hanged handling!");
896 ERR("Critical. Wi-Fi firmware crashed");
898 #if !defined TIZEN_WEARABLE
899 netconfig_send_message_to_net_popup("Wi-Fi Error",
900 "Wi-Fi Driver Hanged. Please get log dump and report", "popup", NULL);
903 interface_name = __supplicant_get_interface_name(path, interface);
904 if (interface_name == NULL)
907 wifi_power_recover_firmware(interface_name);
909 g_free(interface_name);
914 static void _supplicant_session_overlapped(GDBusConnection *conn,
915 const gchar *name, const gchar *path, const gchar *interface,
916 const gchar *sig, GVariant *param, gpointer user_data)
918 DBG("Driver session overlapped handling!");
919 ERR("WPS PBC SESSION OVERLAPPED");
920 #if defined TIZEN_WEARABLE
923 netconfig_send_message_to_net_popup("WPS Error",
924 "wps session overlapped", "popup", NULL);
928 #if defined TIZEN_DEBUG_ENABLE
929 static void __netconfig_dumpservice_handler(GDBusConnection *conn,
930 const gchar *name, const gchar *path, const gchar *interface,
931 const gchar *sig, GVariant *param, gpointer user_data)
934 gchar *signal_path = NULL;
939 g_variant_get(param, "(is)", &mode, &signal_path);
940 DBG("Path: %s and mode: %d", signal_path, mode);
942 netconfig_dump_log(signal_path);
950 static void _supplicant_tdls_connected(GDBusConnection *conn,
951 const gchar *name, const gchar *path, const gchar *interface,
952 const gchar *sig, GVariant *param, gpointer user_data)
954 char *interface_name = NULL;
956 DBG("Received TDLS Connected Signal");
958 interface_name = __supplicant_get_interface_name(path, interface);
959 if (interface_name == NULL)
962 netconfig_wifi_tdls_connected_event(interface_name, param);
964 g_free(interface_name);
968 static void _supplicant_tdls_disconnected(GDBusConnection *conn,
969 const gchar *name, const gchar *path, const gchar *interface,
970 const gchar *sig, GVariant *param, gpointer user_data)
972 char *interface_name = NULL;
974 DBG("Received TDLS Disconnected Signal");
976 interface_name = __supplicant_get_interface_name(path, interface);
977 if (interface_name == NULL)
980 netconfig_wifi_tdls_disconnected_event(interface_name, param);
982 g_free(interface_name);
986 static void _supplicant_tdls_peer_found(GDBusConnection *conn,
987 const gchar *name, const gchar *path, const gchar *interface,
988 const gchar *sig, GVariant *param, gpointer user_data)
990 char *interface_name = NULL;
992 DBG("Received TDLS Peer Found Signal");
994 interface_name = __supplicant_get_interface_name(path, interface);
995 if (interface_name == NULL)
998 netconfig_wifi_tdls_peer_found_event(interface_name, param);
1000 g_free(interface_name);
1004 static void _supplicant_dpp_auth_success(GDBusConnection *conn,
1005 const gchar *name, const gchar *path, const gchar *interface,
1006 const gchar *sig, GVariant *param, gpointer user_data)
1008 DBG("Received DPP Auth Success Signal");
1009 netconfig_wifi_dpp_auth_success_event(param);
1013 static void _supplicant_dpp_auth_failed(GDBusConnection *conn,
1014 const gchar *name, const gchar *path, const gchar *interface,
1015 const gchar *sig, GVariant *param, gpointer user_data)
1017 DBG("Received DPP Auth Failed Signal");
1018 netconfig_wifi_dpp_auth_failed_event(param);
1022 static void _supplicant_dpp_not_compatible(GDBusConnection *conn,
1023 const gchar *name, const gchar *path, const gchar *interface,
1024 const gchar *sig, GVariant *param, gpointer user_data)
1026 DBG("Received DPP Not Compatible Signal");
1027 netconfig_wifi_dpp_not_compatible_event(param);
1031 static void _supplicant_dpp_conf_failed(GDBusConnection *conn,
1032 const gchar *name, const gchar *path, const gchar *interface,
1033 const gchar *sig, GVariant *param, gpointer user_data)
1035 DBG("Received DPP Conf Failed Signal");
1036 netconfig_wifi_dpp_conf_failed_event(param);
1040 static void _supplicant_dpp_scan_peer_qr(GDBusConnection *conn,
1041 const gchar *name, const gchar *path, const gchar *interface,
1042 const gchar *sig, GVariant *param, gpointer user_data)
1044 DBG("Received DPP Scan Peer QR Signal");
1045 netconfig_wifi_dpp_scan_peer_qr_event(param);
1049 static void _supplicant_dpp_network_id(GDBusConnection *conn,
1050 const gchar *name, const gchar *path, const gchar *interface,
1051 const gchar *sig, GVariant *param, gpointer user_data)
1053 DBG("Received DPP Network Id Signal");
1054 netconfig_wifi_dpp_network_id_event(param);
1058 static void _supplicant_dpp_conf_sent(GDBusConnection *conn,
1059 const gchar *name, const gchar *path, const gchar *interface,
1060 const gchar *sig, GVariant *param, gpointer user_data)
1062 DBG("Received DPP Conf Sent Signal");
1063 netconfig_wifi_dpp_conf_sent_event(param);
1067 static void _supplicant_dpp_conf_received(GDBusConnection *conn,
1068 const gchar *name, const gchar *path, const gchar *interface,
1069 const gchar *sig, GVariant *param, gpointer user_data)
1071 DBG("Received DPP Conf Received Signal");
1072 netconfig_wifi_dpp_conf_received_event(param);
1076 static void _supplicant_dpp_conf_obj(GDBusConnection *conn,
1077 const gchar *name, const gchar *path, const gchar *interface,
1078 const gchar *sig, GVariant *param, gpointer user_data)
1080 char *interface_name = NULL;
1082 DBG("Received DPP Conf Obj Signal");
1084 interface_name = __supplicant_get_interface_name(path, interface);
1085 if (interface_name == NULL)
1088 netconfig_wifi_dpp_conf_obj_event(interface_name, param);
1090 g_free(interface_name);
1094 static void _supplicant_wifi_wps_connected(const char *interface_name, GVariant *param)
1097 char ssid[32] = {0, };
1101 int config_error = 0;
1102 int error_indication = 0;
1105 if (param == NULL) {
1106 ERR("Param is NULL");
1110 g_variant_get(param, "(sa{sv})", &name, &iter);
1111 INFO("wps Result: %s", name);
1112 while (g_variant_iter_loop(iter, "{sv}", &key, &variant)) {
1113 INFO("wps Key is %s", key);
1114 if (g_strcmp0(key, "SSID") == 0) {
1115 const char *t_key = NULL;
1116 t_key = g_variant_get_fixed_array(variant, &ssid_len, sizeof(guchar));
1117 INFO("wps ssid_len is %zd ", ssid_len);
1118 if (t_key == NULL) {
1120 g_variant_unref(variant);
1121 ERR("WPS PBC Connection Failed");
1124 if (ssid_len > 0 && ssid_len <= 32) {
1125 memcpy(ssid, t_key, ssid_len);
1127 memset(ssid, 0, sizeof(ssid));
1130 INFO("WPS PBC Connection completed with AP %s", ssid);
1131 netconfig_wifi_notify_wps_completed(interface_name,
1136 g_variant_iter_free(iter);
1141 g_variant_iter_free(iter);
1143 error_indication = WPS_EI_OPERATION_FAILED;
1144 config_error = WPS_CFG_NO_ERROR;
1145 ERR("Error Occured! Notifying Fail Event");
1146 netconfig_wifi_notify_wps_fail_event(interface_name,
1147 config_error, error_indication);
1151 static void _supplicant_wifi_wps_event(const char *interface_name, GVariant *param)
1157 gint32 config_error = 0;
1158 gint32 error_indication = 0;
1160 if (param == NULL) {
1161 ERR("Param is NULL");
1165 g_variant_get(param, "(sa{sv})", &name, &iter);
1166 INFO("Event Result: %s", name);
1167 if (g_strcmp0(name, "fail") == 0) {
1168 while (g_variant_iter_loop(iter, "{sv}", &key, &variant)) {
1171 INFO("Key is %s", key);
1172 if (g_strcmp0(key, "config_error") == 0) {
1173 config_error = g_variant_get_int32(variant);
1174 ERR("Config Error %d", config_error);
1175 } else if (g_strcmp0(key, "error_indication") == 0) {
1176 error_indication = g_variant_get_int32(variant);
1177 ERR("Error Indication %d", error_indication);
1180 netconfig_wifi_notify_wps_fail_event(interface_name,
1181 config_error, error_indication);
1184 g_variant_iter_free(iter);
1189 g_variant_iter_free(iter);
1191 error_indication = WPS_EI_OPERATION_FAILED;
1192 config_error = WPS_CFG_NO_ERROR;
1193 ERR("Error Occured! Notifying Fail Event");
1194 netconfig_wifi_notify_wps_fail_event(interface_name,
1195 config_error, error_indication);
1198 static void _find_service_and_set_passphrase(char *ssid, char *key)
1201 GVariant *reply = NULL;
1206 gchar *enc_passphrase;
1208 ssid_len = strlen(ssid);
1210 str = g_string_sized_new((ssid_len * 2) + 55);
1214 dev_mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
1215 if (!dev_mac_addr) {
1216 ERR("Failed to get mac address from vconf key");
1217 g_string_free(str, TRUE);
1222 for (i = 0; dev_mac_addr[i]; i++) {
1223 if (dev_mac_addr[i] != ':')
1224 ident[j++] = dev_mac_addr[i];
1228 g_string_append_printf(str, "%s%s_", CONNMAN_WIFI_SERVICE_PROFILE_PREFIX,
1232 for (i = 0; i < ssid_len; i++) {
1234 g_string_append_printf(str, "%02x", ssid[i]);
1237 g_string_append_printf(str, "_managed_psk");
1239 service_path = g_string_free(str, FALSE);
1241 enc_passphrase = _netconfig_encrypt_passphrase(key);
1242 if (!enc_passphrase) {
1243 ERR("Failed to encrypt passphrase");
1244 g_free(service_path);
1248 INFO("wps service_path %s Passphrase %s", service_path, enc_passphrase);
1250 reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE, service_path,
1251 CONNMAN_SERVICE_INTERFACE, "SetProperty",
1252 g_variant_new("(sv)", "Passphrase",
1253 g_variant_new_string(enc_passphrase)));
1255 g_variant_unref(reply);
1257 ERR("Failed to set passphrase");
1259 g_free(service_path);
1264 static void _supplicant_wifi_wps_credentials(const char *interface_name, GVariant *param)
1267 char ssid[32] = {0, };
1268 char wps_key[100] = {0, };
1271 int config_error = 0;
1272 int error_indication = 0;
1274 char *key_mgmt = NULL;
1276 if (param == NULL) {
1277 ERR("Param is NULL");
1281 g_variant_get(param, "(a{sv})", &iter);
1282 while (g_variant_iter_loop(iter, "{sv}", &key, &variant)) {
1285 INFO("wps Key is %s", key);
1286 if (g_strcmp0(key, "Key") == 0) {
1288 const char *t_key = NULL;
1289 key_len = g_variant_get_size(variant);
1291 INFO("wps password len %zd ", key_len);
1293 t_key = g_variant_get_fixed_array(variant, &key_len,
1297 g_variant_unref(variant);
1300 strncpy(wps_key, t_key, key_len);
1301 wps_key[key_len] = '\0';
1302 INFO("WPS Key in process credentials %s", wps_key);
1304 SLOGI("WPS AP Security ->Open");
1305 } else if (g_strcmp0(key, "SSID") == 0) {
1306 const char *t_key = NULL;
1307 t_key = g_variant_get_fixed_array(variant, &ssid_len,
1309 INFO("wps ssid_len is %zd ", ssid_len);
1312 g_variant_unref(variant);
1315 if (ssid_len > 0 && ssid_len <= 32) {
1316 memcpy(ssid, t_key, ssid_len);
1318 memset(ssid, 0, sizeof(ssid));
1321 INFO("SSID in process credentials %s", ssid);
1322 } else if (g_strcmp0(key, "AuthType") == 0) {
1324 GVariantIter *var_iter;
1325 g_variant_get(variant, "as", &var_iter);
1326 while (g_variant_iter_loop(var_iter, "s", &auth_type)) {
1327 INFO("wps auth_type %s", auth_type);
1328 if (g_strcmp0(auth_type, "wpa-psk") == 0 ||
1329 g_strcmp0(auth_type, "wpa2-psk") == 0)
1331 else if (g_strcmp0(auth_type, "open") == 0)
1334 g_variant_iter_free(var_iter);
1335 } else if (g_strcmp0(key, "EncrType") == 0) {
1337 GVariantIter *var_iter;
1338 g_variant_get(variant, "as", &var_iter);
1339 while (g_variant_iter_loop(var_iter, "s", &encr_type))
1340 INFO("wps encr_type %s", encr_type);
1341 g_variant_iter_free(var_iter);
1342 } else if (g_strcmp0(key, "BSSID") == 0) {
1343 const guchar *bssid;
1345 bssid = g_variant_get_fixed_array(variant, &bssid_len,
1347 if (bssid && bssid_len == 6)
1348 INFO("wps BSSID %2x:%2x:%2x:%2x:%2x:%2x", bssid[0], bssid[1],
1349 bssid[2], bssid[3], bssid[4], bssid[5]);
1353 g_variant_iter_free(iter);
1355 if (g_strcmp0(key_mgmt, "psk") == 0)
1356 _find_service_and_set_passphrase(ssid, wps_key);
1358 netconfig_wifi_notify_wps_credentials(interface_name, ssid, ssid_len, wps_key);
1362 g_variant_iter_free(iter);
1363 error_indication = WPS_EI_OPERATION_FAILED;
1364 config_error = WPS_CFG_NO_ERROR;
1365 ERR("Error Occured! Notifying Fail Event");
1366 netconfig_wifi_notify_wps_fail_event(interface_name, config_error, error_indication);
1369 static void __netconfig_wps_signal_filter_handler(GDBusConnection *conn,
1370 const gchar *name, const gchar *path, const gchar *interface,
1371 const gchar *sig, GVariant *param, gpointer user_data)
1373 char *interface_name = NULL;
1375 interface_name = __supplicant_get_interface_name(path, SUPPLICANT_IFACE_INTERFACE);
1376 if (interface_name == NULL)
1379 if (g_strcmp0(sig, SIGNAL_WPS_CREDENTIALS) == 0) {
1380 INFO("Received wps CREDENTIALS Signal from Supplicant");
1381 _supplicant_wifi_wps_credentials(interface_name, param);
1382 } else if (g_strcmp0(sig, SIGNAL_WPS_EVENT) == 0) {
1383 INFO("Received wps EVENT Signal from Supplicant");
1384 _supplicant_wifi_wps_event(interface_name, param);
1385 } else if (g_strcmp0(sig, SIGNAL_WPS_CONNECTED) == 0) {
1386 INFO("Received WPSConnected Signal from Supplicant");
1387 _supplicant_wifi_wps_connected(interface_name, param);
1390 g_free(interface_name);
1394 static void __telephony_svc_cs_changed_cb(keynode_t * node, void *data)
1396 int telephony_svc_cs = 0;
1399 telephony_svc_cs = vconf_keynode_get_int(node);
1401 netconfig_vconf_get_int(VCONFKEY_TELEPHONY_SVC_CS, &telephony_svc_cs);
1403 DBG("Telephony svc cs [%d]", telephony_svc_cs);
1405 switch (telephony_svc_cs) {
1407 netconfig_battery_end_dn();
1410 netconfig_battery_start_dn();
1417 static void __telephony_rssi_changed_cb(keynode_t * node, void *data)
1422 rssi = vconf_keynode_get_int(node);
1424 netconfig_vconf_get_int(VCONFKEY_TELEPHONY_RSSI, &rssi);
1426 DBG("Telephony rssi [%d]", rssi);
1428 netconfig_battery_update_dn_rssi(rssi);
1431 static void _notify_telephony_svc_cs(void)
1433 int telephony_svc_cs = 0;
1435 netconfig_vconf_get_int(VCONFKEY_TELEPHONY_SVC_CS, &telephony_svc_cs);
1436 DBG("Telephony svc cs [%d]", telephony_svc_cs);
1438 switch (telephony_svc_cs) {
1440 netconfig_battery_end_dn();
1443 netconfig_battery_start_dn();
1449 vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVC_CS, __telephony_svc_cs_changed_cb, NULL);
1452 static void _notify_telephony_rssi(void)
1456 netconfig_vconf_get_int(VCONFKEY_TELEPHONY_RSSI, &rssi);
1457 DBG("Telephony rssi [%d]", rssi);
1459 netconfig_battery_update_dn_rssi(rssi);
1461 vconf_notify_key_changed(VCONFKEY_TELEPHONY_RSSI, __telephony_rssi_changed_cb, NULL);
1464 static void _ignore_telephony_svc_cs(void)
1466 vconf_ignore_key_changed(VCONFKEY_TELEPHONY_SVC_CS, __telephony_svc_cs_changed_cb);
1469 static void _ignore_telephony_rssi(void)
1471 vconf_ignore_key_changed(VCONFKEY_TELEPHONY_RSSI, __telephony_rssi_changed_cb);
1474 static supplicant_signal_cb supplicant_cbs[SIG_MAX] = {
1475 _supplicant_interface_removed,
1476 _supplicant_properties_changed,
1477 _supplicant_bss_added,
1478 _supplicant_scan_done,
1479 _supplicant_driver_hanged,
1480 _supplicant_session_overlapped,
1481 _supplicant_tdls_connected,
1482 _supplicant_tdls_disconnected,
1483 _supplicant_tdls_peer_found,
1484 _supplicant_dpp_auth_success,
1485 _supplicant_dpp_auth_failed,
1486 _supplicant_dpp_not_compatible,
1487 _supplicant_dpp_conf_failed,
1488 _supplicant_dpp_scan_peer_qr,
1489 _supplicant_dpp_network_id,
1490 _supplicant_dpp_conf_sent,
1491 _supplicant_dpp_conf_received,
1492 _supplicant_dpp_conf_obj,
1495 void register_gdbus_signal_container(void)
1497 GDBusConnection *connection = NULL;
1498 connection = netdbus_get_connection();
1500 if (connection == NULL) {
1501 ERR("Failed to get GDbus Connection");
1505 netconfig_subscription_id = g_dbus_connection_signal_subscribe(
1508 NETCONFIG_NETWORK_INTERFACE,
1509 NETCONFIG_SIGNAL_VCONF_CHANGED,
1510 NETCONFIG_NETWORK_PATH,
1512 G_DBUS_SIGNAL_FLAGS_NONE,
1513 _dbus_vconf_changed_cb,
1517 INFO("Successfully register host net-config DBus signal filter");
1520 void register_gdbus_signal(void)
1522 GDBusConnection *connection = NULL;
1523 SuppSigArrayIndex sig;
1524 connection = netdbus_get_connection();
1526 if (connection == NULL) {
1527 ERR("Failed to get GDbus Connection");
1531 /* listening to messages from all objects as no path is specified */
1532 /* see signals from the given interface */
1533 conn_subscription_ids[0] = g_dbus_connection_signal_subscribe(
1536 CONNMAN_TECHNOLOGY_INTERFACE,
1540 G_DBUS_SIGNAL_FLAGS_NONE,
1541 _technology_signal_cb,
1545 conn_subscription_ids[1] = g_dbus_connection_signal_subscribe(
1548 CONNMAN_SERVICE_INTERFACE,
1549 CONNMAN_SIGNAL_PROPERTY_CHANGED,
1552 G_DBUS_SIGNAL_FLAGS_NONE,
1557 conn_subscription_ids[2] = g_dbus_connection_signal_subscribe(
1560 DBUS_INTERFACE_DBUS,
1561 SIGNAL_NAME_OWNER_CHANGED,
1564 G_DBUS_SIGNAL_FLAGS_NONE,
1565 _dbus_name_changed_cb,
1569 conn_subscription_ids[3] = g_dbus_connection_signal_subscribe(
1572 CONNMAN_MANAGER_INTERFACE,
1573 SIGNAL_SCAN_CHANGED,
1574 CONNMAN_MANAGER_PATH,
1576 G_DBUS_SIGNAL_FLAGS_NONE,
1581 INFO("Successfully register connman DBus signal filters");
1583 conn_subscription_ids[4] = g_dbus_connection_signal_subscribe(
1586 SUPPLICANT_INTERFACE ".Interface.WPS",
1590 G_DBUS_SIGNAL_FLAGS_NONE,
1591 __netconfig_wps_signal_filter_handler,
1595 INFO("Successfully register Supplicant WPS DBus signal filters");
1597 conn_subscription_ids[5] = g_dbus_connection_signal_subscribe(
1600 DBUS_INTERFACE_DBUS,
1601 SIGNAL_NAME_OWNER_CHANGED,
1604 G_DBUS_SIGNAL_FLAGS_NONE,
1605 _dbus_name_changed_cb,
1609 conn_subscription_ids[6] = g_dbus_connection_signal_subscribe(
1612 DBUS_INTERFACE_DBUS,
1613 SIGNAL_NAME_OWNER_CHANGED,
1616 G_DBUS_SIGNAL_FLAGS_NONE,
1617 _dbus_name_changed_cb,
1621 INFO("Successfully register clat DBus signal filters");
1623 for (sig = SIG_INTERFACE_REMOVED; sig < SIG_MAX; sig++) {
1624 supp_subscription_ids[sig] = g_dbus_connection_signal_subscribe(
1627 supplicant_iface_for_sig[sig],
1628 supplicant_signals[sig],
1631 G_DBUS_SIGNAL_FLAGS_NONE,
1632 supplicant_cbs[sig],
1637 INFO("Successfully register Supplicant DBus signal filters");
1639 #if defined TIZEN_DEBUG_ENABLE
1640 dumpservice_subscription_id = g_dbus_connection_signal_subscribe(
1643 DUMP_SERVICE_INTERFACE,
1647 G_DBUS_SIGNAL_FLAGS_NONE,
1648 __netconfig_dumpservice_handler,
1652 INFO("Successfully registered Dumpservice DBus signal filter");
1655 _notify_telephony_svc_cs();
1656 _notify_telephony_rssi();
1658 INFO("Successfully register Telephony vconf keys");
1660 /* In case ConnMan precedes this signal register,
1661 * net-config should update the default connected profile.
1663 netconfig_update_default();
1666 void deregister_gdbus_signal_container(void)
1668 GDBusConnection *connection = NULL;
1670 connection = netdbus_get_connection();
1672 ERR("Already de-registered. Nothing to be done");
1676 if (netconfig_subscription_id)
1677 g_dbus_connection_signal_unsubscribe(connection,
1678 netconfig_subscription_id);
1681 void deregister_gdbus_signal(void)
1683 GDBusConnection *connection = NULL;
1685 SuppSigArrayIndex sig;
1686 connection = netdbus_get_connection();
1688 ERR("Already de-registered. Nothing to be done");
1692 for (signal = 0; signal < TOTAL_CONN_SIGNALS; signal++) {
1693 if (conn_subscription_ids[signal]) {
1694 g_dbus_connection_signal_unsubscribe(connection,
1695 conn_subscription_ids[signal]);
1699 for (sig = SIG_INTERFACE_REMOVED; sig < SIG_MAX; sig++) {
1700 if (supp_subscription_ids[sig]) {
1701 g_dbus_connection_signal_unsubscribe(connection,
1702 supp_subscription_ids[sig]);
1706 #if defined TIZEN_DEBUG_ENABLE
1707 g_dbus_connection_signal_unsubscribe(connection,
1708 dumpservice_subscription_id);
1711 _ignore_telephony_svc_cs();
1712 _ignore_telephony_rssi();