summaryrefslogtreecommitdiff
path: root/doc/src/examples/nla_ok.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-27 10:18:07 +0100
committerThomas Graf <tgraf@suug.ch>2010-11-27 10:18:07 +0100
commit5644578190c3364300128799967d4e7b5e920242 (patch)
tree9972036e0000c249cf776cb55e8340875c54cd5f /doc/src/examples/nla_ok.c
parent7105aea116208422812a3803ef1e58f08b45c75e (diff)
downloadlibnl-5644578190c3364300128799967d4e7b5e920242.tar.gz
Tons of documentation
Diffstat (limited to 'doc/src/examples/nla_ok.c')
-rw-r--r--doc/src/examples/nla_ok.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/src/examples/nla_ok.c b/doc/src/examples/nla_ok.c
new file mode 100644
index 0000000..4485a96
--- /dev/null
+++ b/doc/src/examples/nla_ok.c
@@ -0,0 +1,10 @@
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+struct nlattr *hdr = nlmsg_attrdata(msg, 0);
+int remaining = nlmsg_attrlen(msg, 0);
+
+while (nla_ok(hdr, remaining)) {
+ /* parse attribute here */
+ hdr = nla_next(hdr, &remaining);
+};