diff options
author | Nardi Ivan <nardi.ivan@gmail.com> | 2024-01-09 10:24:36 +0100 |
---|---|---|
committer | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2024-01-18 10:21:24 +0100 |
commit | 3107a958816f3a09ce39a36b42d03a0b0046225f (patch) | |
tree | f4e0967017b591fd5d9a795cf8524f8d86bcf2c0 /src | |
parent | d72a760ac3895dd8a0bd3e55d4b51f9e22e04e6c (diff) |
Make `ndpi_finalize_initialization()` returns an error code
We should check if the initialization was fine or not
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_api.h | 4 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 3a5c7eccc..9c53713de 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -222,8 +222,10 @@ extern "C" { * * @par ndpi_str = the struct created for the protocol detection * + * @return 0 on success + * */ - void ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str); + int ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str); /** * Frees the dynamic memory allocated members in the specified flow diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index bc850df64..39a72267c 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -3514,13 +3514,13 @@ static void ndpi_add_domain_risk_exceptions(struct ndpi_detection_module_struct /* *********************************************** */ -void ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str) { +int ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str) { u_int i; if(!ndpi_str) - return; + return -1; if(ndpi_str->finalized) /* Already finalized */ - return; + return 0; ndpi_add_domain_risk_exceptions(ndpi_str); @@ -3589,7 +3589,7 @@ void ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str) } } - if(ndpi_str->ac_automa_finalized) return; + if(ndpi_str->ac_automa_finalized) return -1; ndpi_automa * const automa[] = { &ndpi_str->host_automa, &ndpi_str->tls_cert_subject_automa, @@ -3607,7 +3607,7 @@ void ndpi_finalize_initialization(struct ndpi_detection_module_struct *ndpi_str) ndpi_str->finalized = 1; - return; + return 0; } /* *********************************************** */ |