diff options
author | Luca Deri <deri@ntop.org> | 2021-03-11 00:04:33 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-03-11 00:04:33 +0100 |
commit | 6833ee2bbec4c2de2489a2091f6c2d1ce0b7b558 (patch) | |
tree | 4a4f04e0e282482b6e45e58ad5737173db470612 /src/include | |
parent | 5b7fe1360a1ed13c9cf6e1f789f0c1a20b175bd8 (diff) |
Added single exponential smoothing API
int ndpi_ses_init(struct ndpi_ses_struct *ses, double alpha, float significance);
int ndpi_ses_add_value(struct ndpi_ses_struct *ses, const u_int32_t _value, double *forecast, double *confidence_band);
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h.in | 5 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in index c12910609..cb5e45931 100644 --- a/src/include/ndpi_api.h.in +++ b/src/include/ndpi_api.h.in @@ -1474,6 +1474,11 @@ extern "C" { /* ******************************* */ + int ndpi_ses_init(struct ndpi_ses_struct *ses, double alpha, float significance); + int ndpi_ses_add_value(struct ndpi_ses_struct *ses, const u_int32_t _value, double *forecast, double *confidence_band); + + /* ******************************* */ + int ndpi_jitter_init(struct ndpi_jitter_struct *hw, u_int16_t num_periods); void ndpi_jitter_free(struct ndpi_jitter_struct *hw); float ndpi_jitter_add_value(struct ndpi_jitter_struct *s, const float value); diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 35b3b95dd..de9a404c8 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1663,6 +1663,17 @@ struct ndpi_hw_struct { double *s; }; +struct ndpi_ses_struct { + struct { + double alpha, ro; + } params; + + u_int32_t num_values; + double sum_square_error, last_forecast, last_value; +}; + +/* **************************************** */ + /* Prototype used to define custom DGA detection function */ typedef int (*ndpi_custom_dga_predict_fctn)(const char* domain, int domain_length); |