Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a list of data sources associated with them. Use the tvbuff pointer to determine which data source is the data source for a given field; this means we don't have to worry about multiple data sources with the same name - the only thing the name does is label the notebook tab for the display of the data source, and label the hex dump of the data source in print/Tethereal output. Clean up a bunch of things discovered in the process of doing the above. svn path=/trunk/; revision=4749
This commit is contained in:
parent
d92a1cd8e1
commit
6a21dc7e44
|
@ -1,6 +1,6 @@
|
||||||
/* epan.h
|
/* epan.h
|
||||||
*
|
*
|
||||||
* $Id: epan.c,v 1.16 2002/01/04 08:57:09 guy Exp $
|
* $Id: epan.c,v 1.17 2002/02/18 01:08:41 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal Protocol Analyzer Library
|
* Ethereal Protocol Analyzer Library
|
||||||
*
|
*
|
||||||
|
@ -95,10 +95,7 @@ epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
|
||||||
const guint8* data, frame_data *fd, column_info *cinfo)
|
const guint8* data, frame_data *fd, column_info *cinfo)
|
||||||
{
|
{
|
||||||
/* start with empty data source list */
|
/* start with empty data source list */
|
||||||
if (fd->data_src) {
|
free_data_sources(fd);
|
||||||
g_slist_free(fd->data_src);
|
|
||||||
}
|
|
||||||
fd->data_src = NULL;
|
|
||||||
|
|
||||||
dissect_packet(edt, pseudo_header, data, fd, cinfo);
|
dissect_packet(edt, pseudo_header, data, fd, cinfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* frame_data.h
|
/* frame_data.h
|
||||||
* Definitions for frame_data structures and routines
|
* Definitions for frame_data structures and routines
|
||||||
*
|
*
|
||||||
* $Id: frame_data.h,v 1.3 2001/12/10 02:16:59 guy Exp $
|
* $Id: frame_data.h,v 1.4 2002/02/18 01:08:41 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#define __FRAME_DATA_H__
|
#define __FRAME_DATA_H__
|
||||||
|
|
||||||
#include "column_info.h"
|
#include "column_info.h"
|
||||||
|
#include "tvbuff.h"
|
||||||
|
|
||||||
/* XXX - some of this stuff is used only while a packet is being dissected;
|
/* XXX - some of this stuff is used only while a packet is being dissected;
|
||||||
should we keep that stuff in the "packet_info" structure, instead, to
|
should we keep that stuff in the "packet_info" structure, instead, to
|
||||||
|
@ -54,6 +55,15 @@ typedef struct _frame_data {
|
||||||
} flags;
|
} flags;
|
||||||
} frame_data;
|
} frame_data;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A data source.
|
||||||
|
* Has a tvbuff and a name.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
tvbuff_t *tvb;
|
||||||
|
char *name;
|
||||||
|
} data_source;
|
||||||
|
|
||||||
/* Utility routines used by packet*.c */
|
/* Utility routines used by packet*.c */
|
||||||
|
|
||||||
void p_add_proto_data(frame_data *, int, void *);
|
void p_add_proto_data(frame_data *, int, void *);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet.c
|
/* packet.c
|
||||||
* Routines for packet disassembly
|
* Routines for packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet.c,v 1.59 2002/02/17 00:51:21 guy Exp $
|
* $Id: packet.c,v 1.60 2002/02/18 01:08:41 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -180,6 +180,46 @@ postseq_cleanup_all_protocols(void)
|
||||||
&call_postseq_cleanup_routine, NULL);
|
&call_postseq_cleanup_routine, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Contains information about data sources. */
|
||||||
|
static GMemChunk *data_source_chunk = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a new data source to the list of data sources for a frame, given
|
||||||
|
* the tvbuff for the data source and its name.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
add_new_data_source(frame_data *fd, tvbuff_t *tvb, char *name)
|
||||||
|
{
|
||||||
|
data_source *src;
|
||||||
|
|
||||||
|
if (data_source_chunk == NULL) {
|
||||||
|
data_source_chunk = g_mem_chunk_new("data_source_chunk",
|
||||||
|
sizeof (data_source), 10 * sizeof (data_source),
|
||||||
|
G_ALLOC_AND_FREE);
|
||||||
|
}
|
||||||
|
src = g_mem_chunk_alloc(data_source_chunk);
|
||||||
|
src->tvb = tvb;
|
||||||
|
src->name = g_strdup(name);
|
||||||
|
fd->data_src = g_slist_append(fd->data_src, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free up a frame's list of data sources.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
free_data_sources(frame_data *fd)
|
||||||
|
{
|
||||||
|
GSList *src_le;
|
||||||
|
data_source *src;
|
||||||
|
|
||||||
|
for (src_le = fd->data_src; src_le != NULL; src_le = src_le->next) {
|
||||||
|
src = src_le->data;
|
||||||
|
g_free(src->name);
|
||||||
|
g_mem_chunk_free(data_source_chunk, src);
|
||||||
|
}
|
||||||
|
g_slist_free(fd->data_src);
|
||||||
|
fd->data_src = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Creates the top-most tvbuff and calls dissect_frame() */
|
/* Creates the top-most tvbuff and calls dissect_frame() */
|
||||||
void
|
void
|
||||||
|
@ -220,9 +260,9 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY {
|
TRY {
|
||||||
edt->tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len, "Frame");
|
edt->tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len);
|
||||||
/* Add this tvbuffer into the data_src list */
|
/* Add this tvbuffer into the data_src list */
|
||||||
fd->data_src = g_slist_append( fd->data_src, edt->tvb);
|
add_new_data_source(fd, edt->tvb, "Frame");
|
||||||
|
|
||||||
/* Even though dissect_frame() catches all the exceptions a
|
/* Even though dissect_frame() catches all the exceptions a
|
||||||
* sub-dissector can throw, dissect_frame() itself may throw
|
* sub-dissector can throw, dissect_frame() itself may throw
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet.h
|
/* packet.h
|
||||||
* Definitions for packet disassembly structures and routines
|
* Definitions for packet disassembly structures and routines
|
||||||
*
|
*
|
||||||
* $Id: packet.h,v 1.51 2002/02/17 00:51:21 guy Exp $
|
* $Id: packet.h,v 1.52 2002/02/18 01:08:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -228,6 +228,17 @@ extern void register_postseq_cleanup_routine(void (*func)(void));
|
||||||
/* Call all the registered "postseq_cleanup" routines. */
|
/* Call all the registered "postseq_cleanup" routines. */
|
||||||
extern void postseq_cleanup_all_protocols(void);
|
extern void postseq_cleanup_all_protocols(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a new data source to the list of data sources for a frame, given
|
||||||
|
* the tvbuff for the data source and its name.
|
||||||
|
*/
|
||||||
|
extern void add_new_data_source(frame_data *fd, tvbuff_t *tvb, char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free up a frame's list of data sources.
|
||||||
|
*/
|
||||||
|
extern void free_data_sources(frame_data *fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dissectors should never modify the packet data.
|
* Dissectors should never modify the packet data.
|
||||||
*/
|
*/
|
||||||
|
|
17
epan/proto.c
17
epan/proto.c
|
@ -1,7 +1,7 @@
|
||||||
/* proto.c
|
/* proto.c
|
||||||
* Routines for protocol tree
|
* Routines for protocol tree
|
||||||
*
|
*
|
||||||
* $Id: proto.c,v 1.51 2002/02/01 04:34:17 gram Exp $
|
* $Id: proto.c,v 1.52 2002/02/18 01:08:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1647,11 +1647,11 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint
|
||||||
|
|
||||||
fi->value = fvalue_new(fi->hfinfo->type);
|
fi->value = fvalue_new(fi->hfinfo->type);
|
||||||
|
|
||||||
/* add the data source name */
|
/* add the data source tvbuff */
|
||||||
if (tvb) {
|
if (tvb) {
|
||||||
fi->ds_name = tvb_get_name(tvb);
|
fi->ds_tvb = tvb_get_ds_tvb(tvb);
|
||||||
} else {
|
} else {
|
||||||
fi->ds_name = NULL;
|
fi->ds_tvb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fi;
|
return fi;
|
||||||
|
@ -2789,7 +2789,7 @@ proto_get_finfo_ptr_array(proto_tree *tree, int id)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint offset;
|
guint offset;
|
||||||
field_info *finfo;
|
field_info *finfo;
|
||||||
gchar *name;
|
tvbuff_t *tvb;
|
||||||
} offset_search_t;
|
} offset_search_t;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -2799,8 +2799,7 @@ check_for_offset(GNode *node, gpointer data)
|
||||||
offset_search_t *offsearch = data;
|
offset_search_t *offsearch = data;
|
||||||
|
|
||||||
/* !fi == the top most container node which holds nothing */
|
/* !fi == the top most container node which holds nothing */
|
||||||
if (fi && fi->visible && fi->ds_name &&
|
if (fi && fi->visible && fi->ds_tvb && offsearch->tvb == fi->ds_tvb) {
|
||||||
strcmp(offsearch->name, fi->ds_name) == 0) {
|
|
||||||
if (offsearch->offset >= (guint) fi->start &&
|
if (offsearch->offset >= (guint) fi->start &&
|
||||||
offsearch->offset < (guint) (fi->start + fi->length)) {
|
offsearch->offset < (guint) (fi->start + fi->length)) {
|
||||||
|
|
||||||
|
@ -2820,13 +2819,13 @@ check_for_offset(GNode *node, gpointer data)
|
||||||
* siblings of each node myself. When I have more time I'll do that.
|
* siblings of each node myself. When I have more time I'll do that.
|
||||||
* (yeah right) */
|
* (yeah right) */
|
||||||
field_info*
|
field_info*
|
||||||
proto_find_field_from_offset(proto_tree *tree, guint offset, char* ds_name)
|
proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb)
|
||||||
{
|
{
|
||||||
offset_search_t offsearch;
|
offset_search_t offsearch;
|
||||||
|
|
||||||
offsearch.offset = offset;
|
offsearch.offset = offset;
|
||||||
offsearch.finfo = NULL;
|
offsearch.finfo = NULL;
|
||||||
offsearch.name = ds_name;
|
offsearch.tvb = tvb;
|
||||||
|
|
||||||
g_node_traverse((GNode*)tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
|
g_node_traverse((GNode*)tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
|
||||||
check_for_offset, &offsearch);
|
check_for_offset, &offsearch);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* proto.h
|
/* proto.h
|
||||||
* Definitions for protocol display
|
* Definitions for protocol display
|
||||||
*
|
*
|
||||||
* $Id: proto.h,v 1.27 2002/02/05 22:10:20 guy Exp $
|
* $Id: proto.h,v 1.28 2002/02/18 01:08:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -113,7 +113,7 @@ typedef struct field_info {
|
||||||
char *representation; /* for GUI tree */
|
char *representation; /* for GUI tree */
|
||||||
int visible;
|
int visible;
|
||||||
fvalue_t *value;
|
fvalue_t *value;
|
||||||
gchar *ds_name; /* data source name */
|
tvbuff_t *ds_tvb; /* data source tvbuff */
|
||||||
} field_info;
|
} field_info;
|
||||||
|
|
||||||
/* One of these exists for the entire protocol tree. Each proto_node
|
/* One of these exists for the entire protocol tree. Each proto_node
|
||||||
|
@ -584,6 +584,6 @@ extern char*
|
||||||
proto_alloc_dfilter_string(field_info *finfo, guint8 *pd);
|
proto_alloc_dfilter_string(field_info *finfo, guint8 *pd);
|
||||||
|
|
||||||
extern field_info*
|
extern field_info*
|
||||||
proto_find_field_from_offset(proto_tree *tree, guint offset, gchar *ds_name);
|
proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
|
||||||
|
|
||||||
#endif /* proto.h */
|
#endif /* proto.h */
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* the data of a backing tvbuff, or can be a composite of
|
* the data of a backing tvbuff, or can be a composite of
|
||||||
* other tvbuffs.
|
* other tvbuffs.
|
||||||
*
|
*
|
||||||
* $Id: tvbuff.c,v 1.29 2002/02/01 07:03:32 guy Exp $
|
* $Id: tvbuff.c,v 1.30 2002/02/18 01:08:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||||
*
|
*
|
||||||
|
@ -68,7 +68,7 @@ struct tvbuff {
|
||||||
tvbuff_type type;
|
tvbuff_type type;
|
||||||
gboolean initialized;
|
gboolean initialized;
|
||||||
guint usage_count;
|
guint usage_count;
|
||||||
gchar* ds_name; /* data source name */
|
tvbuff_t* ds_tvb; /* data source top-level tvbuff */
|
||||||
|
|
||||||
/* The tvbuffs in which this tvbuff is a member
|
/* The tvbuffs in which this tvbuff is a member
|
||||||
* (that is, a backing tvbuff for a TVBUFF_SUBSET
|
* (that is, a backing tvbuff for a TVBUFF_SUBSET
|
||||||
|
@ -143,7 +143,7 @@ tvb_init(tvbuff_t *tvb, tvbuff_type type)
|
||||||
tvb->real_data = NULL;
|
tvb->real_data = NULL;
|
||||||
tvb->raw_offset = -1;
|
tvb->raw_offset = -1;
|
||||||
tvb->used_in = NULL;
|
tvb->used_in = NULL;
|
||||||
tvb->ds_name = NULL;
|
tvb->ds_tvb = NULL;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TVBUFF_REAL_DATA:
|
case TVBUFF_REAL_DATA:
|
||||||
|
@ -204,8 +204,6 @@ tvb_free(tvbuff_t* tvb)
|
||||||
if (tvb->free_cb) {
|
if (tvb->free_cb) {
|
||||||
tvb->free_cb(tvb->real_data);
|
tvb->free_cb(tvb->real_data);
|
||||||
}
|
}
|
||||||
if (tvb->ds_name)
|
|
||||||
g_free(tvb->ds_name);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TVBUFF_SUBSET:
|
case TVBUFF_SUBSET:
|
||||||
|
@ -214,12 +212,6 @@ tvb_free(tvbuff_t* tvb)
|
||||||
if (tvb->tvbuffs.subset.tvb) {
|
if (tvb->tvbuffs.subset.tvb) {
|
||||||
tvb_decrement_usage_count(tvb->tvbuffs.subset.tvb, 1);
|
tvb_decrement_usage_count(tvb->tvbuffs.subset.tvb, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* TVBUFF_SUBSET tvbuffs share a "ds_name" with
|
|
||||||
* the parent tvbuff, so this tvbuff's "ds_name"
|
|
||||||
* shouldn't be freed.
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TVBUFF_COMPOSITE:
|
case TVBUFF_COMPOSITE:
|
||||||
|
@ -237,8 +229,6 @@ tvb_free(tvbuff_t* tvb)
|
||||||
g_free(composite->end_offsets);
|
g_free(composite->end_offsets);
|
||||||
if (tvb->real_data)
|
if (tvb->real_data)
|
||||||
g_free(tvb->real_data);
|
g_free(tvb->real_data);
|
||||||
if (tvb->ds_name)
|
|
||||||
g_free(tvb->ds_name);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -330,7 +320,7 @@ tvb_set_real_data(tvbuff_t* tvb, const guint8* data, guint length, gint reported
|
||||||
}
|
}
|
||||||
|
|
||||||
tvbuff_t*
|
tvbuff_t*
|
||||||
tvb_new_real_data(const guint8* data, guint length, gint reported_length, const gchar* ds_name)
|
tvb_new_real_data(const guint8* data, guint length, gint reported_length)
|
||||||
{
|
{
|
||||||
tvbuff_t *tvb;
|
tvbuff_t *tvb;
|
||||||
|
|
||||||
|
@ -340,8 +330,11 @@ tvb_new_real_data(const guint8* data, guint length, gint reported_length, const
|
||||||
|
|
||||||
tvb_set_real_data(tvb, data, length, reported_length);
|
tvb_set_real_data(tvb, data, length, reported_length);
|
||||||
|
|
||||||
/* set the data source name */
|
/*
|
||||||
tvb->ds_name = g_strdup( ds_name);
|
* This is the top-level real tvbuff for this data source,
|
||||||
|
* so its data source tvbuff is itself.
|
||||||
|
*/
|
||||||
|
tvb->ds_tvb = tvb;
|
||||||
|
|
||||||
CLEANUP_POP;
|
CLEANUP_POP;
|
||||||
|
|
||||||
|
@ -517,7 +510,12 @@ 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_set_subset(tvb, backing, backing_offset, backing_length, reported_length);
|
||||||
|
|
||||||
tvb->ds_name = backing->ds_name;
|
/*
|
||||||
|
* The top-level data source of this tvbuff is the top-level
|
||||||
|
* data source of its parent.
|
||||||
|
*/
|
||||||
|
tvb->ds_tvb = backing->ds_tvb;
|
||||||
|
|
||||||
CLEANUP_POP;
|
CLEANUP_POP;
|
||||||
|
|
||||||
return tvb;
|
return tvb;
|
||||||
|
@ -1615,8 +1613,8 @@ tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len)
|
||||||
return bytes_to_str(tvb_get_ptr(tvb, offset, len), len);
|
return bytes_to_str(tvb_get_ptr(tvb, offset, len), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
tvbuff_t *
|
||||||
tvb_get_name(tvbuff_t* tvb)
|
tvb_get_ds_tvb(tvbuff_t *tvb)
|
||||||
{
|
{
|
||||||
return tvb->ds_name;
|
return tvb->ds_tvb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* the data of a backing tvbuff, or can be a composite of
|
* the data of a backing tvbuff, or can be a composite of
|
||||||
* other tvbuffs.
|
* other tvbuffs.
|
||||||
*
|
*
|
||||||
* $Id: tvbuff.h,v 1.21 2002/02/01 04:34:17 gram Exp $
|
* $Id: tvbuff.h,v 1.22 2002/02/18 01:08:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||||
*
|
*
|
||||||
|
@ -140,7 +140,7 @@ extern void tvb_set_real_data(tvbuff_t*, const guint8* data, guint length,
|
||||||
|
|
||||||
/* Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */
|
/* Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */
|
||||||
extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
|
extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
|
||||||
gint reported_length, const gchar *name);
|
gint reported_length);
|
||||||
|
|
||||||
|
|
||||||
/* Define the subset of the backing buffer to use.
|
/* Define the subset of the backing buffer to use.
|
||||||
|
@ -379,7 +379,7 @@ extern gint tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str,
|
||||||
*/
|
*/
|
||||||
extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
|
extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
|
||||||
|
|
||||||
extern gchar *tvb_get_name(tvbuff_t *tvb);
|
extern tvbuff_t *tvb_get_ds_tvb(tvbuff_t *tvb);
|
||||||
|
|
||||||
/************** END OF ACCESSORS ****************/
|
/************** END OF ACCESSORS ****************/
|
||||||
|
|
||||||
|
|
17
file.c
17
file.c
|
@ -1,7 +1,7 @@
|
||||||
/* file.c
|
/* file.c
|
||||||
* File I/O routines
|
* File I/O routines
|
||||||
*
|
*
|
||||||
* $Id: file.c,v 1.260 2002/02/08 10:07:34 guy Exp $
|
* $Id: file.c,v 1.261 2002/02/18 01:08:35 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1014,12 +1014,9 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
|
||||||
fdata->flags.visited = 0;
|
fdata->flags.visited = 0;
|
||||||
if (fdata->pfd) {
|
if (fdata->pfd) {
|
||||||
g_slist_free(fdata->pfd);
|
g_slist_free(fdata->pfd);
|
||||||
|
fdata->pfd = NULL;
|
||||||
}
|
}
|
||||||
fdata->pfd = NULL;
|
free_data_sources(fdata); /* release data source list */
|
||||||
if (fdata->data_src) { /* release data source list */
|
|
||||||
g_slist_free(fdata->data_src);
|
|
||||||
}
|
|
||||||
fdata->data_src = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
|
wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||||
|
@ -1045,12 +1042,9 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
|
||||||
fdata->flags.visited = 0;
|
fdata->flags.visited = 0;
|
||||||
if (fdata->pfd) {
|
if (fdata->pfd) {
|
||||||
g_slist_free(fdata->pfd);
|
g_slist_free(fdata->pfd);
|
||||||
|
fdata->pfd = NULL;
|
||||||
}
|
}
|
||||||
fdata->pfd = NULL;
|
free_data_sources(fdata); /* release data source list */
|
||||||
if (fdata->data_src) {
|
|
||||||
g_slist_free(fdata->data_src);
|
|
||||||
}
|
|
||||||
fdata->data_src = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1583,7 +1577,6 @@ select_packet(capture_file *cf, int row)
|
||||||
/* Display the GUI protocol tree and hex dump.
|
/* Display the GUI protocol tree and hex dump.
|
||||||
XXX - why does the protocol tree not show up if we call
|
XXX - why does the protocol tree not show up if we call
|
||||||
"proto_tree_draw()" before calling "add_byte_views()"? */
|
"proto_tree_draw()" before calling "add_byte_views()"? */
|
||||||
clear_tree_and_hex_views();
|
|
||||||
add_byte_views(cf->current_frame, cf->edt->tree, tree_view,
|
add_byte_views(cf->current_frame, cf->edt->tree, tree_view,
|
||||||
byte_nb_ptr);
|
byte_nb_ptr);
|
||||||
proto_tree_draw(cf->edt->tree, tree_view);
|
proto_tree_draw(cf->edt->tree, tree_view);
|
||||||
|
|
34
gtk/main.c
34
gtk/main.c
|
@ -1,6 +1,6 @@
|
||||||
/* main.c
|
/* main.c
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.232 2002/02/08 10:07:38 guy Exp $
|
* $Id: main.c,v 1.233 2002/02/18 01:08:44 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -164,7 +164,7 @@ typedef struct column_arrows {
|
||||||
capture_file cfile;
|
capture_file cfile;
|
||||||
GtkWidget *top_level, *packet_list, *tree_view, *byte_nb_ptr,
|
GtkWidget *top_level, *packet_list, *tree_view, *byte_nb_ptr,
|
||||||
*tv_scrollw, *pkt_scrollw;
|
*tv_scrollw, *pkt_scrollw;
|
||||||
static GtkWidget *info_bar, *bv_scrollw;
|
static GtkWidget *info_bar;
|
||||||
GdkFont *m_r_font, *m_b_font;
|
GdkFont *m_r_font, *m_b_font;
|
||||||
guint m_font_height, m_font_width;
|
guint m_font_height, m_font_width;
|
||||||
static guint main_ctx, file_ctx, help_ctx;
|
static guint main_ctx, file_ctx, help_ctx;
|
||||||
|
@ -759,20 +759,18 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
|
||||||
gboolean has_blurb = FALSE;
|
gboolean has_blurb = FALSE;
|
||||||
guint length = 0, byte_len;
|
guint length = 0, byte_len;
|
||||||
GtkWidget *byte_view;
|
GtkWidget *byte_view;
|
||||||
guint8 *byte_data;
|
tvbuff_t *byte_tvb;
|
||||||
|
const guint8 *byte_data;
|
||||||
|
|
||||||
g_assert(node);
|
g_assert(node);
|
||||||
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
||||||
if (!finfo) return;
|
if (!finfo) return;
|
||||||
|
|
||||||
if (finfo->ds_name != NULL)
|
set_notebook_page(byte_nb_ptr, finfo->ds_tvb);
|
||||||
set_notebook_page( byte_nb_ptr, find_notebook_page( byte_nb_ptr, finfo->ds_name));
|
|
||||||
|
|
||||||
byte_view = gtk_object_get_data(GTK_OBJECT(byte_nb_ptr), E_BYTE_VIEW_TEXT_INFO_KEY);
|
byte_view = get_notebook_bv_ptr(byte_nb_ptr);
|
||||||
byte_data = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_PTR_KEY);
|
byte_data = get_byte_view_data_and_length(byte_view, &byte_len);
|
||||||
byte_len = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_LEN_KEY));
|
g_assert(byte_data != NULL);
|
||||||
|
|
||||||
g_assert(byte_data);
|
|
||||||
|
|
||||||
finfo_selected = finfo;
|
finfo_selected = finfo;
|
||||||
set_menus_for_selected_tree_row(TRUE);
|
set_menus_for_selected_tree_row(TRUE);
|
||||||
|
@ -826,15 +824,19 @@ static void
|
||||||
tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user_data)
|
tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkWidget *byte_view;
|
GtkWidget *byte_view;
|
||||||
guint8 *data;
|
const guint8 *data;
|
||||||
gint len;
|
guint len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Which byte view is displaying the current protocol tree
|
* Which byte view is displaying the current protocol tree
|
||||||
* row's data?
|
* row's data?
|
||||||
*/
|
*/
|
||||||
len = get_byte_view_and_data( byte_nb_ptr, &byte_view, &data);
|
byte_view = get_notebook_bv_ptr(byte_nb_ptr);
|
||||||
if ( len < 0)
|
if (byte_view == NULL)
|
||||||
|
return; /* none */
|
||||||
|
|
||||||
|
data = get_byte_view_data_and_length(byte_view, &len);
|
||||||
|
if (data == NULL)
|
||||||
return; /* none */
|
return; /* none */
|
||||||
|
|
||||||
unselect_field();
|
unselect_field();
|
||||||
|
@ -856,7 +858,6 @@ void resolve_name_cb(GtkWidget *widget, gpointer data) {
|
||||||
if (cfile.edt->tree) {
|
if (cfile.edt->tree) {
|
||||||
guint32 tmp = g_resolv_flags;
|
guint32 tmp = g_resolv_flags;
|
||||||
g_resolv_flags = RESOLV_ALL;
|
g_resolv_flags = RESOLV_ALL;
|
||||||
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
|
||||||
proto_tree_draw(cfile.edt->tree, tree_view);
|
proto_tree_draw(cfile.edt->tree, tree_view);
|
||||||
g_resolv_flags = tmp;
|
g_resolv_flags = tmp;
|
||||||
}
|
}
|
||||||
|
@ -2286,8 +2287,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
|
||||||
gtk_widget_show(tree_view);
|
gtk_widget_show(tree_view);
|
||||||
|
|
||||||
/* Byte view. */
|
/* Byte view. */
|
||||||
create_byte_view(bv_size, l_pane, &byte_nb_ptr, &bv_scrollw,
|
byte_nb_ptr = create_byte_view(bv_size, l_pane, prefs->gui_scrollbar_on_right);
|
||||||
prefs->gui_scrollbar_on_right);
|
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(byte_nb_ptr), "button_press_event",
|
gtk_signal_connect(GTK_OBJECT(byte_nb_ptr), "button_press_event",
|
||||||
GTK_SIGNAL_FUNC(popup_menu_handler),
|
GTK_SIGNAL_FUNC(popup_menu_handler),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
||||||
*
|
*
|
||||||
* $Id: packet_win.c,v 1.32 2002/01/21 07:37:41 guy Exp $
|
* $Id: packet_win.c,v 1.33 2002/02/18 01:08:44 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -73,7 +73,6 @@ struct PacketWinData {
|
||||||
GtkWidget *main;
|
GtkWidget *main;
|
||||||
GtkWidget *tv_scrollw;
|
GtkWidget *tv_scrollw;
|
||||||
GtkWidget *tree_view;
|
GtkWidget *tree_view;
|
||||||
GtkWidget *bv_scrollw;
|
|
||||||
GtkWidget *bv_nb_ptr;
|
GtkWidget *bv_nb_ptr;
|
||||||
field_info *finfo_selected;
|
field_info *finfo_selected;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
@ -130,7 +129,6 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
|
||||||
{
|
{
|
||||||
GtkWidget *main_w, *main_vbox, *pane,
|
GtkWidget *main_w, *main_vbox, *pane,
|
||||||
*tree_view, *tv_scrollw,
|
*tree_view, *tv_scrollw,
|
||||||
*bv_scrollw,
|
|
||||||
*bv_nb_ptr;
|
*bv_nb_ptr;
|
||||||
struct PacketWinData *DataPtr;
|
struct PacketWinData *DataPtr;
|
||||||
|
|
||||||
|
@ -157,8 +155,7 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
|
||||||
gtk_widget_show(tree_view);
|
gtk_widget_show(tree_view);
|
||||||
|
|
||||||
/* Byte view */
|
/* Byte view */
|
||||||
create_byte_view(bv_size, pane, &bv_nb_ptr, &bv_scrollw,
|
bv_nb_ptr = create_byte_view(bv_size, pane, prefs.gui_scrollbar_on_right);
|
||||||
prefs.gui_scrollbar_on_right);
|
|
||||||
|
|
||||||
/* Allocate data structure to represent this window. */
|
/* Allocate data structure to represent this window. */
|
||||||
DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData));
|
DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData));
|
||||||
|
@ -174,7 +171,6 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
|
||||||
DataPtr->tv_scrollw = tv_scrollw;
|
DataPtr->tv_scrollw = tv_scrollw;
|
||||||
DataPtr->tree_view = tree_view;
|
DataPtr->tree_view = tree_view;
|
||||||
DataPtr->bv_nb_ptr = bv_nb_ptr;
|
DataPtr->bv_nb_ptr = bv_nb_ptr;
|
||||||
DataPtr->bv_scrollw = bv_scrollw;
|
|
||||||
detail_windows = g_list_append(detail_windows, DataPtr);
|
detail_windows = g_list_append(detail_windows, DataPtr);
|
||||||
|
|
||||||
/* load callback handlers */
|
/* load callback handlers */
|
||||||
|
@ -207,16 +203,17 @@ destroy_new_window(GtkObject *object, gpointer user_data)
|
||||||
g_free(DataPtr);
|
g_free(DataPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
|
|
||||||
gpointer user_data){
|
|
||||||
|
|
||||||
/* called when a tree row is selected in the popup packet window */
|
/* called when a tree row is selected in the popup packet window */
|
||||||
|
static void
|
||||||
field_info *finfo;
|
new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
field_info *finfo;
|
||||||
|
int i;
|
||||||
GtkWidget *byte_view;
|
GtkWidget *byte_view;
|
||||||
guint8 *data;
|
const guint8 *data;
|
||||||
int len, i;
|
guint len;
|
||||||
|
|
||||||
struct PacketWinData *DataPtr = (struct PacketWinData*)user_data;
|
struct PacketWinData *DataPtr = (struct PacketWinData*)user_data;
|
||||||
|
|
||||||
|
@ -224,15 +221,13 @@ new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
|
||||||
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
|
||||||
if (!finfo) return;
|
if (!finfo) return;
|
||||||
|
|
||||||
if (finfo->ds_name != NULL) {
|
set_notebook_page(DataPtr->bv_nb_ptr, finfo->ds_tvb);
|
||||||
i = find_notebook_page( DataPtr->bv_nb_ptr, finfo->ds_name);
|
byte_view = get_notebook_bv_ptr(DataPtr->bv_nb_ptr);
|
||||||
set_notebook_page ( DataPtr->bv_nb_ptr, i);
|
|
||||||
}
|
|
||||||
len = get_byte_view_and_data( DataPtr->bv_nb_ptr, &byte_view, &data);
|
|
||||||
|
|
||||||
if ( !byte_view) /* exit if no hex window to write in */
|
if ( !byte_view) /* exit if no hex window to write in */
|
||||||
return;
|
return;
|
||||||
if ( len < 0){
|
|
||||||
|
data = get_byte_view_data_and_length(byte_view, &len);
|
||||||
|
if (data == NULL) {
|
||||||
data = DataPtr->pd;
|
data = DataPtr->pd;
|
||||||
len = DataPtr->frame->cap_len;
|
len = DataPtr->frame->cap_len;
|
||||||
}
|
}
|
||||||
|
@ -240,31 +235,28 @@ new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
|
||||||
DataPtr->finfo_selected = finfo;
|
DataPtr->finfo_selected = finfo;
|
||||||
packet_hex_print(GTK_TEXT(byte_view), data,
|
packet_hex_print(GTK_TEXT(byte_view), data,
|
||||||
DataPtr->frame, finfo, len);
|
DataPtr->frame, finfo, len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called when a tree row is unselected in the popup packet window */
|
||||||
static void
|
static void
|
||||||
new_tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column,
|
new_tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column,
|
||||||
gpointer user_data){
|
gpointer user_data)
|
||||||
|
{
|
||||||
/* called when a tree row is unselected in the popup packet window */
|
GtkWidget* byte_view;
|
||||||
|
const guint8* data;
|
||||||
guint8* data;
|
guint len;
|
||||||
int len;
|
|
||||||
GtkWidget* byte_view;
|
|
||||||
|
|
||||||
struct PacketWinData *DataPtr = (struct PacketWinData*)user_data;
|
struct PacketWinData *DataPtr = (struct PacketWinData*)user_data;
|
||||||
|
|
||||||
DataPtr->finfo_selected = NULL;
|
DataPtr->finfo_selected = NULL;
|
||||||
|
|
||||||
len = get_byte_view_and_data( DataPtr->bv_nb_ptr, &byte_view, &data);
|
byte_view = get_notebook_bv_ptr(DataPtr->bv_nb_ptr);
|
||||||
|
|
||||||
if ( !byte_view) /* exit if no hex window to write in */
|
if ( !byte_view) /* exit if no hex window to write in */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_assert( len >= 0);
|
data = get_byte_view_data_and_length(byte_view, &len);
|
||||||
|
g_assert(data != NULL);
|
||||||
packet_hex_reprint(GTK_TEXT(byte_view));
|
packet_hex_reprint(GTK_TEXT(byte_view));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Functions called from elsewhere to act on all popup packet windows. */
|
/* Functions called from elsewhere to act on all popup packet windows. */
|
||||||
|
|
354
gtk/proto_draw.c
354
gtk/proto_draw.c
|
@ -1,7 +1,7 @@
|
||||||
/* proto_draw.c
|
/* proto_draw.c
|
||||||
* Routines for GTK+ packet display
|
* Routines for GTK+ packet display
|
||||||
*
|
*
|
||||||
* $Id: proto_draw.c,v 1.45 2002/01/21 07:37:42 guy Exp $
|
* $Id: proto_draw.c,v 1.46 2002/02/18 01:08:44 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -59,109 +59,105 @@
|
||||||
#include "ui_util.h"
|
#include "ui_util.h"
|
||||||
#include "gtkglobals.h"
|
#include "gtkglobals.h"
|
||||||
|
|
||||||
|
|
||||||
#define BYTE_VIEW_WIDTH 16
|
#define BYTE_VIEW_WIDTH 16
|
||||||
#define BYTE_VIEW_SEP 8
|
#define BYTE_VIEW_SEP 8
|
||||||
|
|
||||||
|
#define E_BYTE_VIEW_TREE_PTR "byte_view_tree_ptr"
|
||||||
|
#define E_BYTE_VIEW_TREE_VIEW_PTR "byte_view_tree_view_ptr"
|
||||||
|
#define E_BYTE_VIEW_TVBUFF_KEY "byte_view_tvbuff"
|
||||||
|
#define E_BYTE_VIEW_START_KEY "byte_view_start"
|
||||||
|
#define E_BYTE_VIEW_END_KEY "byte_view_end"
|
||||||
|
#define E_BYTE_VIEW_ENCODE_KEY "byte_view_encode"
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
|
||||||
|
proto_tree *tree, GtkWidget *tree_view);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
proto_tree_draw_node(GNode *node, gpointer data);
|
proto_tree_draw_node(GNode *node, gpointer data);
|
||||||
|
|
||||||
|
/* Get the current text window for the notebook. */
|
||||||
|
GtkWidget *
|
||||||
|
get_notebook_bv_ptr(GtkWidget *nb_ptr)
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
GtkWidget *bv_page, *bv;
|
||||||
|
|
||||||
GtkWidget*
|
num = gtk_notebook_get_current_page(GTK_NOTEBOOK(nb_ptr));
|
||||||
get_notebook_bv_ptr( GtkWidget *nb_ptr){
|
bv_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_ptr), num);
|
||||||
|
return GTK_BIN(bv_page)->child;
|
||||||
/* Get the current text window for the notebook */
|
|
||||||
return gtk_object_get_data(GTK_OBJECT(nb_ptr), E_BYTE_VIEW_TEXT_INFO_KEY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the data and length for a byte view, given the byte view page.
|
||||||
|
* Return the pointer, or NULL on error, and set "*data_len" to the length.
|
||||||
|
*/
|
||||||
|
const guint8 *
|
||||||
|
get_byte_view_data_and_length(GtkWidget *byte_view, guint *data_len)
|
||||||
|
{
|
||||||
|
tvbuff_t *byte_view_tvb;
|
||||||
|
const guint8 *data_ptr;
|
||||||
|
|
||||||
int get_byte_view_data( GtkWidget *byte_view_notebook, guint8 **data_ptr) {
|
byte_view_tvb = gtk_object_get_data(GTK_OBJECT(byte_view),
|
||||||
|
E_BYTE_VIEW_TVBUFF_KEY);
|
||||||
|
if (byte_view_tvb == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* get the data pointer and data length for a hex window */
|
data_ptr = tvb_get_ptr(byte_view_tvb, 0, -1);
|
||||||
/* return the length of the data or -1 on error */
|
*data_len = tvb_length(byte_view_tvb);
|
||||||
|
return data_ptr;
|
||||||
GtkWidget *byte_view = get_notebook_bv_ptr( byte_view_notebook);
|
|
||||||
|
|
||||||
if ( !byte_view)
|
|
||||||
return -1;
|
|
||||||
if ((*data_ptr = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_PTR_KEY)))
|
|
||||||
return GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(byte_view),
|
|
||||||
E_BYTE_VIEW_DATA_LEN_KEY));
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int get_byte_view_and_data( GtkWidget *byte_view_notebook, GtkWidget **byte_view, guint8 **data_ptr) {
|
* Set the current text window for the notebook to the window that
|
||||||
|
* refers to a particular tvbuff.
|
||||||
/* Get both byte_view widget pointer and the data pointer */
|
*/
|
||||||
/* return the data length or -1 if error */
|
|
||||||
|
|
||||||
*byte_view = get_notebook_bv_ptr( byte_view_notebook);
|
|
||||||
if ( *byte_view)
|
|
||||||
return get_byte_view_data( byte_view_notebook, data_ptr);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_notebook_page( GtkWidget *nb_ptr, int num){
|
set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb)
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
GtkWidget *bv_page, *bv;
|
||||||
|
tvbuff_t *bv_tvb;
|
||||||
|
|
||||||
/* Set the current text window for the notebook and set the */
|
for (num = 0;
|
||||||
/* text window pointer storage */
|
(bv_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_ptr), num)) != NULL;
|
||||||
|
num++) {
|
||||||
GtkWidget* child;
|
bv = GTK_BIN(bv_page)->child;
|
||||||
|
bv_tvb = gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_TVBUFF_KEY);
|
||||||
gtk_notebook_set_page ( GTK_NOTEBOOK( nb_ptr), num);
|
if (bv_tvb == tvb) {
|
||||||
|
/* Found it. */
|
||||||
child = gtk_notebook_get_nth_page( GTK_NOTEBOOK(nb_ptr), num);
|
gtk_notebook_set_page(GTK_NOTEBOOK(nb_ptr), num);
|
||||||
child = gtk_object_get_data(GTK_OBJECT(child), E_BYTE_VIEW_TEXT_INFO_KEY);
|
break;
|
||||||
gtk_object_set_data(GTK_OBJECT(nb_ptr), E_BYTE_VIEW_TEXT_INFO_KEY, child);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int find_notebook_page( GtkWidget *nb_ptr, gchar *label){
|
|
||||||
|
|
||||||
/* find the notebook page number for this label */
|
|
||||||
|
|
||||||
int i = -1;
|
|
||||||
gchar *ptr;
|
|
||||||
GtkWidget* child;
|
|
||||||
|
|
||||||
while(( child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_ptr), ++i))){
|
|
||||||
child = gtk_notebook_get_tab_label(GTK_NOTEBOOK(nb_ptr), child);
|
|
||||||
gtk_notebook_get_tab_label(GTK_NOTEBOOK(nb_ptr), child);
|
|
||||||
gtk_label_get(GTK_LABEL(child), &ptr);
|
|
||||||
if (!strcmp( label, ptr))
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Redraw a given byte view window. */
|
/* Redraw a given byte view window. */
|
||||||
void
|
void
|
||||||
redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo)
|
redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo)
|
||||||
{
|
{
|
||||||
GtkWidget* bv;
|
GtkWidget *bv;
|
||||||
guint8* data;
|
const guint8 *data;
|
||||||
int len;
|
guint len;
|
||||||
|
|
||||||
len = get_byte_view_and_data( byte_nb_ptr, &bv, &data);
|
bv = get_notebook_bv_ptr(byte_nb_ptr);
|
||||||
if ( bv)
|
if (bv != NULL) {
|
||||||
packet_hex_print(GTK_TEXT(bv), data, fd, finfo, len);
|
data = get_byte_view_data_and_length(bv, &len);
|
||||||
|
if (data != NULL)
|
||||||
|
packet_hex_print(GTK_TEXT(bv), data, fd, finfo, len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Redraw all byte view windows. */
|
||||||
void
|
void
|
||||||
redraw_hex_dump_all(void)
|
redraw_hex_dump_all(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cfile.current_frame != NULL)
|
if (cfile.current_frame != NULL)
|
||||||
redraw_hex_dump( byte_nb_ptr, cfile.current_frame, finfo_selected);
|
redraw_hex_dump( byte_nb_ptr, cfile.current_frame, finfo_selected);
|
||||||
|
|
||||||
redraw_hex_dump_packet_wins();
|
redraw_hex_dump_packet_wins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
expand_tree(GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data)
|
expand_tree(GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
@ -211,18 +207,14 @@ byte_num(int offset, int start_point)
|
||||||
static gint
|
static gint
|
||||||
byte_view_select(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
byte_view_select(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
||||||
{
|
{
|
||||||
proto_tree *tree = gtk_object_get_data(GTK_OBJECT(widget),
|
proto_tree *tree;
|
||||||
E_BYTE_VIEW_TREE_PTR);
|
GtkCTree *ctree;
|
||||||
GtkWidget *tree_view =
|
|
||||||
gtk_object_get_data(GTK_OBJECT(widget),
|
|
||||||
E_BYTE_VIEW_TREE_VIEW_PTR);
|
|
||||||
GtkCTree *ctree = GTK_CTREE(tree_view);
|
|
||||||
GtkCTreeNode *node, *parent;
|
GtkCTreeNode *node, *parent;
|
||||||
field_info *finfo;
|
field_info *finfo;
|
||||||
GtkText *bv = GTK_TEXT(widget);
|
GtkText *bv = GTK_TEXT(widget);
|
||||||
int row, column;
|
int row, column;
|
||||||
int byte;
|
int byte;
|
||||||
gchar *name;
|
tvbuff_t *tvb;
|
||||||
|
|
||||||
/* The column of the first hex digit in the first half */
|
/* The column of the first hex digit in the first half */
|
||||||
const int digits_start_1 = 6;
|
const int digits_start_1 = 6;
|
||||||
|
@ -244,6 +236,16 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
||||||
/* The column of the last "text dump" character in second half. */
|
/* The column of the last "text dump" character in second half. */
|
||||||
const int text_end_2 = 73;
|
const int text_end_2 = 73;
|
||||||
|
|
||||||
|
tree = gtk_object_get_data(GTK_OBJECT(widget), E_BYTE_VIEW_TREE_PTR);
|
||||||
|
if (tree == NULL) {
|
||||||
|
/*
|
||||||
|
* Somebody clicked on the dummy byte view; do nothing.
|
||||||
|
*/
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
ctree = GTK_CTREE(gtk_object_get_data(GTK_OBJECT(widget),
|
||||||
|
E_BYTE_VIEW_TREE_VIEW_PTR));
|
||||||
|
|
||||||
/* Given the mouse (x,y) and the current GtkText (h,v)
|
/* Given the mouse (x,y) and the current GtkText (h,v)
|
||||||
* adjustments, and the size of the font, figure out
|
* adjustments, and the size of the font, figure out
|
||||||
* which text column/row the user selected. This could be off
|
* which text column/row the user selected. This could be off
|
||||||
|
@ -282,11 +284,11 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
||||||
/* Add the number of bytes from the previous rows. */
|
/* Add the number of bytes from the previous rows. */
|
||||||
byte += row * 16;
|
byte += row * 16;
|
||||||
|
|
||||||
/* Get the data source name */
|
/* Get the data source tvbuff */
|
||||||
name = gtk_object_get_data(GTK_OBJECT(widget), E_BYTE_VIEW_NAME_KEY);
|
tvb = gtk_object_get_data(GTK_OBJECT(widget), E_BYTE_VIEW_TVBUFF_KEY);
|
||||||
|
|
||||||
/* Find the finfo that corresponds to our byte. */
|
/* Find the finfo that corresponds to our byte. */
|
||||||
finfo = proto_find_field_from_offset(tree, byte, name);
|
finfo = proto_find_field_from_offset(tree, byte, tvb);
|
||||||
|
|
||||||
if (!finfo) {
|
if (!finfo) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -343,49 +345,50 @@ byte_view_button_press_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
void
|
create_byte_view(gint bv_size, GtkWidget *pane, int pos)
|
||||||
create_byte_view(gint bv_size, GtkWidget *pane, GtkWidget **byte_nb_p,
|
|
||||||
GtkWidget **bv_scrollw_p, int pos)
|
|
||||||
{
|
{
|
||||||
GtkWidget *byte_scrollw, *byte_nb;
|
GtkWidget *byte_nb;
|
||||||
|
|
||||||
byte_nb = gtk_notebook_new();
|
byte_nb = gtk_notebook_new();
|
||||||
gtk_notebook_set_tab_pos ( GTK_NOTEBOOK(byte_nb), GTK_POS_BOTTOM);
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(byte_nb), GTK_POS_BOTTOM);
|
||||||
|
|
||||||
gtk_paned_pack2(GTK_PANED(pane), byte_nb, FALSE, FALSE);
|
gtk_paned_pack2(GTK_PANED(pane), byte_nb, FALSE, FALSE);
|
||||||
gtk_widget_show(byte_nb);
|
gtk_widget_show(byte_nb);
|
||||||
|
|
||||||
/* Byte view. Create a scrolled window for the text. */
|
/* Add a placeholder byte view so that there's at least something
|
||||||
byte_scrollw = gtk_scrolled_window_new(NULL, NULL);
|
displayed in the byte view notebook. */
|
||||||
*byte_nb_p = byte_nb;
|
add_byte_tab(byte_nb, "", NULL, NULL, NULL);
|
||||||
*bv_scrollw_p = byte_scrollw;
|
|
||||||
|
return byte_nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
byte_view_realize_cb(GtkWidget *bv, gpointer data)
|
||||||
|
{
|
||||||
|
const guint8 *byte_data;
|
||||||
|
guint byte_len;
|
||||||
|
|
||||||
void
|
byte_data = get_byte_view_data_and_length(bv, &byte_len);
|
||||||
byte_view_realize_cb( GtkWidget *bv, gpointer data){
|
if (byte_data == NULL) {
|
||||||
|
/* This must be the dummy byte view if no packet is selected. */
|
||||||
guint8* byte_data = gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_DATA_PTR_KEY);
|
return;
|
||||||
int byte_len = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_DATA_LEN_KEY));
|
}
|
||||||
|
packet_hex_print(GTK_TEXT(bv), byte_data, cfile.current_frame, NULL, byte_len);
|
||||||
packet_hex_print(GTK_TEXT(bv), byte_data, cfile.current_frame, NULL, byte_len);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
add_byte_tab(GtkWidget *byte_nb, const char *name, const guint8 *data, int len,
|
add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
|
||||||
proto_tree *tree, GtkWidget *tree_view)
|
proto_tree *tree, GtkWidget *tree_view)
|
||||||
{
|
{
|
||||||
GtkWidget *byte_view, *byte_scrollw, *label;
|
GtkWidget *byte_view, *byte_scrollw, *label;
|
||||||
gchar *name_ptr;
|
|
||||||
|
|
||||||
/* Byte view. Create a scrolled window for the text. */
|
/* Byte view. Create a scrolled window for the text. */
|
||||||
byte_scrollw = scrolled_window_new(NULL, NULL);
|
byte_scrollw = scrolled_window_new(NULL, NULL);
|
||||||
|
|
||||||
/* Add scrolled pane to tabbed window */
|
/* Add scrolled pane to tabbed window */
|
||||||
label = gtk_label_new (name);
|
label = gtk_label_new(name);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK(byte_nb), byte_scrollw, label);
|
gtk_notebook_append_page(GTK_NOTEBOOK(byte_nb), byte_scrollw, label);
|
||||||
|
|
||||||
/* The horizontal scrollbar of the scroll-window doesn't seem
|
/* The horizontal scrollbar of the scroll-window doesn't seem
|
||||||
* to affect the GtkText widget at all, even when line wrapping
|
* to affect the GtkText widget at all, even when line wrapping
|
||||||
|
@ -400,12 +403,8 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, const guint8 *data, int len,
|
||||||
gtk_text_set_editable(GTK_TEXT(byte_view), FALSE);
|
gtk_text_set_editable(GTK_TEXT(byte_view), FALSE);
|
||||||
gtk_text_set_word_wrap(GTK_TEXT(byte_view), FALSE);
|
gtk_text_set_word_wrap(GTK_TEXT(byte_view), FALSE);
|
||||||
gtk_text_set_line_wrap(GTK_TEXT(byte_view), FALSE);
|
gtk_text_set_line_wrap(GTK_TEXT(byte_view), FALSE);
|
||||||
gtk_object_set_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_PTR_KEY,
|
gtk_object_set_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_TVBUFF_KEY,
|
||||||
(gpointer)data);
|
(gpointer)tvb);
|
||||||
gtk_object_set_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_DATA_LEN_KEY,
|
|
||||||
GINT_TO_POINTER(len));
|
|
||||||
gtk_label_get(GTK_LABEL(label), &name_ptr);
|
|
||||||
gtk_object_set_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_NAME_KEY, name_ptr);
|
|
||||||
gtk_container_add(GTK_CONTAINER(byte_scrollw), byte_view);
|
gtk_container_add(GTK_CONTAINER(byte_scrollw), byte_view);
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(byte_view), "show",
|
gtk_signal_connect(GTK_OBJECT(byte_view), "show",
|
||||||
|
@ -422,14 +421,11 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, const guint8 *data, int len,
|
||||||
|
|
||||||
gtk_widget_show(byte_view);
|
gtk_widget_show(byte_view);
|
||||||
|
|
||||||
gtk_object_set_data(GTK_OBJECT(byte_scrollw), E_BYTE_VIEW_TEXT_INFO_KEY,
|
/* no tabs if this is the first page */
|
||||||
byte_view);
|
if (!(gtk_notebook_page_num(GTK_NOTEBOOK(byte_nb), byte_scrollw)))
|
||||||
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(byte_nb), FALSE);
|
||||||
/* no tabs if this is the first page */
|
|
||||||
if ( !(gtk_notebook_page_num(GTK_NOTEBOOK(byte_nb), byte_scrollw)))
|
|
||||||
gtk_notebook_set_show_tabs ( GTK_NOTEBOOK(byte_nb), FALSE);
|
|
||||||
else
|
else
|
||||||
gtk_notebook_set_show_tabs ( GTK_NOTEBOOK(byte_nb), TRUE);
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(byte_nb), TRUE);
|
||||||
|
|
||||||
return byte_view;
|
return byte_view;
|
||||||
}
|
}
|
||||||
|
@ -438,30 +434,36 @@ void
|
||||||
add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
|
add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
|
||||||
GtkWidget *byte_nb_ptr)
|
GtkWidget *byte_nb_ptr)
|
||||||
{
|
{
|
||||||
int i;
|
GSList *src_le;
|
||||||
tvbuff_t *bv_tvb;
|
data_source *src;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get rid of all the old notebook tabs.
|
||||||
|
*/
|
||||||
|
while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(byte_nb_ptr), 0) != NULL)
|
||||||
|
gtk_notebook_remove_page(GTK_NOTEBOOK(byte_nb_ptr), 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add to the specified byte view notebook tabs for hex dumps
|
* Add to the specified byte view notebook tabs for hex dumps
|
||||||
* of all the data sources for the specified frame.
|
* of all the data sources for the specified frame.
|
||||||
*/
|
*/
|
||||||
for (i = 0;
|
for (src_le = frame->data_src; src_le != NULL; src_le = src_le->next) {
|
||||||
(bv_tvb = g_slist_nth_data(frame->data_src, i)) != NULL; i++) {
|
src = src_le->data;
|
||||||
add_byte_tab(byte_nb_ptr, tvb_get_name(bv_tvb),
|
add_byte_tab(byte_nb_ptr, src->name, src->tvb, tree,
|
||||||
tvb_get_ptr(bv_tvb, 0, -1), tvb_length(bv_tvb),
|
tree_view);
|
||||||
tree, tree_view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initially select the first byte view.
|
* Initially select the first byte view.
|
||||||
*/
|
*/
|
||||||
set_notebook_page(byte_nb_ptr, 0);
|
gtk_notebook_set_page(GTK_NOTEBOOK(byte_nb_ptr), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
packet_hex_print_common(GtkText *bv, guint8 *pd, int len, int bstart, int bend, int encoding)
|
packet_hex_print_common(GtkText *bv, const guint8 *pd, int len, int bstart,
|
||||||
|
int bend, int encoding)
|
||||||
{
|
{
|
||||||
gint i = 0, j, k, cur;
|
int i = 0, j, k, cur;
|
||||||
guchar line[128], hexchars[] = "0123456789abcdef", c = '\0';
|
guchar line[128], hexchars[] = "0123456789abcdef", c = '\0';
|
||||||
GdkFont *cur_font, *new_font;
|
GdkFont *cur_font, *new_font;
|
||||||
GdkColor *fg, *bg;
|
GdkColor *fg, *bg;
|
||||||
|
@ -668,8 +670,9 @@ packet_hex_print_common(GtkText *bv, guint8 *pd, int len, int bstart, int bend,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
packet_hex_print(GtkText *bv, guint8 *pd, frame_data *fd, field_info *finfo, int len){
|
packet_hex_print(GtkText *bv, const guint8 *pd, frame_data *fd,
|
||||||
|
field_info *finfo, guint len)
|
||||||
|
{
|
||||||
/* do the initial printing and save the information needed */
|
/* do the initial printing and save the information needed */
|
||||||
/* to redraw the display if preferences change. */
|
/* to redraw the display if preferences change. */
|
||||||
|
|
||||||
|
@ -692,29 +695,33 @@ packet_hex_print(GtkText *bv, guint8 *pd, frame_data *fd, field_info *finfo, int
|
||||||
gtk_object_set_data(GTK_OBJECT(bv), E_BYTE_VIEW_END_KEY, GINT_TO_POINTER(bstart));
|
gtk_object_set_data(GTK_OBJECT(bv), E_BYTE_VIEW_END_KEY, GINT_TO_POINTER(bstart));
|
||||||
gtk_object_set_data(GTK_OBJECT(bv), E_BYTE_VIEW_ENCODE_KEY, GINT_TO_POINTER(fd->flags.encoding));
|
gtk_object_set_data(GTK_OBJECT(bv), E_BYTE_VIEW_ENCODE_KEY, GINT_TO_POINTER(fd->flags.encoding));
|
||||||
|
|
||||||
packet_hex_print_common( bv, pd, len, bstart, bend, fd->flags.encoding);
|
packet_hex_print_common(bv, pd, len, bstart, bend, fd->flags.encoding);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redraw the text using the saved information; usually called if
|
||||||
|
* the preferences have changed.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
packet_hex_reprint(GtkText *bv){
|
packet_hex_reprint(GtkText *bv)
|
||||||
|
{
|
||||||
|
int start, end, encoding;
|
||||||
|
const guint8 *data;
|
||||||
|
guint len;
|
||||||
|
|
||||||
/* redraw the text using the saved information, */
|
start = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv),
|
||||||
/* usually called if the preferences haved changed. */
|
E_BYTE_VIEW_START_KEY));
|
||||||
|
end = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv),
|
||||||
|
E_BYTE_VIEW_END_KEY));
|
||||||
|
data = get_byte_view_data_and_length(GTK_WIDGET(bv), &len);
|
||||||
|
g_assert(data != NULL);
|
||||||
|
encoding = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv),
|
||||||
|
E_BYTE_VIEW_ENCODE_KEY));
|
||||||
|
|
||||||
int start, end, len, encoding;
|
packet_hex_print_common(bv, data, len, start, end, encoding);
|
||||||
guint8 *data;
|
|
||||||
|
|
||||||
start = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_START_KEY));
|
|
||||||
end = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_END_KEY));
|
|
||||||
len = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_DATA_LEN_KEY));
|
|
||||||
data = gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_DATA_PTR_KEY);
|
|
||||||
encoding = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(bv), E_BYTE_VIEW_ENCODE_KEY));
|
|
||||||
|
|
||||||
packet_hex_print_common( bv, data, len, start, end, encoding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* List of all protocol tree widgets, so we can globally set the selection
|
/* List of all protocol tree widgets, so we can globally set the selection
|
||||||
mode and font of all of them. */
|
mode and font of all of them. */
|
||||||
static GList *ptree_widgets;
|
static GList *ptree_widgets;
|
||||||
|
@ -831,7 +838,6 @@ void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) {
|
||||||
for(i=0; i < num_tree_types; i++) {
|
for(i=0; i < num_tree_types; i++) {
|
||||||
tree_is_expanded[i] = TRUE;
|
tree_is_expanded[i] = TRUE;
|
||||||
}
|
}
|
||||||
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
|
||||||
proto_tree_draw(protocol_tree, tree_view);
|
proto_tree_draw(protocol_tree, tree_view);
|
||||||
gtk_ctree_expand_recursive(GTK_CTREE(tree_view), NULL);
|
gtk_ctree_expand_recursive(GTK_CTREE(tree_view), NULL);
|
||||||
}
|
}
|
||||||
|
@ -841,7 +847,6 @@ void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) {
|
||||||
for(i=0; i < num_tree_types; i++) {
|
for(i=0; i < num_tree_types; i++) {
|
||||||
tree_is_expanded[i] = FALSE;
|
tree_is_expanded[i] = FALSE;
|
||||||
}
|
}
|
||||||
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
|
||||||
proto_tree_draw(protocol_tree, tree_view);
|
proto_tree_draw(protocol_tree, tree_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,12 +864,19 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
|
||||||
info.ctree = GTK_CTREE(tree_view);
|
info.ctree = GTK_CTREE(tree_view);
|
||||||
info.ctree_node = NULL;
|
info.ctree_node = NULL;
|
||||||
|
|
||||||
gtk_clist_freeze ( GTK_CLIST(tree_view) );
|
gtk_clist_freeze(GTK_CLIST(tree_view));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear out any crud left over in the display of the protocol
|
||||||
|
* tree, by removing all nodes from the ctree.
|
||||||
|
* This is how it's done in testgtk.c in GTK+.
|
||||||
|
*/
|
||||||
|
gtk_clist_clear(GTK_CLIST(tree_view));
|
||||||
|
|
||||||
g_node_children_foreach((GNode*) protocol_tree, G_TRAVERSE_ALL,
|
g_node_children_foreach((GNode*) protocol_tree, G_TRAVERSE_ALL,
|
||||||
proto_tree_draw_node, &info);
|
proto_tree_draw_node, &info);
|
||||||
|
|
||||||
gtk_clist_thaw ( GTK_CLIST(tree_view) );
|
gtk_clist_thaw(GTK_CLIST(tree_view));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -882,18 +894,6 @@ proto_tree_draw_node(GNode *node, gpointer data)
|
||||||
|
|
||||||
if (!fi->visible)
|
if (!fi->visible)
|
||||||
return;
|
return;
|
||||||
/*
|
|
||||||
* XXX - why are we doing this? This is done when we consruct
|
|
||||||
* the protocol tree display, but, as far as I can tell, it only
|
|
||||||
* needs to be done when a particular field in the tree is
|
|
||||||
* selected.
|
|
||||||
*/
|
|
||||||
if (fi->ds_name != NULL) {
|
|
||||||
i = find_notebook_page(byte_nb_ptr, fi->ds_name);
|
|
||||||
if (i < 0)
|
|
||||||
return; /* no notebook pages ?? */
|
|
||||||
set_notebook_page(byte_nb_ptr, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* was a free format label produced? */
|
/* was a free format label produced? */
|
||||||
if (fi->representation) {
|
if (fi->representation) {
|
||||||
|
@ -938,27 +938,15 @@ proto_tree_draw_node(GNode *node, gpointer data)
|
||||||
void
|
void
|
||||||
clear_tree_and_hex_views(void)
|
clear_tree_and_hex_views(void)
|
||||||
{
|
{
|
||||||
/* Clear the hex dump. */
|
/* Clear the hex dump by getting rid of all the byte views. */
|
||||||
|
while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(byte_nb_ptr), 0) != NULL)
|
||||||
|
gtk_notebook_remove_page(GTK_NOTEBOOK(byte_nb_ptr), 0);
|
||||||
|
|
||||||
GtkWidget *byte_view;
|
/* Add a placeholder byte view so that there's at least something
|
||||||
int i;
|
displayed in the byte view notebook. */
|
||||||
|
add_byte_tab(byte_nb_ptr, "", NULL, NULL, tree_view);
|
||||||
/* Get the current tab scroll window, then get the text widget */
|
|
||||||
/* from the E_BYTE_VIEW_TEXT_INFO_KEY data field */
|
|
||||||
|
|
||||||
i = gtk_notebook_get_current_page( GTK_NOTEBOOK(byte_nb_ptr));
|
|
||||||
|
|
||||||
if ( i >= 0){
|
|
||||||
byte_view = gtk_notebook_get_nth_page( GTK_NOTEBOOK(byte_nb_ptr), i);
|
|
||||||
byte_view = gtk_object_get_data(GTK_OBJECT(byte_view), E_BYTE_VIEW_TEXT_INFO_KEY);
|
|
||||||
|
|
||||||
gtk_text_freeze(GTK_TEXT(byte_view));
|
|
||||||
gtk_text_set_point(GTK_TEXT(byte_view), 0);
|
|
||||||
gtk_text_forward_delete(GTK_TEXT(byte_view),
|
|
||||||
gtk_text_get_length(GTK_TEXT(byte_view)));
|
|
||||||
gtk_text_thaw(GTK_TEXT(byte_view));
|
|
||||||
}
|
|
||||||
/* Remove all nodes in ctree. This is how it's done in testgtk.c in GTK+ */
|
|
||||||
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
|
||||||
|
|
||||||
|
/* Clear the protocol tree by removing all nodes in the ctree.
|
||||||
|
This is how it's done in testgtk.c in GTK+ */
|
||||||
|
gtk_clist_clear(GTK_CLIST(tree_view));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* proto_draw.h
|
/* proto_draw.h
|
||||||
* Definitions for GTK+ packet display structures and routines
|
* Definitions for GTK+ packet display structures and routines
|
||||||
*
|
*
|
||||||
* $Id: proto_draw.h,v 1.15 2002/01/11 06:43:18 guy Exp $
|
* $Id: proto_draw.h,v 1.16 2002/02/18 01:08:44 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -22,36 +22,38 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKPACKET_H__
|
#ifndef __GTKPACKET_H__
|
||||||
#define __GTKPACKET_H__
|
#define __GTKPACKET_H__
|
||||||
#define E_BYTE_VIEW_TREE_PTR "byte_view_tree_ptr"
|
|
||||||
#define E_BYTE_VIEW_TREE_VIEW_PTR "byte_view_tree_view_ptr"
|
|
||||||
#define E_BYTE_VIEW_TEXT_INFO_KEY "byte_view_win"
|
|
||||||
#define E_BYTE_VIEW_DATA_PTR_KEY "byte_view_data"
|
|
||||||
#define E_BYTE_VIEW_DATA_LEN_KEY "byte_view_len"
|
|
||||||
#define E_BYTE_VIEW_START_KEY "byte_view_start"
|
|
||||||
#define E_BYTE_VIEW_END_KEY "byte_view_end"
|
|
||||||
#define E_BYTE_VIEW_ENCODE_KEY "byte_view_encode"
|
|
||||||
#define E_BYTE_VIEW_NAME_KEY "byte_view_name"
|
|
||||||
|
|
||||||
void add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
|
/* Get the current text window for the notebook. */
|
||||||
GtkWidget *byte_nb_ptr);
|
extern GtkWidget *get_notebook_bv_ptr(GtkWidget *nb_ptr);
|
||||||
|
|
||||||
void set_notebook_page( GtkWidget *nb_ptr, int num);
|
/*
|
||||||
int find_notebook_page( GtkWidget *nb_ptr, gchar *label);
|
* Get the data and length for a byte view, given the byte view page.
|
||||||
|
* Return the pointer, or NULL on error, and set "*data_len" to the length.
|
||||||
|
*/
|
||||||
|
extern const guint8 *get_byte_view_data_and_length(GtkWidget *byte_view,
|
||||||
|
guint *data_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the current text window for the notebook to the window that
|
||||||
|
* refers to a particular tvbuff.
|
||||||
|
*/
|
||||||
|
extern void set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb);
|
||||||
|
|
||||||
GtkWidget *get_byte_view( GtkWidget *byte_view_notebook);
|
/* Redraw a given byte view window. */
|
||||||
int get_byte_view_data( GtkWidget *byte_view_notebook, guint8 **data_ptr);
|
extern void redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo);
|
||||||
int get_byte_view_and_data( GtkWidget *byte_view_notebook, GtkWidget **byte_view, guint8 **data_ptr);
|
|
||||||
|
|
||||||
void redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo);
|
/* Redraw all byte view windows. */
|
||||||
|
extern void redraw_hex_dump_all(void);
|
||||||
|
|
||||||
void redraw_hex_dump_all(void);
|
extern GtkWidget *create_byte_view(gint bv_size, GtkWidget *pane, int pos);
|
||||||
void create_byte_view(gint bv_size, GtkWidget *pane, GtkWidget **byte_view_p,
|
|
||||||
GtkWidget **bv_scrollw_p, int pos);
|
extern void add_byte_views(frame_data *frame, proto_tree *tree,
|
||||||
void packet_hex_print(GtkText *, guint8 *, frame_data *, field_info *, int);
|
GtkWidget *tree_view, GtkWidget *byte_nb_ptr);
|
||||||
|
|
||||||
|
void packet_hex_print(GtkText *, const guint8 *, frame_data *, field_info *,
|
||||||
|
guint);
|
||||||
void packet_hex_reprint(GtkText *);
|
void packet_hex_reprint(GtkText *);
|
||||||
|
|
||||||
void create_tree_view(gint tv_size, e_prefs *prefs, GtkWidget *pane,
|
void create_tree_view(gint tv_size, e_prefs *prefs, GtkWidget *pane,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-clnp.c
|
/* packet-clnp.c
|
||||||
* Routines for ISO/OSI network and transport protocol packet disassembly
|
* Routines for ISO/OSI network and transport protocol packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet-clnp.c,v 1.48 2002/01/30 22:58:54 guy Exp $
|
* $Id: packet-clnp.c,v 1.49 2002/02/18 01:08:35 guy Exp $
|
||||||
* Laurent Deniel <deniel@worldnet.fr>
|
* Laurent Deniel <deniel@worldnet.fr>
|
||||||
* Ralf Schneider <Ralf.Schneider@t-online.de>
|
* Ralf Schneider <Ralf.Schneider@t-online.de>
|
||||||
*
|
*
|
||||||
|
@ -1902,7 +1902,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
|
||||||
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
||||||
next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen,
|
next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen,
|
||||||
fd_head->datalen, "Reassembled");
|
fd_head->datalen);
|
||||||
|
|
||||||
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
||||||
were handed refers, so it'll get cleaned up when that tvbuff
|
were handed refers, so it'll get cleaned up when that tvbuff
|
||||||
|
@ -1910,7 +1910,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
||||||
|
|
||||||
/* Add the defragmented data to the data source list. */
|
/* Add the defragmented data to the data source list. */
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, next_tvb);
|
add_new_data_source(pinfo->fd, next_tvb, "Reassembled");
|
||||||
|
|
||||||
/* It's not fragmented. */
|
/* It's not fragmented. */
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* Frank Singleton <frank.singleton@ericsson.com>
|
* Frank Singleton <frank.singleton@ericsson.com>
|
||||||
* Trevor Shepherd <eustrsd@am1.ericsson.se>
|
* Trevor Shepherd <eustrsd@am1.ericsson.se>
|
||||||
*
|
*
|
||||||
* $Id: packet-giop.c,v 1.55 2002/01/24 09:20:47 guy Exp $
|
* $Id: packet-giop.c,v 1.56 2002/02/18 01:08:35 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1310,7 +1310,7 @@ static void read_IOR_strings_from_file(gchar *name, int max_iorlen) {
|
||||||
it - or "get_CDR_octet()", or "decode_IOR()" - to throw an
|
it - or "get_CDR_octet()", or "decode_IOR()" - to throw an
|
||||||
exception. */
|
exception. */
|
||||||
|
|
||||||
tvb = tvb_new_real_data(out,ior_val_len,ior_val_len, "GIOP FILE IOR");
|
tvb = tvb_new_real_data(out, ior_val_len, ior_val_len);
|
||||||
|
|
||||||
stream_is_big_endian = !get_CDR_octet(tvb,&my_offset);
|
stream_is_big_endian = !get_CDR_octet(tvb,&my_offset);
|
||||||
decode_IOR(tvb, NULL, NULL, &my_offset, 0, stream_is_big_endian);
|
decode_IOR(tvb, NULL, NULL, &my_offset, 0, stream_is_big_endian);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-icq.c
|
/* packet-icq.c
|
||||||
* Routines for ICQ packet disassembly
|
* Routines for ICQ packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet-icq.c,v 1.38 2002/01/21 07:36:35 guy Exp $
|
* $Id: packet-icq.c,v 1.39 2002/02/18 01:08:36 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1731,8 +1731,7 @@ dissect_icqv5Client(tvbuff_t *tvb,
|
||||||
decrypt_v5(decr_pd, rounded_size, key);
|
decrypt_v5(decr_pd, rounded_size, key);
|
||||||
|
|
||||||
/* Allocate a new tvbuff, referring to the decrypted data. */
|
/* Allocate a new tvbuff, referring to the decrypted data. */
|
||||||
decr_tvb = tvb_new_real_data(decr_pd, pktsize, tvb_reported_length(tvb),
|
decr_tvb = tvb_new_real_data(decr_pd, pktsize, tvb_reported_length(tvb));
|
||||||
"Decrypted");
|
|
||||||
|
|
||||||
/* Arrange that the allocated packet data copy be freed when the
|
/* Arrange that the allocated packet data copy be freed when the
|
||||||
tvbuff is freed. */
|
tvbuff is freed. */
|
||||||
|
@ -1744,7 +1743,7 @@ dissect_icqv5Client(tvbuff_t *tvb,
|
||||||
tvb_set_child_real_data_tvbuff(tvb, decr_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, decr_tvb);
|
||||||
|
|
||||||
/* Add the decrypted data to the data source list. */
|
/* Add the decrypted data to the data source list. */
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, decr_tvb);
|
add_new_data_source(pinfo->fd, decr_tvb, "Decrypted");
|
||||||
|
|
||||||
cmd = tvb_get_letohs(decr_tvb, ICQ5_CL_CMD);
|
cmd = tvb_get_letohs(decr_tvb, ICQ5_CL_CMD);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-ip.c
|
/* packet-ip.c
|
||||||
* Routines for IP and miscellaneous IP protocol packet disassembly
|
* Routines for IP and miscellaneous IP protocol packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet-ip.c,v 1.161 2002/02/17 00:51:19 guy Exp $
|
* $Id: packet-ip.c,v 1.162 2002/02/18 01:08:36 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1054,7 +1054,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
|
||||||
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
||||||
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
|
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
|
||||||
ipfd_head->datalen, "Reassembled");
|
ipfd_head->datalen);
|
||||||
|
|
||||||
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
||||||
were handed refers, so it'll get cleaned up when that tvbuff
|
were handed refers, so it'll get cleaned up when that tvbuff
|
||||||
|
@ -1062,7 +1062,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
||||||
|
|
||||||
/* Add the defragmented data to the data source list. */
|
/* Add the defragmented data to the data source list. */
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, next_tvb);
|
add_new_data_source(pinfo->fd, next_tvb, "Reassembled");
|
||||||
|
|
||||||
/* It's not fragmented. */
|
/* It's not fragmented. */
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-ipv6.c
|
/* packet-ipv6.c
|
||||||
* Routines for IPv6 packet disassembly
|
* Routines for IPv6 packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet-ipv6.c,v 1.76 2002/02/17 00:51:19 guy Exp $
|
* $Id: packet-ipv6.c,v 1.77 2002/02/18 01:08:36 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -893,7 +893,7 @@ again:
|
||||||
|
|
||||||
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
/* Allocate a new tvbuff, referring to the reassembled payload. */
|
||||||
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
|
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen,
|
||||||
ipfd_head->datalen, "Reassembled");
|
ipfd_head->datalen);
|
||||||
|
|
||||||
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
/* Add the tvbuff to the list of tvbuffs to which the tvbuff we
|
||||||
were handed refers, so it'll get cleaned up when that tvbuff
|
were handed refers, so it'll get cleaned up when that tvbuff
|
||||||
|
@ -901,7 +901,7 @@ again:
|
||||||
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
||||||
|
|
||||||
/* Add the defragmented data to the data source list. */
|
/* Add the defragmented data to the data source list. */
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, next_tvb);
|
add_new_data_source(pinfo->fd, next_tvb, "Reassembled");
|
||||||
|
|
||||||
/* It's not fragmented. */
|
/* It's not fragmented. */
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
|
|
|
@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
|
||||||
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
|
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
|
||||||
* Guy Harris 2001
|
* Guy Harris 2001
|
||||||
*
|
*
|
||||||
* $Id: packet-smb-pipe.c,v 1.68 2002/01/27 22:25:48 guy Exp $
|
* $Id: packet-smb-pipe.c,v 1.69 2002/02/18 01:08:36 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -3194,11 +3194,10 @@ dissect_pipe_dcerpc(tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree
|
||||||
fragment_data *fd;
|
fragment_data *fd;
|
||||||
|
|
||||||
new_tvb = tvb_new_real_data(fd_head->data,
|
new_tvb = tvb_new_real_data(fd_head->data,
|
||||||
fd_head->datalen, fd_head->datalen,
|
fd_head->datalen, fd_head->datalen);
|
||||||
"DCERPC over SMB");
|
|
||||||
tvb_set_child_real_data_tvbuff(d_tvb, new_tvb);
|
tvb_set_child_real_data_tvbuff(d_tvb, new_tvb);
|
||||||
pinfo->fd->data_src=g_slist_append(pinfo->fd->data_src,
|
add_new_data_source(pinfo->fd, new_tvb,
|
||||||
new_tvb);
|
"DCERPC over SMB");
|
||||||
pinfo->fragmented=FALSE;
|
pinfo->fragmented=FALSE;
|
||||||
|
|
||||||
d_tvb=new_tvb;
|
d_tvb=new_tvb;
|
||||||
|
|
10
packet-smb.c
10
packet-smb.c
|
@ -3,7 +3,7 @@
|
||||||
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
|
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
|
||||||
* 2001 Rewrite by Ronnie Sahlberg and Guy Harris
|
* 2001 Rewrite by Ronnie Sahlberg and Guy Harris
|
||||||
*
|
*
|
||||||
* $Id: packet-smb.c,v 1.206 2002/02/14 05:53:59 guy Exp $
|
* $Id: packet-smb.c,v 1.207 2002/02/18 01:08:36 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -7712,9 +7712,9 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
||||||
}
|
}
|
||||||
|
|
||||||
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
|
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
|
||||||
r_fd->datalen, "Reassembled SMB");
|
r_fd->datalen);
|
||||||
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, pd_tvb);
|
add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11517,9 +11517,9 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
|
||||||
}
|
}
|
||||||
|
|
||||||
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
|
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
|
||||||
r_fd->datalen, "Reassembled SMB");
|
r_fd->datalen);
|
||||||
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, pd_tvb);
|
add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* packet-tcp.c
|
/* packet-tcp.c
|
||||||
* Routines for TCP packet disassembly
|
* Routines for TCP packet disassembly
|
||||||
*
|
*
|
||||||
* $Id: packet-tcp.c,v 1.130 2002/02/03 23:28:38 guy Exp $
|
* $Id: packet-tcp.c,v 1.131 2002/02/18 01:08:37 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -382,14 +382,14 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
|
||||||
|
|
||||||
/* create a new TVB structure for desegmented data */
|
/* create a new TVB structure for desegmented data */
|
||||||
next_tvb = tvb_new_real_data(ipfd_head->data,
|
next_tvb = tvb_new_real_data(ipfd_head->data,
|
||||||
ipfd_head->datalen, ipfd_head->datalen,
|
ipfd_head->datalen, ipfd_head->datalen);
|
||||||
"Desegmented");
|
|
||||||
|
|
||||||
/* add this tvb as a child to the original one */
|
/* add this tvb as a child to the original one */
|
||||||
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
|
||||||
|
|
||||||
/* add desegmented data to the data source list */
|
/* add desegmented data to the data source list */
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, next_tvb);
|
add_new_data_source(pinfo->fd, next_tvb,
|
||||||
|
"Desegmented");
|
||||||
|
|
||||||
/* indicate that this is reassembled data */
|
/* indicate that this is reassembled data */
|
||||||
tcpinfo->is_reassembled = TRUE;
|
tcpinfo->is_reassembled = TRUE;
|
||||||
|
|
78
packet-vj.c
78
packet-vj.c
|
@ -1,7 +1,7 @@
|
||||||
/* packet-vj.c
|
/* packet-vj.c
|
||||||
* Routines for Van Jacobson header decompression.
|
* Routines for Van Jacobson header decompression.
|
||||||
*
|
*
|
||||||
* $Id: packet-vj.c,v 1.5 2002/01/21 07:36:44 guy Exp $
|
* $Id: packet-vj.c,v 1.6 2002/02/18 01:08:37 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -170,8 +170,7 @@ typedef struct {
|
||||||
static int proto_vj = -1;
|
static int proto_vj = -1;
|
||||||
|
|
||||||
/* Protocol handles */
|
/* Protocol handles */
|
||||||
static dissector_handle_t vjc_handle;
|
static dissector_handle_t ip_handle;
|
||||||
static dissector_handle_t vjuc_handle;
|
|
||||||
static dissector_handle_t data_handle;
|
static dissector_handle_t data_handle;
|
||||||
|
|
||||||
/* State repository (Full Duplex) */
|
/* State repository (Full Duplex) */
|
||||||
|
@ -191,12 +190,10 @@ static void decodel(tvbuff_t *tvb, guint32 *offset, gint32 *val);
|
||||||
static guint16 ip_csum(const guint8 *ptr, guint32 len);
|
static guint16 ip_csum(const guint8 *ptr, guint32 len);
|
||||||
static slcompress *slhc_init(gint rslots);
|
static slcompress *slhc_init(gint rslots);
|
||||||
static void vj_init(void);
|
static void vj_init(void);
|
||||||
static void vj_display_pkt(tvbuff_t *parent_tvb, tvbuff_t *child_tvb,
|
|
||||||
packet_info *pinfo, proto_tree *tree);
|
|
||||||
static gint vjuc_check(tvbuff_t *tvb, slcompress *comp);
|
static gint vjuc_check(tvbuff_t *tvb, slcompress *comp);
|
||||||
static void vjuc_update_state(tvbuff_t *tvb, slcompress *comp, guint8 index);
|
static void vjuc_update_state(tvbuff_t *tvb, slcompress *comp, guint8 index);
|
||||||
static gint vjuc_tvb_setup(tvbuff_t *tvb, tvbuff_t **dst_tvb,
|
static gint vjuc_tvb_setup(tvbuff_t *tvb, tvbuff_t **dst_tvb,
|
||||||
slcompress *comp);
|
slcompress *comp, frame_data *fd);
|
||||||
static gint vjc_check(tvbuff_t *src_tvb, slcompress *comp);
|
static gint vjc_check(tvbuff_t *src_tvb, slcompress *comp);
|
||||||
static gint vjc_update_state(tvbuff_t *src_tvb, slcompress *comp,
|
static gint vjc_update_state(tvbuff_t *src_tvb, slcompress *comp,
|
||||||
frame_data *fd);
|
frame_data *fd);
|
||||||
|
@ -208,7 +205,6 @@ static void
|
||||||
dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree)
|
dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree)
|
||||||
{
|
{
|
||||||
tvbuff_t *next_tvb = NULL;
|
tvbuff_t *next_tvb = NULL;
|
||||||
tvbuff_t *data_tvb = NULL;
|
|
||||||
slcompress *comp = NULL;
|
slcompress *comp = NULL;
|
||||||
gint conn_index = ZERO;
|
gint conn_index = ZERO;
|
||||||
gint err = VJ_OK;
|
gint err = VJ_OK;
|
||||||
|
@ -226,7 +222,7 @@ dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree)
|
||||||
|
|
||||||
/* Set up tvb containing decompressed packet */
|
/* Set up tvb containing decompressed packet */
|
||||||
if(err != VJ_ERROR)
|
if(err != VJ_ERROR)
|
||||||
err = vjuc_tvb_setup(tvb, &next_tvb, comp);
|
err = vjuc_tvb_setup(tvb, &next_tvb, comp, pinfo->fd);
|
||||||
|
|
||||||
/* If packet seen for first time update state */
|
/* If packet seen for first time update state */
|
||||||
if(pinfo->fd->flags.visited != 1 && err == VJ_OK)
|
if(pinfo->fd->flags.visited != 1 && err == VJ_OK)
|
||||||
|
@ -234,11 +230,9 @@ dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree)
|
||||||
|
|
||||||
/* If no errors call IP dissector else dissect as data. */
|
/* If no errors call IP dissector else dissect as data. */
|
||||||
if(err == VJ_OK)
|
if(err == VJ_OK)
|
||||||
vj_display_pkt(tvb, next_tvb, pinfo, tree);
|
call_dissector(ip_handle, next_tvb, pinfo, tree);
|
||||||
else {
|
else
|
||||||
data_tvb = tvb_new_subset(tvb, 0, -1, -1);
|
call_dissector(data_handle, tvb, pinfo, tree);
|
||||||
call_dissector(data_handle, data_tvb, pinfo, tree);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dissector for VJ Compressed packets */
|
/* Dissector for VJ Compressed packets */
|
||||||
|
@ -246,7 +240,6 @@ static void
|
||||||
dissect_vjc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
dissect_vjc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
{
|
{
|
||||||
tvbuff_t *next_tvb = NULL;
|
tvbuff_t *next_tvb = NULL;
|
||||||
tvbuff_t *data_tvb = NULL;
|
|
||||||
slcompress *comp = NULL;
|
slcompress *comp = NULL;
|
||||||
gint err = VJ_OK;
|
gint err = VJ_OK;
|
||||||
|
|
||||||
|
@ -272,11 +265,9 @@ dissect_vjc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
|
||||||
/* If no errors call IP dissector else dissect as data */
|
/* If no errors call IP dissector else dissect as data */
|
||||||
if(err == VJ_OK)
|
if(err == VJ_OK)
|
||||||
vj_display_pkt(tvb, next_tvb, pinfo, tree);
|
call_dissector(ip_handle, next_tvb, pinfo, tree);
|
||||||
else {
|
else
|
||||||
data_tvb = tvb_new_subset(tvb, 0, -1, -1);
|
call_dissector(data_handle, tvb, pinfo, tree);
|
||||||
call_dissector(data_handle, data_tvb, pinfo, tree);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Registeration functions for dissectors */
|
/* Registeration functions for dissectors */
|
||||||
|
@ -285,48 +276,24 @@ proto_register_vj(void)
|
||||||
{
|
{
|
||||||
proto_vj = proto_register_protocol("PPP VJ Compression", "PPP VJ", "vj");
|
proto_vj = proto_register_protocol("PPP VJ Compression", "PPP VJ", "vj");
|
||||||
register_init_routine(&vj_init);
|
register_init_routine(&vj_init);
|
||||||
|
|
||||||
vjc_handle = create_dissector_handle(dissect_vjc, proto_vj);
|
|
||||||
vjuc_handle = create_dissector_handle(dissect_vjuc, proto_vj);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
proto_reg_handoff_vj(void)
|
proto_reg_handoff_vj(void)
|
||||||
{
|
{
|
||||||
|
dissector_handle_t vjc_handle;
|
||||||
|
dissector_handle_t vjuc_handle;
|
||||||
|
|
||||||
|
vjc_handle = create_dissector_handle(dissect_vjc, proto_vj);
|
||||||
dissector_add("ppp.protocol", PPP_VJC_COMP, vjc_handle);
|
dissector_add("ppp.protocol", PPP_VJC_COMP, vjc_handle);
|
||||||
|
|
||||||
|
vjuc_handle = create_dissector_handle(dissect_vjuc, proto_vj);
|
||||||
dissector_add("ppp.protocol", PPP_VJC_UNCOMP, vjuc_handle);
|
dissector_add("ppp.protocol", PPP_VJC_UNCOMP, vjuc_handle);
|
||||||
|
|
||||||
|
ip_handle = find_dissector("ip");
|
||||||
data_handle = find_dissector("data");
|
data_handle = find_dissector("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function to setup decompressed packet display */
|
|
||||||
static void
|
|
||||||
vj_display_pkt(tvbuff_t *parent_tvb,
|
|
||||||
tvbuff_t *child_tvb,
|
|
||||||
packet_info *pinfo,
|
|
||||||
proto_tree *tree)
|
|
||||||
{
|
|
||||||
dissector_handle_t ip_handle = find_dissector("ip");
|
|
||||||
frame_data *fd = pinfo->fd;
|
|
||||||
tvbuff_t *data_tvb = NULL;
|
|
||||||
|
|
||||||
g_assert(parent_tvb);
|
|
||||||
g_assert(child_tvb);
|
|
||||||
g_assert(fd);
|
|
||||||
|
|
||||||
if (ip_handle == NULL) {
|
|
||||||
data_tvb = tvb_new_subset(child_tvb, 0, -1, -1);
|
|
||||||
call_dissector(data_handle, data_tvb, pinfo, tree);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tvb_set_child_real_data_tvbuff(parent_tvb, child_tvb);
|
|
||||||
fd->data_src = g_slist_append(fd->data_src, child_tvb);
|
|
||||||
call_dissector(ip_handle, child_tvb, pinfo, tree);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialization function */
|
/* Initialization function */
|
||||||
static void
|
static void
|
||||||
vj_init(void)
|
vj_init(void)
|
||||||
|
@ -409,7 +376,9 @@ vjc_tvb_setup(tvbuff_t *src_tvb,
|
||||||
pbuf = g_malloc(buf_len);
|
pbuf = g_malloc(buf_len);
|
||||||
memcpy(pbuf, data_ptr, hdr_len);
|
memcpy(pbuf, data_ptr, hdr_len);
|
||||||
tvb_memcpy(src_tvb, pbuf + hdr_len, offset, buf_len - hdr_len);
|
tvb_memcpy(src_tvb, pbuf + hdr_len, offset, buf_len - hdr_len);
|
||||||
*dst_tvb = tvb_new_real_data(pbuf, buf_len, buf_len, "VJ Decompressed");
|
*dst_tvb = tvb_new_real_data(pbuf, buf_len, buf_len);
|
||||||
|
tvb_set_child_real_data_tvbuff(src_tvb, *dst_tvb);
|
||||||
|
add_new_data_source(fd, *dst_tvb, "VJ Decompressed");
|
||||||
return VJ_OK;
|
return VJ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +574,8 @@ vjuc_check(tvbuff_t *tvb, slcompress *comp)
|
||||||
static gint
|
static gint
|
||||||
vjuc_tvb_setup(tvbuff_t *tvb,
|
vjuc_tvb_setup(tvbuff_t *tvb,
|
||||||
tvbuff_t **dst_tvb,
|
tvbuff_t **dst_tvb,
|
||||||
slcompress *comp)
|
slcompress *comp,
|
||||||
|
frame_data *fd)
|
||||||
{
|
{
|
||||||
guint8 ihl = ZERO;
|
guint8 ihl = ZERO;
|
||||||
guint8 index = ZERO;
|
guint8 index = ZERO;
|
||||||
|
@ -637,7 +607,9 @@ vjuc_tvb_setup(tvbuff_t *tvb,
|
||||||
* Form the new tvbuff.
|
* Form the new tvbuff.
|
||||||
* Neither header checksum is recalculated
|
* Neither header checksum is recalculated
|
||||||
*/
|
*/
|
||||||
*dst_tvb = tvb_new_real_data(buffer, isize, isize, "VJ Uncompressed");
|
*dst_tvb = tvb_new_real_data(buffer, isize, isize);
|
||||||
|
tvb_set_child_real_data_tvbuff(tvb, *dst_tvb);
|
||||||
|
add_new_data_source(fd, *dst_tvb, "VJ Uncompressed");
|
||||||
return VJ_OK;
|
return VJ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
packet-wcp.c
12
packet-wcp.c
|
@ -2,7 +2,7 @@
|
||||||
* Routines for Wellfleet Compression frame disassembly
|
* Routines for Wellfleet Compression frame disassembly
|
||||||
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
|
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
|
||||||
*
|
*
|
||||||
* $Id: packet-wcp.c,v 1.20 2002/01/21 07:36:45 guy Exp $
|
* $Id: packet-wcp.c,v 1.21 2002/02/18 01:08:37 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -584,17 +584,17 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
|
||||||
|
|
||||||
|
|
||||||
TRY {
|
TRY {
|
||||||
tvb = tvb_new_real_data( pdata_ptr->buffer, pdata_ptr->len, pdata_ptr->len, "uncompressed");
|
tvb = tvb_new_real_data( pdata_ptr->buffer, pdata_ptr->len, pdata_ptr->len);
|
||||||
|
|
||||||
}
|
}
|
||||||
CATCH(BoundsError) {
|
CATCH(BoundsError) {
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
CATCH(ReportedBoundsError) {
|
CATCH(ReportedBoundsError) {
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ENDTRY;
|
ENDTRY;
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
|
||||||
tvb_set_child_real_data_tvbuff( src_tvb, tvb);
|
tvb_set_child_real_data_tvbuff( src_tvb, tvb);
|
||||||
|
|
||||||
/* Add new data to the data source list */
|
/* Add new data to the data source list */
|
||||||
pinfo->fd->data_src = g_slist_append( pinfo->fd->data_src, tvb);
|
add_new_data_source( pinfo->fd, tvb, "Uncompressed");
|
||||||
return tvb;
|
return tvb;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Routines to dissect WTP component of WAP traffic.
|
* Routines to dissect WTP component of WAP traffic.
|
||||||
*
|
*
|
||||||
* $Id: packet-wtp.c,v 1.26 2002/01/21 07:36:47 guy Exp $
|
* $Id: packet-wtp.c,v 1.27 2002/02/18 01:08:37 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -523,10 +523,10 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
{
|
{
|
||||||
wsp_tvb = tvb_new_real_data(fd_head->data,
|
wsp_tvb = tvb_new_real_data(fd_head->data,
|
||||||
fd_head->len,
|
fd_head->len,
|
||||||
fd_head->len,
|
fd_head->len);
|
||||||
"Reassembled");
|
|
||||||
tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
|
tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
|
||||||
pinfo->fd->data_src = g_slist_append(pinfo->fd->data_src, wsp_tvb);
|
add_new_data_source(pinfo->fd, wsp_tvb,
|
||||||
|
"Reassembled");
|
||||||
pinfo->fragmented = FALSE;
|
pinfo->fragmented = FALSE;
|
||||||
call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
|
call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
|
||||||
}
|
}
|
||||||
|
|
26
print.c
26
print.c
|
@ -1,7 +1,7 @@
|
||||||
/* print.c
|
/* print.c
|
||||||
* Routines for printing packet analysis trees.
|
* Routines for printing packet analysis trees.
|
||||||
*
|
*
|
||||||
* $Id: print.c,v 1.40 2002/02/15 11:56:10 guy Exp $
|
* $Id: print.c,v 1.41 2002/02/18 01:08:38 guy Exp $
|
||||||
*
|
*
|
||||||
* Gilbert Ramirez <gram@alumni.rice.edu>
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
||||||
*
|
*
|
||||||
|
@ -121,18 +121,20 @@ void proto_tree_print(gboolean print_one_packet, print_args_t *print_args,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the data source tvbuff with a specified name, and return a
|
* Find the data source for a specified field, and return a pointer
|
||||||
* pointer to the data in it.
|
* to the data in it.
|
||||||
*/
|
*/
|
||||||
static const guint8 *
|
static const guint8 *
|
||||||
get_field_data(GSList *src_list, field_info *fi)
|
get_field_data(GSList *src_list, field_info *fi)
|
||||||
{
|
{
|
||||||
GSList *src;
|
GSList *src_le;
|
||||||
|
data_source *src;
|
||||||
tvbuff_t *src_tvb;
|
tvbuff_t *src_tvb;
|
||||||
|
|
||||||
for (src = src_list; src != NULL; src = g_slist_next(src)) {
|
for (src_le = src_list; src_le != NULL; src_le = src_le->next) {
|
||||||
src_tvb = src->data;
|
src = src_le->data;
|
||||||
if (strcmp(fi->ds_name, tvb_get_name(src_tvb)) == 0) {
|
src_tvb = src->tvb;
|
||||||
|
if (fi->ds_tvb == src_tvb) {
|
||||||
/*
|
/*
|
||||||
* Found it.
|
* Found it.
|
||||||
*/
|
*/
|
||||||
|
@ -208,7 +210,8 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
|
||||||
void print_hex_data(FILE *fh, gint format, frame_data *fd)
|
void print_hex_data(FILE *fh, gint format, frame_data *fd)
|
||||||
{
|
{
|
||||||
gboolean multiple_sources;
|
gboolean multiple_sources;
|
||||||
GSList *src;
|
GSList *src_le;
|
||||||
|
data_source *src;
|
||||||
tvbuff_t *tvb;
|
tvbuff_t *tvb;
|
||||||
char *name;
|
char *name;
|
||||||
char *line;
|
char *line;
|
||||||
|
@ -223,10 +226,11 @@ void print_hex_data(FILE *fh, gint format, frame_data *fd)
|
||||||
*/
|
*/
|
||||||
multiple_sources = (fd->data_src->next != NULL);
|
multiple_sources = (fd->data_src->next != NULL);
|
||||||
|
|
||||||
for (src = fd->data_src; src != NULL; src = src->next) {
|
for (src_le = fd->data_src; src_le != NULL; src_le = src_le->next) {
|
||||||
tvb = src->data;
|
src = src_le->data;
|
||||||
|
tvb = src->tvb;
|
||||||
if (multiple_sources) {
|
if (multiple_sources) {
|
||||||
name = tvb_get_name(tvb);
|
name = src->name;
|
||||||
print_line(fh, format, "\n");
|
print_line(fh, format, "\n");
|
||||||
line = g_malloc(strlen(name) + 3); /* <name>:\n\0 */
|
line = g_malloc(strlen(name) + 3); /* <name>:\n\0 */
|
||||||
strcpy(line, name);
|
strcpy(line, name);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* tethereal.c
|
/* tethereal.c
|
||||||
*
|
*
|
||||||
* $Id: tethereal.c,v 1.121 2002/02/08 10:07:34 guy Exp $
|
* $Id: tethereal.c,v 1.122 2002/02/18 01:08:38 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1207,7 +1207,7 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
|
||||||
fdata->next = NULL;
|
fdata->next = NULL;
|
||||||
fdata->prev = NULL;
|
fdata->prev = NULL;
|
||||||
fdata->pfd = NULL;
|
fdata->pfd = NULL;
|
||||||
fdata->data_src = NULL;
|
fdata->data_src = NULL;
|
||||||
fdata->num = cf->count;
|
fdata->num = cf->count;
|
||||||
fdata->pkt_len = phdr->len;
|
fdata->pkt_len = phdr->len;
|
||||||
fdata->cap_len = phdr->caplen;
|
fdata->cap_len = phdr->caplen;
|
||||||
|
@ -1264,8 +1264,7 @@ clear_fdata(frame_data *fdata)
|
||||||
{
|
{
|
||||||
if (fdata->pfd)
|
if (fdata->pfd)
|
||||||
g_slist_free(fdata->pfd);
|
g_slist_free(fdata->pfd);
|
||||||
if (fdata->data_src)
|
free_data_sources(fdata); /* release data source list */
|
||||||
g_slist_free(fdata->data_src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue