return offset;
}
-/* function to dissect a unidimensional conformant and varying array */
-int
-dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+
+/* function to dissect a unidimensional conformant and varying array
+ * depending on the dissection function passed as a parameter,
+ * content of the array will be dissected as a block or byte by byte
+ */
+static int
+dissect_ndr_ucvarray_core(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
- dcerpc_dissect_fnct_t *fnct)
+ dcerpc_dissect_fnct_t *fnct_bytes,
+ dcerpc_dissect_fnct_blk_t *fnct_block)
{
guint32 i;
dcerpc_info *di;
proto_tree_add_uint(tree, hf_dcerpc_array_actual_count, tvb, di->array_actual_count_offset, conformance_size, di->array_actual_count);
/* real run, dissect the elements */
- for(i=0 ;i<di->array_actual_count; i++) {
- old_offset = offset;
- offset = (*fnct)(tvb, offset, pinfo, tree, drep);
- if (offset <= old_offset)
- THROW(ReportedBoundsError);
+ if (fnct_block) {
+ old_offset = offset;
+ offset = (*fnct_block)(tvb, offset, di->array_actual_count, pinfo, tree, drep);
+ } else {
+ for(i=0 ;i<di->array_actual_count; i++) {
+ old_offset = offset;
+ offset = (*fnct_bytes)(tvb, offset, pinfo, tree, drep);
+ if (offset <= old_offset)
+ THROW(ReportedBoundsError);
+ }
}
}
return offset;
}
+
+int
+dissect_ndr_ucvarray_block(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ dcerpc_dissect_fnct_blk_t *fnct)
+{
+ return dissect_ndr_ucvarray_core(tvb, offset, pinfo, tree, drep, NULL, fnct);
+}
+
+int
+dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ dcerpc_dissect_fnct_t *fnct)
+{
+ return dissect_ndr_ucvarray_core(tvb, offset, pinfo, tree, drep, fnct, NULL);
+}
/* function to dissect a unidimensional varying array */
int
dissect_ndr_uvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
int hfindex, guint3264 *pdata);
typedef int (dcerpc_dissect_fnct_t)(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep);
+typedef int (dcerpc_dissect_fnct_blk_t)(tvbuff_t *tvb, int offset, int length, packet_info *pinfo, proto_tree *tree, guint8 *drep);
typedef void (dcerpc_callback_fnct_t)(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb, int start_offset, int end_offset, void *callback_args);
proto_tree *tree, guint8 *drep,
dcerpc_dissect_fnct_t *fnct);
-/* dissect a NDR unidimensional conformant and varying array */
+/* dissect a NDR unidimensional conformant and varying array
+ * each byte in the array is processed separately
+ */
int dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- dcerpc_dissect_fnct_t *fnct);
+ proto_tree *tree, guint8 *drep,
+ dcerpc_dissect_fnct_t *fnct);
+
+int dissect_ndr_ucvarray_block(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ dcerpc_dissect_fnct_blk_t *fnct);
/* dissect a NDR unidimensional varying array */
int dissect_ndr_uvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo,