diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/epan.c | 7 | ||||
-rw-r--r-- | epan/packet.c | 7 | ||||
-rw-r--r-- | epan/packet.h | 4 | ||||
-rw-r--r-- | epan/proto.c | 19 | ||||
-rw-r--r-- | epan/proto.h | 5 | ||||
-rw-r--r-- | epan/tvbuff.c | 15 | ||||
-rw-r--r-- | epan/tvbuff.h | 6 |
7 files changed, 50 insertions, 13 deletions
diff --git a/epan/epan.c b/epan/epan.c index 7ebf350f12..d18f40eccf 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -1,6 +1,6 @@ /* epan.h * - * $Id: epan.c,v 1.6 2001/02/01 20:21:16 gram Exp $ + * $Id: epan.c,v 1.7 2001/03/23 14:44:01 jfoster Exp $ * * Ethereal Protocol Analyzer Library * @@ -77,6 +77,11 @@ epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_ edt = g_new(epan_dissect_t, 1); + /* start with empty data source list */ + if ( fd->data_src) + g_slist_free( fd->data_src); + fd->data_src = 0; + /* XXX - init tree */ edt->tree = tree; diff --git a/epan/packet.c b/epan/packet.c index 3fa6e4a56b..405e1398ad 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.22 2001/03/22 16:24:16 gram Exp $ + * $Id: packet.c,v 1.23 2001/03/23 14:44:01 jfoster Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -1073,7 +1073,10 @@ dissect_packet(tvbuff_t **p_tvb, union wtap_pseudo_header *pseudo_header, col_set_writable(fd, TRUE); TRY { - *p_tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len); + *p_tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len, "Frame"); + /* Add this tvbuffer into the data_src list */ + fd->data_src = g_slist_append( fd->data_src, *p_tvb); + pi.compat_top_tvb = *p_tvb; } CATCH(BoundsError) { diff --git a/epan/packet.h b/epan/packet.h index fd857c8be8..7a8882c4d0 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.23 2001/03/15 06:41:13 guy Exp $ + * $Id: packet.h,v 1.24 2001/03/23 14:44:01 jfoster Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -100,6 +100,7 @@ typedef struct _frame_data { struct _frame_data *next; /* Next element in list */ struct _frame_data *prev; /* Previous element in list */ GSList *pfd; /* Per frame proto data */ + GSList *data_src; /* Frame data sources */ guint32 num; /* Frame number */ guint32 pkt_len; /* Packet length */ guint32 cap_len; /* Amount actually captured */ @@ -131,6 +132,7 @@ typedef enum { AT_ATALK, /* Appletalk DDP */ AT_VINES, /* Banyan Vines */ AT_OSI, /* OSI NSAP */ + AT_DLCI /* Frame Relay DLCI */ } address_type; typedef struct _address { 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); diff --git a/epan/proto.h b/epan/proto.h index 6aa31830f9..d5d16b45c9 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -1,7 +1,7 @@ /* proto.h * Definitions for protocol display * - * $Id: proto.h,v 1.8 2001/03/02 23:10:11 gram Exp $ + * $Id: proto.h,v 1.9 2001/03/23 14:44:02 jfoster Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -121,6 +121,7 @@ typedef struct field_info { char *representation; /* for GUI tree */ int visible; fvalue_t *value; + gchar *ds_name; /* data source name */ } field_info; @@ -558,6 +559,6 @@ char* proto_alloc_dfilter_string(field_info *finfo, guint8 *pd); field_info* -proto_find_field_from_offset(proto_tree *tree, guint offset); +proto_find_field_from_offset(proto_tree *tree, guint offset, gchar *ds_name); #endif /* proto.h */ diff --git a/epan/tvbuff.c b/epan/tvbuff.c index d2152bc679..1d6f3f2407 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.c,v 1.15 2001/03/13 21:34:27 gram Exp $ + * $Id: tvbuff.c,v 1.16 2001/03/23 14:44:02 jfoster Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org> * @@ -69,6 +69,7 @@ struct tvbuff { tvbuff_type type; gboolean initialized; guint usage_count; + gchar* ds_name; /* data source name */ /* The tvbuffs in which this tvbuff is a member * (that is, a backing tvbuff for a TVBUFF_SUBSET @@ -319,7 +320,7 @@ tvb_set_real_data(tvbuff_t* tvb, const guint8* data, guint length, gint reported } tvbuff_t* -tvb_new_real_data(const guint8* data, guint length, gint reported_length) +tvb_new_real_data(const guint8* data, guint length, gint reported_length, const gchar* ds_name) { tvbuff_t *tvb; @@ -329,6 +330,9 @@ tvb_new_real_data(const guint8* data, guint length, gint reported_length) tvb_set_real_data(tvb, data, length, reported_length); + /* set the data source name */ + tvb->ds_name = g_strdup( ds_name); + CLEANUP_POP; return tvb; @@ -497,6 +501,7 @@ tvb_new_subset(tvbuff_t *backing, gint backing_offset, gint backing_length, gint tvb_set_subset(tvb, backing, backing_offset, backing_length, reported_length); + tvb->ds_name = backing->ds_name; CLEANUP_POP; return tvb; @@ -1568,3 +1573,9 @@ tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len) { return bytes_to_str(tvb_get_ptr(tvb, offset, len), len); } + +gchar* +tvb_get_name(tvbuff_t* tvb) +{ + return tvb->ds_name; +} diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 21f224fbb4..0c043dda64 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.h,v 1.11 2001/03/13 21:34:27 gram Exp $ + * $Id: tvbuff.h,v 1.12 2001/03/23 14:44:02 jfoster Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org> * @@ -139,7 +139,7 @@ void tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child); void tvb_set_real_data(tvbuff_t*, const guint8* data, guint length, gint reported_length); /* Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */ -tvbuff_t* tvb_new_real_data(const guint8* data, guint length, gint reported_length); +tvbuff_t* tvb_new_real_data(const guint8* data, guint length, gint reported_length, const gchar *name); /* Define the subset of the backing buffer to use. @@ -363,6 +363,8 @@ gint tvb_strncaseeql(tvbuff_t *tvb, gint offset, const guint8 *str, gint size); */ gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len); +gchar *tvb_get_name(tvbuff_t *tvb); + /************** END OF ACCESSORS ****************/ /* Sets pd and offset so that tvbuff's can be used with code |