diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-02-07 14:06:38 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-02-25 10:29:46 +0100 |
commit | d5d633f475b6860f839860f7cad42a765ae64ac9 (patch) | |
tree | d45f44ec6b5d806e23588acf50c54626bb0959b1 /src/lib/ndpi_main.c | |
parent | 34e020ac35a40b9b9440d0064dcd9dcf64fe0cbe (diff) |
Provide some API functions for convenience.improved/serialization-and-api-helper
* Extended JSON serializsation: risk, risk score, confidence
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 37d73172c..c0a871cc5 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -6490,6 +6490,27 @@ u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi /* ********************************************************************************* */ +u_int16_t ndpi_get_flow_appprotocol(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow) { + return(flow->detected_protocol_stack[0]); +} + +/* ********************************************************************************* */ + +ndpi_protocol_category_t ndpi_get_flow_category(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow) +{ + return(flow->category); +} + +void ndpi_get_flow_ndpi_proto(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, + struct ndpi_proto * ndpi_proto) +{ + ndpi_proto->master_protocol = ndpi_get_flow_masterprotocol(ndpi_str, flow); + ndpi_proto->app_protocol = ndpi_get_flow_appprotocol(ndpi_str, flow); + ndpi_proto->category = ndpi_get_flow_category(ndpi_str, flow); +} + +/* ********************************************************************************* */ + static void ndpi_int_change_flow_protocol(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, u_int16_t upper_detected_protocol, u_int16_t lower_detected_protocol, ndpi_confidence_t confidence) { |