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
|
||||
#define AF_MAC 99
|
||||
#endif
|
||||
@@ -1590,9 +1584,7 @@ typedef struct _ndpi_prefix_t {
|
||||
int ref_count; /* reference count */
|
||||
union {
|
||||
struct in_addr sin;
|
||||
#ifdef NDPI_PATRICIA_IPV6
|
||||
struct in6_addr sin6;
|
||||
#endif /* IPV6 */
|
||||
u_int8_t mac[6];
|
||||
} add;
|
||||
} 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));
|
||||
return (1);
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
} else if(af == AF_INET6) {
|
||||
return (inet_pton (af, src, dst));
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
} else {
|
||||
#ifndef NT
|
||||
errno = EAFNOSUPPORT;
|
||||
@@ -182,7 +180,6 @@ static char * ndpi_prefix_toa2x (ndpi_prefix_t *prefix, char *buff, int with_len
|
||||
}
|
||||
return (buff);
|
||||
}
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
else if(prefix->family == AF_INET6) {
|
||||
char *r;
|
||||
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);
|
||||
}
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
else
|
||||
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 default_bitlen = sizeof(struct in_addr) * 8;
|
||||
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
if(family == AF_INET6) {
|
||||
default_bitlen = sizeof(struct in6_addr) * 8;
|
||||
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));
|
||||
}
|
||||
else
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
if(family == AF_INET) {
|
||||
if(prefix == NULL) {
|
||||
#ifndef NT
|
||||
@@ -972,9 +966,7 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
||||
long maxbitlen = 0;
|
||||
char *cp;
|
||||
struct in_addr sin;
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
struct in6_addr sin6;
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
char save[MAXLINE];
|
||||
|
||||
if(string == NULL)
|
||||
@@ -983,19 +975,15 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
||||
/* easy way to handle both families */
|
||||
if(family == 0) {
|
||||
family = AF_INET;
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
if(strchr (string, ':')) family = AF_INET6;
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
}
|
||||
|
||||
if(family == AF_INET) {
|
||||
maxbitlen = sizeof(struct in_addr) * 8;
|
||||
}
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
else if(family == AF_INET6) {
|
||||
maxbitlen = sizeof(struct in6_addr) * 8;
|
||||
}
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
|
||||
if((cp = strchr (string, '/')) != NULL) {
|
||||
bitlen = atol (cp + 1);
|
||||
@@ -1016,8 +1004,6 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
||||
return (NULL);
|
||||
return (ndpi_New_Prefix (AF_INET, &sin, bitlen));
|
||||
}
|
||||
|
||||
#if defined(NDPI_PATRICIA_IPV6)
|
||||
else if(family == AF_INET6) {
|
||||
// Get rid of this with next IPv6 upgrade
|
||||
#if defined(NT) && !defined(HAVE_INET_NTOP)
|
||||
@@ -1029,7 +1015,6 @@ static ndpi_prefix_t * ndpi_ascii2prefix (int family, char *string)
|
||||
#endif /* NT */
|
||||
return (ndpi_New_Prefix (AF_INET6, &sin6, bitlen));
|
||||
}
|
||||
#endif /* NDPI_PATRICIA_IPV6 */
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user