diff options
-rw-r--r-- | config.h.win32 | 1 | ||||
-rw-r--r-- | config.nmake | 4 | ||||
-rw-r--r-- | configure.in | 8 | ||||
-rw-r--r-- | gtk/menus.c | 8 | ||||
-rw-r--r-- | gtk/packet_win.c | 10 |
5 files changed, 30 insertions, 1 deletions
diff --git a/config.h.win32 b/config.h.win32 index 3d2a1c5c03..7be8b6411a 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -71,6 +71,7 @@ @HAVE_AIRPDCAP@ @MAIN_MENU_USE_UIMANAGER@ +@WANT_PACKET_EDITOR /* availability of pcap_freecode() is handled at runtime */ #define HAVE_PCAP_FREECODE 1 diff --git a/config.nmake b/config.nmake index 6fbce6aa6f..85ac657872 100644 --- a/config.nmake +++ b/config.nmake @@ -206,6 +206,10 @@ PYTHON="$(PYTHON_DIR)\python.exe" PATH=$(PYTHON_DIR);$(PATH) !ENDIF +##### To Use packet editor uncomment this line #### +### Warning Experimental - work in progress +#WANT_PACKET_EDITOR=^#define WANT_PACKET_EDITOR 1 + !if "$(WIRESHARK_TARGET_PLATFORM)" == "win32" ##### Win32 Libraries ##### # diff --git a/configure.in b/configure.in index 056a631515..00500ec785 100644 --- a/configure.in +++ b/configure.in @@ -718,6 +718,14 @@ AC_ARG_ENABLE(wireshark, [build GTK+-based wireshark. @<:@default=yes, if GTK+ available@:>@]), enable_wireshark=$enableval,enable_wireshark=yes) +AC_ARG_ENABLE(packet-editor, + AC_HELP_STRING( [--enable-packet-editor], + [add support for packet editor in wireshark. @<:@default=no@:>@]), + enable_packet_editor=$enableval,enable_packet_editor=no) +if test x$enable_packet_editor = xyes; then + AC_DEFINE(WANT_PACKET_EDITOR, 1, [Support for packet editor]) +fi + AC_ARG_ENABLE(threads, AC_HELP_STRING( [--enable-threads], [use threads in wireshark. @<:@default=no@:>@]), diff --git a/gtk/menus.c b/gtk/menus.c index 7f3c9395ef..cfd38493f1 100644 --- a/gtk/menus.c +++ b/gtk/menus.c @@ -382,11 +382,13 @@ new_window_cb(GtkWidget *widget) new_packet_window(widget, FALSE); } +#ifdef WANT_PACKET_EDITOR static void edit_window_cb(GtkWidget *widget) { new_packet_window(widget, TRUE); } +#endif static void conversation_cb(GtkAction *a _U_, gpointer data _U_, int action) @@ -1070,8 +1072,10 @@ static const char *ui_desc_menubar = " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n" " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n" " <separator/>\n" +#ifdef WANT_PACKET_EDITOR " <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n" " <separator/>\n" +#endif " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n" " <menuitem name='Preferences' action='/Edit/Preferences'/>\n" " </menu>\n" @@ -1516,7 +1520,9 @@ static const GtkActionEntry main_menu_bar_entries[] = { { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) }, { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) }, +#ifdef WANT_PACKET_EDITOR { "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) }, +#endif { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL }, @@ -1951,8 +1957,10 @@ static GtkItemFactoryEntry menu_items[] = {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,}, {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,}, {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,}, +#ifdef WANT_PACKET_EDITOR {"/Edit/Edit packet", NULL, GTK_MENU_FUNC(edit_window_cb), 0, NULL, NULL, }, {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,}, +#endif {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,}, {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb), PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,}, diff --git a/gtk/packet_win.c b/gtk/packet_win.c index 7673725daf..d78f1aa8ef 100644 --- a/gtk/packet_win.c +++ b/gtk/packet_win.c @@ -88,6 +88,7 @@ struct PacketWinData { int pd_bitoffset; }; +#ifdef WANT_PACKET_EDITOR struct FieldinfoWinData { frame_data *frame; /* The frame being displayed */ union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */ @@ -116,6 +117,7 @@ struct CommonWinData { }; static gboolean edit_pkt_common_key_pressed_cb(GdkEventKey *event, struct CommonWinData *DataPtr); +#endif /* List of all the packet-detail windows popped up. */ static GList *detail_windows; @@ -156,6 +158,7 @@ button_press_handler(GtkWidget *widget, GdkEvent *event, gpointer data _U_) return FALSE; } +#ifdef WANT_PACKET_EDITOR static field_info * proto_finfo_find(proto_tree *tree, field_info *old_finfo) { @@ -821,8 +824,9 @@ edit_pkt_win_key_pressed_cb(GtkWidget *win _U_, GdkEventKey *event, gpointer use } return TRUE; } +#endif /* WANT_PACKET_EDITOR */ -void new_packet_window(GtkWidget *w _U_, gboolean editable) +void new_packet_window(GtkWidget *w _U_, gboolean editable _U_) { #define NewWinTitleLen 1000 char Title[NewWinTitleLen] = ""; @@ -906,11 +910,13 @@ void new_packet_window(GtkWidget *w _U_, gboolean editable) g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)), "changed", G_CALLBACK(new_tree_view_selection_changed_cb), DataPtr); g_signal_connect(tree_view, "button_press_event", G_CALLBACK(button_press_handler), NULL); +#ifdef WANT_PACKET_EDITOR if (editable && DataPtr->frame->cap_len != 0) { g_signal_connect(main_w, "key-press-event", G_CALLBACK(edit_pkt_win_key_pressed_cb), DataPtr); /* XXX, popup-menu instead of row-activated? */ g_signal_connect(tree_view, "row-activated", G_CALLBACK(edit_pkt_tree_row_activated_cb), DataPtr); } +#endif g_signal_connect(main_w, "destroy", G_CALLBACK(destroy_new_window), DataPtr); /* draw the protocol tree & print hex data */ @@ -966,6 +972,7 @@ new_tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data) DataPtr->finfo_selected = finfo; +#ifdef WANT_PACKET_EDITOR DataPtr->pd_offset = 0; DataPtr->pd_bitoffset = 0; @@ -995,6 +1002,7 @@ new_tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data) if ((guint)DataPtr->pd_offset >= DataPtr->frame->cap_len) DataPtr->pd_offset = 0; } +#endif packet_hex_print(byte_view, data, DataPtr->frame, finfo, len); } |