From 9e2271940a081214f045341fa521a6231736bae8 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 22 Dec 2014 17:45:48 +0100 Subject: concat: add concat subtype lookup/id helpers Signed-off-by: Patrick McHardy --- include/datatype.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/datatype.h') 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 */ -- cgit v1.2.3