summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2023-01-11 18:28:18 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2023-01-11 18:28:18 +0900
commit5f93d209b19a4dc17d5cc8e241c984f213b1b577 (patch)
tree2869ad322e79b243c35cf66c67e3dd7e86f8760a
parent75b786ae3e6c234d245ba750c78d66b6f5b36c0d (diff)
downloadconnman-5f93d209b19a4dc17d5cc8e241c984f213b1b577.tar.gz
connman-5f93d209b19a4dc17d5cc8e241c984f213b1b577.tar.bz2
connman-5f93d209b19a4dc17d5cc8e241c984f213b1b577.zip
Add a dbus signal and a property for DHCP statusaccepted/tizen/7.0/unified/20230118.093741
Signal for DHCP start point has been added. And the interface name is also delivered to distinguish devices. Change-Id: I30ac4a48309c5324efb66a36c9dd431e0c847f5e Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xgdhcp/client.c7
-rwxr-xr-xgdhcp/gdhcp.h1
-rwxr-xr-xsrc/connman.h2
-rw-r--r--src/dhcp.c20
-rwxr-xr-xsrc/network.c10
5 files changed, 30 insertions, 10 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 5e23b13a..18f11a65 100755
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -3131,6 +3131,13 @@ int g_dhcp_client_get_index(GDHCPClient *dhcp_client)
return dhcp_client->ifindex;
}
+#if defined TIZEN_EXT
+char *g_dhcp_client_get_interface(GDHCPClient *dhcp_client)
+{
+ return dhcp_client->interface;
+}
+#endif
+
char *g_dhcp_client_get_server_address(GDHCPClient *dhcp_client)
{
if (!dhcp_client)
diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h
index d9944882..041ae81b 100755
--- a/gdhcp/gdhcp.h
+++ b/gdhcp/gdhcp.h
@@ -157,6 +157,7 @@ char *g_dhcp_client_get_server_address(GDHCPClient *client);
#if defined TIZEN_EXT
int g_dhcp_client_get_dhcp_lease_duration(GDHCPClient *client);
+char *g_dhcp_client_get_interface(GDHCPClient *dhcp_client);
#endif
char *g_dhcp_client_get_address(GDHCPClient *client);
diff --git a/src/connman.h b/src/connman.h
index 9d995962..902dd3e5 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -685,7 +685,7 @@ const char *__connman_network_get_ident(struct connman_network *network);
bool __connman_network_get_weakness(struct connman_network *network);
bool __connman_network_native_autoconnect(struct connman_network *network);
#if defined TIZEN_EXT
-dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, void *val);
+dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, const char *val);
bool connman_network_get_psk_sha256(struct connman_network *network);
void connman_network_set_psk_sha256(struct connman_network *network, bool is_psk_sha256);
#endif
diff --git a/src/dhcp.c b/src/dhcp.c
index ae60fcfa..b17bc653 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -291,21 +291,22 @@ static void no_lease_cb(GDHCPClient *dhcp_client, gpointer user_data)
#if defined TIZEN_EXT
if (dhcp->network &&
connman_network_get_bool(dhcp->network, "WiFi.RoamingDHCP")) {
- int lease_time = 0;
connman_network_set_bool(dhcp->network, "WiFi.RoamingDHCP", false);
__connman_network_enable_ipconfig(dhcp->network, dhcp->ipconfig);
- __connman_network_notify_dhcp_changed("DHCP_FAIL", &lease_time);
+ __connman_network_notify_dhcp_changed("DHCP_FAIL",
+ g_dhcp_client_get_interface(dhcp_client));
return;
}
if (connman_setting_get_bool("EnableAutoIp") == false) {
DBG("link-local address autoconfiguration is disabled.");
+
if (dhcp->network) {
- int lease_time = 0;
DBG("[DHCP-C] auto ip is not used, set dhcp-fail error and disconnect");
- __connman_network_notify_dhcp_changed("DHCP_FAIL", &lease_time);
+ __connman_network_notify_dhcp_changed("DHCP_FAIL",
+ g_dhcp_client_get_interface(dhcp_client));
connman_network_set_error(dhcp->network, CONNMAN_NETWORK_ERROR_DHCP_FAIL);
}
return;
@@ -566,7 +567,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
#if defined TIZEN_EXT
__connman_ipconfig_set_dhcp_lease_duration(dhcp->ipconfig, dhcp_lease_duration);
- __connman_network_notify_dhcp_changed(DHCP_SUCCESS, &dhcp_lease_duration);
+ __connman_network_notify_dhcp_changed(DHCP_SUCCESS,
+ g_dhcp_client_get_interface(dhcp_client));
#endif
/*
@@ -653,6 +655,11 @@ static void ipv4ll_available_cb(GDHCPClient *ipv4ll_client, gpointer user_data)
g_free(address);
g_free(netmask);
+
+#if defined TIZEN_EXT
+ __connman_network_notify_dhcp_changed("DHCP_FAIL",
+ g_dhcp_client_get_interface(ipv4ll_client));
+#endif
}
static int dhcp_initialize(struct connman_dhcp *dhcp)
@@ -860,6 +867,9 @@ int __connman_dhcp_start(struct connman_ipconfig *ipconfig,
dhcp->user_data = user_data;
#if defined TIZEN_EXT
+ __connman_network_notify_dhcp_changed("DHCP_STARTED",
+ g_dhcp_client_get_interface(dhcp->dhcp_client));
+
if (network && connman_network_get_bool(network, "WiFi.RoamingDHCP")) {
const char *last_addr = __connman_ipconfig_get_dhcp_address(ipconfig);
diff --git a/src/network.c b/src/network.c
index d702d3d9..db0e72ea 100755
--- a/src/network.c
+++ b/src/network.c
@@ -2108,14 +2108,16 @@ out:
}
#if defined TIZEN_EXT
-dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, void *val)
+dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, const char *val)
{
- int *value = (int *) val;
DBusMessage *signal;
DBusMessageIter iter;
dbus_bool_t result = FALSE;
- DBG("key %s, val %d", key, *value);
+ if (val)
+ DBG("key %s, val %s", key, val);
+ else
+ DBG("key %s, val NULL", key);
signal = dbus_message_new_signal(CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE, "DhcpChanged");
@@ -2124,7 +2126,7 @@ dbus_bool_t __connman_network_notify_dhcp_changed(const char *key, void *val)
return result;
dbus_message_iter_init_append(signal, &iter);
- connman_dbus_property_append_basic(&iter, key, DBUS_TYPE_INT32, val);
+ connman_dbus_property_append_basic(&iter, key, DBUS_TYPE_STRING, &val);
result = dbus_connection_send(connection, signal, NULL);
if (result)