diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-08-22 00:31:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-08-22 00:31:58 +0000 |
commit | c68f62210fc20890502cb84dbc2ea4321de5b791 (patch) | |
tree | d7311a179eacd5a137e9e874b3bf2d0e15377de6 /epan/dissectors/packet-ber.c | |
parent | 9dcb077e460619b8ab54810e4fef850a0799bcde (diff) |
Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bit
integers.
Make FT_INT64 and FT_UINT64 add numerical values, rather than byte-array
values, to the protocol tree, and add routines to add specified 64-bit
integer values to the protocol tree.
Use those routines in the RSVP dissector.
svn path=/trunk/; revision=11796
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r-- | epan/dissectors/packet-ber.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index d1b2c902f8..b1891d76d1 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -43,7 +43,6 @@ #include <epan/packet.h> #include <epan/strutil.h> -#include <epan/int-64bit.h> #include "prefs.h" #include "packet-ber.h" @@ -344,6 +343,7 @@ dissect_ber_integer(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off guint32 tag; guint32 len; gint32 val; + gint64 val64; guint32 i; offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag); @@ -367,11 +367,19 @@ dissect_ber_integer(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int off } if(len>4){ header_field_info *hfinfo; - char buf[8]={0,0,0,0,0,0,0,0}; - tvb_memcpy(tvb, buf+8-len, offset, len); + val64=0; + if (len > 0) { + /* extend sign bit */ + val64 = (gint8)tvb_get_guint8(tvb, offset); + offset++; + } + for(i=1;i<len;i++){ + val64=(val64<<8)|tvb_get_guint8(tvb, offset); + offset++; + } hfinfo = proto_registrar_get_nth(hf_id); - proto_tree_add_text(tree, tvb, offset, len, "%s: %s", hfinfo->name, u64toa(buf)); + proto_tree_add_text(tree, tvb, offset, len, "%s: %" PRIu64, hfinfo->name, val64); return 0xdeadbeef; } |