* Add a Submenu (/Views/User Tables) where UATs can be accessed.

* Remove macros_dlg, the DFMacros UAT goes in the menu with all the rest
* in packet-user_encap.c WTAP_ENCAP=XXX has become useless information for the user leave just the DLT#



svn path=/trunk/; revision=20753
This commit is contained in:
Luis Ontanon 2007-02-09 03:11:14 +00:00
parent 7de24ea51b
commit 7c57c05ed5
11 changed files with 65 additions and 93 deletions

View File

@ -468,12 +468,12 @@ void dfilter_macro_init(void) {
UAT_END_FIELDS
};
dfilter_macro_uat = uat_new("Display Filter Macros",
dfilter_macro_uat = uat_new(" Display Filter Macros",
sizeof(dfilter_macro_t),
DFILTER_MACRO_FILENAME,
(void**) &macros,
&num_macros,
UAT_CAT_GENERAL,
NULL,
"ChDisplayFilterMacrosSection",
macro_copy,
macro_update,

View File

@ -45,24 +45,24 @@ typedef struct _user_encap_t {
guint trailer_size;
} user_encap_t;
#define ENCAP0_STR "User 0 (DLT=147 WTAP_ENCAP=45)"
#define ENCAP0_STR "User 0 (DLT=147)"
static const value_string user_dlts[] = {
{ WTAP_ENCAP_USER0, ENCAP0_STR},
{ WTAP_ENCAP_USER1, "User 1 (DLT=148 WTAP_ENCAP=46)"},
{ WTAP_ENCAP_USER2, "User 2 (DLT=149 WTAP_ENCAP=47)"},
{ WTAP_ENCAP_USER3, "User 3 (DLT=150 WTAP_ENCAP=48)"},
{ WTAP_ENCAP_USER4, "User 4 (DLT=151 WTAP_ENCAP=49)"},
{ WTAP_ENCAP_USER5, "User 5 (DLT=152 WTAP_ENCAP=50)"},
{ WTAP_ENCAP_USER6, "User 6 (DLT=153 WTAP_ENCAP=51)"},
{ WTAP_ENCAP_USER7, "User 7 (DLT=154 WTAP_ENCAP=52)"},
{ WTAP_ENCAP_USER8, "User 8 (DLT=155 WTAP_ENCAP=53)"},
{ WTAP_ENCAP_USER9, "User 9 (DLT=156 WTAP_ENCAP=54)"},
{ WTAP_ENCAP_USER10, "User 10 (DLT=157 WTAP_ENCAP=55)"},
{ WTAP_ENCAP_USER11, "User 11 (DLT=158 WTAP_ENCAP=56)"},
{ WTAP_ENCAP_USER12, "User 12 (DLT=159 WTAP_ENCAP=57)"},
{ WTAP_ENCAP_USER13, "User 13 (DLT=160 WTAP_ENCAP=58)"},
{ WTAP_ENCAP_USER14, "User 14 (DLT=161 WTAP_ENCAP=59)"},
{ WTAP_ENCAP_USER15, "User 15 (DLT=162 WTAP_ENCAP=60)"},
{ WTAP_ENCAP_USER1, "User 1 (DLT=148)"},
{ WTAP_ENCAP_USER2, "User 2 (DLT=149)"},
{ WTAP_ENCAP_USER3, "User 3 (DLT=150)"},
{ WTAP_ENCAP_USER4, "User 4 (DLT=151)"},
{ WTAP_ENCAP_USER5, "User 5 (DLT=152)"},
{ WTAP_ENCAP_USER6, "User 6 (DLT=153)"},
{ WTAP_ENCAP_USER7, "User 7 (DLT=154)"},
{ WTAP_ENCAP_USER8, "User 8 (DLT=155)"},
{ WTAP_ENCAP_USER9, "User 9 (DLT=156)"},
{ WTAP_ENCAP_USER10, "User 10 (DLT=157)"},
{ WTAP_ENCAP_USER11, "User 11 (DLT=158)"},
{ WTAP_ENCAP_USER12, "User 12 (DLT=159)"},
{ WTAP_ENCAP_USER13, "User 13 (DLT=160)"},
{ WTAP_ENCAP_USER14, "User 14 (DLT=161)"},
{ WTAP_ENCAP_USER15, "User 15 (DLT=162)"},
{ 0, NULL }
};
static int proto_user_encap = -1;

View File

@ -786,6 +786,7 @@ tvb_strnlen
tvb_strsize
tvb_uncompress
uat_add_record
uat_foreach_table
uat_remove_record_idx
uat_save
uat_swap

View File

@ -79,7 +79,6 @@ WIRESHARK_GTK_SRC = \
help_dlg.c \
hostlist_table.c \
layout_prefs.c \
macros_dlg.c \
main.c \
menu.c \
nameres_prefs.c \

View File

@ -1,41 +0,0 @@
/* macros_dlg.c
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 2001 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gtk/gtk.h>
#include <epan/dfilter/dfilter-macro.h>
#include <stdlib.h>
#include <epan/uat.h>
#include "uat_gui.h"
#include "macros_dlg.h"
void macros_dialog_cb(GtkWidget *w _U_, gpointer data _U_) {
void* dfmuat;
dfilter_macro_get_uat(&dfmuat);
uat_window(dfmuat);
}

View File

@ -1,26 +0,0 @@
/* macros_dlg.h
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 2001 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MACROS_DLG_H_
#define __MACROS_DLG_H_
void macros_dialog_cb(GtkWidget*, gpointer);
#endif

View File

@ -96,6 +96,7 @@
#include "version_info.h"
#include "merge.h"
#include "u3.h"
#include "uat_gui.h"
#ifdef HAVE_LIBPCAP
@ -2373,6 +2374,10 @@ main(int argc, char *argv[])
epan_init(register_all_protocols,register_all_protocol_handoffs,
failure_alert_box,open_failure_alert_box,read_failure_alert_box);
uat_init_menus();
splash_update(splash_win, "Init tap listeners ...");
/* Register all tap listeners; we do this before we parse the arguments,

View File

@ -82,7 +82,7 @@
#include "sctp_stat.h"
#include "firewall_dlg.h"
#include "u3.h"
#include "macros_dlg.h"
GtkWidget *popup_menu_object;
@ -524,8 +524,7 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_STOCK_ENTRY("/View/_Coloring Rules...", NULL, color_display_cb,
0, GTK_STOCK_SELECT_COLOR),
ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/View/Display Filter _Macros...", NULL, macros_dialog_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/View/User Tables", NULL, NULL, 0, "<Branch>", NULL),
ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
@ -891,6 +890,7 @@ menus_init(void) {
/* init with an empty recent files list */
clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
}
}
@ -994,6 +994,7 @@ register_stat_menu_item(
have_items_in_tools_menu = TRUE;
break;
#endif
case(REGISTER_USER_TABLES): toolspath = "/View/User Tables/"; break;
default:
g_assert(!"no such menu group");
toolspath = NULL;
@ -1123,6 +1124,8 @@ static guint merge_tap_menus_layered(GList *node, gint group) {
case(REGISTER_TOOLS_GROUP_NONE):
break;
#endif
case(REGISTER_USER_TABLES):
break;
default:
g_assert_not_reached();
}
@ -1200,7 +1203,11 @@ void merge_all_tap_menus(GList *node) {
/*gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);*/
}
#endif
if (merge_tap_menus_layered(node, REGISTER_USER_TABLES)) {
entry->path = "/View/";
/*gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);*/
}
}

View File

@ -51,7 +51,12 @@
#include "gui_utils.h"
#include "dlg_utils.h"
#include "help_dlg.h"
#include "menu.h"
#include "compat_macros.h"
#include <epan/proto.h>
#include <epan/packet.h>
#include "../stat_menu.h"
#include "gui_stat_menu.h"
#include <epan/uat-int.h>
#include <epan/value_string.h>
@ -787,7 +792,7 @@ static void uat_help_cb(GtkWidget* w _U_, gpointer u) {
}
#endif
GtkWidget* uat_window(void* u) {
static GtkWidget* uat_window(void* u) {
uat_t* uat = u;
uat_field_t* f = uat->fields;
uat_rep_t* rep;
@ -957,3 +962,24 @@ GtkWidget* uat_window(void* u) {
void uat_window_cb(GtkWidget* u _U_, void* uat) {
uat_window(uat);
}
/*
Add an UAT to the menu
*/
static void add_uat_to_menu(void* u, void* user_data _U_) {
uat_t* uat = u;
register_stat_menu_item(uat->category ? ep_strdup_printf("%s/%s",uat->category,uat->name) : uat->name,
REGISTER_USER_TABLES,
uat_window_cb,
NULL,
NULL,
uat);
}
void uat_init_menus(void) {
uat_foreach_table(add_uat_to_menu,NULL);
}

View File

@ -30,7 +30,7 @@
#ifndef _UAT_GUI_H_
#define _UAT_GUI_H_
GtkWidget* uat_window(void*);
void uat_window_cb(GtkWidget* unused, void* uat);
void uat_init_menus(void);
#endif

View File

@ -50,7 +50,8 @@ typedef enum {
REGISTER_STAT_GROUP_RESPONSE_TIME,
REGISTER_STAT_GROUP_TELEPHONY,
/* XXX - split into telephony and VoIP? */
REGISTER_ANALYZE_GROUP_NONE
REGISTER_ANALYZE_GROUP_NONE,
REGISTER_USER_TABLES
#ifdef HAVE_LUA_5_1
,REGISTER_TOOLS_GROUP_NONE
#endif