diff options
author | Luca <deri@ntop.org> | 2019-08-27 12:56:15 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2019-08-27 12:56:15 +0200 |
commit | 2acffb41638233f6576663b77bfdd7574014fd1d (patch) | |
tree | 797ee5b4e550a15f4d7d4299c9dccf929aec1cf6 /src/include | |
parent | b837f3753d247b0653b22383eabe8525f684ab29 (diff) |
Initial work towards traffic classification
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h | 11 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 9350cd543..03f21d4cd 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -891,6 +891,17 @@ extern "C" { ndpi_string *key, float *value); int ndpi_deserialize_end_of_record(ndpi_deserializer *deserializer); + /* Data analysis */ + struct ndpi_analyze_struct* ndpi_init_data_analysis(u_int16_t _max_series_len); + void ndpi_free_data_analysis(struct ndpi_analyze_struct *d); + void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int32_t value); + + float ndpi_data_average(struct ndpi_analyze_struct *s); + float ndpi_data_window_average(struct ndpi_analyze_struct *s); + + float ndpi_entropy(struct ndpi_analyze_struct *s); + + void ndpi_data_print_window_values(struct ndpi_analyze_struct *s); /* debug */ #ifdef __cplusplus } #endif diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index bdb5a76e1..2aacf847a 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1363,4 +1363,16 @@ typedef struct { u_int16_t str_len; } ndpi_string; +/* **************************************** */ + +struct ndpi_analyze_struct { + u_int32_t *values; + u_int32_t sum_total, num_data_entries, next_value_insert_index; + u_int16_t num_values_array_len /* lenght of the values array */; +}; + +#define DEFAULT_SERIES_LEN 64 +#define MAX_SERIES_LEN 512 +#define MIN_SERIES_LEN 8 + #endif /* __NDPI_TYPEDEFS_H__ */ |