summaryrefslogtreecommitdiff
path: root/src/dhcp.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-12-07 07:30:40 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-12-07 07:30:40 +0100
commitccc6c9abbc8034776d3a7106ec5ce5c7fed3c88f (patch)
tree561bdb5e876fd8f477250c8358367873d10fea37 /src/dhcp.c
parent21cf9622d48ac41f86c7fe186c6b617e5f661189 (diff)
downloadconnman-ccc6c9abbc8034776d3a7106ec5ce5c7fed3c88f.tar.gz
connman-ccc6c9abbc8034776d3a7106ec5ce5c7fed3c88f.tar.bz2
connman-ccc6c9abbc8034776d3a7106ec5ce5c7fed3c88f.zip
Add DHCP value configuration handling
Diffstat (limited to 'src/dhcp.c')
-rw-r--r--src/dhcp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/dhcp.c b/src/dhcp.c
index 57b44da4..19fab9cc 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -86,6 +86,38 @@ char *connman_dhcp_get_interface(struct connman_dhcp *dhcp)
}
/**
+ * connman_dhcp_set_value:
+ * @dhcp: DHCP structure
+ * @key: unique identifier
+ * @value: string value
+ *
+ * Set string value for specific key
+ */
+void connman_dhcp_set_value(struct connman_dhcp *dhcp,
+ const char *key, const char *value)
+{
+ if (g_strcmp0(key, "Address") == 0) {
+ g_free(dhcp->element->ipv4.address);
+ dhcp->element->ipv4.address = g_strdup(value);
+ } else if (g_strcmp0(key, "Netmask") == 0) {
+ g_free(dhcp->element->ipv4.netmask);
+ dhcp->element->ipv4.netmask = g_strdup(value);
+ } else if (g_strcmp0(key, "Gateway") == 0) {
+ g_free(dhcp->element->ipv4.gateway);
+ dhcp->element->ipv4.gateway = g_strdup(value);
+ } else if (g_strcmp0(key, "Network") == 0) {
+ g_free(dhcp->element->ipv4.network);
+ dhcp->element->ipv4.network = g_strdup(value);
+ } else if (g_strcmp0(key, "Broadcast") == 0) {
+ g_free(dhcp->element->ipv4.broadcast);
+ dhcp->element->ipv4.broadcast = g_strdup(value);
+ } else if (g_strcmp0(key, "Nameserver") == 0) {
+ g_free(dhcp->element->ipv4.nameserver);
+ dhcp->element->ipv4.nameserver = g_strdup(value);
+ }
+}
+
+/**
* connman_dhcp_bound:
* @dhcp: DHCP structure
*