summaryrefslogtreecommitdiffstats
path: root/examples/Makefile.am
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2010-04-03 08:29:16 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2010-04-03 13:26:44 +0200
commit8ce5d4ca70884654988eb86734cb3022e0b71995 (patch)
treea42c6a5b87d5b6c2ff01446f127824e355de3ee8 /examples/Makefile.am
parentba57ffc48d3a97421c8358947bc8cf9f2e7ff7c6 (diff)
add validation infrastructure and rework attribute parsing
This patch includes the new validation infrastructure which is decoupled from the attribute parsing. It is composed of: - mnl_attr_type_invalid: that allows to check if the attribute type is valid (ie. the type is not higher than WXYZ_MAX). - mnl_attr_validate: that allows to validate that there's enough room for the attribute data. The patch includes the rework of the attribute parsers. Now, you don't have to use an array of pointer to store the result of the parsing, you can use whatever data structure instead. The prototype as it follows: typedef int (*mnl_attr_cb_t)(const struct nlattr *attr, void *data); extern int mnl_attr_parse(const struct nlmsghdr *nlh, int offset, mnl_attr_cb_t cb, void *data) There are three versions of rtnl-link-dump.c that show how attribute parsing can be done now. Probably that many examples are not good idea, I may remove some of them from the tree in the future. This patch also merges mnl_attr_parse_at_offset into mnl_attr_parse. This patch modifies MNL_ALIGN so that we can use it in static arrays (the use of mnl_align() is not allowed in compilation time to initialize an array field). I have added the mnl_attr_for_each() macro and I have changed mnl_attr_for_each_nested() to declare the length variable internally. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'examples/Makefile.am')
-rw-r--r--examples/Makefile.am15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 92c5342..1874971 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,12 +1,23 @@
include $(top_srcdir)/Make_global.am
-check_PROGRAMS = rtnl-link-dump rtnl-link-event rtnl-link-set \
- rtnl-route-dump genl-family-get
+check_PROGRAMS = rtnl-link-dump rtnl-link-dump2 rtnl-link-dump3 \
+ rtnl-link-event \
+ rtnl-link-set \
+ rtnl-route-dump \
+ genl-family-get
rtnl_link_dump_SOURCES = rtnl-link-dump.c
rtnl_link_dump_LDADD = ../src/libmnl.la
rtnl_link_dump_LDFLAGS = -dynamic -ldl
+rtnl_link_dump2_SOURCES = rtnl-link-dump2.c
+rtnl_link_dump2_LDADD = ../src/libmnl.la
+rtnl_link_dump2_LDFLAGS = -dynamic -ldl
+
+rtnl_link_dump3_SOURCES = rtnl-link-dump3.c
+rtnl_link_dump3_LDADD = ../src/libmnl.la
+rtnl_link_dump3_LDFLAGS = -dynamic -ldl
+
rtnl_link_event_SOURCES = rtnl-link-event.c
rtnl_link_event_LDADD = ../src/libmnl.la
rtnl_link_event_LDFLAGS = -dynamic -ldl