Win32 fixes

This commit is contained in:
Luca Deri
2015-05-18 13:00:02 +02:00
parent b22d1d8e6a
commit 68ac979dc5
4 changed files with 27 additions and 23 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
#!/bin/sh
#
# 1.5.1 r8171 06/09/2014
#
/bin/rm -f configure config.h config.h.in src/lib/Makefile.in
autoreconf -ivf
./configure
+2 -2
View File
@@ -95,7 +95,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
protocols/quake.c \
protocols/radius.c \
protocols/rdp.c \
protocols/redis.c \
protocols/redis_net.c \
protocols/rsync.c \
protocols/rtcp.c \
protocols/rtmp.c \
@@ -148,7 +148,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
protocols/xdmcp.c \
protocols/yahoo.c \
protocols/zattoo.c \
protocols/zmq.c \
protocols/zeromq.c \
third_party/include/actypes.h \
third_party/include/ahocorasick.h \
third_party/include/node.h \
+6 -2
View File
@@ -41,7 +41,11 @@
#ifndef _PATRICIA_H
#define _PATRICIA_H
#define HAVE_IPV6
#ifndef WIN32
#define PATRICIA_IPV6 HAVE_IPV6
#else
#define PATRICIA_IPV6 0
#endif
/* typedef unsigned int u_int; */
/* { from defs.h */
@@ -94,7 +98,7 @@ typedef struct the_prefix_t {
int ref_count; /* reference count */
union {
struct in_addr sin;
#ifdef HAVE_IPV6
#ifdef PATRICIA_IPV6
struct in6_addr sin6;
#endif /* IPV6 */
} add;
+17 -16
View File
@@ -60,6 +60,7 @@
#include "patricia.h"
#ifdef __KERNEL__
long atol(const char *nptr) {
@@ -125,12 +126,12 @@ inet_pton (int af, const char *src, void *dst)
}
}
#ifdef NT
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
else if(af == AF_INET6) {
struct in6_addr Address;
return (inet6_addr(src, &Address));
}
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
#endif /* NT */
#ifndef NT
else {
@@ -174,10 +175,10 @@ ndpi_my_inet_pton (int af, const char *src, void *dst)
}
memcpy (dst, xp, sizeof(struct in_addr));
return (1);
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
} else if(af == AF_INET6) {
return (inet_pton (af, src, dst));
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
} else {
#ifndef NT
#ifndef __KERNEL__
@@ -235,7 +236,7 @@ ndpi_ndpi_prefix_toa2x (prefix_t *prefix, char *buff, int with_len)
}
return (buff);
}
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
else if(prefix->family == AF_INET6) {
char *r;
r = (char *) inet_ntop (AF_INET6, &prefix->add.sin6, buff, 48 /* a guess value */ );
@@ -245,7 +246,7 @@ ndpi_ndpi_prefix_toa2x (prefix_t *prefix, char *buff, int with_len)
}
return (buff);
}
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
else
return (NULL);
}
@@ -273,7 +274,7 @@ ndpi_New_Prefix2 (int family, void *dest, int bitlen, prefix_t *prefix)
int dynamic_allocated = 0;
int default_bitlen = sizeof(struct in_addr) * 8;
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
if(family == AF_INET6) {
default_bitlen = sizeof(struct in6_addr) * 8;
if(prefix == NULL) {
@@ -283,7 +284,7 @@ ndpi_New_Prefix2 (int family, void *dest, int bitlen, prefix_t *prefix)
memcpy (&prefix->add.sin6, dest, sizeof(struct in6_addr));
}
else
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
if(family == AF_INET) {
if(prefix == NULL) {
#ifndef NT
@@ -327,9 +328,9 @@ ndpi_ascii2prefix (int family, char *string)
long maxbitlen = 0;
char *cp;
struct in_addr sin;
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
struct in6_addr sin6;
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
char save[MAXLINE];
if(string == NULL)
@@ -338,19 +339,19 @@ ndpi_ascii2prefix (int family, char *string)
/* easy way to handle both families */
if(family == 0) {
family = AF_INET;
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
if(strchr (string, ':')) family = AF_INET6;
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
}
if(family == AF_INET) {
maxbitlen = sizeof(struct in_addr) * 8;
}
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
else if(family == AF_INET6) {
maxbitlen = sizeof(struct in6_addr) * 8;
}
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
if((cp = strchr (string, '/')) != NULL) {
bitlen = atol (cp + 1);
@@ -372,7 +373,7 @@ ndpi_ascii2prefix (int family, char *string)
return (ndpi_New_Prefix (AF_INET, &sin, bitlen));
}
#if defined(HAVE_IPV6) && (!defined(__KERNEL__))
#if defined(PATRICIA_IPV6) && (!defined(__KERNEL__))
else if(family == AF_INET6) {
// Get rid of this with next IPv6 upgrade
#if defined(NT) && !defined(HAVE_INET_NTOP)
@@ -384,7 +385,7 @@ ndpi_ascii2prefix (int family, char *string)
#endif /* NT */
return (ndpi_New_Prefix (AF_INET6, &sin6, bitlen));
}
#endif /* HAVE_IPV6 */
#endif /* PATRICIA_IPV6 */
else
return (NULL);
}