aboutsummaryrefslogtreecommitdiff
path: root/src/include/ndpi_win32.h
diff options
context:
space:
mode:
authorLuca Deri <lucaderi@users.noreply.github.com>2020-09-20 18:33:40 +0200
committerGitHub <noreply@github.com>2020-09-20 18:33:40 +0200
commit1385f05713045b846f5a830cfc23eabd5f71e70d (patch)
tree0f95d7f1cd5ea9d1053280d317a247cb4e2f083f /src/include/ndpi_win32.h
parent6a7139bb24c4835604641262a07becee637a9e53 (diff)
parentd0052fd5b2c48c8ab344d17bf4b603e80b6e1a29 (diff)
Merge pull request #1017 from lnslbrty/fix/mingw-xcompile
Added support for mingw xcompile.
Diffstat (limited to 'src/include/ndpi_win32.h')
-rw-r--r--src/include/ndpi_win32.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/include/ndpi_win32.h b/src/include/ndpi_win32.h
index a39a2401a..c3403c009 100644
--- a/src/include/ndpi_win32.h
+++ b/src/include/ndpi_win32.h
@@ -31,6 +31,8 @@
#define __mingw_forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__))
#endif
+#undef _WIN32_WINNT
+#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
@@ -39,6 +41,7 @@
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
#include <process.h> /* for getpid() and the exec..() family */
#include <stdint.h>
+#include <time.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
@@ -48,6 +51,17 @@
#define IPVERSION 4 /* on *nix it is defined in netinet/ip.h */
+#ifndef MIN
+#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
+#endif
+
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif
+
+#undef gettimeofday
+#define gettimeofday mingw_gettimeofday
+
extern char* strsep(char **sp, char *sep);
typedef unsigned char u_char;
@@ -79,4 +93,11 @@ extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
#define strtok_r strtok_s
#define timegm _mkgmtime
+static inline struct tm * localtime_r(const time_t *timep, struct tm * result)
+{
+ struct tm *timeinfo;
+ timeinfo = localtime(timep);
+ return timeinfo;
+}
+
#endif /* __NDPI_WIN32_H__ */