Windows code cleanup
This commit is contained in:
@@ -1574,12 +1574,6 @@ struct ndpi_jitter_struct {
|
|||||||
|
|
||||||
/* **************************************** */
|
/* **************************************** */
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#define NDPI_PATRICIA_IPV6
|
|
||||||
#else
|
|
||||||
#undef NDPI_PATRICIA_IPV6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AF_MAC
|
#ifndef AF_MAC
|
||||||
#define AF_MAC 99
|
#define AF_MAC 99
|
||||||
#endif
|
#endif
|
||||||
@@ -1590,9 +1584,7 @@ typedef struct _ndpi_prefix_t {
|
|||||||
int ref_count; /* reference count */
|
int ref_count; /* reference count */
|
||||||
union {
|
union {
|
||||||
struct in_addr sin;
|
struct in_addr sin;
|
||||||
#ifdef NDPI_PATRICIA_IPV6
|
|
||||||
struct in6_addr sin6;
|
struct in6_addr sin6;
|
||||||
#endif /* IPV6 */
|
|
||||||
u_int8_t mac[6];
|
u_int8_t mac[6];
|
||||||
} add;
|
} add;
|
||||||
} ndpi_prefix_t;
|
} ndpi_prefix_t;
|
||||||
|
|||||||
-15
@@ -122,10 +122,8 @@ static int ndpi_my_inet_pton (int af, const char *src, void *dst)
|
|||||||
}
|
}
|
||||||
memcpy (dst, xp, sizeof(struct in_addr));
|
memcpy (dst, xp, sizeof(struct in_addr));
|
||||||
return (1);
|
return (1);
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
} else if(af == AF_INET6) {
|
} else if(af == AF_INET6) {
|
||||||
return (inet_pton (af, src, dst));
|
return (inet_pton (af, src, dst));
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
} else {
|
} else {
|
||||||
#ifndef NT
|
#ifndef NT
|
||||||
errno = EAFNOSUPPORT;
|
errno = EAFNOSUPPORT;
|
||||||
@@ -182,7 +180,6 @@ static char * ndpi_prefix_toa2x (ndpi_prefix_t *prefix, char *buff, int with_len
|
|||||||
}
|
}
|
||||||
return (buff);
|
return (buff);
|
||||||
}
|
}
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
else if(prefix->family == AF_INET6) {
|
else if(prefix->family == AF_INET6) {
|
||||||
char *r;
|
char *r;
|
||||||
r = (char *) inet_ntop (AF_INET6, &prefix->add.sin6, buff, 48 /* a guess value */ );
|
r = (char *) inet_ntop (AF_INET6, &prefix->add.sin6, buff, 48 /* a guess value */ );
|
||||||
@@ -192,7 +189,6 @@ static char * ndpi_prefix_toa2x (ndpi_prefix_t *prefix, char *buff, int with_len
|
|||||||
}
|
}
|
||||||
return (buff);
|
return (buff);
|
||||||
}
|
}
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
else
|
else
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -218,7 +214,6 @@ static ndpi_prefix_t * ndpi_New_Prefix2 (int family, void *dest, int bitlen, ndp
|
|||||||
int dynamic_allocated = 0;
|
int dynamic_allocated = 0;
|
||||||
int default_bitlen = sizeof(struct in_addr) * 8;
|
int default_bitlen = sizeof(struct in_addr) * 8;
|
||||||
|
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
if(family == AF_INET6) {
|
if(family == AF_INET6) {
|
||||||
default_bitlen = sizeof(struct in6_addr) * 8;
|
default_bitlen = sizeof(struct in6_addr) * 8;
|
||||||
if(prefix == NULL) {
|
if(prefix == NULL) {
|
||||||
@@ -228,7 +223,6 @@ static ndpi_prefix_t * ndpi_New_Prefix2 (int family, void *dest, int bitlen, ndp
|
|||||||
memcpy (&prefix->add.sin6, dest, sizeof(struct in6_addr));
|
memcpy (&prefix->add.sin6, dest, sizeof(struct in6_addr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
if(family == AF_INET) {
|
if(family == AF_INET) {
|
||||||
if(prefix == NULL) {
|
if(prefix == NULL) {
|
||||||
#ifndef NT
|
#ifndef NT
|
||||||
@@ -972,9 +966,7 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
|||||||
long maxbitlen = 0;
|
long maxbitlen = 0;
|
||||||
char *cp;
|
char *cp;
|
||||||
struct in_addr sin;
|
struct in_addr sin;
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
struct in6_addr sin6;
|
struct in6_addr sin6;
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
char save[MAXLINE];
|
char save[MAXLINE];
|
||||||
|
|
||||||
if(string == NULL)
|
if(string == NULL)
|
||||||
@@ -983,19 +975,15 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
|||||||
/* easy way to handle both families */
|
/* easy way to handle both families */
|
||||||
if(family == 0) {
|
if(family == 0) {
|
||||||
family = AF_INET;
|
family = AF_INET;
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
if(strchr (string, ':')) family = AF_INET6;
|
if(strchr (string, ':')) family = AF_INET6;
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(family == AF_INET) {
|
if(family == AF_INET) {
|
||||||
maxbitlen = sizeof(struct in_addr) * 8;
|
maxbitlen = sizeof(struct in_addr) * 8;
|
||||||
}
|
}
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
else if(family == AF_INET6) {
|
else if(family == AF_INET6) {
|
||||||
maxbitlen = sizeof(struct in6_addr) * 8;
|
maxbitlen = sizeof(struct in6_addr) * 8;
|
||||||
}
|
}
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
|
|
||||||
if((cp = strchr (string, '/')) != NULL) {
|
if((cp = strchr (string, '/')) != NULL) {
|
||||||
bitlen = atol (cp + 1);
|
bitlen = atol (cp + 1);
|
||||||
@@ -1016,8 +1004,6 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
return (ndpi_New_Prefix (AF_INET, &sin, bitlen));
|
return (ndpi_New_Prefix (AF_INET, &sin, bitlen));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NDPI_PATRICIA_IPV6)
|
|
||||||
else if(family == AF_INET6) {
|
else if(family == AF_INET6) {
|
||||||
// Get rid of this with next IPv6 upgrade
|
// Get rid of this with next IPv6 upgrade
|
||||||
#if defined(NT) && !defined(HAVE_INET_NTOP)
|
#if defined(NT) && !defined(HAVE_INET_NTOP)
|
||||||
@@ -1029,7 +1015,6 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
|||||||
#endif /* NT */
|
#endif /* NT */
|
||||||
return (ndpi_New_Prefix (AF_INET6, &sin6, bitlen));
|
return (ndpi_New_Prefix (AF_INET6, &sin6, bitlen));
|
||||||
}
|
}
|
||||||
#endif /* NDPI_PATRICIA_IPV6 */
|
|
||||||
else
|
else
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user