summaryrefslogtreecommitdiffstats
path: root/include/netlink
diff options
context:
space:
mode:
Diffstat (limited to 'include/netlink')
-rw-r--r--include/netlink/cli/class.h3
-rw-r--r--include/netlink/cli/cls.h15
-rw-r--r--include/netlink/cli/qdisc.h20
-rw-r--r--include/netlink/cli/tc.h18
-rw-r--r--include/netlink/route/class-modules.h73
-rw-r--r--include/netlink/route/class.h2
-rw-r--r--include/netlink/route/classifier-modules.h78
-rw-r--r--include/netlink/route/classifier.h7
-rw-r--r--include/netlink/route/qdisc-modules.h75
-rw-r--r--include/netlink/route/sch/netem.h26
-rw-r--r--include/netlink/route/sch/prio.h4
-rw-r--r--include/netlink/route/sch/sfq.h8
-rw-r--r--include/netlink/route/sch/tbf.h6
-rw-r--r--include/netlink/route/tc-api.h141
-rw-r--r--include/netlink/route/tc.h26
15 files changed, 203 insertions, 299 deletions
diff --git a/include/netlink/cli/class.h b/include/netlink/cli/class.h
index 0141c21..5001e42 100644
--- a/include/netlink/cli/class.h
+++ b/include/netlink/cli/class.h
@@ -13,12 +13,9 @@
#define __NETLINK_CLI_CLASS_H_
#include <netlink/route/class.h>
-#include <netlink/route/class-modules.h>
#include <netlink/cli/tc.h>
extern struct rtnl_class *nl_cli_class_alloc(void);
extern struct nl_cache *nl_cli_class_alloc_cache(struct nl_sock *, int);
-extern void nl_cli_class_parse_kind(struct rtnl_class *, char *);
-
#endif
diff --git a/include/netlink/cli/cls.h b/include/netlink/cli/cls.h
index cdcb17e..a2707b8 100644
--- a/include/netlink/cli/cls.h
+++ b/include/netlink/cli/cls.h
@@ -13,27 +13,12 @@
#define __NETLINK_CLI_CLS_H_
#include <netlink/route/classifier.h>
-#include <netlink/route/classifier-modules.h>
#include <netlink/cli/tc.h>
-struct nl_cli_cls_module
-{
- const char * cm_name;
- struct rtnl_cls_ops * cm_ops;
- int (*cm_parse_argv)(struct rtnl_cls *, int, char **);
- struct nl_list_head cm_list;
-};
-
extern struct rtnl_cls * nl_cli_cls_alloc(void);
extern struct nl_cache * nl_cli_cls_alloc_cache(struct nl_sock *,
int, uint32_t);
-extern void nl_cli_cls_parse_kind(struct rtnl_cls *, char *);
extern void nl_cli_cls_parse_proto(struct rtnl_cls *, char *);
extern struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(struct rtnl_cls *, char *);
-extern struct nl_cli_cls_module *nl_cli_cls_lookup(struct rtnl_cls_ops *);
-extern void nl_cli_cls_register(struct nl_cli_cls_module *);
-extern void nl_cli_cls_unregister(struct nl_cli_cls_module *);
-
-
#endif
diff --git a/include/netlink/cli/qdisc.h b/include/netlink/cli/qdisc.h
index 00c7083..b102da4 100644
--- a/include/netlink/cli/qdisc.h
+++ b/include/netlink/cli/qdisc.h
@@ -6,36 +6,18 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_QDISC_H_
#define __NETLINK_CLI_QDISC_H_
#include <netlink/route/qdisc.h>
-#include <netlink/route/qdisc-modules.h>
#define nl_cli_qdisc_alloc_cache(sk) \
nl_cli_alloc_cache((sk), "queueing disciplines", \
rtnl_qdisc_alloc_cache)
-struct nl_cli_qdisc_module
-{
- const char * qm_name;
- struct rtnl_qdisc_ops * qm_ops;
- struct rtnl_class_ops * qm_class_ops;
- void (*qm_parse_qdisc_argv)(struct rtnl_qdisc *, int, char **);
- void (*qm_parse_class_argv)(struct rtnl_class *, int, char **);
- struct nl_list_head qm_list;
-};
-
-extern struct nl_cli_qdisc_module *nl_cli_qdisc_lookup(struct rtnl_qdisc_ops *);
-extern struct nl_cli_qdisc_module *nl_cli_qdisc_lookup_by_class(struct rtnl_class_ops *);
-extern void nl_cli_qdisc_register(struct nl_cli_qdisc_module *);
-extern void nl_cli_qdisc_unregister(struct nl_cli_qdisc_module *);
-
extern struct rtnl_qdisc *nl_cli_qdisc_alloc(void);
-extern void nl_cli_qdisc_parse_kind(struct rtnl_qdisc *, char *);
-
#endif
diff --git a/include/netlink/cli/tc.h b/include/netlink/cli/tc.h
index 82f9a1d..85d2e30 100644
--- a/include/netlink/cli/tc.h
+++ b/include/netlink/cli/tc.h
@@ -6,13 +6,13 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2010-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_TC_H_
#define __NETLINK_CLI_TC_H_
-#include <netlink/route/tc.h>
+#include <netlink/route/tc-api.h>
extern void nl_cli_tc_parse_dev(struct rtnl_tc *, struct nl_cache *, char *);
extern void nl_cli_tc_parse_parent(struct rtnl_tc *, char *);
@@ -21,5 +21,19 @@ extern void nl_cli_tc_parse_mtu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_mpu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_overhead(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_linktype(struct rtnl_tc *, char *);
+extern void nl_cli_tc_parse_kind(struct rtnl_tc *, char *);
+
+struct nl_cli_tc_module
+{
+ const char * tm_name;
+ enum rtnl_tc_type tm_type;
+ struct rtnl_tc_ops * tm_ops;
+ void (*tm_parse_argv)(struct rtnl_tc *, int, char **);
+ struct nl_list_head tm_list;
+};
+
+extern struct nl_cli_tc_module *nl_cli_tc_lookup(struct rtnl_tc_ops *);
+extern void nl_cli_tc_register(struct nl_cli_tc_module *);
+extern void nl_cli_tc_unregister(struct nl_cli_tc_module *);
#endif
diff --git a/include/netlink/route/class-modules.h b/include/netlink/route/class-modules.h
deleted file mode 100644
index 74a25c9..0000000
--- a/include/netlink/route/class-modules.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * netlink/route/class-modules.h Class Module API
- *
- * 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) 2003-2006 Thomas Graf <tgraf@suug.ch>
- */
-
-#ifndef NETLINK_CLASS_MODULES_H_
-#define NETLINK_CLASS_MODULES_H_
-
-#include <netlink/netlink.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Class operations
- * @ingroup class_api
- */
-struct rtnl_class_ops
-{
- /**
- * Kind/Name of class
- */
- char co_kind[32];
-
- /**
- * Dump callbacks
- */
- void (*co_dump[NL_DUMP_MAX+1])(struct rtnl_class *,
- struct nl_dump_params *);
-
- /**
- * Must return the contents supposed to be in TCA_OPTIONS
- */
- struct nl_msg *(*co_get_opts)(struct rtnl_class *);
-
- /**
- * TCA_OPTIONS message parser
- */
- int (*co_msg_parser)(struct rtnl_class *);
-
- /**
- * Called before a class object gets destroyed
- */
- void (*co_free_data)(struct rtnl_class *);
-
- /**
- * Called whenever a class object needs to be cloned
- */
- int (*co_clone)(struct rtnl_class *, struct rtnl_class *);
-
- /**
- * INTERNAL (Do not use)
- */
- struct rtnl_class_ops *co_next;
-};
-
-extern int rtnl_class_register(struct rtnl_class_ops *);
-extern int rtnl_class_unregister(struct rtnl_class_ops *);
-extern struct rtnl_class_ops * rtnl_class_lookup_ops(struct rtnl_class *);
-extern struct rtnl_class_ops * __rtnl_class_lookup_ops(const char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/netlink/route/class.h b/include/netlink/route/class.h
index 13a25d6..ad3bacf 100644
--- a/include/netlink/route/class.h
+++ b/include/netlink/route/class.h
@@ -22,8 +22,6 @@ extern "C" {
struct rtnl_class;
-extern struct nl_object_ops class_obj_ops;
-
extern struct rtnl_class * rtnl_class_alloc(void);
extern void rtnl_class_put(struct rtnl_class *);
extern int rtnl_class_alloc_cache(struct nl_sock *, int,
diff --git a/include/netlink/route/classifier-modules.h b/include/netlink/route/classifier-modules.h
deleted file mode 100644
index 35cb06e..0000000
--- a/include/netlink/route/classifier-modules.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * netlink/route/classifier-modules.h Classifier Module API
- *
- * 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) 2003-2009 Thomas Graf <tgraf@suug.ch>
- */
-
-#ifndef NETLINK_CLASS_MODULES_H_
-#define NETLINK_CLASS_MODULES_H_
-
-#include <netlink/netlink.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Classifier operations
- * @ingroup cls_api
- */
-struct rtnl_cls_ops
-{
- /**
- * Name of classifier module
- */
- char co_kind[32];
-
-
- /**
- * Size of private classifier data
- */
- size_t co_size;
-
- /**
- * Dump callbacks
- */
- void (*co_dump[NL_DUMP_MAX+1])(struct rtnl_cls *,
- struct nl_dump_params *);
- /**
- * Must return the contents supposed to be in TCA_OPTIONS
- */
- int (*co_get_opts)(struct rtnl_cls *, struct nl_msg *);
-
- /**
- * TCA_OPTIONS message parser
- */
- int (*co_msg_parser)(struct rtnl_cls *);
-
- /**
- * Called before a class object gets destroyed
- */
- void (*co_free_data)(struct rtnl_cls *);
-
- /**
- * Called whenever a classifier object needs to be cloned
- */
- int (*co_clone)(struct rtnl_cls *, struct rtnl_cls *);
-
- /**
- * INTERNAL (Do not use)
- */
- struct rtnl_cls_ops *co_next;
-};
-
-extern int rtnl_cls_register(struct rtnl_cls_ops *);
-extern int rtnl_cls_unregister(struct rtnl_cls_ops *);
-extern struct rtnl_cls_ops * rtnl_cls_lookup_ops(struct rtnl_cls *);
-extern struct rtnl_cls_ops * __rtnl_cls_lookup_ops(const char *kind);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/netlink/route/classifier.h b/include/netlink/route/classifier.h
index 17c834b..23af837 100644
--- a/include/netlink/route/classifier.h
+++ b/include/netlink/route/classifier.h
@@ -21,8 +21,6 @@
extern "C" {
#endif
-extern struct nl_object_ops cls_obj_ops;
-
extern struct rtnl_cls *rtnl_cls_alloc(void);
extern void rtnl_cls_put(struct rtnl_cls *);
@@ -39,17 +37,12 @@ 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);
-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 *, uint16_t);
extern uint16_t rtnl_cls_get_prio(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
}
#endif
diff --git a/include/netlink/route/qdisc-modules.h b/include/netlink/route/qdisc-modules.h
deleted file mode 100644
index 769625e..0000000
--- a/include/netlink/route/qdisc-modules.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * netlink/route/qdisc-modules.h Qdisc Module API
- *
- * 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) 2003-2006 Thomas Graf <tgraf@suug.ch>
- */
-
-#ifndef NETLINK_QDISC_MODULES_H_
-#define NETLINK_QDISC_MODULES_H_
-
-#include <netlink/netlink.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Qdisc Operations
- * @ingroup qdisc
- */
-struct rtnl_qdisc_ops
-{
- /**
- * Kind/Name of Qdisc
- */
- char qo_kind[32];
-
- /**
- * Dump callbacks
- */
- 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
- */
- int (*qo_msg_parser)(struct rtnl_qdisc *);
-
- /**
- * Called before a Qdisc object gets destroyed
- */
- void (*qo_free_data)(struct rtnl_qdisc *);
-
- /**
- * Called whenever a qdisc object needs to be cloned
- */
- int (*qo_clone)(struct rtnl_qdisc *, struct rtnl_qdisc *);
-
- /**
- * INTERNAL (Do not use)
- */
- struct rtnl_qdisc_ops *qo_next;
-};
-
-extern int rtnl_qdisc_register(struct rtnl_qdisc_ops *);
-extern int rtnl_qdisc_unregister(struct rtnl_qdisc_ops *);
-extern struct rtnl_qdisc_ops * rtnl_qdisc_lookup_ops(struct rtnl_qdisc *);
-extern struct rtnl_qdisc_ops * __rtnl_qdisc_lookup_ops(const char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/netlink/route/sch/netem.h b/include/netlink/route/sch/netem.h
index c293777..ce56ee7 100644
--- a/include/netlink/route/sch/netem.h
+++ b/include/netlink/route/sch/netem.h
@@ -18,48 +18,48 @@
extern "C" {
#endif
-extern int rtnl_netem_set_limit(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_limit(struct rtnl_qdisc *);
/* Packet Re-ordering */
-extern int rtnl_netem_set_gap(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_gap(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_gap(struct rtnl_qdisc *);
-extern int rtnl_netem_set_reorder_probability(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_reorder_probability(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_reorder_probability(struct rtnl_qdisc *);
-extern int rtnl_netem_set_reorder_correlation(struct rtnl_qdisc *, int);
+extern void 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 void 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 void 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 void rtnl_netem_set_loss(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_loss(struct rtnl_qdisc *);
-extern int rtnl_netem_set_loss_correlation(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_loss_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_loss_correlation(struct rtnl_qdisc *);
/* Packet Duplication */
-extern int rtnl_netem_set_duplicate(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_duplicate(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_duplicate(struct rtnl_qdisc *);
-extern int rtnl_netem_set_duplicate_correlation(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_duplicate_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_duplicate_correlation(struct rtnl_qdisc *);
/* Packet Delay */
-extern int rtnl_netem_set_delay(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_delay(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_delay(struct rtnl_qdisc *);
-extern int rtnl_netem_set_jitter(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_jitter(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_jitter(struct rtnl_qdisc *);
-extern int rtnl_netem_set_delay_correlation(struct rtnl_qdisc *, int);
+extern void rtnl_netem_set_delay_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_delay_correlation(struct rtnl_qdisc *);
/* Delay Distribution */
diff --git a/include/netlink/route/sch/prio.h b/include/netlink/route/sch/prio.h
index ff35b07..f6fdc86 100644
--- a/include/netlink/route/sch/prio.h
+++ b/include/netlink/route/sch/prio.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-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_PRIO_H_
@@ -38,7 +38,7 @@ extern "C" {
/** @} */
-extern int rtnl_qdisc_prio_set_bands(struct rtnl_qdisc *, int);
+extern void rtnl_qdisc_prio_set_bands(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_prio_get_bands(struct rtnl_qdisc *);
extern int rtnl_qdisc_prio_set_priomap(struct rtnl_qdisc *, uint8_t[], int);
extern uint8_t *rtnl_qdisc_prio_get_priomap(struct rtnl_qdisc *);
diff --git a/include/netlink/route/sch/sfq.h b/include/netlink/route/sch/sfq.h
index 19b3817..7cc0b3e 100644
--- a/include/netlink/route/sch/sfq.h
+++ b/include/netlink/route/sch/sfq.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-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_SFQ_H_
@@ -18,13 +18,13 @@
extern "C" {
#endif
-extern int rtnl_sfq_set_quantum(struct rtnl_qdisc *, int);
+extern void rtnl_sfq_set_quantum(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_quantum(struct rtnl_qdisc *);
-extern int rtnl_sfq_set_limit(struct rtnl_qdisc *, int);
+extern void rtnl_sfq_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_limit(struct rtnl_qdisc *);
-extern int rtnl_sfq_set_perturb(struct rtnl_qdisc *, int);
+extern void rtnl_sfq_set_perturb(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_perturb(struct rtnl_qdisc *);
extern int rtnl_sfq_get_divisor(struct rtnl_qdisc *);
diff --git a/include/netlink/route/sch/tbf.h b/include/netlink/route/sch/tbf.h
index bb0e3b1..8a2144a 100644
--- a/include/netlink/route/sch/tbf.h
+++ b/include/netlink/route/sch/tbf.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_TBF_H_
@@ -19,11 +19,11 @@
extern "C" {
#endif
-extern int rtnl_qdisc_tbf_set_limit(struct rtnl_qdisc *, int);
+extern void rtnl_qdisc_tbf_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_tbf_set_limit_by_latency(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_tbf_get_limit(struct rtnl_qdisc *);
-extern int rtnl_qdisc_tbf_set_rate(struct rtnl_qdisc *, int, int, int);
+extern void rtnl_qdisc_tbf_set_rate(struct rtnl_qdisc *, int, int, int);
extern int rtnl_qdisc_tbf_get_rate(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_rate_bucket(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_rate_cell(struct rtnl_qdisc *);
diff --git a/include/netlink/route/tc-api.h b/include/netlink/route/tc-api.h
new file mode 100644
index 0000000..8ed940a
--- /dev/null
+++ b/include/netlink/route/tc-api.h
@@ -0,0 +1,141 @@
+/*
+ * netlink/route/tc-api.h Traffic Control API
+ *
+ * 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) 2011 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_TC_API_H_
+#define NETLINK_TC_API_H_
+
+#include <netlink/netlink.h>
+#include <netlink/msg.h>
+#include <netlink/route/tc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum rtnl_tc_type {
+ RTNL_TC_TYPE_QDISC,
+ RTNL_TC_TYPE_CLASS,
+ RTNL_TC_TYPE_CLS,
+ __RTNL_TC_TYPE_MAX,
+};
+
+#define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1)
+
+/**
+ * Traffic control object operations
+ * @ingroup tc
+ *
+ * This structure holds function pointers and settings implementing
+ * the features of each traffic control object implementation.
+ */
+struct rtnl_tc_ops
+{
+ /**
+ * Name of traffic control module
+ */
+ char *to_kind;
+
+ /**
+ * Type of traffic control object
+ */
+ enum rtnl_tc_type to_type;
+
+
+ /**
+ * Size of private data
+ */
+ size_t to_size;
+
+ /**
+ * Dump callbacks
+ */
+ void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *,
+ struct nl_dump_params *);
+ /**
+ * Used to fill the contents of TCA_OPTIONS
+ */
+ int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
+
+ /**
+ * Uesd to to fill tc related messages, unlike with to_msg_fill,
+ * the contents is not encapsulated with a TCA_OPTIONS nested
+ * attribute.
+ */
+ int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
+
+ /**
+ * TCA_OPTIONS message parser
+ */
+ int (*to_msg_parser)(struct rtnl_tc *, void *);
+
+ /**
+ * Called before a tc object is destroyed
+ */
+ void (*to_free_data)(struct rtnl_tc *, void *);
+
+ /**
+ * Called whenever a classifier object needs to be cloned
+ */
+ int (*to_clone)(void *, void *);
+
+ /**
+ * Internal, don't touch
+ */
+ struct nl_list_head to_list;
+};
+
+struct rtnl_tc_type_ops
+{
+ enum rtnl_tc_type tt_type;
+
+ char *tt_dump_prefix;
+
+ /**
+ * Dump callbacks
+ */
+ void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *,
+ struct nl_dump_params *);
+};
+
+extern int rtnl_tc_msg_parse(struct nlmsghdr *,
+ struct rtnl_tc *);
+extern int rtnl_tc_msg_build(struct rtnl_tc *, int,
+ int, struct nl_msg **);
+
+extern void rtnl_tc_free_data(struct nl_object *);
+extern int rtnl_tc_clone(struct nl_object *,
+ struct nl_object *);
+extern void rtnl_tc_dump_line(struct nl_object *,
+ struct nl_dump_params *);
+extern void rtnl_tc_dump_details(struct nl_object *,
+ struct nl_dump_params *);
+extern void rtnl_tc_dump_stats(struct nl_object *,
+ struct nl_dump_params *);
+extern int rtnl_tc_compare(struct nl_object *,
+ struct nl_object *,
+ uint32_t, int);
+
+extern void * rtnl_tc_data(struct rtnl_tc *);
+
+extern struct rtnl_tc_ops * rtnl_tc_lookup_ops(enum rtnl_tc_type,
+ const char *);
+extern struct rtnl_tc_ops * rtnl_tc_get_ops(struct rtnl_tc *);
+extern int rtnl_tc_register(struct rtnl_tc_ops *);
+extern void rtnl_tc_unregister(struct rtnl_tc_ops *);
+
+extern void rtnl_tc_type_register(struct rtnl_tc_type_ops *);
+extern void rtnl_tc_type_unregister(struct rtnl_tc_type_ops *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/netlink/route/tc.h b/include/netlink/route/tc.h
index 4ba0e06..17021be 100644
--- a/include/netlink/route/tc.h
+++ b/include/netlink/route/tc.h
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_TC_H_
@@ -23,12 +23,31 @@
extern "C" {
#endif
+/**
+ * Traffic control object
+ * @ingroup tc
+ */
struct rtnl_tc;
/**
+ * Macro to cast qdisc/class/classifier to tc object
* @ingroup tc
+ *
+ * @code
+ * rtnl_tc_set_mpu(TC_CAST(qdisc), 40);
+ * @endcode
+ */
+#define TC_CAST(ptr) ((struct rtnl_tc *) (ptr))
+
+/**
+ * Traffic control statistical identifier
+ * @ingroup tc
+ *
+ * @code
+ * uint64_t n = rtnl_tc_get_stat(TC_CAST(class), RTNL_TC_PACKETS);
+ * @endcode
*/
-enum rtnl_tc_stats_id {
+enum rtnl_tc_stat {
RTNL_TC_PACKETS, /**< Number of packets seen */
RTNL_TC_BYTES, /**< Total bytes seen */
RTNL_TC_RATE_BPS, /**< Current bits/s (rate estimator) */
@@ -58,8 +77,9 @@ extern void rtnl_tc_set_handle(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_handle(struct rtnl_tc *);
extern void rtnl_tc_set_parent(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_parent(struct rtnl_tc *);
+extern int rtnl_tc_set_kind(struct rtnl_tc *, const char *);
extern char * rtnl_tc_get_kind(struct rtnl_tc *);
-extern uint64_t rtnl_tc_get_stat(struct rtnl_tc *, int );
+extern uint64_t rtnl_tc_get_stat(struct rtnl_tc *, enum rtnl_tc_stat);
extern int rtnl_tc_calc_txtime(int, int);
extern int rtnl_tc_calc_bufsize(int, int);