Rename g_resolv_flags --> gbl_resolv_flags; Also: cleanup some whitespace & indentation.
svn path=/trunk/; revision=34487
This commit is contained in:
parent
6e31c8c406
commit
c78221d4ce
|
@ -279,7 +279,7 @@ static void add_serv_port_cb(const guint32 port);
|
|||
/*
|
||||
* Flag controlling what names to resolve.
|
||||
*/
|
||||
guint32 g_resolv_flags;
|
||||
guint32 gbl_resolv_flags;
|
||||
|
||||
/*
|
||||
* Global variables (can be changed in GUI sections)
|
||||
|
@ -649,7 +649,7 @@ static gchar
|
|||
tp->port = port;
|
||||
tp->next = NULL;
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT) ||
|
||||
if (!(gbl_resolv_flags & RESOLV_TRANSPORT) ||
|
||||
(servp = getservbyport(g_htons(port), serv_proto)) == NULL) {
|
||||
/* unknown port */
|
||||
guint32_to_str_buf(port, tp->name, MAXNAMELEN);
|
||||
|
@ -792,7 +792,7 @@ host_lookup(const guint addr, const gboolean resolve, gboolean *found)
|
|||
if (resolve) {
|
||||
tp->resolve = TRUE;
|
||||
#ifdef ASYNC_DNS
|
||||
if ((g_resolv_flags & RESOLV_CONCURRENT) &&
|
||||
if ((gbl_resolv_flags & RESOLV_CONCURRENT) &&
|
||||
prefs.name_resolve_concurrency > 0 &&
|
||||
async_dns_initialized) {
|
||||
add_async_dns_ipv4(AF_INET, addr);
|
||||
|
@ -810,7 +810,7 @@ host_lookup(const guint addr, const gboolean resolve, gboolean *found)
|
|||
* botch, we don't try to translate an all-zero IP address to a host
|
||||
* name.
|
||||
*/
|
||||
if (addr != 0 && (g_resolv_flags & RESOLV_NETWORK)) {
|
||||
if (addr != 0 && (gbl_resolv_flags & RESOLV_NETWORK)) {
|
||||
/* Use async DNS if possible, else fall back to timeouts,
|
||||
* else call gethostbyaddr and hope for the best
|
||||
*/
|
||||
|
@ -901,7 +901,7 @@ host_lookup6(const struct e_in6_addr *addr, const gboolean resolve, gboolean *fo
|
|||
#ifdef INET6
|
||||
|
||||
#ifdef HAVE_C_ARES
|
||||
if ((g_resolv_flags & RESOLV_CONCURRENT) &&
|
||||
if ((gbl_resolv_flags & RESOLV_CONCURRENT) &&
|
||||
prefs.name_resolve_concurrency > 0 &&
|
||||
async_dns_initialized) {
|
||||
caqm = g_malloc(sizeof(async_dns_queue_msg_t));
|
||||
|
@ -2605,7 +2605,7 @@ extern const gchar *
|
|||
get_hostname(const guint addr)
|
||||
{
|
||||
gboolean found;
|
||||
gboolean resolve = g_resolv_flags & RESOLV_NETWORK;
|
||||
gboolean resolve = gbl_resolv_flags & RESOLV_NETWORK;
|
||||
hashipv4_t *tp = host_lookup(addr, resolve, &found);
|
||||
|
||||
if (!resolve)
|
||||
|
@ -2620,7 +2620,7 @@ extern const gchar *
|
|||
get_hostname6(const struct e_in6_addr *addr)
|
||||
{
|
||||
gboolean found;
|
||||
gboolean resolve = g_resolv_flags & RESOLV_NETWORK;
|
||||
gboolean resolve = gbl_resolv_flags & RESOLV_NETWORK;
|
||||
hashipv6_t *tp = host_lookup6(addr, resolve, &found);
|
||||
|
||||
if (!resolve || E_IN6_IS_ADDR_LINKLOCAL(addr) || E_IN6_IS_ADDR_MULTICAST(addr))
|
||||
|
@ -2722,7 +2722,7 @@ extern gchar *
|
|||
get_udp_port(guint port)
|
||||
{
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
return ep_utoa(port);
|
||||
}
|
||||
|
||||
|
@ -2734,7 +2734,7 @@ extern gchar *
|
|||
get_dccp_port(guint port)
|
||||
{
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
return ep_utoa(port);
|
||||
}
|
||||
|
||||
|
@ -2747,7 +2747,7 @@ extern gchar *
|
|||
get_tcp_port(guint port)
|
||||
{
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
return ep_utoa(port);
|
||||
}
|
||||
|
||||
|
@ -2759,7 +2759,7 @@ extern gchar *
|
|||
get_sctp_port(guint port)
|
||||
{
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_TRANSPORT)) {
|
||||
return ep_utoa(port);
|
||||
}
|
||||
|
||||
|
@ -2822,7 +2822,7 @@ gchar *
|
|||
get_ether_name(const guint8 *addr)
|
||||
{
|
||||
hashether_t *tp;
|
||||
gboolean resolve = (g_resolv_flags & RESOLV_MAC) != 0;
|
||||
gboolean resolve = (gbl_resolv_flags & RESOLV_MAC) != 0;
|
||||
|
||||
if (resolve && !eth_resolution_initialized) {
|
||||
initialize_ethers();
|
||||
|
@ -2845,7 +2845,7 @@ get_ether_name_if_known(const guint8 *addr)
|
|||
|
||||
/* Initialize ether structs if we're the first
|
||||
* ether-related function called */
|
||||
if (!(g_resolv_flags & RESOLV_MAC))
|
||||
if (!(gbl_resolv_flags & RESOLV_MAC))
|
||||
return NULL;
|
||||
|
||||
if (!eth_resolution_initialized) {
|
||||
|
@ -2871,7 +2871,7 @@ extern guint8 *
|
|||
get_ether_addr(const gchar *name)
|
||||
{
|
||||
|
||||
/* force resolution (do not check g_resolv_flags) */
|
||||
/* force resolution (do not check gbl_resolv_flags) */
|
||||
|
||||
if (!eth_resolution_initialized) {
|
||||
initialize_ethers();
|
||||
|
@ -2890,7 +2890,7 @@ add_ether_byip(const guint ip, const guint8 *eth)
|
|||
gboolean found;
|
||||
|
||||
/* first check that IP address can be resolved */
|
||||
if (!(g_resolv_flags & RESOLV_NETWORK))
|
||||
if (!(gbl_resolv_flags & RESOLV_NETWORK))
|
||||
return;
|
||||
|
||||
if ((host = host_name_lookup(ip, &found)) == NULL)
|
||||
|
@ -2907,7 +2907,7 @@ extern const gchar *
|
|||
get_ipxnet_name(const guint32 addr)
|
||||
{
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_NETWORK)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_NETWORK)) {
|
||||
return ipxnet_to_str_punct(addr, '\0');
|
||||
}
|
||||
|
||||
|
@ -2926,7 +2926,7 @@ get_ipxnet_addr(const gchar *name, gboolean *known)
|
|||
guint32 addr;
|
||||
gboolean success;
|
||||
|
||||
/* force resolution (do not check g_resolv_flags) */
|
||||
/* force resolution (do not check gbl_resolv_flags) */
|
||||
|
||||
if (!ipxnet_resolution_initialized) {
|
||||
initialize_ipxnets();
|
||||
|
@ -2946,12 +2946,12 @@ get_manuf_name(const guint8 *addr)
|
|||
gchar *cur;
|
||||
hashmanuf_t *mtp;
|
||||
|
||||
if ((g_resolv_flags & RESOLV_MAC) && !eth_resolution_initialized) {
|
||||
if ((gbl_resolv_flags & RESOLV_MAC) && !eth_resolution_initialized) {
|
||||
initialize_ethers();
|
||||
eth_resolution_initialized = TRUE;
|
||||
}
|
||||
|
||||
if (!(g_resolv_flags & RESOLV_MAC) || ((mtp = manuf_name_lookup(addr)) == NULL)) {
|
||||
if (!(gbl_resolv_flags & RESOLV_MAC) || ((mtp = manuf_name_lookup(addr)) == NULL)) {
|
||||
cur=ep_alloc(MAXMANUFLEN);
|
||||
g_snprintf(cur, MAXMANUFLEN, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
|
||||
return cur;
|
||||
|
@ -3025,13 +3025,13 @@ get_host_ipaddr(const char *host, guint32 *addrp)
|
|||
* less-than-4 octet notation.
|
||||
*/
|
||||
if (!inet_aton(host, &ipaddr)) {
|
||||
if (! (g_resolv_flags & RESOLV_NETWORK)) {
|
||||
if (! (gbl_resolv_flags & RESOLV_NETWORK)) {
|
||||
return FALSE;
|
||||
}
|
||||
/* It's not a valid dotted-quad IP address; is it a valid
|
||||
* host name? */
|
||||
#ifdef HAVE_C_ARES
|
||||
if (! (g_resolv_flags & RESOLV_CONCURRENT) ||
|
||||
if (! (gbl_resolv_flags & RESOLV_CONCURRENT) ||
|
||||
prefs.name_resolve_concurrency < 1 ||
|
||||
! async_dns_initialized) {
|
||||
return FALSE;
|
||||
|
@ -3101,13 +3101,13 @@ get_host_ipaddr6(const char *host, struct e_in6_addr *addrp)
|
|||
if (inet_pton(AF_INET6, host, addrp) == 1)
|
||||
return TRUE;
|
||||
|
||||
if (! (g_resolv_flags & RESOLV_NETWORK)) {
|
||||
if (! (gbl_resolv_flags & RESOLV_NETWORK)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* try FQDN */
|
||||
#ifdef HAVE_C_ARES
|
||||
if (! (g_resolv_flags & RESOLV_CONCURRENT) ||
|
||||
if (! (gbl_resolv_flags & RESOLV_CONCURRENT) ||
|
||||
prefs.name_resolve_concurrency < 1 ||
|
||||
! async_dns_initialized) {
|
||||
return FALSE;
|
||||
|
|
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
/*
|
||||
* Flag controlling what names to resolve.
|
||||
*/
|
||||
WS_VAR_IMPORT guint32 g_resolv_flags;
|
||||
WS_VAR_IMPORT guint32 gbl_resolv_flags;
|
||||
|
||||
/* 32 types are sufficient (as are 640k of RAM) */
|
||||
/* FIXME: Maybe MANUF/m, IP/i, IP6/6, IPX/x, UDP+TCP/t etc would be
|
||||
|
|
|
@ -285,7 +285,7 @@ const char *ipprotostr(const int proto) {
|
|||
* XXX - have another flag for resolving network-layer
|
||||
* protocol names?
|
||||
*/
|
||||
if (g_resolv_flags != 0) {
|
||||
if (gbl_resolv_flags != 0) {
|
||||
static char buf[128];
|
||||
struct protoent *pe;
|
||||
|
||||
|
|
|
@ -488,8 +488,8 @@ fvalue_get_uinteger
|
|||
fvalue_string_repr_len
|
||||
fvalue_t_free_list DATA
|
||||
fvalue_to_string_repr
|
||||
g_resolv_flags DATA
|
||||
GatekeeperRejectReason_vals DATA
|
||||
gbl_resolv_flags DATA
|
||||
gcamel_StatSRT DATA
|
||||
geoip_db_get_paths
|
||||
geoip_db_lookup_ipv4
|
||||
|
|
|
@ -266,7 +266,7 @@ capture_filter_check_syntax_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|||
|
||||
/* pcap_compile_nopcap will not alter the filter string, so the (char *) cast is "safe" */
|
||||
if (pcap_compile_nopcap(DUMMY_SNAPLENGTH /* use a dummy snaplength for syntax-checking */,
|
||||
global_capture_opts.linktype, &fcode, (char *)filter_text, 1 /* Do optimize */,
|
||||
global_capture_opts.linktype, &fcode, (char *)filter_text, 1 /* Do optimize */,
|
||||
DUMMY_NETMASK /* use a dummy netmask for syntax-checking */) < 0) {
|
||||
colorize_filter_te_as_invalid(filter_te);
|
||||
} else {
|
||||
|
@ -2310,7 +2310,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
m_resolv_cb = gtk_check_button_new_with_mnemonic(
|
||||
"Enable _MAC name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_resolv_cb),
|
||||
g_resolv_flags & RESOLV_MAC);
|
||||
gbl_resolv_flags & RESOLV_MAC);
|
||||
gtk_tooltips_set_tip(tooltips, m_resolv_cb,
|
||||
"Perform MAC layer name resolution while capturing.", NULL);
|
||||
gtk_container_add(GTK_CONTAINER(resolv_vb), m_resolv_cb);
|
||||
|
@ -2318,7 +2318,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
n_resolv_cb = gtk_check_button_new_with_mnemonic(
|
||||
"Enable _network name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(n_resolv_cb),
|
||||
g_resolv_flags & RESOLV_NETWORK);
|
||||
gbl_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_tooltips_set_tip(tooltips, n_resolv_cb,
|
||||
"Perform network layer name resolution while capturing.", NULL);
|
||||
gtk_container_add(GTK_CONTAINER(resolv_vb), n_resolv_cb);
|
||||
|
@ -2326,7 +2326,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
t_resolv_cb = gtk_check_button_new_with_mnemonic(
|
||||
"Enable _transport name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t_resolv_cb),
|
||||
g_resolv_flags & RESOLV_TRANSPORT);
|
||||
gbl_resolv_flags & RESOLV_TRANSPORT);
|
||||
gtk_tooltips_set_tip(tooltips, t_resolv_cb,
|
||||
"Perform transport layer name resolution while capturing.", NULL);
|
||||
gtk_container_add(GTK_CONTAINER(resolv_vb), t_resolv_cb);
|
||||
|
@ -2892,17 +2892,17 @@ capture_dlg_prep(gpointer parent_w) {
|
|||
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hide_info_cb));
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_MAC;
|
||||
gbl_resolv_flags |= RESOLV_MAC;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_MAC;
|
||||
gbl_resolv_flags &= ~RESOLV_MAC;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(n_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_NETWORK;
|
||||
gbl_resolv_flags |= RESOLV_NETWORK;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_NETWORK;
|
||||
gbl_resolv_flags &= ~RESOLV_NETWORK;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_TRANSPORT;
|
||||
gbl_resolv_flags |= RESOLV_TRANSPORT;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_TRANSPORT;
|
||||
gbl_resolv_flags &= ~RESOLV_TRANSPORT;
|
||||
|
||||
global_capture_opts.has_ring_num_files =
|
||||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ringbuffer_nbf_cb));
|
||||
|
|
|
@ -542,7 +542,7 @@ file_open_cmd(GtkWidget *w)
|
|||
/* resolve buttons */
|
||||
m_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _MAC name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_resolv_cb),
|
||||
g_resolv_flags & RESOLV_MAC);
|
||||
gbl_resolv_flags & RESOLV_MAC);
|
||||
gtk_box_pack_start(GTK_BOX(main_vb), m_resolv_cb, FALSE, FALSE, 0);
|
||||
g_object_set_data(G_OBJECT(file_open_w),
|
||||
E_FILE_M_RESOLVE_KEY, m_resolv_cb);
|
||||
|
@ -550,13 +550,13 @@ file_open_cmd(GtkWidget *w)
|
|||
|
||||
n_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _network name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(n_resolv_cb),
|
||||
g_resolv_flags & RESOLV_NETWORK);
|
||||
gbl_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_box_pack_start(GTK_BOX(main_vb), n_resolv_cb, FALSE, FALSE, 0);
|
||||
gtk_widget_show(n_resolv_cb);
|
||||
g_object_set_data(G_OBJECT(file_open_w), E_FILE_N_RESOLVE_KEY, n_resolv_cb);
|
||||
t_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _transport name resolution");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t_resolv_cb),
|
||||
g_resolv_flags & RESOLV_TRANSPORT);
|
||||
gbl_resolv_flags & RESOLV_TRANSPORT);
|
||||
gtk_box_pack_start(GTK_BOX(main_vb), t_resolv_cb, FALSE, FALSE, 0);
|
||||
gtk_widget_show(t_resolv_cb);
|
||||
g_object_set_data(G_OBJECT(file_open_w), E_FILE_T_RESOLVE_KEY, t_resolv_cb);
|
||||
|
@ -673,22 +673,22 @@ file_open_ok_cb(GtkWidget *w, gpointer fs) {
|
|||
cfile.rfcode = rfcode;
|
||||
|
||||
/* Set the global resolving variable */
|
||||
g_resolv_flags = prefs.name_resolve;
|
||||
gbl_resolv_flags = prefs.name_resolve;
|
||||
m_resolv_cb = g_object_get_data(G_OBJECT(w), E_FILE_M_RESOLVE_KEY);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (m_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_MAC;
|
||||
gbl_resolv_flags |= RESOLV_MAC;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_MAC;
|
||||
gbl_resolv_flags &= ~RESOLV_MAC;
|
||||
n_resolv_cb = g_object_get_data(G_OBJECT(w), E_FILE_N_RESOLVE_KEY);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (n_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_NETWORK;
|
||||
gbl_resolv_flags |= RESOLV_NETWORK;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_NETWORK;
|
||||
gbl_resolv_flags &= ~RESOLV_NETWORK;
|
||||
t_resolv_cb = g_object_get_data(G_OBJECT(w), E_FILE_T_RESOLVE_KEY);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (t_resolv_cb)))
|
||||
g_resolv_flags |= RESOLV_TRANSPORT;
|
||||
gbl_resolv_flags |= RESOLV_TRANSPORT;
|
||||
else
|
||||
g_resolv_flags &= ~RESOLV_TRANSPORT;
|
||||
gbl_resolv_flags &= ~RESOLV_TRANSPORT;
|
||||
|
||||
/* We've crossed the Rubicon; get rid of the file selection box. */
|
||||
window_destroy(GTK_WIDGET (fs));
|
||||
|
@ -1144,7 +1144,7 @@ set_file_type_list(GtkWidget *combo_box, int default_file_type)
|
|||
guint idx;
|
||||
gint item_to_select;
|
||||
|
||||
/* Default to the first supported file type (which should be libpcap)
|
||||
/* Default to the first supported file type (which should be libpcap)
|
||||
if this file's current type isn't supported */
|
||||
item_to_select = 0;
|
||||
|
||||
|
|
|
@ -1167,11 +1167,11 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
|
||||
/* Fill in our resolution values */
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, g_resolv_flags & RESOLV_MAC, 0);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags & RESOLV_MAC, 0);
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_NET_NR_CB);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, g_resolv_flags & RESOLV_NETWORK, 0);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags & RESOLV_NETWORK, 0);
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_TRANS_NR_CB);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, g_resolv_flags & RESOLV_TRANSPORT, 0);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags & RESOLV_TRANSPORT, 0);
|
||||
|
||||
preview_set_filename(of_hwnd, NULL);
|
||||
break;
|
||||
|
@ -1183,16 +1183,16 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
dfilter_open_str = filter_tb_get(cur_ctrl);
|
||||
|
||||
/* Fetch our resolution values */
|
||||
g_resolv_flags = prefs.name_resolve & RESOLV_CONCURRENT;
|
||||
gbl_resolv_flags = prefs.name_resolve & RESOLV_CONCURRENT;
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
g_resolv_flags |= RESOLV_MAC;
|
||||
gbl_resolv_flags |= RESOLV_MAC;
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_NET_NR_CB);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
g_resolv_flags |= RESOLV_NETWORK;
|
||||
gbl_resolv_flags |= RESOLV_NETWORK;
|
||||
cur_ctrl = GetDlgItem(of_hwnd, EWFD_TRANS_NR_CB);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
g_resolv_flags |= RESOLV_TRANSPORT;
|
||||
gbl_resolv_flags |= RESOLV_TRANSPORT;
|
||||
break;
|
||||
case CDN_SELCHANGE:
|
||||
/* This _almost_ works correctly. We need to handle directory
|
||||
|
|
18
gtk/main.c
18
gtk/main.c
|
@ -609,7 +609,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
|
|||
/* Only construct the filter when a single occurrence is displayed
|
||||
* otherwise we might end up with a filter like "ip.proto==1,6".
|
||||
*
|
||||
* Or do we want to be able to filter on multiple occurrences so that
|
||||
* Or do we want to be able to filter on multiple occurrences so that
|
||||
* the filter might be calculated as "ip.proto==1 && ip.proto==6"
|
||||
* instead?
|
||||
*/
|
||||
|
@ -935,10 +935,10 @@ void expand_tree_cb(GtkWidget *widget _U_, gpointer data _U_) {
|
|||
|
||||
void resolve_name_cb(GtkWidget *widget _U_, gpointer data _U_) {
|
||||
if (cfile.edt->tree) {
|
||||
guint32 tmp = g_resolv_flags;
|
||||
g_resolv_flags = RESOLV_ALL;
|
||||
guint32 tmp = gbl_resolv_flags;
|
||||
gbl_resolv_flags = RESOLV_ALL;
|
||||
proto_tree_draw(cfile.edt->tree, tree_view_gbl);
|
||||
g_resolv_flags = tmp;
|
||||
gbl_resolv_flags = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2569,12 +2569,12 @@ main(int argc, char *argv[])
|
|||
prefs_p->gui_font_name = g_strdup(optarg);
|
||||
break;
|
||||
case 'n': /* No name resolution */
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
break;
|
||||
case 'N': /* Select what types of addresses/port #s to resolve */
|
||||
if (g_resolv_flags == RESOLV_ALL)
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &g_resolv_flags);
|
||||
if (gbl_resolv_flags == RESOLV_ALL)
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &gbl_resolv_flags);
|
||||
if (badopt != '\0') {
|
||||
cmdarg_err("-N specifies unknown resolving option '%c'; valid options are 'm', 'n', and 't'",
|
||||
badopt);
|
||||
|
@ -3723,7 +3723,7 @@ prefs_to_capture_opts(void)
|
|||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
/* Set the name resolution code's flags from the preferences. */
|
||||
g_resolv_flags = prefs.name_resolve;
|
||||
gbl_resolv_flags = prefs.name_resolve;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ man_addr_resolv_ok (GtkWidget *w _U_, gpointer data _U_)
|
|||
|
||||
if (strlen (addr) && strlen (name)) {
|
||||
if (!add_ip_name_from_string (addr, name)) {
|
||||
GtkWidget *dialog = simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
GtkWidget *dialog = simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Illegal IP address: \"%s\".", addr);
|
||||
simple_dialog_set_cb (dialog, man_addr_ill_addr_cb, NULL);
|
||||
return;
|
||||
|
@ -87,9 +87,9 @@ man_addr_resolv_ok (GtkWidget *w _U_, gpointer data _U_)
|
|||
|
||||
resolv_cb = g_object_get_data (G_OBJECT(man_addr_resolv_dlg), "resolv");
|
||||
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolv_cb));
|
||||
if (!(g_resolv_flags & RESOLV_NETWORK) && active) {
|
||||
if (!(gbl_resolv_flags & RESOLV_NETWORK) && active) {
|
||||
/* Name resolution for Network Layer activated */
|
||||
g_resolv_flags |= RESOLV_NETWORK;
|
||||
gbl_resolv_flags |= RESOLV_NETWORK;
|
||||
menu_name_resolution_changed ();
|
||||
redissect = TRUE;
|
||||
}
|
||||
|
@ -153,9 +153,9 @@ manual_addr_resolv_dlg (GtkWidget *w _U_, gpointer data)
|
|||
gtk_container_add (GTK_CONTAINER(vbox), sep);
|
||||
|
||||
resolv_cb = gtk_check_button_new_with_mnemonic ("Enable network name resolution");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(resolv_cb), g_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_widget_set_sensitive (resolv_cb, !(g_resolv_flags & RESOLV_NETWORK));
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(resolv_cb), gbl_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_widget_set_sensitive (resolv_cb, !(gbl_resolv_flags & RESOLV_NETWORK));
|
||||
|
||||
gtk_tooltips_set_tip (tooltips, resolv_cb, "Perform network layer name resolution.", NULL);
|
||||
g_object_set_data (G_OBJECT(man_addr_resolv_dlg), "resolv", resolv_cb);
|
||||
gtk_container_add (GTK_CONTAINER(vbox), resolv_cb);
|
||||
|
|
22
gtk/menus.c
22
gtk/menus.c
|
@ -4842,29 +4842,29 @@ menu_name_resolution_changed(void)
|
|||
if(!menu){
|
||||
g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
|
||||
}
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
|
||||
|
||||
menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
|
||||
if(!menu){
|
||||
g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
|
||||
}
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
|
||||
|
||||
menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
|
||||
if(!menu){
|
||||
g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
|
||||
}
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
|
||||
|
||||
#else
|
||||
menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
|
||||
|
||||
menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
|
||||
|
||||
menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
|
||||
#endif /* MAIN_MENU_USE_UIMANAGER */
|
||||
}
|
||||
|
||||
|
@ -4872,9 +4872,9 @@ static void
|
|||
name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
|
||||
{
|
||||
if (GTK_CHECK_MENU_ITEM(w)->active) {
|
||||
g_resolv_flags |= action;
|
||||
gbl_resolv_flags |= action;
|
||||
} else {
|
||||
g_resolv_flags &= ~action;
|
||||
gbl_resolv_flags &= ~action;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5900,7 +5900,7 @@ set_menus_for_selected_packet(capture_file *cf)
|
|||
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
|
||||
frame_selected);
|
||||
set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
|
||||
frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
#ifdef MAIN_MENU_USE_UIMANAGER
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
|
||||
frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
|
||||
|
@ -5911,7 +5911,7 @@ set_menus_for_selected_packet(capture_file *cf)
|
|||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
|
||||
frame_selected && decode_as_ok());
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
|
||||
frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
|
||||
frame_selected);
|
||||
|
||||
|
@ -5925,7 +5925,7 @@ set_menus_for_selected_packet(capture_file *cf)
|
|||
set_menu_sensitivity_old("/Analyze/Decode As...",
|
||||
frame_selected && decode_as_ok());
|
||||
set_menu_sensitivity_old("/View/Name Resolution/Resolve Name",
|
||||
frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
set_menu_sensitivity_old("/Tools/Firewall ACL Rules",
|
||||
frame_selected);
|
||||
#endif /* MAIN_MENU_USE_UIMANAGER */
|
||||
|
|
|
@ -107,7 +107,7 @@ nameres_prefs_show(void)
|
|||
* without a subsequent editing of the preferences recording the
|
||||
* temporary settings as permanent preferences.
|
||||
*/
|
||||
prefs.name_resolve = g_resolv_flags;
|
||||
prefs.name_resolve = gbl_resolv_flags;
|
||||
|
||||
/* Main vertical box */
|
||||
main_vb = gtk_vbox_new(FALSE, 7);
|
||||
|
@ -299,7 +299,7 @@ nameres_prefs_apply(GtkWidget *w _U_)
|
|||
* XXX - force a regeneration of the protocol list if this has
|
||||
* changed?
|
||||
*/
|
||||
g_resolv_flags = prefs.name_resolve;
|
||||
gbl_resolv_flags = prefs.name_resolve;
|
||||
menu_name_resolution_changed();
|
||||
}
|
||||
|
||||
|
|
10
rawshark.c
10
rawshark.c
|
@ -541,7 +541,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Set the name resolution code's flags from the preferences. */
|
||||
g_resolv_flags = prefs_p->name_resolve;
|
||||
gbl_resolv_flags = prefs_p->name_resolve;
|
||||
|
||||
/* Read the disabled protocols file. */
|
||||
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
||||
|
@ -617,12 +617,12 @@ main(int argc, char *argv[])
|
|||
line_buffered = TRUE;
|
||||
break;
|
||||
case 'n': /* No name resolution */
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
break;
|
||||
case 'N': /* Select what types of addresses/port #s to resolve */
|
||||
if (g_resolv_flags == RESOLV_ALL)
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &g_resolv_flags);
|
||||
if (gbl_resolv_flags == RESOLV_ALL)
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &gbl_resolv_flags);
|
||||
if (badopt != '\0') {
|
||||
cmdarg_err("-N specifies unknown resolving option '%c'; valid options are 'm', 'n', and 't'",
|
||||
badopt);
|
||||
|
|
280
tshark.c
280
tshark.c
|
@ -113,7 +113,7 @@ static nstime_t first_ts;
|
|||
static nstime_t prev_dis_ts;
|
||||
static nstime_t prev_cap_ts;
|
||||
|
||||
static gboolean print_packet_info; /* TRUE if we're to print packet information */
|
||||
static gboolean print_packet_info; /* TRUE if we're to print packet information */
|
||||
|
||||
static gboolean perform_two_pass_analysis;
|
||||
|
||||
|
@ -121,14 +121,14 @@ static gboolean perform_two_pass_analysis;
|
|||
* The way the packet decode is to be written.
|
||||
*/
|
||||
typedef enum {
|
||||
WRITE_TEXT, /* summary or detail text */
|
||||
WRITE_XML, /* PDML or PSML */
|
||||
WRITE_FIELDS /* User defined list of fields */
|
||||
/* Add CSV and the like here */
|
||||
WRITE_TEXT, /* summary or detail text */
|
||||
WRITE_XML, /* PDML or PSML */
|
||||
WRITE_FIELDS /* User defined list of fields */
|
||||
/* Add CSV and the like here */
|
||||
} output_action_e;
|
||||
|
||||
static output_action_e output_action;
|
||||
static gboolean do_dissection; /* TRUE if we have to dissect each packet */
|
||||
static gboolean do_dissection; /* TRUE if we have to dissect each packet */
|
||||
static gboolean verbose;
|
||||
static gboolean print_hex;
|
||||
static gboolean line_buffered;
|
||||
|
@ -148,8 +148,8 @@ static gboolean print_packet_counts;
|
|||
static capture_options global_capture_opts;
|
||||
|
||||
#ifdef SIGINFO
|
||||
static gboolean infodelay; /* if TRUE, don't print capture info in SIGINFO handler */
|
||||
static gboolean infoprint; /* if TRUE, print capture info after clearing infodelay */
|
||||
static gboolean infodelay; /* if TRUE, don't print capture info in SIGINFO handler */
|
||||
static gboolean infoprint; /* if TRUE, print capture info after clearing infodelay */
|
||||
#endif /* SIGINFO */
|
||||
|
||||
static gboolean capture(void);
|
||||
|
@ -187,18 +187,18 @@ capture_file cfile;
|
|||
void
|
||||
cf_mark_frame(capture_file *cf _U_, frame_data *frame _U_)
|
||||
{
|
||||
g_assert_not_reached();
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
static void list_capture_types(void) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "editcap: The available capture file types for \"F\":\n");
|
||||
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
|
||||
if (wtap_dump_can_open(i))
|
||||
fprintf(stderr, " %s - %s\n",
|
||||
wtap_file_type_short_string(i), wtap_file_type_string(i));
|
||||
}
|
||||
fprintf(stderr, "editcap: The available capture file types for \"F\":\n");
|
||||
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
|
||||
if (wtap_dump_can_open(i))
|
||||
fprintf(stderr, " %s - %s\n",
|
||||
wtap_file_type_short_string(i), wtap_file_type_string(i));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -214,7 +214,7 @@ print_usage(gboolean print_ver)
|
|||
"See http://www.wireshark.org for more information.\n"
|
||||
"\n"
|
||||
"%s",
|
||||
wireshark_svnversion, get_copyright_info());
|
||||
wireshark_svnversion, get_copyright_info());
|
||||
} else {
|
||||
output = stderr;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ add_decode_as(const gchar *cl_param)
|
|||
cmdarg_err("Unknown protocol -- \"%s\"", dissector_str);
|
||||
} else {
|
||||
cmdarg_err("Protocol \"%s\" isn't valid for layer type \"%s\"",
|
||||
dissector_str, table_name);
|
||||
dissector_str, table_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -769,8 +769,8 @@ main(int argc, char *argv[])
|
|||
gboolean arg_error = FALSE;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
#endif /* _WIN32 */
|
||||
WSADATA wsaData;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
char *gpf_path, *pf_path;
|
||||
char *gdp_path, *dp_path;
|
||||
|
@ -843,21 +843,21 @@ main(int argc, char *argv[])
|
|||
optind_initial = optind;
|
||||
|
||||
while ((opt = getopt(argc, argv, optstring)) != -1) {
|
||||
switch (opt) {
|
||||
case 'C': /* Configuration Profile */
|
||||
if (profile_exists (optarg)) {
|
||||
set_profile_name (optarg);
|
||||
} else {
|
||||
cmdarg_err("Configuration Profile \"%s\" does not exist", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
ex_opt_add(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (opt) {
|
||||
case 'C': /* Configuration Profile */
|
||||
if (profile_exists (optarg)) {
|
||||
set_profile_name (optarg);
|
||||
} else {
|
||||
cmdarg_err("Configuration Profile \"%s\" does not exist", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
ex_opt_add(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
optind = optind_initial;
|
||||
|
@ -868,28 +868,28 @@ main(int argc, char *argv[])
|
|||
/** Send All g_log messages to our own handler **/
|
||||
|
||||
log_flags =
|
||||
G_LOG_LEVEL_ERROR|
|
||||
G_LOG_LEVEL_CRITICAL|
|
||||
G_LOG_LEVEL_WARNING|
|
||||
G_LOG_LEVEL_MESSAGE|
|
||||
G_LOG_LEVEL_INFO|
|
||||
G_LOG_LEVEL_DEBUG|
|
||||
G_LOG_FLAG_FATAL|G_LOG_FLAG_RECURSION;
|
||||
G_LOG_LEVEL_ERROR|
|
||||
G_LOG_LEVEL_CRITICAL|
|
||||
G_LOG_LEVEL_WARNING|
|
||||
G_LOG_LEVEL_MESSAGE|
|
||||
G_LOG_LEVEL_INFO|
|
||||
G_LOG_LEVEL_DEBUG|
|
||||
G_LOG_FLAG_FATAL|G_LOG_FLAG_RECURSION;
|
||||
|
||||
g_log_set_handler(NULL,
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
g_log_set_handler(LOG_DOMAIN_MAIN,
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
g_log_set_handler(LOG_DOMAIN_CAPTURE,
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
g_log_set_handler(LOG_DOMAIN_CAPTURE_CHILD,
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
log_flags,
|
||||
tshark_log_handler, NULL /* user_data */);
|
||||
#endif
|
||||
|
||||
initialize_funnel_ops();
|
||||
|
@ -934,7 +934,7 @@ main(int argc, char *argv[])
|
|||
If none of our build or other processes uses "-G" with no arguments,
|
||||
we can just process it with the other arguments. */
|
||||
if (argc >= 2 && strcmp(argv[1], "-G") == 0) {
|
||||
proto_initialize_all_prefixes();
|
||||
proto_initialize_all_prefixes();
|
||||
|
||||
if (argc == 2)
|
||||
proto_registrar_dump_fields(1);
|
||||
|
@ -998,7 +998,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Set the name resolution code's flags from the preferences. */
|
||||
g_resolv_flags = prefs_p->name_resolve;
|
||||
gbl_resolv_flags = prefs_p->name_resolve;
|
||||
|
||||
/* Read the disabled protocols file. */
|
||||
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
|
||||
|
@ -1067,7 +1067,7 @@ main(int argc, char *argv[])
|
|||
break;
|
||||
case 'C':
|
||||
/* Configuration profile settings were already processed just ignore them this time*/
|
||||
break;
|
||||
break;
|
||||
case 'd': /* Decode as rule */
|
||||
if (!add_decode_as(optarg))
|
||||
return 1;
|
||||
|
@ -1154,12 +1154,12 @@ main(int argc, char *argv[])
|
|||
break;
|
||||
#endif
|
||||
case 'n': /* No name resolution */
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
break;
|
||||
case 'N': /* Select what types of addresses/port #s to resolve */
|
||||
if (g_resolv_flags == RESOLV_ALL)
|
||||
g_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &g_resolv_flags);
|
||||
if (gbl_resolv_flags == RESOLV_ALL)
|
||||
gbl_resolv_flags = RESOLV_NONE;
|
||||
badopt = string_to_name_resolve(optarg, &gbl_resolv_flags);
|
||||
if (badopt != '\0') {
|
||||
cmdarg_err("-N specifies unknown resolving option '%c';",
|
||||
badopt);
|
||||
|
@ -1270,17 +1270,17 @@ main(int argc, char *argv[])
|
|||
}
|
||||
case 'V': /* Verbose */
|
||||
verbose = TRUE;
|
||||
/* The user asked for a verbose output, so let's ensure they get it,
|
||||
* even if they're writing to a file.
|
||||
*/
|
||||
print_packet_info = TRUE;
|
||||
/* The user asked for a verbose output, so let's ensure they get it,
|
||||
* even if they're writing to a file.
|
||||
*/
|
||||
print_packet_info = TRUE;
|
||||
break;
|
||||
case 'x': /* Print packet data in hex (and ASCII) */
|
||||
print_hex = TRUE;
|
||||
/* The user asked for hex output, so let's ensure they get it,
|
||||
* even if they're writing to a file.
|
||||
*/
|
||||
print_packet_info = TRUE;
|
||||
/* The user asked for hex output, so let's ensure they get it,
|
||||
* even if they're writing to a file.
|
||||
*/
|
||||
print_packet_info = TRUE;
|
||||
break;
|
||||
case 'X':
|
||||
break;
|
||||
|
@ -1470,7 +1470,7 @@ main(int argc, char *argv[])
|
|||
/* Multiple-file mode doesn't work under certain conditions:
|
||||
a) it doesn't work if you're writing to the standard output;
|
||||
b) it doesn't work if you're writing to a pipe;
|
||||
*/
|
||||
*/
|
||||
if (strcmp(global_capture_opts.save_file, "-") == 0) {
|
||||
cmdarg_err("Multiple capture files requested, but "
|
||||
"the capture is being written to the standard output.");
|
||||
|
@ -1482,7 +1482,7 @@ main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
if (!global_capture_opts.has_autostop_filesize &&
|
||||
!global_capture_opts.has_file_duration) {
|
||||
!global_capture_opts.has_file_duration) {
|
||||
cmdarg_err("Multiple capture files requested, but "
|
||||
"no maximum capture file size or duration was specified.");
|
||||
return 1;
|
||||
|
@ -1800,7 +1800,7 @@ typedef struct pipe_input_tag {
|
|||
pipe_input_cb_t input_cb;
|
||||
guint pipe_input_id;
|
||||
#ifdef _WIN32
|
||||
GStaticMutex callback_running;
|
||||
GStaticMutex callback_running;
|
||||
#endif
|
||||
} pipe_input_t;
|
||||
|
||||
|
@ -1824,47 +1824,47 @@ pipe_timer_cb(gpointer data)
|
|||
|
||||
/* try to read data from the pipe only 5 times, to avoid blocking */
|
||||
while(iterations < 5) {
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: new iteration");*/
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: new iteration");*/
|
||||
|
||||
/* Oddly enough although Named pipes don't work on win9x,
|
||||
PeekNamedPipe does !!! */
|
||||
handle = (HANDLE) _get_osfhandle (pipe_input->source);
|
||||
result = PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL);
|
||||
/* Oddly enough although Named pipes don't work on win9x,
|
||||
PeekNamedPipe does !!! */
|
||||
handle = (HANDLE) _get_osfhandle (pipe_input->source);
|
||||
result = PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL);
|
||||
|
||||
/* Get the child process exit status */
|
||||
result1 = GetExitCodeProcess((HANDLE)*(pipe_input->child_process),
|
||||
&childstatus);
|
||||
/* Get the child process exit status */
|
||||
result1 = GetExitCodeProcess((HANDLE)*(pipe_input->child_process),
|
||||
&childstatus);
|
||||
|
||||
/* If the Peek returned an error, or there are bytes to be read
|
||||
or the childwatcher thread has terminated then call the normal
|
||||
callback */
|
||||
if (!result || avail > 0 || childstatus != STILL_ACTIVE) {
|
||||
/* If the Peek returned an error, or there are bytes to be read
|
||||
or the childwatcher thread has terminated then call the normal
|
||||
callback */
|
||||
if (!result || avail > 0 || childstatus != STILL_ACTIVE) {
|
||||
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: data avail");*/
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: data avail");*/
|
||||
|
||||
/* And call the real handler */
|
||||
if (!pipe_input->input_cb(pipe_input->source, pipe_input->user_data)) {
|
||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: input pipe closed, iterations: %u", iterations);
|
||||
/* pipe closed, return false so that the timer is stopped */
|
||||
g_static_mutex_unlock (&pipe_input->callback_running);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: no data avail");*/
|
||||
/* No data, stop now */
|
||||
break;
|
||||
}
|
||||
/* And call the real handler */
|
||||
if (!pipe_input->input_cb(pipe_input->source, pipe_input->user_data)) {
|
||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: input pipe closed, iterations: %u", iterations);
|
||||
/* pipe closed, return false so that the timer is stopped */
|
||||
g_static_mutex_unlock (&pipe_input->callback_running);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: no data avail");*/
|
||||
/* No data, stop now */
|
||||
break;
|
||||
}
|
||||
|
||||
iterations++;
|
||||
iterations++;
|
||||
}
|
||||
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, new timer", iterations);*/
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, new timer", iterations);*/
|
||||
|
||||
g_static_mutex_unlock (&pipe_input->callback_running);
|
||||
g_static_mutex_unlock (&pipe_input->callback_running);
|
||||
|
||||
/* we didn't stopped the timer, so let it run */
|
||||
return TRUE;
|
||||
/* we didn't stopped the timer, so let it run */
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1873,20 +1873,20 @@ void
|
|||
pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb)
|
||||
{
|
||||
|
||||
pipe_input.source = source;
|
||||
pipe_input.child_process = child_process;
|
||||
pipe_input.user_data = user_data;
|
||||
pipe_input.input_cb = input_cb;
|
||||
pipe_input.source = source;
|
||||
pipe_input.child_process = child_process;
|
||||
pipe_input.user_data = user_data;
|
||||
pipe_input.input_cb = input_cb;
|
||||
|
||||
#ifdef _WIN32
|
||||
g_static_mutex_init(&pipe_input.callback_running);
|
||||
/* Tricky to use pipes in win9x, as no concept of wait. NT can
|
||||
do this but that doesn't cover all win32 platforms. GTK can do
|
||||
this but doesn't seem to work over processes. Attempt to do
|
||||
something similar here, start a timer and check for data on every
|
||||
timeout. */
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_input_set_handler: new");*/
|
||||
pipe_input.pipe_input_id = g_timeout_add(200, pipe_timer_cb, &pipe_input);
|
||||
g_static_mutex_init(&pipe_input.callback_running);
|
||||
/* Tricky to use pipes in win9x, as no concept of wait. NT can
|
||||
do this but that doesn't cover all win32 platforms. GTK can do
|
||||
this but doesn't seem to work over processes. Attempt to do
|
||||
something similar here, start a timer and check for data on every
|
||||
timeout. */
|
||||
/*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_input_set_handler: new");*/
|
||||
pipe_input.pipe_input_id = g_timeout_add(200, pipe_timer_cb, &pipe_input);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2016,8 +2016,8 @@ capture(void)
|
|||
#endif
|
||||
/* Call the real handler */
|
||||
if (!pipe_input.input_cb(pipe_input.source, pipe_input.user_data)) {
|
||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "input pipe closed");
|
||||
return FALSE;
|
||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "input pipe closed");
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef USE_TSHARK_SELECT
|
||||
}
|
||||
|
@ -2038,8 +2038,8 @@ void main_window_update(void)
|
|||
void
|
||||
capture_input_error_message(capture_options *capture_opts _U_, char *error_msg, char *secondary_error_msg)
|
||||
{
|
||||
cmdarg_err("%s", error_msg);
|
||||
cmdarg_err_cont("%s", secondary_error_msg);
|
||||
cmdarg_err("%s", error_msg);
|
||||
cmdarg_err_cont("%s", secondary_error_msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2047,30 +2047,30 @@ capture_input_error_message(capture_options *capture_opts _U_, char *error_msg,
|
|||
void
|
||||
capture_input_cfilter_error_message(capture_options *capture_opts, char *error_message)
|
||||
{
|
||||
dfilter_t *rfcode = NULL;
|
||||
dfilter_t *rfcode = NULL;
|
||||
|
||||
|
||||
if (dfilter_compile(capture_opts->cfilter, &rfcode) && rfcode != NULL) {
|
||||
cmdarg_err(
|
||||
"Invalid capture filter: \"%s\"!\n"
|
||||
"\n"
|
||||
"That string looks like a valid display filter; however, it isn't a valid\n"
|
||||
"capture filter (%s).\n"
|
||||
"\n"
|
||||
"Note that display filters and capture filters don't have the same syntax,\n"
|
||||
"so you can't use most display filter expressions as capture filters.\n"
|
||||
"\n"
|
||||
"See the User's Guide for a description of the capture filter syntax.",
|
||||
capture_opts->cfilter, error_message);
|
||||
dfilter_free(rfcode);
|
||||
} else {
|
||||
cmdarg_err(
|
||||
"Invalid capture filter: \"%s\"!\n"
|
||||
"\n"
|
||||
"That string isn't a valid capture filter (%s).\n"
|
||||
"See the User's Guide for a description of the capture filter syntax.",
|
||||
capture_opts->cfilter, error_message);
|
||||
}
|
||||
if (dfilter_compile(capture_opts->cfilter, &rfcode) && rfcode != NULL) {
|
||||
cmdarg_err(
|
||||
"Invalid capture filter: \"%s\"!\n"
|
||||
"\n"
|
||||
"That string looks like a valid display filter; however, it isn't a valid\n"
|
||||
"capture filter (%s).\n"
|
||||
"\n"
|
||||
"Note that display filters and capture filters don't have the same syntax,\n"
|
||||
"so you can't use most display filter expressions as capture filters.\n"
|
||||
"\n"
|
||||
"See the User's Guide for a description of the capture filter syntax.",
|
||||
capture_opts->cfilter, error_message);
|
||||
dfilter_free(rfcode);
|
||||
} else {
|
||||
cmdarg_err(
|
||||
"Invalid capture filter: \"%s\"!\n"
|
||||
"\n"
|
||||
"That string isn't a valid capture filter (%s).\n"
|
||||
"See the User's Guide for a description of the capture filter syntax.",
|
||||
capture_opts->cfilter, error_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2355,7 +2355,7 @@ process_packet_first_pass(capture_file *cf,
|
|||
run a read filter, or we're going to process taps, set up to
|
||||
do a dissection and do so. */
|
||||
if (do_dissection) {
|
||||
if (g_resolv_flags)
|
||||
if (gbl_resolv_flags)
|
||||
/* Grab any resolved addresses */
|
||||
host_name_lookup_process(NULL);
|
||||
|
||||
|
@ -2412,7 +2412,7 @@ process_packet_second_pass(capture_file *cf, frame_data *fdata,
|
|||
run a read filter, or we're going to process taps, set up to
|
||||
do a dissection and do so. */
|
||||
if (do_dissection) {
|
||||
if (g_resolv_flags)
|
||||
if (gbl_resolv_flags)
|
||||
/* Grab any resolved addresses */
|
||||
host_name_lookup_process(NULL);
|
||||
|
||||
|
@ -2783,7 +2783,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
|
|||
run a read filter, or we're going to process taps, set up to
|
||||
do a dissection and do so. */
|
||||
if (do_dissection) {
|
||||
if (print_packet_info && g_resolv_flags)
|
||||
if (print_packet_info && gbl_resolv_flags)
|
||||
/* Grab any resolved addresses */
|
||||
host_name_lookup_process(NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue