diff options
author | Abhishek Sansanwal <abhishek.s94@samsung.com> | 2017-08-03 09:27:22 +0530 |
---|---|---|
committer | Abhishek Sansanwal <abhishek.s94@samsung.com> | 2017-08-03 09:27:22 +0530 |
commit | fd3573b27dcecd10afaaabada6892a0e65974e44 (patch) | |
tree | 18223155b852ec01834c1c247acbe1a3690ca8ec | |
parent | 1b56f4d34a2583a30be96f9e0e5dd44ab4c30be8 (diff) | |
download | connman-fd3573b27dcecd10afaaabada6892a0e65974e44.tar.gz connman-fd3573b27dcecd10afaaabada6892a0e65974e44.tar.bz2 connman-fd3573b27dcecd10afaaabada6892a0e65974e44.zip |
Changes required for DHCP leased seconds APIsubmit/tizen/20170809.085632submit/tizen/20170808.043745accepted/tizen/unified/20170811.021044
Change-Id: I0727c24f30be5162d27e49996dfa376348f98527
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
-rwxr-xr-x | gdhcp/client.c | 12 | ||||
-rwxr-xr-x | gdhcp/gdhcp.h | 5 | ||||
-rwxr-xr-x | src/connman.h | 5 | ||||
-rwxr-xr-x | src/dhcp.c | 9 | ||||
-rwxr-xr-x | src/ipconfig.c | 14 |
5 files changed, 45 insertions, 0 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c index ff4539b7..d3794bde 100755 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -178,6 +178,7 @@ struct _GDHCPClient { struct timeval start_time; bool request_bcast; #if defined TIZEN_EXT + uint32_t dhcp_lease_seconds; gboolean init_reboot; #endif }; @@ -2383,6 +2384,10 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition, dhcp_client->lease_seconds = get_lease(&packet); +#if defined TIZEN_EXT + dhcp_client->dhcp_lease_seconds = dhcp_client->lease_seconds; +#endif + get_request(dhcp_client, &packet); switch_listening_mode(dhcp_client, L_NONE); @@ -3036,6 +3041,13 @@ char *g_dhcp_client_get_server_address(GDHCPClient *dhcp_client) #endif } +#if defined TIZEN_EXT +int g_dhcp_client_get_dhcp_lease_duration(GDHCPClient *dhcp_client) +{ + return dhcp_client->dhcp_lease_seconds; +} +#endif + char *g_dhcp_client_get_address(GDHCPClient *dhcp_client) { return g_strdup(dhcp_client->assigned_ip); diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h index 59b562bf..fd6ce548 100755 --- a/gdhcp/gdhcp.h +++ b/gdhcp/gdhcp.h @@ -151,6 +151,11 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *client, const char *option_value); char *g_dhcp_client_get_server_address(GDHCPClient *client); + +#if defined TIZEN_EXT +int g_dhcp_client_get_dhcp_lease_duration(GDHCPClient *client); +#endif + char *g_dhcp_client_get_address(GDHCPClient *client); char *g_dhcp_client_get_netmask(GDHCPClient *client); GList *g_dhcp_client_get_option(GDHCPClient *client, diff --git a/src/connman.h b/src/connman.h index 7c44d1c1..237c1ec7 100755 --- a/src/connman.h +++ b/src/connman.h @@ -367,6 +367,11 @@ const char *__connman_ipconfig_get_broadcast(struct connman_ipconfig *ipconfig); void __connman_ipconfig_set_broadcast(struct connman_ipconfig *ipconfig, const char *broadcast); const char *__connman_ipconfig_get_gateway(struct connman_ipconfig *ipconfig); void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, const char *gateway); + +#if defined TIZEN_EXT +void __connman_ipconfig_set_dhcp_lease_duration(struct connman_ipconfig *ipconfig, int dhcp_lease_duration); +#endif + unsigned char __connman_ipconfig_get_prefixlen(struct connman_ipconfig *ipconfig); void __connman_ipconfig_set_prefixlen(struct connman_ipconfig *ipconfig, unsigned char prefixlen); @@ -473,6 +473,10 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) __connman_ipconfig_set_dhcp_address(dhcp->ipconfig, address); DBG("last address %s", address); +#if defined TIZEN_EXT + int dhcp_lease_duration = g_dhcp_client_get_dhcp_lease_duration(dhcp_client); +#endif + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET); if (option) netmask = g_strdup(option->data); @@ -505,6 +509,11 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) __connman_ipconfig_set_method(dhcp->ipconfig, CONNMAN_IPCONFIG_METHOD_DHCP); + +#if defined TIZEN_EXT + __connman_ipconfig_set_dhcp_lease_duration(dhcp->ipconfig, dhcp_lease_duration); +#endif + if (ip_change) { __connman_ipconfig_set_local(dhcp->ipconfig, address); __connman_ipconfig_set_prefixlen(dhcp->ipconfig, prefixlen); diff --git a/src/ipconfig.c b/src/ipconfig.c index 411fc450..700384fe 100755 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -53,6 +53,10 @@ struct connman_ipconfig { struct connman_ipaddress *address; struct connman_ipaddress *system; +#if defined TIZEN_EXT + int dhcp_lease_duration; +#endif + int ipv6_privacy_config; char *last_dhcp_address; char **last_dhcpv6_prefixes; @@ -1098,6 +1102,14 @@ void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig, } #if defined TIZEN_EXT +void __connman_ipconfig_set_dhcp_lease_duration(struct connman_ipconfig *ipconfig, + int dhcp_lease_duration) +{ + ipconfig->dhcp_lease_duration = dhcp_lease_duration; +} +#endif + +#if defined TIZEN_EXT int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig, struct connman_service *service) #else int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig) @@ -1903,6 +1915,8 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, DBUS_TYPE_STRING, &server_ip); g_free(server_ip); } + connman_dbus_dict_append_basic(iter, "DHCPLeaseDuration", + DBUS_TYPE_INT32, &ipconfig->dhcp_lease_duration); } #endif } |