Wireshark-dev: Re: [Wireshark-dev] How do I register a sub-dissector for HTTP2?

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Sat, 10 Jun 2017 16:28:07 -0700
On Sat, Jun 10, 2017 at 4:19 PM, Richard Sharpe
<realrichardsharpe@xxxxxxxxx> wrote:
> Let's say I want to register a sub-dissector for HTTP2 on port 50051,
> how do I do that?
>
> Maybe I should look at the code...

OK, so I looked at the code ... and here is what I found:

-------------------------------------
/* Data (0) */
static int
dissect_http2_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
*http2_tree,
                   guint offset, guint8 flags)
{
    guint16 padding;
    gint datalen;

    offset = dissect_frame_padding(tvb, &padding, http2_tree, offset, flags);
    datalen = tvb_reported_length_remaining(tvb, offset) - padding;
    proto_tree_add_item(http2_tree, hf_http2_data_data, tvb, offset,
datalen, ENC_NA);
    offset += datalen;

    proto_tree_add_item(http2_tree, hf_http2_data_padding, tvb,
offset, padding, ENC_NA);
    offset += padding;

    return offset;
}
------------------------------

Any protocol carried atop HTTP2 is going to be carried in DATA segments, ISTM.

Currently, there is no way to call a sub-dissector from the look of the code.

What seems to be needed is some way to say: if you find HTTP2 on PORT
X (perhaps because the user said PORT X is for HTTP) call this
dissector for DATA segments.

Does that sound reasonable?

There is a genuine, grumble, grumble reason for this question.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)