ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Iteration in dissectors?

From: Chris Maynard <Chris.Maynard@xxxxxxxxx>
Date: Mon, 23 Jan 2012 00:07:06 +0000 (UTC)
Tyson Key <tyson.key@...> writes:

OK, what about this:

    for (rwe_pos = 0; rwe_pos < tvb_get_guint8(tvb, 12); rwe_pos++) {
        proto_tree_add_item(felica_tree, hf_felica_block_nbr, tvb, 14 +
2*rwe_pos, 1, ENC_BIG_ENDIAN);
    }

... or if you want the 0x80 bytes highlighted, try this:

    for (rwe_pos = 0; rwe_pos < tvb_get_guint8(tvb, 12); rwe_pos++) {
        proto_tree_add_uint(felica_tree, hf_felica_block_nbr, tvb, 13 +
2*rwe_pos, 2, tvb_get_guint8(tvb, 14 + 2*rwe_pos);
    }

- Chris