diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-01-30 11:56:37 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-01-30 11:56:37 +0000 |
commit | 95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8 (patch) | |
tree | e9bcbe6f55f51d9d76b0716a41fa420077ca14b3 /epan | |
parent | cdaf516b8b5611c206e1b630a234c3f9a5fcea40 (diff) | |
download | wireshark-95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8.tar.gz wireshark-95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8.tar.bz2 wireshark-95b0d123ba60b82d2e5aea42b9eaf4cb4a8ec9b8.zip |
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')
-rw-r--r-- | epan/dissectors/packet-dcerpc-nt.c | 59 | ||||
-rw-r--r-- | epan/dissectors/packet-dcerpc-nt.h | 11 |
2 files changed, 70 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 */ diff --git a/epan/dissectors/packet-dcerpc-nt.h b/epan/dissectors/packet-dcerpc-nt.h index 227f2faf70..3a41cfd244 100644 --- a/epan/dissectors/packet-dcerpc-nt.h +++ b/epan/dissectors/packet-dcerpc-nt.h @@ -67,6 +67,17 @@ extern const value_string platform_id_vals[]; } 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); +int +dissect_ndr_counted_ascii_string(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, + guint8 *drep, int hf_index, int levels); + +int dissect_ndr_counted_string_cb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, |