summaryrefslogtreecommitdiffstats
path: root/include/netlink/route
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-02-14 13:27:00 -0800
committerJP Abgrall <jpa@google.com>2014-02-14 13:27:00 -0800
commit823435f737de20d5ca9f4aa2ba0ae2950dbb5d4f (patch)
treee146cd87948eb11eb195d463b49dc8b1bdeb0db0 /include/netlink/route
parent0021213ea39d6a889b6ed6e24dc1c2142ae175bf (diff)
parent515d3af751f58f1645d09f0a750b759cdc7820c3 (diff)
downloadandroid_external_libnl-823435f737de20d5ca9f4aa2ba0ae2950dbb5d4f.tar.gz
android_external_libnl-823435f737de20d5ca9f4aa2ba0ae2950dbb5d4f.tar.bz2
android_external_libnl-823435f737de20d5ca9f4aa2ba0ae2950dbb5d4f.zip
Merge remote-tracking branch 'upstream_linaro/linaro-libnl2_0'
* upstream_linaro/linaro-libnl2_0: (159 commits) Updating group definition to follow 3.13 kernel Adding version.h Adding support for netlink API and quota in nfaccounting Compile 2.0 with Kitkat Don't include pktloc_syntax.h in BUILT_SOURCES route_obj: don't add empty destination to nlmsg automake: add ${top_builddir}/include to AM_CFLAGS Use CPPFLAGS Put preprocessor definitions in AM_CPPFLAGS add user data to change_func_t for caches Trivial fix for TBF memleak libnl: optionally disable cli tools. Ignore vim swap files Let git ignore generated pktloc source files Fix compile warning in utils.c Fix compile warning in nl.c Packet Location Interface src/nf-queue.c: cleanup and improve performance of test program for NF_QUEUE Don't install private header files. object: fix attribute comparison ... Conflicts: Android.mk include/linux/netfilter/nfnetlink.h Change-Id: I383749ca16113b2ae8cfc7729aee8bbc8a36dc9e
Diffstat (limited to 'include/netlink/route')
-rw-r--r--include/netlink/route/addr.h86
-rw-r--r--include/netlink/route/class-modules.h4
-rw-r--r--include/netlink/route/class.h21
-rw-r--r--include/netlink/route/classifier-modules.h16
-rw-r--r--include/netlink/route/classifier.h40
-rw-r--r--include/netlink/route/cls/basic.h33
-rw-r--r--include/netlink/route/cls/cgroup.h31
-rw-r--r--include/netlink/route/cls/ematch.h73
-rw-r--r--include/netlink/route/cls/ematch/cmp.h31
-rw-r--r--include/netlink/route/link.h136
-rw-r--r--include/netlink/route/link/info-api.h4
-rw-r--r--include/netlink/route/neighbour.h42
-rw-r--r--include/netlink/route/neightbl.h11
-rw-r--r--include/netlink/route/nexthop.h32
-rw-r--r--include/netlink/route/pktloc.h44
-rw-r--r--include/netlink/route/qdisc-modules.h6
-rw-r--r--include/netlink/route/qdisc.h96
-rw-r--r--include/netlink/route/route.h157
-rw-r--r--include/netlink/route/rtnl.h6
-rw-r--r--include/netlink/route/rule.h23
-rw-r--r--include/netlink/route/sch/htb.h6
-rw-r--r--include/netlink/route/sch/netem.h13
22 files changed, 563 insertions, 348 deletions
diff --git a/include/netlink/route/addr.h b/include/netlink/route/addr.h
index 71a90e0..1381486 100644
--- a/include/netlink/route/addr.h
+++ b/include/netlink/route/addr.h
@@ -6,8 +6,8 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
- * Baruch Even <baruch@ev-en.org>,
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org>,
* Mediatrix Telecom, inc. <ericb@mediatrix.com>
*/
@@ -26,63 +26,63 @@ struct rtnl_addr;
/* General */
extern struct rtnl_addr *rtnl_addr_alloc(void);
-extern void rtnl_addr_put(struct rtnl_addr *);
+extern void rtnl_addr_put(struct rtnl_addr *);
-extern struct nl_cache *rtnl_addr_alloc_cache(struct nl_handle *);
+extern int rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **);
-/* Address Addition */
-extern struct nl_msg * rtnl_addr_build_add_request(struct rtnl_addr *, int);
-extern int rtnl_addr_add(struct nl_handle *, struct rtnl_addr *,
- int);
+extern int rtnl_addr_build_add_request(struct rtnl_addr *, int,
+ struct nl_msg **);
+extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int);
-/* Address Deletion */
-extern struct nl_msg * rtnl_addr_build_delete_request(struct rtnl_addr *, int);
-extern int rtnl_addr_delete(struct nl_handle *,
- struct rtnl_addr *, int);
+extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int,
+ struct nl_msg **);
+extern int rtnl_addr_delete(struct nl_sock *,
+ struct rtnl_addr *, int);
-/* Address Flags Translations */
-extern char * rtnl_addr_flags2str(int, char *, size_t);
-extern int rtnl_addr_str2flags(const char *);
+extern char * rtnl_addr_flags2str(int, char *, size_t);
+extern int rtnl_addr_str2flags(const char *);
-/* Attribute Access */
-extern void rtnl_addr_set_label(struct rtnl_addr *, const char *);
-extern char * rtnl_addr_get_label(struct rtnl_addr *);
+extern int rtnl_addr_set_label(struct rtnl_addr *, const char *);
+extern char * rtnl_addr_get_label(struct rtnl_addr *);
-extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int);
-extern int rtnl_addr_get_ifindex(struct rtnl_addr *);
+extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int);
+extern int rtnl_addr_get_ifindex(struct rtnl_addr *);
-extern void rtnl_addr_set_family(struct rtnl_addr *, int);
-extern int rtnl_addr_get_family(struct rtnl_addr *);
+extern void rtnl_addr_set_family(struct rtnl_addr *, int);
+extern int rtnl_addr_get_family(struct rtnl_addr *);
-extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int);
-extern int rtnl_addr_get_prefixlen(struct rtnl_addr *);
+extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int);
+extern int rtnl_addr_get_prefixlen(struct rtnl_addr *);
-extern void rtnl_addr_set_scope(struct rtnl_addr *, int);
-extern int rtnl_addr_get_scope(struct rtnl_addr *);
+extern void rtnl_addr_set_scope(struct rtnl_addr *, int);
+extern int rtnl_addr_get_scope(struct rtnl_addr *);
-extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int);
-extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int);
-extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *);
+extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int);
+extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int);
+extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *);
-extern int rtnl_addr_set_local(struct rtnl_addr *,
+extern int rtnl_addr_set_local(struct rtnl_addr *,
struct nl_addr *);
-extern struct nl_addr * rtnl_addr_get_local(struct rtnl_addr *);
+extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *);
-extern int rtnl_addr_set_peer(struct rtnl_addr *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_addr_get_peer(struct rtnl_addr *);
+extern int rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *);
+extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *);
-extern int rtnl_addr_set_broadcast(struct rtnl_addr *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_addr_get_broadcast(struct rtnl_addr *);
+extern int rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *);
+extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *);
-extern int rtnl_addr_set_anycast(struct rtnl_addr *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_addr_get_anycast(struct rtnl_addr *);
+extern int rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *);
+extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *);
-extern int rtnl_addr_set_multicast(struct rtnl_addr *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_addr_get_multicast(struct rtnl_addr *);
+extern int rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *);
+extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *);
+
+extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *);
+extern void rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t);
+extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *);
+extern void rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t);
+extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *);
+extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/class-modules.h b/include/netlink/route/class-modules.h
index 2400a60..74a25c9 100644
--- a/include/netlink/route/class-modules.h
+++ b/include/netlink/route/class-modules.h
@@ -32,8 +32,8 @@ struct rtnl_class_ops
/**
* Dump callbacks
*/
- int (*co_dump[NL_DUMP_MAX+1])(struct rtnl_class *,
- struct nl_dump_params *, int);
+ void (*co_dump[NL_DUMP_MAX+1])(struct rtnl_class *,
+ struct nl_dump_params *);
/**
* Must return the contents supposed to be in TCA_OPTIONS
diff --git a/include/netlink/route/class.h b/include/netlink/route/class.h
index a624ef6..480095e 100644
--- a/include/netlink/route/class.h
+++ b/include/netlink/route/class.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLASS_H_
@@ -24,20 +24,25 @@ struct rtnl_class;
extern struct nl_object_ops class_obj_ops;
-/* General */
extern struct rtnl_class * rtnl_class_alloc(void);
-extern void rtnl_class_put(struct rtnl_class *);
-extern struct nl_cache * rtnl_class_alloc_cache(struct nl_handle *, int);
+extern void rtnl_class_put(struct rtnl_class *);
+extern int rtnl_class_alloc_cache(struct nl_sock *, int,
+ struct nl_cache **);
+extern struct rtnl_class *rtnl_class_get(struct nl_cache *, int, uint32_t);
/* leaf qdisc access */
extern struct rtnl_qdisc * rtnl_class_leaf_qdisc(struct rtnl_class *,
struct nl_cache *);
-/* class addition */
-extern struct nl_msg * rtnl_class_build_add_request(struct rtnl_class *, int);
-extern int rtnl_class_add(struct nl_handle *, struct rtnl_class *, int);
+extern int rtnl_class_build_add_request(struct rtnl_class *, int,
+ struct nl_msg **);
+extern int rtnl_class_add(struct nl_sock *, struct rtnl_class *,
+ int);
+
+extern int rtnl_class_build_delete_request(struct rtnl_class *,
+ struct nl_msg **);
+extern int rtnl_class_delete(struct nl_sock *, struct rtnl_class *);
-/* attribute modification */
extern void rtnl_class_set_ifindex(struct rtnl_class *, int);
extern int rtnl_class_get_ifindex(struct rtnl_class *);
extern void rtnl_class_set_handle(struct rtnl_class *, uint32_t);
diff --git a/include/netlink/route/classifier-modules.h b/include/netlink/route/classifier-modules.h
index 8c31e67..35cb06e 100644
--- a/include/netlink/route/classifier-modules.h
+++ b/include/netlink/route/classifier-modules.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLASS_MODULES_H_
@@ -25,19 +25,25 @@ extern "C" {
struct rtnl_cls_ops
{
/**
- * Kind/Name of classifier
+ * Name of classifier module
*/
char co_kind[32];
+
+ /**
+ * Size of private classifier data
+ */
+ size_t co_size;
+
/**
* Dump callbacks
*/
- int (*co_dump[NL_DUMP_MAX+1])(struct rtnl_cls *,
- struct nl_dump_params *, int);
+ void (*co_dump[NL_DUMP_MAX+1])(struct rtnl_cls *,
+ struct nl_dump_params *);
/**
* Must return the contents supposed to be in TCA_OPTIONS
*/
- struct nl_msg *(*co_get_opts)(struct rtnl_cls *);
+ int (*co_get_opts)(struct rtnl_cls *, struct nl_msg *);
/**
* TCA_OPTIONS message parser
diff --git a/include/netlink/route/classifier.h b/include/netlink/route/classifier.h
index 7ef0da4..d9c3d21 100644
--- a/include/netlink/route/classifier.h
+++ b/include/netlink/route/classifier.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLASSIFIER_H_
@@ -23,31 +23,37 @@ extern "C" {
extern struct nl_object_ops cls_obj_ops;
-extern struct rtnl_cls *rtnl_cls_alloc(void);
-extern void rtnl_cls_put(struct rtnl_cls *);
+extern struct rtnl_cls *rtnl_cls_alloc(void);
+extern void rtnl_cls_put(struct rtnl_cls *);
-extern struct nl_cache *rtnl_cls_alloc_cache(struct nl_handle *, int, uint32_t);
+extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t,
+ struct nl_cache **);
-/* classifier addition */
-extern int rtnl_cls_add(struct nl_handle *, struct rtnl_cls *,
- int);
-extern struct nl_msg * rtnl_cls_build_add_request(struct rtnl_cls *, int);
+extern int rtnl_cls_build_add_request(struct rtnl_cls *, int,
+ struct nl_msg **);
+extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int);
-extern struct nl_msg *rtnl_cls_build_change_request(struct rtnl_cls *, int);
-extern struct nl_msg *rtnl_cls_build_delete_request(struct rtnl_cls *, int);
-extern int rtnl_cls_delete(struct nl_handle *, struct rtnl_cls *, int);
+extern int rtnl_cls_build_change_request(struct rtnl_cls *, int,
+ struct nl_msg **);
+extern int rtnl_cls_build_delete_request(struct rtnl_cls *, int,
+ struct nl_msg **);
+extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *, int);
-/* attribute modification */
extern void rtnl_cls_set_ifindex(struct rtnl_cls *, int);
+extern int rtnl_cls_get_ifindex(struct rtnl_cls *);
extern void rtnl_cls_set_handle(struct rtnl_cls *, uint32_t);
extern void rtnl_cls_set_parent(struct rtnl_cls *, uint32_t);
-extern void rtnl_cls_set_kind(struct rtnl_cls *, const char *);
+extern uint32_t rtnl_cls_get_parent(struct rtnl_cls *);
+extern int rtnl_cls_set_kind(struct rtnl_cls *, const char *);
+extern struct rtnl_cls_ops *rtnl_cls_get_ops(struct rtnl_cls *);
-extern void rtnl_cls_set_prio(struct rtnl_cls *, int);
-extern int rtnl_cls_get_prio(struct rtnl_cls *);
+extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t);
+extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *);
-extern void rtnl_cls_set_protocol(struct rtnl_cls *, int);
-extern int rtnl_cls_get_protocol(struct rtnl_cls *);
+extern void rtnl_cls_set_protocol(struct rtnl_cls *, uint16_t);
+extern uint16_t rtnl_cls_get_protocol(struct rtnl_cls *);
+
+extern void *rtnl_cls_data(struct rtnl_cls *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/cls/basic.h b/include/netlink/route/cls/basic.h
new file mode 100644
index 0000000..7003124
--- /dev/null
+++ b/include/netlink/route/cls/basic.h
@@ -0,0 +1,33 @@
+/*
+ * netlink/route/cls/basic.h Basic Classifier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_BASIC_H_
+#define NETLINK_BASIC_H_
+
+#include <netlink/netlink.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct rtnl_cls_ops *rtnl_basic_get_ops(void);
+extern int rtnl_basic_set_classid(struct rtnl_cls *, uint32_t);
+extern uint32_t rtnl_basic_get_classid(struct rtnl_cls *);
+extern int rtnl_basic_set_ematch(struct rtnl_cls *,
+ struct rtnl_ematch_tree *);
+extern struct rtnl_ematch_tree *
+ rtnl_basic_get_ematch(struct rtnl_cls *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/cls/cgroup.h b/include/netlink/route/cls/cgroup.h
new file mode 100644
index 0000000..7b0e3d3
--- /dev/null
+++ b/include/netlink/route/cls/cgroup.h
@@ -0,0 +1,31 @@
+/*
+ * netlink/route/cls/cgroup.h Control Groups Classifier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2009 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_CLS_CGROUP_H_
+#define NETLINK_CLS_CGROUP_H_
+
+#include <netlink/netlink.h>
+#include <netlink/cache.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int rtnl_cgroup_set_ematch(struct rtnl_cls *,
+ struct rtnl_ematch_tree *);
+extern struct rtnl_ematch_tree *
+ rtnl_cgroup_get_ematch(struct rtnl_cls *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/cls/ematch.h b/include/netlink/route/cls/ematch.h
new file mode 100644
index 0000000..c4292bf
--- /dev/null
+++ b/include/netlink/route/cls/ematch.h
@@ -0,0 +1,73 @@
+/*
+ * netlink/route/cls/ematch.h Extended Matches
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_CLS_EMATCH_H_
+#define NETLINK_CLS_EMATCH_H_
+
+#include <netlink/netlink.h>
+#include <netlink/route/classifier.h>
+#include <linux/pkt_cls.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct rtnl_ematch;
+struct rtnl_ematch_tree;
+
+struct rtnl_ematch_ops
+{
+ int eo_kind;
+ const char * eo_name;
+ size_t eo_datalen;
+
+ int (*eo_parse)(struct rtnl_ematch *,
+ void *, size_t);
+ void (*eo_dump)(struct rtnl_ematch *,
+ struct nl_dump_params *);
+ struct nl_list_head eo_list;
+};
+
+extern int rtnl_ematch_register(struct rtnl_ematch_ops *);
+extern int rtnl_ematch_unregister(struct rtnl_ematch_ops *);
+
+extern struct rtnl_ematch_ops *
+ rtnl_ematch_lookup_ops(int);
+extern struct rtnl_ematch_ops *
+ rtnl_ematch_lookup_ops_name(const char *);
+
+extern struct rtnl_ematch *
+ rtnl_ematch_alloc(struct rtnl_ematch_ops *);
+extern void rtnl_ematch_add_child(struct rtnl_ematch *,
+ struct rtnl_ematch *);
+extern void rtnl_ematch_unlink(struct rtnl_ematch *);
+extern void rtnl_ematch_free(struct rtnl_ematch *);
+
+extern void * rtnl_ematch_data(struct rtnl_ematch *);
+extern void rtnl_ematch_set_flags(struct rtnl_ematch *, uint16_t);
+extern void rtnl_ematch_unset_flags(struct rtnl_ematch *, uint16_t);
+extern uint16_t rtnl_ematch_get_flags(struct rtnl_ematch *);
+
+extern struct rtnl_ematch_tree *
+ rtnl_ematch_tree_alloc(uint16_t);
+extern void rtnl_ematch_tree_free(struct rtnl_ematch_tree *);
+
+extern int rtnl_ematch_parse(struct nlattr *, struct rtnl_ematch_tree **);
+extern void rtnl_ematch_tree_add_tail(struct rtnl_ematch_tree *,
+ struct rtnl_ematch *);
+extern void rtnl_ematch_tree_dump(struct rtnl_ematch_tree *,
+ struct nl_dump_params *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/cls/ematch/cmp.h b/include/netlink/route/cls/ematch/cmp.h
new file mode 100644
index 0000000..b4ad03a
--- /dev/null
+++ b/include/netlink/route/cls/ematch/cmp.h
@@ -0,0 +1,31 @@
+/*
+ * netlink/route/cls/ematch/cmp.h Simple Comparison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_CLS_EMATCH_CMP_H_
+#define NETLINK_CLS_EMATCH_CMP_H_
+
+#include <netlink/netlink.h>
+#include <netlink/route/cls/ematch.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void rtnl_ematch_cmp_set(struct rtnl_ematch *,
+ struct tcf_em_cmp *);
+extern struct tcf_em_cmp *
+ rtnl_ematch_cmp_get(struct rtnl_ematch *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h
index caaa792..4b630f7 100644
--- a/include/netlink/route/link.h
+++ b/include/netlink/route/link.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_H_
@@ -51,116 +51,92 @@ enum rtnl_link_st {
#define RTNL_LINK_STATS_MAX (__RTNL_LINK_STATS_MAX - 1)
-/**
- * Special interface index stating the link was not found.
- * @ingroup link
- */
-#define RTNL_LINK_NOT_FOUND -1
-
/* link object allocation/freeage */
-extern struct rtnl_link * rtnl_link_alloc(void);
-extern void rtnl_link_put(struct rtnl_link *);
-extern void rtnl_link_free(struct rtnl_link *);
+extern struct rtnl_link *rtnl_link_alloc(void);
+extern void rtnl_link_put(struct rtnl_link *);
+extern void rtnl_link_free(struct rtnl_link *);
/* link cache management */
-extern struct nl_cache * rtnl_link_alloc_cache(struct nl_handle *);
-extern struct rtnl_link * rtnl_link_get(struct nl_cache *, int);
-extern struct rtnl_link * rtnl_link_get_by_name(struct nl_cache *,
- const char *);
+extern int rtnl_link_alloc_cache(struct nl_sock *, struct nl_cache **);
+extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int);
+extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *);
-/* Link Modifications */
-extern struct nl_msg * rtnl_link_build_change_request(struct rtnl_link *,
- struct rtnl_link *,
- int);
-extern int rtnl_link_change(struct nl_handle *,
- struct rtnl_link *,
- struct rtnl_link *, int);
+extern int rtnl_link_build_change_request(struct rtnl_link *,
+ struct rtnl_link *, int,
+ struct nl_msg **);
+extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *,
+ struct rtnl_link *, int);
/* Name <-> Index Translations */
-extern char * rtnl_link_i2name(struct nl_cache *, int,
- char *, size_t);
-extern int rtnl_link_name2i(struct nl_cache *,
- const char *);
+extern char * rtnl_link_i2name(struct nl_cache *, int, char *, size_t);
+extern int rtnl_link_name2i(struct nl_cache *, const char *);
/* Name <-> Statistic Translations */
-extern char * rtnl_link_stat2str(int, char *, size_t);
-extern int rtnl_link_str2stat(const char *);
+extern char * rtnl_link_stat2str(int, char *, size_t);
+extern int rtnl_link_str2stat(const char *);
/* Link Flags Translations */
-extern char * rtnl_link_flags2str(int, char *, size_t);
-extern int rtnl_link_str2flags(const char *);
+extern char * rtnl_link_flags2str(int, char *, size_t);
+extern int rtnl_link_str2flags(const char *);
-extern char * rtnl_link_operstate2str(int, char *, size_t);
-extern int rtnl_link_str2operstate(const char *);
+extern char * rtnl_link_operstate2str(int, char *, size_t);
+extern int rtnl_link_str2operstate(const char *);
-extern char * rtnl_link_mode2str(int, char *, size_t);
-extern int rtnl_link_str2mode(const char *);
+extern char * rtnl_link_mode2str(int, char *, size_t);
+extern int rtnl_link_str2mode(const char *);
/* Access Functions */
-extern void rtnl_link_set_qdisc(struct rtnl_link *,
- const char *);
-extern char * rtnl_link_get_qdisc(struct rtnl_link *);
+extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *);
+extern char * rtnl_link_get_qdisc(struct rtnl_link *);
-extern void rtnl_link_set_name(struct rtnl_link *,
- const char *);
-extern char * rtnl_link_get_name(struct rtnl_link *);
+extern void rtnl_link_set_name(struct rtnl_link *, const char *);
+extern char * rtnl_link_get_name(struct rtnl_link *);
-extern void rtnl_link_set_flags(struct rtnl_link *,
- unsigned int);
-extern void rtnl_link_unset_flags(struct rtnl_link *,
- unsigned int);
-extern unsigned int rtnl_link_get_flags(struct rtnl_link *);
+extern void rtnl_link_set_flags(struct rtnl_link *, unsigned int);
+extern void rtnl_link_unset_flags(struct rtnl_link *, unsigned int);
+extern unsigned int rtnl_link_get_flags(struct rtnl_link *);
-extern void rtnl_link_set_mtu(struct rtnl_link *,
- unsigned int);
-extern unsigned int rtnl_link_get_mtu(struct rtnl_link *);
+extern void rtnl_link_set_mtu(struct rtnl_link *, unsigned int);
+extern unsigned int rtnl_link_get_mtu(struct rtnl_link *);
-extern void rtnl_link_set_txqlen(struct rtnl_link *,
- unsigned int);
-extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *);
+extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int);
+extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *);
-extern void rtnl_link_set_weight(struct rtnl_link *,
- unsigned int);
-extern unsigned int rtnl_link_get_weight(struct rtnl_link *);
+extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int);
+extern unsigned int rtnl_link_get_weight(struct rtnl_link *);
-extern void rtnl_link_set_ifindex(struct rtnl_link *, int);
-extern int rtnl_link_get_ifindex(struct rtnl_link *);
+extern void rtnl_link_set_ifindex(struct rtnl_link *, int);
+extern int rtnl_link_get_ifindex(struct rtnl_link *);
-extern void rtnl_link_set_family(struct rtnl_link *, int);
-extern int rtnl_link_get_family(struct rtnl_link *);
+extern void rtnl_link_set_family(struct rtnl_link *, int);
+extern int rtnl_link_get_family(struct rtnl_link *);
-extern void rtnl_link_set_arptype(struct rtnl_link *,
- unsigned int);
-extern unsigned int rtnl_link_get_arptype(struct rtnl_link *);
+extern void rtnl_link_set_arptype(struct rtnl_link *, unsigned int);
+extern unsigned int rtnl_link_get_arptype(struct rtnl_link *);
-extern void rtnl_link_set_addr(struct rtnl_link *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_link_get_addr(struct rtnl_link *);
+extern void rtnl_link_set_addr(struct rtnl_link *, struct nl_addr *);
+extern struct nl_addr *rtnl_link_get_addr(struct rtnl_link *);
-extern void rtnl_link_set_broadcast(struct rtnl_link *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_link_get_broadcast(struct rtnl_link *);
+extern void rtnl_link_set_broadcast(struct rtnl_link *, struct nl_addr *);
+extern struct nl_addr *rtnl_link_get_broadcast(struct rtnl_link *);
-extern void rtnl_link_set_link(struct rtnl_link *, int);
-extern int rtnl_link_get_link(struct rtnl_link *);
+extern void rtnl_link_set_link(struct rtnl_link *, int);
+extern int rtnl_link_get_link(struct rtnl_link *);
-extern void rtnl_link_set_master(struct rtnl_link *, int);
-extern int rtnl_link_get_master(struct rtnl_link *);
+extern void rtnl_link_set_master(struct rtnl_link *, int);
+extern int rtnl_link_get_master(struct rtnl_link *);
-extern void rtnl_link_set_operstate(struct rtnl_link *,
- uint8_t);
-extern uint8_t rtnl_link_get_operstate(struct rtnl_link *);
+extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t);
+extern uint8_t rtnl_link_get_operstate(struct rtnl_link *);
-extern void rtnl_link_set_linkmode(struct rtnl_link *,
- uint8_t);
-extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *);
+extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t);
+extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *);
-extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int);
+extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int);
-extern int rtnl_link_set_info_type(struct rtnl_link *,
- const char *);
-extern char * rtnl_link_get_info_type(struct rtnl_link *);
+extern int rtnl_link_set_info_type(struct rtnl_link *, const char *);
+extern char * rtnl_link_get_info_type(struct rtnl_link *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/link/info-api.h b/include/netlink/route/link/info-api.h
index 2ccce9d..7e18e31 100644
--- a/include/netlink/route/link/info-api.h
+++ b/include/netlink/route/link/info-api.h
@@ -45,8 +45,8 @@ struct rtnl_link_info_ops
/** Called when the link object is dumped.
* Must dump the info type specific attributes. */
- int (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *,
- struct nl_dump_params *, int);
+ void (*io_dump[NL_DUMP_MAX+1])(struct rtnl_link *,
+ struct nl_dump_params *);
/** Called when a link object is cloned.
* Must clone all info type specific attributes. */
diff --git a/include/netlink/route/neighbour.h b/include/netlink/route/neighbour.h
index 078c3f4..698539a 100644
--- a/include/netlink/route/neighbour.h
+++ b/include/netlink/route/neighbour.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NEIGHBOUR_H_
@@ -22,39 +22,27 @@ extern "C" {
struct rtnl_neigh;
-/* neighbour object allocation/freeage */
-extern struct rtnl_neigh * rtnl_neigh_alloc(void);
-extern void rtnl_neigh_put(struct rtnl_neigh *);
+extern struct rtnl_neigh *rtnl_neigh_alloc(void);
+extern void rtnl_neigh_put(struct rtnl_neigh *);
-/* neighbour cache management */
-extern struct nl_cache * rtnl_neigh_alloc_cache(struct nl_handle *);
-extern struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *, int,
+extern int rtnl_neigh_alloc_cache(struct nl_sock *, struct nl_cache **);
+extern struct rtnl_neigh *rtnl_neigh_get(struct nl_cache *, int,
struct nl_addr *);
-/* Neigbour state translations */
-extern char * rtnl_neigh_state2str(int, char *, size_t);
-extern int rtnl_neigh_str2state(const char *);
+extern char * rtnl_neigh_state2str(int, char *, size_t);
+extern int rtnl_neigh_str2state(const char *);
-/* Neighbour flags translations */
-extern char * rtnl_neigh_flags2str(int, char *, size_t);
-extern int rtnl_neigh_str2flag(const char *);
+extern char * rtnl_neigh_flags2str(int, char *, size_t);
+extern int rtnl_neigh_str2flag(const char *);
-/* Neighbour Addition */
-extern int rtnl_neigh_add(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_add_request(struct rtnl_neigh *, int);
+extern int rtnl_neigh_add(struct nl_sock *, struct rtnl_neigh *, int);
+extern int rtnl_neigh_build_add_request(struct rtnl_neigh *, int,
+ struct nl_msg **);
-/* Neighbour Modification */
-extern int rtnl_neigh_change(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_change_request(struct rtnl_neigh *, int);
+extern int rtnl_neigh_delete(struct nl_sock *, struct rtnl_neigh *, int);
+extern int rtnl_neigh_build_delete_request(struct rtnl_neigh *, int,
+ struct nl_msg **);
-/* Neighbour Deletion */
-extern int rtnl_neigh_delete(struct nl_handle *,
- struct rtnl_neigh *, int);
-extern struct nl_msg * rtnl_neigh_build_delete_request(struct rtnl_neigh *, int);
-
-/* Access functions */
extern void rtnl_neigh_set_state(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_state(struct rtnl_neigh *);
extern void rtnl_neigh_unset_state(struct rtnl_neigh *,
diff --git a/include/netlink/route/neightbl.h b/include/netlink/route/neightbl.h
index 20285ee..412c3e9 100644
--- a/include/netlink/route/neightbl.h
+++ b/include/netlink/route/neightbl.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NEIGHTBL_H_
@@ -25,15 +25,16 @@ struct rtnl_neightbl;
extern struct rtnl_neightbl *rtnl_neightbl_alloc(void);
extern void rtnl_neightbl_put(struct rtnl_neightbl *);
extern void rtnl_neightbl_free(struct rtnl_neightbl *);
-extern struct nl_cache *rtnl_neightbl_alloc_cache(struct nl_handle *);
+extern int rtnl_neightbl_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct rtnl_neightbl *rtnl_neightbl_get(struct nl_cache *,
const char *, int);
extern void rtnl_neightbl_dump(struct rtnl_neightbl *, FILE *,
struct nl_dump_params *);
-extern struct nl_msg *rtnl_neightbl_build_change_request(struct rtnl_neightbl *,
- struct rtnl_neightbl *);
-extern int rtnl_neightbl_change(struct nl_handle *, struct rtnl_neightbl *,
+extern int rtnl_neightbl_build_change_request(struct rtnl_neightbl *,
+ struct rtnl_neightbl *,
+ struct nl_msg **);
+extern int rtnl_neightbl_change(struct nl_sock *, struct rtnl_neightbl *,
struct rtnl_neightbl *);
extern void rtnl_neightbl_set_family(struct rtnl_neightbl *, int);
diff --git a/include/netlink/route/nexthop.h b/include/netlink/route/nexthop.h
index 984f4b5..2aa44dc 100644
--- a/include/netlink/route/nexthop.h
+++ b/include/netlink/route/nexthop.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ROUTE_NEXTHOP_H_
@@ -21,18 +21,42 @@ extern "C" {
struct rtnl_nexthop;
-extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
-extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
+enum {
+ NH_DUMP_FROM_ONELINE = -2,
+ NH_DUMP_FROM_DETAILS = -1,
+ NH_DUMP_FROM_ENV = 0,
+ /* > 0 reserved for nexthop index */
+};
+
+extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
+extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
extern void rtnl_route_nh_free(struct rtnl_nexthop *);
-extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, int);
+
+extern int rtnl_route_nh_compare(struct rtnl_nexthop *,
+ struct rtnl_nexthop *,
+ uint32_t, int);
+
+extern void rtnl_route_nh_dump(struct rtnl_nexthop *,
+ struct nl_dump_params *);
+
+extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
+extern uint8_t rtnl_route_nh_get_weight(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
+extern int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
struct nl_addr *);
+extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_flags(struct rtnl_nexthop *,
unsigned int);
extern void rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
unsigned int);
extern unsigned int rtnl_route_nh_get_flags(struct rtnl_nexthop *);
+extern void rtnl_route_nh_set_realms(struct rtnl_nexthop *,
+ uint32_t);
+extern uint32_t rtnl_route_nh_get_realms(struct rtnl_nexthop *);
+
+extern char * rtnl_route_nh_flags2str(int, char *, size_t);
+extern int rtnl_route_nh_str2flags(const char *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/pktloc.h b/include/netlink/route/pktloc.h
new file mode 100644
index 0000000..28e1dc2
--- /dev/null
+++ b/include/netlink/route/pktloc.h
@@ -0,0 +1,44 @@
+/*
+ * netlink/route/pktloc.h Packet Location Aliasing
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_PKTLOC_H_
+#define NETLINK_PKTLOC_H_
+
+#include <netlink/netlink.h>
+#include <netlink/cache.h>
+#include <netlink/route/tc.h>
+
+#include <linux/tc_ematch/tc_em_cmp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct rtnl_pktloc
+{
+ char * name;
+ uint8_t align:4;
+ uint8_t layer:4;
+ uint8_t flags;
+ uint16_t offset;
+ uint32_t mask;
+
+ struct nl_list_head list;
+};
+
+extern int rtnl_pktloc_lookup(const char *, struct rtnl_pktloc **);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/qdisc-modules.h b/include/netlink/route/qdisc-modules.h
index 802eac4..769625e 100644
--- a/include/netlink/route/qdisc-modules.h
+++ b/include/netlink/route/qdisc-modules.h
@@ -32,14 +32,16 @@ struct rtnl_qdisc_ops
/**
* Dump callbacks
*/
- int (*qo_dump[NL_DUMP_MAX+1])(struct rtnl_qdisc *,
- struct nl_dump_params *, int);
+ void (*qo_dump[NL_DUMP_MAX+1])(struct rtnl_qdisc *,
+ struct nl_dump_params *);
/**
* Must return the contents supposed to be in TCA_OPTIONS
*/
struct nl_msg *(*qo_get_opts)(struct rtnl_qdisc *);
+ int (*qo_build_msg)(struct rtnl_qdisc *, struct nl_msg *);
+
/**
* TCA_OPTIONS message parser
*/
diff --git a/include/netlink/route/qdisc.h b/include/netlink/route/qdisc.h
index ee71304..5acd6e1 100644
--- a/include/netlink/route/qdisc.h
+++ b/include/netlink/route/qdisc.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_QDISC_H_
@@ -24,60 +24,46 @@ struct rtnl_qdisc;
extern struct nl_object_ops qdisc_obj_ops;
-/* General */
-extern struct rtnl_qdisc * rtnl_qdisc_alloc(void);
-extern void rtnl_qdisc_put(struct rtnl_qdisc *);
-
-/* Cache Management */
-extern struct nl_cache * rtnl_qdisc_alloc_cache(struct nl_handle *);
-extern struct rtnl_qdisc * rtnl_qdisc_get(struct nl_cache *,
- int, uint32_t);
-extern struct rtnl_qdisc * rtnl_qdisc_get_by_parent(struct nl_cache *,
- int, uint32_t);
-
-/* qdisc addition */
-extern struct nl_msg * rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int);
-extern int rtnl_qdisc_add(struct nl_handle *, struct rtnl_qdisc *,
- int);
-
-/* qdisc modification */
-extern struct nl_msg * rtnl_qdisc_build_change_request(struct rtnl_qdisc *,
- struct rtnl_qdisc *);
-extern int rtnl_qdisc_change(struct nl_handle *,
- struct rtnl_qdisc *,
- struct rtnl_qdisc *);
-
-/* qdisc deletion */
-extern struct nl_msg * rtnl_qdisc_build_delete_request(struct rtnl_qdisc *);
-extern int rtnl_qdisc_delete(struct nl_handle *,
- struct rtnl_qdisc *);
-
-/* attribute modifications */
-extern void rtnl_qdisc_set_ifindex(struct rtnl_qdisc *, int);
-extern int rtnl_qdisc_get_ifindex(struct rtnl_qdisc *);
-extern void rtnl_qdisc_set_handle(struct rtnl_qdisc *, uint32_t);
-extern uint32_t rtnl_qdisc_get_handle(struct rtnl_qdisc *);
-extern void rtnl_qdisc_set_parent(struct rtnl_qdisc *, uint32_t);
-extern uint32_t rtnl_qdisc_get_parent(struct rtnl_qdisc *);
-extern void rtnl_qdisc_set_kind(struct rtnl_qdisc *, const char *);
-extern char * rtnl_qdisc_get_kind(struct rtnl_qdisc *);
-extern uint64_t rtnl_qdisc_get_stat(struct rtnl_qdisc *,
- enum rtnl_tc_stats_id);
-
-/* iterators */
-extern void rtnl_qdisc_foreach_child(struct rtnl_qdisc *,
- struct nl_cache *,
- void (*cb)(struct nl_object *,
- void *),
- void *);
-
-extern void rtnl_qdisc_foreach_cls(struct rtnl_qdisc *,
- struct nl_cache *,
- void (*cb)(struct nl_object *,
- void *),
- void *);
-
-/* qdisc specific options */
+extern struct rtnl_qdisc *rtnl_qdisc_alloc(void);
+extern void rtnl_qdisc_put(struct rtnl_qdisc *);
+
+extern int rtnl_qdisc_alloc_cache(struct nl_sock *, struct nl_cache **);
+extern struct rtnl_qdisc *rtnl_qdisc_get(struct nl_cache *, int, uint32_t);
+extern struct rtnl_qdisc *rtnl_qdisc_get_by_parent(struct nl_cache *,
+ int, uint32_t);
+
+extern int rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int,
+ struct nl_msg **);
+extern int rtnl_qdisc_add(struct nl_sock *, struct rtnl_qdisc *, int);
+
+extern int rtnl_qdisc_build_change_request(struct rtnl_qdisc *,
+ struct rtnl_qdisc *,
+ struct nl_msg **);
+extern int rtnl_qdisc_change(struct nl_sock *, struct rtnl_qdisc *,
+ struct rtnl_qdisc *);
+
+extern int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *,
+ struct nl_msg **);
+extern int rtnl_qdisc_delete(struct nl_sock *, struct rtnl_qdisc *);
+
+extern void rtnl_qdisc_set_ifindex(struct rtnl_qdisc *, int);
+extern int rtnl_qdisc_get_ifindex(struct rtnl_qdisc *);
+extern void rtnl_qdisc_set_handle(struct rtnl_qdisc *, uint32_t);
+extern uint32_t rtnl_qdisc_get_handle(struct rtnl_qdisc *);
+extern void rtnl_qdisc_set_parent(struct rtnl_qdisc *, uint32_t);
+extern uint32_t rtnl_qdisc_get_parent(struct rtnl_qdisc *);
+extern void rtnl_qdisc_set_kind(struct rtnl_qdisc *, const char *);
+extern char * rtnl_qdisc_get_kind(struct rtnl_qdisc *);
+extern uint64_t rtnl_qdisc_get_stat(struct rtnl_qdisc *, enum rtnl_tc_stats_id);
+
+extern void rtnl_qdisc_foreach_child(struct rtnl_qdisc *, struct nl_cache *,
+ void (*cb)(struct nl_object *, void *),
+ void *);
+
+extern void rtnl_qdisc_foreach_cls(struct rtnl_qdisc *, struct nl_cache *,
+ void (*cb)(struct nl_object *, void *),
+ void *);
+
extern struct nl_msg * rtnl_qdisc_get_opts(struct rtnl_qdisc *);
#ifdef __cplusplus
diff --git a/include/netlink/route/route.h b/include/netlink/route/route.h
index f59f36b..5729cd7 100644
--- a/include/netlink/route/route.h
+++ b/include/netlink/route/route.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ROUTE_H_
@@ -17,11 +17,16 @@
#include <netlink/addr.h>
#include <netlink/data.h>
#include <netlink/route/nexthop.h>
+#include <netlink/route/rtnl.h>
+#include <linux/in_route.h>
#ifdef __cplusplus
extern "C" {
#endif
+/* flags */
+#define ROUTE_CACHE_CONTENT 1
+
struct rtnl_route;
struct rtnl_rtcacheinfo
@@ -38,85 +43,79 @@ struct rtnl_rtcacheinfo
extern struct nl_object_ops route_obj_ops;
-/* General */
extern struct rtnl_route * rtnl_route_alloc(void);
-extern void rtnl_route_put(struct rtnl_route *);
-extern struct nl_cache * rtnl_route_alloc_cache(struct nl_handle *);
-
-extern void rtnl_route_get(struct rtnl_route *);
-extern void rtnl_route_put(struct rtnl_route *);
-
-extern struct nl_msg *rtnl_route_build_add_request(struct rtnl_route *, int);
-extern int rtnl_route_add(struct nl_handle *, struct rtnl_route *, int);
-extern struct nl_msg *rtnl_route_build_del_request(struct rtnl_route *, int);
-extern int rtnl_route_del(struct nl_handle *, struct rtnl_route *, int);
-
-extern void rtnl_route_set_table(struct rtnl_route *, int);
-extern int rtnl_route_get_table(struct rtnl_route *);
-extern void rtnl_route_set_scope(struct rtnl_route *, int);
-extern int rtnl_route_get_scope(struct rtnl_route *);
-extern void rtnl_route_set_tos(struct rtnl_route *, int);
-extern int rtnl_route_get_tos(struct rtnl_route *);
-extern void rtnl_route_set_realms(struct rtnl_route *, realm_t);
-extern realm_t rtnl_route_get_realms(struct rtnl_route *);
-extern void rtnl_route_set_protocol(struct rtnl_route *, int);
-extern int rtnl_route_get_protocol(struct rtnl_route *);
-extern void rtnl_route_set_prio(struct rtnl_route *, int);
-extern int rtnl_route_get_prio(struct rtnl_route *);
-extern void rtnl_route_set_family(struct rtnl_route *, int);
-extern int rtnl_route_get_family(struct rtnl_route *);
-extern void rtnl_route_set_type(struct rtnl_route *, int);
-extern int rtnl_route_get_type(struct rtnl_route *);
-extern void rtnl_route_set_flags(struct rtnl_route *,
- unsigned int);
-extern void rtnl_route_unset_flags(struct rtnl_route *,
- unsigned int);
-extern unsigned int rtnl_route_get_flags(struct rtnl_route *);
-extern int rtnl_route_set_metric(struct rtnl_route *, int,
- unsigned int);
-extern int rtnl_route_unset_metric(struct rtnl_route *, int);
-extern unsigned int rtnl_route_get_metric(struct rtnl_route *, int);
-extern int rtnl_route_set_dst(struct rtnl_route *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_route_get_dst(struct rtnl_route *);
-extern int rtnl_route_set_src(struct rtnl_route *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_route_get_src(struct rtnl_route *);
-extern int rtnl_route_set_gateway(struct rtnl_route *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
-extern int rtnl_route_set_pref_src(struct rtnl_route *,
- struct nl_addr *);
-extern struct nl_addr * rtnl_route_get_pref_src(struct rtnl_route *);
-extern void rtnl_route_set_oif(struct rtnl_route *, int);
-extern int rtnl_route_get_oif(struct rtnl_route *);
-extern void rtnl_route_set_iif(struct rtnl_route *, const char *);
-extern char * rtnl_route_get_iif(struct rtnl_route *);
-extern int rtnl_route_get_dst_len(struct rtnl_route *);
-extern int rtnl_route_get_src_len(struct rtnl_route *);
-
-extern void rtnl_route_add_nexthop(struct rtnl_route *,
- struct rtnl_nexthop *);
-extern void rtnl_route_remove_nexthop(struct rtnl_nexthop *);
-extern struct nl_list_head * rtnl_route_get_nexthops(struct rtnl_route *);
-extern void rtnl_route_set_cacheinfo(struct rtnl_route *,
- struct rtnl_rtcacheinfo *);
-extern uint32_t rtnl_route_get_mp_algo(struct rtnl_route *);
-extern void rtnl_route_set_mp_algo(struct rtnl_route *, uint32_t);
-
-extern char * rtnl_route_table2str(int, char *, size_t);
-extern int rtnl_route_str2table(const char *);
-extern int rtnl_route_read_table_names(const char *);
-
-extern char * rtnl_route_proto2str(int, char *, size_t);
-extern int rtnl_route_str2proto(const char *);
-extern int rtnl_route_read_protocol_names(const char *);
-
-extern char * rtnl_route_metric2str(int, char *, size_t);
-extern int rtnl_route_str2metric(const char *);
-
-extern char * rtnl_route_nh_flags2str(int, char *, size_t);
-extern int rtnl_route_nh_str2flags(const char *);
+extern void rtnl_route_put(struct rtnl_route *);
+extern int rtnl_route_alloc_cache(struct nl_sock *, int, int,
+ struct nl_cache **);
+
+extern void rtnl_route_get(struct rtnl_route *);
+extern void rtnl_route_put(struct rtnl_route *);
+
+extern int rtnl_route_parse(struct nlmsghdr *, struct rtnl_route **);
+extern int rtnl_route_build_msg(struct nl_msg *, struct rtnl_route *);
+
+extern int rtnl_route_build_add_request(struct rtnl_route *, int,
+ struct nl_msg **);
+extern int rtnl_route_add(struct nl_sock *, struct rtnl_route *, int);
+extern int rtnl_route_build_del_request(struct rtnl_route *, int,
+ struct nl_msg **);
+extern int rtnl_route_delete(struct nl_sock *, struct rtnl_route *, int);
+
+extern void rtnl_route_set_table(struct rtnl_route *, uint32_t);
+extern uint32_t rtnl_route_get_table(struct rtnl_route *);
+extern void rtnl_route_set_scope(struct rtnl_route *, uint8_t);
+extern uint8_t rtnl_route_get_scope(struct rtnl_route *);
+extern void rtnl_route_set_tos(struct rtnl_route *, uint8_t);
+extern uint8_t rtnl_route_get_tos(struct rtnl_route *);
+extern void rtnl_route_set_protocol(struct rtnl_route *, uint8_t);
+extern uint8_t rtnl_route_get_protocol(struct rtnl_route *);
+extern void rtnl_route_set_priority(struct rtnl_route *, uint32_t);
+extern uint32_t rtnl_route_get_priority(struct rtnl_route *);
+extern int rtnl_route_set_family(struct rtnl_route *, uint8_t);
+extern uint8_t rtnl_route_get_family(struct rtnl_route *);
+extern int rtnl_route_set_type(struct rtnl_route *, uint8_t);
+extern uint8_t rtnl_route_get_type(struct rtnl_route *);
+extern void rtnl_route_set_flags(struct rtnl_route *, uint32_t);
+extern void rtnl_route_unset_flags(struct rtnl_route *, uint32_t);
+extern uint32_t rtnl_route_get_flags(struct rtnl_route *);
+extern int rtnl_route_set_metric(struct rtnl_route *, int, unsigned int);
+extern int rtnl_route_unset_metric(struct rtnl_route *, int);
+extern int rtnl_route_get_metric(struct rtnl_route *, int, uint32_t *);
+extern int rtnl_route_set_dst(struct rtnl_route *, struct nl_addr *);
+extern struct nl_addr *rtnl_route_get_dst(struct rtnl_route *);
+extern int rtnl_route_set_src(struct rtnl_route *, struct nl_addr *);
+extern struct nl_addr *rtnl_route_get_src(struct rtnl_route *);
+extern int rtnl_route_set_pref_src(struct rtnl_route *, struct nl_addr *);
+extern struct nl_addr *rtnl_route_get_pref_src(struct rtnl_route *);
+extern void rtnl_route_set_iif(struct rtnl_route *, int);
+extern int rtnl_route_get_iif(struct rtnl_route *);
+extern int rtnl_route_get_src_len(struct rtnl_route *);
+
+extern void rtnl_route_add_nexthop(struct rtnl_route *,
+ struct rtnl_nexthop *);
+extern void rtnl_route_remove_nexthop(struct rtnl_route *,
+ struct rtnl_nexthop *);
+extern struct nl_list_head *rtnl_route_get_nexthops(struct rtnl_route *);
+extern int rtnl_route_get_nnexthops(struct rtnl_route *);
+
+extern void rtnl_route_foreach_nexthop(struct rtnl_route *r,
+ void (*cb)(struct rtnl_nexthop *, void *),
+ void *arg);
+
+extern struct rtnl_nexthop * rtnl_route_nexthop_n(struct rtnl_route *r, int n);
+
+extern int rtnl_route_guess_scope(struct rtnl_route *);
+
+extern char * rtnl_route_table2str(int, char *, size_t);
+extern int rtnl_route_str2table(const char *);
+extern int rtnl_route_read_table_names(const char *);
+
+extern char * rtnl_route_proto2str(int, char *, size_t);
+extern int rtnl_route_str2proto(const char *);
+extern int rtnl_route_read_protocol_names(const char *);
+
+extern char * rtnl_route_metric2str(int, char *, size_t);
+extern int rtnl_route_str2metric(const char *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/rtnl.h b/include/netlink/route/rtnl.h
index 9d116cd..f551a5d 100644
--- a/include/netlink/route/rtnl.h
+++ b/include/netlink/route/rtnl.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_RTNL_H_
@@ -23,8 +23,6 @@ extern "C" {
* @{
*/
-typedef uint32_t realm_t;
-
/**
* Mask specying the size of each realm part
* @ingroup rtnl
@@ -51,7 +49,7 @@ typedef uint32_t realm_t;
/* General */
-extern int nl_rtgen_request(struct nl_handle *, int, int, int);
+extern int nl_rtgen_request(struct nl_sock *, int, int, int);
/* Routing Type Translations */
extern char * nl_rtntype2str(int, char *, size_t);
diff --git a/include/netlink/route/rule.h b/include/netlink/route/rule.h
index d295b0d..928dc0f 100644
--- a/include/netlink/route/rule.h
+++ b/include/netlink/route/rule.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_RULE_H_
@@ -27,15 +27,16 @@ struct rtnl_rule;
extern struct rtnl_rule * rtnl_rule_alloc(void);
extern void rtnl_rule_put(struct rtnl_rule *);
-extern struct nl_cache * rtnl_rule_alloc_cache(struct nl_handle *);
-extern struct nl_cache * rtnl_rule_alloc_cache_by_family(struct nl_handle *,
- int);
+extern int rtnl_rule_alloc_cache(struct nl_sock *, int,
+ struct nl_cache **);
extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *);
-extern struct nl_msg * rtnl_rule_build_add_request(struct rtnl_rule *, int);
-extern int rtnl_rule_add(struct nl_handle *, struct rtnl_rule *, int);
-extern struct nl_msg * rtnl_rule_build_delete_request(struct rtnl_rule *, int);
-extern int rtnl_rule_delete(struct nl_handle *, struct rtnl_rule *, int);
+extern int rtnl_rule_build_add_request(struct rtnl_rule *, int,
+ struct nl_msg **);
+extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int);
+extern int rtnl_rule_build_delete_request(struct rtnl_rule *, int,
+ struct nl_msg **);
+extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int);
/* attribute modification */
@@ -43,9 +44,7 @@ extern void rtnl_rule_set_family(struct rtnl_rule *, int);
extern int rtnl_rule_get_family(struct rtnl_rule *);
extern void rtnl_rule_set_prio(struct rtnl_rule *, int);
extern int rtnl_rule_get_prio(struct rtnl_rule *);
-#define rtnl_rule_set_fwmark(ptr, n) rtnl_rule_set_mark(ptr, n)
extern void rtnl_rule_set_mark(struct rtnl_rule *, uint64_t);
-#define rtnl_rule_get_fwmark(ptr) rtnl_rule_get_mark(ptr)
extern uint64_t rtnl_rule_get_mark(struct rtnl_rule *);
extern void rtnl_rule_set_table(struct rtnl_rule *, int);
extern int rtnl_rule_get_table(struct rtnl_rule *);
@@ -69,8 +68,8 @@ extern char * rtnl_rule_get_iif(struct rtnl_rule *);
extern void rtnl_rule_set_classid(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_classid(struct rtnl_rule *);
-extern void rtnl_rule_set_realms(struct rtnl_rule *, realm_t);
-extern realm_t rtnl_rule_get_realms(struct rtnl_rule *);
+extern void rtnl_rule_set_realms(struct rtnl_rule *, uint32_t);
+extern uint32_t rtnl_rule_get_realms(struct rtnl_rule *);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/sch/htb.h b/include/netlink/route/sch/htb.h
index 5d4d681..d44f039 100644
--- a/include/netlink/route/sch/htb.h
+++ b/include/netlink/route/sch/htb.h
@@ -30,9 +30,9 @@ extern void rtnl_htb_set_rate(struct rtnl_class *, uint32_t);
extern void rtnl_htb_set_ceil(struct rtnl_class *, uint32_t);
extern void rtnl_htb_set_rbuffer(struct rtnl_class *, uint32_t);
extern void rtnl_htb_set_cbuffer(struct rtnl_class *, uint32_t);
-extern void rtnl_htb_set_quantum(struct rtnl_class *class, uint32_t quantum);
-extern void rtnl_htb_set_overhead(struct rtnl_class *class, uint8_t overhead);
-extern void rtnl_htb_set_mpu(struct rtnl_class *class, uint8_t mpu);
+extern void rtnl_htb_set_quantum(struct rtnl_class *, uint32_t quantum);
+extern void rtnl_htb_set_overhead(struct rtnl_class *, uint8_t overhead);
+extern void rtnl_htb_set_mpu(struct rtnl_class *, uint8_t mpu);
#ifdef __cplusplus
}
diff --git a/include/netlink/route/sch/netem.h b/include/netlink/route/sch/netem.h
index b100741..c293777 100644
--- a/include/netlink/route/sch/netem.h
+++ b/include/netlink/route/sch/netem.h
@@ -31,6 +31,13 @@ extern int rtnl_netem_get_reorder_probability(struct rtnl_qdisc *);
extern int rtnl_netem_set_reorder_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_reorder_correlation(struct rtnl_qdisc *);
+/* Corruption */
+extern int rtnl_netem_set_corruption_probability(struct rtnl_qdisc *, int);
+extern int rtnl_netem_get_corruption_probability(struct rtnl_qdisc *);
+
+extern int rtnl_netem_set_corruption_correlation(struct rtnl_qdisc *, int);
+extern int rtnl_netem_get_corruption_correlation(struct rtnl_qdisc *);
+
/* Packet Loss */
extern int rtnl_netem_set_loss(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_loss(struct rtnl_qdisc *);
@@ -55,6 +62,12 @@ extern int rtnl_netem_get_jitter(struct rtnl_qdisc *);
extern int rtnl_netem_set_delay_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_delay_correlation(struct rtnl_qdisc *);
+/* Delay Distribution */
+#define MAXDIST 65536
+extern int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *, const char *);
+extern int rtnl_netem_get_delay_distribution_size(struct rtnl_qdisc *);
+extern int rtnl_netem_get_delay_distribution(struct rtnl_qdisc *, int16_t **);
+
#ifdef __cplusplus
}
#endif