From 0c2d559ed3061c05620a3970fe69ba327ed50b53 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 5 Sep 2022 11:32:27 +0200 Subject: Serialize nDPI detection/dissection data as object. Signed-off-by: Toni Uhlig --- src/lib/ndpi_utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/ndpi_utils.c') diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 2653a8f83..b86313c75 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1198,7 +1198,6 @@ void ndpi_serialize_proto(struct ndpi_detection_module_struct *ndpi_struct, { char buf[64]; - ndpi_serialize_start_of_block(serializer, "ndpi"); ndpi_serialize_risk(serializer, risk); ndpi_serialize_confidence(serializer, confidence); ndpi_serialize_string_string(serializer, "proto", ndpi_protocol2name(ndpi_struct, l7_protocol, buf, sizeof(buf))); @@ -1213,7 +1212,6 @@ void ndpi_serialize_proto(struct ndpi_detection_module_struct *ndpi_struct, ndpi_serialize_string_uint32(serializer, "category_id", l7_protocol.category); ndpi_serialize_string_string(serializer, "category", ndpi_category_get_name(ndpi_struct, l7_protocol.category)); } - ndpi_serialize_end_of_block(serializer); } /* ********************************** */ @@ -1314,6 +1312,7 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct, if(flow == NULL) return(-1); + ndpi_serialize_start_of_block(serializer, "ndpi"); ndpi_serialize_proto(ndpi_struct, serializer, flow->risk, flow->confidence, l7_protocol); host_server_name = ndpi_get_flow_info(flow, &l7_protocol); @@ -1522,6 +1521,8 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct, break; } /* switch */ + ndpi_serialize_end_of_block(serializer); // "ndpi" + return(0); } -- cgit v1.2.3