aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2009-10-03 04:49:04 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2009-10-03 04:49:04 +0000
commit7783d0f03e482c21a610d36e3b2a86a2276220d3 (patch)
tree306ae8c6a2c9b783d74c4c84de5200c4480c417d /epan
parentec886a00e21019c3f77ee4b77602c2b6a4994013 (diff)
add a helper that supports decoding either a 16 or 32 bit integer based
on whether nrd or ndr64 is used. svn path=/trunk/; revision=30263
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dcerpc-ndr.c22
-rw-r--r--epan/dissectors/packet-dcerpc-samr.c4
-rw-r--r--epan/dissectors/packet-dcerpc.h3
3 files changed, 27 insertions, 2 deletions
diff --git a/epan/dissectors/packet-dcerpc-ndr.c b/epan/dissectors/packet-dcerpc-ndr.c
index a6e760bde1..dc1e01afc6 100644
--- a/epan/dissectors/packet-dcerpc-ndr.c
+++ b/epan/dissectors/packet-dcerpc-ndr.c
@@ -236,6 +236,28 @@ dissect_ndr_4or8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
}
+/* This is used to dissect the new datatypes, such as enums
+ that are 2 bytes in size in NDR but 4 bytes in NDR64.
+*/
+int
+dissect_ndr_2or4 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint32 *pdata)
+{
+ dcerpc_info *di;
+
+ di=pinfo->private_data;
+
+ if (di->call_data->flags & DCERPC_IS_NDR64) {
+ return dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hfindex, pdata);
+ } else {
+ guint16 val;
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep, hfindex, &val);
+ *pdata = val;
+ return offset;
+ }
+}
+
int
PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c
index fdb9339646..f417464c7c 100644
--- a/epan/dissectors/packet-dcerpc-samr.c
+++ b/epan/dissectors/packet-dcerpc-samr.c
@@ -3785,7 +3785,7 @@ samr_dissect_DomainInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset;
- guint16 level;
+ guint32 level;
old_offset = offset;
if (parent_tree) {
@@ -3793,7 +3793,7 @@ samr_dissect_DomainInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U
tree = proto_item_add_subtree(item, ett_samr_samr_DomainInfo);
}
- offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep, hf_index, &level);
+ offset = dissect_ndr_2or4(tvb, offset, pinfo, tree, drep, hf_index, &level);
ALIGN_TO_8_BYTES;
switch(level) {
diff --git a/epan/dissectors/packet-dcerpc.h b/epan/dissectors/packet-dcerpc.h
index d03b039afd..14996828c9 100644
--- a/epan/dissectors/packet-dcerpc.h
+++ b/epan/dissectors/packet-dcerpc.h
@@ -185,6 +185,9 @@ int dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
int dissect_ndr_ctx_hnd (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, e_ctx_hnd *pdata);
+int dissect_ndr_2or4 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint32 *pdata);
int dissect_ndr_4or8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint64 *pdata);