Refactor "common" hostlist/endpoint table functionality.

This is very similar in architecture to the changes made to the Conversation table functionality.  Since all conversations have endpoints/hostlists, the "registered" list is shared for both.

Change-Id: Ie8c6910a68a1b3f27c5b18c4494f49b9404a7b31
Reviewed-on: https://code.wireshark.org/review/3214
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2014-07-25 11:34:51 -04:00 committed by Anders Broman
parent a76c888cd9
commit 018b84de84
43 changed files with 1029 additions and 1918 deletions

View File

@ -38,8 +38,11 @@ GList *cmd_string_list_ = NULL;
struct register_ct {
gboolean hide_ports; /* hide TCP / UDP port columns */
int proto_id; /* protocol id (0-indexed) */
tap_packet_cb packet_func; /* function to be called for new incoming packets */
conv_gui_init_cb gui_init_cb; /* GUI specific function to initialize conversation */
tap_packet_cb conv_func; /* function to be called for new incoming packets for conversation*/
tap_packet_cb host_func; /* function to be called for new incoming packets for hostlist */
host_tap_prefix prefix_func; /* function to provide prefix if different than default (host) */
conv_gui_init_cb conv_gui_init; /* GUI specific function to initialize conversation */
host_gui_init_cb host_gui_init; /* GUI specific function to initialize hostlist */
};
gboolean get_conversation_hide_ports(register_ct_t* ct)
@ -57,9 +60,20 @@ int get_conversation_proto_id(register_ct_t* ct)
tap_packet_cb get_conversation_packet_func(register_ct_t* ct)
{
return ct->packet_func;
return ct->conv_func;
}
tap_packet_cb get_hostlist_packet_func(register_ct_t* ct)
{
return ct->host_func;
}
host_tap_prefix get_hostlist_prefix_func(register_ct_t* ct)
{
return ct->prefix_func;
}
static GSList *registered_ct_tables = NULL;
void
@ -77,10 +91,29 @@ dissector_conversation_init(const char *opt_arg, void* userdata)
}
g_string_free(cmd_str, TRUE);
if (table->gui_init_cb)
table->gui_init_cb(table, filter);
if (table->conv_gui_init)
table->conv_gui_init(table, filter);
}
void
dissector_hostlist_init(const char *opt_arg, void* userdata)
{
register_ct_t *table = (register_ct_t*)userdata;
GString *cmd_str = g_string_new("");
const char *filter=NULL;
g_string_printf(cmd_str, "%s,%s,", (table->prefix_func != NULL) ? table->prefix_func() : "host", proto_get_protocol_filter_name(table->proto_id));
if(!strncmp(opt_arg, cmd_str->str, cmd_str->len)){
filter=opt_arg+cmd_str->len;
} else {
filter=NULL;
}
g_string_free(cmd_str, TRUE);
if (table->host_gui_init)
table->host_gui_init(table, filter);
}
/** get conversation from protocol ID
*
* @param proto_id protocol ID
@ -110,37 +143,58 @@ insert_sorted_by_table_name(gconstpointer aparam, gconstpointer bparam)
}
void
register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb packet_func)
register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func, host_tap_prefix prefix_func)
{
register_ct_t *table;
GString *cmd_str = g_string_new("conv,");
GString *conv_cmd_str = g_string_new("conv,");
GString *host_cmd_str = g_string_new("");
table = g_new(register_ct_t,1);
table->hide_ports = hide_ports;
table->proto_id = proto_id;
table->packet_func = packet_func;
table->gui_init_cb = NULL;
table->hide_ports = hide_ports;
table->proto_id = proto_id;
table->conv_func = conv_packet_func;
table->host_func = hostlist_func;
table->conv_gui_init = NULL;
table->host_gui_init = NULL;
table->prefix_func = prefix_func;
registered_ct_tables = g_slist_insert_sorted(registered_ct_tables, table, insert_sorted_by_table_name);
g_string_append(cmd_str, proto_get_protocol_filter_name(table->proto_id));
cmd_string_list_ = g_list_append(cmd_string_list_, cmd_str->str);
register_stat_cmd_arg(cmd_str->str, dissector_conversation_init, table);
g_string_free(cmd_str, FALSE);
g_string_append(conv_cmd_str, proto_get_protocol_filter_name(table->proto_id));
cmd_string_list_ = g_list_append(cmd_string_list_, conv_cmd_str->str);
register_stat_cmd_arg(conv_cmd_str->str, dissector_conversation_init, table);
g_string_free(conv_cmd_str, FALSE);
g_string_printf(host_cmd_str, "%s,%s", (get_hostlist_prefix_func(table) != NULL) ? get_hostlist_prefix_func(table)() : "host",
proto_get_protocol_filter_name(table->proto_id));
register_stat_cmd_arg(host_cmd_str->str, dissector_hostlist_init, table);
g_string_free(host_cmd_str, FALSE);
}
/* Set GUI fields for register_ct list */
static void
set_gui_data(gpointer data, gpointer user_data)
set_conv_gui_data(gpointer data, gpointer user_data)
{
register_ct_t *table = (register_ct_t*)data;
table->gui_init_cb = (conv_gui_init_cb)user_data;
table->conv_gui_init = (conv_gui_init_cb)user_data;
}
void conversation_table_set_gui_info(conv_gui_init_cb init_cb)
{
g_slist_foreach(registered_ct_tables, set_gui_data, init_cb);
g_slist_foreach(registered_ct_tables, set_conv_gui_data, init_cb);
}
static void
set_host_gui_data(gpointer data, gpointer user_data)
{
register_ct_t *table = (register_ct_t*)data;
table->host_gui_init = (host_gui_init_cb)user_data;
}
void hostlist_table_set_gui_info(host_gui_init_cb init_cb)
{
g_slist_foreach(registered_ct_tables, set_host_gui_data, init_cb);
}
void conversation_table_iterate_tables(GFunc func, gpointer user_data)
@ -243,6 +297,30 @@ reset_conversation_table_data(conv_hash_t *ch)
ch->hashtable=NULL;
}
void reset_hostlist_table_data(conv_hash_t *ch)
{
if (!ch) {
return;
}
if (ch->conv_array != NULL) {
guint i;
for(i = 0; i < ch->conv_array->len; i++){
hostlist_talker_t *host = &g_array_index(ch->conv_array, hostlist_talker_t, i);
g_free((gpointer)host->myaddress.data);
}
g_array_free(ch->conv_array, TRUE);
}
if (ch->hashtable != NULL) {
g_hash_table_destroy(ch->hashtable);
}
ch->conv_array=NULL;
ch->hashtable=NULL;
}
const char *get_conversation_address(address *addr, gboolean resolve_names)
{
if (resolve_names) {
@ -288,6 +366,17 @@ conversation_get_filter_name(conv_item_t *conv_item, conv_filter_type_e filter_t
return conv_item->dissector_info->get_filter_type(conv_item, filter_type);
}
static const char *
hostlist_get_filter_name(hostlist_talker_t *host, conv_filter_type_e filter_type)
{
if ((host == NULL) || (host->dissector_info == NULL) || (host->dissector_info->get_filter_type == NULL)) {
return CONV_FILTER_INVALID;
}
return host->dissector_info->get_filter_type(host, filter_type);
}
/* Convert a port number into a string or NULL */
static char *
ct_port_to_str(port_type ptype, guint32 port)
@ -438,6 +527,24 @@ const char *get_conversation_filter(conv_item_t *conv_item, conv_direction_e dir
return str;
}
const char *get_hostlist_filter(hostlist_talker_t *host)
{
char *sport;
const char *str;
sport=ct_port_to_str(host->ptype, host->port);
str = g_strdup_printf("%s==%s%s%s%s%s",
hostlist_get_filter_name(host, CONV_FT_ANY_ADDRESS),
ep_address_to_str(&host->myaddress),
sport?" && ":"",
sport?hostlist_get_filter_name(host, CONV_FT_ANY_PORT):"",
sport?"==":"",
sport?sport:"");
return str;
}
void
add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes,
nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, port_type ptype)
@ -572,6 +679,109 @@ add_conversation_table_data_with_conv_id(
}
}
/*
* Compute the hash value for a given address/port pairs if the match
* is to be exact.
*/
static guint
host_hash(gconstpointer v)
{
const host_key_t *key = (const host_key_t *)v;
guint hash_val;
hash_val = 0;
ADD_ADDRESS_TO_HASH(hash_val, &key->myaddress);
hash_val += key->port;
return hash_val;
}
/*
* Compare two host keys for an exact match.
*/
static gint
host_match(gconstpointer v, gconstpointer w)
{
const host_key_t *v1 = (const host_key_t *)v;
const host_key_t *v2 = (const host_key_t *)w;
if (v1->port == v2->port &&
ADDRESSES_EQUAL(&v1->myaddress, &v2->myaddress)) {
return 1;
}
/*
* The addresses or the ports don't match.
*/
return 0;
}
void
add_hostlist_table_data(conv_hash_t *ch, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, hostlist_dissector_info_t *host_info, port_type port_type_val)
{
hostlist_talker_t *talker=NULL;
int talker_idx=0;
/* XXX should be optimized to allocate n extra entries at a time
instead of just one */
/* if we dont have any entries at all yet */
if(ch->conv_array==NULL){
ch->conv_array=g_array_sized_new(FALSE, FALSE, sizeof(hostlist_talker_t), 10000);
ch->hashtable = g_hash_table_new_full(host_hash,
host_match, /* key_equal_func */
g_free, /* key_destroy_func */
NULL); /* value_destroy_func */
}
else {
/* try to find it among the existing known conversations */
host_key_t existing_key;
existing_key.myaddress = *addr;
existing_key.port = port;
if (g_hash_table_lookup_extended(ch->hashtable, &existing_key, NULL, (gpointer *) &talker_idx)) {
talker = &g_array_index(ch->conv_array, hostlist_talker_t, talker_idx);
}
}
/* if we still dont know what talker this is it has to be a new one
and we have to allocate it and append it to the end of the list */
if(talker==NULL){
host_key_t *new_key;
hostlist_talker_t host;
COPY_ADDRESS(&host.myaddress, addr);
host.dissector_info = host_info;
host.ptype=port_type_val;
host.port=port;
host.rx_frames=0;
host.tx_frames=0;
host.rx_bytes=0;
host.tx_bytes=0;
host.modified = TRUE;
g_array_append_val(ch->conv_array, host);
talker_idx= ch->conv_array->len - 1;
talker=&g_array_index(ch->conv_array, hostlist_talker_t, talker_idx);
/* hl->hosts address is not a constant but address.data is */
new_key = g_new(host_key_t,1);
SET_ADDRESS(&new_key->myaddress, talker->myaddress.type, talker->myaddress.len, talker->myaddress.data);
new_key->port = port;
g_hash_table_insert(ch->hashtable, new_key, GUINT_TO_POINTER(talker_idx));
}
/* if this is a new talker we need to initialize the struct */
talker->modified = TRUE;
/* update the talker struct */
if( sender ){
talker->tx_frames+=num_frames;
talker->tx_bytes+=num_bytes;
} else {
talker->rx_frames+=num_frames;
talker->rx_bytes+=num_bytes;
}
}
/*
* Editor modelines
*

View File

@ -75,22 +75,34 @@ typedef struct _conversation_key_t {
conv_id_t conv_id;
} conv_key_t;
typedef struct {
address myaddress;
guint32 port;
} host_key_t;
struct _conversation_item_t;
typedef const char* (*conv_get_filter_type)(struct _conversation_item_t* item, conv_filter_type_e filter);
typedef const char* (*conv_get_conversation_filter_type)(struct _conversation_item_t* item, conv_direction_e direction);
typedef struct _ct_dissector_info {
conv_get_filter_type get_filter_type;
} ct_dissector_info_t;
struct _hostlist_talker_t;
typedef const char* (*host_get_filter_type)(struct _hostlist_talker_t* item, conv_filter_type_e filter_type);
typedef struct _hostlist_dissector_info {
host_get_filter_type get_filter_type;
} hostlist_dissector_info_t;
#define CONV_FILTER_INVALID "INVALID"
struct register_ct;
typedef void (*conv_gui_init_cb)(struct register_ct* ct, const char *filter);
typedef void (*host_gui_init_cb)(struct register_ct* host, const char *filter);
typedef const char* (*host_tap_prefix)(void);
/** Structure for information about a registered conversation */
typedef struct register_ct register_ct_t;
@ -116,14 +128,31 @@ typedef struct _conversation_item_t {
gboolean modified; /**< new to redraw the row (only used in GTK+) */
} conv_item_t;
/** Hostlist information */
typedef struct _hostlist_talker_t {
hostlist_dissector_info_t *dissector_info; /**< conversation information provided by dissector */
address myaddress; /**< address */
port_type ptype; /**< port_type (e.g. PT_TCP) */
guint32 port; /**< port */
guint64 rx_frames; /**< number of received packets */
guint64 tx_frames; /**< number of transmitted packets */
guint64 rx_bytes; /**< number of received bytes */
guint64 tx_bytes; /**< number of transmitted bytes */
gboolean modified; /**< new to redraw the row */
} hostlist_talker_t;
/** Register the conversation table for the multiple conversation window.
*
* @param proto_id is the protocol with conversation
* @param hide_ports hide the port columns
* @param table_name the table name to be displayed
* @param tap_name the registered tap name
* @param packet_func the function to be called for each incoming packet
* @param conv_packet_func the registered conversation tap name
* @param hostlist_func the registered hostlist tap name
* @param prefix_func the function if hostlist tap has diffent name than default ("host")
*/
extern void register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb packet_func);
extern void register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func, host_tap_prefix prefix_func);
/** Should port columns be hidden?
*
@ -146,6 +175,20 @@ WS_DLL_PUBLIC int get_conversation_proto_id(register_ct_t* ct);
*/
WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func(register_ct_t* ct);
/** Get tap function handler from hostlist
*
* @param ct Registered conversation
* @return tap function handler of conversation
*/
WS_DLL_PUBLIC tap_packet_cb get_hostlist_packet_func(register_ct_t* ct);
/** Get tap function handler from hostlist
*
* @param ct Registered conversation
* @return tap function handler of conversation
*/
WS_DLL_PUBLIC host_tap_prefix get_hostlist_prefix_func(register_ct_t* ct);
/** get conversation from protocol ID
*
* @param proto_id protocol ID
@ -161,6 +204,14 @@ WS_DLL_PUBLIC register_ct_t* get_conversation_by_proto_id(int proto_id);
*/
WS_DLL_PUBLIC void conversation_table_set_gui_info(conv_gui_init_cb init_cb);
/** Register "initialization function" used by the GUI to create hostlist
* table display in GUI
*
* @param init_cb callback function that will be called when hostlist "display"
* is instantiated in GUI
*/
WS_DLL_PUBLIC void hostlist_table_set_gui_info(host_gui_init_cb init_cb);
/** Interator to walk converation tables and execute func
* a GUI menu (only used in GTK)
*
@ -187,13 +238,26 @@ WS_DLL_PUBLIC register_ct_t* get_conversation_table_by_num(guint table_num);
*/
WS_DLL_PUBLIC void reset_conversation_table_data(conv_hash_t *ch);
/** Initialize dissector converation for stats and (possibly) GUI.
/** Remove all entries from the hostlist table.
*
* @param ch the table to reset
*/
WS_DLL_PUBLIC void reset_hostlist_table_data(conv_hash_t *ch);
/** Initialize dissector conversation for stats and (possibly) GUI.
*
* @param opt_arg filter string to compare with dissector
* @param userdata register_ct_t* for dissector conversation
*/
WS_DLL_PUBLIC void dissector_conversation_init(const char *opt_arg, void* userdata);
/** Initialize dissector hostlist for stats and (possibly) GUI.
*
* @param opt_arg filter string to compare with dissector
* @param userdata register_ct_t* for dissector conversation
*/
WS_DLL_PUBLIC void dissector_hostlist_init(const char *opt_arg, void* userdata);
/** Get the string representation of an address.
*
* @param addr The address.
@ -219,6 +283,14 @@ WS_DLL_PUBLIC const char *get_conversation_port(guint32 port, port_type ptype, g
*/
WS_DLL_PUBLIC const char *get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction);
/** Get a display filter for the given hostlist and direction.
*
* @param host The hostlist.
* @param direction The desired direction.
* @return An ep_allocated string representing the conversation.
*/
WS_DLL_PUBLIC const char *get_hostlist_filter(hostlist_talker_t *host);
/** Add some data to the conversation table.
*
* @param ch the table to add the data to
@ -255,19 +327,23 @@ extern void add_conversation_table_data(conv_hash_t *ch, const address *src, con
* @param conv_id a value to help differentiate the conversation in case the address and port quadruple is not sufficiently unique
*/
extern void
add_conversation_table_data_with_conv_id(
conv_hash_t *ch,
const address *src,
const address *dst,
guint32 src_port,
guint32 dst_port,
conv_id_t conv_id,
int num_frames,
int num_bytes,
nstime_t *ts,
nstime_t *abs_ts,
ct_dissector_info_t *ct_info,
port_type ptype);
add_conversation_table_data_with_conv_id(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port,
guint32 dst_port, conv_id_t conv_id, int num_frames, int num_bytes,
nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, port_type ptype);
/** Add some data to the table.
*
* @param hl the table to add the data to
* @param addr address
* @param port port
* @param sender TRUE, if this is a sender
* @param num_frames number of packets
* @param num_bytes number of bytes
* @param sat address type
* @param port_type the port type (e.g. PT_TCP)
*/
void add_hostlist_table_data(conv_hash_t *ch, const address *addr,
guint32 port, gboolean sender, int num_frames, int num_bytes, hostlist_dissector_info_t *host_info, port_type port_type_val);
#ifdef __cplusplus
}

View File

@ -135,6 +135,34 @@ eth_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* eth_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_ETHER))
return "eth.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t eth_host_dissector_info = {&eth_host_get_filter_type};
static int
eth_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const eth_hdr *ehdr=(const eth_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &ehdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, &eth_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &ehdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &eth_host_dissector_info, PT_NONE);
return 1;
}
/* These are the Netware-ish names for the different Ethernet frame types.
EthernetII: The ethernet with a Type field instead of a length field
Ethernet802.2: An 802.3 header followed by an 802.2 header
@ -971,7 +999,7 @@ proto_register_eth(void)
register_dissector("eth", dissect_eth_maybefcs, proto_eth);
eth_tap = register_tap("eth");
register_conversation_table(proto_eth, TRUE, eth_conversation_packet);
register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet, NULL);
}
void

View File

@ -233,6 +233,31 @@ fc_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, c
return 1;
}
static const char* fc_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_FC))
return "fc.id";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t fc_host_dissector_info = {&fc_host_get_filter_type};
static int
fc_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const fc_hdr *fchdr=(const fc_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &fchdr->s_id, 0, TRUE, 1, pinfo->fd->pkt_len, &fc_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &fchdr->d_id, 0, FALSE, 1, pinfo->fd->pkt_len, &fc_host_dissector_info, PT_NONE);
return 1;
}
const value_string fc_fc4_val[] = {
{FC_TYPE_BLS, "Basic Link Svc"},
{FC_TYPE_ELS, "Ext Link Svc"},
@ -1607,7 +1632,7 @@ proto_register_fc(void)
fcsof_handle = register_dissector("fcsof", dissect_fcsof, proto_fcsof);
register_conversation_table(proto_fc, TRUE, fc_conversation_packet);
register_conversation_table(proto_fc, TRUE, fc_conversation_packet, fc_hostlist_packet, NULL);
}

View File

@ -170,6 +170,31 @@ fddi_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* fddi_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_ETHER))
return "fddi.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t fddi_host_dissector_info = {&fddi_host_get_filter_type};
static int
fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const fddi_hdr *ehdr=(const fddi_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &ehdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, &fddi_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &ehdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &fddi_host_dissector_info, PT_NONE);
return 1;
}
void
capture_fddi(const guchar *pd, int len, packet_counts *ld)
{
@ -505,7 +530,7 @@ proto_register_fddi(void)
&fddi_padding);
fddi_tap = register_tap("fddi");
register_conversation_table(proto_fddi, TRUE, fddi_conversation_packet);
register_conversation_table(proto_fddi, TRUE, fddi_conversation_packet, fddi_hostlist_packet, NULL);
}
void

View File

@ -5266,6 +5266,30 @@ wlan_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* wlan_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_ETHER))
return "wlan.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t wlan_host_dissector_info = {&wlan_host_get_filter_type};
static int
wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const wlan_hdr *whdr=(const wlan_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &whdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, &wlan_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &whdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &wlan_host_dissector_info, PT_NONE);
return 1;
}
static void
beacon_interval_base_custom(gchar *result, guint32 beacon_interval)
{
@ -26211,7 +26235,7 @@ proto_register_ieee80211 (void)
register_init_routine(ieee80211_gas_reassembly_init);
wlan_tap = register_tap("wlan");
register_conversation_table(proto_wlan, TRUE, wlan_conversation_packet);
register_conversation_table(proto_wlan, TRUE, wlan_conversation_packet, wlan_hostlist_packet, NULL);
/* Register configuration options */
wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);

View File

@ -501,6 +501,30 @@ ip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, c
return 1;
}
static const char* ip_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_IPv4))
return "ip.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t ip_host_dissector_info = {&ip_host_get_filter_type};
static int
ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const ws_ip *iph=(const ws_ip *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &iph->ip_src, 0, TRUE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &iph->ip_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ip_host_dissector_info, PT_NONE);
return 1;
}
/*
* defragmentation of IPv4
*/
@ -3067,7 +3091,7 @@ proto_register_ip(void)
ip_tap = register_tap("ip");
register_decode_as(&ip_da);
register_conversation_table(proto_ip, TRUE, ip_conversation_packet);
register_conversation_table(proto_ip, TRUE, ip_conversation_packet, ip_hostlist_packet, NULL);
}
void

View File

@ -383,6 +383,34 @@ ipv6_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* ipv6_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_IPv6))
return "ipv6.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t ipv6_host_dissector_info = {&ipv6_host_get_filter_type};
static int
ipv6_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const struct ip6_hdr *ip6h = (const struct ip6_hdr *)vip;
address src;
address dst;
/* Addresses aren't implemented as 'address' type in struct ip6_hdr */
SET_ADDRESS(&src, AT_IPv6, sizeof(struct e_in6_addr), &ip6h->ip6_src);
SET_ADDRESS(&dst, AT_IPv6, sizeof(struct e_in6_addr), &ip6h->ip6_dst);
add_hostlist_table_data(hash, &src, 0, TRUE, 1, pinfo->fd->pkt_len, &ipv6_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ipv6_host_dissector_info, PT_NONE);
return 1;
}
static const fragment_items ipv6_frag_items = {
&ett_ipv6_fragment,
&ett_ipv6_fragments,
@ -2944,7 +2972,7 @@ proto_register_ipv6(void)
register_decode_as(&ipv6_da);
register_decode_as(&ipv6_next_header_da);
register_conversation_table(proto_ipv6, TRUE, ipv6_conversation_packet);
register_conversation_table(proto_ipv6, TRUE, ipv6_conversation_packet, ipv6_hostlist_packet, NULL);
}
void

View File

@ -174,6 +174,31 @@ ipx_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* ipx_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_IPX))
return "ipx.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t ipx_host_dissector_info = {&ipx_host_get_filter_type};
static int
ipx_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const ipxhdr_t *ipxh=(const ipxhdr_t *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &ipxh->ipx_src, 0, TRUE, 1, pinfo->fd->pkt_len, &ipx_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &ipxh->ipx_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ipx_host_dissector_info, PT_NONE);
return 1;
}
/* ================================================================= */
/* IPX */
/* ================================================================= */
@ -1568,7 +1593,7 @@ proto_register_ipx(void)
register_postseq_cleanup_routine(&spx_postseq_cleanup);
ipx_tap=register_tap("ipx");
register_conversation_table(proto_ipx, TRUE, ipx_conversation_packet);
register_conversation_table(proto_ipx, TRUE, ipx_conversation_packet, ipx_hostlist_packet, NULL);
}
void

View File

@ -223,6 +223,30 @@ jxta_conversation_packet(void *pct, packet_info *pinfo _U_, epan_dissect_t *edt
return 1;
}
static const char* jxta_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_URI))
return "jxta.message.address";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t jxta_host_dissector_info = {&jxta_host_get_filter_type};
static int
jxta_hostlist_packet(void *pit, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const jxta_tap_header *jxtahdr = (const jxta_tap_header *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, &jxta_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, &jxta_host_dissector_info, PT_NONE);
return 1;
}
/**
* Prototypes
**/
@ -2352,7 +2376,7 @@ void proto_register_jxta(void)
prefs_register_bool_preference(jxta_module, "sctp.heuristic", "Try to discover JXTA in SCTP connections",
"Enable to inspect SCTP connections for JXTA conversations.", &gSCTP_HEUR);
register_conversation_table(proto_jxta, TRUE, jxta_conversation_packet);
register_conversation_table(proto_jxta, TRUE, jxta_conversation_packet, jxta_hostlist_packet, NULL);
}

View File

@ -321,6 +321,28 @@ ncp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* ncp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
{
return ncp_conv_get_filter_type(NULL, filter);
}
static hostlist_dissector_info_t ncp_host_dissector_info = {&ncp_host_get_filter_type};
static int
ncp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
{
conv_hash_t *hash = (conv_hash_t*) pit;
/*const ncp_common_header *ncphdr=vip;*/
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, &ncp_host_dissector_info, PT_NCP);
add_hostlist_table_data(hash, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &ncp_host_dissector_info, PT_NCP);
return 1;
}
/*
* Burst packet system flags.
*/
@ -1127,7 +1149,7 @@ proto_register_ncp(void)
ncp_tap.hdr=register_tap("ncp");
register_postseq_cleanup_routine(&mncp_postseq_cleanup);
register_conversation_table(proto_ncp, FALSE, ncp_conversation_packet);
register_conversation_table(proto_ncp, FALSE, ncp_conversation_packet, ncp_hostlist_packet, NULL);
}
void

View File

@ -1892,6 +1892,29 @@ rsvp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* rsvp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
{
return rsvp_conv_get_filter_type(NULL, filter);
}
static hostlist_dissector_info_t rsvp_host_dissector_info = {&rsvp_host_get_filter_type};
static int
rsvp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const rsvp_conversation_info *rsvph = (const rsvp_conversation_info *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures
* that all packets are counted properly (even if address is sending to
* itself). XXX - this could probably be done more efficiently inside
* hostlist_table
*/
add_hostlist_table_data(hash, &rsvph->source, 0, TRUE, 1, pinfo->fd->pkt_len, &rsvp_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &rsvph->destination, 0, FALSE, 1, pinfo->fd->pkt_len, &rsvp_host_dissector_info, PT_NONE);
return 1;
}
static inline int
rsvp_class_to_filter_num(int classnum)
{
@ -9177,7 +9200,7 @@ proto_register_rsvp(void)
/* Initialization routine for RSVP conversations */
register_init_routine(&rsvp_init_protocol);
register_conversation_table(proto_rsvp, TRUE, rsvp_conversation_packet);
register_conversation_table(proto_rsvp, TRUE, rsvp_conversation_packet, rsvp_hostlist_packet, NULL);
}
void

View File

@ -825,6 +825,28 @@ sctp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* sctp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
{
return sctp_conv_get_filter_type(NULL, filter);
}
static hostlist_dissector_info_t sctp_host_dissector_info = {&sctp_host_get_filter_type};
static int
sctp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const struct _sctp_info *sctphdr=(const struct _sctp_info *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &sctphdr->ip_src, sctphdr->sport, TRUE, 1, pinfo->fd->pkt_len, &sctp_host_dissector_info, PT_SCTP);
add_hostlist_table_data(hash, &sctphdr->ip_dst, sctphdr->dport, FALSE, 1, pinfo->fd->pkt_len, &sctp_host_dissector_info, PT_SCTP);
return 1;
}
static unsigned int
sctp_adler32(tvbuff_t *tvb, unsigned int len)
{
@ -4887,7 +4909,7 @@ proto_register_sctp(void)
register_decode_as(&sctp_da_port);
register_decode_as(&sctp_da_ppi);
register_conversation_table(proto_sctp, FALSE, sctp_conversation_packet);
register_conversation_table(proto_sctp, FALSE, sctp_conversation_packet, sctp_hostlist_packet, NULL);
}
void

View File

@ -574,6 +574,34 @@ tcpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_
return 1;
}
static const char* tcp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
{
return tcp_conv_get_filter_type(NULL, filter);
}
static hostlist_dissector_info_t tcp_host_dissector_info = {&tcp_host_get_filter_type};
static int
tcpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const struct tcpheader *tcphdr=(const struct tcpheader *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &tcphdr->ip_src, tcphdr->th_sport, TRUE, 1, pinfo->fd->pkt_len, &tcp_host_dissector_info, PT_TCP);
add_hostlist_table_data(hash, &tcphdr->ip_dst, tcphdr->th_dport, FALSE, 1, pinfo->fd->pkt_len, &tcp_host_dissector_info, PT_TCP);
return 1;
}
static const char*
tcpip_hostlist_prefix(void)
{
return "endpoints";
}
/* TCP structs and definitions */
/* **************************************************************************
@ -5874,7 +5902,7 @@ proto_register_tcp(void)
register_decode_as(&tcp_da);
register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet);
register_conversation_table(proto_tcp, FALSE, tcpip_conversation_packet, tcpip_hostlist_packet, tcpip_hostlist_prefix);
}
void

View File

@ -147,7 +147,7 @@ static ct_dissector_info_t tr_ct_dissector_info = {&tr_conv_get_filter_type};
static int
tr_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pct;
conv_hash_t *hash = (conv_hash_t*) pct;
const tr_hdr *trhdr=(const tr_hdr *)vip;
add_conversation_table_data(hash, &trhdr->src, &trhdr->dst, 0, 0, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->fd->abs_ts, &tr_ct_dissector_info, PT_NONE);
@ -155,6 +155,31 @@ tr_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, c
return 1;
}
static const char* tr_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_ETHER))
return "tr.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t tr_host_dissector_info = {&tr_host_get_filter_type};
static int
tr_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const tr_hdr *trhdr=(const tr_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &trhdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, &tr_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &trhdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &tr_host_dissector_info, PT_NONE);
return 1;
}
/*
* DODGY LINUX HACK DODGY LINUX HACK
* Linux 2.0.x always passes frames to the Token Ring driver for transmission with
@ -763,7 +788,7 @@ proto_register_tr(void)
register_dissector("tr", dissect_tr, proto_tr);
tr_tap=register_tap("tr");
register_conversation_table(proto_tr, TRUE, tr_conversation_packet);
register_conversation_table(proto_tr, TRUE, tr_conversation_packet, tr_hostlist_packet, NULL);
}
void

View File

@ -321,12 +321,40 @@ static ct_dissector_info_t udp_ct_dissector_info = {&udp_conv_get_filter_type};
static int
udpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pct;
const e_udphdr *udphdr=(const e_udphdr *)vip;
conv_hash_t *hash = (conv_hash_t*) pct;
const e_udphdr *udphdr=(const e_udphdr *)vip;
add_conversation_table_data(hash, &udphdr->ip_src, &udphdr->ip_dst, udphdr->uh_sport, udphdr->uh_dport, 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->fd->abs_ts, &udp_ct_dissector_info, PT_UDP);
return 1;
return 1;
}
static const char* udp_host_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
{
return udp_conv_get_filter_type(NULL, filter);
}
static hostlist_dissector_info_t udp_host_dissector_info = {&udp_host_get_filter_type};
static int
udpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
conv_hash_t *hash = (conv_hash_t*) pit;
const e_udphdr *udphdr=(const e_udphdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &udphdr->ip_src, udphdr->uh_sport, TRUE, 1, pinfo->fd->pkt_len, &udp_host_dissector_info, PT_UDP);
add_hostlist_table_data(hash, &udphdr->ip_dst, udphdr->uh_dport, FALSE, 1, pinfo->fd->pkt_len, &udp_host_dissector_info, PT_UDP);
return 1;
}
static const char*
udpip_hostlist_prefix(void)
{
return "endpoints";
}
/* Attach process info to a flow */
@ -936,7 +964,7 @@ proto_register_udp(void)
&udplite_check_checksum);
register_decode_as(&udp_da);
register_conversation_table(proto_udp, FALSE, udpip_conversation_packet);
register_conversation_table(proto_udp, FALSE, udpip_conversation_packet, udpip_hostlist_packet, udpip_hostlist_prefix);
register_init_routine(udp_init);

View File

@ -1135,6 +1135,30 @@ usb_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
return 1;
}
static const char* usb_host_get_filter_type(hostlist_talker_t* host, conv_filter_type_e filter)
{
if ((filter == CONV_FT_ANY_ADDRESS) && (host->myaddress.type == AT_USB))
return "usb.addr";
return CONV_FILTER_INVALID;
}
static hostlist_dissector_info_t usb_host_dissector_info = {&usb_host_get_filter_type};
static int
usb_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
{
conv_hash_t *hash = (conv_hash_t*) pit;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hash, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, &usb_host_dissector_info, PT_NONE);
add_hostlist_table_data(hash, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, &usb_host_dissector_info, PT_NONE);
return 1;
}
/* SETUP dissectors */
@ -4189,7 +4213,7 @@ proto_register_usb(void)
register_decode_as(&usb_product_da);
register_decode_as(&usb_device_da);
register_conversation_table(proto_usb, TRUE, usb_conversation_packet);
register_conversation_table(proto_usb, TRUE, usb_conversation_packet, usb_hostlist_packet, NULL);
}
void

View File

@ -972,7 +972,6 @@ main(int argc, char *argv[])
register_all_plugin_tap_listeners();
#endif
register_all_tap_listeners();
conversation_table_set_gui_info(NULL); * XXX - TODO: Provide GUI function for tfshark *
*/
/* If invoked with the "-G" flag, we dump out information based on

View File

@ -1201,6 +1201,7 @@ main(int argc, char *argv[])
#endif
register_all_tap_listeners();
conversation_table_set_gui_info(init_iousers);
hostlist_table_set_gui_info(NULL); /* XXX - TODO: Provide "GUI" function for TShark */
/* If invoked with the "-G" flag, we dump out information based on
the argument to the "-G" flag; if no argument is specified,

View File

@ -49,7 +49,7 @@ typedef enum {
CONV_COLUMN_BPS_BA,
CONV_NUM_COLUMNS,
CONV_INDEX_COLUMN = CONV_NUM_COLUMNS
} column_type_e;
} conversation_column_type_e;
extern const char *column_titles[CONV_NUM_COLUMNS];

View File

@ -142,21 +142,6 @@ set(WIRESHARK_TAP_SRC
gtp_stat.c
h225_counter.c
h225_ras_srt.c
hostlist_eth.c
hostlist_fc.c
hostlist_fddi.c
hostlist_ip.c
hostlist_ipv6.c
hostlist_ipx.c
hostlist_jxta.c
hostlist_ncp.c
hostlist_rsvp.c
hostlist_sctp.c
hostlist_tcpip.c
hostlist_tr.c
hostlist_udpip.c
hostlist_usb.c
hostlist_wlan.c
iax2_analysis.c
io_stat.c
lbm_stream_dlg.c

View File

@ -167,21 +167,6 @@ WIRESHARK_TAP_SRC = \
gtp_stat.c \
h225_counter.c \
h225_ras_srt.c \
hostlist_eth.c \
hostlist_fc.c \
hostlist_fddi.c \
hostlist_ip.c \
hostlist_ipv6.c \
hostlist_ipx.c \
hostlist_jxta.c \
hostlist_ncp.c \
hostlist_rsvp.c \
hostlist_sctp.c \
hostlist_tcpip.c \
hostlist_tr.c \
hostlist_udpip.c \
hostlist_usb.c \
hostlist_wlan.c \
iax2_analysis.c \
io_stat.c \
lbm_stream_dlg.c \

View File

@ -55,8 +55,8 @@ typedef struct _conversations_table {
/** Init the conversation table for the single conversation window.
*
* @param ct the registered conversation
* @param filter the optional filter name or NULL
* @param packet_func the function to be called for each incoming packet
*/
extern void init_conversation_table(struct register_ct* ct, const char *filter);

View File

@ -1,85 +0,0 @@
/* hostlist_eth.c 2004 Ian Schorr
* modified from endpoint_talkers_eth.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-eth.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_eth_hostlist(void);
static int
eth_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const eth_hdr *ehdr=(const eth_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &ehdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_ETHERNET, PT_NONE);
add_hostlist_table_data(hosts, &ehdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_ETHERNET, PT_NONE);
return 1;
}
static void
gtk_eth_hostlist_init(const char *opt_arg,
void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,eth,",10)){
filter=opt_arg+10;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "Ethernet", "eth", filter, eth_hostlist_packet);
}
void
gtk_eth_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_eth_hostlist_init("hosts,eth",NULL);
}
void
register_tap_listener_eth_hostlist(void)
{
register_stat_cmd_arg("hosts,eth", gtk_eth_hostlist_init,NULL);
register_hostlist_table(TRUE, "Ethernet", "eth", NULL /*filter*/, eth_hostlist_packet);
}

View File

@ -1,85 +0,0 @@
/* hostlist_fc.c 2004 Ian Schorr
* modified from endpoint_talkers_fc.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/conversation.h>
#include <epan/dissectors/packet-fc.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_fc_hostlist(void);
static int
fc_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const fc_hdr *fchdr=(const fc_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &fchdr->s_id, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_FIBRE_CHANNEL, PT_NONE);
add_hostlist_table_data(hosts, &fchdr->d_id, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_FIBRE_CHANNEL, PT_NONE);
return 1;
}
static void
gtk_fc_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,fc,",9)){
filter=opt_arg+9;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "Fibre Channel", "fc", filter, fc_hostlist_packet);
}
void
gtk_fc_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_fc_hostlist_init("hosts,fc",NULL);
}
void
register_tap_listener_fc_hostlist(void)
{
register_stat_cmd_arg("hosts,fc", gtk_fc_hostlist_init,NULL);
register_hostlist_table(TRUE, "Fibre Channel", "fc", NULL /*filter*/, fc_hostlist_packet);
}

View File

@ -1,84 +0,0 @@
/* hostlist_fddi.c 2004 Ian Schorr
* modified from endpoint_talkers_fddi.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-fddi.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_fddi_hostlist(void);
static int
fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const fddi_hdr *ehdr=(const fddi_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &ehdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_FDDI, PT_NONE);
add_hostlist_table_data(hosts, &ehdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_FDDI, PT_NONE);
return 1;
}
static void
gtk_fddi_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,fddi,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "FDDI", "fddi", filter, fddi_hostlist_packet);
}
void
gtk_fddi_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_fddi_hostlist_init("hosts,fddi",NULL);
}
void
register_tap_listener_fddi_hostlist(void)
{
register_stat_cmd_arg("hosts,fddi", gtk_fddi_hostlist_init,NULL);
register_hostlist_table(TRUE, "FDDI", "fddi", NULL /*filter*/, fddi_hostlist_packet);
}

View File

@ -1,83 +0,0 @@
/* hostlist_ip.c 2004 Ian Schorr
* modified from endpoint_talkers_ip.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-ip.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_ip_hostlist(void);
static int
ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const ws_ip *iph=(const ws_ip *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &iph->ip_src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPV4, PT_NONE);
add_hostlist_table_data(hosts, &iph->ip_dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPV4, PT_NONE);
return 1;
}
static void
gtk_ip_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,ip,",9)){
filter=opt_arg+9;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "IPv4", "ip", filter, ip_hostlist_packet);
}
void
gtk_ip_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_ip_hostlist_init("hosts,ip",NULL);
}
void
register_tap_listener_ip_hostlist(void)
{
register_stat_cmd_arg("hosts,ip", gtk_ip_hostlist_init,NULL);
register_hostlist_table(TRUE, "IPv4", "ip", NULL /*filter*/, ip_hostlist_packet);
}

View File

@ -1,88 +0,0 @@
/* hostlist_ipv6.c 2009 Clif Bratcher
* Modified from hostlist_ip.c 2004 Ian Schorr
* modified from endpoint_talkers_ip.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-ipv6.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_ipv6_hostlist(void);
static int
ipv6_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts = (hostlist_table *)pit;
const struct ip6_hdr *ip6h = (const struct ip6_hdr *)vip;
address src;
address dst;
/* Addresses aren't implemented as 'address' type in struct ip6_hdr */
SET_ADDRESS(&src, AT_IPv6, sizeof(struct e_in6_addr), &ip6h->ip6_src);
SET_ADDRESS(&dst, AT_IPv6, sizeof(struct e_in6_addr), &ip6h->ip6_dst);
add_hostlist_table_data(hosts, &src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPV6, PT_NONE);
add_hostlist_table_data(hosts, &dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPV6, PT_NONE);
return 1;
}
static void
gtk_ipv6_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,ipv6,",10)){
filter = opt_arg + 10;
} else {
filter = NULL;
}
init_hostlist_table(TRUE, "IPv6", "ipv6", filter, ipv6_hostlist_packet);
}
void
gtk_ipv6_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_ipv6_hostlist_init("hosts,ipv6", NULL);
}
void
register_tap_listener_ipv6_hostlist(void)
{
register_stat_cmd_arg("hosts,ipv6", gtk_ipv6_hostlist_init, NULL);
register_hostlist_table(TRUE, "IPv6", "ipv6", NULL /*filter*/, ipv6_hostlist_packet);
}

View File

@ -1,84 +0,0 @@
/* hostlist_ipx.c 2004 Ian Schorr
* modified from endpoint_talkers_ipx.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-ipx.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_ipx_hostlist(void);
static int
ipx_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const ipxhdr_t *ipxh=(const ipxhdr_t *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &ipxh->ipx_src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPX, PT_NONE);
add_hostlist_table_data(hosts, &ipxh->ipx_dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_IPX, PT_NONE);
return 1;
}
static void
gtk_ipx_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,ipx,",10)){
filter=opt_arg+10;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "IPX", "ipx", filter, ipx_hostlist_packet);
}
void
gtk_ipx_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_ipx_hostlist_init("hosts,ipx",NULL);
}
void
register_tap_listener_ipx_hostlist(void)
{
register_stat_cmd_arg("hosts,ipx", gtk_ipx_hostlist_init,NULL);
register_hostlist_table(TRUE, "IPX", "ipx", NULL /*filter*/, ipx_hostlist_packet);
}

View File

@ -1,81 +0,0 @@
/* hostlist_jxta.c 2005 Mike Duigou
* modified from hostlist_eth.c 2004 Ian Schorr
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-jxta.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_jxta_hostlist(void);
static int
jxta_hostlist_packet(void *pit, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts = (hostlist_table *) pit;
const jxta_tap_header *jxtahdr = (const jxta_tap_header *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, CONV_TYPE_JXTA, PT_NONE);
add_hostlist_table_data(hosts, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, CONV_TYPE_JXTA, PT_NONE);
return 1;
}
static void
gtk_jxta_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,jxta,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "JXTA", "jxta", filter, jxta_hostlist_packet);
}
void
gtk_jxta_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_jxta_hostlist_init("hosts,jxta",NULL);
}
void
register_tap_listener_jxta_hostlist(void)
{
register_stat_cmd_arg("hosts,jxta", gtk_jxta_hostlist_init,NULL);
register_hostlist_table(TRUE, "JXTA", "jxta", NULL /*filter*/, jxta_hostlist_packet);
}

View File

@ -1,82 +0,0 @@
/* hostlist_ncp.c 2006 Greg Morris
* modified from endpoint_talkers_eth.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
/*#include <epan/dissectors/packet-ncp-int.h>*/
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_ncp_hostlist(void);
static int
ncp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
{
hostlist_table *hosts=(hostlist_table *)pit;
/*const ncp_common_header *ncphdr=vip;*/
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_ETHERNET, PT_NCP);
add_hostlist_table_data(hosts, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_ETHERNET, PT_NCP);
return 1;
}
static void
gtk_ncp_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,ncp,",10)){
filter=opt_arg+10;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "NCP", "ncp", filter, ncp_hostlist_packet);
}
void
gtk_ncp_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_ncp_hostlist_init("hosts,ncp",NULL);
}
void
register_tap_listener_ncp_hostlist(void)
{
register_stat_cmd_arg("hosts,ncp", gtk_ncp_hostlist_init,NULL);
register_hostlist_table(TRUE, "NCP", "ncp", NULL /*filter*/, ncp_hostlist_packet);
}

View File

@ -1,88 +0,0 @@
/* hostlist_rsvp.c
* hostlist_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-rsvp.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_rsvp_hostlist(void);
static int
rsvp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const rsvp_conversation_info *rsvph = (const rsvp_conversation_info *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures
* that all packets are counted properly (even if address is sending to
* itself). XXX - this could probably be done more efficiently inside
* hostlist_table
*/
add_hostlist_table_data(hosts, &rsvph->source, 0, TRUE, 1,
pinfo->fd->pkt_len, CONV_TYPE_RSVP, PT_NONE);
add_hostlist_table_data(hosts, &rsvph->destination, 0, FALSE, 1,
pinfo->fd->pkt_len, CONV_TYPE_RSVP, PT_NONE);
return 1;
}
static void
gtk_rsvp_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,rsvp,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "RSVP", "rsvp", filter,
rsvp_hostlist_packet);
}
void
gtk_rsvp_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_rsvp_hostlist_init("hosts,rsvp",NULL);
}
void
register_tap_listener_rsvp_hostlist(void)
{
register_stat_cmd_arg("hosts,rsvp", gtk_rsvp_hostlist_init,NULL);
register_hostlist_table(TRUE, "RSVP", "rsvp", NULL /*filter*/,
rsvp_hostlist_packet);
}

View File

@ -1,82 +0,0 @@
/* hostlist_sctp.c 2008 Stig Bjorlykke
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-sctp.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_sctp_hostlist(void);
static int
sctp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const struct _sctp_info *sctphdr=(const struct _sctp_info *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &sctphdr->ip_src, sctphdr->sport, TRUE, 1,
pinfo->fd->pkt_len, CONV_TYPE_SCTP, PT_SCTP);
add_hostlist_table_data(hosts, &sctphdr->ip_dst, sctphdr->dport, FALSE, 1,
pinfo->fd->pkt_len, CONV_TYPE_SCTP, PT_SCTP);
return 1;
}
static void
gtk_sctp_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,sctp,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(FALSE, "SCTP", "sctp", filter, sctp_hostlist_packet);
}
void
gtk_sctp_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_sctp_hostlist_init("hosts,sctp",NULL);
}
void
register_tap_listener_sctp_hostlist(void)
{
register_stat_cmd_arg("hosts,sctp", gtk_sctp_hostlist_init,NULL);
register_hostlist_table(FALSE, "SCTP", "sctp", NULL /*filter*/, sctp_hostlist_packet);
}

File diff suppressed because it is too large Load Diff

View File

@ -24,51 +24,42 @@
#ifndef __HOSTLIST_TABLE_H__
#define __HOSTLIST_TABLE_H__
#include <ui/conversation_ui.h>
#include <epan/conversation_table.h>
/** @file
* Hostlist definitions.
*/
/** Conversation types */
/* Sort alphabetically by title */
typedef enum {
CONV_TYPE_ETHERNET,
CONV_TYPE_FIBRE_CHANNEL,
CONV_TYPE_FDDI,
CONV_TYPE_IPV4,
CONV_TYPE_IPV6,
CONV_TYPE_IPX,
CONV_TYPE_JXTA,
CONV_TYPE_NCP,
CONV_TYPE_RSVP,
CONV_TYPE_SCTP,
CONV_TYPE_TCP,
CONV_TYPE_TOKEN_RING,
CONV_TYPE_UDP,
CONV_TYPE_USB,
CONV_TYPE_WLAN,
N_CONV_TYPES
} conversation_type_e;
typedef enum
{
HOST_ADR_COLUMN,
HOST_PORT_COLUMN,
HOST_PACKETS_COLUMN,
HOST_BYTES_COLUMN,
HOST_PKT_AB_COLUMN,
HOST_BYTES_AB_COLUMN,
HOST_PKT_BA_COLUMN,
HOST_BYTES_BA_COLUMN,
#ifdef HAVE_GEOIP
HOST_GEOIP1_COLUMN,
HOST_GEOIP2_COLUMN,
HOST_GEOIP3_COLUMN,
HOST_GEOIP4_COLUMN,
HOST_GEOIP5_COLUMN,
HOST_GEOIP6_COLUMN,
HOST_GEOIP7_COLUMN,
HOST_GEOIP8_COLUMN,
HOST_GEOIP9_COLUMN,
HOST_GEOIP10_COLUMN,
HOST_GEOIP11_COLUMN,
HOST_GEOIP12_COLUMN,
HOST_GEOIP13_COLUMN,
#endif
HOST_NUM_COLUMNS,
HOST_INDEX_COLUMN = HOST_NUM_COLUMNS
} hostlist_column_type_e;
/** Hostlist information */
typedef struct _hostlist_talker_t {
address myaddress; /**< address */
conversation_type_e sat; /**< address type */
guint32 port_type; /**< port_type (e.g. PT_TCP) */
guint32 port; /**< port */
guint64 rx_frames; /**< number of received packets */
guint64 tx_frames; /**< number of transmitted packets */
guint64 rx_bytes; /**< number of received bytes */
guint64 tx_bytes; /**< number of transmitted bytes */
gboolean modified; /**< new to redraw the row */
GtkTreeIter iter;
gboolean iter_valid; /**< not a new row */
} hostlist_talker_t;
#define NUM_BUILTIN_COLS 8
#ifdef HAVE_GEOIP
@ -91,33 +82,18 @@ typedef struct _hostlist_table {
const char *default_titles[NUM_HOSTLIST_COLS]; /**< Column headers */
GtkWidget *menu; /**< context menu */
gboolean has_ports; /**< table has ports */
guint32 num_hosts; /**< number of hosts (0 or 1) */
GArray *hosts; /**< array of host values */
GHashTable *hashtable; /**< conversations hash table */
gboolean fixed_col; /**< if switched to fixed column */
conv_hash_t hash; /**< hostlist hash table */
gboolean fixed_col; /**< if switched to fixed column */
gboolean resolve_names; /**< resolve address names? */
gboolean geoip_visible; /**< if geoip columns are visible */
} hostlist_table;
/** Register the hostlist table for the multiple hostlist window.
*
* @param hide_ports hide the port columns
* @param table_name the table name to be displayed
* @param tap_name the registered tap name
* @param filter the optional filter name or NULL
* @param packet_func the function to be called for each incoming packet
*/
extern void register_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
/** Init the hostlist table for the single hostlist window.
*
* @param hide_ports hide the port columns
* @param table_name the table name to be displayed
* @param tap_name the registered tap name
* @param ct the registered hostlist (conversation)
* @param filter the optional filter name or NULL
* @param packet_func the function to be called for each incoming packet
*/
extern void init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
extern void init_hostlist_table(struct register_ct* ct, const char *filter);
/** Callback for "Endpoints" statistics item.
*
@ -126,18 +102,10 @@ extern void init_hostlist_table(gboolean hide_ports, const char *table_name, con
*/
extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d);
/** Add some data to the table.
/** Function called to instantiate the "GTK hostlist display"
*
* @param hl the table to add the data to
* @param addr address
* @param port port
* @param sender TRUE, if this is a sender
* @param num_frames number of packets
* @param num_bytes number of bytes
* @param sat address type
* @param port_type the port type (e.g. PT_TCP)
* @param table conversation table to be created
*/
void add_hostlist_table_data(hostlist_table *hl, const address *addr,
guint32 port, gboolean sender, int num_frames, int num_bytes, conversation_type_e sat, int port_type);
extern void hostlist_endpoint_cb(register_ct_t* table);
#endif /* __HOSTLIST_TABLE_H__ */

View File

@ -1,84 +0,0 @@
/* hostlist_tcpip.c 2004 Ian Schorr
* modified from endpoint_talkers_tcpip.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_tcpip_hostlist(void);
static int
tcpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const struct tcpheader *tcphdr=(const struct tcpheader *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &tcphdr->ip_src, tcphdr->th_sport, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_TCP, PT_TCP);
add_hostlist_table_data(hosts, &tcphdr->ip_dst, tcphdr->th_dport, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_TCP, PT_TCP);
return 1;
}
static void
gtk_tcpip_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"endpoints,tcp,",14)){
filter=opt_arg+14;
} else {
filter=NULL;
}
init_hostlist_table(FALSE, "TCP", "tcp", filter, tcpip_hostlist_packet);
}
void
gtk_tcpip_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_tcpip_hostlist_init("endpoints,tcp",NULL);
}
void
register_tap_listener_tcpip_hostlist(void)
{
register_stat_cmd_arg("endpoints,tcp", gtk_tcpip_hostlist_init,NULL);
register_hostlist_table(FALSE, "TCP", "tcp", NULL /*filter*/, tcpip_hostlist_packet);
}

View File

@ -1,84 +0,0 @@
/* hostlist_tr.c 2004 Ian Schorr
* modified from endpoint_talkers_tr.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-tr.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_tr_hostlist(void);
static int
tr_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const tr_hdr *trhdr=(const tr_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &trhdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_TOKEN_RING, PT_NONE);
add_hostlist_table_data(hosts, &trhdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_TOKEN_RING, PT_NONE);
return 1;
}
static void
gtk_tr_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,tr,",9)){
filter=opt_arg+9;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "Token Ring", "tr", filter, tr_hostlist_packet);
}
void
gtk_tr_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_tr_hostlist_init("hosts,tr",NULL);
}
void
register_tap_listener_tr_hostlist(void)
{
register_stat_cmd_arg("hosts,tr", gtk_tr_hostlist_init,NULL);
register_hostlist_table(TRUE, "Token Ring", "tr", NULL /*filter*/, tr_hostlist_packet);
}

View File

@ -1,84 +0,0 @@
/* hostlist_udpip.c 2004 Ian Schorr
* modified from endpoint_talkers_udpip.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-udp.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_udpip_hostlist(void);
static int
udpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const e_udphdr *udphdr=(const e_udphdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &udphdr->ip_src, udphdr->uh_sport, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_UDP, PT_UDP);
add_hostlist_table_data(hosts, &udphdr->ip_dst, udphdr->uh_dport, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_UDP, PT_UDP);
return 1;
}
static void
gtk_udpip_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"endpoints,udp,",14)){
filter=opt_arg+14;
} else {
filter=NULL;
}
init_hostlist_table(FALSE, "UDP", "udp", filter, udpip_hostlist_packet);
}
void
gtk_udpip_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_udpip_hostlist_init("endpoints,udp",NULL);
}
void
register_tap_listener_udpip_hostlist(void)
{
register_stat_cmd_arg("endpoints,udp", gtk_udpip_hostlist_init,NULL);
register_hostlist_table(FALSE, "UDP", "udp", NULL /*filter*/, udpip_hostlist_packet);
}

View File

@ -1,81 +0,0 @@
/* hostlist_usb.c 2007 Jon Smirl
* modified from endpoint_talkers_eth.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-usb.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_usb_hostlist(void);
static int
usb_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip _U_)
{
hostlist_table *hosts=(hostlist_table *)pit;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_USB, PT_NONE);
add_hostlist_table_data(hosts, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_USB, PT_NONE);
return 1;
}
static void
gtk_usb_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if (!strncmp(opt_arg, "hosts,usb," ,10)) {
filter = opt_arg + 10;
} else {
filter = NULL;
}
init_hostlist_table(TRUE, "USB", "usb", filter, usb_hostlist_packet);
}
void
gtk_usb_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_usb_hostlist_init("hosts,usb", NULL);
}
void
register_tap_listener_usb_hostlist(void)
{
register_stat_cmd_arg("hosts,usb", gtk_usb_hostlist_init, NULL);
register_hostlist_table(TRUE, "USB", "usb", NULL /*filter*/, usb_hostlist_packet);
}

View File

@ -1,82 +0,0 @@
/* hostlist_wlan.c 2004 Giles Scott
* modified from endpoint_talkers_eth.c 2003 Ronnie Sahlberg
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-ieee80211.h>
#include <epan/stat_groups.h>
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void register_tap_listener_wlan_hostlist(void);
static int
wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const wlan_hdr *whdr=(const wlan_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
add_hostlist_table_data(hosts, &whdr->src, 0, TRUE, 1, pinfo->fd->pkt_len, CONV_TYPE_WLAN, PT_NONE);
add_hostlist_table_data(hosts, &whdr->dst, 0, FALSE, 1, pinfo->fd->pkt_len, CONV_TYPE_WLAN, PT_NONE);
return 1;
}
static void
gtk_wlan_hostlist_init(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,wlan,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(TRUE, "WLAN", "wlan", filter, wlan_hostlist_packet);
}
void
gtk_wlan_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_)
{
gtk_wlan_hostlist_init("hosts,wlan",NULL);
}
void
register_tap_listener_wlan_hostlist(void)
{
register_stat_cmd_arg("hosts,wlan", gtk_wlan_hostlist_init,NULL);
register_hostlist_table(TRUE, "WLAN", "wlan", NULL /*filter*/, wlan_hostlist_packet);
}

View File

@ -191,6 +191,7 @@
#include "ui/gtk/packet_list.h"
#include "ui/gtk/filter_expression_save_dlg.h"
#include "ui/gtk/conversations_table.h"
#include "ui/gtk/hostlist_table.h"
#include "ui/gtk/old-gtk-compat.h"
@ -2578,6 +2579,7 @@ main(int argc, char *argv[])
register_all_tap_listeners();
conversation_table_set_gui_info(init_conversation_table);
hostlist_table_set_gui_info(init_hostlist_table);
splash_update(RA_PREFERENCES, NULL, (gpointer)splash_win);

View File

@ -1190,21 +1190,7 @@ static const char *ui_desc_menubar =
" <placeholder name='Conversations'/>\n"
" </menu>\n"
" <menu name= 'EndpointListMenu' action='/Statistics/EndpointList'>\n"
" <menuitem name='Ethernet' action='/Statistics/EndpointList/Ethernet'/>\n"
" <menuitem name='FibreChannel' action='/Statistics/EndpointList/FibreChannel'/>\n"
" <menuitem name='FDDI' action='/Statistics/EndpointList/FDDI'/>\n"
" <menuitem name='IP' action='/Statistics/EndpointList/IP'/>\n"
" <menuitem name='IPv6' action='/Statistics/EndpointList/IPv6'/>\n"
" <menuitem name='IPX' action='/Statistics/EndpointList/IPX'/>\n"
" <menuitem name='JXTA' action='/Statistics/EndpointList/JXTA'/>\n"
" <menuitem name='NCP' action='/Statistics/EndpointList/NCP'/>\n"
" <menuitem name='RSVP' action='/Statistics/EndpointList/RSVP'/>\n"
" <menuitem name='SCTP' action='/Statistics/EndpointList/SCTP'/>\n"
" <menuitem name='TCPIP' action='/Statistics/EndpointList/TCPIP'/>\n"
" <menuitem name='TR' action='/Statistics/EndpointList/TR'/>\n"
" <menuitem name='UDPIP' action='/Statistics/EndpointList/UDPIP'/>\n"
" <menuitem name='USB' action='/Statistics/EndpointList/USB'/>\n"
" <menuitem name='WLAN' action='/Statistics/EndpointList/WLAN'/>\n"
" <placeholder name='Endpoints'/>\n"
" </menu>\n"
" <menu name='ServiceResponseTimeMenu' action='/Statistics/ServiceResponseTime'>\n"
" <menuitem name='DCE-RPC' action='/Statistics/ServiceResponseTime/DCE-RPC'/>\n"
@ -1642,21 +1628,6 @@ static const GtkActionEntry main_menu_bar_entries[] = {
{ "/Statistics/ConversationList", NULL, "_Conversation List", NULL, NULL, NULL },
{ "/Statistics/EndpointList", NULL, "_Endpoint List", NULL, NULL, NULL },
{ "/Statistics/EndpointList/Ethernet", WIRESHARK_STOCK_ENDPOINTS, "Ethernet", NULL, NULL, G_CALLBACK(gtk_eth_hostlist_cb) },
{ "/Statistics/EndpointList/FibreChannel", WIRESHARK_STOCK_ENDPOINTS, "Fibre Channel", NULL, NULL, G_CALLBACK(gtk_fc_hostlist_cb) },
{ "/Statistics/EndpointList/FDDI", WIRESHARK_STOCK_ENDPOINTS, "FDDI", NULL, NULL, G_CALLBACK(gtk_fddi_hostlist_cb) },
{ "/Statistics/EndpointList/IP", WIRESHARK_STOCK_ENDPOINTS, "IPv4", NULL, NULL, G_CALLBACK(gtk_ip_hostlist_cb) },
{ "/Statistics/EndpointList/IPv6", WIRESHARK_STOCK_ENDPOINTS, "IPv6", NULL, NULL, G_CALLBACK(gtk_ipv6_hostlist_cb) },
{ "/Statistics/EndpointList/IPX", WIRESHARK_STOCK_ENDPOINTS, "IPX", NULL, NULL, G_CALLBACK(gtk_ipx_hostlist_cb) },
{ "/Statistics/EndpointList/JXTA", WIRESHARK_STOCK_ENDPOINTS, "JXTA", NULL, NULL, G_CALLBACK(gtk_jxta_hostlist_cb) },
{ "/Statistics/EndpointList/NCP", WIRESHARK_STOCK_ENDPOINTS, "NCP", NULL, NULL, G_CALLBACK(gtk_ncp_hostlist_cb) },
{ "/Statistics/EndpointList/RSVP", WIRESHARK_STOCK_ENDPOINTS, "RSVP", NULL, NULL, G_CALLBACK(gtk_rsvp_hostlist_cb) },
{ "/Statistics/EndpointList/SCTP", WIRESHARK_STOCK_ENDPOINTS, "SCTP", NULL, NULL, G_CALLBACK(gtk_sctp_hostlist_cb) },
{ "/Statistics/EndpointList/TCPIP", WIRESHARK_STOCK_ENDPOINTS, "TCP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_tcpip_hostlist_cb) },
{ "/Statistics/EndpointList/TR", WIRESHARK_STOCK_ENDPOINTS, "Token Ring", NULL, NULL, G_CALLBACK(gtk_tr_hostlist_cb) },
{ "/Statistics/EndpointList/UDPIP", WIRESHARK_STOCK_ENDPOINTS, "UDP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_udpip_hostlist_cb) },
{ "/Statistics/EndpointList/USB", WIRESHARK_STOCK_ENDPOINTS, "USB", NULL, NULL, G_CALLBACK(gtk_usb_hostlist_cb) },
{ "/Statistics/EndpointList/WLAN", WIRESHARK_STOCK_ENDPOINTS, "WLAN", NULL, NULL, G_CALLBACK(gtk_wlan_hostlist_cb) },
{ "/Statistics/ServiceResponseTime", NULL, "Service _Response Time", NULL, NULL, NULL },
{ "/Statistics/ServiceResponseTime/DCE-RPC", WIRESHARK_STOCK_TIME, "DCE-RPC...", NULL, NULL, G_CALLBACK(gtk_dcerpcstat_cb) },
@ -3405,6 +3376,70 @@ menu_conversation_list(capture_file *cf)
conversation_table_iterate_tables(add_conversation_menuitem, &conv_data);
}
static void
menu_hostlist_cb(GtkAction *action _U_, gpointer user_data)
{
register_ct_t *table = (register_ct_t*)user_data;
hostlist_endpoint_cb(table);
}
static void
add_hostlist_menuitem(gpointer data, gpointer user_data)
{
register_ct_t *table = (register_ct_t*)data;
conv_menu_t *conv = (conv_menu_t*)user_data;
gchar *action_name;
GtkAction *action;
action_name = g_strdup_printf ("hostlist-%u", conv->counter);
/*g_warning("action_name %s, filter_entry->name %s",action_name,filter_entry->name);*/
action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
"name", action_name,
"label", proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(table))),
"sensitive", TRUE,
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (menu_hostlist_cb), table);
gtk_action_group_add_action (conv->action_group, action);
g_object_unref (action);
gtk_ui_manager_add_ui (ui_manager_main_menubar, conv->merge_id,
"/Menubar/StatisticsMenu/EndpointListMenu/Endpoints",
action_name,
action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free(action_name);
conv->counter++;
}
static void
menu_hostlist_list(capture_file *cf)
{
GtkWidget *submenu_hostlist;
conv_menu_t conv_data;
conv_data.merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
conv_data.action_group = gtk_action_group_new ("endpoint-list-group");
submenu_hostlist = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/StatisticsMenu/EndpointListMenu");
if(!submenu_hostlist){
g_warning("add_recent_items: No submenu_conversation_list found, path= /Menubar/StatisticsMenu/EndpointListMenu");
}
gtk_ui_manager_insert_action_group (ui_manager_main_menubar, conv_data.action_group, 0);
g_object_set_data (G_OBJECT (ui_manager_main_menubar),
"endpoint-list-merge-id", GUINT_TO_POINTER (conv_data.merge_id));
conv_data.cf = cf;
conv_data.counter = 0;
conversation_table_iterate_tables(add_hostlist_menuitem, &conv_data);
}
static void
menus_init(void)
{
@ -3669,6 +3704,7 @@ menus_init(void)
menu_dissector_filter(&cfile);
menu_conversation_list(&cfile);
menu_hostlist_list(&cfile);
merge_menu_items(merge_menu_items_list);
/* Add external menus and items */

View File

@ -911,6 +911,7 @@ int main(int argc, char *argv[])
register_all_tap_listeners();
conversation_table_set_gui_info(init_conversation_table);
hostlist_table_set_gui_info(NULL); /* XXX - TODO: Provide "GUI" function for Qt */
if (ex_opt_count("read_format") > 0) {
in_file_type = open_info_name_to_type(ex_opt_get_next("read_format"));