Imported Upstream version 1.24
[platform/upstream/connman.git] / gdhcp / gdhcp.h
index 4f0a16b..f3e47bf 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  DHCP library with GLib integration
  *
- *  Copyright (C) 2009-2012  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2009-2013  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -22,7 +22,9 @@
 #ifndef __G_DHCP_H
 #define __G_DHCP_H
 
+#include <stdbool.h>
 #include <stdint.h>
+#include <arpa/inet.h>
 
 #include <glib.h>
 
@@ -60,6 +62,7 @@ typedef enum {
        G_DHCP_CLIENT_EVENT_REBIND,
        G_DHCP_CLIENT_EVENT_RELEASE,
        G_DHCP_CLIENT_EVENT_CONFIRM,
+       G_DHCP_CLIENT_EVENT_DECLINE,
 } GDHCPClientEvent;
 
 typedef enum {
@@ -83,11 +86,14 @@ typedef enum {
 #define G_DHCPV6_IA_TA         4
 #define G_DHCPV6_IAADDR                5
 #define G_DHCPV6_ORO           6
+#define G_DHCPV6_PREFERENCE     7
 #define G_DHCPV6_ELAPSED_TIME   8
 #define G_DHCPV6_STATUS_CODE   13
 #define G_DHCPV6_RAPID_COMMIT  14
 #define G_DHCPV6_DNS_SERVERS   23
 #define G_DHCPV6_DOMAIN_LIST   24
+#define G_DHCPV6_IA_PD         25
+#define G_DHCPV6_IA_PREFIX     26
 #define G_DHCPV6_SNTP_SERVERS  31
 
 #define G_DHCPV6_ERROR_SUCCESS 0
@@ -96,6 +102,7 @@ typedef enum {
 #define G_DHCPV6_ERROR_BINDING 3
 #define G_DHCPV6_ERROR_LINK    4
 #define G_DHCPV6_ERROR_MCAST   5
+#define G_DHCPV6_ERROR_NO_PREFIX 6
 
 typedef enum {
        G_DHCPV6_DUID_LLT = 1,
@@ -103,6 +110,19 @@ typedef enum {
        G_DHCPV6_DUID_LL  = 3,
 } GDHCPDuidType;
 
+typedef struct {
+       /*
+        * Note that no field in this struct can be allocated
+        * from heap or there will be a memory leak when the
+        * struct is freed by client.c:remove_option_value()
+        */
+       struct in6_addr prefix;
+       unsigned char prefixlen;
+       uint32_t preferred;
+       uint32_t valid;
+       time_t expire;
+} GDHCPIAPrefix;
+
 typedef void (*GDHCPClientEventFunc) (GDHCPClient *client, gpointer user_data);
 
 typedef void (*GDHCPDebugFunc)(const char *str, gpointer user_data);
@@ -142,6 +162,10 @@ int g_dhcpv6_create_duid(GDHCPDuidType duid_type, int index, int type,
                        unsigned char **duid, int *duid_len);
 int g_dhcpv6_client_set_duid(GDHCPClient *dhcp_client, unsigned char *duid,
                        int duid_len);
+int g_dhcpv6_client_set_pd(GDHCPClient *dhcp_client, uint32_t *T1, uint32_t *T2,
+                       GSList *prefixes);
+GSList *g_dhcpv6_copy_prefixes(GSList *prefixes);
+gboolean g_dhcpv6_client_clear_send(GDHCPClient *dhcp_client, uint16_t code);
 void g_dhcpv6_client_set_send(GDHCPClient *dhcp_client, uint16_t option_code,
                        uint8_t *option_value, uint16_t option_len);
 uint16_t g_dhcpv6_client_get_status(GDHCPClient *dhcp_client);
@@ -150,15 +174,16 @@ void g_dhcpv6_client_create_iaid(GDHCPClient *dhcp_client, int index,
                                unsigned char *iaid);
 int g_dhcpv6_client_get_timeouts(GDHCPClient *dhcp_client,
                                uint32_t *T1, uint32_t *T2,
-                               time_t *last_renew, time_t *last_rebind,
-                               time_t *expire);
+                               time_t *started, time_t *expire);
 uint32_t g_dhcpv6_client_get_iaid(GDHCPClient *dhcp_client);
+void g_dhcpv6_client_set_iaid(GDHCPClient *dhcp_client, uint32_t iaid);
 int g_dhcpv6_client_set_ia(GDHCPClient *dhcp_client, int index,
                        int code, uint32_t *T1, uint32_t *T2,
-                       gboolean add_addresses, const char *address);
-void g_dhcpv6_client_reset_renew(GDHCPClient *dhcp_client);
-void g_dhcpv6_client_reset_rebind(GDHCPClient *dhcp_client);
-void g_dhcpv6_client_set_expire(GDHCPClient *dhcp_client, uint32_t timeout);
+                       bool add_addresses, const char *address);
+int g_dhcpv6_client_set_ias(GDHCPClient *dhcp_client, int index,
+                       int code, uint32_t *T1, uint32_t *T2,
+                       GSList *addresses);
+void g_dhcpv6_client_reset_request(GDHCPClient *dhcp_client);
 void g_dhcpv6_client_set_retransmit(GDHCPClient *dhcp_client);
 void g_dhcpv6_client_clear_retransmit(GDHCPClient *dhcp_client);