diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-04-01 09:08:27 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-04-01 09:08:27 +0000 |
commit | 6a33606bd0b861b08d08ca62ccee8dc85640c4fc (patch) | |
tree | f40c994e197238fcb60ea9206222296805d55dfb /gtk | |
parent | cb4ac46b1d418cefdfe6fa7e13dc398b9e58b296 (diff) |
Rename "register_ethereal_tap()" to "register_tap_listener_cmd_arg()" as
it's used to register a callback for a tap listener invoked if the
specified command line argument is specified to the "-z" flag.
Move it, along with routines to:
look up a "-z" argument in the table constructed by
"register_tap_listener_cmd_arg()" and either save the full
argument to "-z" and the corresponding listener if it's found or
return a failure indication if it isn't;
list the available tap listeners;
call the "init" routines for the tap listeners saved in the
table above;
and have Ethereal and Tethereal use those routines.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13993 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk')
46 files changed, 58 insertions, 111 deletions
diff --git a/gtk/ansi_a_stat.c b/gtk/ansi_a_stat.c index f34754ada9..7c2337e524 100644 --- a/gtk/ansi_a_stat.c +++ b/gtk/ansi_a_stat.c @@ -460,7 +460,7 @@ register_tap_listener_gtkansi_a_stat(void) GString *err_p; - register_ethereal_tap("ansi_a,", ansi_a_stat_gtk_init); + register_tap_listener_cmd_arg("ansi_a,", ansi_a_stat_gtk_init); memset((void *) &stat, 0, sizeof(ansi_a_stat_t)); diff --git a/gtk/ansi_map_stat.c b/gtk/ansi_map_stat.c index 16bc2b76a6..9260822724 100644 --- a/gtk/ansi_map_stat.c +++ b/gtk/ansi_map_stat.c @@ -424,7 +424,7 @@ register_tap_listener_gtkansi_map_stat(void) GString *err_p; - register_ethereal_tap("ansi_map,", ansi_map_stat_gtk_init); + register_tap_listener_cmd_arg("ansi_map,", ansi_map_stat_gtk_init); memset((void *) &stat, 0, sizeof(ansi_map_stat_t)); diff --git a/gtk/bootp_stat.c b/gtk/bootp_stat.c index cf8e910ca9..261cd851cc 100644 --- a/gtk/bootp_stat.c +++ b/gtk/bootp_stat.c @@ -281,7 +281,7 @@ static tap_dfilter_dlg dhcp_stat_dlg = { void register_tap_listener_gtkdhcpstat(void) { - register_ethereal_tap("bootp,stat", dhcpstat_init); + register_tap_listener_cmd_arg("bootp,stat", dhcpstat_init); register_tap_menu_item("BOOTP-DHCP", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(dhcp_stat_dlg)); diff --git a/gtk/conversations_eth.c b/gtk/conversations_eth.c index 4196f25124..4ed203c483 100644 --- a/gtk/conversations_eth.c +++ b/gtk/conversations_eth.c @@ -78,7 +78,7 @@ eth_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_eth_conversation(void) { - register_ethereal_tap("conv,eth", eth_conversation_init); + register_tap_listener_cmd_arg("conv,eth", eth_conversation_init); register_tap_menu_item("Ethernet", REGISTER_TAP_GROUP_CONVERSATION_LIST, eth_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_fc.c b/gtk/conversations_fc.c index 01b9662560..8cbd055a46 100644 --- a/gtk/conversations_fc.c +++ b/gtk/conversations_fc.c @@ -78,7 +78,7 @@ fc_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_fc_conversation(void) { - register_ethereal_tap("conv,fc", fc_conversation_init); + register_tap_listener_cmd_arg("conv,fc", fc_conversation_init); register_tap_menu_item("Fibre Channel", REGISTER_TAP_GROUP_CONVERSATION_LIST, fc_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_fddi.c b/gtk/conversations_fddi.c index 317423305b..c9db23f57a 100644 --- a/gtk/conversations_fddi.c +++ b/gtk/conversations_fddi.c @@ -78,7 +78,7 @@ fddi_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_fddi_conversation(void) { - register_ethereal_tap("conv,fddi", fddi_conversation_init); + register_tap_listener_cmd_arg("conv,fddi", fddi_conversation_init); register_tap_menu_item("FDDI", REGISTER_TAP_GROUP_CONVERSATION_LIST, fddi_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_ip.c b/gtk/conversations_ip.c index d2811801e4..e5b29dbdae 100644 --- a/gtk/conversations_ip.c +++ b/gtk/conversations_ip.c @@ -76,7 +76,7 @@ ip_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_ip_conversation(void) { - register_ethereal_tap("conv,ip", ip_conversation_init); + register_tap_listener_cmd_arg("conv,ip", ip_conversation_init); register_tap_menu_item("IPv4", REGISTER_TAP_GROUP_CONVERSATION_LIST, ip_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_ipx.c b/gtk/conversations_ipx.c index 634d7d56e7..ad564bf043 100644 --- a/gtk/conversations_ipx.c +++ b/gtk/conversations_ipx.c @@ -78,7 +78,7 @@ ipx_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_ipx_conversation(void) { - register_ethereal_tap("conv,ipx", ipx_conversation_init); + register_tap_listener_cmd_arg("conv,ipx", ipx_conversation_init); register_tap_menu_item("IPX", REGISTER_TAP_GROUP_CONVERSATION_LIST, ipx_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_sctp.c b/gtk/conversations_sctp.c index 1b9a94bbe0..cfe36031dc 100644 --- a/gtk/conversations_sctp.c +++ b/gtk/conversations_sctp.c @@ -87,7 +87,7 @@ sctp_conversation_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_sctp_conversation(void) { - register_ethereal_tap("conv,sctp", sctp_conversation_init); + register_tap_listener_cmd_arg("conv,sctp", sctp_conversation_init); register_tap_menu_item("SCTP", REGISTER_TAP_GROUP_CONVERSATION_LIST, sctp_conversation_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_tcpip.c b/gtk/conversations_tcpip.c index 4e85e08964..7500e65fb1 100644 --- a/gtk/conversations_tcpip.c +++ b/gtk/conversations_tcpip.c @@ -78,7 +78,7 @@ tcpip_conversation_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_tcpip_conversation(void) { - register_ethereal_tap("conv,tcp", tcpip_conversation_init); + register_tap_listener_cmd_arg("conv,tcp", tcpip_conversation_init); register_tap_menu_item("TCP (IPv4 & IPv6)", REGISTER_TAP_GROUP_CONVERSATION_LIST, tcpip_conversation_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_tr.c b/gtk/conversations_tr.c index 93d5a65a92..8884e66249 100644 --- a/gtk/conversations_tr.c +++ b/gtk/conversations_tr.c @@ -78,7 +78,7 @@ tr_conversation_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_tr_conversation(void) { - register_ethereal_tap("conv,tr", tr_conversation_init); + register_tap_listener_cmd_arg("conv,tr", tr_conversation_init); register_tap_menu_item("Token Ring", REGISTER_TAP_GROUP_CONVERSATION_LIST, tr_conversation_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_udpip.c b/gtk/conversations_udpip.c index a78b42550c..f24dae9b26 100644 --- a/gtk/conversations_udpip.c +++ b/gtk/conversations_udpip.c @@ -78,7 +78,7 @@ udpip_conversation_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_udpip_conversation(void) { - register_ethereal_tap("conv,udp", udpip_conversation_init); + register_tap_listener_cmd_arg("conv,udp", udpip_conversation_init); register_tap_menu_item("UDP (IPv4 & IPv6)", REGISTER_TAP_GROUP_CONVERSATION_LIST, udpip_conversation_cb, NULL, NULL, NULL); diff --git a/gtk/conversations_wlan.c b/gtk/conversations_wlan.c index 0faf6132a9..a2312a04c4 100644 --- a/gtk/conversations_wlan.c +++ b/gtk/conversations_wlan.c @@ -78,7 +78,7 @@ wlan_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_wlan_conversation(void) { - register_ethereal_tap("conv,wlan", wlan_conversation_init); + register_tap_listener_cmd_arg("conv,wlan", wlan_conversation_init); register_tap_menu_item("WLAN", REGISTER_TAP_GROUP_CONVERSATION_LIST, wlan_endpoints_cb, NULL, NULL, NULL); diff --git a/gtk/dcerpc_stat.c b/gtk/dcerpc_stat.c index 3ef040435d..2947fa1b3d 100644 --- a/gtk/dcerpc_stat.c +++ b/gtk/dcerpc_stat.c @@ -675,7 +675,7 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtkdcerpcstat(void) { - register_ethereal_tap("dcerpc,srt,", gtk_dcerpcstat_init); + register_tap_listener_cmd_arg("dcerpc,srt,", gtk_dcerpcstat_init); register_tap_menu_item("DCE-RPC...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_dcerpcstat_cb, NULL, NULL, NULL); diff --git a/gtk/fc_stat.c b/gtk/fc_stat.c index 376b8abf56..99378e72bd 100644 --- a/gtk/fc_stat.c +++ b/gtk/fc_stat.c @@ -312,7 +312,7 @@ gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtkfcstat(void) { - register_ethereal_tap("fc,srt", gtk_fcstat_init); + register_tap_listener_cmd_arg("fc,srt", gtk_fcstat_init); register_tap_menu_item("Fibre Channel...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_fcstat_cb, NULL, NULL, NULL); diff --git a/gtk/gsm_a_stat.c b/gtk/gsm_a_stat.c index b45d2a93d5..a6c0e6fc6c 100644 --- a/gtk/gsm_a_stat.c +++ b/gtk/gsm_a_stat.c @@ -620,7 +620,7 @@ register_tap_listener_gtkgsm_a_stat(void) GString *err_p; - register_ethereal_tap("gsm_a,", gsm_a_stat_gtk_init); + register_tap_listener_cmd_arg("gsm_a,", gsm_a_stat_gtk_init); memset((void *) &stat, 0, sizeof(gsm_a_stat_t)); diff --git a/gtk/gsm_map_stat.c b/gtk/gsm_map_stat.c index 883fe71305..c4f7d03f2b 100644 --- a/gtk/gsm_map_stat.c +++ b/gtk/gsm_map_stat.c @@ -458,7 +458,7 @@ register_tap_listener_gtkgsm_map_stat(void) GString *err_p; - register_ethereal_tap("gsm_map,", gsm_map_stat_gtk_init); + register_tap_listener_cmd_arg("gsm_map,", gsm_map_stat_gtk_init); memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t)); diff --git a/gtk/h225_counter.c b/gtk/h225_counter.c index df45102b1f..2b4bf3df24 100644 --- a/gtk/h225_counter.c +++ b/gtk/h225_counter.c @@ -562,7 +562,7 @@ gtk_h225counter_init(char *optarg) void register_tap_listener_gtk_h225counter(void) { - register_ethereal_tap("h225,counter", gtk_h225counter_init); + register_tap_listener_cmd_arg("h225,counter", gtk_h225counter_init); register_tap_menu_item("H.225...", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(h225_counter_dlg)); diff --git a/gtk/h225_ras_srt.c b/gtk/h225_ras_srt.c index daedacccae..add30db5cf 100644 --- a/gtk/h225_ras_srt.c +++ b/gtk/h225_ras_srt.c @@ -342,7 +342,7 @@ gtk_h225rassrt_init(char *optarg) void register_tap_listener_gtk_h225rassrt(void) { - register_ethereal_tap("h225,srt", gtk_h225rassrt_init); + register_tap_listener_cmd_arg("h225,srt", gtk_h225rassrt_init); register_tap_menu_item("H.225 RAS...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(h225_rassrt_dlg)); diff --git a/gtk/hostlist_eth.c b/gtk/hostlist_eth.c index 2a7ebfc502..b7a93c3cd5 100644 --- a/gtk/hostlist_eth.c +++ b/gtk/hostlist_eth.c @@ -83,7 +83,7 @@ gtk_eth_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_eth_hostlist(void) { - register_ethereal_tap("hosts,eth", gtk_eth_hostlist_init); + register_tap_listener_cmd_arg("hosts,eth", gtk_eth_hostlist_init); register_tap_menu_item("Ethernet", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_eth_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_fc.c b/gtk/hostlist_fc.c index 22b18e956e..886e58a7b3 100644 --- a/gtk/hostlist_fc.c +++ b/gtk/hostlist_fc.c @@ -83,7 +83,7 @@ gtk_fc_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_fc_hostlist(void) { - register_ethereal_tap("hosts,fc", gtk_fc_hostlist_init); + register_tap_listener_cmd_arg("hosts,fc", gtk_fc_hostlist_init); register_tap_menu_item("Fibre Channel", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_fc_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_fddi.c b/gtk/hostlist_fddi.c index 5f2083005d..81198fde01 100644 --- a/gtk/hostlist_fddi.c +++ b/gtk/hostlist_fddi.c @@ -83,7 +83,7 @@ gtk_fddi_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_fddi_hostlist(void) { - register_ethereal_tap("hosts,fddi", gtk_fddi_hostlist_init); + register_tap_listener_cmd_arg("hosts,fddi", gtk_fddi_hostlist_init); register_tap_menu_item("FDDI", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_fddi_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_ip.c b/gtk/hostlist_ip.c index cc6294e4ba..57f456cd6c 100644 --- a/gtk/hostlist_ip.c +++ b/gtk/hostlist_ip.c @@ -82,7 +82,7 @@ gtk_ip_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_ip_hostlist(void) { - register_ethereal_tap("hosts,ip", gtk_ip_hostlist_init); + register_tap_listener_cmd_arg("hosts,ip", gtk_ip_hostlist_init); register_tap_menu_item("IPv4", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_ip_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_ipx.c b/gtk/hostlist_ipx.c index a266796fcd..b48930af21 100644 --- a/gtk/hostlist_ipx.c +++ b/gtk/hostlist_ipx.c @@ -83,7 +83,7 @@ gtk_ipx_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_ipx_hostlist(void) { - register_ethereal_tap("hosts,ipx", gtk_ipx_hostlist_init); + register_tap_listener_cmd_arg("hosts,ipx", gtk_ipx_hostlist_init); register_tap_menu_item("IPX", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_ipx_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_tcpip.c b/gtk/hostlist_tcpip.c index 13a4ae0e21..72f28fc9ca 100644 --- a/gtk/hostlist_tcpip.c +++ b/gtk/hostlist_tcpip.c @@ -83,7 +83,7 @@ gtk_tcpip_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_tcpip_hostlist(void) { - register_ethereal_tap("endpoints,tcp", gtk_tcpip_hostlist_init); + register_tap_listener_cmd_arg("endpoints,tcp", gtk_tcpip_hostlist_init); register_tap_menu_item("TCP (IPv4 & IPv6)", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_tcpip_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_tr.c b/gtk/hostlist_tr.c index 1cac21c34f..af21ca6ca3 100644 --- a/gtk/hostlist_tr.c +++ b/gtk/hostlist_tr.c @@ -83,7 +83,7 @@ gtk_tr_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_tr_hostlist(void) { - register_ethereal_tap("hosts,tr", gtk_tr_hostlist_init); + register_tap_listener_cmd_arg("hosts,tr", gtk_tr_hostlist_init); register_tap_menu_item("Token Ring", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_tr_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_udpip.c b/gtk/hostlist_udpip.c index 1e4ecebc04..6d86a16ba7 100644 --- a/gtk/hostlist_udpip.c +++ b/gtk/hostlist_udpip.c @@ -83,7 +83,7 @@ gtk_udpip_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_udpip_hostlist(void) { - register_ethereal_tap("endpoints,udp", gtk_udpip_hostlist_init); + register_tap_listener_cmd_arg("endpoints,udp", gtk_udpip_hostlist_init); register_tap_menu_item("UDP (IPv4 & IPv6)", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_udpip_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/hostlist_wlan.c b/gtk/hostlist_wlan.c index 00034c5863..07de604544 100644 --- a/gtk/hostlist_wlan.c +++ b/gtk/hostlist_wlan.c @@ -81,7 +81,7 @@ gtk_wlan_hostlist_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_wlan_hostlist(void) { - register_ethereal_tap("hosts,wlan", gtk_wlan_hostlist_init); + register_tap_listener_cmd_arg("hosts,wlan", gtk_wlan_hostlist_init); register_tap_menu_item("WLAN", REGISTER_TAP_GROUP_ENDPOINT_LIST, gtk_wlan_hostlist_cb, NULL, NULL, NULL); diff --git a/gtk/http_stat.c b/gtk/http_stat.c index 195e12898c..0defcfebe6 100644 --- a/gtk/http_stat.c +++ b/gtk/http_stat.c @@ -515,7 +515,7 @@ static tap_dfilter_dlg http_stat_dlg = { void register_tap_listener_gtkhttpstat(void) { - register_ethereal_tap("http,stat", gtk_httpstat_init); + register_tap_listener_cmd_arg("http,stat", gtk_httpstat_init); register_tap_menu_item("HTTP/Packet Counter", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(http_stat_dlg)); diff --git a/gtk/io_stat.c b/gtk/io_stat.c index 8bb636789a..1bef7e107c 100644 --- a/gtk/io_stat.c +++ b/gtk/io_stat.c @@ -1930,7 +1930,7 @@ gtk_iostat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtk_iostat(void) { - register_ethereal_tap("io,stat", gtk_iostat_init); + register_tap_listener_cmd_arg("io,stat", gtk_iostat_init); register_tap_menu_item("_IO Graphs", REGISTER_TAP_GROUP_GENERIC, gtk_iostat_cb, NULL, NULL, NULL); diff --git a/gtk/isup_stat.c b/gtk/isup_stat.c index befac9102a..795f4a64c0 100644 --- a/gtk/isup_stat.c +++ b/gtk/isup_stat.c @@ -398,7 +398,7 @@ register_tap_listener_gtkisup_stat(void) GString *err_p; - register_ethereal_tap("isup,", isup_stat_gtk_init); + register_tap_listener_cmd_arg("isup,", isup_stat_gtk_init); memset((void *) &stat, 0, sizeof(isup_stat_t)); diff --git a/gtk/ldap_stat.c b/gtk/ldap_stat.c index 2b6e638a43..da6149ef4b 100644 --- a/gtk/ldap_stat.c +++ b/gtk/ldap_stat.c @@ -347,7 +347,7 @@ gtk_ldapstat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtkldapstat(void) { - register_ethereal_tap("ldap,srt", gtk_ldapstat_init); + register_tap_listener_cmd_arg("ldap,srt", gtk_ldapstat_init); register_tap_menu_item("LDAP...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_ldapstat_cb, NULL, NULL, NULL); diff --git a/gtk/main.c b/gtk/main.c index 0a2544e450..9b2666b1ca 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1172,28 +1172,6 @@ unprotect_thread_critical_region(void) #endif } -/* structure to keep track of what tap listeners have been registered. - */ -typedef struct _ethereal_tap_list { - struct _ethereal_tap_list *next; - char *cmd; - void (*func)(char *arg); -} ethereal_tap_list; -static ethereal_tap_list *tap_list=NULL; - -void -register_ethereal_tap(char *cmd, void (*func)(char *arg)) -{ - ethereal_tap_list *newtl; - - newtl=malloc(sizeof(ethereal_tap_list)); - newtl->next=tap_list; - tap_list=newtl; - newtl->cmd=cmd; - newtl->func=func; - -} - /* Set the file name in the status line, in the name for the main window, and in the name for the main window's icon. */ static void @@ -1478,11 +1456,6 @@ void main_cf_callback(gint event, gpointer data, gpointer user_data _U_) } } -typedef struct { - ethereal_tap_list *tli; - char *arg; -} tap_to_run_t; - /* And now our feature presentation... [ fade to music ] */ int main(int argc, char *argv[]) @@ -1530,9 +1503,6 @@ main(int argc, char *argv[]) gboolean rfilter_parse_failed = FALSE; e_prefs *prefs; char badopt; - ethereal_tap_list *tli; - tap_to_run_t *tap_to_run; - GSList *taps_to_run = NULL; GtkWidget *splash_win = NULL; gboolean capture_child; /* True if this is the child for "-S" */ @@ -1972,28 +1942,17 @@ main(int argc, char *argv[]) exit(0); break; case 'z': - for(tli=tap_list;tli;tli=tli->next){ - if(!strncmp(tli->cmd,optarg,strlen(tli->cmd))){ - /* We won't call the init function for the tap this soon - as it would disallow MATE's fields (which are registered - by the preferences set callback) from being used as - part of a tap filter. Instead, we just add the argument - to a list of tap arguments. */ - tap_to_run = g_malloc(sizeof (tap_to_run_t)); - tap_to_run->tli = tli; - tap_to_run->arg = g_strdup(optarg); - taps_to_run = g_slist_append(taps_to_run, tap_to_run); - break; - } - } - if(!tli){ - fprintf(stderr,"ethereal: invalid -z argument.\n"); - fprintf(stderr," -z argument must be one of :\n"); - for(tli=tap_list;tli;tli=tli->next){ - fprintf(stderr," %s\n",tli->cmd); - } - exit(1); - } + /* We won't call the init function for the tap this soon + as it would disallow MATE's fields (which are registered + by the preferences set callback) from being used as + part of a tap filter. Instead, we just add the argument + to a list of tap arguments. */ + if (!process_tap_cmd_arg(optarg)) { + fprintf(stderr,"ethereal: invalid -z argument.\n"); + fprintf(stderr," -z argument must be one of :\n"); + list_tap_cmd_args(); + exit(1); + } break; default: case '?': /* Bad flag - print usage message */ @@ -2338,13 +2297,7 @@ main(int argc, char *argv[]) registered its field array and we can have a filter with one of MATE's late-registered fields as part of the tap's filter. */ - while (taps_to_run != NULL) { - tap_to_run = taps_to_run->data; - (*tap_to_run->tli->func)(tap_to_run->arg); - g_free(tap_to_run->arg); - g_free(tap_to_run); - taps_to_run = g_slist_remove(taps_to_run, tap_to_run); - } + start_requested_taps(); /* Read the capture file. */ switch (cf_read(&cfile)) { @@ -2398,13 +2351,7 @@ main(int argc, char *argv[]) registered its field array and we can have a filter with one of MATE's late-registered fields as part of the tap's filter. */ - while (taps_to_run != NULL) { - tap_to_run = taps_to_run->data; - (*tap_to_run->tli->func)(tap_to_run->arg); - g_free(tap_to_run->arg); - g_free(tap_to_run); - taps_to_run = g_slist_remove(taps_to_run, tap_to_run); - } + start_requested_taps(); } } else { diff --git a/gtk/mgcp_stat.c b/gtk/mgcp_stat.c index 1f4d8b67a4..9775071601 100644 --- a/gtk/mgcp_stat.c +++ b/gtk/mgcp_stat.c @@ -326,7 +326,7 @@ register_tap_listener_gtkmgcpstat(void) { /* We don't register this tap, if we don't have the mgcp plugin loaded.*/ if (find_tap_id("mgcp")) { - register_ethereal_tap("mgcp,srt", gtk_mgcpstat_init); + register_tap_listener_cmd_arg("mgcp,srt", gtk_mgcpstat_init); register_tap_menu_item("MGCP...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(mgcp_srt_dlg)); diff --git a/gtk/mtp3_stat.c b/gtk/mtp3_stat.c index 76b9206704..70dc5ee566 100644 --- a/gtk/mtp3_stat.c +++ b/gtk/mtp3_stat.c @@ -447,7 +447,7 @@ register_tap_listener_gtkmtp3_stat(void) GString *err_p; - register_ethereal_tap("mtp3,", mtp3_stat_gtk_init); + register_tap_listener_cmd_arg("mtp3,", mtp3_stat_gtk_init); memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat_t)); diff --git a/gtk/rpc_progs.c b/gtk/rpc_progs.c index f585c49070..9d674deb18 100644 --- a/gtk/rpc_progs.c +++ b/gtk/rpc_progs.c @@ -418,7 +418,7 @@ gtk_rpcprogs_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtkrpcprogs(void) { - register_ethereal_tap("rpc,programs", gtk_rpcprogs_init); + register_tap_listener_cmd_arg("rpc,programs", gtk_rpcprogs_init); register_tap_menu_item("ONC-RPC Programs", REGISTER_TAP_GROUP_NONE, gtk_rpcprogs_cb, NULL, NULL, NULL); diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c index 5da4615889..cffc0db23a 100644 --- a/gtk/rpc_stat.c +++ b/gtk/rpc_stat.c @@ -536,7 +536,7 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtkrpcstat(void) { - register_ethereal_tap("rpc,srt,", gtk_rpcstat_init); + register_tap_listener_cmd_arg("rpc,srt,", gtk_rpcstat_init); register_tap_menu_item("ONC-RPC...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_rpcstat_cb, NULL, NULL, NULL); diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 066b84a32d..b1f4ab43ae 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -3649,7 +3649,7 @@ rtp_analysis_init(char *dummy _U_) void register_tap_listener_rtp_analysis(void) { - register_ethereal_tap("rtp", rtp_analysis_init); + register_tap_listener_cmd_arg("rtp", rtp_analysis_init); register_tap_menu_item("RTP/Stream Analysis...", REGISTER_TAP_GROUP_NONE, rtp_analysis_cb, NULL, NULL, NULL); diff --git a/gtk/rtp_stream.c b/gtk/rtp_stream.c index feb1f1bbf2..4ddb0b9c70 100644 --- a/gtk/rtp_stream.c +++ b/gtk/rtp_stream.c @@ -438,7 +438,7 @@ register_tap_listener_rtp_stream(void) GString *error_string; if (!the_tapinfo_struct.is_registered) { - register_ethereal_tap("rtp", rtpstream_init_tap); + register_tap_listener_cmd_arg("rtp", rtpstream_init_tap); error_string = register_tap_listener("rtp", &the_tapinfo_struct, NULL, rtpstream_reset_cb, rtpstream_packet, diff --git a/gtk/sctp_chunk_stat.c b/gtk/sctp_chunk_stat.c index 9ae5141f7c..94e051d583 100644 --- a/gtk/sctp_chunk_stat.c +++ b/gtk/sctp_chunk_stat.c @@ -344,7 +344,7 @@ sctpstat_init(char *optarg) void register_tap_listener_sctpstat(void) { - register_ethereal_tap("sctp,stat", sctpstat_init); + register_tap_listener_cmd_arg("sctp,stat", sctpstat_init); register_tap_menu_item("SCTP/Chunk Counter", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(sctp_stat_dlg)); diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c index 9ffc6ac2dd..68dbe8515e 100644 --- a/gtk/sctp_stat.c +++ b/gtk/sctp_stat.c @@ -1448,7 +1448,7 @@ register_tap_listener_sctp_stat(void) if (!sctp_tapinfo_struct.is_registered) { - register_ethereal_tap("sctp",gtk_sctpstat_init); + register_tap_listener_cmd_arg("sctp",gtk_sctpstat_init); if ((error_string = register_tap_listener("sctp", &sctp_tapinfo_struct, NULL, reset, packet, sctp_update))) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); g_string_free(error_string, TRUE); diff --git a/gtk/sip_stat.c b/gtk/sip_stat.c index 9560bf321b..c0de0c4379 100644 --- a/gtk/sip_stat.c +++ b/gtk/sip_stat.c @@ -662,7 +662,7 @@ static tap_dfilter_dlg sip_stat_dlg = { void register_tap_listener_gtksipstat(void) { - register_ethereal_tap("sip,stat", gtk_sipstat_init); + register_tap_listener_cmd_arg("sip,stat", gtk_sipstat_init); register_tap_menu_item("SIP", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(sip_stat_dlg)); diff --git a/gtk/smb_stat.c b/gtk/smb_stat.c index 240cbfb0d7..4b87d871d7 100644 --- a/gtk/smb_stat.c +++ b/gtk/smb_stat.c @@ -351,7 +351,7 @@ gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_) void register_tap_listener_gtksmbstat(void) { - register_ethereal_tap("smb,srt", gtk_smbstat_init); + register_tap_listener_cmd_arg("smb,srt", gtk_smbstat_init); register_tap_menu_item("SMB...", REGISTER_TAP_GROUP_RESPONSE_TIME, gtk_smbstat_cb, NULL, NULL, NULL); diff --git a/gtk/stats_tree_stat.c b/gtk/stats_tree_stat.c index 2573b229e3..07394ebe54 100644 --- a/gtk/stats_tree_stat.c +++ b/gtk/stats_tree_stat.c @@ -370,7 +370,7 @@ static void register_gtk_stats_tree_tap (gpointer k _U_, gpointer v, gpointer p s = g_strdup_printf("%s,tree",cfg->abbr); - register_ethereal_tap(s, init_gtk_tree); + register_tap_listener_cmd_arg(s, init_gtk_tree); cfg->pr = g_malloc(sizeof(tree_pres)); diff --git a/gtk/voip_calls_dlg.c b/gtk/voip_calls_dlg.c index 00e8319b39..2e718d2dc3 100644 --- a/gtk/voip_calls_dlg.c +++ b/gtk/voip_calls_dlg.c @@ -766,7 +766,7 @@ void voip_calls_launch(GtkWidget *w _U_, gpointer data _U_) void register_tap_listener_voip_calls_dlg(void) { - register_ethereal_tap("voip,calls",voip_calls_init_tap); + register_tap_listener_cmd_arg("voip,calls",voip_calls_init_tap); register_tap_menu_item("VoIP Calls...", REGISTER_TAP_GROUP_NONE, voip_calls_launch, NULL, NULL, NULL); diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c index 6a9e143f19..903987bbb7 100644 --- a/gtk/wsp_stat.c +++ b/gtk/wsp_stat.c @@ -425,7 +425,7 @@ static tap_dfilter_dlg wsp_stat_dlg = { void register_tap_listener_gtkwspstat(void) { - register_ethereal_tap("wsp,stat", gtk_wspstat_init); + register_tap_listener_cmd_arg("wsp,stat", gtk_wspstat_init); register_tap_menu_item("WAP-WSP...", REGISTER_TAP_GROUP_NONE, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(wsp_stat_dlg)); |