diff options
author | Luca Deri <deri@ntop.org> | 2025-01-31 19:02:13 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2025-01-31 19:02:13 +0100 |
commit | 71bd58532ad6648b5b80669bd992d6918ad9b69c (patch) | |
tree | 0b92494de74d4a6e383dc2384e5a79b4d1c7760f /src/lib/ndpi_main.c | |
parent | dd4807f8ee66d2e4ff81ec43481943c4d17fb574 (diff) |
Added ndpi_network_ptree6_match() API call
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index f3104a9a8..5b5506195 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2725,6 +2725,24 @@ u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_str /* ******************************************* */ +u_int16_t ndpi_network_ptree6_match(struct ndpi_detection_module_struct *ndpi_str, + struct in6_addr *pin) { + ndpi_prefix_t prefix; + ndpi_patricia_node_t *node; + + if(!ndpi_str || !ndpi_str->protocols) + return(NDPI_PROTOCOL_UNKNOWN); + + /* Make sure all in network byte order otherwise compares wont work */ + ndpi_fill_prefix_v6(&prefix, pin, 128, + ((ndpi_patricia_tree_t *) ndpi_str->protocols->v4)->maxbits); + node = ndpi_patricia_search_best(ndpi_str->protocols->v4, &prefix); + + return(node ? node->value.u.uv16[0].user_value : NDPI_PROTOCOL_UNKNOWN); +} + +/* ******************************************* */ + u_int16_t ndpi_network_port_ptree_match(struct ndpi_detection_module_struct *ndpi_str, struct in_addr *pin /* network byte order */, u_int16_t port /* network byte order */) { |