summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dcerpc-nt.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-01-30 11:56:37 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-01-30 11:56:37 +0000
commit95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8 (patch)
treee9bcbe6f55f51d9d76b0716a41fa420077ca14b3 /epan/dissectors/packet-dcerpc-nt.c
parentcdaf516b8b5611c206e1b630a234c3f9a5fcea40 (diff)
downloadwireshark-95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8.tar.gz
add a new dissect_ndr_counted_ascii_string() that mimics dissect_ndr_counted_string() but handles an ASCII string instead of a Unicode one.
svn path=/trunk/; revision=13204
Diffstat (limited to 'epan/dissectors/packet-dcerpc-nt.c')
-rw-r--r--epan/dissectors/packet-dcerpc-nt.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c
index d5f0bfd155..7f018fd59e 100644
--- a/epan/dissectors/packet-dcerpc-nt.c
+++ b/epan/dissectors/packet-dcerpc-nt.c
@@ -265,6 +265,64 @@ dissect_ndr_counted_byte_array(tvbuff_t *tvb, int offset,
tvb, offset, pinfo, tree, drep, hf_index, cb_byte_array_postprocess, GINT_TO_POINTER(2 + levels));
}
+/* Dissect a counted ascii string in-line. */
+static gint ett_nt_counted_ascii_string = -1;
+
+int
+dissect_ndr_counted_ascii_string_cb(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, int hf_index,
+ dcerpc_callback_fnct_t *callback,
+ void *callback_args)
+{
+ dcerpc_info *di = pinfo->private_data;
+ proto_item *item;
+ proto_tree *subtree;
+ guint16 len, size;
+
+ /* Structure starts with short, but is aligned for longs */
+
+ ALIGN_TO_4_BYTES;
+
+ if (di->conformant_run)
+ return offset;
+
+ item = proto_tree_add_text(tree, tvb, offset, 0,
+ proto_registrar_get_name(hf_index));
+
+ subtree = proto_item_add_subtree(item, ett_nt_counted_ascii_string);
+
+ /*
+ struct {
+ short len;
+ short size;
+ [size_is(size), length_is(len), ptr] unsigned char *string;
+ } WHATEVER_THIS_IS_CALLED;
+
+ */
+
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, drep,
+ hf_nt_cs_len, &len);
+
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, drep,
+ hf_nt_cs_size, &size);
+
+ offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, subtree, drep,
+ dissect_ndr_char_cvstring, NDR_POINTER_UNIQUE,
+ "Ascii String", hf_index, callback, callback_args);
+
+ return offset;
+}
+
+int
+dissect_ndr_counted_ascii_string(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, int hf_index, int levels)
+{
+ return dissect_ndr_counted_ascii_string_cb(
+ tvb, offset, pinfo, tree, drep, hf_index, cb_str_postprocess, GINT_TO_POINTER(2 + levels));
+}
+
/* This function is used to dissect a DCERPC encoded 64 bit time value.
XXX it should be fixed both here and in dissect_nt_64bit_time so
it can handle both BIG and LITTLE endian encodings
@@ -1545,6 +1603,7 @@ void dcerpc_smb_init(int proto_dcerpc)
&ett_nt_sid_array,
&ett_nt_sid_and_attributes_array,
&ett_nt_sid_and_attributes,
+ &ett_nt_counted_ascii_string,
};
/* Register ett's and hf's */