2004-08-09 22:31:21 +00:00
|
|
|
/* addr_resolv.h
|
1998-09-16 02:39:15 +00:00
|
|
|
* Definitions for network object lookup
|
|
|
|
*
|
2003-01-26 19:35:31 +00:00
|
|
|
* Laurent Deniel <laurent.deniel@free.fr>
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
1998-09-16 02:39:15 +00:00
|
|
|
*/
|
2009-09-06 14:25:47 +00:00
|
|
|
/* The buffers returned by these functions are all allocated with a
|
|
|
|
* packet lifetime and does not have have to be freed.
|
2005-08-17 20:45:18 +00:00
|
|
|
* However, take into account that when the packet dissection
|
|
|
|
* completes, these buffers will be automatically reclaimed/freed.
|
|
|
|
* If you need the buffer to remain for a longer scope than packet lifetime
|
2015-01-12 00:48:54 +00:00
|
|
|
* you must copy the content to an wmem_file_scope() buffer.
|
2005-08-17 20:45:18 +00:00
|
|
|
*/
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
#ifndef __RESOLV_H__
|
|
|
|
#define __RESOLV_H__
|
|
|
|
|
2005-01-07 11:56:00 +00:00
|
|
|
#include <epan/address.h>
|
2011-05-20 02:42:14 +00:00
|
|
|
#include <epan/tvbuff.h>
|
2016-01-03 20:30:57 +00:00
|
|
|
#include <epan/ipv6.h>
|
2013-08-18 19:02:48 +00:00
|
|
|
#include <epan/to_str.h>
|
2013-09-22 19:40:02 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2005-01-07 11:56:00 +00:00
|
|
|
|
2007-01-18 18:43:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
1999-11-20 05:35:15 +00:00
|
|
|
#ifndef MAXNAMELEN
|
|
|
|
#define MAXNAMELEN 64 /* max name length (hostname and port name) */
|
|
|
|
#endif
|
|
|
|
|
2016-03-13 22:16:20 +00:00
|
|
|
#ifndef MAXVLANNAMELEN
|
|
|
|
#define MAXVLANNAMELEN 128 /* max vlan name length */
|
|
|
|
#endif
|
|
|
|
|
2017-06-24 13:25:41 +00:00
|
|
|
#define BASE_ENTERPRISES BASE_CUSTOM
|
|
|
|
#define STRINGS_ENTERPRISES CF_FUNC(enterprises_base_custom)
|
|
|
|
|
2015-07-25 13:24:48 +00:00
|
|
|
/**
|
|
|
|
* @brief Flags to control name resolution.
|
|
|
|
*/
|
2012-07-06 04:48:36 +00:00
|
|
|
typedef struct _e_addr_resolve {
|
2015-07-25 13:24:48 +00:00
|
|
|
gboolean mac_name; /**< Whether to resolve Ethernet MAC to manufacturer names */
|
|
|
|
gboolean network_name; /**< Whether to resolve IPv4, IPv6, and IPX addresses into host names */
|
2015-10-05 10:53:07 +00:00
|
|
|
gboolean transport_name; /**< Whether to resolve TCP/UDP/DCCP/SCTP ports into service names */
|
2015-07-25 13:24:48 +00:00
|
|
|
gboolean dns_pkt_addr_resolution; /**< Whether to resolve addresses using captured DNS packets */
|
|
|
|
gboolean use_external_net_name_resolver; /**< Whether to system's configured DNS server to resolve names */
|
|
|
|
gboolean load_hosts_file_from_profile_only; /**< Whether to only load the hosts in the current profile, not hosts files */
|
2016-03-13 22:16:20 +00:00
|
|
|
gboolean vlan_name; /**< Whether to resolve VLAN IDs to names */
|
2016-09-13 04:46:06 +00:00
|
|
|
gboolean ss7pc_name; /**< Whether to resolve SS7 Point Codes to names */
|
2012-07-06 04:48:36 +00:00
|
|
|
} e_addr_resolve;
|
|
|
|
|
2015-09-12 05:35:22 +00:00
|
|
|
#define ADDR_RESOLV_MACADDR(at) \
|
|
|
|
(((at)->type == AT_ETHER))
|
|
|
|
|
|
|
|
#define ADDR_RESOLV_NETADDR(at) \
|
|
|
|
(((at)->type == AT_IPv4) || ((at)->type == AT_IPv6) || ((at)->type == AT_IPX))
|
|
|
|
|
2015-02-12 01:13:36 +00:00
|
|
|
struct hashether;
|
|
|
|
typedef struct hashether hashether_t;
|
2013-08-02 15:05:00 +00:00
|
|
|
|
2015-02-12 03:16:01 +00:00
|
|
|
struct hashmanuf;
|
|
|
|
typedef struct hashmanuf hashmanuf_t;
|
|
|
|
|
2013-08-05 16:36:24 +00:00
|
|
|
typedef struct serv_port {
|
|
|
|
gchar *udp_name;
|
|
|
|
gchar *tcp_name;
|
|
|
|
gchar *sctp_name;
|
|
|
|
gchar *dccp_name;
|
2015-10-05 12:51:58 +00:00
|
|
|
gchar *numeric;
|
2013-08-05 16:36:24 +00:00
|
|
|
} serv_port_t;
|
|
|
|
|
2013-08-11 19:02:26 +00:00
|
|
|
/*
|
2016-01-19 07:22:30 +00:00
|
|
|
* Flags for various IPv4/IPv6 hash table entries.
|
2013-08-11 19:02:26 +00:00
|
|
|
*/
|
2017-06-09 08:03:38 +00:00
|
|
|
#define TRIED_RESOLVE_ADDRESS (1U<<0) /* XXX - what does this bit *really* mean? */
|
|
|
|
#define NAME_RESOLVED (1U<<1) /* the name field contains a host name, not a printable address */
|
2016-01-19 07:22:30 +00:00
|
|
|
#define RESOLVED_ADDRESS_USED (1U<<2) /* a get_hostname* call returned the host name */
|
2013-10-10 19:17:48 +00:00
|
|
|
|
2017-06-09 08:03:38 +00:00
|
|
|
#define TRIED_OR_RESOLVED_MASK (TRIED_RESOLVE_ADDRESS | NAME_RESOLVED)
|
|
|
|
#define USED_AND_RESOLVED_MASK (NAME_RESOLVED | RESOLVED_ADDRESS_USED)
|
Don't include libwireshark headers from libwiretap.
Move the definitions of hashipv4_t and hashipv6_t to wiretap/wtap.h, as
that's the main place they're used. Change them a bit not to depend on
other stuff from libwireshark, and change the code as required by those
changes.
This should fix the Solaris build; apparently, the Sun^WOracle compiler
is generating code for static inline functions even if they're never
called, so that libwiretap ends up including code that calls tvbuff and
wmem functions.
There's probably further cleanup that could be done here, but this
should at least fix the build, as well as getting rid of a dependency
between two libraries that are at least somewhat independent (libwiretap
should *not* depend on libwireshark, as some programs use libwiretap but
not libwireshark, and, ultimately, we probably want it to be possible to
use libwireshark without libwiretap but that'd be more work).
Change-Id: I91c745282f17d7c8bff7809aa277eab2b3cf47c1
Reviewed-on: https://code.wireshark.org/review/11537
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-03 22:12:14 +00:00
|
|
|
|
2002-01-13 20:35:12 +00:00
|
|
|
/*
|
|
|
|
* Flag controlling what names to resolve.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC e_addr_resolve gbl_resolv_flags;
|
2002-01-13 20:35:12 +00:00
|
|
|
|
1998-09-25 23:24:07 +00:00
|
|
|
/* global variables */
|
|
|
|
|
|
|
|
extern gchar *g_ethers_path;
|
1999-11-21 16:32:23 +00:00
|
|
|
extern gchar *g_ipxnets_path;
|
1998-09-25 23:24:07 +00:00
|
|
|
extern gchar *g_pethers_path;
|
1999-11-21 16:32:23 +00:00
|
|
|
extern gchar *g_pipxnets_path;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2012-07-06 04:48:36 +00:00
|
|
|
/* Functions in addr_resolv.c */
|
2002-01-13 20:35:12 +00:00
|
|
|
|
2004-12-30 02:10:24 +00:00
|
|
|
/*
|
2015-01-07 21:24:17 +00:00
|
|
|
* udp_port_to_display() returns the port name corresponding to that UDP port,
|
2004-12-30 02:10:24 +00:00
|
|
|
* or the port number as a string if not found.
|
|
|
|
*/
|
2015-01-07 21:24:17 +00:00
|
|
|
WS_DLL_PUBLIC gchar *udp_port_to_display(wmem_allocator_t *allocator, guint port);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
2004-12-30 02:10:24 +00:00
|
|
|
/*
|
2015-01-07 21:24:17 +00:00
|
|
|
* tcp_port_to_display() returns the port name corresponding to that TCP port,
|
2004-12-30 02:10:24 +00:00
|
|
|
* or the port number as a string if not found.
|
|
|
|
*/
|
2015-01-07 21:24:17 +00:00
|
|
|
WS_DLL_PUBLIC gchar *tcp_port_to_display(wmem_allocator_t *allocator, guint port);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
2005-09-20 15:18:28 +00:00
|
|
|
/*
|
2015-01-07 21:24:17 +00:00
|
|
|
* dccp_port_to_display() returns the port name corresponding to that DCCP port,
|
2005-09-20 15:18:28 +00:00
|
|
|
* or the port number as a string if not found.
|
|
|
|
*/
|
2015-01-07 21:24:17 +00:00
|
|
|
extern gchar *dccp_port_to_display(wmem_allocator_t *allocator, guint port);
|
2005-09-20 15:18:28 +00:00
|
|
|
|
2004-12-30 02:10:24 +00:00
|
|
|
/*
|
2015-01-07 21:24:17 +00:00
|
|
|
* sctp_port_to_display() returns the port name corresponding to that SCTP port,
|
2004-12-30 02:10:24 +00:00
|
|
|
* or the port number as a string if not found.
|
|
|
|
*/
|
2015-01-07 21:24:17 +00:00
|
|
|
WS_DLL_PUBLIC gchar *sctp_port_to_display(wmem_allocator_t *allocator, guint port);
|
2000-08-19 08:26:04 +00:00
|
|
|
|
2015-10-05 12:51:58 +00:00
|
|
|
/*
|
|
|
|
* serv_name_lookup() returns the well known service name string, or numeric
|
|
|
|
* representation if one doesn't exist.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const gchar *serv_name_lookup(port_type proto, guint port);
|
|
|
|
|
2017-06-24 13:25:41 +00:00
|
|
|
/*
|
|
|
|
* enterprises_lookup() returns the private enterprise code string, or 'unknown_str'
|
|
|
|
* if one doesn't exist, or "<Unknown>" if that is NULL.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const gchar *enterprises_lookup(guint32 value, const char *unknown_str);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* try_enterprises_lookup() returns the private enterprise code string, or NULL if not found.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const gchar *try_enterprises_lookup(guint32 value);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* enterprises_base_custom() prints the "name (decimal)" string to 'buf'.
|
|
|
|
* (Used with BASE_CUSTOM field display).
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void enterprises_base_custom(char *buf, guint32 value);
|
|
|
|
|
2015-10-05 12:51:58 +00:00
|
|
|
/*
|
|
|
|
* try_serv_name_lookup() returns the well known service name string, or NULL if
|
|
|
|
* one doesn't exist.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const gchar *try_serv_name_lookup(port_type proto, guint port);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* port_with_resolution_to_str() prints the "<resolved> (<numerical>)" port
|
|
|
|
* string.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC gchar *port_with_resolution_to_str(wmem_allocator_t *scope,
|
|
|
|
port_type proto, guint port);
|
|
|
|
|
2015-10-05 10:53:07 +00:00
|
|
|
/*
|
|
|
|
* port_with_resolution_to_str_buf() prints the "<resolved> (<numerical>)" port
|
|
|
|
* string to 'buf'. Return value is the same as g_snprintf().
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC int port_with_resolution_to_str_buf(gchar *buf, gulong buf_size,
|
2015-10-05 12:51:58 +00:00
|
|
|
port_type proto, guint port);
|
2015-10-05 10:53:07 +00:00
|
|
|
|
2003-05-05 08:20:01 +00:00
|
|
|
/*
|
|
|
|
* Asynchronous host name lookup initialization, processing, and cleanup
|
|
|
|
*/
|
|
|
|
|
2012-07-06 04:48:36 +00:00
|
|
|
/* Setup name resolution preferences */
|
2012-07-06 07:06:09 +00:00
|
|
|
struct pref_module;
|
|
|
|
extern void addr_resolve_pref_init(struct pref_module *nameres);
|
2012-07-06 04:48:36 +00:00
|
|
|
|
2015-07-25 13:24:48 +00:00
|
|
|
/*
|
|
|
|
* disable_name_resolution() sets all relevant gbl_resolv_flags to FALSE.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void disable_name_resolution(void);
|
|
|
|
|
2016-03-16 22:11:17 +00:00
|
|
|
/** If we're using c-ares process outstanding host name lookups.
|
2009-12-22 20:01:06 +00:00
|
|
|
* This is called from a GLIB timeout in Wireshark and before processing
|
|
|
|
* each packet in TShark.
|
|
|
|
*
|
|
|
|
* @return True if any new objects have been resolved since the previous
|
|
|
|
* call. This can be used to trigger a display update, e.g. in Wireshark.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gboolean host_name_lookup_process(void);
|
2003-05-05 08:20:01 +00:00
|
|
|
|
1998-09-25 23:24:07 +00:00
|
|
|
/* get_hostname returns the host name or "%d.%d.%d.%d" if not found */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *get_hostname(const guint addr);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2003-05-04 18:50:56 +00:00
|
|
|
/* get_hostname6 returns the host name, or numeric addr if not found */
|
2017-10-26 08:50:00 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *get_hostname6(const ws_in6_addr *ad);
|
1999-03-28 18:32:03 +00:00
|
|
|
|
1998-09-25 23:24:07 +00:00
|
|
|
/* get_ether_name returns the logical name if found in ethers files else
|
|
|
|
"<vendor>_%02x:%02x:%02x" if the vendor code is known else
|
|
|
|
"%02x:%02x:%02x:%02x:%02x:%02x" */
|
2016-02-10 19:07:29 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *get_ether_name(const guint8 *addr);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
2016-09-13 04:46:06 +00:00
|
|
|
/* get_hostname_ss7pc returns the logical name if found in ss7pcs file else
|
|
|
|
'\0' on the first call or the unresolved Point Code in the subsequent calls */
|
|
|
|
const gchar *get_hostname_ss7pc(const guint8 ni, const guint32 pc);
|
|
|
|
|
|
|
|
/* fill_unresolved_ss7pc initializes the unresolved Point Code Address string in the hashtable */
|
|
|
|
void fill_unresolved_ss7pc(const gchar * pc_addr, const guint8 ni, const guint32 pc);
|
|
|
|
|
|
|
|
|
2015-03-02 14:33:52 +00:00
|
|
|
/* Same as get_ether_name with tvb support */
|
2016-02-10 19:07:29 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *tvb_get_ether_name(tvbuff_t *tvb, gint offset);
|
2015-03-02 14:33:52 +00:00
|
|
|
|
2016-11-15 22:36:26 +00:00
|
|
|
/* get_ether_name_if_known returns the logical name if found in ethers files else NULL */
|
2015-11-30 07:14:44 +00:00
|
|
|
const gchar *get_ether_name_if_known(const guint8 *addr);
|
1999-11-20 05:35:15 +00:00
|
|
|
|
2012-04-13 22:23:04 +00:00
|
|
|
/*
|
|
|
|
* Given a sequence of 3 octets containing an OID, get_manuf_name()
|
|
|
|
* returns the vendor name, or "%02x:%02x:%02x" if not known.
|
|
|
|
*/
|
2015-02-12 03:16:01 +00:00
|
|
|
extern const gchar *get_manuf_name(const guint8 *addr);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
2012-04-13 22:23:04 +00:00
|
|
|
/*
|
|
|
|
* Given a sequence of 3 octets containing an OID, get_manuf_name_if_known()
|
|
|
|
* returns the vendor name, or NULL if not known.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *get_manuf_name_if_known(const guint8 *addr);
|
2005-05-20 21:44:17 +00:00
|
|
|
|
2012-04-13 22:23:04 +00:00
|
|
|
/*
|
|
|
|
* Given an integer containing a 24-bit OID, uint_get_manuf_name_if_known()
|
|
|
|
* returns the vendor name, or NULL if not known.
|
|
|
|
*/
|
|
|
|
extern const gchar *uint_get_manuf_name_if_known(const guint oid);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Given a tvbuff and an offset in that tvbuff for a 3-octet OID,
|
|
|
|
* tvb_get_manuf_name() returns the vendor name, or "%02x:%02x:%02x"
|
|
|
|
* if not known.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *tvb_get_manuf_name(tvbuff_t *tvb, gint offset);
|
2011-05-20 02:42:14 +00:00
|
|
|
|
2012-04-13 22:23:04 +00:00
|
|
|
/*
|
|
|
|
* Given a tvbuff and an offset in that tvbuff for a 3-octet OID,
|
|
|
|
* tvb_get_manuf_name_if_known() returns the vendor name, or NULL
|
|
|
|
* if not known.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *tvb_get_manuf_name_if_known(tvbuff_t *tvb, gint offset);
|
2011-05-20 02:42:14 +00:00
|
|
|
|
2015-01-08 18:16:01 +00:00
|
|
|
/* eui64_to_display returns "<vendor>_%02x:%02x:%02x:%02x:%02x:%02x" if the vendor code is known
|
2011-05-08 10:23:53 +00:00
|
|
|
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" */
|
2016-02-10 19:07:29 +00:00
|
|
|
extern gchar *eui64_to_display(wmem_allocator_t *allocator, const guint64 addr);
|
2011-05-08 10:23:53 +00:00
|
|
|
|
1999-11-21 16:32:23 +00:00
|
|
|
/* get_ipxnet_name returns the logical name if found in an ipxnets file,
|
|
|
|
* or a string formatted with "%X" if not */
|
2015-11-30 07:14:44 +00:00
|
|
|
extern gchar *get_ipxnet_name(wmem_allocator_t *allocator, const guint32 addr);
|
1999-11-21 16:32:23 +00:00
|
|
|
|
2016-03-13 22:16:20 +00:00
|
|
|
/* get_vlan_name returns the logical name if found in a vlans file,
|
|
|
|
* or the VLAN ID itself as a string if not found*/
|
|
|
|
extern gchar *get_vlan_name(wmem_allocator_t *allocator, const guint16 id);
|
|
|
|
|
2015-02-12 01:13:36 +00:00
|
|
|
WS_DLL_PUBLIC guint get_hash_ether_status(hashether_t* ether);
|
|
|
|
WS_DLL_PUBLIC char* get_hash_ether_hexaddr(hashether_t* ether);
|
|
|
|
WS_DLL_PUBLIC char* get_hash_ether_resolved_name(hashether_t* ether);
|
|
|
|
|
2015-02-12 03:16:01 +00:00
|
|
|
WS_DLL_PUBLIC char* get_hash_manuf_resolved_name(hashmanuf_t* manuf);
|
|
|
|
|
|
|
|
|
2004-11-17 08:53:20 +00:00
|
|
|
/* adds a hostname/IPv4 in the hash table */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void add_ipv4_name(const guint addr, const gchar *name);
|
1998-09-25 23:24:07 +00:00
|
|
|
|
2004-11-17 09:44:41 +00:00
|
|
|
/* adds a hostname/IPv6 in the hash table */
|
2017-10-26 08:50:00 +00:00
|
|
|
WS_DLL_PUBLIC void add_ipv6_name(const ws_in6_addr *addr, const gchar *name);
|
2004-11-17 09:44:41 +00:00
|
|
|
|
2012-11-29 00:32:39 +00:00
|
|
|
/** Add an additional "hosts" file for IPv4 and IPv6 name resolution.
|
|
|
|
*
|
|
|
|
* The file can be added before host_name_lookup_init() is called and
|
|
|
|
* will be re-read each time host_name_lookup_init() is called.
|
|
|
|
*
|
2013-04-26 18:28:21 +00:00
|
|
|
* @param hosts_file Absolute path to the hosts file.
|
2012-11-29 00:32:39 +00:00
|
|
|
*
|
|
|
|
* @return TRUE if the hosts file can be read.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gboolean add_hosts_file (const char *hosts_file);
|
2011-03-24 22:47:57 +00:00
|
|
|
|
2010-04-27 06:51:16 +00:00
|
|
|
/* adds a hostname in the hash table */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gboolean add_ip_name_from_string (const char *addr, const char *name);
|
2010-04-27 06:51:16 +00:00
|
|
|
|
2013-09-22 19:40:02 +00:00
|
|
|
|
|
|
|
/** Get lists of host name to address mappings we know about.
|
2011-03-24 22:47:57 +00:00
|
|
|
*
|
2013-09-22 19:40:02 +00:00
|
|
|
* The struct contains two g_lists one with hashipv4_t entries and one with hashipv6_t entries.
|
2011-05-20 02:42:14 +00:00
|
|
|
*
|
2013-09-22 19:40:02 +00:00
|
|
|
* @return a struct with lists of known addresses(IPv4 and IPv6). May be NULL.
|
2011-03-24 22:47:57 +00:00
|
|
|
*/
|
2013-09-22 19:40:02 +00:00
|
|
|
WS_DLL_PUBLIC addrinfo_lists_t *get_addrinfo_list(void);
|
2011-03-24 22:47:57 +00:00
|
|
|
|
2000-08-10 20:09:29 +00:00
|
|
|
/* add ethernet address / name corresponding to IP address */
|
2010-04-03 18:18:50 +00:00
|
|
|
extern void add_ether_byip(const guint ip, const guint8 *eth);
|
2000-08-10 20:09:29 +00:00
|
|
|
|
2009-12-24 00:58:31 +00:00
|
|
|
/** Translates a string representing a hostname or dotted-decimal IPv4 address
|
|
|
|
* into a numeric IPv4 address value in network byte order. If compiled with
|
|
|
|
* c-ares, the request will wait a maximum of 250ms for the request to finish.
|
|
|
|
* Otherwise the wait time will be system-dependent, ususally much longer.
|
2009-12-24 17:21:02 +00:00
|
|
|
* Immediately returns FALSE for hostnames if network name resolution is
|
|
|
|
* disabled.
|
2009-12-24 00:58:31 +00:00
|
|
|
*
|
|
|
|
* @param[in] host The hostname.
|
|
|
|
* @param[out] addrp The numeric IPv4 address in network byte order.
|
2009-12-24 17:21:02 +00:00
|
|
|
* @return TRUE on success, FALSE on failure, timeout.
|
2009-12-24 00:58:31 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
Have "get_host_ipaddr()" return a Boolean indicating whether it
succeeded or failed, and, if it succeeded, have it fill in the IP
address if found through a pointer passed as the second argument.
Have it first try interpreting its first argument as a dotted-quad IP
address, with "inet_aton()", and, if that fails, have it try to
interpret it as a host name with "gethostbyname()"; don't bother with
"gethostbyaddr()", as we should be allowed to filter on IP addresses
even if there's no host name associated with them (there's no guarantee
that "gethostbyaddr()" will succeed if handed an IP address with no
corresponding name - and it looks as if FreeBSD 3.2, at least, may not
succeed in that case).
Add a "dfilter_fail()" routine that takes "printf()"-like arguments and
uses them to set an error message for the parse; doing so means that
even if the filter expression is syntactically valid, we treat it as
being invalid. (Is there a better way to force a parse to fail from
arbitrary places in routines called by the parser?)
Use that routine in the lexical analyzer.
If that error message was set, use it as is as the failure message,
rather than adding "Unable to parse filter string XXX" to it.
Have the code to handle IP addresses and host names in display filters
check whether "get_host_ipaddr()" succeeded or failed and, if it failed,
arrange that the parse fail with an error message indicating the source
of the problem.
svn path=/trunk/; revision=802
1999-10-11 03:03:12 +00:00
|
|
|
gboolean get_host_ipaddr(const char *host, guint32 *addrp);
|
1999-07-07 22:52:57 +00:00
|
|
|
|
2009-12-24 00:58:31 +00:00
|
|
|
/** Translates a string representing a hostname or colon-hex IPv6 address
|
|
|
|
* into a numeric IPv6 address value in network byte order. If compiled with
|
|
|
|
* c-ares, the request will wait a maximum of 250ms for the request to finish.
|
|
|
|
* Otherwise the wait time will be system-dependent, usually much longer.
|
2009-12-24 17:21:02 +00:00
|
|
|
* Immediately returns FALSE for hostnames if network name resolution is
|
|
|
|
* disabled.
|
2009-12-24 00:58:31 +00:00
|
|
|
*
|
|
|
|
* @param[in] host The hostname.
|
|
|
|
* @param[out] addrp The numeric IPv6 address in network byte order.
|
|
|
|
* @return TRUE on success, FALSE on failure or timeout.
|
1999-10-15 03:11:52 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-10-26 08:50:00 +00:00
|
|
|
gboolean get_host_ipaddr6(const char *host, ws_in6_addr *addrp);
|
1999-10-15 03:11:52 +00:00
|
|
|
|
2013-08-01 20:11:13 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_manuf_hashtable(void);
|
2013-08-01 20:11:13 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_wka_hashtable(void);
|
2013-08-01 20:11:13 +00:00
|
|
|
|
2013-08-02 15:05:00 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_eth_hashtable(void);
|
2013-08-02 15:05:00 +00:00
|
|
|
|
2013-08-05 16:36:24 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_serv_port_hashtable(void);
|
2013-08-05 16:36:24 +00:00
|
|
|
|
2013-08-20 05:06:26 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_ipxnet_hash_table(void);
|
2013-08-20 05:06:26 +00:00
|
|
|
|
2016-03-13 22:16:20 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_vlan_hash_table(void);
|
2016-03-13 22:16:20 +00:00
|
|
|
|
2013-08-11 19:02:26 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_ipv4_hash_table(void);
|
2013-08-11 19:02:26 +00:00
|
|
|
|
2013-08-18 19:02:48 +00:00
|
|
|
WS_DLL_PUBLIC
|
2016-04-21 16:04:16 +00:00
|
|
|
wmem_map_t *get_ipv6_hash_table(void);
|
2013-08-18 19:02:48 +00:00
|
|
|
|
2018-05-20 08:44:15 +00:00
|
|
|
/*
|
|
|
|
* XXX - if we ever have per-session host name etc. information, we
|
|
|
|
* should probably have the "resolve synchronously or asynchronously"
|
|
|
|
* flag be per-session, set with an epan API.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void set_resolution_synchrony(gboolean synchronous);
|
|
|
|
|
2013-08-07 16:46:08 +00:00
|
|
|
/*
|
|
|
|
* private functions (should only be called by epan directly)
|
|
|
|
*/
|
2013-08-01 20:11:13 +00:00
|
|
|
|
2013-08-07 16:46:08 +00:00
|
|
|
WS_DLL_LOCAL
|
|
|
|
void name_resolver_init(void);
|
|
|
|
|
2018-09-02 12:43:40 +00:00
|
|
|
/* Reinitialize hostname resolution subsystem */
|
2013-08-07 16:46:08 +00:00
|
|
|
WS_DLL_LOCAL
|
2018-09-02 12:43:40 +00:00
|
|
|
void host_name_lookup_reset(void);
|
2013-08-07 16:46:08 +00:00
|
|
|
|
|
|
|
WS_DLL_LOCAL
|
|
|
|
void addr_resolv_init(void);
|
|
|
|
|
|
|
|
WS_DLL_LOCAL
|
|
|
|
void addr_resolv_cleanup(void);
|
2013-08-01 20:11:13 +00:00
|
|
|
|
2013-10-23 12:02:15 +00:00
|
|
|
WS_DLL_PUBLIC
|
2013-10-23 14:04:19 +00:00
|
|
|
void manually_resolve_cleanup(void);
|
2013-10-23 12:02:15 +00:00
|
|
|
|
2015-11-11 12:15:16 +00:00
|
|
|
WS_DLL_PUBLIC
|
2013-12-21 16:16:56 +00:00
|
|
|
gboolean str_to_ip(const char *str, void *dst);
|
2015-11-11 12:15:16 +00:00
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
2013-12-21 16:16:56 +00:00
|
|
|
gboolean str_to_ip6(const char *str, void *dst);
|
|
|
|
|
2018-10-10 15:25:52 +00:00
|
|
|
WS_DLL_LOCAL
|
|
|
|
gboolean str_to_eth(const char *str, char *eth_bytes);
|
|
|
|
|
2018-02-09 01:20:26 +00:00
|
|
|
WS_DLL_LOCAL
|
|
|
|
guint ipv6_oat_hash(gconstpointer key);
|
|
|
|
|
|
|
|
WS_DLL_LOCAL
|
|
|
|
gboolean ipv6_equal(gconstpointer v1, gconstpointer v2);
|
|
|
|
|
2007-01-18 18:43:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
#endif /* __RESOLV_H__ */
|