diff options
Diffstat (limited to 'match.h')
-rw-r--r-- | match.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +/** + * struct kernel_set - Representation of in-kernel set data + * @groups: Number of 4-bit groups for each field (algorithm step 3.1) + * @offset: Offset of field within packet data, in bytes + * @bsize: Lookup table bucket size for field, in bytes + * @lt: Lookup table for field (algorithm steps 3.2 - 3.4) + * @mt: Mapping table for field (algorithm steps 3.5 - 3.6) + * @map: Result bitmap, two copies: swap indices instead of copying + * @map_idx: Index of current matching bitmap + * @max_bsize: Maximum lookup table bucket size for all fields in the set + */ +struct kernel_set { + int groups[MAX_FIELDS]; + int offset[MAX_FIELDS]; + int bsize[MAX_FIELDS]; + uint8_t *lt[MAX_FIELDS]; + union map_bucket *mt[MAX_FIELDS]; + uint8_t *map[2]; + int map_idx; + int max_bsize; +}; + +struct kernel_set *kernel_init(struct set *s, struct desc_spec **layout); +uint32_t match(struct kernel_set *ks, uint8_t *packet); |