We only need to print the data corresponding to the field, so fetch only
that data with a "tvb_get_ptr()". svn path=/trunk/; revision=3532
This commit is contained in:
parent
2da9bb2696
commit
e52dd802c4
25
print.c
25
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.34 2001/06/08 08:50:49 guy Exp $
|
* $Id: print.c,v 1.35 2001/06/08 10:07:55 guy Exp $
|
||||||
*
|
*
|
||||||
* Gilbert Ramirez <gram@xiexie.org>
|
* Gilbert Ramirez <gram@xiexie.org>
|
||||||
*
|
*
|
||||||
|
@ -125,22 +125,21 @@ void proto_tree_print(gboolean print_one_packet, print_args_t *print_args,
|
||||||
* pointer to the data in it.
|
* pointer to the data in it.
|
||||||
*/
|
*/
|
||||||
static const guint8 *
|
static const guint8 *
|
||||||
find_data_source(GSList *src_list, gchar *ds_name)
|
get_field_data(GSList *src_list, field_info *fi)
|
||||||
{
|
{
|
||||||
GSList *src;
|
GSList *src;
|
||||||
tvbuff_t *src_tvb;
|
tvbuff_t *src_tvb;
|
||||||
guint src_tvb_len;
|
|
||||||
|
|
||||||
for (src = src_list; src != NULL; src = g_slist_next(src)) {
|
for (src = src_list; src != NULL; src = g_slist_next(src)) {
|
||||||
src_tvb = src->data;
|
src_tvb = src->data;
|
||||||
if (strcmp(ds_name, tvb_get_name(src_tvb)) == 0) {
|
if (strcmp(fi->ds_name, tvb_get_name(src_tvb)) == 0) {
|
||||||
/*
|
/*
|
||||||
* Found it.
|
* Found it.
|
||||||
*/
|
*/
|
||||||
src_tvb_len = tvb_length(src_tvb);
|
return tvb_get_ptr(src_tvb, fi->start, fi->length);
|
||||||
return tvb_get_ptr(src_tvb, 0, src_tvb_len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_assert_not_reached();
|
||||||
return NULL; /* not found */
|
return NULL; /* not found */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,11 +187,10 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
|
||||||
be printing the entire packet in hex). */
|
be printing the entire packet in hex). */
|
||||||
if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
|
if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
|
||||||
/*
|
/*
|
||||||
* Find the data source tvbuff for this field.
|
* Find the data for this field.
|
||||||
*/
|
*/
|
||||||
pd = find_data_source(pdata->src_list, fi->ds_name);
|
pd = get_field_data(pdata->src_list, fi);
|
||||||
print_hex_data_text(pdata->fh, &pd[fi->start],
|
print_hex_data_text(pdata->fh, pd, fi->length, pdata->encoding);
|
||||||
fi->length, pdata->encoding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're printing all levels, or if this level is expanded,
|
/* If we're printing all levels, or if this level is expanded,
|
||||||
|
@ -317,11 +315,10 @@ void proto_tree_print_node_ps(GNode *node, gpointer data)
|
||||||
be printing the entire packet in hex). */
|
be printing the entire packet in hex). */
|
||||||
if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
|
if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
|
||||||
/*
|
/*
|
||||||
* Find the data source tvbuff for this field.
|
* Find the data for this field.
|
||||||
*/
|
*/
|
||||||
pd = find_data_source(pdata->src_list, fi->ds_name);
|
pd = get_field_data(pdata->src_list, fi);
|
||||||
print_hex_data_ps(pdata->fh, &pd[fi->start], fi->length,
|
print_hex_data_ps(pdata->fh, pd, fi->length, pdata->encoding);
|
||||||
pdata->encoding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recurse into the subtree, if it exists */
|
/* Recurse into the subtree, if it exists */
|
||||||
|
|
Loading…
Reference in New Issue