Change-Id: I728c27b95edb2c47d708ec89b31a404e4a30e4cb
static int hf_nmf_version_major = -1;
static int hf_nmf_version_minor = -1;
static int hf_nmf_mode_value = -1;
static int hf_nmf_version_major = -1;
static int hf_nmf_version_minor = -1;
static int hf_nmf_mode_value = -1;
-static int hf_nmf_length = -1;
+static int hf_nmf_via_length = -1;
enum nmf_record_type {
NMF_VERSION_RECORD = 0x00,
enum nmf_record_type {
NMF_VERSION_RECORD = 0x00,
-dissect_nmf_record_size(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- int offset, guint32 *_size)
+dissect_nmf_record_size(tvbuff_t *tvb, proto_tree *tree,
+ int hf_index, int offset, guint32 *_size)
+ proto_item *item = NULL;
+ guint8 byte = tvb_get_guint8(tvb, offset);
+ guint32 size = 0;
+ guint8 shift = 0;
+ int start_offset = offset;
+
+ do {
+ byte = tvb_get_guint8(tvb, offset);
+ offset += 1;
+
+ size |= (guint32)(byte & 0x7F) << shift;
+ shift += 7;
+ } while (byte & 0x80);
+
+
+ item = proto_tree_add_item(tree, hf_index, tvb,
+ start_offset, -1, ENC_NA);
+ proto_item_set_end(item, tvb, offset);
+ proto_item_append_text(item, ": %u (0x%x)",
+ (guint)size, (guint)size);
+
static int
dissect_nmf_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
static int
dissect_nmf_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
proto_tree *record_tree = NULL;
const gchar *record_name = NULL;
enum nmf_record_type record_type;
proto_tree *record_tree = NULL;
const gchar *record_name = NULL;
enum nmf_record_type record_type;
record_item = proto_tree_add_item(tree, hf_nmf_record, tvb, offset, -1, ENC_NA);
proto_item_append_text(record_item, ", start_offset=0x%x, ", (guint)offset);
record_item = proto_tree_add_item(tree, hf_nmf_record, tvb, offset, -1, ENC_NA);
proto_item_append_text(record_item, ", start_offset=0x%x, ", (guint)offset);
offset += 1;
break;
case NMF_VIA_RECORD:
offset += 1;
break;
case NMF_VIA_RECORD:
+ offset = dissect_nmf_record_size(tvb, record_tree,
+ hf_nmf_via_length,
+ offset, &size);
+ if (offset <= 0) {
+ return -1;
+ }
+
+ offset += size;
+ break;
case NMF_KNOWN_ENCODING_RECORD:
case NMF_KNOWN_ENCODING_RECORD:
case NMF_EXTENSIBLE_ENCODING_RECORD:
case NMF_UNSIZED_ENVELOPE_RECORD:
case NMF_SIZED_ENVELOPE_RECORD:
case NMF_EXTENSIBLE_ENCODING_RECORD:
case NMF_UNSIZED_ENVELOPE_RECORD:
case NMF_SIZED_ENVELOPE_RECORD:
case NMF_UPGRADE_RESPONSE_RECORD:
case NMF_PREAMBLE_ACK_RECORD:
case NMF_PREAMBLE_END_RECORD:
case NMF_UPGRADE_RESPONSE_RECORD:
case NMF_PREAMBLE_ACK_RECORD:
case NMF_PREAMBLE_END_RECORD:
{ &hf_nmf_mode_value,
{ "Mode", "nmf.mode.value",
FT_UINT8, BASE_DEC, VALS(mode_values), 0, NULL, HFILL }},
{ &hf_nmf_mode_value,
{ "Mode", "nmf.mode.value",
FT_UINT8, BASE_DEC, VALS(mode_values), 0, NULL, HFILL }},
- { &hf_nmf_length,
- { "Length", "nmf.length",
- FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
+ { &hf_nmf_via_length,
+ { "Length", "nmf.via.length",
+ FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
};
proto_nmf = proto_register_protocol("NMF (.NET Message Framing Protocol)",
};
proto_nmf = proto_register_protocol("NMF (.NET Message Framing Protocol)",