Win32 compilation fixes
This commit is contained in:
@@ -54,8 +54,10 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__ 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__))
|
||||
#if defined(__mips__)
|
||||
@@ -286,4 +288,8 @@
|
||||
/* define memory callback function */
|
||||
#define match_first_bytes(payload,st) (memcmp((payload),(st),(sizeof(st)-1))==0)
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_DEFINE_INCLUDE_FILE__ */
|
||||
|
||||
@@ -34,12 +34,15 @@
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#if !defined __APPLE__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __OpenBSD__
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
|
||||
@@ -56,6 +56,18 @@ typedef struct node_t
|
||||
struct node_t *left, *right;
|
||||
} ndpi_node;
|
||||
|
||||
#ifdef WIN32
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long u_long;
|
||||
typedef u_char u_int8_t;
|
||||
typedef u_short u_int16_t;
|
||||
typedef uint u_int32_t;
|
||||
typedef uint u_int;
|
||||
typedef unsigned __int64 u_int64_t;
|
||||
#endif
|
||||
|
||||
/* NDPI_MASK_SIZE */
|
||||
typedef u_int32_t ndpi_ndpi_mask;
|
||||
|
||||
@@ -93,7 +105,7 @@ struct ndpi_chdlc
|
||||
u_int8_t addr; /* 0x0F (Unicast) - 0x8F (Broadcast) */
|
||||
u_int8_t ctrl; /* always 0x00 */
|
||||
u_int16_t proto_code; /* protocol type (e.g. 0x0800 IP) */
|
||||
} PACK_OFF;
|
||||
}; PACK_OFF
|
||||
|
||||
/* SLARP - Serial Line ARP http://tinyurl.com/qa54e95 */
|
||||
PACK_ON
|
||||
@@ -269,6 +281,11 @@ struct ndpi_udphdr
|
||||
u_int16_t check;
|
||||
} PACK_OFF;
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_dns_packet_header {
|
||||
u_int16_t transaction_id, flags, num_queries, answer_rrs, authority_rrs, additional_rrs;
|
||||
} PACK_OFF;
|
||||
|
||||
typedef union
|
||||
{
|
||||
u_int32_t ipv4;
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef unsigned __int64 u_int64_t;
|
||||
#define pthread_rwlock_unlock pthread_mutex_unlock
|
||||
#define pthread_rwlock_destroy pthread_mutex_destroy
|
||||
|
||||
#define gmtime_r(a, b) gmtime(a) /* Already thread safe on windows */
|
||||
#define gmtime_r(a, b) memcpy(b, gmtime(a), sizeof(struct tm))
|
||||
|
||||
extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user