aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2022-12-18 09:10:57 +0100
committerGitHub <noreply@github.com>2022-12-18 08:10:57 +0000
commitad6bfbad4d0b8ae6c0c6b2d58c68eee542110e8a (patch)
tree999ca90928ef9c410807b1376ce7539beeec810c /tests/unit
parentfb0a73c0c7725fbeafda18b816d72f0d2fd6bd02 (diff)
Add protocol disabling feature (#1808)
The application may enable only some protocols. Disabling a protocol means: *) don't register/use the protocol dissector code (if any) *) disable classification by-port for such a protocol *) disable string matchings for domains/certificates involving this protocol *) disable subprotocol registration (if any) This feature can be tested with `ndpiReader -B list_of_protocols_to_disable`. Custom protocols are always enabled. Technically speaking, this commit doesn't introduce any API/ABI incompatibility. However, calling `ndpi_set_protocol_detection_bitmask2()` is now mandatory, just after having called `ndpi_init_detection_module()`. Most of the diffs (and all the diffs in `/src/lib/protocols/`) are due to the removing of some function parameters. Fix the low level macro `NDPI_LOG`. This issue hasn't been detected sooner simply because almost all the code uses only the helpers `NDPI_LOG_*`
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/unit.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/unit/unit.c b/tests/unit/unit.c
index e1713a7c4..440ffadf4 100644
--- a/tests/unit/unit.c
+++ b/tests/unit/unit.c
@@ -356,6 +356,7 @@ int main(int argc, char **argv) {
#ifndef WIN32
int c;
#endif
+ NDPI_PROTOCOL_BITMASK all;
if (ndpi_get_api_version() != NDPI_API_VERSION) {
printf("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n");
@@ -367,6 +368,10 @@ int main(int argc, char **argv) {
if (ndpi_info_mod == NULL)
return -1;
+ NDPI_BITMASK_SET_ALL(all);
+ ndpi_set_protocol_detection_bitmask2(ndpi_info_mod, &all);
+ ndpi_finalize_initialization(ndpi_info_mod);
+
/*
* If we want argument parsing on Windows,
* we need to re-implement it as Windows has no such function.