]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Provide nl_object_dump_buf() to easily dump to buffers
authorThomas Graf <tgraf@suug.ch>
Sun, 10 Apr 2011 08:22:01 +0000 (10:22 +0200)
committerThomas Graf <tgraf@suug.ch>
Sun, 10 Apr 2011 08:22:01 +0000 (10:22 +0200)
include/netlink/object.h
lib/object.c

index ef1ed9ff1687baae58bed4074decb718d423be02..7dc62ac5465b7bb0aa97394ebd46c99e14ff6d83 100644 (file)
@@ -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 *,
index 4a1b35645aa6f2694e2ef4fa06b01049b5a4529b..3bf02ea3a16c019b12cfb4e533ffcd564b0fcc40 100644 (file)
@@ -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