about summary refs log tree commit diff
path: root/src/rdisc/nm-rdisc.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-07-06 03:04:17 +0200
committerMichael Biebl <biebl@debian.org>2014-07-06 03:04:17 +0200
commit3ce667b6ee6b86291bbe60ef93cba7f11a5c5400 (patch)
treeaf3daa7221e898b72f3de26eb2cf0c1b1c8661b0 /src/rdisc/nm-rdisc.h
parentf02d31d95af29678092d1ff01f714621bc9dcc0f (diff)
parent33491bc4279481db8ae47213e34a6d695a0e8830 (diff)
Merge tag 'upstream/0.9.10.0'
Upstream version 0.9.10.0
Diffstat (limited to 'src/rdisc/nm-rdisc.h')
-rw-r--r--src/rdisc/nm-rdisc.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/src/rdisc/nm-rdisc.h b/src/rdisc/nm-rdisc.h
new file mode 100644
index 00000000..fba06bc2
--- /dev/null
+++ b/src/rdisc/nm-rdisc.h
@@ -0,0 +1,139 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* nm-rdisc.h - Perform IPv6 router discovery
+ *
+ * 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, 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) 2013 Red Hat, Inc.
+ */
+
+#ifndef NM_RDISC_H
+#define NM_RDISC_H
+
+#include <glib-object.h>
+
+#include <stdlib.h>
+#include <netinet/in.h>
+
+#define NM_TYPE_RDISC            (nm_rdisc_get_type ())
+#define NM_RDISC(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_RDISC, NMRDisc))
+#define NM_RDISC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_RDISC, NMRDiscClass))
+#define NM_IS_RDISC(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_RDISC))
+#define NM_IS_RDISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_RDISC))
+#define NM_RDISC_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_RDISC, NMRDiscClass))
+
+#define NM_RDISC_CONFIG_CHANGED "config-changed"
+
+typedef enum {
+	NM_RDISC_DHCP_LEVEL_UNKNOWN,
+	NM_RDISC_DHCP_LEVEL_NONE,
+	NM_RDISC_DHCP_LEVEL_OTHERCONF,
+	NM_RDISC_DHCP_LEVEL_MANAGED
+} NMRDiscDHCPLevel;
+
+typedef enum {
+	NM_RDISC_PREFERENCE_INVALID,
+	NM_RDISC_PREFERENCE_LOW,
+	NM_RDISC_PREFERENCE_MEDIUM,
+	NM_RDISC_PREFERENCE_HIGH
+} NMRDiscPreference;
+
+typedef struct {
+	struct in6_addr address;
+	guint32 timestamp;
+	guint32 lifetime;
+	NMRDiscPreference preference;
+} NMRDiscGateway;
+
+typedef struct {
+	struct in6_addr address;
+	guint32 timestamp;
+	guint32 lifetime;
+	guint32 preferred;
+} NMRDiscAddress;
+
+typedef struct {
+	struct in6_addr network;
+	int plen;
+	struct in6_addr gateway;
+	guint32 timestamp;
+	guint32 lifetime;
+	NMRDiscPreference preference;
+} NMRDiscRoute;
+
+typedef struct {
+	struct in6_addr address;
+	guint32 timestamp;
+	guint32 lifetime;
+} NMRDiscDNSServer;
+
+typedef struct {
+	char *domain;
+	guint32 timestamp;
+	guint32 lifetime;
+} NMRDiscDNSDomain;
+
+typedef enum {
+	NM_RDISC_CONFIG_DHCP_LEVEL                          = 1 << 0,
+	NM_RDISC_CONFIG_GATEWAYS                            = 1 << 1,
+	NM_RDISC_CONFIG_ADDRESSES                           = 1 << 2,
+	NM_RDISC_CONFIG_ROUTES                              = 1 << 3,
+	NM_RDISC_CONFIG_DNS_SERVERS                         = 1 << 4,
+	NM_RDISC_CONFIG_DNS_DOMAINS                         = 1 << 5,
+	NM_RDISC_CONFIG_HOP_LIMIT                           = 1 << 6,
+} NMRDiscConfigMap;
+
+#define NM_RDISC_MAX_ADDRESSES_DEFAULT 16
+#define NM_RDISC_RTR_SOLICITATIONS_DEFAULT 3
+#define NM_RDISC_RTR_SOLICITATION_INTERVAL_DEFAULT 4
+
+/**
+ * NMRDisc:
+ * @ifindex: Interface index
+ *
+ * Interface-specific structure that handles incoming router advertisements,
+ * caches advertised items and removes them when they are obsolete.
+ */
+typedef struct {
+	GObject parent;
+
+	int ifindex;
+	char *ifname;
+	GBytes *lladdr;
+	gint32 max_addresses;
+	gint32 rtr_solicitations;
+	gint32 rtr_solicitation_interval;
+
+	NMRDiscDHCPLevel dhcp_level;
+	GArray *gateways;
+	GArray *addresses;
+	GArray *routes;
+	GArray *dns_servers;
+	GArray *dns_domains;
+	int hop_limit;
+} NMRDisc;
+
+typedef struct {
+	GObjectClass parent;
+
+	void (*start) (NMRDisc *rdisc);
+	void (*config_changed) (NMRDisc *rdisc, NMRDiscConfigMap changed);
+} NMRDiscClass;
+
+GType nm_rdisc_get_type (void);
+
+void nm_rdisc_set_lladdr (NMRDisc *rdisc, const char *addr, size_t addrlen);
+void nm_rdisc_start (NMRDisc *rdisc);
+
+#endif /* NM_RDISC_H */