1999-11-06 06:28:07 +00:00
|
|
|
/* find_dlg.c
|
|
|
|
* Routines for "find frame" window
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-11-06 06:28:07 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-06 06:28:07 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-06 06:28:07 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-06 06:28:07 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
1999-11-06 06:28:07 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
1999-11-06 06:28:07 +00:00
|
|
|
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2004-08-13 02:39:49 +00:00
|
|
|
#include <epan/strutil.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2008-04-13 01:54:20 +00:00
|
|
|
|
|
|
|
#include "../globals.h"
|
2012-01-16 01:07:52 +00:00
|
|
|
#include "ui/main_statusbar.h"
|
2008-04-13 01:54:20 +00:00
|
|
|
|
2015-01-08 09:01:56 +00:00
|
|
|
#include "ui/gtk/old-gtk-compat.h"
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/gui_utils.h"
|
|
|
|
#include "ui/gtk/find_dlg.h"
|
|
|
|
#include "ui/gtk/filter_dlg.h"
|
|
|
|
#include "ui/gtk/dlg_utils.h"
|
|
|
|
#include "ui/gtk/stock_icons.h"
|
|
|
|
#include "ui/gtk/help_dlg.h"
|
|
|
|
#include "ui/gtk/filter_autocomplete.h"
|
1999-11-06 06:28:07 +00:00
|
|
|
|
|
|
|
/* Capture callback data keys */
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
#define E_FIND_FILT_KEY "find_filter_te"
|
|
|
|
#define E_FIND_BACKWARD_KEY "find_backward"
|
|
|
|
#define E_FIND_HEXDATA_KEY "find_hex"
|
2004-04-15 23:28:11 +00:00
|
|
|
#define E_FIND_STRINGDATA_KEY "find_string"
|
2003-07-22 23:08:48 +00:00
|
|
|
#define E_FIND_FILTERDATA_KEY "find_filter"
|
|
|
|
#define E_FIND_STRINGTYPE_KEY "find_string_type"
|
2004-02-28 22:07:33 +00:00
|
|
|
#define E_FIND_STRINGTYPE_LABEL_KEY "find_string_type_label"
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
#define E_CASE_SEARCH_KEY "case_insensitive_search"
|
2011-01-31 12:19:15 +00:00
|
|
|
#define E_SOURCE_DATA_KEY "packet_data_source"
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
#define E_SOURCE_DECODE_KEY "decode_data_source"
|
|
|
|
#define E_SOURCE_SUMMARY_KEY "summary_data_source"
|
|
|
|
#define E_FILT_TE_BUTTON_KEY "find_filter_button"
|
2003-08-05 00:01:27 +00:00
|
|
|
|
|
|
|
static gboolean case_type = TRUE;
|
2003-08-11 22:41:10 +00:00
|
|
|
static gboolean summary_data = FALSE;
|
|
|
|
static gboolean decode_data = FALSE;
|
2011-01-31 12:19:15 +00:00
|
|
|
static gboolean packet_data = FALSE;
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2004-02-28 04:18:47 +00:00
|
|
|
static void
|
|
|
|
find_filter_te_syntax_check_cb(GtkWidget *w, gpointer parent_w);
|
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
static void
|
|
|
|
find_frame_ok_cb(GtkWidget *ok_bt, gpointer parent_w);
|
|
|
|
|
|
|
|
static void
|
|
|
|
find_frame_close_cb(GtkWidget *close_bt, gpointer parent_w);
|
|
|
|
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
static void
|
|
|
|
find_frame_destroy_cb(GtkWidget *win, gpointer user_data);
|
|
|
|
|
2004-02-28 04:18:47 +00:00
|
|
|
static void
|
|
|
|
hex_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w);
|
|
|
|
|
2003-08-11 22:41:10 +00:00
|
|
|
static void
|
2004-04-15 23:28:11 +00:00
|
|
|
string_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w);
|
2003-08-11 22:41:10 +00:00
|
|
|
|
2003-08-28 23:25:55 +00:00
|
|
|
static void
|
|
|
|
filter_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w);
|
|
|
|
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
/*
|
2003-11-28 19:02:41 +00:00
|
|
|
* Keep a static pointer to the current "Find Packet" window, if any, so
|
|
|
|
* that if somebody tries to do "Find Packet" while there's already a
|
|
|
|
* "Find Packet" window up, we just pop up the existing one, rather than
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
* creating a new one.
|
|
|
|
*/
|
|
|
|
static GtkWidget *find_frame_w;
|
2003-09-05 06:16:10 +00:00
|
|
|
static GtkWidget *filter_text_box;
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
|
2009-03-13 21:25:28 +00:00
|
|
|
/*
|
2011-03-21 18:54:10 +00:00
|
|
|
* Save the presskey handlers to be able to dissable the auto-completion
|
2009-03-13 21:25:28 +00:00
|
|
|
* feature for hex and string searches.
|
|
|
|
*/
|
2009-04-28 03:00:40 +00:00
|
|
|
static gulong te_presskey_handler_id;
|
|
|
|
static gulong win_presskey_handler_id;
|
2009-03-13 21:25:28 +00:00
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
void
|
2002-03-05 11:56:00 +00:00
|
|
|
find_frame_cb(GtkWidget *w _U_, gpointer d _U_)
|
1999-11-06 06:28:07 +00:00
|
|
|
{
|
2004-02-28 22:07:33 +00:00
|
|
|
GtkWidget *main_vb, *main_find_hb, *main_options_hb,
|
2004-08-13 02:39:49 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
*find_type_frame, *find_type_vb,
|
2004-04-15 23:28:11 +00:00
|
|
|
*find_type_hb, *find_type_lb, *hex_rb, *string_rb, *filter_rb,
|
2004-02-28 22:07:33 +00:00
|
|
|
*filter_hb, *filter_bt,
|
|
|
|
|
|
|
|
*direction_frame, *direction_vb,
|
|
|
|
*up_rb, *down_rb,
|
|
|
|
|
|
|
|
*data_frame, *data_vb,
|
2011-01-31 12:19:15 +00:00
|
|
|
*packet_data_rb, *decode_data_rb, *summary_data_rb,
|
2004-02-28 22:07:33 +00:00
|
|
|
|
|
|
|
*string_opt_frame, *string_opt_vb,
|
2004-08-13 02:39:49 +00:00
|
|
|
*case_cb, *combo_lb, *combo_cb,
|
2004-02-28 22:07:33 +00:00
|
|
|
|
2005-01-20 23:17:23 +00:00
|
|
|
*bbox, *ok_bt, *cancel_bt, *help_bt;
|
2009-03-02 21:30:17 +00:00
|
|
|
|
2009-10-18 10:23:50 +00:00
|
|
|
|
In the process of destroying a filter editing dialog box, we get a
selection change event on the list of filters. Unfortunately, this can
happen after some other widgets in that dialog box have already been
destroyed - including some of the widgets that such a selection change
event can change.
This sometimes happened when "filter_prefs_delete()" hadn't been called,
so the mechanism we had been using, with a Boolean datum attached to the
dialog box, set in "filter_prefs_delete()" before we actually destroy
the dialog box, wasn't sufficient to keep that from happening.
Attach to the top-level window data items containing pointers to the
widgets changed when a filter is selected from the list, give each of
those widgets their own destroy callbacks, clear the pointer attached to
the top-level widget when the widget is destroyed, and don't do anything
to the widget when a filter is selected from the list if the pointer for
that widget is null, as that means the widget's been destroyed and we
*can't* do anything to it.
Not all filter editing dialogs created on behalf of a "Filter:" button
next to a text entry box should, when you click "OK", activate the text
entry box; if the text entry box is part of a dialog box with multiple
widgets, the user might not have filled in all of the items in that
dialog box, so you shouldn't activate it for them. Add a mechanism by
which, when creating a filter editing dialog box, you can specify
whether the "OK" button should just fill in the text entry box or should
fill it in and also activate it.
svn path=/trunk/; revision=2922
2001-01-21 01:45:07 +00:00
|
|
|
/* No Apply button, but "OK" not only sets our text widget, it
|
|
|
|
activates it (i.e., it causes us to do the search). */
|
2001-01-21 02:27:24 +00:00
|
|
|
static construct_args_t args = {
|
2012-06-04 19:45:44 +00:00
|
|
|
"Wireshark: Search Filter",
|
|
|
|
FALSE,
|
|
|
|
TRUE,
|
2005-12-31 17:09:27 +00:00
|
|
|
FALSE
|
2001-01-21 02:27:24 +00:00
|
|
|
};
|
1999-11-06 06:28:07 +00:00
|
|
|
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
if (find_frame_w != NULL) {
|
2003-11-28 19:02:41 +00:00
|
|
|
/* There's already a "Find Packet" dialog box; reactivate it. */
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
reactivate_window(find_frame_w);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
find_frame_w = dlg_window_new("Wireshark: Find Packet");
|
2003-08-28 23:25:55 +00:00
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
/* Container for each row of widgets */
|
2012-04-21 16:40:14 +00:00
|
|
|
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);
|
1999-11-06 06:28:07 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(find_frame_w), main_vb);
|
|
|
|
gtk_widget_show(main_vb);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* */
|
2012-04-21 16:40:14 +00:00
|
|
|
main_find_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (main_vb), main_find_hb, TRUE, TRUE, 0);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(main_find_hb);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* find frame */
|
|
|
|
find_type_frame = gtk_frame_new("Find");
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_find_hb), find_type_frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(find_type_frame);
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2012-04-21 16:40:14 +00:00
|
|
|
find_type_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(find_type_vb), 3);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(find_type_frame), find_type_vb);
|
|
|
|
gtk_widget_show(find_type_vb);
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* find type row */
|
2012-04-21 16:40:14 +00:00
|
|
|
find_type_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (find_type_vb), find_type_hb, TRUE, TRUE, 0);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(find_type_hb);
|
2003-07-22 23:08:48 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
find_type_lb = gtk_label_new("By:");
|
|
|
|
gtk_box_pack_start(GTK_BOX(find_type_hb), find_type_lb, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(find_type_lb);
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2003-07-22 23:08:48 +00:00
|
|
|
/* Filter */
|
2008-04-11 19:26:22 +00:00
|
|
|
filter_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_Display filter");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filter_rb), !cfile.hex && !cfile.string);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(find_type_hb), filter_rb, FALSE, FALSE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(filter_rb, "Search for data by display filter syntax.\ne.g. ip.addr==10.1.1.1");
|
2003-07-22 23:08:48 +00:00
|
|
|
gtk_widget_show(filter_rb);
|
|
|
|
|
|
|
|
/* Hex */
|
2008-04-11 19:26:22 +00:00
|
|
|
hex_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(filter_rb), "_Hex value");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hex_rb), cfile.hex);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(find_type_hb), hex_rb, FALSE, FALSE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(hex_rb, "Search for data by hex string.\ne.g. fffffda5");
|
2003-07-22 23:08:48 +00:00
|
|
|
gtk_widget_show(hex_rb);
|
|
|
|
|
|
|
|
/* ASCII Search */
|
2008-04-11 19:26:22 +00:00
|
|
|
string_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(filter_rb), "_String");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(string_rb), cfile.string);
|
|
|
|
gtk_box_pack_start(GTK_BOX(find_type_hb), string_rb, FALSE, FALSE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(string_rb, "Search for data by string value.\ne.g. My String");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_widget_show(string_rb);
|
2003-07-22 23:08:48 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* Filter row */
|
2012-04-21 16:40:14 +00:00
|
|
|
filter_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2004-02-29 10:41:03 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(find_type_vb), filter_hb, FALSE, FALSE, 0);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(filter_hb);
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2014-02-21 13:09:52 +00:00
|
|
|
filter_bt = ws_gtk_button_new_from_stock(WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY);
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(filter_bt, "clicked", G_CALLBACK(display_filter_construct_cb), &args);
|
|
|
|
g_signal_connect(filter_bt, "destroy", G_CALLBACK(filter_button_destroy_cb), NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(filter_bt), E_FILT_TE_BUTTON_KEY, filter_bt);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(filter_hb), filter_bt, FALSE, TRUE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(filter_bt, "Click on the filter button to select a display filter,\nor enter your search criteria into the text box");
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(filter_bt);
|
2003-08-11 22:41:10 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
filter_text_box = gtk_entry_new();
|
|
|
|
if (cfile.sfilter) gtk_entry_set_text(GTK_ENTRY(filter_text_box), cfile.sfilter);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, filter_text_box);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FILT_TE_PTR_KEY, filter_text_box);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(filter_hb), filter_text_box, TRUE, TRUE, 0);
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(filter_text_box, "changed", G_CALLBACK(find_filter_te_syntax_check_cb), find_frame_w);
|
2008-07-22 15:19:10 +00:00
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FILT_AUTOCOMP_PTR_KEY, NULL);
|
2009-03-13 21:25:28 +00:00
|
|
|
te_presskey_handler_id = g_signal_connect(filter_text_box, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL);
|
|
|
|
win_presskey_handler_id = g_signal_connect(find_frame_w, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(filter_text_box);
|
2003-08-11 22:41:10 +00:00
|
|
|
|
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* */
|
2012-04-21 16:40:14 +00:00
|
|
|
main_options_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (main_vb), main_options_hb, TRUE, TRUE, 0);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(main_options_hb);
|
|
|
|
|
2003-08-11 22:41:10 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* search in frame */
|
|
|
|
data_frame = gtk_frame_new("Search In");
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_options_hb), data_frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(data_frame);
|
|
|
|
|
|
|
|
/* search in row */
|
2012-04-21 16:40:14 +00:00
|
|
|
data_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(data_vb), 3);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(data_frame), data_vb);
|
|
|
|
gtk_widget_show(data_vb);
|
|
|
|
|
|
|
|
/* Packet list */
|
2008-04-11 19:26:22 +00:00
|
|
|
summary_data_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "Packet list");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(summary_data_rb), summary_data);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(data_vb), summary_data_rb, TRUE, TRUE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(summary_data_rb, "Search for string in the Info column of the packet summary (summary pane)");
|
2003-08-11 22:41:10 +00:00
|
|
|
gtk_widget_show(summary_data_rb);
|
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* Packet details */
|
2008-04-11 19:26:22 +00:00
|
|
|
decode_data_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(summary_data_rb), "Packet details");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_data_rb), decode_data);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(data_vb), decode_data_rb, TRUE, TRUE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(decode_data_rb, "Search for string among the decoded packet display labels (tree view pane)");
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(decode_data_rb);
|
|
|
|
|
|
|
|
/* Packet bytes */
|
2011-01-31 12:19:15 +00:00
|
|
|
packet_data_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(summary_data_rb), "Packet bytes");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(packet_data_rb), packet_data);
|
|
|
|
gtk_box_pack_start(GTK_BOX(data_vb), packet_data_rb, TRUE, TRUE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(packet_data_rb, "Search for string in the ASCII-converted packet data (hex view pane)");
|
2011-01-31 12:19:15 +00:00
|
|
|
gtk_widget_show(packet_data_rb);
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* string options frame */
|
|
|
|
string_opt_frame = gtk_frame_new("String Options");
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_options_hb), string_opt_frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(string_opt_frame);
|
|
|
|
|
2012-04-21 16:40:14 +00:00
|
|
|
string_opt_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(string_opt_frame), string_opt_vb);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(string_opt_vb), 3);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(string_opt_vb);
|
|
|
|
|
2008-04-11 19:04:34 +00:00
|
|
|
case_cb = gtk_check_button_new_with_mnemonic("Case sensitive");
|
2004-04-15 23:28:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(case_cb), !case_type);
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (string_opt_vb), case_cb, TRUE, TRUE, 0);
|
2011-07-11 20:01:28 +00:00
|
|
|
gtk_widget_set_tooltip_text(case_cb, "Search by mixed upper/lower case?");
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(case_cb);
|
|
|
|
|
2012-12-15 01:04:39 +00:00
|
|
|
combo_lb = gtk_label_new("Character width:");
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (string_opt_vb), combo_lb, TRUE, TRUE, 0);
|
2009-04-21 16:57:52 +00:00
|
|
|
gtk_misc_set_alignment(GTK_MISC(combo_lb), 0.0f, 0.5f);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_show(combo_lb);
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2008-01-24 22:12:10 +00:00
|
|
|
/* Character Type Selection Dropdown Box
|
|
|
|
These only apply to the string find option */
|
2003-07-22 23:08:48 +00:00
|
|
|
/* Create Combo Box */
|
2011-03-21 18:54:10 +00:00
|
|
|
|
2011-07-24 16:50:55 +00:00
|
|
|
combo_cb = gtk_combo_box_text_new();
|
2003-07-22 23:08:48 +00:00
|
|
|
|
2012-12-15 01:04:39 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_cb), "Narrow & wide");
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_cb), "Narrow (UTF-8 / ASCII)");
|
|
|
|
/* UCS-2 might be more accurate but then we'd have to explain why we don't support UTF-16 */
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_cb), "Wide (UTF-16)");
|
2003-07-22 23:08:48 +00:00
|
|
|
|
2009-03-02 20:20:39 +00:00
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_cb),0);
|
2012-07-19 15:02:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX (string_opt_vb), combo_cb, TRUE, TRUE, 0);
|
2009-03-03 05:52:46 +00:00
|
|
|
|
2003-07-22 23:08:48 +00:00
|
|
|
gtk_widget_show(combo_cb);
|
|
|
|
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2004-02-28 22:07:33 +00:00
|
|
|
/* direction frame */
|
|
|
|
direction_frame = gtk_frame_new("Direction");
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_options_hb), direction_frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(direction_frame);
|
|
|
|
|
|
|
|
/* Direction row: Forward and reverse radio buttons */
|
2012-04-21 16:40:14 +00:00
|
|
|
direction_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(direction_vb), 3);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(direction_frame), direction_vb);
|
|
|
|
gtk_widget_show(direction_vb);
|
|
|
|
|
2008-04-11 19:26:22 +00:00
|
|
|
up_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_Up");
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(up_rb), cfile.dir == SD_BACKWARD);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(direction_vb), up_rb, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(up_rb);
|
|
|
|
|
2008-04-11 19:26:22 +00:00
|
|
|
down_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(up_rb), "_Down");
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(down_rb), cfile.dir == SD_FORWARD);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(direction_vb), down_rb, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(down_rb);
|
|
|
|
|
2003-08-05 00:01:27 +00:00
|
|
|
|
2004-01-21 21:19:34 +00:00
|
|
|
/* Button row */
|
2008-06-21 13:36:31 +00:00
|
|
|
bbox = dlg_button_row_new(GTK_STOCK_FIND, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL);
|
2004-01-21 21:19:34 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
|
1999-11-06 06:28:07 +00:00
|
|
|
gtk_widget_show(bbox);
|
|
|
|
|
2013-03-09 17:33:15 +00:00
|
|
|
ok_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_FIND);
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(ok_bt, "clicked", G_CALLBACK(find_frame_ok_cb), find_frame_w);
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2013-03-09 17:33:15 +00:00
|
|
|
cancel_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(cancel_bt, "clicked", G_CALLBACK(find_frame_close_cb), find_frame_w);
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2013-03-09 17:33:15 +00:00
|
|
|
help_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP);
|
2008-06-21 13:36:31 +00:00
|
|
|
g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_FIND_DIALOG);
|
2005-01-20 23:17:23 +00:00
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
/* Attach pointers to needed widgets to the capture prefs window/object */
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_FILT_KEY, filter_text_box);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_BACKWARD_KEY, up_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_FILTERDATA_KEY, filter_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_HEXDATA_KEY, hex_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_STRINGDATA_KEY, string_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_STRINGTYPE_LABEL_KEY, combo_lb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FIND_STRINGTYPE_KEY, combo_cb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_CASE_SEARCH_KEY, case_cb);
|
2011-01-31 12:19:15 +00:00
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_SOURCE_DATA_KEY, packet_data_rb);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_SOURCE_DECODE_KEY, decode_data_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_SOURCE_SUMMARY_KEY, summary_data_rb);
|
|
|
|
g_object_set_data(G_OBJECT(find_frame_w), E_FILT_TE_BUTTON_KEY, filter_bt);
|
2004-08-13 02:39:49 +00:00
|
|
|
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/*
|
|
|
|
* Now that we've attached the pointers, connect the signals - if
|
|
|
|
* we do so before we've attached the pointers, the signals may
|
|
|
|
* be delivered before the pointers are attached; the signal
|
|
|
|
* handlers expect the pointers to be attached, and won't be happy.
|
|
|
|
*/
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(hex_rb, "clicked", G_CALLBACK(hex_selected_cb), find_frame_w);
|
|
|
|
g_signal_connect(string_rb, "clicked", G_CALLBACK(string_selected_cb), find_frame_w);
|
|
|
|
g_signal_connect(filter_rb, "clicked", G_CALLBACK(filter_selected_cb), find_frame_w);
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2004-04-15 23:28:11 +00:00
|
|
|
string_selected_cb(NULL, find_frame_w);
|
2003-08-28 23:25:55 +00:00
|
|
|
filter_selected_cb(NULL, find_frame_w);
|
2004-05-26 03:49:24 +00:00
|
|
|
|
|
|
|
window_set_cancel_button(find_frame_w, cancel_bt, window_cancel_button_cb);
|
|
|
|
|
|
|
|
gtk_widget_grab_default(ok_bt);
|
|
|
|
|
2003-04-24 23:18:07 +00:00
|
|
|
/* Catch the "activate" signal on the filter text entry, so that
|
2000-05-02 08:04:31 +00:00
|
|
|
if the user types Return there, we act as if the "OK" button
|
|
|
|
had been selected, as happens if Return is typed if some widget
|
|
|
|
that *doesn't* handle the Return key has the input focus. */
|
2003-09-05 06:16:10 +00:00
|
|
|
dlg_set_activate(filter_text_box, ok_bt);
|
2000-05-02 08:04:31 +00:00
|
|
|
|
2000-03-15 08:54:24 +00:00
|
|
|
/* Give the initial focus to the "Filter" entry box. */
|
2003-09-05 06:16:10 +00:00
|
|
|
gtk_widget_grab_focus(filter_text_box);
|
2000-03-15 08:54:24 +00:00
|
|
|
|
2008-04-11 22:10:36 +00:00
|
|
|
g_signal_connect(find_frame_w, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
|
|
|
g_signal_connect(find_frame_w, "destroy", G_CALLBACK(find_frame_destroy_cb), NULL);
|
2004-05-26 03:49:24 +00:00
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
gtk_widget_show(find_frame_w);
|
2004-05-26 03:49:24 +00:00
|
|
|
window_present(find_frame_w);
|
1999-11-06 06:28:07 +00:00
|
|
|
}
|
|
|
|
|
2003-09-05 06:16:10 +00:00
|
|
|
/* this function opens the find frame dialogue and sets the filter string */
|
2004-08-13 02:39:49 +00:00
|
|
|
void
|
2003-09-05 06:16:10 +00:00
|
|
|
find_frame_with_filter(char *filter)
|
|
|
|
{
|
|
|
|
find_frame_cb(NULL, NULL);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(filter_text_box), filter);
|
|
|
|
}
|
|
|
|
|
2004-02-28 04:18:47 +00:00
|
|
|
/*
|
|
|
|
* Check the filter syntax based on the type of search we're doing.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
find_filter_te_syntax_check_cb(GtkWidget *w, gpointer parent_w)
|
|
|
|
{
|
|
|
|
const gchar *strval;
|
2004-04-15 23:28:11 +00:00
|
|
|
GtkWidget *hex_rb, *string_rb;
|
2004-02-28 04:18:47 +00:00
|
|
|
guint8 *bytes = NULL;
|
|
|
|
size_t nbytes;
|
|
|
|
|
2008-04-11 16:04:54 +00:00
|
|
|
hex_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_HEXDATA_KEY);
|
|
|
|
string_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGDATA_KEY);
|
2004-02-28 04:18:47 +00:00
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (hex_rb))) {
|
|
|
|
/*
|
|
|
|
* Hex search - scan the search string to make sure it's valid hex.
|
|
|
|
*/
|
|
|
|
strval = gtk_entry_get_text(GTK_ENTRY(w));
|
|
|
|
if (strval == NULL) {
|
2004-08-13 02:39:49 +00:00
|
|
|
/* XXX - can this happen? */
|
2004-02-28 04:18:47 +00:00
|
|
|
colorize_filter_te_as_invalid(w);
|
|
|
|
} else {
|
|
|
|
bytes = convert_string_to_hex(strval, &nbytes);
|
|
|
|
if (bytes == NULL)
|
|
|
|
colorize_filter_te_as_invalid(w);
|
|
|
|
else {
|
|
|
|
g_free(bytes);
|
|
|
|
colorize_filter_te_as_valid(w);
|
|
|
|
}
|
|
|
|
}
|
2004-04-15 23:28:11 +00:00
|
|
|
} else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb))) {
|
2004-02-28 04:18:47 +00:00
|
|
|
/*
|
|
|
|
* String search. Make sure the string isn't empty.
|
|
|
|
*/
|
|
|
|
strval = gtk_entry_get_text(GTK_ENTRY(w));
|
|
|
|
if (strval == NULL) {
|
2004-08-13 02:39:49 +00:00
|
|
|
/* XXX - can this happen? */
|
2004-02-28 04:18:47 +00:00
|
|
|
colorize_filter_te_as_invalid(w);
|
|
|
|
} else {
|
|
|
|
if (strcmp(strval, "") == 0)
|
|
|
|
colorize_filter_te_as_invalid(w);
|
|
|
|
else
|
|
|
|
colorize_filter_te_as_valid(w);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Display filter search; check it with "filter_te_syntax_check_cb()".
|
|
|
|
*/
|
2010-08-17 13:44:12 +00:00
|
|
|
filter_te_syntax_check_cb(w, NULL);
|
2004-02-28 04:18:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-13 02:39:49 +00:00
|
|
|
/*
|
2004-02-28 04:18:47 +00:00
|
|
|
* This function will re-check the search text syntax.
|
2004-08-13 02:39:49 +00:00
|
|
|
*/
|
2004-02-28 04:18:47 +00:00
|
|
|
static void
|
|
|
|
hex_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w)
|
|
|
|
{
|
2013-05-20 05:45:32 +00:00
|
|
|
GtkWidget *filter_tb, *hex_rb, *filter_entry;
|
2004-02-28 04:18:47 +00:00
|
|
|
|
2009-09-29 19:23:50 +00:00
|
|
|
filter_tb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_FILT_TE_PTR_KEY);
|
2009-03-13 21:25:28 +00:00
|
|
|
hex_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_HEXDATA_KEY);
|
|
|
|
|
2013-05-20 05:45:32 +00:00
|
|
|
filter_entry = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w),E_FIND_FILT_KEY);
|
|
|
|
gtk_widget_grab_focus(filter_entry);
|
|
|
|
|
2009-03-13 21:25:28 +00:00
|
|
|
/* Disable AutoCompletion feature */
|
2009-09-29 19:23:50 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hex_rb)) && g_signal_handler_is_connected(filter_tb, te_presskey_handler_id)) {
|
|
|
|
g_signal_handler_disconnect(filter_tb, te_presskey_handler_id);
|
2009-03-13 21:25:28 +00:00
|
|
|
g_signal_handler_disconnect(parent_w, win_presskey_handler_id);
|
|
|
|
}
|
2004-02-28 04:18:47 +00:00
|
|
|
|
|
|
|
/* Re-check the display filter. */
|
2009-09-29 19:23:50 +00:00
|
|
|
find_filter_te_syntax_check_cb(filter_tb, parent_w);
|
2004-02-28 04:18:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-08-13 02:39:49 +00:00
|
|
|
/*
|
2003-08-11 22:41:10 +00:00
|
|
|
* This function will disable the string options until
|
|
|
|
* the string search is selected.
|
2004-08-13 02:39:49 +00:00
|
|
|
*/
|
2003-08-11 22:41:10 +00:00
|
|
|
static void
|
2004-04-15 23:28:11 +00:00
|
|
|
string_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w)
|
2003-08-11 22:41:10 +00:00
|
|
|
{
|
2011-01-31 12:19:15 +00:00
|
|
|
GtkWidget *string_rb, *packet_data_rb, *decode_data_rb, *summary_data_rb,
|
2013-05-20 05:45:32 +00:00
|
|
|
*data_combo_lb, *data_combo_cb, *data_case_cb, *filter_tb, *filter_entry;
|
2003-08-11 22:41:10 +00:00
|
|
|
|
2008-04-11 16:04:54 +00:00
|
|
|
string_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGDATA_KEY);
|
2011-01-31 12:19:15 +00:00
|
|
|
packet_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_DATA_KEY);
|
2008-04-11 16:04:54 +00:00
|
|
|
decode_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_DECODE_KEY);
|
|
|
|
summary_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_SUMMARY_KEY);
|
2004-08-13 02:39:49 +00:00
|
|
|
|
2008-04-11 16:04:54 +00:00
|
|
|
data_combo_lb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGTYPE_LABEL_KEY);
|
|
|
|
data_combo_cb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGTYPE_KEY);
|
|
|
|
data_case_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CASE_SEARCH_KEY);
|
2009-09-29 19:23:50 +00:00
|
|
|
filter_tb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_FILT_TE_PTR_KEY);
|
2003-08-11 22:41:10 +00:00
|
|
|
|
2013-05-20 05:45:32 +00:00
|
|
|
filter_entry = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w),E_FIND_FILT_KEY);
|
|
|
|
gtk_widget_grab_focus(filter_entry);
|
|
|
|
|
2004-04-15 23:28:11 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(string_rb))) {
|
2011-01-31 12:19:15 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(packet_data_rb), TRUE);
|
2004-02-28 04:18:47 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(decode_data_rb), TRUE);
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(summary_data_rb), TRUE);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_combo_lb), TRUE);
|
2004-02-28 04:18:47 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_combo_cb), TRUE);
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_case_cb), TRUE);
|
2009-03-13 21:25:28 +00:00
|
|
|
|
|
|
|
/* Disable AutoCompletion feature */
|
2009-09-29 19:23:50 +00:00
|
|
|
if(g_signal_handler_is_connected(filter_tb, te_presskey_handler_id)) {
|
|
|
|
g_signal_handler_disconnect(filter_tb, te_presskey_handler_id);
|
2009-03-13 21:25:28 +00:00
|
|
|
g_signal_handler_disconnect(parent_w, win_presskey_handler_id);
|
|
|
|
}
|
|
|
|
|
2003-08-11 22:41:10 +00:00
|
|
|
} else {
|
2011-01-31 12:19:15 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(packet_data_rb), FALSE);
|
2003-08-11 22:41:10 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(decode_data_rb), FALSE);
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(summary_data_rb), FALSE);
|
2004-02-28 22:07:33 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_combo_lb), FALSE);
|
2003-08-11 22:41:10 +00:00
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_combo_cb), FALSE);
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data_case_cb), FALSE);
|
|
|
|
}
|
2004-02-28 04:18:47 +00:00
|
|
|
/* Re-check the display filter. */
|
2009-09-29 19:23:50 +00:00
|
|
|
find_filter_te_syntax_check_cb(filter_tb, parent_w);
|
2003-08-11 22:41:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-08-13 02:39:49 +00:00
|
|
|
/*
|
2003-08-28 23:25:55 +00:00
|
|
|
* This function will disable the filter button until
|
|
|
|
* the filter search is selected.
|
2004-08-13 02:39:49 +00:00
|
|
|
*/
|
2003-08-28 23:25:55 +00:00
|
|
|
static void
|
|
|
|
filter_selected_cb(GtkWidget *button_rb _U_, gpointer parent_w)
|
|
|
|
{
|
2013-05-20 05:45:32 +00:00
|
|
|
GtkWidget *filter_bt, *filter_rb, *filter_te, *filter_entry;
|
2003-08-28 23:25:55 +00:00
|
|
|
|
2008-04-11 16:04:54 +00:00
|
|
|
filter_bt = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FILT_TE_BUTTON_KEY);
|
|
|
|
filter_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_FILTERDATA_KEY);
|
2009-03-13 21:25:28 +00:00
|
|
|
filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FILT_TE_PTR_KEY);
|
2004-08-13 02:39:49 +00:00
|
|
|
|
2013-05-20 05:45:32 +00:00
|
|
|
filter_entry = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w),E_FIND_FILT_KEY);
|
|
|
|
gtk_widget_grab_focus(filter_entry);
|
|
|
|
|
2003-08-28 23:25:55 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filter_rb)))
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(filter_bt), TRUE);
|
2009-03-13 21:25:28 +00:00
|
|
|
/* Enable AutoCompletion feature */
|
|
|
|
if(!g_signal_handler_is_connected(filter_te, te_presskey_handler_id)) {
|
|
|
|
te_presskey_handler_id = g_signal_connect(filter_te, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL);
|
|
|
|
win_presskey_handler_id = g_signal_connect(parent_w, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL);
|
|
|
|
}
|
2003-08-28 23:25:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(filter_bt), FALSE);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-11-06 06:28:07 +00:00
|
|
|
static void
|
2002-03-05 11:56:00 +00:00
|
|
|
find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
|
1999-11-06 06:28:07 +00:00
|
|
|
{
|
2004-04-15 23:28:11 +00:00
|
|
|
GtkWidget *filter_te, *up_rb, *hex_rb, *string_rb, *combo_cb,
|
2011-01-31 12:19:15 +00:00
|
|
|
*case_cb, *packet_data_rb, *decode_data_rb, *summary_data_rb;
|
2009-10-18 10:23:50 +00:00
|
|
|
const gchar *filter_text;
|
2012-12-15 01:04:39 +00:00
|
|
|
search_charset_t scs_type = SCS_NARROW_AND_WIDE;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
guint8 *bytes = NULL;
|
2006-03-09 23:13:49 +00:00
|
|
|
size_t nbytes = 0;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
char *string = NULL;
|
2006-03-09 23:13:49 +00:00
|
|
|
dfilter_t *sfcode = NULL;
|
2011-03-21 18:54:10 +00:00
|
|
|
gboolean found_packet=FALSE;
|
|
|
|
gboolean hex_search;
|
|
|
|
gboolean string_search;
|
|
|
|
int string_type;
|
1999-11-06 06:28:07 +00:00
|
|
|
|
2008-04-11 16:04:54 +00:00
|
|
|
filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_FILT_KEY);
|
|
|
|
up_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_BACKWARD_KEY);
|
|
|
|
hex_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_HEXDATA_KEY);
|
|
|
|
string_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGDATA_KEY);
|
|
|
|
combo_cb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_STRINGTYPE_KEY);
|
|
|
|
case_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CASE_SEARCH_KEY);
|
2011-01-31 12:19:15 +00:00
|
|
|
packet_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_DATA_KEY);
|
2008-04-11 16:04:54 +00:00
|
|
|
decode_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_DECODE_KEY);
|
|
|
|
summary_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_SUMMARY_KEY);
|
1999-11-06 06:28:07 +00:00
|
|
|
|
|
|
|
filter_text = gtk_entry_get_text(GTK_ENTRY(filter_te));
|
2009-10-18 10:23:50 +00:00
|
|
|
|
|
|
|
/* Corresponds to the enum in file.c
|
2011-03-21 18:54:10 +00:00
|
|
|
* Character set for text search.
|
2009-10-18 10:23:50 +00:00
|
|
|
* typedef enum {
|
2012-12-15 01:04:39 +00:00
|
|
|
* SCS_NARROW_AND_WIDE,
|
|
|
|
* SCS_NARROW,
|
|
|
|
* SCS_WIDE
|
2009-10-18 10:23:50 +00:00
|
|
|
* / * add EBCDIC when it's implemented * /
|
|
|
|
* } search_charset_t;
|
|
|
|
*/
|
|
|
|
string_type = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_cb));
|
|
|
|
|
2011-03-21 18:54:10 +00:00
|
|
|
case_type = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_cb));
|
|
|
|
packet_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(packet_data_rb));
|
|
|
|
decode_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(decode_data_rb));
|
|
|
|
summary_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(summary_data_rb));
|
|
|
|
hex_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (hex_rb));
|
|
|
|
string_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb));
|
1999-11-06 06:28:07 +00:00
|
|
|
/*
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
* Process the search criterion.
|
1999-11-06 06:28:07 +00:00
|
|
|
*/
|
2011-03-21 18:54:10 +00:00
|
|
|
if (hex_search) {
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/*
|
|
|
|
* Hex search - scan the search string to make sure it's valid hex
|
|
|
|
* and to find out how many bytes there are.
|
|
|
|
*/
|
|
|
|
bytes = convert_string_to_hex(filter_text, &nbytes);
|
|
|
|
if (bytes == NULL) {
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("That's not a valid hex string.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-03-21 18:54:10 +00:00
|
|
|
} else if (string_search) {
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/*
|
|
|
|
* String search.
|
2004-02-28 04:18:47 +00:00
|
|
|
* Make sure we're searching for something, first.
|
|
|
|
*/
|
|
|
|
if (strcmp(filter_text, "") == 0) {
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("You didn't specify any text for which to search.");
|
2004-02-28 04:18:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We are - get the character set type.
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
*/
|
2012-12-15 01:04:39 +00:00
|
|
|
if (string_type == SCS_NARROW_AND_WIDE)
|
|
|
|
scs_type = SCS_NARROW_AND_WIDE;
|
|
|
|
else if (string_type == SCS_NARROW)
|
|
|
|
scs_type = SCS_NARROW;
|
|
|
|
else if (string_type == SCS_WIDE)
|
|
|
|
scs_type = SCS_WIDE;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
else {
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("You didn't choose a valid character set.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
string = convert_string_case(filter_text, case_type);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Display filter search - try to compile the filter.
|
|
|
|
*/
|
2015-01-18 10:22:19 +00:00
|
|
|
gchar *err_msg;
|
|
|
|
|
|
|
|
if (!dfilter_compile(filter_text, &sfcode, &err_msg)) {
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/* The attempt failed; report an error. */
|
2015-01-18 10:22:19 +00:00
|
|
|
bad_dfilter_alert_box(GTK_WIDGET(parent_w), filter_text, err_msg);
|
|
|
|
g_free(err_msg);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-11-06 06:28:07 +00:00
|
|
|
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/* Was it empty? */
|
|
|
|
if (sfcode == NULL) {
|
|
|
|
/* Yes - complain. */
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("That filter doesn't test anything.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-11-06 06:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
* Remember the search parameters.
|
1999-11-06 06:28:07 +00:00
|
|
|
*/
|
2009-03-13 22:06:48 +00:00
|
|
|
g_free(cfile.sfilter);
|
2000-06-27 04:36:03 +00:00
|
|
|
cfile.sfilter = g_strdup(filter_text);
|
2011-03-21 18:54:10 +00:00
|
|
|
cfile.dir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (up_rb)) ? SD_BACKWARD : SD_FORWARD;
|
|
|
|
cfile.hex = hex_search;
|
|
|
|
cfile.string = string_search;
|
|
|
|
cfile.scs_type = scs_type;
|
|
|
|
cfile.case_type = case_type;
|
|
|
|
cfile.packet_data = packet_data;
|
|
|
|
cfile.decode_data = decode_data;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
cfile.summary_data = summary_data;
|
|
|
|
|
|
|
|
if (cfile.hex) {
|
2011-03-21 18:54:10 +00:00
|
|
|
/* Hex value in packet data */
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
found_packet = cf_find_packet_data(&cfile, bytes, nbytes, cfile.dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
g_free(bytes);
|
|
|
|
if (!found_packet) {
|
|
|
|
/* We didn't find a packet */
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("No packet contained those bytes.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-04-15 23:28:11 +00:00
|
|
|
} else if (cfile.string) {
|
2011-01-31 12:19:15 +00:00
|
|
|
if (cfile.summary_data) {
|
|
|
|
/* String in the Info column of the summary line */
|
|
|
|
found_packet = cf_find_packet_summary_line(&cfile, string, cfile.dir);
|
|
|
|
g_free(string);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
if (!found_packet) {
|
2011-01-31 12:19:15 +00:00
|
|
|
statusbar_push_temporary_msg("No packet contained that string in its Info column.");
|
2003-07-22 23:08:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-31 12:19:15 +00:00
|
|
|
} else if (cfile.decode_data) {
|
|
|
|
/* String in the protocol tree headings */
|
|
|
|
found_packet = cf_find_packet_protocol_tree(&cfile, string, cfile.dir);
|
|
|
|
g_free(string);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
if (!found_packet) {
|
2011-01-31 12:19:15 +00:00
|
|
|
statusbar_push_temporary_msg("No packet contained that string in its dissected display.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
2003-08-11 22:41:10 +00:00
|
|
|
}
|
2011-02-18 19:46:05 +00:00
|
|
|
} else if (cfile.packet_data && string) {
|
2011-01-31 12:19:15 +00:00
|
|
|
/* String in the ASCII-converted packet data */
|
|
|
|
found_packet = cf_find_packet_data(&cfile, string, strlen(string), cfile.dir);
|
|
|
|
g_free(string);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
if (!found_packet) {
|
2011-01-31 12:19:15 +00:00
|
|
|
statusbar_push_temporary_msg("No packet contained that string in its ASCII-converted data.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
return;
|
2003-07-22 23:08:48 +00:00
|
|
|
}
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
}
|
|
|
|
} else {
|
2011-01-31 12:19:15 +00:00
|
|
|
/* Search via display filter */
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
found_packet = cf_find_packet_dfilter(&cfile, sfcode, cfile.dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
dfilter_free(sfcode);
|
|
|
|
if (!found_packet) {
|
2010-11-27 21:50:49 +00:00
|
|
|
statusbar_push_temporary_msg("No packet matched that filter.");
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
g_free(bytes);
|
|
|
|
return;
|
|
|
|
}
|
1999-11-06 06:54:24 +00:00
|
|
|
}
|
2004-05-26 03:49:24 +00:00
|
|
|
window_destroy(GTK_WIDGET(parent_w));
|
1999-11-06 06:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-03-05 11:56:00 +00:00
|
|
|
find_frame_close_cb(GtkWidget *close_bt _U_, gpointer parent_w)
|
1999-11-06 06:28:07 +00:00
|
|
|
{
|
|
|
|
gtk_grab_remove(GTK_WIDGET(parent_w));
|
2004-05-26 03:49:24 +00:00
|
|
|
window_destroy(GTK_WIDGET(parent_w));
|
1999-11-06 06:28:07 +00:00
|
|
|
}
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
|
|
|
|
static void
|
2003-01-15 05:20:19 +00:00
|
|
|
find_frame_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
{
|
2003-11-28 19:02:41 +00:00
|
|
|
/* Note that we no longer have a "Find Packet" dialog box. */
|
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
|
|
|
find_frame_w = NULL;
|
|
|
|
}
|
2002-05-03 21:55:15 +00:00
|
|
|
|
|
|
|
static void
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
find_previous_next(GtkWidget *w, gpointer d, search_direction dir)
|
2002-05-03 21:55:15 +00:00
|
|
|
{
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
guint8 *bytes;
|
|
|
|
size_t nbytes;
|
|
|
|
char *string;
|
2002-05-03 21:55:15 +00:00
|
|
|
dfilter_t *sfcode;
|
|
|
|
|
|
|
|
if (cfile.sfilter) {
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cfile.dir = dir;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
if (cfile.hex) {
|
|
|
|
bytes = convert_string_to_hex(cfile.sfilter, &nbytes);
|
|
|
|
if (bytes == NULL) {
|
|
|
|
/*
|
|
|
|
* XXX - this shouldn't happen, as we've already successfully
|
|
|
|
* translated the string once.
|
|
|
|
*/
|
2002-05-03 21:55:15 +00:00
|
|
|
return;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
}
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cf_find_packet_data(&cfile, bytes, nbytes, dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
g_free(bytes);
|
2004-04-15 23:28:11 +00:00
|
|
|
} else if (cfile.string) {
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
string = convert_string_case(cfile.sfilter, cfile.case_type);
|
|
|
|
/* OK, what are we searching? */
|
|
|
|
if (cfile.decode_data) {
|
|
|
|
/* The text in the protocol tree */
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cf_find_packet_protocol_tree(&cfile, string, dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
} else if (cfile.summary_data) {
|
|
|
|
/* The text in the summary line */
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cf_find_packet_summary_line(&cfile, string, dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
} else {
|
|
|
|
/* The raw packet data */
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cf_find_packet_data(&cfile, string, strlen(string), dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
}
|
|
|
|
g_free(string);
|
|
|
|
} else {
|
2015-01-18 10:22:19 +00:00
|
|
|
if (!dfilter_compile(cfile.sfilter, &sfcode, NULL)) {
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
/*
|
|
|
|
* XXX - this shouldn't happen, as we've already successfully
|
|
|
|
* translated the string once.
|
|
|
|
*/
|
2002-05-03 21:55:15 +00:00
|
|
|
return;
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
}
|
|
|
|
if (sfcode == NULL) {
|
|
|
|
/*
|
|
|
|
* XXX - this shouldn't happen, as we've already found that the
|
|
|
|
* string wasn't null.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
cf_find_packet_dfilter(&cfile, sfcode, dir);
|
Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.
Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.
Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.
Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.
Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code. Check that it's a valid string.
Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.
Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine. Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.
Search for the Info column by column type, not by name (the user can
change the name).
When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)
Free the generated display filter code after a find-by-display-filter
finishes.
svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
|
|
|
dfilter_free(sfcode);
|
|
|
|
}
|
2002-05-03 21:55:15 +00:00
|
|
|
} else
|
|
|
|
find_frame_cb(w, d);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
find_next_cb(GtkWidget *w , gpointer d)
|
|
|
|
{
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
find_previous_next(w, d, SD_FORWARD);
|
2002-05-03 21:55:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
find_previous_cb(GtkWidget *w , gpointer d)
|
|
|
|
{
|
Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.
Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction. Give
more information in the Doxygen comments for those routines.
Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument. Replace
find_previous_next_frame_with_filter() with it.
Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller. That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().
Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.
Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet. Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.
Clean up indentation.
svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
|
|
|
find_previous_next(w, d, SD_BACKWARD);
|
2003-10-07 09:30:34 +00:00
|
|
|
}
|