about summary refs log tree commit diff
path: root/src/nm-netlink-utils.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-10-28 23:04:16 +0200
committerMichael Biebl <biebl@debian.org>2011-10-28 23:04:16 +0200
commit485d149fe80915d94ed49ea6c2c0552cf7a3e79a (patch)
tree6a48492b46b8c1e3df1c58626c28f05a978c61f7 /src/nm-netlink-utils.h
parent263bf4c0c89bb88dc995acd9a6a2de9095fbd461 (diff)
Imported Upstream version 0.9.1.95 upstream/0.9.1.95
Diffstat (limited to 'src/nm-netlink-utils.h')
-rw-r--r--src/nm-netlink-utils.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/nm-netlink-utils.h b/src/nm-netlink-utils.h
new file mode 100644
index 00000000..c6c452a0
--- /dev/null
+++ b/src/nm-netlink-utils.h
@@ -0,0 +1,80 @@
+/* -*- 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) 2011 Red Hat, Inc.
+ */
+
+#ifndef NM_NETLINK_UTILS_H
+#define NM_NETLINK_UTILS_H
+
+#include <glib.h>
+#include <netlink/route/rtnl.h>
+#include <netlink/route/route.h>
+
+gboolean nm_netlink_find_address (int ifindex,
+                                  int family,
+                                  void *addr,  /* struct in_addr or struct in6_addr */
+                                  int prefix_);
+
+typedef enum {
+	NMNL_PROP_INVALID = 0,
+	NMNL_PROP_PROT,
+	NMNL_PROP_SCOPE,
+	NMNL_PROP_TABLE,
+	NMNL_PROP_PRIO,
+} NmNlProp;
+
+struct rtnl_route * nm_netlink_route_new (int ifindex,
+                                          int family,
+                                          int mss,
+                                          ...) __attribute__((__sentinel__));
+
+int nm_netlink_route_add (struct rtnl_route *route,
+                          int family,
+                          const void * dst, /* struct in_addr or struct in6_addr */
+                          int prefix,
+                          const void * gw, /* struct in_addr or struct in6_addr */
+                          int flags);
+
+gboolean nm_netlink_route_delete (struct rtnl_route *route);
+
+/**
+ * NlRouteForeachFunc:
+ * @route: the route being processed
+ * @dst: the route's destination address
+ * @iface: the interface name of the index passed to nm_netlink_foreach_route()
+ * @in_family: the address family passed to nm_netlink_foreach_route()
+ * @user_data: the user data pointer passed to nm_netlink_foreach_route()
+ *
+ * Returns: a route to return to the caller of nm_netlink_foreach_route() which
+ * terminates routing table iteration, or NULL to continue iterating the
+ * routing table.
+ **/
+typedef struct rtnl_route * (*NlRouteForeachFunc) (struct rtnl_route *route,
+                                                   struct nl_addr *dst,
+                                                   const char *iface,
+                                                   gpointer user_data);
+
+struct rtnl_route * nm_netlink_foreach_route (int ifindex,
+                                              int family,
+                                              int scope,
+                                              gboolean ignore_inet6_ll_mc,
+                                              NlRouteForeachFunc callback,
+                                              gpointer user_data);
+
+#endif  /* NM_NETLINK_MONITOR_H */
+