#include <sys/socket.h> /* needed to define AF_ values on UNIX */
#endif
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h> /* needed to define AF_ values on Windows */
-#endif
-
#ifdef _WIN32
-# include <ws2tcpip.h>
+#include <winsock2.h> /* needed to define AF_ values on Windows */
+#include <ws2tcpip.h>
#endif
#ifdef HAVE_C_ARES
typedef struct _resolved_ipv6
{
- struct e_in6_addr ip6_addr;
+ ws_in6_addr ip6_addr;
char name[MAXNAMELEN];
} resolved_ipv6_t;
ipv6_equal(gconstpointer v1, gconstpointer v2)
{
- if (memcmp(v1, v2, sizeof (struct e_in6_addr)) == 0) {
+ if (memcmp(v1, v2, sizeof (ws_in6_addr)) == 0) {
return TRUE;
}
{
union {
guint32 ip4;
- struct e_in6_addr ip6;
+ ws_in6_addr ip6;
} addr;
int family;
} async_dns_queue_msg_t;
if (0 != subnet_entry.mask) {
/* Print name, then '.' then IP address after subnet mask */
guint32 host_addr;
- gchar buffer[MAX_IP_STR_LEN];
+ gchar buffer[WS_INET_ADDRSTRLEN];
gchar* paddr;
gsize i;
host_addr = addr & (~(guint32)subnet_entry.mask);
- ip_to_str_buf((guint8 *)&host_addr, buffer, MAX_IP_STR_LEN);
+ ip_to_str_buf((guint8 *)&host_addr, buffer, WS_INET_ADDRSTRLEN);
paddr = buffer;
/* Skip to first octet that is not totally masked
/* --------------- */
static hashipv6_t *
-new_ipv6(const struct e_in6_addr *addr)
+new_ipv6(const ws_in6_addr *addr)
{
hashipv6_t *tp = wmem_new(wmem_epan_scope(), hashipv6_t);
memcpy(tp->addr, addr->bytes, sizeof tp->addr);
/* ------------------------------------ */
static hashipv6_t *
-host_lookup6(const struct e_in6_addr *addr)
+host_lookup6(const ws_in6_addr *addr)
{
hashipv6_t * volatile tp;
#ifdef HAVE_C_ARES
* We don't already have an entry for this host name; create one,
* and then try to resolve it.
*/
- struct e_in6_addr *addr_key;
+ ws_in6_addr *addr_key;
- addr_key = wmem_new(wmem_epan_scope(), struct e_in6_addr);
+ addr_key = wmem_new(wmem_epan_scope(), ws_in6_addr);
tp = new_ipv6(addr);
memcpy(addr_key, addr, 16);
fill_dummy_ip6(tp);
gchar *cp;
union {
guint32 ip4_addr;
- struct e_in6_addr ip6_addr;
+ ws_in6_addr ip6_addr;
} host_addr;
gboolean is_ipv6, entry_found = FALSE;
{
union {
guint32 ip4_addr;
- struct e_in6_addr ip6_addr;
+ ws_in6_addr ip6_addr;
} host_addr;
gboolean is_ipv6;
resolved_ipv4_t *resolved_ipv4_entry;
c_ares_ghba_cb, caqm);
async_dns_in_flight++;
} else if (caqm->family == AF_INET6) {
- ares_gethostbyaddr(ghba_chan, &caqm->addr.ip6, sizeof(struct e_in6_addr),
+ ares_gethostbyaddr(ghba_chan, &caqm->addr.ip6, sizeof(ws_in6_addr),
AF_INET6, c_ares_ghba_cb, caqm);
async_dns_in_flight++;
}
/* -------------------------- */
const gchar *
-get_hostname6(const struct e_in6_addr *addr)
+get_hostname6(const ws_in6_addr *addr)
{
/* XXX why do we call this if we're not resolving? To create hash entries?
* Why?
/* -------------------------- */
void
-add_ipv6_name(const struct e_in6_addr *addrp, const gchar *name)
+add_ipv6_name(const ws_in6_addr *addrp, const gchar *name)
{
hashipv6_t *tp;
tp = (hashipv6_t *)wmem_map_lookup(ipv6_hash_table, addrp);
if (!tp) {
- struct e_in6_addr *addr_key;
+ ws_in6_addr *addr_key;
- addr_key = wmem_new(wmem_epan_scope(), struct e_in6_addr);
+ addr_key = wmem_new(wmem_epan_scope(), ws_in6_addr);
tp = new_ipv6(addrp);
memcpy(addr_key, addrp, 16);
wmem_map_insert(ipv6_hash_table, addr_key, tp);
#endif
/*
- * XXX - if there are any places where this needs to support
- * the hex-address form for IPv4 addresses, or to support
- * fewer than 4 components for a network address, add that
- * wherever it's appropriate.
- *
* XXX - are there places where this is used to translate something
* that's *only* supposed to be an IPv4 address, and where it
* *shouldn't* translate host names?
}
return FALSE;
#endif
- } else {
- /* Does the string really contain dotted-quad IP?
- * Check against inet_atons that accept strings such as
- * "130.230" as valid addresses and try to convert them
- * to some form of a classful (host.net) notation.
- */
- unsigned int a0, a1, a2, a3;
- if (sscanf(host, "%u.%u.%u.%u", &a0, &a1, &a2, &a3) != 4)
- return FALSE;
}
return TRUE;
* return FALSE if we fail.
*/
gboolean
-get_host_ipaddr6(const char *host, struct e_in6_addr *addrp)
+get_host_ipaddr6(const char *host, ws_in6_addr *addrp)
{
#ifdef HAVE_C_ARES
struct timeval tv = { 0, GHI_TIMEOUT }, *tvp;
if (!async_dns_initialized || name_resolve_concurrency < 1) {
return FALSE;
}
- ahe.addr_size = (int) sizeof (struct e_in6_addr);
+ ahe.addr_size = (int) sizeof (ws_in6_addr);
ahe.copied = 0;
ahe.addrp = addrp;
ares_gethostbyname(ghbn_chan, host, AF_INET6, c_ares_ghi_cb, &ahe);
gboolean
str_to_ip6(const char *str, void *dst)
{
- return ws_inet_pton6(str, (struct e_in6_addr *)dst);
+ return ws_inet_pton6(str, (ws_in6_addr *)dst);
}
/*