aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-smb.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-08-22 00:31:58 +0000
committerGuy Harris <guy@alum.mit.edu>2004-08-22 00:31:58 +0000
commitc68f62210fc20890502cb84dbc2ea4321de5b791 (patch)
treed7311a179eacd5a137e9e874b3bf2d0e15377de6 /epan/dissectors/packet-smb.c
parent9dcb077e460619b8ab54810e4fef850a0799bcde (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-smb.c')
-rw-r--r--epan/dissectors/packet-smb.c67
1 files changed, 16 insertions, 51 deletions
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index a9cc387d06..db97ee34ac 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -36,7 +36,6 @@
#include <string.h>
#include <glib.h>
#include <ctype.h>
-#include <epan/int-64bit.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include "smb.h"
@@ -4665,8 +4664,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
proto_item *litem = NULL;
proto_tree *ltree = NULL;
if(lt&0x10){
- guint8 buf[8];
- guint32 val;
+ guint64 val;
/* large lock format */
litem = proto_tree_add_text(tr, tvb, offset, 20,
@@ -4685,32 +4683,16 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
/* offset */
CHECK_BYTE_COUNT(8);
- val=tvb_get_letohl(tvb, offset);
- buf[3]=(val>>24)&0xff;
- buf[2]=(val>>16)&0xff;
- buf[1]=(val>> 8)&0xff;
- buf[0]=(val )&0xff;
- val=tvb_get_letohl(tvb, offset+4);
- buf[7]=(val>>24)&0xff;
- buf[6]=(val>>16)&0xff;
- buf[5]=(val>> 8)&0xff;
- buf[4]=(val )&0xff;
- proto_tree_add_string(ltree, hf_smb_lock_long_offset, tvb, offset, 8, u64toa(buf));
+ val=((guint64)tvb_get_letohl(tvb, offset)) << 32
+ | tvb_get_letohl(tvb, offset+4);
+ proto_tree_add_uint64(ltree, hf_smb_lock_long_offset, tvb, offset, 8, val);
COUNT_BYTES(8);
/* length */
CHECK_BYTE_COUNT(8);
- val=tvb_get_letohl(tvb, offset);
- buf[3]=(val>>24)&0xff;
- buf[2]=(val>>16)&0xff;
- buf[1]=(val>> 8)&0xff;
- buf[0]=(val )&0xff;
- val=tvb_get_letohl(tvb, offset+4);
- buf[7]=(val>>24)&0xff;
- buf[6]=(val>>16)&0xff;
- buf[5]=(val>> 8)&0xff;
- buf[4]=(val )&0xff;
- proto_tree_add_string(ltree, hf_smb_lock_long_length, tvb, offset, 8, u64toa(buf));
+ val=((guint64)tvb_get_letohl(tvb, offset)) << 32
+ | tvb_get_letohl(tvb, offset+4);
+ proto_tree_add_uint64(ltree, hf_smb_lock_long_length, tvb, offset, 8, val);
COUNT_BYTES(8);
} else {
/* normal lock format */
@@ -4749,8 +4731,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
proto_item *litem = NULL;
proto_tree *ltree = NULL;
if(lt&0x10){
- guint8 buf[8];
- guint32 val;
+ guint64 val;
/* large lock format */
litem = proto_tree_add_text(tr, tvb, offset, 20,
@@ -4769,32 +4750,16 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
/* offset */
CHECK_BYTE_COUNT(8);
- val=tvb_get_letohl(tvb, offset);
- buf[3]=(val )&0xff;
- buf[2]=(val>> 8)&0xff;
- buf[1]=(val>>16)&0xff;
- buf[0]=(val>>24)&0xff;
- val=tvb_get_letohl(tvb, offset+4);
- buf[7]=(val )&0xff;
- buf[6]=(val>> 8)&0xff;
- buf[5]=(val>>16)&0xff;
- buf[4]=(val>>24)&0xff;
- proto_tree_add_string(ltree, hf_smb_lock_long_offset, tvb, offset, 8, u64toa(buf));
+ val=((guint64)tvb_get_letohl(tvb, offset)) << 32
+ | tvb_get_letohl(tvb, offset+4);
+ proto_tree_add_uint64(ltree, hf_smb_lock_long_offset, tvb, offset, 8, val);
COUNT_BYTES(8);
/* length */
CHECK_BYTE_COUNT(8);
- val=tvb_get_letohl(tvb, offset);
- buf[3]=(val )&0xff;
- buf[2]=(val>> 8)&0xff;
- buf[1]=(val>>16)&0xff;
- buf[0]=(val>>24)&0xff;
- val=tvb_get_letohl(tvb, offset+4);
- buf[7]=(val )&0xff;
- buf[6]=(val>> 8)&0xff;
- buf[5]=(val>>16)&0xff;
- buf[4]=(val>>24)&0xff;
- proto_tree_add_string(ltree, hf_smb_lock_long_length, tvb, offset, 8, u64toa(buf));
+ val=((guint64)tvb_get_letohl(tvb, offset)) << 32
+ | tvb_get_letohl(tvb, offset+4);
+ proto_tree_add_uint64(ltree, hf_smb_lock_long_length, tvb, offset, 8, val);
COUNT_BYTES(8);
} else {
/* normal lock format */
@@ -15932,11 +15897,11 @@ proto_register_smb(void)
NULL, 0, "Number of unlock requests in this request", HFILL }},
{ &hf_smb_lock_long_length,
- { "Length", "smb.lock.length", FT_STRING, BASE_DEC,
+ { "Length", "smb.lock.length", FT_UINT64, BASE_DEC,
NULL, 0, "Length of lock/unlock region", HFILL }},
{ &hf_smb_lock_long_offset,
- { "Offset", "smb.lock.offset", FT_STRING, BASE_DEC,
+ { "Offset", "smb.lock.offset", FT_UINT64, BASE_DEC,
NULL, 0, "Offset in the file of lock/unlock region", HFILL }},
{ &hf_smb_file_type,