From eb689b2069ebd9d78e376e812af5163ad61fd7ad Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Mon, 30 Nov 2020 22:01:49 +0100 Subject: nDPI rules (work in progress) implementation --- src/include/ndpi_api.h.in | 4 ++++ src/include/ndpi_typedefs.h | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'src/include') diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in index fbc9414a4..c0f0042de 100644 --- a/src/include/ndpi_api.h.in +++ b/src/include/ndpi_api.h.in @@ -1426,6 +1426,10 @@ extern "C" { struct ndpi_bin *centroids); u_int32_t ndpi_quick_16_byte_hash(u_int8_t *in_16_bytes_long); + + /* ******************************* */ + + ndpi_rules* ndpi_parse_rules(struct ndpi_detection_module_struct *ndpi_str, char *path); #ifdef __cplusplus } #endif diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 70fab3f75..31043b685 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1553,4 +1553,31 @@ struct ndpi_bin { } u; }; +/* **************************** */ + +typedef struct { + ndpi_ip_addr_t ip; + u_int8_t cidr; + u_int8_t ip_v6:1, _notused:7; + u_int16_t l4_port; +} ndpi_rule_peer; + +typedef enum { + rule_pass, + rule_drop +} ndpi_rule_action; + +typedef struct { + u_int16_t id; + char *description; + u_int8_t l4_proto; + ndpi_rule_action action; + ndpi_rule_peer client, server; /* Network byte order */ + u_int16_t l7_proto; +} ndpi_rule; + +typedef struct { + u_int32_t num_rules; +} ndpi_rules; + #endif /* __NDPI_TYPEDEFS_H__ */ -- cgit v1.2.3