aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-08-14 22:51:09 +0200
committerGitHub <noreply@github.com>2023-08-14 22:51:09 +0200
commit5867f43fae70b1a08b64e8635bf8183ba4d29124 (patch)
tree6204868707874c790dfe103fcdfc9c34f1b792bb
parentcfbb7a423edd42976097b779ac9d71f1c4badeee (diff)
Fix compilation on Windows (#2072)
-rw-r--r--src/lib/Makefile.in2
-rw-r--r--src/lib/ndpi_analyze.c3
-rw-r--r--src/lib/ndpi_filter.c2
-rw-r--r--src/lib/third_party/include/MurmurHash3.h2
-rw-r--r--src/lib/third_party/include/hll.h1
-rw-r--r--src/lib/third_party/src/hll/MurmurHash3.c2
-rw-r--r--src/lib/third_party/src/hll/hll.c4
-rw-r--r--windows/nDPI.vcxproj3
-rw-r--r--windows/nDPI.vcxproj.filters7
9 files changed, 19 insertions, 7 deletions
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 7867f5424..c4e5880b6 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -21,7 +21,7 @@ CFLAGS += -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION @NDPI_CF
LDFLAGS += @NDPI_LDFLAGS@
LIBS = @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@
-OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
+OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst third_party/src/hll/%.c, third_party/src/hll/%.o, $(wildcard third_party/src/hll/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
HEADERS = $(wildcard ../include/*.h)
NDPI_VERSION_MAJOR = @NDPI_MAJOR@
NDPI_LIB_STATIC = libndpi.a
diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c
index ef3d3cb9a..e9aa99a31 100644
--- a/src/lib/ndpi_analyze.c
+++ b/src/lib/ndpi_analyze.c
@@ -30,6 +30,7 @@
#include <float.h> /* FLT_EPSILON */
#include "ndpi_api.h"
#include "ndpi_config.h"
+#include "third_party/include/hll.h"
/* ********************************************************************************* */
@@ -298,8 +299,6 @@ const char* ndpi_data_ratio2str(float ratio) {
/* ********************************************************************************* */
/* ********************************************************************************* */
-#include "third_party/src/hll/hll.c"
-
int ndpi_hll_init(struct ndpi_hll *hll, u_int8_t bits) {
return(hll_init(hll, bits));
}
diff --git a/src/lib/ndpi_filter.c b/src/lib/ndpi_filter.c
index 7917639d0..5c4ff62bd 100644
--- a/src/lib/ndpi_filter.c
+++ b/src/lib/ndpi_filter.c
@@ -34,7 +34,7 @@
#include "ndpi_includes.h"
#include "ndpi_encryption.h"
-#include "third_party/src/hll/MurmurHash3.c"
+#include "third_party/include/MurmurHash3.h"
/* ******************************************* */
diff --git a/src/lib/third_party/include/MurmurHash3.h b/src/lib/third_party/include/MurmurHash3.h
index 43dc5fd92..63841cc6d 100644
--- a/src/lib/third_party/include/MurmurHash3.h
+++ b/src/lib/third_party/include/MurmurHash3.h
@@ -1,7 +1,7 @@
#ifndef _MURMURHASH3_H_
#define _MURMURHASH3_H_
-#include <stdint.h>
+#include "ndpi_includes.h"
uint32_t MurmurHash(const void * key, uint32_t len, uint32_t seed);
diff --git a/src/lib/third_party/include/hll.h b/src/lib/third_party/include/hll.h
index 4b094a63e..68af742e1 100644
--- a/src/lib/third_party/include/hll.h
+++ b/src/lib/third_party/include/hll.h
@@ -25,3 +25,4 @@ extern int hll_init(struct ndpi_hll *hll, u_int8_t bits);
extern void hll_destroy(struct ndpi_hll *hll);
extern int hll_add(struct ndpi_hll *hll, const void *buf, size_t size);
extern double hll_count(const struct ndpi_hll *hll);
+extern void hll_reset(struct ndpi_hll *hll);
diff --git a/src/lib/third_party/src/hll/MurmurHash3.c b/src/lib/third_party/src/hll/MurmurHash3.c
index f8bf0d881..dbfd15b85 100644
--- a/src/lib/third_party/src/hll/MurmurHash3.c
+++ b/src/lib/third_party/src/hll/MurmurHash3.c
@@ -1,7 +1,7 @@
/*-----------------------------------------------------------------------------
MurmurHash3 was written by Austin Appleby, and is placed in the public
domain. The author hereby disclaims copyright to this source code.
-xo*/
+*/
#include "MurmurHash3.h"
diff --git a/src/lib/third_party/src/hll/hll.c b/src/lib/third_party/src/hll/hll.c
index c4ed59885..653d66aec 100644
--- a/src/lib/third_party/src/hll/hll.c
+++ b/src/lib/third_party/src/hll/hll.c
@@ -26,7 +26,9 @@
#include <string.h>
#include <stdio.h>
-
+#include <ndpi_api.h>
+#include <ndpi_main.h>
+#include "ndpi_typedefs.h"
#include "../include/MurmurHash3.h"
#include "../include/hll.h"
diff --git a/windows/nDPI.vcxproj b/windows/nDPI.vcxproj
index b28587b6d..7ebb55b3d 100644
--- a/windows/nDPI.vcxproj
+++ b/windows/nDPI.vcxproj
@@ -128,6 +128,7 @@
<ClCompile Include="..\src\lib\ndpi_community_id.c" />
<ClCompile Include="..\src\lib\ndpi_geoip.c" />
<ClCompile Include="..\src\lib\ndpi_main.c" />
+ <ClCompile Include="..\src\lib\ndpi_filter.c" />
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
@@ -331,6 +332,8 @@
<ClCompile Include="..\src\lib\third_party\src\ndpi_sha1.c" />
<ClCompile Include="..\src\lib\third_party\src\sha1-fast.c" />
<ClCompile Include="..\src\lib\third_party\src\strptime.c" />
+ <ClCompile Include="..\src\lib\third_party\src\hll\MurmurHash3.c" />
+ <ClCompile Include="..\src\lib\third_party\src\hll\hll.c" />
<ClCompile Include="src\getopt.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
diff --git a/windows/nDPI.vcxproj.filters b/windows/nDPI.vcxproj.filters
index 594681a70..af43e8f1b 100644
--- a/windows/nDPI.vcxproj.filters
+++ b/windows/nDPI.vcxproj.filters
@@ -120,6 +120,7 @@
<ClCompile Include="..\src\lib\ndpi_community_id.c" />
<ClCompile Include="..\src\lib\ndpi_geoip.c" />
<ClCompile Include="..\src\lib\ndpi_main.c" />
+ <ClCompile Include="..\src\lib\ndpi_filter.c" />
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
@@ -202,6 +203,12 @@
<ClCompile Include="..\src\lib\third_party\src\strptime.c">
<Filter>third_party</Filter>
</ClCompile>
+ <ClCompile Include="..\src\lib\third_party\src\hll\MurmurHash3.c" />
+ <Filter>third_party</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\lib\third_party\src\hll\hll.c" />
+ <Filter>third_party</Filter>
+ </ClCompile>
<ClCompile Include="..\src\lib\protocols\tocaboca.c" />
<ClCompile Include="..\src\lib\protocols\raknet.c" />
<ClCompile Include="..\src\lib\protocols\sd_rtn.c" />