diff --git a/introspection/Makefile.am b/introspection/Makefile.am
index 0dc286a9cd..a70d28511a 100644
--- a/introspection/Makefile.am
+++ b/introspection/Makefile.am
@@ -23,5 +23,6 @@ EXTRA_DIST = \
nm-vpn-connection.xml \
nm-ppp-manager.xml \
nm-active-connection.xml \
+ nm-dhcp4-config.xml \
nm-dhcp4-config.xml
diff --git a/introspection/all.xml b/introspection/all.xml
index 67f1e54216..d6b2f23674 100644
--- a/introspection/all.xml
+++ b/introspection/all.xml
@@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
diff --git a/introspection/nm-dhcp6-config.xml b/introspection/nm-dhcp6-config.xml
new file mode 100644
index 0000000000..93b0f1c8f0
--- /dev/null
+++ b/introspection/nm-dhcp6-config.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Options and configuration returned by the IPv6 DHCP server.
+
+
+ Configuration options returned by a DHCP server, if any.
+
+
+
+
+
+ A dictionary mapping property names to variant boxed values
+
+
+
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 60aa93ee15..7111ac3e5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,6 +114,8 @@ NetworkManager_SOURCES = \
nm-netlink.h \
nm-dhcp4-config.c \
nm-dhcp4-config.h \
+ nm-dhcp6-config.c \
+ nm-dhcp6-config.h \
nm-rfkill.h
nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml
@@ -149,6 +151,9 @@ nm-active-connection-glue.h: $(top_srcdir)/introspection/nm-active-connection.xm
nm-dhcp4-config-glue.h: $(top_srcdir)/introspection/nm-dhcp4-config.xml
dbus-binding-tool --prefix=nm_dhcp4_config --mode=glib-server --output=$@ $<
+nm-dhcp6-config-glue.h: $(top_srcdir)/introspection/nm-dhcp6-config.xml
+ dbus-binding-tool --prefix=nm_dhcp6_config --mode=glib-server --output=$@ $<
+
BUILT_SOURCES = \
nm-access-point-glue.h \
nm-manager-glue.h \
@@ -160,7 +165,8 @@ BUILT_SOURCES = \
nm-ip4-config-glue.h \
nm-ip6-config-glue.h \
nm-active-connection-glue.h \
- nm-dhcp4-config-glue.h
+ nm-dhcp4-config-glue.h \
+ nm-dhcp6-config-glue.h
NetworkManager_CPPFLAGS = \
$(DBUS_CFLAGS) \
diff --git a/src/nm-dhcp6-config.c b/src/nm-dhcp6-config.c
new file mode 100644
index 0000000000..fb6ccce50a
--- /dev/null
+++ b/src/nm-dhcp6-config.c
@@ -0,0 +1,192 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ */
+
+#include
+#include
+
+#include "NetworkManager.h"
+#include "nm-dbus-manager.h"
+#include "nm-dhcp6-config.h"
+#include "nm-dhcp6-config-glue.h"
+#include "nm-dbus-glib-types.h"
+#include "nm-properties-changed-signal.h"
+#include "nm-utils.h"
+
+
+G_DEFINE_TYPE (NMDHCP6Config, nm_dhcp6_config, G_TYPE_OBJECT)
+
+#define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDHCP6ConfigPrivate))
+
+typedef struct {
+ char *dbus_path;
+ GHashTable *options;
+} NMDHCP6ConfigPrivate;
+
+
+enum {
+ PROP_0,
+ PROP_OPTIONS,
+
+ LAST_PROP
+};
+
+enum {
+ PROPERTIES_CHANGED,
+
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
+NMDHCP6Config *
+nm_dhcp6_config_new (void)
+{
+ return NM_DHCP6_CONFIG (g_object_new (NM_TYPE_DHCP6_CONFIG, NULL));
+}
+
+void
+nm_dhcp6_config_add_option (NMDHCP6Config *self,
+ const char *key,
+ const char *option)
+{
+ GValue *svalue;
+
+ g_return_if_fail (NM_IS_DHCP6_CONFIG (self));
+ g_return_if_fail (key != NULL);
+ g_return_if_fail (option != NULL);
+
+ svalue = g_slice_new0 (GValue);
+ g_value_init (svalue, G_TYPE_STRING);
+ g_value_set_string (svalue, option);
+ g_hash_table_insert (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, g_strdup (key), svalue);
+ g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS);
+}
+
+void
+nm_dhcp6_config_reset (NMDHCP6Config *self)
+{
+ g_return_if_fail (NM_IS_DHCP6_CONFIG (self));
+
+ g_hash_table_remove_all (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options);
+ g_object_notify (G_OBJECT (self), NM_DHCP6_CONFIG_OPTIONS);
+}
+
+const char *
+nm_dhcp6_config_get_option (NMDHCP6Config *self, const char *key)
+{
+ GValue *value;
+
+ g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);
+ g_return_val_if_fail (key != NULL, NULL);
+
+ value = g_hash_table_lookup (NM_DHCP6_CONFIG_GET_PRIVATE (self)->options, key);
+ return value ? g_value_get_string (value) : NULL;
+}
+
+const char *
+nm_dhcp6_config_get_dbus_path (NMDHCP6Config *self)
+{
+ g_return_val_if_fail (NM_IS_DHCP6_CONFIG (self), NULL);
+
+ return NM_DHCP6_CONFIG_GET_PRIVATE (self)->dbus_path;
+}
+
+static void
+nm_gvalue_destroy (gpointer data)
+{
+ GValue *value = (GValue *) data;
+
+ g_value_unset (value);
+ g_slice_free (GValue, value);
+}
+
+static void
+nm_dhcp6_config_init (NMDHCP6Config *self)
+{
+ NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self);
+ static guint32 counter = 0;
+ DBusGConnection *connection;
+ NMDBusManager *dbus_mgr;
+
+ dbus_mgr = nm_dbus_manager_get ();
+ connection = nm_dbus_manager_get_connection (dbus_mgr);
+ priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP6Config/%d", counter++);
+ dbus_g_connection_register_g_object (connection, priv->dbus_path, G_OBJECT (self));
+ g_object_unref (dbus_mgr);
+
+ priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
+}
+
+static void
+finalize (GObject *object)
+{
+ NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
+
+ g_free (priv->dbus_path);
+ g_hash_table_destroy (priv->options);
+
+ G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object);
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
+
+ switch (prop_id) {
+ case PROP_OPTIONS:
+ g_value_set_boxed (value, priv->options);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (config_class);
+
+ g_type_class_add_private (config_class, sizeof (NMDHCP6ConfigPrivate));
+
+ /* virtual methods */
+ object_class->get_property = get_property;
+ object_class->finalize = finalize;
+
+ /* properties */
+ g_object_class_install_property
+ (object_class, PROP_OPTIONS,
+ g_param_spec_boxed (NM_DHCP6_CONFIG_OPTIONS,
+ "Options",
+ "DHCP configuration options returned by the server",
+ DBUS_TYPE_G_MAP_OF_VARIANT,
+ G_PARAM_READABLE));
+
+ /* Signals */
+ signals[PROPERTIES_CHANGED] =
+ nm_properties_changed_signal_new (object_class,
+ G_STRUCT_OFFSET (NMDHCP6ConfigClass, properties_changed));
+
+ dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (config_class),
+ &dbus_glib_nm_dhcp6_config_object_info);
+}
diff --git a/src/nm-dhcp6-config.h b/src/nm-dhcp6-config.h
new file mode 100644
index 0000000000..90eb10ffb5
--- /dev/null
+++ b/src/nm-dhcp6-config.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ */
+
+#ifndef NM_DHCP6_CONFIG_H
+#define NM_DHCP6_CONFIG_H
+
+#include
+#include
+
+#define NM_TYPE_DHCP6_CONFIG (nm_dhcp6_config_get_type ())
+#define NM_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP6_CONFIG, NMDHCP6Config))
+#define NM_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP6_CONFIG, NMDHCP6ConfigClass))
+#define NM_IS_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP6_CONFIG))
+#define NM_IS_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DHCP6_CONFIG))
+#define NM_DHCP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP6_CONFIG, NMDHCP6ConfigClass))
+
+typedef struct {
+ GObject parent;
+} NMDHCP6Config;
+
+typedef struct {
+ GObjectClass parent;
+
+ /* Signals */
+ void (*properties_changed) (NMDHCP6Config *config, GHashTable *properties);
+} NMDHCP6ConfigClass;
+
+#define NM_DHCP6_CONFIG_OPTIONS "options"
+
+GType nm_dhcp6_config_get_type (void);
+
+NMDHCP6Config *nm_dhcp6_config_new (void);
+
+const char *nm_dhcp6_config_get_dbus_path (NMDHCP6Config *config);
+
+void nm_dhcp6_config_add_option (NMDHCP6Config *config,
+ const char *key,
+ const char *option);
+
+void nm_dhcp6_config_reset (NMDHCP6Config *config);
+
+const char *nm_dhcp6_config_get_option (NMDHCP6Config *config, const char *option);
+
+#endif /* NM_DHCP6_CONFIG_H */