Cleaned-up issuer DN check code adding

u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct *ndpi_str, char *issuerDN);

Added new API function for checking nDPI-configured exceptions
u_int8_t ndpi_check_flow_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
                                        u_int num_params,
                                        ndpi_risk_params **params);
This commit is contained in:
Luca Deri
2022-07-04 18:41:01 +02:00
parent 8ff2860601
commit e7a5eaecde
4 changed files with 139 additions and 37 deletions
+6
View File
@@ -1640,6 +1640,12 @@ extern "C" {
u_int16_t ndpi_risk2score(ndpi_risk risk,
u_int16_t *client_score, u_int16_t *server_score);
u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
char *issuerDN);
u_int8_t ndpi_check_flow_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
u_int num_params,
ndpi_risk_params **params);
/* ******************************* */
/* HyperLogLog cardinality estimator */
+21 -2
View File
@@ -127,6 +127,26 @@ typedef enum {
typedef u_int64_t ndpi_risk; /* (**) */
typedef enum {
NDPI_PARAM_HOSTNAME /* char* */,
NDPI_PARAM_ISSUER_DN /* char* */,
NDPI_PARAM_HOST_IPV4 /* u_int32_t* */, /* Network byte order */
/*
IMPORTANT
please update ndpi_check_flow_risk_exceptions()
(in ndpi_utils.c) whenever you add a new parameter
*/
/* Leave this as last member */
NDPI_MAX_RISK_PARAM_ID
} ndpi_risk_param_id;
typedef struct {
ndpi_risk_param_id id;
void *value; /* char* for strings, u_int32_t* for IPv4 addresses */
} ndpi_risk_params;
typedef enum {
NDPI_RISK_LOW,
NDPI_RISK_MEDIUM,
@@ -1440,8 +1460,7 @@ typedef struct {
typedef u_int32_t ndpi_init_prefs;
typedef enum
{
typedef enum {
ndpi_no_prefs = 0,
ndpi_dont_load_tor_list = (1 << 0),
ndpi_dont_init_libgcrypt = (1 << 1),