summaryrefslogtreecommitdiff
path: root/match.h
diff options
context:
space:
mode:
Diffstat (limited to 'match.h')
-rw-r--r--match.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/match.h b/match.h
new file mode 100644
index 0000000..c3821a7
--- /dev/null
+++ b/match.h
@@ -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);