From: guy Date: Sat, 1 Jan 2005 12:49:54 +0000 (+0000) Subject: Make the signatures of functions passed to "register_tap_listener()" X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=fc5094771f7601ad4a3a4e3e13d972439a77a8a9 Make the signatures of functions passed to "register_tap_listener()" match what "register_tap_listener()" expects (rather than squelching warnings about the differences by casting function pointers to "void *"). Make static some functions not used outside the module in which they're defined. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12913 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c index c706c76239..79997eb686 100644 --- a/epan/dissectors/packet-smb-sidsnooping.c +++ b/epan/dissectors/packet-smb-sidsnooping.c @@ -62,8 +62,8 @@ static int ctx_handle_init_count = 200; static GHashTable *ctx_handle_table = NULL; -static void *lsa_policy_information_flag = NULL; -static void *samr_query_dispinfo_flag = NULL; +static gboolean lsa_policy_information_tap_installed = FALSE; +static gboolean samr_query_dispinfo_tap_installed = FALSE; char * @@ -334,13 +334,13 @@ sid_snooping_init(void) header_field_info *hfi; GString *error_string; - if(lsa_policy_information_flag){ - remove_tap_listener(lsa_policy_information_flag); - lsa_policy_information_flag=NULL; + if(lsa_policy_information_tap_installed){ + remove_tap_listener(&lsa_policy_information_tap_installed); + lsa_policy_information_tap_installed=FALSE; } - if(samr_query_dispinfo_flag){ - remove_tap_listener(samr_query_dispinfo_flag); - samr_query_dispinfo_flag=NULL; + if(samr_query_dispinfo_tap_installed){ + remove_tap_listener(&samr_query_dispinfo_tap_installed); + samr_query_dispinfo_tap_installed=FALSE; } if(sid_name_table){ @@ -421,7 +421,7 @@ sid_snooping_init(void) - error_string=register_tap_listener("dcerpc", lsa_policy_information, "lsa.policy_information and ( lsa.info.level or lsa.domain or nt.domain_sid )", NULL, lsa_policy_information, NULL); + error_string=register_tap_listener("dcerpc", &lsa_policy_information_tap_installed, "lsa.policy_information and ( lsa.info.level or lsa.domain or nt.domain_sid )", NULL, lsa_policy_information, NULL); if(error_string){ /* error, we failed to attach to the tap. clean up */ @@ -430,9 +430,9 @@ sid_snooping_init(void) g_string_free(error_string, TRUE); exit(1); } - lsa_policy_information_flag=lsa_policy_information; + lsa_policy_information_tap_installed=TRUE; - error_string=register_tap_listener("dcerpc", samr_query_dispinfo, "samr and samr.opnum==40 and ( samr.hnd or samr.rid or samr.acct_name or samr.level )", NULL, samr_query_dispinfo, NULL); + error_string=register_tap_listener("dcerpc", &samr_query_dispinfo_tap_installed, "samr and samr.opnum==40 and ( samr.hnd or samr.rid or samr.acct_name or samr.level )", NULL, samr_query_dispinfo, NULL); if(error_string){ /* error, we failed to attach to the tap. clean up */ @@ -441,7 +441,7 @@ sid_snooping_init(void) g_string_free(error_string, TRUE); exit(1); } - samr_query_dispinfo_flag=samr_query_dispinfo; + samr_query_dispinfo_tap_installed=TRUE; } void @@ -454,4 +454,3 @@ void proto_reg_handoff_smb_sidsnooping(void) { } - diff --git a/gtk/conversations_eth.c b/gtk/conversations_eth.c index 681b64657e..4196f25124 100644 --- a/gtk/conversations_eth.c +++ b/gtk/conversations_eth.c @@ -41,9 +41,9 @@ static int -eth_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +eth_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - eth_hdr *ehdr=vip; + const eth_hdr *ehdr=vip; add_conversation_table_data((conversations_table *)pct, &ehdr->src, &ehdr->dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_ETHER, PT_NONE); @@ -63,7 +63,7 @@ eth_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "Ethernet", "eth", filter, (void *)eth_conversation_packet); + init_conversation_table(TRUE, "Ethernet", "eth", filter, eth_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_eth_conversation(void) register_tap_menu_item("Ethernet", REGISTER_TAP_GROUP_CONVERSATION_LIST, eth_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "Ethernet", "eth", NULL /*filter*/, (void *)eth_conversation_packet); + register_conversation_table(TRUE, "Ethernet", "eth", NULL /*filter*/, eth_conversation_packet); } - diff --git a/gtk/conversations_fc.c b/gtk/conversations_fc.c index b584197063..01b9662560 100644 --- a/gtk/conversations_fc.c +++ b/gtk/conversations_fc.c @@ -41,9 +41,9 @@ static int -fc_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +fc_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - fc_hdr *fchdr=vip; + const fc_hdr *fchdr=vip; add_conversation_table_data((conversations_table *)pct, &fchdr->s_id, &fchdr->d_id, 0, 0, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NONE); @@ -63,7 +63,7 @@ fc_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "Fibre Channel", "fc", filter, (void *)fc_conversation_packet); + init_conversation_table(TRUE, "Fibre Channel", "fc", filter, fc_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_fc_conversation(void) register_tap_menu_item("Fibre Channel", REGISTER_TAP_GROUP_CONVERSATION_LIST, fc_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "Fibre Channel", "fc", NULL /*filter*/, (void *)fc_conversation_packet); + register_conversation_table(TRUE, "Fibre Channel", "fc", NULL /*filter*/, fc_conversation_packet); } - diff --git a/gtk/conversations_fddi.c b/gtk/conversations_fddi.c index be6222652d..317423305b 100644 --- a/gtk/conversations_fddi.c +++ b/gtk/conversations_fddi.c @@ -41,9 +41,9 @@ static int -fddi_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +fddi_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - fddi_hdr *ehdr=vip; + const fddi_hdr *ehdr=vip; add_conversation_table_data((conversations_table *)pct, &ehdr->src, &ehdr->dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_FDDI, PT_NONE); @@ -63,7 +63,7 @@ fddi_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "FDDI", "fddi", filter, (void *)fddi_conversation_packet); + init_conversation_table(TRUE, "FDDI", "fddi", filter, fddi_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_fddi_conversation(void) register_tap_menu_item("FDDI", REGISTER_TAP_GROUP_CONVERSATION_LIST, fddi_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "FDDI", "fddi", NULL /*filter*/, (void *)fddi_conversation_packet); + register_conversation_table(TRUE, "FDDI", "fddi", NULL /*filter*/, fddi_conversation_packet); } - diff --git a/gtk/conversations_ip.c b/gtk/conversations_ip.c index 5a94f97f59..d2811801e4 100644 --- a/gtk/conversations_ip.c +++ b/gtk/conversations_ip.c @@ -41,9 +41,9 @@ static int -ip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +ip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - e_ip *iph=vip; + const e_ip *iph=vip; add_conversation_table_data((conversations_table *)pct, &iph->ip_src, &iph->ip_dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NONE); @@ -61,7 +61,7 @@ ip_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "IPv4", "ip", filter, (void *)ip_conversation_packet); + init_conversation_table(TRUE, "IPv4", "ip", filter, ip_conversation_packet); } @@ -81,6 +81,5 @@ register_tap_listener_ip_conversation(void) register_tap_menu_item("IPv4", REGISTER_TAP_GROUP_CONVERSATION_LIST, ip_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "IPv4", "ip", NULL /*filter*/, (void *)ip_conversation_packet); + register_conversation_table(TRUE, "IPv4", "ip", NULL /*filter*/, ip_conversation_packet); } - diff --git a/gtk/conversations_ipx.c b/gtk/conversations_ipx.c index 4b90e2a3a2..634d7d56e7 100644 --- a/gtk/conversations_ipx.c +++ b/gtk/conversations_ipx.c @@ -41,9 +41,9 @@ static int -ipx_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +ipx_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - ipxhdr_t *ipxh=vip; + const ipxhdr_t *ipxh=vip; add_conversation_table_data((conversations_table *)pct, &ipxh->ipx_src, &ipxh->ipx_dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NONE); @@ -63,7 +63,7 @@ ipx_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "IPX", "ipx", filter, (void *)ipx_conversation_packet); + init_conversation_table(TRUE, "IPX", "ipx", filter, ipx_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_ipx_conversation(void) register_tap_menu_item("IPX", REGISTER_TAP_GROUP_CONVERSATION_LIST, ipx_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "IPX", "ipx", NULL /*filter*/, (void *)ipx_conversation_packet); + register_conversation_table(TRUE, "IPX", "ipx", NULL /*filter*/, ipx_conversation_packet); } - diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c index b79b0869da..c460d55a45 100644 --- a/gtk/conversations_table.c +++ b/gtk/conversations_table.c @@ -36,17 +36,18 @@ #include +#include +#include +#include +#include + #include "compat_macros.h" -#include "epan/packet_info.h" -#include "epan/to_str.h" -#include "epan/addr_resolv.h" #include "sat.h" #include "conversations_table.h" #include "image/clist_ascend.xpm" #include "image/clist_descend.xpm" #include "simple_dialog.h" #include "globals.h" -#include #include "gtk/find_dlg.h" #include "color.h" #include "gtk/color_dlg.h" @@ -240,6 +241,11 @@ reset_ct_table_data(conversations_table *ct) ct->num_conversations=0; } +static void +reset_ct_table_data_cb(void *arg) +{ + reset_ct_table_data(arg); +} void protect_thread_critical_region(void); void unprotect_thread_critical_region(void); @@ -1051,15 +1057,20 @@ draw_ct_table_data(conversations_table *ct) } - draw_ct_table_addresses(ct); + draw_ct_table_addresses(ct); gtk_clist_sort(ct->table); - /* Allow table to redraw */ + /* Allow table to redraw */ gtk_clist_thaw(ct->table); - gtk_clist_freeze(ct->table); + gtk_clist_freeze(ct->table); } +static void +draw_ct_table_data_cb(void *arg) +{ + draw_ct_table_data(arg); +} #if (GTK_MAJOR_VERSION >= 2) static void @@ -1101,8 +1112,8 @@ copy_as_csv_cb(GtkWindow *win _U_, gpointer data) #endif -gboolean -init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +static gboolean +init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { int i; column_arrows *col_arrows; @@ -1209,7 +1220,7 @@ init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean #endif /* register the tap and rerun the taps on the packet list */ - error_string=register_tap_listener(tap_name, conversations, filter, (void *)reset_ct_table_data, packet_func, (void *)draw_ct_table_data); + error_string=register_tap_listener(tap_name, conversations, filter, reset_ct_table_data_cb, packet_func, draw_ct_table_data_cb); if(error_string){ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); g_string_free(error_string, TRUE); @@ -1221,7 +1232,7 @@ init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean void -init_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +init_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { conversations_table *conversations; char title[256]; @@ -1291,7 +1302,7 @@ ct_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) static conversations_table * -init_ct_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +init_ct_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { gboolean ret; GtkWidget *page_vbox; @@ -1316,18 +1327,18 @@ init_ct_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, typedef struct { - gboolean hide_ports; /* hide TCP / UDP port columns */ - char *table_name; /* GUI output name */ - char *tap_name; /* internal name */ - char *filter; /* display filter string (unused) */ - void *packet_func; /* function to be called for new incoming packets */ + gboolean hide_ports; /* hide TCP / UDP port columns */ + char *table_name; /* GUI output name */ + char *tap_name; /* internal name */ + char *filter; /* display filter string (unused) */ + tap_packet_cb packet_func; /* function to be called for new incoming packets */ } register_ct_t; static GSList *registered_ct_tables = NULL; void -register_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +register_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { register_ct_t *table; @@ -1451,9 +1462,9 @@ init_conversation_notebook_cb(GtkWidget *w _U_, gpointer d _U_) void -add_conversation_table_data(conversations_table *ct, address *src, address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, SAT_E sat, int port_type) +add_conversation_table_data(conversations_table *ct, const address *src, const address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, SAT_E sat, int port_type) { - address *addr1, *addr2; + const address *addr1, *addr2; guint32 port1, port2; conversation_t *conversation=NULL; int conversation_idx=0; @@ -1576,5 +1587,3 @@ add_conversation_table_data(conversations_table *ct, address *src, address *dst, draw_ct_table_address(ct, conversation_idx); } } - - diff --git a/gtk/conversations_table.h b/gtk/conversations_table.h index a9786acf7a..7ee2aadcd1 100644 --- a/gtk/conversations_table.h +++ b/gtk/conversations_table.h @@ -68,7 +68,7 @@ typedef struct _conversations_table { * @param filter the optional filter name or NULL * @param packet_func the function to be called for each incoming packet */ -extern void register_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func); +extern void register_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func); /** Init the conversation table for the single conversation window. * @@ -78,7 +78,7 @@ extern void register_conversation_table(gboolean hide_ports, char *table_name, c * @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(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func); +extern void init_conversation_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func); /** Callback for "Conversations" statistics item. * @@ -99,5 +99,5 @@ extern void init_conversation_notebook_cb(GtkWidget *widget, gpointer data); * @param sat address type * @param port_type the port type (e.g. PT_TCP) */ -extern void add_conversation_table_data(conversations_table *ct, address *src, address *dst, +extern void add_conversation_table_data(conversations_table *ct, const address *src, const address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, SAT_E sat, int port_type); diff --git a/gtk/conversations_tcpip.c b/gtk/conversations_tcpip.c index de201e87ef..4e85e08964 100644 --- a/gtk/conversations_tcpip.c +++ b/gtk/conversations_tcpip.c @@ -41,9 +41,9 @@ static int -tcpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +tcpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - struct tcpheader *tcphdr=vip; + const struct tcpheader *tcphdr=vip; add_conversation_table_data((conversations_table *)pct, &tcphdr->ip_src, &tcphdr->ip_dst, tcphdr->th_sport, tcphdr->th_dport, 1, pinfo->fd->pkt_len, SAT_NONE, PT_TCP); @@ -63,7 +63,7 @@ tcpip_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(FALSE, "TCP", "tcp", filter, (void *)tcpip_conversation_packet); + init_conversation_table(FALSE, "TCP", "tcp", filter, tcpip_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_tcpip_conversation(void) register_tap_menu_item("TCP (IPv4 & IPv6)", REGISTER_TAP_GROUP_CONVERSATION_LIST, tcpip_conversation_cb, NULL, NULL, NULL); - register_conversation_table(FALSE, "TCP", "tcp", NULL /*filter*/, (void *)tcpip_conversation_packet); + register_conversation_table(FALSE, "TCP", "tcp", NULL /*filter*/, tcpip_conversation_packet); } - diff --git a/gtk/conversations_tr.c b/gtk/conversations_tr.c index c01807fcbc..93d5a65a92 100644 --- a/gtk/conversations_tr.c +++ b/gtk/conversations_tr.c @@ -41,9 +41,9 @@ static int -tr_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +tr_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - tr_hdr *trhdr=vip; + const tr_hdr *trhdr=vip; add_conversation_table_data((conversations_table *)pct, &trhdr->src, &trhdr->dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_TOKENRING, PT_NONE); @@ -63,7 +63,7 @@ tr_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "Token Ring", "tr", filter, (void *)tr_conversation_packet); + init_conversation_table(TRUE, "Token Ring", "tr", filter, tr_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_tr_conversation(void) register_tap_menu_item("Token Ring", REGISTER_TAP_GROUP_CONVERSATION_LIST, tr_conversation_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "Token Ring", "tr", NULL /*filter*/, (void *)tr_conversation_packet); + register_conversation_table(TRUE, "Token Ring", "tr", NULL /*filter*/, tr_conversation_packet); } - diff --git a/gtk/conversations_udpip.c b/gtk/conversations_udpip.c index 5a695c0e1f..a78b42550c 100644 --- a/gtk/conversations_udpip.c +++ b/gtk/conversations_udpip.c @@ -41,9 +41,9 @@ static int -udpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +udpip_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - e_udphdr *udphdr=vip; + const e_udphdr *udphdr=vip; add_conversation_table_data((conversations_table *)pct, &udphdr->ip_src, &udphdr->ip_dst, udphdr->uh_sport, udphdr->uh_dport, 1, pinfo->fd->pkt_len, SAT_NONE, PT_UDP); @@ -63,7 +63,7 @@ udpip_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(FALSE, "UDP", "udp", filter, (void *)udpip_conversation_packet); + init_conversation_table(FALSE, "UDP", "udp", filter, udpip_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_udpip_conversation(void) register_tap_menu_item("UDP (IPv4 & IPv6)", REGISTER_TAP_GROUP_CONVERSATION_LIST, udpip_conversation_cb, NULL, NULL, NULL); - register_conversation_table(FALSE, "UDP", "udp", NULL /*filter*/, (void *)udpip_conversation_packet); + register_conversation_table(FALSE, "UDP", "udp", NULL /*filter*/, udpip_conversation_packet); } - diff --git a/gtk/conversations_wlan.c b/gtk/conversations_wlan.c index ab57f76df2..0faf6132a9 100644 --- a/gtk/conversations_wlan.c +++ b/gtk/conversations_wlan.c @@ -41,9 +41,9 @@ static int -wlan_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +wlan_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - wlan_hdr *whdr=vip; + const wlan_hdr *whdr=vip; add_conversation_table_data((conversations_table *)pct, &whdr->src, &whdr->dst, 0, 0, 1, pinfo->fd->pkt_len, SAT_ETHER, PT_NONE); @@ -63,7 +63,7 @@ wlan_conversation_init(char *optarg) filter=NULL; } - init_conversation_table(TRUE, "WLAN", "wlan", filter, (void *)wlan_conversation_packet); + init_conversation_table(TRUE, "WLAN", "wlan", filter, wlan_conversation_packet); } @@ -83,6 +83,5 @@ register_tap_listener_wlan_conversation(void) register_tap_menu_item("WLAN", REGISTER_TAP_GROUP_CONVERSATION_LIST, wlan_endpoints_cb, NULL, NULL, NULL); - register_conversation_table(TRUE, "WLAN", "wlan", NULL /*filter*/, (void *)wlan_conversation_packet); + register_conversation_table(TRUE, "WLAN", "wlan", NULL /*filter*/, wlan_conversation_packet); } - diff --git a/gtk/h323_conversations.c b/gtk/h323_conversations.c index ec60f3eb15..df6707f259 100644 --- a/gtk/h323_conversations.c +++ b/gtk/h323_conversations.c @@ -55,6 +55,8 @@ #include +static void h245conversations_reset(void *arg); + char *transport_prot_name[256] ={ "","","","","","","tcp","","","", /* 0 to 10 */ "","","","","","","","udp","","", /* 10 to 20 */ @@ -145,11 +147,16 @@ void h225conversations_reset(h323conversations_tapinfo_t *tapinfo) return; } +static void h225conversations_reset_cb(void *arg) +{ + h225conversations_reset(arg); +} + /****************************************************************************/ /* redraw the output */ -void h225conversations_draw(h323conversations_tapinfo_t *tapinfo _U_) +static void h225conversations_draw(void *arg _U_) { -/* XXX: see h323conversations_on_update in h323_conversationss_dlg.c for comments +/* XXX: see h323conversations_on_update in h323_conversations_dlg.c for comments gtk_signal_emit_by_name(top_level, "signal_h225conversations_update"); */ h323conversations_dlg_update(the_tapinfo_struct.strinfo_list); @@ -160,13 +167,14 @@ void h225conversations_draw(h323conversations_tapinfo_t *tapinfo _U_) /****************************************************************************/ /* whenever a H225 packet is seen by the tap listener */ -int h225conversations_packet(h323conversations_tapinfo_t *tapinfo _U_, packet_info *pinfo, epan_dissect_t *edt _U_, void *h225info) +static int h225conversations_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *h225info) { + h323conversations_tapinfo_t *tapinfo = arg; h323_conversations_info_t tmp_strinfo; h323_conversations_info_t *strinfo = NULL; GList* list; - h225_packet_info *pi = h225info; + const h225_packet_info *pi = h225info; /* TODO: evaluate RAS Messages. Just ignore them for now*/ if(pi->msg_type==H225_RAS) @@ -295,7 +303,8 @@ h225conversations_init_tap(void) { /* don't register tap listener, if we have it already */ error_string = register_tap_listener("h225", &the_tapinfo_struct, NULL, - (void*)h225conversations_reset, (void*)h225conversations_packet, (void*)h225conversations_draw); + h225conversations_reset_cb, h225conversations_packet, + h225conversations_draw); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, @@ -328,9 +337,15 @@ remove_tap_listener_h225_conversations(void) /* ***************************TAP for h245 **********************************/ /****************************************************************************/ +/****************************************************************************/ +static void h245conversations_reset(void *arg _U_) +{ + return; +} + /****************************************************************************/ /* redraw the output */ -void h245conversations_draw(h323conversations_tapinfo_t *tapinfo _U_) +static void h245conversations_draw(void *arg _U_) { h323conversations_dlg_update(the_tapinfo_struct.strinfo_list); return; @@ -338,8 +353,9 @@ void h245conversations_draw(h323conversations_tapinfo_t *tapinfo _U_) /****************************************************************************/ /* whenever a H245 packet is seen by the tap listener */ -int h245conversations_packet(h323conversations_tapinfo_t *tapinfo _U_, packet_info *pinfo, epan_dissect_t *edt _U_, void *h245info _U_) +static int h245conversations_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *h245info _U_) { + h323conversations_tapinfo_t *tapinfo = arg; GList* list; struct _h323_conversations_info* a; guint32 src, dst; @@ -382,8 +398,8 @@ h245conversations_init_tap(void) { /* don't register tap listener, if we have it already */ error_string = register_tap_listener("h245", &the_tapinfo_struct, - NULL, - (void*)h245conversations_reset, (void*)h245conversations_packet, (void*)h245conversations_draw); + NULL, h245conversations_reset, h245conversations_packet, + h245conversations_draw); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, @@ -405,12 +421,3 @@ remove_tap_listener_h245_conversations(void) have_h245_tap_listener=FALSE; } - - -/****************************************************************************/ - -void h245conversations_reset(h323conversations_tapinfo_t *tapinfo _U_) -{ - return; -} - diff --git a/gtk/h323_conversations.h b/gtk/h323_conversations.h index d20c19c6a6..ee8cf5b648 100644 --- a/gtk/h323_conversations.h +++ b/gtk/h323_conversations.h @@ -112,7 +112,6 @@ const h323conversations_tapinfo_t* h323conversations_get_info(void); * Cleans up memory of h323 conversationss tap. */ void h225conversations_reset(h323conversations_tapinfo_t *tapinfo); -void h245conversations_reset(h323conversations_tapinfo_t *tapinfo); /* * Marks all packets belonging to conversations. diff --git a/gtk/hostlist_eth.c b/gtk/hostlist_eth.c index 814645c5b5..2a7ebfc502 100644 --- a/gtk/hostlist_eth.c +++ b/gtk/hostlist_eth.c @@ -41,10 +41,10 @@ static int -eth_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +eth_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - eth_hdr *ehdr=vip; + const eth_hdr *ehdr=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) @@ -68,7 +68,7 @@ gtk_eth_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "Ethernet Hosts", "eth", filter, (void *)eth_hostlist_packet); + init_hostlist_table(TRUE, "Ethernet Hosts", "eth", filter, eth_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_eth_hostlist(void) register_tap_menu_item("Ethernet", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_eth_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "Ethernet", "eth", NULL /*filter*/, (void *)eth_hostlist_packet); + register_hostlist_table(TRUE, "Ethernet", "eth", NULL /*filter*/, eth_hostlist_packet); } - diff --git a/gtk/hostlist_fc.c b/gtk/hostlist_fc.c index e3b4c44687..22b18e956e 100644 --- a/gtk/hostlist_fc.c +++ b/gtk/hostlist_fc.c @@ -41,10 +41,10 @@ static int -fc_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +fc_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - fc_hdr *fchdr=vip; + const fc_hdr *fchdr=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) @@ -68,7 +68,7 @@ gtk_fc_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "Fibre Channel Hosts", "fc", filter, (void *)fc_hostlist_packet); + init_hostlist_table(TRUE, "Fibre Channel Hosts", "fc", filter, fc_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_fc_hostlist(void) register_tap_menu_item("Fibre Channel", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_fc_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "Fibre Channel", "fc", NULL /*filter*/, (void *)fc_hostlist_packet); + register_hostlist_table(TRUE, "Fibre Channel", "fc", NULL /*filter*/, fc_hostlist_packet); } - diff --git a/gtk/hostlist_fddi.c b/gtk/hostlist_fddi.c index 0ca976dd5d..5f2083005d 100644 --- a/gtk/hostlist_fddi.c +++ b/gtk/hostlist_fddi.c @@ -41,10 +41,10 @@ static int -fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +fddi_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - fddi_hdr *ehdr=vip; + const fddi_hdr *ehdr=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) @@ -68,7 +68,7 @@ gtk_fddi_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "FDDI Hosts", "fddi", filter, (void *)fddi_hostlist_packet); + init_hostlist_table(TRUE, "FDDI Hosts", "fddi", filter, fddi_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_fddi_hostlist(void) register_tap_menu_item("FDDI", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_fddi_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "FDDI", "fddi", NULL /*filter*/, (void *)fddi_hostlist_packet); + register_hostlist_table(TRUE, "FDDI", "fddi", NULL /*filter*/, fddi_hostlist_packet); } - diff --git a/gtk/hostlist_ip.c b/gtk/hostlist_ip.c index 0f95fcce51..cc6294e4ba 100644 --- a/gtk/hostlist_ip.c +++ b/gtk/hostlist_ip.c @@ -43,10 +43,10 @@ static int -ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +ip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - e_ip *iph=vip; + const e_ip *iph=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) @@ -67,7 +67,7 @@ gtk_ip_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "IPv4 Hosts", "ip", filter, (void *)ip_hostlist_packet); + init_hostlist_table(TRUE, "IPv4 Hosts", "ip", filter, ip_hostlist_packet); } @@ -87,6 +87,5 @@ register_tap_listener_ip_hostlist(void) register_tap_menu_item("IPv4", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_ip_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "IPv4", "ip", NULL /*filter*/, (void *)ip_hostlist_packet); + register_hostlist_table(TRUE, "IPv4", "ip", NULL /*filter*/, ip_hostlist_packet); } - diff --git a/gtk/hostlist_ipx.c b/gtk/hostlist_ipx.c index a59a85d5f0..a266796fcd 100644 --- a/gtk/hostlist_ipx.c +++ b/gtk/hostlist_ipx.c @@ -41,10 +41,10 @@ static int -ipx_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +ipx_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - ipxhdr_t *ipxh=vip; + const ipxhdr_t *ipxh=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) @@ -68,7 +68,7 @@ gtk_ipx_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "IPX Hosts", "ipx", filter, (void *)ipx_hostlist_packet); + init_hostlist_table(TRUE, "IPX Hosts", "ipx", filter, ipx_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_ipx_hostlist(void) register_tap_menu_item("IPX", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_ipx_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "IPX", "ipx", NULL /*filter*/, (void *)ipx_hostlist_packet); + register_hostlist_table(TRUE, "IPX", "ipx", NULL /*filter*/, ipx_hostlist_packet); } - diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index afe9540c3e..0e867bd72f 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -31,17 +31,20 @@ #include #include #include + #include + +#include +#include +#include +#include + #include "compat_macros.h" -#include "epan/packet_info.h" -#include "epan/to_str.h" -#include "epan/addr_resolv.h" #include "hostlist_table.h" #include "image/clist_ascend.xpm" #include "image/clist_descend.xpm" #include "simple_dialog.h" #include "globals.h" -#include #include "gtk/find_dlg.h" #include "color.h" #include "gtk/color_dlg.h" @@ -170,7 +173,11 @@ reset_hostlist_table_data(hostlist_table *hosts) hosts->num_hosts=0; } - +static void +reset_hostlist_table_data_cb(void *arg) +{ + reset_hostlist_table_data(arg); +} void protect_thread_critical_region(void); void unprotect_thread_critical_region(void); @@ -542,13 +549,19 @@ draw_hostlist_table_data(hostlist_table *hl) } - draw_hostlist_table_addresses(hl); + draw_hostlist_table_addresses(hl); gtk_clist_sort(hl->table); - /* Allow table to redraw. */ + /* Allow table to redraw. */ gtk_clist_thaw(hl->table); - gtk_clist_freeze(hl->table); + gtk_clist_freeze(hl->table); +} + +static void +draw_hostlist_table_data_cb(void *arg) +{ + draw_hostlist_table_data(arg); } #if (GTK_MAJOR_VERSION >= 2) @@ -592,7 +605,7 @@ copy_as_csv_cb(GtkWindow *win _U_, gpointer data) static gboolean -init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { int i; column_arrows *col_arrows; @@ -691,7 +704,7 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi #endif /* register the tap and rerun the taps on the packet list */ - error_string=register_tap_listener(tap_name, hosttable, filter, (void *)reset_hostlist_table_data, packet_func, (void *)draw_hostlist_table_data); + error_string=register_tap_listener(tap_name, hosttable, filter, reset_hostlist_table_data_cb, packet_func, draw_hostlist_table_data_cb); if(error_string){ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); g_string_free(error_string, TRUE); @@ -704,7 +717,7 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi void -init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { hostlist_table *hosttable; char title[256]; @@ -773,7 +786,7 @@ hostlist_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) static hostlist_table * -init_hostlist_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +init_hostlist_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { gboolean ret; GtkWidget *page_vbox; @@ -798,18 +811,18 @@ init_hostlist_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_ typedef struct { - gboolean hide_ports; /* hide TCP / UDP port columns */ - char *table_name; /* GUI output name */ - char *tap_name; /* internal name */ - char *filter; /* display filter string (unused) */ - void *packet_func; /* function to be called for new incoming packets */ + gboolean hide_ports; /* hide TCP / UDP port columns */ + char *table_name; /* GUI output name */ + char *tap_name; /* internal name */ + char *filter; /* display filter string (unused) */ + tap_packet_cb packet_func; /* function to be called for new incoming packets */ } register_hostlist_t; static GSList *registered_hostlist_tables = NULL; void -register_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) +register_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func) { register_hostlist_t *table; @@ -935,7 +948,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) void -add_hostlist_table_data(hostlist_table *hl, address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type) +add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type) { hostlist_talker_t *talker=NULL; int talker_idx=0; @@ -1026,4 +1039,3 @@ add_hostlist_table_data(hostlist_table *hl, address *addr, guint32 port, gboolea draw_hostlist_table_address(hl, talker_idx); } } - diff --git a/gtk/hostlist_table.h b/gtk/hostlist_table.h index 7076c42187..73ae442e50 100644 --- a/gtk/hostlist_table.h +++ b/gtk/hostlist_table.h @@ -66,7 +66,7 @@ typedef struct _hostlist_table { * @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, char *table_name, char *tap_name, char *filter, void *packet_func); +extern void register_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func); /** Init the hostlist table for the single hostlist window. * @@ -76,7 +76,7 @@ extern void register_hostlist_table(gboolean hide_ports, char *table_name, char * @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, char *table_name, char *tap_name, char *filter, void *packet_func); +extern void init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, tap_packet_cb packet_func); /** Callback for "Endpoints" statistics item. * @@ -96,5 +96,5 @@ extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d); * @param sat address type * @param port_type the port type (e.g. PT_TCP) */ -void add_hostlist_table_data(hostlist_table *hl, address *addr, +void add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type); diff --git a/gtk/hostlist_tcpip.c b/gtk/hostlist_tcpip.c index 0490866667..13a4ae0e21 100644 --- a/gtk/hostlist_tcpip.c +++ b/gtk/hostlist_tcpip.c @@ -41,10 +41,10 @@ static int -tcpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +tcpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - struct tcpheader *tcphdr=vip; + const struct tcpheader *tcphdr=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) @@ -68,7 +68,7 @@ gtk_tcpip_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(FALSE, "TCP Endpoints", "tcp", filter, (void *)tcpip_hostlist_packet); + init_hostlist_table(FALSE, "TCP Endpoints", "tcp", filter, tcpip_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_tcpip_hostlist(void) register_tap_menu_item("TCP (IPv4 & IPv6)", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_tcpip_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(FALSE, "TCP", "tcp", NULL /*filter*/, (void *)tcpip_hostlist_packet); + register_hostlist_table(FALSE, "TCP", "tcp", NULL /*filter*/, tcpip_hostlist_packet); } - diff --git a/gtk/hostlist_tr.c b/gtk/hostlist_tr.c index 3109521fef..1cac21c34f 100644 --- a/gtk/hostlist_tr.c +++ b/gtk/hostlist_tr.c @@ -41,10 +41,10 @@ static int -tr_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +tr_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - tr_hdr *trhdr=vip; + const tr_hdr *trhdr=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) @@ -68,7 +68,7 @@ gtk_tr_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "Token Ring Hosts", "tr", filter, (void *)tr_hostlist_packet); + init_hostlist_table(TRUE, "Token Ring Hosts", "tr", filter, tr_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_tr_hostlist(void) register_tap_menu_item("Token Ring", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_tr_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "Token Ring", "tr", NULL /*filter*/, (void *)tr_hostlist_packet); + register_hostlist_table(TRUE, "Token Ring", "tr", NULL /*filter*/, tr_hostlist_packet); } - diff --git a/gtk/hostlist_udpip.c b/gtk/hostlist_udpip.c index b7c048051e..1e4ecebc04 100644 --- a/gtk/hostlist_udpip.c +++ b/gtk/hostlist_udpip.c @@ -41,10 +41,10 @@ static int -udpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +udpip_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - e_udphdr *udphdr=vip; + const e_udphdr *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) @@ -68,7 +68,7 @@ gtk_udpip_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(FALSE, "UDP Endpoints", "udp", filter, (void *)udpip_hostlist_packet); + init_hostlist_table(FALSE, "UDP Endpoints", "udp", filter, udpip_hostlist_packet); } @@ -88,6 +88,5 @@ register_tap_listener_udpip_hostlist(void) register_tap_menu_item("UDP (IPv4 & IPv6)", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_udpip_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(FALSE, "UDP", "udp", NULL /*filter*/, (void *)udpip_hostlist_packet); + register_hostlist_table(FALSE, "UDP", "udp", NULL /*filter*/, udpip_hostlist_packet); } - diff --git a/gtk/hostlist_wlan.c b/gtk/hostlist_wlan.c index 5b17aa83e0..00034c5863 100644 --- a/gtk/hostlist_wlan.c +++ b/gtk/hostlist_wlan.c @@ -41,10 +41,10 @@ static int -wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; - wlan_hdr *whdr=vip; + const wlan_hdr *whdr=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) @@ -66,7 +66,7 @@ gtk_wlan_hostlist_init(char *optarg) filter=NULL; } - init_hostlist_table(TRUE, "WLAN Hosts", "wlan", filter, (void *)wlan_hostlist_packet); + init_hostlist_table(TRUE, "WLAN Hosts", "wlan", filter, wlan_hostlist_packet); } @@ -86,5 +86,5 @@ register_tap_listener_wlan_hostlist(void) register_tap_menu_item("WLAN", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_wlan_hostlist_cb, NULL, NULL, NULL); - register_hostlist_table(TRUE, "WLAN", "wlan", NULL /*filter*/, (void *)wlan_hostlist_packet); + register_hostlist_table(TRUE, "WLAN", "wlan", NULL /*filter*/, wlan_hostlist_packet); } diff --git a/gtk/rpc_progs.c b/gtk/rpc_progs.c index b12ee9c3c2..2567b8b898 100644 --- a/gtk/rpc_progs.c +++ b/gtk/rpc_progs.c @@ -154,8 +154,9 @@ add_new_program(rpc_program_t *rp) static int -rpcprogs_packet(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_call_info_value *ri) +rpcprogs_packet(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg) { + const rpc_call_info_value *ri = arg; nstime_t delta; rpc_program_t *rp; @@ -384,7 +385,7 @@ gtk_rpcprogs_init(char *optarg _U_) gtk_table_attach_defaults(GTK_TABLE(table), tmp, 5,6,0,1); gtk_label_set_justify(GTK_LABEL(tmp), GTK_JUSTIFY_RIGHT); - error_string=register_tap_listener("rpc", win, NULL, (void*)rpcprogs_reset, (void*)rpcprogs_packet, (void*)rpcprogs_draw); + error_string=register_tap_listener("rpc", win, NULL, rpcprogs_reset, rpcprogs_packet, rpcprogs_draw); if(error_string){ fprintf(stderr, "ethereal: Couldn't register rpc,programs tap: %s\n", error_string->str); diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c index 004f3a3cd9..2c192976b8 100644 --- a/gtk/rpc_stat.c +++ b/gtk/rpc_stat.c @@ -82,16 +82,21 @@ rpcstat_set_title(rpcstat_t *rs) } static void -rpcstat_reset(rpcstat_t *rs) +rpcstat_reset(void *arg) { + rpcstat_t *rs = arg; + reset_srt_table_data(&rs->srt_table); rpcstat_set_title(rs); } static int -rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_call_info_value *ri) +rpcstat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2) { + rpcstat_t *rs = arg; + const rpc_call_info_value *ri = arg2; + /* we are only interested in reply packets */ if(ri->request){ return 0; @@ -123,8 +128,10 @@ rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_c } static void -rpcstat_draw(rpcstat_t *rs) +rpcstat_draw(void *arg) { + rpcstat_t *rs = arg; + draw_srt_table_data(&rs->srt_table); } @@ -254,7 +261,7 @@ gtk_rpcstat_init(char *optarg) gtk_container_add(GTK_CONTAINER(rs->win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); - title_string = rpcstat_gen_title(rs); + title_string = rpcstat_gen_title(rs); stat_label=gtk_label_new(title_string); g_free(title_string); gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); @@ -278,7 +285,7 @@ gtk_rpcstat_init(char *optarg) } - error_string=register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw); + error_string=register_tap_listener("rpc", rs, filter, rpcstat_reset, rpcstat_packet, rpcstat_draw); if(error_string){ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); g_string_free(error_string, TRUE); @@ -292,15 +299,15 @@ gtk_rpcstat_init(char *optarg) gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb); + window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb); - SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL); SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs); - gtk_widget_show_all(rs->win); - window_present(rs->win); + gtk_widget_show_all(rs->win); + window_present(rs->win); - retap_packets(&cfile); + retap_packets(&cfile); } @@ -534,4 +541,3 @@ register_tap_listener_gtkrpcstat(void) register_tap_menu_item("ONC-RPC...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_rpcstat_cb, NULL, NULL, NULL); } - diff --git a/gtk/rtp_stream.c b/gtk/rtp_stream.c index 9b015b904c..f5caf80e74 100644 --- a/gtk/rtp_stream.c +++ b/gtk/rtp_stream.c @@ -116,9 +116,14 @@ void rtpstream_reset(rtpstream_tapinfo_t *tapinfo) return; } +static void rtpstream_reset_cb(void *arg) +{ + rtpstream_reset(arg); +} + /****************************************************************************/ /* redraw the output */ -void rtpstream_draw(rtpstream_tapinfo_t *tapinfo _U_) +void rtpstream_draw(void *arg _U_) { /* XXX: see rtpstream_on_update in rtp_streams_dlg.c for comments gtk_signal_emit_by_name(top_level, "signal_rtpstream_update"); @@ -197,8 +202,10 @@ static void rtp_write_sample(rtp_sample_t* sample, FILE* file) /****************************************************************************/ /* whenever a RTP packet is seen by the tap listener */ -int rtpstream_packet(rtpstream_tapinfo_t *tapinfo _U_, packet_info *pinfo, epan_dissect_t *edt _U_, struct _rtp_info *rtpinfo _U_) +static int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2) { + rtpstream_tapinfo_t *tapinfo = arg; + const struct _rtp_info *rtpinfo = arg2; rtp_stream_info_t tmp_strinfo; rtp_stream_info_t *strinfo = NULL; GList* list; @@ -397,8 +404,8 @@ register_tap_listener_rtp_stream(void) register_ethereal_tap("rtp", rtpstream_init_tap); error_string = register_tap_listener("rtp", &the_tapinfo_struct, - NULL, - (void*)rtpstream_reset, (void*)rtpstream_packet, (void*)rtpstream_draw); + NULL, rtpstream_reset_cb, rtpstream_packet, + rtpstream_draw); if (error_string != NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, diff --git a/tap-iostat.c b/tap-iostat.c index da84b631f6..e9cdac6284 100644 --- a/tap-iostat.c +++ b/tap-iostat.c @@ -67,8 +67,9 @@ typedef struct _io_stat_item_t { static int -iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_, void *dummy _U_) +iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, void *dummy _U_) { + io_stat_item_t *mit = arg; io_stat_item_t *it; gint32 current_time; GPtrArray *gp; @@ -249,8 +250,9 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_, } static void -iostat_draw(io_stat_item_t *mit) +iostat_draw(void *arg) { + io_stat_item_t *mit = arg; io_stat_t *iot; io_stat_item_t **items; guint32 *frames; @@ -561,7 +563,7 @@ CALC_TYPE_MAX 4 CALC_TYPE_AVG 5 */ - error_string=register_tap_listener("frame", &io->items[i], flt, NULL, (void*)iostat_packet, i?NULL:(void*)iostat_draw); + error_string=register_tap_listener("frame", &io->items[i], flt, NULL, iostat_packet, i?NULL:iostat_draw); if(error_string){ g_free(io->items); g_free(io); @@ -650,4 +652,3 @@ register_tap_listener_iostat(void) { register_ethereal_tap("io,stat,", iostat_init); } - diff --git a/tap-iousers.c b/tap-iousers.c index b63100ff6f..e1a93d07df 100644 --- a/tap-iousers.c +++ b/tap-iousers.c @@ -68,9 +68,10 @@ typedef struct _io_users_item_t { static int -iousers_udpip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vudph) +iousers_udpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vudph) { - e_udphdr *udph=vudph; + io_users_t *iu=arg; + const e_udphdr *udph=vudph; char name1[256],name2[256]; io_users_item_t *iui; int direction=0; @@ -127,9 +128,10 @@ iousers_udpip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_ static int -iousers_tcpip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vtcph) +iousers_tcpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vtcph) { - struct tcpheader *tcph=vtcph; + io_users_t *iu=arg; + const struct tcpheader *tcph=vtcph; char name1[256],name2[256]; io_users_item_t *iui; int direction=0; @@ -186,10 +188,11 @@ iousers_tcpip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_ static int -iousers_ip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vip) +iousers_ip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { - e_ip *iph=vip; - address *addr1, *addr2; + io_users_t *iu=arg; + const e_ip *iph=vip; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&iph->ip_src, &iph->ip_dst)>0){ @@ -233,10 +236,11 @@ iousers_ip_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, v } static int -iousers_ipx_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vipx) +iousers_ipx_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vipx) { - ipxhdr_t *ipxh=vipx; - address *addr1, *addr2; + io_users_t *iu=arg; + const ipxhdr_t *ipxh=vipx; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&ipxh->ipx_src, &ipxh->ipx_dst)>0){ @@ -280,10 +284,11 @@ iousers_ipx_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, } static int -iousers_fc_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vfc) +iousers_fc_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vfc) { - fc_hdr *fchdr=vfc; - address *addr1, *addr2; + io_users_t *iu=arg; + const fc_hdr *fchdr=vfc; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&fchdr->s_id, &fchdr->d_id)<0){ @@ -327,10 +332,11 @@ iousers_fc_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, v } static int -iousers_eth_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *veth) +iousers_eth_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *veth) { - eth_hdr *ehdr=veth; - address *addr1, *addr2; + io_users_t *iu=arg; + const eth_hdr *ehdr=veth; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&ehdr->src, &ehdr->dst)<0){ @@ -374,10 +380,11 @@ iousers_eth_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, } static int -iousers_fddi_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *veth) +iousers_fddi_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *veth) { - fddi_hdr *ehdr=veth; - address *addr1, *addr2; + io_users_t *iu=arg; + const fddi_hdr *ehdr=veth; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&ehdr->src, &ehdr->dst)<0){ @@ -421,10 +428,11 @@ iousers_fddi_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, } static int -iousers_tr_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, void *vtr) +iousers_tr_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vtr) { - tr_hdr *trhdr=vtr; - address *addr1, *addr2; + io_users_t *iu=arg; + const tr_hdr *trhdr=vtr; + const address *addr1, *addr2; io_users_item_t *iui; if(CMP_ADDRESS(&trhdr->src, &trhdr->dst)<0){ @@ -468,8 +476,9 @@ iousers_tr_packet(io_users_t *iu, packet_info *pinfo, epan_dissect_t *edt _U_, v } static void -iousers_draw(io_users_t *iu) +iousers_draw(void *arg) { + io_users_t *iu = arg; io_users_item_t *iui; guint32 last_frames, max_frames; @@ -514,7 +523,7 @@ iousers_init(char *optarg) { char *filter=NULL; char *tap_type, *tap_type_name; - static int (*packet_func)(io_users_t *, packet_info *, epan_dissect_t *, void *); + tap_packet_cb packet_func; io_users_t *iu=NULL; GString *error_string; @@ -614,7 +623,7 @@ iousers_init(char *optarg) iu->filter=NULL; } - error_string=register_tap_listener(tap_type, iu, filter, NULL, (void*)packet_func, (void*)iousers_draw); + error_string=register_tap_listener(tap_type, iu, filter, NULL, packet_func, iousers_draw); if(error_string){ if(iu->items){ g_free(iu->items); @@ -633,4 +642,3 @@ register_tap_listener_iousers(void) { register_ethereal_tap("conv,", iousers_init); } -