diff options
author | Julien Massot <jmassot@aldebaran-robotics.com> | 2010-12-20 16:24:01 +0000 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-12-21 11:08:37 +0100 |
commit | c7b4007c167f35e6a6b4e58ffd1aec83dae0b18a (patch) | |
tree | b5fb0f7bfd6ccc35128cfbb3b4927fdfb10ad4b5 /gdhcp | |
parent | 7aff98665b599ca6863818e97ad3b29574704964 (diff) | |
download | connman-c7b4007c167f35e6a6b4e58ffd1aec83dae0b18a.tar.gz connman-c7b4007c167f35e6a6b4e58ffd1aec83dae0b18a.tar.bz2 connman-c7b4007c167f35e6a6b4e58ffd1aec83dae0b18a.zip |
gdhcp: Add netmask getter
Diffstat (limited to 'gdhcp')
-rw-r--r-- | gdhcp/client.c | 24 | ||||
-rw-r--r-- | gdhcp/gdhcp.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c index 3508b1e8..107077ae 100644 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -1413,6 +1413,30 @@ char *g_dhcp_client_get_address(GDHCPClient *dhcp_client) return g_strdup(dhcp_client->assigned_ip); } +char *g_dhcp_client_get_netmask(GDHCPClient *dhcp_client) +{ + GList *option = NULL; + + switch (dhcp_client->state) { + case IPV4LL_DEFEND: + case IPV4LL_MONITOR: + return g_strdup("255.255.0.0"); + case BOUND: + case RENEWING: + case REBINDING: + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET); + if (option != NULL) + return g_strdup(option->data); + case INIT_SELECTING: + case REQUESTING: + case RELEASED: + case IPV4LL_PROBE: + case IPV4LL_ANNOUNCE: + break; + } + return NULL; +} + GDHCPClientError g_dhcp_client_set_request(GDHCPClient *dhcp_client, unsigned char option_code) { diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h index 63c395dc..4f583ff7 100644 --- a/gdhcp/gdhcp.h +++ b/gdhcp/gdhcp.h @@ -91,6 +91,7 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *client, const char *option_value); char *g_dhcp_client_get_address(GDHCPClient *client); +char *g_dhcp_client_get_netmask(GDHCPClient *client); GList *g_dhcp_client_get_option(GDHCPClient *client, unsigned char option_code); int g_dhcp_client_get_index(GDHCPClient *client); |