Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic functions for library configuration [advanced version] #2190

Closed
wants to merge 48 commits into from

Conversation

IvanNardi
Copy link
Collaborator

This is a new way to provide (more) configuration options in nDPI.

The idea is to have a simple way to configure (most of) nDPI: only one function (ndpi_set_config()) to set any configuration parameters (in the present or on in the future) and this function prototype is as agnostic as possible.

This way, anytime we need to add a new configuration parameter:

  • we don't need to add two public functions (a getter and a setter)
  • we don't break API/ABI compatibility of the library; even changing the parameter type (from integer to a list of integer, for example) doesn't break the compatibility.

Two examples of how to extend the configuration are provided:

  • the ability to enable/disable the extraction of the sha1 fingerprint of the TLS certificates.
  • the upper limit on the number of packets per flow that will be subject to inspection

@IvanNardi
Copy link
Collaborator Author

A simpler and updated version of #2066. See previous discussion there

This is a new way to provide (more) configuration options in nDPI.

The idea is to have a simple way to configure (most of) nDPI: only one
function (`ndpi_set_config()`) to set any configuration parameters
(in the present or on in the future) and this function prototype is as
agnostic as possible.

This way, anytime we need to add a new configuration parameter:
 * we don't need to add two public functions (a getter and a setter)
 * we don't break API/ABI compatibility of the library; even changing
the parameter type (from integer to a list of integer, for example)
doesn't break the compatibility.

Two examples of how to extend the configuration are provided:
 * the ability to enable/disable the extraction of the sha1 fingerprint
of the TLS certificates.
 * the upper limit on the number of packets per flow that will be subject
to inspection
@IvanNardi IvanNardi force-pushed the config2 branch 3 times, most recently from 55bb688 to 81bc7d6 Compare December 2, 2023 18:54
Remove: `ndpi_set_detection_preferences()`,
`ndpi_set_opportunistic_tls()`, `ndpi_get_opportunistic_tls()`,
`ndpi_set_protocol_aggressiveness()`,
`ndpi_get_protocol_aggressiveness()`
@IvanNardi IvanNardi force-pushed the config2 branch 2 times, most recently from 3c9c0e7 to c363b4f Compare December 8, 2023 17:07
IvanNardi added a commit to IvanNardi/nDPI that referenced this pull request Dec 9, 2023
Keep looking for RTP packets but remove the monitoring concept.
We will re-introduce a more general concept of "flow in monitoring
state" later.
The function was disabled by default.
Some configuration knobs will be provided when/if ntop#2190 is merged.
IvanNardi added a commit to IvanNardi/nDPI that referenced this pull request Dec 9, 2023
Keep looking for RTP packets but remove the monitoring concept.
We will re-introduce a more general concept of "flow in monitoring
state" later.
The function was disabled by default.
Some configuration knobs will be provided when/if ntop#2190 is merged.
IvanNardi added a commit that referenced this pull request Dec 11, 2023
Keep looking for RTP packets but remove the monitoring concept.
We will re-introduce a more general concept of "flow in monitoring
state" later.
The function was disabled by default.
Some configuration knobs will be provided when/if #2190 is merged.
@IvanNardi
Copy link
Collaborator Author

IvanNardi commented Dec 29, 2023

API changes

Almost all nDPI configuration is made via ndpi_set_config() and lots of configuration functions have been removed.
Important examples of API changes:

  • Enumeration ndpi_init_prefs has been removed: struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs prefs) --> struct ndpi_detection_module_struct *ndpi_init_detection_module(void).
    Example: ndpi_s = ndpi_init_detection_module(ndpi_track_flow_payload); --> ndpi_s = ndpi_init_detection_module(); ndpi_set_config(ndpi_s, NULL, "flow.track_payload.enable", "1");

  • All protocols are enabled by default: ndpi_set_protocol_detection_bitmask2() has been removed

  • ndpi_finalize_initialization must be called at the end of the configuration/init phase and its (new) return value must be checked

  • Enabling/disabling guessing algorithm in ndpi_detection_giveup() is done in general configuration/init phase and no more as specific parameter of this function
    TODO

Copy link

sonarqubecloud bot commented Jan 8, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@IvanNardi IvanNardi changed the title Add generic functions for library configuration Add generic functions for library configuration [advanced version] Jan 9, 2024
@IvanNardi IvanNardi closed this Jan 18, 2024
@IvanNardi IvanNardi deleted the config2 branch February 15, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant