Provide some API functions for convenience. (#1456)

* Extended JSON serializsation: risk, risk score, confidence

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2022-02-25 14:26:04 +01:00
committed by GitHub
parent 34e020ac35
commit f14dcb8344
5 changed files with 225 additions and 9 deletions
+21
View File
@@ -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) {