aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorjfoster <jfoster@f5534014-38df-0310-8fa8-9805f1628bb7>2001-03-23 14:44:04 +0000
committerjfoster <jfoster@f5534014-38df-0310-8fa8-9805f1628bb7>2001-03-23 14:44:04 +0000
commit2bd994141313d00dd56ee0c63eac0384e8a4de26 (patch)
tree3f409c6b10b05a765a7b836578421e65d7a7e231 /epan/proto.c
parenta5849bedec32c75d9049979e3a8d5546b9a767f5 (diff)
Changes required to support multiple named data sources.
Tvbuffers changed to added the data source name, GUI and printing code changed to support these changes and display the multiple hex views. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3165 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 0f54f2c528..fc9a6b50a4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.14 2001/03/15 22:08:41 guy Exp $
+ * $Id: proto.c,v 1.15 2001/03/23 14:44:02 jfoster Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -1460,6 +1460,9 @@ proto_tree_add_pi(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint
return pi;
}
+/* The default name for a NullTVB. This removed when all dissectors use tvbuffs */
+static gchar* null_tvb_ds_name = "Frame";
+
static field_info *
alloc_field_info(int hfindex, tvbuff_t *tvb, gint start, gint length)
{
@@ -1481,6 +1484,14 @@ alloc_field_info(int hfindex, tvbuff_t *tvb, gint start, gint length)
fi->value = fvalue_new(fi->hfinfo->type);
+ /* add the data source name */
+ /* This has the hack to return a default name for NullTVB. This */
+ /* hack can be removed when all dissectors use tvbuffs */
+ if ( tvb)
+ fi->ds_name = tvb_get_name(tvb);
+ else
+ fi->ds_name = null_tvb_ds_name;
+
return fi;
}
@@ -2595,6 +2606,7 @@ proto_get_finfo_ptr_array(proto_tree *tree, int id)
typedef struct {
guint offset;
field_info *finfo;
+ gchar *name;
} offset_search_t;
static gboolean
@@ -2604,7 +2616,7 @@ check_for_offset(GNode *node, gpointer data)
offset_search_t *offsearch = data;
/* !fi == the top most container node which holds nothing */
- if (fi && fi->visible) {
+ if (fi && fi->visible && !strcmp( offsearch->name,fi->ds_name)) {
if (offsearch->offset >= fi->start &&
offsearch->offset < (fi->start + fi->length)) {
@@ -2624,12 +2636,13 @@ check_for_offset(GNode *node, gpointer data)
* siblings of each node myself. When I have more time I'll do that.
* (yeah right) */
field_info*
-proto_find_field_from_offset(proto_tree *tree, guint offset)
+proto_find_field_from_offset(proto_tree *tree, guint offset, char* ds_name)
{
offset_search_t offsearch;
offsearch.offset = offset;
offsearch.finfo = NULL;
+ offsearch.name = ds_name;
g_node_traverse((GNode*)tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
check_for_offset, &offsearch);