void register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func, host_tap_prefix prefix_func) { register_ct_t *table; GString *conv_cmd_str = g_string_new("conv,"); GString *host_cmd_str = g_string_new(""); table = g_new(register_ct_t,1); table->hide_ports = hide_ports; table->proto_id = proto_id; table->conv_func = conv_packet_func; table->host_func = hostlist_func; table->conv_gui_init = NULL; table->host_gui_init = NULL; table->prefix_func = prefix_func; registered_ct_tables = g_slist_insert_sorted(registered_ct_tables, table, insert_sorted_by_table_name); g_string_append(conv_cmd_str, proto_get_protocol_filter_name(table->proto_id)); cmd_string_list_ = g_list_append(cmd_string_list_, conv_cmd_str->str); register_stat_cmd_arg(conv_cmd_str->str, dissector_conversation_init, table); g_string_free(conv_cmd_str, FALSE); g_string_printf(host_cmd_str, "%s,%s", (get_hostlist_prefix_func(table) != NULL) ? get_hostlist_prefix_func(table)() : "host", proto_get_protocol_filter_name(table->proto_id)); register_stat_cmd_arg(host_cmd_str->str, dissector_hostlist_init, table); g_string_free(host_cmd_str, FALSE); }
/* * Register a stat that has a parameter dialog. * We register it both as a command-line stat and a menu item stat. */ void register_param_stat(tap_param_dlg *info, const char *name, register_stat_group_t group) { gchar *full_name; const gchar *stock_id = NULL; register_stat_cmd_arg(info->init_string, info->tap_init_cb, NULL); /* * This menu item will pop up a dialog box, so append "..." * to it. */ full_name = g_strdup_printf("%s...", name); switch (group) { case REGISTER_ANALYZE_GROUP_UNSORTED: case REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER: case REGISTER_STAT_GROUP_UNSORTED: case REGISTER_STAT_GROUP_GENERIC: break; case REGISTER_STAT_GROUP_CONVERSATION_LIST: stock_id = WIRESHARK_STOCK_CONVERSATIONS; break; case REGISTER_STAT_GROUP_ENDPOINT_LIST: stock_id = WIRESHARK_STOCK_ENDPOINTS; break; case REGISTER_STAT_GROUP_RESPONSE_TIME: stock_id = WIRESHARK_STOCK_TIME; break; case REGISTER_STAT_GROUP_TELEPHONY: case REGISTER_STAT_GROUP_TELEPHONY_GSM: case REGISTER_STAT_GROUP_TELEPHONY_LTE: case REGISTER_STAT_GROUP_TELEPHONY_SCTP: break; case REGISTER_TOOLS_GROUP_UNSORTED: break; } register_menu_bar_menu_items( stat_group_name(group), /* GUI path to the place holder in the menu */ name, /* Action name */ stock_id, /* Stock id */ full_name, /* label */ NULL, /* Accelerator */ NULL, /* Tooltip */ tap_param_dlg_cb, /* Callback */ info, /* Callback data */ TRUE, /* Enabled */ NULL, NULL); }
WSLUA_FUNCTION wslua_register_stat_cmd_arg(lua_State* L) { /* Register a function to handle a -z option */ #define WSLUA_ARG_register_stat_cmd_arg_ARGUMENT 1 /* Argument */ #define WSLUA_OPTARG_register_stat_cmd_arg_ACTION 2 /* Action */ const char* arg = luaL_checkstring(L,WSLUA_ARG_register_stat_cmd_arg_ARGUMENT); statcmd_t* sc = g_malloc0(sizeof(statcmd_t)); /* XXX leaked */ sc->L = L; lua_pushvalue(L, WSLUA_OPTARG_register_stat_cmd_arg_ACTION); sc->func_ref = luaL_ref(L, LUA_REGISTRYINDEX); lua_remove(L,1); register_stat_cmd_arg(arg, statcmd_init, sc); return 0; }
/* * Register a stat that has a display filter dialog. * We register it both as a command-line stat and a menu item stat. */ void register_dfilter_stat(tap_dfilter_dlg *info, const char *name, register_stat_group_t group) { char *full_name; register_stat_cmd_arg(info->init_string, info->tap_init_cb, NULL); /* * This menu item will pop up a dialog box, so append "..." * to it. */ full_name = g_strdup_printf("%s...", name); register_stat_menu_item(full_name, group, tap_dfilter_dlg_cb, NULL, NULL, info); g_free(full_name); }