Wireshark-dev: Re: [Wireshark-dev] Handling weight for PRIORITY and HEADERS frames for HTTP2 wi
From: Alexis La Goutte <[email protected]>
Date: Fri, 22 Dec 2017 16:04:47 +0100
Hi Alexander,

No problem, you can push a fix with this enhance !


On Fri, Dec 22, 2017 at 1:19 AM, Alexander Gryanko <[email protected]> wrote:

When I try to dissect HTTP2 messages, I found one confusing thing. Here is a definition of fields:

{ &hf_http2_weight,
    { "Weight", "http2.headers.weight",
       FT_UINT8, BASE_DEC, NULL, 0x0,
      "An 8-bit weight for the identified priority", HFILL }
{ &hf_http2_weight_real,
    { "Weight real", "http2.headers.weight_real",
       FT_UINT8, BASE_DEC, NULL, 0x0,
      "Real Weight value (Add one to value)", HFILL }

Function to fill this fields:

/* helper function to get the priority dependence for the frames that feature them:
static guint
dissect_frame_prio(tvbuff_t *tvb, proto_tree *http2_tree, guint offset, guint8 flags)
    proto_tree *ti;
    guint8 weight;

    if(flags & HTTP2_FLAGS_PRIORITY)
        proto_tree_add_item(http2_tree, hf_http2_excl_dependency, tvb, offset, 4, ENC_NA);
        proto_tree_add_item(http2_tree, hf_http2_stream_dependency, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;
        proto_tree_add_item(http2_tree, hf_http2_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
        weight = tvb_get_guint8(tvb, offset);
        /* 6.2: Weight:  An 8-bit weight for the stream; Add one to the value to obtain a weight between 1 and 256 */
        ti = proto_tree_add_uint(http2_tree, hf_http2_weight_real, tvb, offset, 1, weight+1);

    return offset;

So, when we try to access weights for PRIORITY, we need to create a field with Field.new("http2.headers.weight"). Maybe it will be better to split weights for PRIORITY and HEADERS to two different fields http2.priority.weight* and http2.headers.weight*?

Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]wireshark.org?subject=unsubscribe