diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-04-10 10:22:01 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-04-10 10:22:01 +0200 |
commit | ef327ffd44dbef02446255fe370d91e256ad927b (patch) | |
tree | 661ca161f301660764cea167ddbce0011fa60c8a | |
parent | 2dbe7d7cfc591e4e279f91409dca92f235b92c1b (diff) | |
download | libnl-ef327ffd44dbef02446255fe370d91e256ad927b.tar.gz |
Provide nl_object_dump_buf() to easily dump to buffers
-rw-r--r-- | include/netlink/object.h | 1 | ||||
-rw-r--r-- | lib/object.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/netlink/object.h b/include/netlink/object.h index ef1ed9f..7dc62ac 100644 --- a/include/netlink/object.h +++ b/include/netlink/object.h @@ -36,6 +36,7 @@ extern void nl_object_put(struct nl_object *); extern int nl_object_shared(struct nl_object *); extern void nl_object_dump(struct nl_object *, struct nl_dump_params *); +extern void nl_object_dump_buf(struct nl_object *, char *, size_t); extern int nl_object_identical(struct nl_object *, struct nl_object *); extern uint32_t nl_object_diff(struct nl_object *, diff --git a/lib/object.c b/lib/object.c index 4a1b356..3bf02ea 100644 --- a/lib/object.c +++ b/lib/object.c @@ -250,6 +250,16 @@ void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params) dump_from_ops(obj, params); } +void nl_object_dump_buf(struct nl_object *obj, char *buf, size_t len) +{ + struct nl_dump_params dp = { + .dp_buf = buf, + .dp_buflen = len, + }; + + return nl_object_dump(obj, &dp); +} + /** * Check if the identifiers of two objects are identical * @arg a an object |