diff options
author | berat <beratiz@gmail.com> | 2017-09-25 11:14:57 +0200 |
---|---|---|
committer | berat <beratiz@gmail.com> | 2017-09-25 11:14:57 +0200 |
commit | 688d7c33e4339e67bfb9e7a52e602b3d53c7ac9a (patch) | |
tree | acb235d0df942715ffc3f0830b6d2aed1371f949 /example/ndpiReader.c | |
parent | b0f3852fed9273f530753573ca1bde9d714ae988 (diff) |
improved (-x flag) bpf filter condition
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index f1cb40c75..5da9cd18b 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -2485,6 +2485,10 @@ void bpf_filter_port_array_add(int filter_array[], int size, int port) { /* *********************************************** */ +#ifdef HAVE_JSON_C +/* + * @brief returns average value for a given field + */ float getAverage(struct json_object *jObj_stat, char *field){ json_object *field_stat; json_bool res; @@ -2512,8 +2516,13 @@ float getAverage(struct json_object *jObj_stat, char *field){ return sum/j; } +#endif /* *********************************************** */ - +#ifdef HAVE_JSON_C +/* + * @brief returns standard deviation for a given + * field and it's average value. + */ float getStdDeviation(struct json_object *jObj_stat, float average, char *field){ json_object *field_stat; json_bool res; @@ -2539,15 +2548,16 @@ float getStdDeviation(struct json_object *jObj_stat, float average, char *field) return sqrt(sum/(float)j); } +#endif /* *********************************************** */ +#ifdef HAVE_JSON_C /* * @brief add ports which have (flows/packets > threshold) * and have (#flows > %1 of total flows) to the srcPortArray * to filter */ -#ifdef HAVE_JSON_C void getPacketBasedSourcePortsToFilter(struct json_object *jObj_stat, int srcPortArray[], int size) { int j; |