aboutsummaryrefslogtreecommitdiffstats
path: root/proto.c
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>1999-09-18 15:44:41 +0000
committerLaurent Deniel <laurent.deniel@free.fr>1999-09-18 15:44:41 +0000
commit89e7f49262bd8aee13bb86c8516611e31c32ff78 (patch)
treed62371648217759f43dcec50500d48ed5b057015 /proto.c
parentfaad1274edd677eabd16505e41e837f07ef5a72c (diff)
Handle the missing FT_BYTES field type.
svn path=/trunk/; revision=687
Diffstat (limited to 'proto.c')
-rw-r--r--proto.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/proto.c b/proto.c
index 27ff6659bd..33ab009b8c 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.28 1999/09/17 05:56:58 guy Exp $
+ * $Id: proto.c,v 1.29 1999/09/18 15:44:40 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -292,6 +292,8 @@ proto_tree_free_node(GNode *node, gpointer data)
g_mem_chunk_free(gmc_item_labels, fi->representation);
if (fi->hfinfo->type == FT_STRING)
g_free(fi->value.string);
+ else if (fi->hfinfo->type == FT_BYTES)
+ g_free(fi->value.bytes);
g_mem_chunk_free(gmc_field_info, fi);
}
return FALSE; /* FALSE = do not end traversal of GNode tree */
@@ -403,6 +405,13 @@ NOTES
fi->value.numeric = va_arg(ap, unsigned int) ? TRUE : FALSE;
break;
+ case FT_BYTES:
+ /* This g_malloc'ed memory is freed in
+ proto_tree_free_node() */
+ fi->value.bytes = (guint8 *)g_malloc(length);
+ memcpy(fi->value.bytes, va_arg(ap, guint8*), length);
+ break;
+
case FT_UINT8:
case FT_VALS_UINT8:
fi->value.numeric = va_arg(ap, unsigned int);
@@ -556,6 +565,12 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
fi->value.numeric == TRUE ? "True" : "False");
break;
+ case FT_BYTES:
+ snprintf(label_str, ITEM_LABEL_LENGTH,
+ "%s: %s", fi->hfinfo->name,
+ bytes_to_str(fi->value.bytes, fi->length));
+ break;
+
case FT_UINT8:
case FT_UINT16:
case FT_UINT32: