aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.seed11
-rw-r--r--example/ndpiReader.c2
-rw-r--r--example/ndpiSimpleIntegration.c33
-rw-r--r--example/reader_util.c8
-rw-r--r--example/reader_util.h11
-rw-r--r--packages/openwrt/Makefile14
-rw-r--r--packages/openwrt/README25
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/ndpi_classify.h26
-rw-r--r--src/include/ndpi_define.h.in2
-rw-r--r--src/include/ndpi_includes.h6
-rw-r--r--src/include/ndpi_includes_OpenBSD.h43
-rw-r--r--src/include/ndpi_protocol_ids.h2
-rw-r--r--src/lib/ndpi_classify.c52
-rw-r--r--src/lib/ndpi_community_id.c1
-rw-r--r--src/lib/ndpi_content_match.c.inc7
-rw-r--r--src/lib/ndpi_main.c4
18 files changed, 183 insertions, 67 deletions
diff --git a/Makefile.am b/Makefile.am
index e4d8c58c9..6238c8b3c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src/lib example tests
+SUBDIRS = src/lib @EXTRA_TARGETS@
if BUILD_FUZZTARGETS
SUBDIRS += fuzz
diff --git a/configure.seed b/configure.seed
index b344064cd..087150a39 100644
--- a/configure.seed
+++ b/configure.seed
@@ -4,6 +4,14 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
+EXTRA_TARGETS="example tests"
+AC_ARG_WITH(only-libndpi, AS_HELP_STRING([--with-only-libndpi], [Build only libndpi (no examples, tests etc)]))
+AS_IF([test "${with_only_libndpi+set}" = set],[
+ EXTRA_TARGETS=""
+])
+
+
+
AC_ARG_WITH(sanitizer, AS_HELP_STRING([--with-sanitizer], [Build with support for address, undefined and leak sanitizer]))
AC_ARG_ENABLE(fuzztargets, AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
@@ -59,6 +67,8 @@ else
NDPI_API_VERSION=`date +%s | cut -c7-10`
fi
+NDPI_API_VERSION=`echo $NDPI_API_VERSION | sed 's/^0*//'`
+
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
@@ -187,4 +197,5 @@ AC_SUBST(DPDK_TARGET)
AC_SUBST(HAVE_PTHREAD_SETAFFINITY_NP)
AC_SUBST(CUSTOM_NDPI)
AC_SUBST(NDPI_API_VERSION)
+AC_SUBST(EXTRA_TARGETS)
AC_OUTPUT
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 03ab1df4a..5202c8b78 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -3121,7 +3121,7 @@ void * processing_thread(void *_thread_id) {
gettimeofday(&h.ts, NULL);
ndpi_process_packet((u_char*)&thread_id, &h, (const u_char *)data);
- rte_pktmbuf_ndpi_free(bufs[i]);
+ rte_pktmbuf_free(bufs[i]);
}
}
#else
diff --git a/example/ndpiSimpleIntegration.c b/example/ndpiSimpleIntegration.c
index bf16dbd95..eedf86ffc 100644
--- a/example/ndpiSimpleIntegration.c
+++ b/example/ndpiSimpleIntegration.c
@@ -9,6 +9,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#define MAX_FLOW_ROOTS_PER_THREAD 2048
@@ -133,7 +134,8 @@ static struct nDPI_workflow * init_workflow(char const * const file_or_device)
}
if (workflow->pcap_handle == NULL) {
- fprintf(stderr, "pcap_open_live / pcap_open_offline_with_tstamp_precision: %s\n", pcap_error_buffer);
+ fprintf(stderr, "pcap_open_live / pcap_open_offline_with_tstamp_precision: %.*s\n",
+ (int) PCAP_ERRBUF_SIZE, pcap_error_buffer);
free_workflow(&workflow);
return NULL;
}
@@ -204,9 +206,25 @@ static void free_workflow(struct nDPI_workflow ** const workflow)
*workflow = NULL;
}
+static char * get_default_pcapdev(char *errbuf)
+{
+ char * ifname;
+ pcap_if_t * all_devices = NULL;
+
+ if (pcap_findalldevs(&all_devices, errbuf) != 0)
+ {
+ return NULL;
+ }
+
+ ifname = strdup(all_devices[0].name);
+ pcap_freealldevs(all_devices);
+
+ return ifname;
+}
+
static int setup_reader_threads(char const * const file_or_device)
{
- char const * file_or_default_device;
+ char * file_or_default_device;
char pcap_error_buffer[PCAP_ERRBUF_SIZE];
if (reader_thread_count > MAX_READER_THREADS) {
@@ -214,23 +232,28 @@ static int setup_reader_threads(char const * const file_or_device)
}
if (file_or_device == NULL) {
- file_or_default_device = pcap_lookupdev(pcap_error_buffer);
+ file_or_default_device = get_default_pcapdev(pcap_error_buffer);
if (file_or_default_device == NULL) {
- fprintf(stderr, "pcap_lookupdev: %s\n", pcap_error_buffer);
+ fprintf(stderr, "pcap_findalldevs: %.*s\n", (int) PCAP_ERRBUF_SIZE, pcap_error_buffer);
return 1;
}
} else {
- file_or_default_device = file_or_device;
+ file_or_default_device = strdup(file_or_device);
+ if (file_or_default_device == NULL) {
+ return 1;
+ }
}
for (int i = 0; i < reader_thread_count; ++i) {
reader_threads[i].workflow = init_workflow(file_or_default_device);
if (reader_threads[i].workflow == NULL)
{
+ free(file_or_default_device);
return 1;
}
}
+ free(file_or_default_device);
return 0;
}
diff --git a/example/reader_util.c b/example/reader_util.c
index 7e68a378d..d0f16ab62 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -692,7 +692,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
u_int8_t **payload,
u_int16_t *payload_len,
u_int8_t *src_to_dst_direction,
- struct timeval when) {
+ pkt_timeval when) {
u_int32_t idx, l4_offset, hashval;
struct ndpi_flow_info flow;
void *ret;
@@ -979,7 +979,7 @@ static struct ndpi_flow_info *get_ndpi_flow_info6(struct ndpi_workflow * workflo
u_int8_t **payload,
u_int16_t *payload_len,
u_int8_t *src_to_dst_direction,
- struct timeval when) {
+ pkt_timeval when) {
struct ndpi_iphdr iph;
memset(&iph, 0, sizeof(iph));
@@ -1300,7 +1300,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
u_int16_t ipsize, u_int16_t rawsize,
const struct pcap_pkthdr *header,
const u_char *packet,
- struct timeval when,
+ pkt_timeval when,
FILE * csv_fp) {
struct ndpi_id_struct *src, *dst;
struct ndpi_flow_info *flow = NULL;
@@ -1330,7 +1330,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
&payload, &payload_len, &src_to_dst_direction, when);
if(flow != NULL) {
- struct timeval tdiff;
+ pkt_timeval tdiff;
workflow->stats.ip_packet_count++;
workflow->stats.total_wire_bytes += rawsize + 24 /* CRC etc */,
diff --git a/example/reader_util.h b/example/reader_util.h
index d4e3dc74f..4dba29ddc 100644
--- a/example/reader_util.h
+++ b/example/reader_util.h
@@ -31,6 +31,7 @@
#include "uthash.h"
#include <pcap.h>
+#include "ndpi_includes.h"
#include "ndpi_classify.h"
#include "ndpi_typedefs.h"
@@ -128,13 +129,13 @@ struct flow_metrics {
struct ndpi_entropy {
// Entropy fields
- struct timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
+ pkt_timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
u_int16_t src2dst_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
- struct timeval src2dst_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
+ pkt_timeval src2dst_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
u_int16_t dst2src_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
- struct timeval dst2src_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
- struct timeval src2dst_start; /*!< first packet arrival time */
- struct timeval dst2src_start; /*!< first packet arrival time */
+ pkt_timeval dst2src_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
+ pkt_timeval src2dst_start; /*!< first packet arrival time */
+ pkt_timeval dst2src_start; /*!< first packet arrival time */
u_int32_t src2dst_opackets; /*!< non-zero packet counts */
u_int32_t dst2src_opackets; /*!< non-zero packet counts */
u_int16_t src2dst_pkt_count; /*!< packet counts */
diff --git a/packages/openwrt/Makefile b/packages/openwrt/Makefile
index 4b8429b59..5d56e18ad 100644
--- a/packages/openwrt/Makefile
+++ b/packages/openwrt/Makefile
@@ -1,22 +1,22 @@
#
-# Copyright (C) 2018 - ntop.org
+# Copyright (C) 2018-20 - ntop.org
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libndpi
-PKG_VERSION:=1333.ab2f3ce
+PKG_VERSION:=17022020
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/ntop/nDPI.git
-PKG_SOURCE_VERSION:=ab2f3cefc89017d73e67faa4eb4011e7e3f2044d
+PKG_SOURCE_VERSION:=1f921562d1d7962f1d23ca5b59c25f9b65073460
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
-PKG_MAINTAINER:=Emanuele Faranda <faranda@ntop.org>
+PKG_MAINTAINER:=Luca Deri <deri@ntop.org>
PKG_LICENSE:=GPL3
-PKG_BUILD_DEPENDS:=+libpcap
+PKG_BUILD_DEPENDS:=
PKG_BUILD_PARALLEL:=1
# autogen fix
@@ -27,7 +27,6 @@ include $(INCLUDE_DIR)/package.mk
define Package/libndpi
SECTION:=network
CATEGORY:=Network
- #DEPENDS:=+libc +libjson-c +libpthread
TITLE:=nDPI Deep Packet Inspection Library
URL:=https://www.ntop.org
endef
@@ -37,8 +36,7 @@ define Package/libndpi/description
endef
CONFIGURE_ARGS += \
- --with-pic \
- --disable-json-c \
+ --with-only-libndpi
define Build/Prepare
$(call Build/Prepare/Default)
diff --git a/packages/openwrt/README b/packages/openwrt/README
new file mode 100644
index 000000000..5a2cf2712
--- /dev/null
+++ b/packages/openwrt/README
@@ -0,0 +1,25 @@
+Howto Compile lindpi on OpenWRT
+-------------------------------
+
+cd myopenwrt_directory
+mkdir package/network/services/libndpi
+cd package/network/services/libndpi
+cp ~/nDPI/packages/openwrt/Makefile .
+cd myopenwrt_directory
+make menuconfig
+
+Go under network and select
+
+<M> libndpi.............................. nDPI Deep Packet Inspection Library
+
+
+Build Commands
+--------------
+
+If you want to build just libndpi do:
+make -j1 V=s package/network/services/libndpi/clean
+make -j1 V=s package/network/services/libndpi/compile
+
+Other Documents
+---------------
+https://openwrt.org/packages/pkgdata/libndpi \ No newline at end of file
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index db4e40f35..19d6c60cf 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -8,4 +8,5 @@ library_include_HEADERS = ndpi_api.h \
ndpi_protocol_ids.h \
ndpi_protocols.h \
ndpi_win32.h \
+ ndpi_includes_OpenBSD.h \
ndpi_includes.h
diff --git a/src/include/ndpi_classify.h b/src/include/ndpi_classify.h
index 4d2cfff97..ab9212832 100644
--- a/src/include/ndpi_classify.h
+++ b/src/include/ndpi_classify.h
@@ -43,7 +43,7 @@
#ifndef NDPI_CLASSIFY_H
#define NDPI_CLASSIFY_H
-
+#include "ndpi_includes.h"
/* constants */
#define NUM_PARAMETERS_SPLT_LOGREG 208
@@ -66,27 +66,27 @@ extern float parameters_bd[NUM_PARAMETERS_BD_LOGREG];
extern float parameters_splt[NUM_PARAMETERS_SPLT_LOGREG];
/* Classifier functions */
-float ndpi_classify(const unsigned short *pkt_len, const struct timeval *pkt_time,
- const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
+float ndpi_classify(const unsigned short *pkt_len, const pkt_timeval *pkt_time,
+ const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t);
-void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const struct timeval *pkt_time,
- const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin,
+void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const pkt_timeval *pkt_time,
+ const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin,
uint16_t s_idx, uint16_t r_idx,
uint16_t *merged_lens, uint16_t *merged_times);
void ndpi_update_params(classifier_type_codes_t param_type, const char *param_file);
void ndpi_flow_info_freer(void *node);
-unsigned int ndpi_timer_eq(const struct timeval *a, const struct timeval *b);
-unsigned int ndpi_timer_lt(const struct timeval *a, const struct timeval *b);
-void ndpi_timer_sub(const struct timeval *a, const struct timeval *b, struct timeval *result);
-void ndpi_timer_clear(struct timeval *a);
-unsigned int ndpi_timeval_to_milliseconds(struct timeval ts);
-unsigned int ndpi_timeval_to_microseconds(struct timeval ts);
+unsigned int ndpi_timer_eq(const pkt_timeval *a, const pkt_timeval *b);
+unsigned int ndpi_timer_lt(const pkt_timeval *a, const pkt_timeval *b);
+void ndpi_timer_sub(const pkt_timeval *a, const pkt_timeval *b, pkt_timeval *result);
+void ndpi_timer_clear(pkt_timeval *a);
+unsigned int ndpi_timeval_to_milliseconds(pkt_timeval ts);
+unsigned int ndpi_timeval_to_microseconds(pkt_timeval ts);
void ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len);
#endif /* NDPI_CLASSIFY_H */
diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in
index 990f84bf4..1fb0d282c 100644
--- a/src/include/ndpi_define.h.in
+++ b/src/include/ndpi_define.h.in
@@ -35,7 +35,9 @@
#include <endian.h>
#define __BYTE_ORDER BYTE_ORDER
#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef __LITTLE_ENDIAN__
#define __LITTLE_ENDIAN__
+#endif /* __LITTLE_ENDIAN__ */
#else
#define __BIG_ENDIAN__
#endif/* BYTE_ORDER */
diff --git a/src/include/ndpi_includes.h b/src/include/ndpi_includes.h
index f8bde5194..99c50fe02 100644
--- a/src/include/ndpi_includes.h
+++ b/src/include/ndpi_includes.h
@@ -57,7 +57,7 @@
#if defined __NetBSD__ || defined __OpenBSD__
#include <netinet/in_systm.h>
-#ifdef __OpenBSD__
+#if defined __OpenBSD__
#include <pthread.h>
#endif
@@ -67,4 +67,8 @@
#endif /* Win32 */
+#if defined __OpenBSD__
+#include "ndpi_includes_OpenBSD.h"
+#endif /* __OpenBSD__ */
+
#endif /* __NDPI_INCLUDES_H__ */
diff --git a/src/include/ndpi_includes_OpenBSD.h b/src/include/ndpi_includes_OpenBSD.h
new file mode 100644
index 000000000..4efdbd844
--- /dev/null
+++ b/src/include/ndpi_includes_OpenBSD.h
@@ -0,0 +1,43 @@
+/*
+ * ndpi_includes_OpenBSD.h
+ *
+ * Copyright (C) 2011-16 - ntop.org
+ *
+ * This file is part of nDPI, an open source deep packet inspection
+ * library based on the OpenDPI and PACE technology by ipoque GmbH
+ *
+ * nDPI is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * nDPI is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with nDPI. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __NDPI_INCLUDES_OPENBSD_H__
+#define __NDPI_INCLUDES_OPENBSD_H__
+
+#ifdef __OpenBSD__
+
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif /* IPPROTO_SCTP */
+
+#endif /* __OpenBSD__ */
+
+
+#ifdef __OpenBSD__
+#include <net/bpf.h>
+typedef struct bpf_timeval pkt_timeval;
+#else
+typedef struct timeval pkt_timeval;
+#endif /* __OpenBSD__ */
+
+#endif /* __NDPI_INCLUDES_OPENBSD_H__ */
diff --git a/src/include/ndpi_protocol_ids.h b/src/include/ndpi_protocol_ids.h
index c653429ef..07f444e8e 100644
--- a/src/include/ndpi_protocol_ids.h
+++ b/src/include/ndpi_protocol_ids.h
@@ -87,7 +87,7 @@ typedef enum {
NDPI_PROTOCOL_ZATTOO = 55,
NDPI_PROTOCOL_SHOUTCAST = 56,
NDPI_PROTOCOL_SOPCAST = 57,
- NDPI_PROTOCOL_FREE_58 = 58, /* Free */
+ NDPI_PROTOCOL_DISCORD = 58,
NDPI_PROTOCOL_TVUPLAYER = 59,
NDPI_PROTOCOL_HTTP_DOWNLOAD = 60,
NDPI_PROTOCOL_QQLIVE = 61,
diff --git a/src/lib/ndpi_classify.c b/src/lib/ndpi_classify.c
index 9791db324..7b410e05f 100644
--- a/src/lib/ndpi_classify.c
+++ b/src/lib/ndpi_classify.c
@@ -240,9 +240,9 @@ float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
};
/**
- * \fn void ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
- const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin,
+ * \fn void ndpi_merge_splt_arrays (const uint16_t *pkt_len, const pkt_timeval *pkt_time,
+ const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin,
uint16_t s_idx, uint16_t r_idx,
uint16_t *merged_lens, uint16_t *merged_times,
uint32_t max_num_pkt_len, uint32_t max_merged_num_pkts)
@@ -260,16 +260,16 @@ float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
* \return none
*/
void
-ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
- const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin,
+ndpi_merge_splt_arrays (const uint16_t *pkt_len, const pkt_timeval *pkt_time,
+ const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin,
uint16_t s_idx, uint16_t r_idx,
uint16_t *merged_lens, uint16_t *merged_times)
{
int s,r;
- struct timeval ts_start = { 0, 0 }; /* initialize to avoid spurious warnings */
- struct timeval tmp, tmp_r;
- struct timeval start_m;
+ pkt_timeval ts_start = { 0, 0 }; /* initialize to avoid spurious warnings */
+ pkt_timeval tmp, tmp_r;
+ pkt_timeval start_m;
if(r_idx + s_idx == 0) {
return ;
@@ -419,9 +419,9 @@ ndpi_get_mc_rep_times (uint16_t *times, float *time_mc, uint16_t num_packets)
}
/**
- * \fn float classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
- const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
+ * \fn float classify (const unsigned short *pkt_len, const pkt_timeval *pkt_time,
+ const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
* \param pkt_len length of the packet
@@ -445,9 +445,9 @@ ndpi_get_mc_rep_times (uint16_t *times, float *time_mc, uint16_t num_packets)
* \return float score
*/
float
-ndpi_classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
- const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
- struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
+ndpi_classify (const unsigned short *pkt_len, const pkt_timeval *pkt_time,
+ const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
+ pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
{
@@ -604,8 +604,8 @@ ndpi_update_params (classifier_type_codes_t param_type, const char *param_file)
* \return 1 if equal, 0 otherwise
*/
unsigned int
-ndpi_timer_eq(const struct timeval *a,
- const struct timeval *b)
+ndpi_timer_eq(const pkt_timeval *a,
+ const pkt_timeval *b)
{
if(a->tv_sec == b->tv_sec && a->tv_usec == b->tv_usec) {
return 1;
@@ -615,8 +615,8 @@ ndpi_timer_eq(const struct timeval *a,
}
unsigned int
-ndpi_timer_lt(const struct timeval *a,
- const struct timeval *b)
+ndpi_timer_lt(const pkt_timeval *a,
+ const pkt_timeval *b)
{
return (a->tv_sec == b->tv_sec) ?
(a->tv_usec < b->tv_usec):(a->tv_sec < b->tv_sec);
@@ -630,9 +630,9 @@ ndpi_timer_lt(const struct timeval *a,
* \return none
*/
void
-ndpi_timer_sub(const struct timeval *a,
- const struct timeval *b,
- struct timeval *result)
+ndpi_timer_sub(const pkt_timeval *a,
+ const pkt_timeval *b,
+ pkt_timeval *result)
{
result->tv_sec = a->tv_sec - b->tv_sec;
result->tv_usec = a->tv_usec - b->tv_usec;
@@ -648,7 +648,7 @@ ndpi_timer_sub(const struct timeval *a,
* \return none
*/
void
-ndpi_timer_clear(struct timeval *a)
+ndpi_timer_clear(pkt_timeval *a)
{
a->tv_sec = a->tv_usec = 0;
}
@@ -659,7 +659,7 @@ ndpi_timer_clear(struct timeval *a)
* \return unsigned int - Milliseconds
*/
unsigned int
-ndpi_timeval_to_milliseconds(struct timeval ts)
+ndpi_timeval_to_milliseconds(pkt_timeval ts)
{
unsigned int result = ts.tv_usec / 1000 + ts.tv_sec * 1000;
return result;
@@ -671,7 +671,7 @@ ndpi_timeval_to_milliseconds(struct timeval ts)
* \return unsigned int - Milliseconds
*/
unsigned int
-ndpi_timeval_to_microseconds(struct timeval ts)
+ndpi_timeval_to_microseconds(pkt_timeval ts)
{
unsigned int result = ts.tv_usec + ts.tv_sec * 1000 * 1000;
return result;
@@ -680,7 +680,7 @@ ndpi_timeval_to_microseconds(struct timeval ts)
void
ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len)
{
- struct timeval tv;
+ pkt_timeval tv;
time_t nowtime;
struct tm nowtm_r;
char tmbuf[NDPI_TIMESTAMP_LEN];
diff --git a/src/lib/ndpi_community_id.c b/src/lib/ndpi_community_id.c
index 72f60c746..cc8436928 100644
--- a/src/lib/ndpi_community_id.c
+++ b/src/lib/ndpi_community_id.c
@@ -31,6 +31,7 @@
#include "ndpi_api.h"
#include "ndpi_config.h"
+#include "ndpi_includes.h"
#include <time.h>
#ifndef WIN32
diff --git a/src/lib/ndpi_content_match.c.inc b/src/lib/ndpi_content_match.c.inc
index 29e2a4277..761ec53d5 100644
--- a/src/lib/ndpi_content_match.c.inc
+++ b/src/lib/ndpi_content_match.c.inc
@@ -9138,6 +9138,13 @@ static ndpi_protocol_match host_match[] =
{ ".net.anydesk.com", "AnyDesk", NDPI_PROTOCOL_ANYDESK, NDPI_PROTOCOL_CATEGORY_REMOTE_ACCESS, NDPI_PROTOCOL_ACCEPTABLE },
+ { "discordapp.com", "Discord", NDPI_PROTOCOL_DISCORD, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
+ { "discordapp.net", "Discord", NDPI_PROTOCOL_DISCORD, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
+ { "discord.com", "Discord", NDPI_PROTOCOL_DISCORD, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
+ { "discord.gg", "Discord", NDPI_PROTOCOL_DISCORD, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
+ { "discord.media", "Discord", NDPI_PROTOCOL_DISCORD, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
+
+
{ NULL, NULL, NDPI_PROTOCOL_UNKNOWN, NDPI_PROTOCOL_CATEGORY_UNSPECIFIED, NDPI_PROTOCOL_SAFE }
};
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 0a4ee3a42..ea2aeb206 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -914,8 +914,8 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
no_master, no_master, "Sopcast", NDPI_PROTOCOL_CATEGORY_VIDEO,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
- ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_58, 0 /* can_have_a_subprotocol */,
- no_master, no_master, "Free58", NDPI_PROTOCOL_CATEGORY_VIDEO,
+ ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_DISCORD, 0 /* can_have_a_subprotocol */,
+ no_master, no_master, "Discord", NDPI_PROTOCOL_CATEGORY_COLLABORATIVE,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_TVUPLAYER, 0 /* can_have_a_subprotocol */,