summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-06-09 12:30:15 +0200
committerThomas Graf <tgraf@suug.ch>2011-06-09 12:30:15 +0200
commitaba36899377bfa9dcb9aab431de5a26c3cfeb5ef (patch)
treebde4d6b7c1904eb57de0ff9bc474ee4a1cf9ee63
parent58e0e1eda9cbb09a56ffdc8ac6934dc5f5f884b2 (diff)
downloadlibnl-aba36899377bfa9dcb9aab431de5a26c3cfeb5ef.tar.gz
Provide documentation for rtnl_tc_data() and rtnl_tc_data_check()
-rw-r--r--lib/route/tc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/route/tc.c b/lib/route/tc.c
index 983555a..7bd4728 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -987,6 +987,15 @@ void rtnl_tc_unregister(struct rtnl_tc_ops *ops)
nl_list_del(&ops->to_list);
}
+/**
+ * Return pointer to private data of traffic control object
+ * @arg tc traffic control object
+ *
+ * Allocates the private traffic control object data section
+ * as necessary and returns it.
+ *
+ * @return Pointer to private tc data or NULL if allocation failed.
+ */
void *rtnl_tc_data(struct rtnl_tc *tc)
{
if (!tc->tc_subdata) {
@@ -1010,6 +1019,20 @@ void *rtnl_tc_data(struct rtnl_tc *tc)
return nl_data_get(tc->tc_subdata);
}
+/**
+ * Check traffic control object type and return private data section
+ * @arg tc traffic control object
+ * @arg ops expected traffic control object operations
+ *
+ * Checks whether the traffic control object matches the type
+ * specified with the traffic control object operations. If the
+ * type matches, the private tc object data is returned. If type
+ * mismatches, APPBUG() will print a application bug warning.
+ *
+ * @see rtnl_tc_data()
+ *
+ * @return Pointer to private tc data or NULL if type mismatches.
+ */
void *rtnl_tc_data_check(struct rtnl_tc *tc, struct rtnl_tc_ops *ops)
{
if (tc->tc_ops != ops) {
@@ -1018,6 +1041,7 @@ void *rtnl_tc_data_check(struct rtnl_tc *tc, struct rtnl_tc_ops *ops)
snprintf(buf, sizeof(buf),
"tc object %p used in %s context but is of type %s",
tc, ops->to_kind, tc->tc_ops->to_kind);
+ APPBUG(buf);
return NULL;
}