Updated API for ndpi_risk2score()

Added ndpi_get_upper_proto() API call
This commit is contained in:
Luca Deri
2021-05-17 22:39:07 +02:00
parent 43a8576efb
commit 0b3d627185
4 changed files with 19 additions and 10 deletions
+4 -1
View File
@@ -895,6 +895,9 @@ extern "C" {
ndpi_l4_proto_info ndpi_get_l4_proto_info(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_proto_id); ndpi_l4_proto_info ndpi_get_l4_proto_info(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_proto_id);
const char* ndpi_get_l4_proto_name(ndpi_l4_proto_info proto); const char* ndpi_get_l4_proto_name(ndpi_l4_proto_info proto);
u_int16_t ndpi_get_lower_proto(ndpi_protocol proto);
u_int16_t ndpi_get_upper_proto(ndpi_protocol proto);
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod); ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod); u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod); u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
@@ -1510,7 +1513,7 @@ extern "C" {
const char* ndpi_risk2str(ndpi_risk_enum risk); const char* ndpi_risk2str(ndpi_risk_enum risk);
ndpi_risk_severity ndpi_risk2severity(ndpi_risk_enum risk); ndpi_risk_severity ndpi_risk2severity(ndpi_risk_enum risk);
u_int16_t ndpi_risk2score(ndpi_risk_enum risk); u_int16_t ndpi_risk2score(ndpi_risk risk);
/* ******************************* */ /* ******************************* */
+6
View File
@@ -6183,6 +6183,12 @@ static int ndpi_init_packet_header(struct ndpi_detection_module_struct *ndpi_str
return((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN) ? proto.master_protocol : proto.app_protocol); return((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN) ? proto.master_protocol : proto.app_protocol);
} }
/* ****************************************************** */
u_int16_t ndpi_get_upper_proto(ndpi_protocol proto) {
return((proto.app_protocol != NDPI_PROTOCOL_UNKNOWN) ? proto.app_protocol : proto.master_protocol);
}
/* ****************************************************** */ /* ****************************************************** */
ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_str, ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_str,
+1 -1
View File
@@ -1781,7 +1781,7 @@ ndpi_risk_severity ndpi_risk2severity(ndpi_risk_enum risk) {
/* ******************************************************************** */ /* ******************************************************************** */
u_int16_t ndpi_risk2score(ndpi_risk_enum risk) { u_int16_t ndpi_risk2score(ndpi_risk risk) {
u_int16_t score = 0; u_int16_t score = 0;
u_int32_t i; u_int32_t i;