summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-12-22 17:45:48 +0100
committerPatrick McHardy <kaber@trash.net>2015-01-11 08:14:08 +0000
commit9e2271940a081214f045341fa521a6231736bae8 (patch)
treef523937a3fc0f1bfd31f50bc42f5497e0bfb4d2d /include
parent755d5d4d63450b13e2a0059a63d5cae24c215ac3 (diff)
concat: add concat subtype lookup/id helpers
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include')
-rw-r--r--include/datatype.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/datatype.h b/include/datatype.h
index f05f9877..3c3f42f3 100644
--- a/include/datatype.h
+++ b/include/datatype.h
@@ -215,4 +215,20 @@ extern const struct datatype time_type;
extern const struct datatype *concat_type_alloc(uint32_t type);
extern void concat_type_destroy(const struct datatype *dtype);
+static inline uint32_t concat_subtype_add(uint32_t type, uint32_t subtype)
+{
+ return type << TYPE_BITS | subtype;
+}
+
+static inline uint32_t concat_subtype_id(uint32_t type, unsigned int n)
+{
+ return (type >> TYPE_BITS * n) & TYPE_MASK;
+}
+
+static inline const struct datatype *
+concat_subtype_lookup(uint32_t type, unsigned int n)
+{
+ return datatype_lookup(concat_subtype_id(type, n));
+}
+
#endif /* NFTABLES_DATATYPE_H */