timestamp_set_type(TS_RELATIVE);
timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
+#ifdef HAVE_PLUGINS
+ /* Register all the plugin types we have. */
+ epan_register_plugin_types(); /* Types known to libwireshark */
+
+ /* Scan for plugins. This does *not* call their registration routines;
+ that's done later. */
+ scan_plugins();
+#endif
+
/* Register all dissectors; we must do this before checking for the
"-g" flag, as the "-g" flag dumps a list of fields registered
by the dissectors, and we must do it before we read the preferences,
static void
sid_snooping_init(void)
{
- gchar *error_string;
+ GString *error_string;
if(lsa_policy_information_tap_installed){
remove_tap_listener(&lsa_policy_information_tap_installed);
/* error, we failed to attach to the tap. clean up */
report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/lsa_policy_information tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
lsa_policy_information_tap_installed=TRUE;
/* error, we failed to attach to the tap. clean up */
report_failure( "Couldn't register proto_reg_handoff_smb_sidsnooping()/samr_query_dispinfo tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
samr_query_dispinfo_tap_installed=TRUE;
const ntlmssp_header_t *ntlmssph;
if (!ntlmssp_tap_id) {
- gchar *error_string;
+ GString *error_string;
/* We don't specify any callbacks at all.
* Instead we manually fetch the tapped data after the
* security blob has been fully dissected and before
if (!error_string) {
ntlmssp_tap_id = find_tap_id("ntlmssp");
} else {
- wmem_free(NULL, error_string);
+ g_string_free(error_string, TRUE);
}
}
int idx;
if (!ntlmssp_tap_id) {
- gchar *error_string;
+ GString *error_string;
/* We don't specify any callbacks at all.
* Instead we manually fetch the tapped data after the
* security blob has been fully dissected and before
if (!error_string) {
ntlmssp_tap_id = find_tap_id("ntlmssp");
} else {
- wmem_free(NULL, error_string);
+ g_string_free(error_string, TRUE);
}
}
#include <stdarg.h>
#include <wsutil/wsgcrypt.h>
-#include <wsutil/plugins.h>
#ifdef HAVE_LIBGNUTLS
#include <gnutls/gnutls.h>
#ifdef HAVE_LIBGNUTLS
gnutls_global_init();
#endif
-
-#ifdef HAVE_PLUGINS
- /* Register all the plugin types we have. */
- epan_register_plugin_types(); /* Types known to libwireshark */
-#endif
-
TRY {
tap_init();
prefs_init();
status = FALSE;
}
ENDTRY;
-
-#ifdef HAVE_PLUGINS
- /* Scan for plugins. This does *not* call their registration routines;
- that's done later. */
- scan_plugins();
-#endif
-
return status;
}
#include <epan/packet_info.h>
#include <epan/dfilter/dfilter.h>
#include <epan/tap.h>
-#include <epan/wmem/wmem_list.h>
static gboolean tapping_is_active=FALSE;
void (*register_tap_listener_fn)(void); /* routine to call to register tap listener */
} tap_plugin;
-static wmem_list_t *tap_plugins = NULL;
+static GSList *tap_plugins = NULL;
/*
* Callback for each plugin found.
/*
* Add this one to the list of tap plugins.
*/
- plugin = wmem_new(NULL, tap_plugin);
+ plugin = (tap_plugin *)g_malloc(sizeof (tap_plugin));
plugin->register_tap_listener_fn = register_tap_listener_fn;
- wmem_list_append(tap_plugins, plugin);
+ tap_plugins = g_slist_append(tap_plugins, plugin);
return TRUE;
}
void
register_all_plugin_tap_listeners(void)
{
- wmem_list_foreach(tap_plugins, register_tap_plugin_listener, NULL);
+ g_slist_foreach(tap_plugins, register_tap_plugin_listener, NULL);
}
#endif /* HAVE_PLUGINS */
tap_init(void)
{
tap_packet_index=0;
- tap_plugins = wmem_list_new(NULL);
}
/* **********************************************************************
return tap_id;
}
- td=wmem_new(NULL, tap_dissector_t);
+ td=(tap_dissector_t *)g_malloc(sizeof(tap_dissector_t));
td->next=NULL;
- td->name = wmem_strdup(NULL, name);
+ td->name = g_strdup(name);
if(!tap_dissector_list){
tap_dissector_list=td;
if(tl->code){
dfilter_free(tl->code);
}
- wmem_free(NULL, tl->fstring);
- wmem_free(NULL, (void*)tl);
+ g_free(tl->fstring);
+DIAG_OFF(cast-qual)
+ g_free((gpointer)tl);
+DIAG_ON(cast-qual)
}
/* this function attaches the tap_listener to the named tap.
* non-NULL: error, return value points to GString containing error
* message.
*/
-gchar *
+GString *
register_tap_listener(const char *tapname, void *tapdata, const char *fstring,
guint flags, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw)
{
volatile tap_listener_t *tl;
int tap_id;
dfilter_t *code=NULL;
- gchar *error_string = NULL;
+ GString *error_string;
gchar *err_msg;
tap_id=find_tap_id(tapname);
if(!tap_id){
- error_string = wmem_strdup_printf(NULL, "Tap %s not found", tapname);
+ error_string = g_string_new("");
+ g_string_printf(error_string, "Tap %s not found", tapname);
return error_string;
}
- tl=wmem_new0(NULL, volatile tap_listener_t);
+ tl=(volatile tap_listener_t *)g_malloc0(sizeof(tap_listener_t));
tl->needs_redraw=TRUE;
tl->flags=flags;
if(fstring){
if(!dfilter_compile(fstring, &code, &err_msg)){
- error_string = wmem_strdup_printf(NULL,
+ error_string = g_string_new("");
+ g_string_printf(error_string,
"Filter \"%s\" is invalid - %s",
fstring, err_msg);
g_free(err_msg);
return error_string;
}
}
- tl->fstring=wmem_strdup(NULL, fstring);
+ tl->fstring=g_strdup(fstring);
tl->code=code;
tl->tap_id=tap_id;
/* this function sets a new dfilter to a tap listener
*/
-gchar *
+GString *
set_tap_dfilter(void *tapdata, const char *fstring)
{
volatile tap_listener_t *tl=NULL,*tl2;
dfilter_t *code=NULL;
- gchar *error_string;
+ GString *error_string;
gchar *err_msg;
if(!tap_listener_queue){
tl->code=NULL;
}
tl->needs_redraw=TRUE;
- wmem_free(NULL, tl->fstring);
+ g_free(tl->fstring);
if(fstring){
if(!dfilter_compile(fstring, &code, &err_msg)){
tl->fstring=NULL;
- error_string = wmem_strdup_printf(
- NULL,
+ error_string = g_string_new("");
+ g_string_printf(error_string,
"Filter \"%s\" is invalid - %s",
fstring, err_msg);
- wmem_free(NULL, err_msg);
+ g_free(err_msg);
return error_string;
}
}
- tl->fstring=wmem_strdup(NULL, fstring);
+ tl->fstring=g_strdup(fstring);
tl->code=code;
}
/** this function attaches the tap_listener to the named tap.
* function returns :
* NULL: ok.
- * non-NULL: error, return value points to gchar* containing error
- * message. This value must be freed with wmem_free().
+ * non-NULL: error, return value points to GString containing error
+ * message.
* @param tapname The name of the tap we want to listen to.
* @param tapdata is the instance identifier. The tap system uses the value of this
* pointer to distinguish between different instances of a tap.
* or the file has been [re]read completely.
*/
-WS_DLL_PUBLIC gchar *register_tap_listener(const char *tapname, void *tapdata,
+WS_DLL_PUBLIC GString *register_tap_listener(const char *tapname, void *tapdata,
const char *fstring, guint flags, tap_reset_cb tap_reset,
tap_packet_cb tap_packet, tap_draw_cb tap_draw);
/** This function sets a new dfilter to a tap listener */
-WS_DLL_PUBLIC gchar *set_tap_dfilter(void *tapdata, const char *fstring);
+WS_DLL_PUBLIC GString *set_tap_dfilter(void *tapdata, const char *fstring);
/** This function recompiles dfilter for all registered tap listeners */
WS_DLL_PUBLIC void tap_listeners_dfilter_recompile(void);
if (fake_tap && fake_tap_filter->len > strlen("frame")) {
/* a boring tap :-) */
- gchar* error = register_tap_listener("frame",
+ GString* error = register_tap_listener("frame",
&fake_tap,
fake_tap_filter->str,
0, /* XXX - do we need the protocol tree or columns? */
NULL, NULL, NULL);
if (error) {
- report_failure("while registering lua_fake_tap:\n%s", error);
- wmem_free(NULL, error);
+ report_failure("while registering lua_fake_tap:\n%s",error->str);
+ g_string_free(error,TRUE);
} else if (!dfilter_compile(fake_tap_filter->str, &wslua_dfilter, &err_msg)) {
report_failure("while compiling dfilter \"%s\" for wslua: %s", fake_tap_filter->str, err_msg);
g_free(err_msg);
const gchar* filter = luaL_optstring(L,WSLUA_OPTARG_Listener_new_FILTER,NULL);
const gboolean all_fields = wslua_optbool(L, WSLUA_OPTARG_Listener_new_ALLFIELDS, FALSE);
Listener tap;
- gchar* error;
+ GString* error;
tap = (Listener)g_malloc(sizeof(struct _wslua_tap));
g_free(tap->name);
g_free(tap);
/* WSLUA_ERROR(new_tap,"tap registration error"); */
- lua_pushfstring(L,"Error while registering tap:\n%s",error);
- wmem_free(NULL, error);
+ lua_pushfstring(L,"Error while registering tap:\n%s",error->str);
+ g_string_free(error,TRUE);
luaL_error(L,lua_tostring(L,-1));
}
void
proto_reg_handoff_mate(void)
{
- gchar* tap_error = NULL;
+ GString* tap_error = NULL;
if ( *pref_mate_config_filename != '\0' ) {
(tap_draw_cb) NULL);
if ( tap_error ) {
- g_warning("mate: couldn't (re)register tap: %s", tap_error);
- wmem_free(NULL, tap_error);
+ g_warning("mate: couldn't (re)register tap: %s",tap_error->str);
+ g_string_free(tap_error, TRUE);
mate_tap_data = 0;
return;
}
{
pci_t *rs;
header_field_info *hfi;
- gchar *error_string;
+ GString *error_string;
char hfibuf[100];
hfi=proto_registrar_get_byname(field);
if(error_string){
/* error, we failed to attach to the tap. complain and clean up */
fprintf(stderr, "rawshark: Couldn't register field extraction tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
if(rs->filter){
g_free(rs->filter);
}
init_open_routines();
+#ifdef HAVE_PLUGINS
+ /* Register all the plugin types we have. */
+ epan_register_plugin_types(); /* Types known to libwireshark */
+
+ /* Scan for plugins. This does *not* call their registration routines;
+ that's done later. */
+ scan_plugins();
+
+#endif
+
/* Register all dissectors; we must do this before checking for the
"-G" flag, as the "-G" flag dumps information registered by the
dissectors, and we must do it before we read the preferences, in
init_open_routines();
#ifdef HAVE_PLUGINS
+ /* Register all the plugin types we have. */
+ epan_register_plugin_types(); /* Types known to libwireshark */
wtap_register_plugin_types(); /* Types known to libwiretap */
+ /* Scan for plugins. This does *not* call their registration routines;
+ that's done later. */
+ scan_plugins();
+
/* Register all libwiretap plugin modules. */
register_all_wiretap_modules();
#endif
static void camelsrt_init(const char *opt_arg, void *userdata _U_)
{
struct camelsrt_t *p_camelsrt;
- gchar *error_string;
+ GString *error_string;
p_camelsrt = g_new(struct camelsrt_t, 1);
if (!strncmp(opt_arg, "camel,srt,", 9)) {
g_free(p_camelsrt);
fprintf(stderr, "tshark: Couldn't register camel,srt tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
{
comparestat_t *cs;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
gint start, stop, ttl, order, pos = 0;
gdouble variance;
g_hash_table_destroy(cs->packet_set);
g_free(cs);
- fprintf(stderr, "tshark: Couldn't register compare tap: %s\n", error_string);
- wmem_free(NULL, error_string);
+ fprintf(stderr, "tshark: Couldn't register compare tap: %s\n", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
guint opt_count = 0;
guint opt_idx = 0;
GString *filter = NULL;
- gchar *error_string = NULL;
+ GString *error_string = NULL;
ds = g_new(diameteravp_t, 1);
ds->frame = 0;
g_free(ds);
fprintf(stderr, "tshark: Couldn't register diam,csv tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
void init_hostlists(struct register_ct *ct, const char *filter)
{
endpoints_t *iu;
- gchar *error_string;
+ GString *error_string;
iu = g_new0(endpoints_t, 1);
iu->type = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(ct)));
if (error_string) {
g_free(iu);
fprintf(stderr, "tshark: Couldn't register endpoint tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
{
const char *args = NULL;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
expert_tapdata_t *hs;
int n;
expert_stat_packet,
expert_stat_draw);
if (error_string) {
- printf("Expert tap error (%s)!\n", error_string);
- wmem_free(NULL, error_string);
+ printf("Expert tap error (%s)!\n", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(hs);
exit(1);
}
{
follow_info_t *follow_info;
cli_follow_info_t* cli_follow_info;
- gchar *errp;
+ GString *errp;
register_follow_t* follower = (register_follow_t*)userdata;
follow_index_filter_func index_filter;
follow_address_filter_func address_filter;
if (errp != NULL)
{
follow_free(follow_info);
- wmem_free(NULL, errp);
+ g_string_free(errp, TRUE);
follow_exit("Error registering tap listener.");
}
}
gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_)
{
gsm_a_stat_t *stat_p;
- gchar *err_p;
+ GString *err_p;
stat_p = g_new(gsm_a_stat_t, 1);
if (err_p != NULL)
{
g_free(stat_p);
- wmem_free(NULL, err_p);
+ g_string_free(err_p, TRUE);
exit(1);
}
static void
hosts_init(const char *opt_arg, void *userdata _U_)
{
- gchar *error_string;
+ GString *error_string;
gchar **tokens;
gint opt_count;
if (error_string) {
/* error, we failed to attach to the tap. clean up */
fprintf(stderr, "tshark: Couldn't register " TAP_NAME " tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
{
httpstat_t *sp;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (!strncmp (opt_arg, "http,stat,", 10)) {
filter = opt_arg+10;
g_free(sp->filter);
g_free(sp);
fprintf (stderr, "tshark: Couldn't register http,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
{
icmpstat_t *icmpstat;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (strstr(opt_arg, "icmp,srt,"))
filter = opt_arg + strlen("icmp,srt,");
g_free(icmpstat);
fprintf(stderr, "tshark: Couldn't register icmp,srt tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
{
icmpv6stat_t *icmpv6stat;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (strstr(opt_arg, "icmpv6,srt,"))
filter = opt_arg + strlen("icmpv6,srt,");
g_free(icmpv6stat);
fprintf(stderr, "tshark: Couldn't register icmpv6,srt tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
static void
register_io_tap(io_stat_t *io, int i, const char *filter)
{
- gchar *error_string;
+ GString *error_string;
const char *flt;
int j;
size_t namelen;
g_free(io->items);
g_free(io);
fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
void init_iousers(struct register_ct *ct, const char *filter)
{
io_users_t *iu;
- gchar *error_string;
+ GString *error_string;
iu = g_new0(io_users_t, 1);
iu->type = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(ct)));
if (error_string) {
g_free(iu);
fprintf(stderr, "tshark: Couldn't register conversations tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
{
mac_lte_stat_t *hs;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
/* Check for a filter string */
if (strncmp(opt_arg, "mac-lte,stat,", 13) == 0) {
mac_lte_stat_packet,
mac_lte_stat_draw);
if (error_string) {
- wmem_free(NULL, error_string);
+ g_string_free(error_string, TRUE);
g_free(hs);
exit(1);
}
const char *field = NULL;
const char *filter = NULL;
header_field_info *hfi;
- gchar *error_string;
+ GString *error_string;
if (!strncmp("proto,colinfo,", opt_arg, 14)) {
filter = opt_arg+14;
if (error_string) {
/* error, we failed to attach to the tap. complain and clean up */
fprintf(stderr, "tshark: Couldn't register proto,colinfo tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
g_free(rs->filter);
g_free(rs);
phs_t *rs;
int pos = 0;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (strcmp("io,phs", opt_arg) == 0) {
/* No arguments */
g_free(rs);
fprintf(stderr, "tshark: Couldn't register io,phs tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
{
rlc_lte_stat_t *hs;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
/* Check for a filter string */
if (strncmp(opt_arg, "rlc-lte,stat,", 13) == 0) {
rlc_lte_stat_packet,
rlc_lte_stat_draw);
if (error_string) {
- wmem_free(NULL, error_string);
+ g_string_free(error_string, TRUE);
g_free(hs);
exit(1);
}
static void
rpcprogs_init(const char *opt_arg _U_, void *userdata _U_)
{
- gchar *error_string;
+ GString *error_string;
if (already_enabled) {
return;
error_string = register_tap_listener("rpc", NULL, NULL, 0, NULL, rpcprogs_packet, rpcprogs_draw);
if (error_string) {
fprintf(stderr, "tshark: Couldn't register rpc,programs tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
static void
init_rtd_tables(register_rtd_t* rtd, const char *filter)
{
- gchar *error_string;
+ GString *error_string;
rtd_t* ui;
ui = g_new0(rtd_t, 1);
error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &ui->rtd, filter, 0, NULL, get_rtd_packet_func(rtd), rtd_draw);
if (error_string) {
free_rtd_table(&ui->rtd.stat_table, NULL, NULL);
- fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string);
- wmem_free(NULL, error_string);
+ fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
static void
rtp_streams_stat_init(const char *opt_arg _U_, void *userdata _U_)
{
- gchar *err_p;
+ GString *err_p;
err_p =
register_tap_listener("rtp", &the_tapinfo_struct, NULL, 0,
if (err_p != NULL)
{
- wmem_free(NULL, err_p);
+ g_string_free(err_p, TRUE);
exit(1);
}
{
rtspstat_t *sp;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (!strncmp (opt_arg, "rtsp,stat,", 10)) {
filter = opt_arg+10;
g_free(sp->filter);
g_free(sp);
fprintf (stderr, "tshark: Couldn't register rtsp,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
sctpstat_init(const char *opt_arg, void *userdata _U_)
{
sctpstat_t *hs;
- gchar *error_string;
+ GString *error_string;
hs = (sctpstat_t *)g_malloc(sizeof(sctpstat_t));
if (!strncmp(opt_arg, "sctp,stat,", 11)) {
g_free(hs);
fprintf(stderr, "tshark: Couldn't register sctp,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
static void
init_stat_table(stat_tap_table_ui *new_stat_tap, const char *filter)
{
- gchar *error_string;
+ GString *error_string;
table_stat_t* ui;
ui = g_new0(table_stat_t, 1);
error_string = register_tap_listener(new_stat_tap->tap_name, &ui->stats, filter, 0, NULL, new_stat_tap->packet_func, simple_draw);
if (error_string) {
/* free_rtd_table(&ui->rtd.stat_table, NULL, NULL); */
- fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string);
- wmem_free(NULL, error_string);
+ fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
{
sipstat_t *sp;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
if (strncmp (opt_arg, "sip,stat,", 9) == 0) {
filter = opt_arg+9;
g_free(sp->filter);
g_free(sp);
fprintf (stderr, "tshark: Couldn't register sip,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
static void
smbsids_init(const char *opt_arg _U_, void *userdata _U_)
{
- gchar *error_string;
+ GString *error_string;
if (!sid_name_snooping) {
fprintf(stderr, "The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n");
error_string = register_tap_listener("smb", NULL, NULL, 0, NULL, smbsids_packet, smbsids_draw);
if (error_string) {
fprintf(stderr, "tshark: Couldn't register smb,sids tap:%s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
init_srt_tables(register_srt_t* srt, const char *filter)
{
srt_t *ui;
- gchar *error_string;
+ GString *error_string;
ui = g_new0(srt_t, 1);
ui->type = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt)));
if (error_string) {
free_srt_table(srt, global_srt_array, NULL, NULL);
g_free(ui);
- fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string);
- wmem_free(NULL, error_string);
+ fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
init_stats_tree(const char *opt_arg, void *userdata _U_)
{
char *abbr = stats_tree_get_abbr(opt_arg);
- gchar *error_string;
+ GString *error_string;
stats_tree_cfg *cfg = NULL;
stats_tree *st = NULL;
draw_stats_tree);
if (error_string) {
- report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string);
- wmem_free(NULL, error_string);
+ report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string->str);
return;
}
static void
svstat_init(const char *opt_arg _U_, void *userdata _U_)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener(
"sv",
if (error_string) {
/* error, we failed to attach to the tap. clean up */
fprintf(stderr, "tshark: Couldn't register sv,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
wspstat_t *sp;
const char *filter = NULL;
guint32 i;
- gchar *error_string;
+ GString *error_string;
wsp_status_code_t *sc;
const value_string *wsp_vals_status_p;
g_hash_table_foreach( sp->hash, (GHFunc) wsp_free_hash_table, NULL ) ;
g_hash_table_destroy( sp->hash );
fprintf(stderr, "tshark: Couldn't register wsp,stat tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}
gdouble variance;
gint start, stop,ttl, order, pos=0;
const char *filter=NULL;
- gchar *error_string;
+ GString *error_string;
if(sscanf(opt_arg,"compare,%d,%d,%d,%d,%lf%n",&start, &stop, &ttl, &order, &variance, &pos)==5){
if(*(opt_arg+pos)==',')
error_string=register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
gtk_tree_store_clear(cs->simple_list);
g_hash_table_destroy(cs->packet_set);
g_hash_table_destroy(cs->ip_id_set);
{
char *display_name;
char title[256];
- gchar *error_string;
+ GString *error_string;
const char *filter;
GtkListStore *store;
error_string = set_tap_dfilter (&ct->hash, filter);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
tap_packet_cb packet_func)
{
int i;
- gchar *error_string;
+ GString *error_string;
char title[256];
GtkListStore *store;
error_string=register_tap_listener(tap_name, &conversations->hash, filter, 0, reset_ct_table_data_cb, packet_func,
draw_ct_table_data_cb);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return FALSE;
}
int pos = 0;
const char *filter = NULL;
dcerpcstat_tap_data_t* tap_data;
- gchar *error_string;
+ GString *error_string;
/*
* XXX - DCE RPC statistics are maintained only by major version,
error_string = register_tap_listener("dcerpc", &rs->data, filter, 0, dcerpcstat_reset, get_srt_packet_func(rs->srt), dcerpcstat_draw);
if(error_string){
/* error, we failed to attach to the tap. clean up */
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
free_srt_table(rs->srt, rs->data.srt_array, NULL, NULL);
g_free(rs);
return;
{
expert_comp_dlg_t *ss = (expert_comp_dlg_t *)callback_data;
const char *filter;
- gchar *error_string;
+ GString *error_string;
ss->use_dfilter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget));
if (ss->use_dfilter) {
}
error_string = set_tap_dfilter (ss, filter);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
error_string = set_tap_dfilter (ss->etd, filter);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
expert_comp_init(const char *opt_arg _U_, void* userdata _U_)
{
expert_comp_dlg_t *ss;
- gchar *error_string;
+ GString *error_string;
GtkWidget *temp_page, *details_page, *comments_page;
GtkWidget *main_nb;
GtkWidget *vbox;
expert_dlg_packet,
expert_dlg_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(ss->etd);
return;
}
error_string=register_tap_listener("expert", ss, NULL,
TL_REQUIRES_NOTHING, error_reset, error_packet, expert_comp_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(ss);
return;
}
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
GtkWidget *vbox, *bbox, *help_bt, *cancel_bt, *save_bt, *save_all_bt;
- gchar *error_msg;
+ GString *error_msg;
export_object_list_t *object_list;
gchar *window_title;
if (error_msg) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Can't register %s tap: %s\n", name, error_msg);
- wmem_free(NULL, error_msg);
+ "Can't register %s tap: %s\n", name, error_msg->str);
+ g_string_free(error_msg, TRUE);
g_free(object_list);
return;
}
gchar *both_directions_string = NULL;
follow_info_t *follow_info;
gtk_follow_info_t *gtk_follow_info;
- gchar *msg;
+ GString *msg;
gboolean is_follow = FALSE;
guint32 ignore_stream;
char stream_window_title[256];
if (msg) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't register %s tap: %s\n",
- get_follow_tap_string(follower), msg);
+ get_follow_tap_string(follower), msg->str);
g_free(gtk_follow_info);
g_free(follow_info->filter_out_filter);
g_free(follow_info);
g_free(follow_filter);
- wmem_free(NULL, msg);
return;
}
void
register_tap_listener_gtk_gsm_map_summary(void)
{
- gchar *err_p;
+ GString *err_p;
memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t));
if (err_p != NULL)
{
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p);
- wmem_free(NULL, err_p);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str);
+ g_string_free(err_p, TRUE);
exit(1);
}
{
char *display_name;
char title[256];
- gchar *error_string;
+ GString *error_string;
const char *filter;
GtkListStore *store;
}
error_string = set_tap_dfilter (&hosts->hash, filter);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
const char *filter, tap_packet_cb packet_func)
{
guint i;
- gchar *error_string;
+ GString *error_string;
char title[256];
GtkListStore *store;
GtkWidget *tree;
/* register the tap and rerun the taps on the packet list */
error_string=register_tap_listener(tap_name, &hosttable->hash, filter, 0, reset_hostlist_table_data_cb, packet_func, draw_hostlist_table_data_cb);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(hosttable);
return FALSE;
}
on_refresh_bt_clicked(GtkWidget *bt _U_, gpointer data)
{
user_data_t *user_data = (user_data_t *)data;
- gchar *error_string;
+ GString *error_string;
/* remove tap listener */
remove_tap_listener(user_data);
error_string = register_tap_listener("IAX2", user_data, NULL, 0,
iax2_reset, iax2_packet, iax2_draw);
if (error_string != NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
be able to pick up the field values after the edt tree has been
pruned
*/
-static gchar *
+static GString *
enable_graph(io_stat_graph_t *gio, const char *filter, const char *field)
{
GString *real_filter = NULL;
- gchar *err_msg;
+ GString *err_msg;
gio->display = TRUE;
{1.0, 0.314, 1.0, 1.0} /* Light brilliant magenta */
};
- gchar *error_string;
+ GString *error_string;
io = g_new(io_stat_t,1);
io->needs_redraw = TRUE;
/**************************************************************/
void lbmc_stream_dlg_stream_menu_cb(gpointer arg _U_)
{
- gchar * err_msg;
+ GString * err_msg;
if (global_stream_dialog_info != NULL)
{
lbmc_stream_dlg_tap_draw);
if (err_msg != NULL)
{
- fprintf(stderr, "register_tap_listener: %s\n", err_msg);
- wmem_free(NULL, err_msg);
+ fprintf(stderr, "register_tap_listener: %s\n", err_msg->str);
+ g_string_free(err_msg, TRUE);
}
cf_retap_packets(&cfile);
}
/* Scan for displayed packets (retap all packets) */
if (dialog_data.have_tap_listener == FALSE)
{
- gchar * err_msg;
+ GString * err_msg;
err_msg = register_tap_listener("lbm_uim",
&(dialog_data.tap_identifier),
lbmc_uim_flow_tap_draw);
if (err_msg != NULL)
{
- fprintf(stderr, "register_tap_listener: %s\n", err_msg);
- wmem_free(NULL, err_msg);
+ fprintf(stderr, "register_tap_listener: %s\n", err_msg->str);
+ g_string_free(err_msg, TRUE);
}
dialog_data.have_tap_listener = TRUE;
}
{
mac_lte_stat_t *hs;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
GtkWidget *ues_scrolled_window;
GtkWidget *bbox;
GtkWidget *top_level_vbox;
mac_lte_stat_packet,
mac_lte_stat_draw);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(hs);
return;
}
#ifdef HAVE_PLUGINS
/* Register all the plugin types we have. */
+ epan_register_plugin_types(); /* Types known to libwireshark */
wtap_register_plugin_types(); /* Types known to libwiretap */
codec_register_plugin_types(); /* Types known to libwscodecs */
+ /* Scan for plugins. This does *not* call their registration routines;
+ that's done later. */
+ scan_plugins();
+
/* Register all libwiretap plugin modules. */
register_all_wiretap_modules();
void
register_tap_listener_gtk_mtp3_summary(void)
{
- gchar *err_p;
+ GString *err_p;
memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat));
if (err_p != NULL)
{
- simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "%s", err_p);
- wmem_free(NULL, err_p);
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "%s", err_p->str);
+ g_string_free(err_p, TRUE);
exit(1);
}
{
rtd_t *rr;
gchar *str;
- gchar *error_string;
+ GString *error_string;
GtkWidget *bbox;
GtkWidget *close_bt;
error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &rr->data, filter, 0, rtd_reset, get_rtd_packet_func(rtd), rtd_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
free_rtd_table(&rr->data.stat_table, NULL, NULL);
g_free(rr);
return;
{
rlc_lte_stat_t *hs;
const char *filter = NULL;
- gchar *error_string;
+ GString *error_string;
GtkWidget *ues_scrolled_window;
GtkWidget *channels_scrolled_window;
GtkWidget *bbox;
rlc_lte_stat_packet,
rlc_lte_stat_draw);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(hs);
return;
}
GtkWidget *close_bt;
int program, version, pos;
const char *filter=NULL;
- gchar *error_string;
+ GString *error_string;
rpcstat_tap_data_t* tap_data;
pos=0;
error_string=register_tap_listener("rpc", &rs->data, filter, 0, rpcstat_reset, get_srt_packet_func(rs->srt), rpcstat_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
free_srt_table(rs->srt, rs->data.srt_array, NULL, NULL);
g_free(rs);
return;
static void
on_refresh_bt_clicked(GtkWidget *bt _U_, user_data_t *user_data)
{
- gchar *error_string;
+ GString *error_string;
/* remove tap listener */
remove_tap_listener(user_data);
error_string = register_tap_listener("rtp", user_data, NULL, 0,
rtp_reset, rtp_packet, rtp_draw);
if (error_string != NULL) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
sctpstat_init(const char *opt_arg, void *userdata _U_)
{
sctpstat_t *hs;
- gchar *error_string;
+ GString *error_string;
GtkWidget *bbox;
GtkWidget *close_bt;
sctpstat_packet,
sctpstat_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
g_free(hs->filter);
g_free(hs);
return;
gchar *str;
GtkWidget *label;
char *filter_string, *tmp_filter_string;
- gchar *error_string;
+ GString *error_string;
GtkWidget *bbox;
GtkWidget *close_bt;
error_string = register_tap_listener(get_srt_tap_listener_name(srt), &ss->data, filter, 0, srt_reset, get_srt_packet_func(srt), srt_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
free_srt_table(ss->srt, ss->data.srt_array, NULL, NULL);
g_free(ss);
return;
init_simple_stat_tables(stat_tap_table_ui *new_stat_tap, const char *filter)
{
simple_stat_t *ss;
- gchar *error_string;
+ GString *error_string;
GtkWidget *bbox;
GtkWidget *close_bt;
error_string = register_tap_listener(new_stat_tap->tap_name, &ss->data, filter, 0, simple_stat_reset, new_stat_tap->packet_func, simple_stat_draw);
if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
free_stat_tables(ss->new_stat_tap, NULL, NULL);
g_free(ss);
return;
tree_pres* pr = (tree_pres *)g_malloc(sizeof(tree_pres));
gchar* title = NULL;
gchar* window_name = NULL;
- gchar* error_string;
+ GString* error_string;
GtkWidget *scr_win;
size_t init_strlen;
GtkWidget *main_vb, *bbox, *bt_close, *bt_copy, *bt_saveas;
if (error_string) {
/* error, we failed to attach to the tap. clean up */
/* destroy_stat_tree_window(st); */
- report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string);
- wmem_free(NULL, error_string);
+ report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str);
+ g_string_free(error_string, TRUE);
}
/* Button row. */
wlan_ep_t *list = wlan_stat->ep_list;
char *display_name;
char title[256];
- gchar *error_string;
+ GString *error_string;
GtkListStore *store;
const char *filter = NULL;
error_string = set_tap_dfilter (wlan_stat, filter);
if (error_string) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
wlanstat_dlg_create (void)
{
wlanstat_t *hs;
- gchar *error_string;
+ GString *error_string;
GtkWidget *scrolled_window;
GtkWidget *bbox;
GtkWidget *vbox;
wlanstat_reset, wlanstat_packet,
wlanstat_draw);
if (error_string) {
- simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free (error_string, TRUE);
g_free (hs);
return;
}
/* increment the packets counter for this stream and calculate average pps */
++(strinfo->npackets);
-
+
if (deltatime > 0) {
strinfo->apackets = strinfo->npackets / deltatime;
strinfo->average_bw = ((double)(strinfo->total_bytes*8) / deltatime);
void
register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo)
{
- gchar *error_string;
+ GString *error_string;
if (!tapinfo) {
return;
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
static void
bluetooth_devices_tap(void *data)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("bluetooth.device", data, NULL,
0,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- g_free(error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
static void
bluetooth_devices_tap(void *data)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("bluetooth.hci_summary", data, NULL,
0,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
}
if (ui->limitCheckBox->isChecked()) {
- gchar *error_string = set_tap_dfilter(this, display_filter_.toUtf8().constData());
+ GString *error_string = set_tap_dfilter(this, display_filter_.toUtf8().constData());
if (error_string) {
QMessageBox::warning(this, tr("Endpoint expert failed to set filter"),
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
}
void
register_tap_listener_qt_gsm_map_summary(void)
{
- gchar *err_p;
+ GString *err_p;
memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t));
if (err_p != NULL)
{
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p);
- wmem_free(NULL, err_p);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str);
+ g_string_free(err_p, TRUE);
exit(1);
}
graph_ = parent_->addGraph(parent_->xAxis, parent_->yAxis);
Q_ASSERT(graph_ != NULL);
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("frame",
this,
"",
if (error_string) {
// QMessageBox::critical(this, tr("%1 failed to register tap listener").arg(name_),
// error_string->str);
- wmem_free(NULL, error_string);
+ g_string_free(error_string, TRUE);
}
setFilter(QString());
void IOGraph::setFilter(const QString &filter)
{
GString *error_string;
- gchar* filter_error_string;
QString full_filter(filter.trimmed());
config_err_.clear();
}
}
- filter_error_string = set_tap_dfilter(this, full_filter.toUtf8().constData());
- if (filter_error_string) {
- config_err_ = filter_error_string;
- wmem_free(NULL, filter_error_string);
+ error_string = set_tap_dfilter(this, full_filter.toUtf8().constData());
+ if (error_string) {
+ config_err_ = error_string->str;
+ g_string_free(error_string, TRUE);
return;
} else {
if (filter_.compare(filter) && visible_) {
void LBMLBTRMTransportDialog::fillTree(void)
{
- gchar * error_string;
+ GString * error_string;
if (m_capture_file == NULL)
{
if (error_string)
{
QMessageBox::critical(this, tr("LBT-RM Statistics failed to attach to tap"),
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
reject();
}
void LBMLBTRUTransportDialog::fillTree(void)
{
- gchar * error_string;
+ GString * error_string;
if (m_capture_file == NULL)
{
if (error_string)
{
QMessageBox::critical(this, tr("LBT-RU Statistics failed to attach to tap"),
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
reject();
}
void LBMStreamDialog::fillTree(void)
{
- gchar * error_string;
+ GString * error_string;
if (m_capture_file == NULL)
{
if (error_string)
{
QMessageBox::critical(this, tr("LBM Stream failed to attach to tap"),
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
reject();
}
void
register_tap_listener_qt_mtp3_summary(void)
{
- gchar *err_p;
+ GString *err_p;
memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat));
if (err_p != NULL)
{
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p);
- wmem_free(NULL, err_p);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_p->str);
+ g_string_free(err_p, TRUE);
exit(1);
}
bool WiresharkDialog::registerTapListener(const char *tap_name, void *tap_data, const char *filter, guint flags, void(*tap_reset)(void *), gboolean(*tap_packet)(void *, struct _packet_info *, struct epan_dissect *, const void *), void(*tap_draw)(void *))
{
- gchar *error_string = register_tap_listener(tap_name, tap_data, filter, flags,
+ GString *error_string = register_tap_listener(tap_name, tap_data, filter, flags,
tap_reset, tap_packet, tap_draw);
if (error_string) {
QMessageBox::warning(this, tr("Failed to attach to tap \"%1\"").arg(tap_name),
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
return false;
}
void
register_tap_listener_rtp_stream(rtpstream_tapinfo_t *tapinfo, const char *fstring)
{
- gchar *error_string;
+ GString *error_string;
if (!tapinfo) {
return;
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
epan_dissect_t edt;
dfilter_t *sfcode;
- gchar *error_string;
+ GString *error_string;
nstime_t rel_ts;
/* Initialised to no known channels */
th_t th = {0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
error_string = register_tap_listener("rlc-lte", &th, NULL, 0, NULL, tap_lte_rlc_packet, NULL);
if (error_string){
fprintf(stderr, "wireshark: Couldn't register rlc_lte_graph tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1); /* XXX: fix this */
}
char **err_string)
{
struct rlc_segment current;
- gchar *error_string;
+ GString *error_string;
g_log(NULL, G_LOG_LEVEL_DEBUG, "graph_segment_list_get()");
error_string = register_tap_listener("rlc-lte", g, "rlc-lte", 0, NULL, rlc_lte_tap_for_graph_data, NULL);
if (error_string) {
fprintf(stderr, "wireshark: Couldn't register rlc_graph tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1); /* XXX: fix this */
}
cf_retap_packets(cf);
void
register_tap_listener_sctp_stat(void)
{
- gchar *error_string;
+ GString *error_string;
if (!sctp_tapinfo_struct.is_registered)
{
if ((error_string = register_tap_listener("sctp", &sctp_tapinfo_struct, NULL, 0, reset, packet, NULL))) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string);
- wmem_free(NULL, error_string);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
+ g_string_free(error_string, TRUE);
return;
}
sctp_tapinfo_struct.is_registered=TRUE;
graph_segment_list_get(capture_file *cf, struct tcp_graph *tg, gboolean stream_known)
{
struct segment current;
- gchar *error_string;
+ GString *error_string;
tcp_scan_t ts;
g_log(NULL, G_LOG_LEVEL_DEBUG, "graph_segment_list_get()");
error_string = register_tap_listener("tcp", &ts, "tcp", 0, NULL, tapall_tcpip_packet, NULL);
if (error_string) {
fprintf(stderr, "wireshark: Couldn't register tcp_graph tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1); /* XXX: fix this */
}
cf_retap_packets(cf);
epan_dissect_t edt;
dfilter_t *sfcode;
gchar *err_msg;
- gchar *error_string;
+ GString *error_string;
nstime_t rel_ts;
th_t th = {0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
error_string=register_tap_listener("tcp", &th, NULL, 0, NULL, tap_tcpip_packet, NULL);
if (error_string) {
fprintf(stderr, "wireshark: Couldn't register tcp_graph tap: %s\n",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
char *
exp_pdu_pre_open(const char *tap_name, const char *filter, exp_pdu_t *exp_pdu_tap_data)
{
+ GString *error_string;
+
/* XXX: can we always assume WTAP_ENCAP_WIRESHARK_UPPER_PDU? */
exp_pdu_tap_data->pkt_encap = wtap_wtap_encap_to_pcap_encap(WTAP_ENCAP_WIRESHARK_UPPER_PDU);
/* Register this tap listener now */
- return register_tap_listener(tap_name, /* The name of the tap we want to listen to */
+ error_string = register_tap_listener(tap_name, /* The name of the tap we want to listen to */
exp_pdu_tap_data, /* instance identifier/pointer to a struct holding
* all state variables */
filter, /* pointer to a filter string */
NULL,
export_pdu_packet,
NULL);
+ if (error_string != NULL)
+ return g_string_free(error_string, FALSE);
+
+ return NULL;
}
void
rtp_event_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("rtpevent", tap_base_to_id(tap_id_base, tap_id_offset_rtp_event_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
rtp_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("rtp", tap_base_to_id(tap_id_base, tap_id_offset_rtp_), NULL,
0,
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
t38_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("t38", tap_base_to_id(tap_id_base, tap_id_offset_t38_), NULL,
0,
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
sip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("sip", tap_base_to_id(tap_id_base, tap_id_offset_sip_), NULL,
0,
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
isup_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("isup", tap_base_to_id(tap_id_base, tap_id_offset_isup_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
mtp3_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("mtp3", tap_base_to_id(tap_id_base, tap_id_offset_mtp3_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
error_string = register_tap_listener("m3ua", tap_base_to_id(tap_id_base, tap_id_offset_m3ua_),
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
q931_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("q931", tap_base_to_id(tap_id_base, tap_id_offset_q931_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
h225_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("h225", tap_base_to_id(tap_id_base, tap_id_offset_h225_), NULL,
0,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
h245dg_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
if (!tap_id_base->h245_labels) {
tap_id_base->h245_labels = g_new0(h245_labels_t, 1);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
sdp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("sdp", tap_base_to_id(tap_id_base, tap_id_offset_sdp_), NULL,
0,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
mgcp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
/*
* We set TL_REQUIRES_PROTO_TREE to force a non-null "tree"
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
actrace_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("actrace", tap_base_to_id(tap_id_base, tap_id_offset_actrace_), NULL,
0,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
h248_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("megaco", tap_base_to_id(tap_id_base, tap_id_offset_megaco_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
error_string = register_tap_listener("h248", tap_base_to_id(tap_id_base, tap_id_offset_h248_),
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void sccp_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("sccp", tap_base_to_id(tap_id_base, tap_id_offset_sccp_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
error_string = register_tap_listener("sua", tap_base_to_id(tap_id_base, tap_id_offset_sua_),
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
unistim_calls_init_tap(voip_calls_tapinfo_t *tap_id_base) {
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("unistim", tap_base_to_id(tap_id_base, tap_id_offset_unistim_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
skinny_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
/*
* We set TL_REQUIRES_PROTO_TREE to force a non-null "tree"
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
iax2_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
/*
* We set TL_REQUIRES_PROTO_TREE to force a non-null "tree"
);
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
- error_string);
- wmem_free(NULL, error_string);
+ error_string->str);
+ g_string_free(error_string, TRUE);
}
}
void
voip_calls_init_tap(voip_calls_tapinfo_t *tap_id_base)
{
- gchar *error_string;
+ GString *error_string;
error_string = register_tap_listener("voip", tap_base_to_id(tap_id_base, tap_id_offset_voip_),
NULL,
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%s", error_string);
- wmem_free(NULL, error_string);
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
}
}
init_open_routines();
- /* Register all dissectors; we must do this before checking for the
- "-G" flag, as the "-G" flag dumps information registered by the
- dissectors, and we must do it before we read the preferences, in
- case any dissectors register preferences. */
- if (!epan_init(register_all_protocols,register_all_protocol_handoffs,
- splash_update, NULL)) {
- SimpleDialog::displayQueuedMessages(main_w);
- return 2;
- }
-
#ifdef HAVE_PLUGINS
/* Register all the plugin types we have. */
epan_register_plugin_types(); /* Types known to libwireshark */
register_all_codecs();
#endif
+ /* Register all dissectors; we must do this before checking for the
+ "-G" flag, as the "-G" flag dumps information registered by the
+ dissectors, and we must do it before we read the preferences, in
+ case any dissectors register preferences. */
+ if (!epan_init(register_all_protocols,register_all_protocol_handoffs,
+ splash_update, NULL)) {
+ SimpleDialog::displayQueuedMessages(main_w);
+ return 2;
+ }
+
splash_update(RA_LISTENERS, NULL, NULL);
/* Register all tap listeners; we do this before we parse the arguments,