dissect_gquic_q046(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        void *data _U_)
{
    proto_item *ti, *ti_firstbyte; /*, *expert_ti*/
    proto_tree *gquic_tree, *firstbyte_tree;
    guint offset = 0;
    guint8 first_byte, len_cid, cil, len_pkn;
    guint64 cid = 0, pkn = 0;
    conversation_t  *conv;
    gquic_info_data_t  *gquic_info;

    /* get conversation, create if necessary*/
    conv = find_or_create_conversation(pinfo);

    /* get associated state information, create if necessary */
    gquic_info = (gquic_info_data_t *)conversation_get_proto_data(conv, proto_gquic);

    if (!gquic_info) {
        gquic_info = wmem_new(wmem_file_scope(), gquic_info_data_t);
        gquic_info->version = 0;
        gquic_info->encoding = ENC_BIG_ENDIAN;
        gquic_info->version_valid = TRUE;
        gquic_info->server_port = 443;
        conversation_add_proto_data(conv, proto_gquic, gquic_info);
    }

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "GQUIC");

    ti = proto_tree_add_item(tree, proto_gquic, tvb, 0, -1, ENC_NA);
    gquic_tree = proto_item_add_subtree(ti, ett_gquic);

    /* First byte */
    first_byte = tvb_get_guint8(tvb, offset);
    len_pkn = (first_byte & 0x03) + 1;

    ti_firstbyte = proto_tree_add_item(gquic_tree, hf_gquic_puflags, tvb, offset, 1, ENC_NA);
    firstbyte_tree = proto_item_add_subtree(ti_firstbyte, ett_gquic_puflags);
    proto_tree_add_item(firstbyte_tree, hf_gquic_header_form, tvb, offset, 1, ENC_NA);
    proto_tree_add_item(firstbyte_tree, hf_gquic_fixed_bit, tvb, offset, 1, ENC_NA);

    if((first_byte & PUFLAGS_MPTH) && (first_byte & PUFLAGS_RSV)) {
        /* Long Header. We handle only Q046 */

	gquic_info->version_valid = ws_strtou8(tvb_get_string_enc(wmem_packet_scope(), tvb,
            offset + 2, 3, ENC_ASCII), NULL, &gquic_info->version);
        if (!gquic_info->version_valid) {
            expert_add_info(pinfo, gquic_tree, &ei_gquic_version_invalid);
        }

	cil = tvb_get_guint8(tvb, offset + 5);
	if(pinfo->srcport == gquic_info->server_port) { /* Server to client */
	    len_cid = (cil & 0x0F) + 3;
	} else {
	    len_cid = ((cil & 0xF0) >> 4) + 3;
	}
	if (len_cid != 8) {
            expert_add_info(pinfo, gquic_tree, &ei_gquic_invalid_parameter);
        }

        proto_tree_add_item(firstbyte_tree, hf_gquic_long_packet_type, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(firstbyte_tree, hf_gquic_long_reserved, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(firstbyte_tree, hf_gquic_packet_number_length, tvb, offset, 1, ENC_NA);
        offset += 1;

        proto_tree_add_item(gquic_tree, hf_gquic_version, tvb, offset, 4, ENC_ASCII|ENC_NA);
        offset += 4;

        proto_tree_add_item(gquic_tree, hf_gquic_dcil, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(gquic_tree, hf_gquic_scil, tvb, offset, 1, ENC_NA);
        offset += 1;

        /* CID */
        if (len_cid > 0) {
            cid = tvb_get_guint64(tvb, offset, gquic_info->encoding);
            proto_tree_add_item(gquic_tree, hf_gquic_cid, tvb, offset, len_cid, gquic_info->encoding);
        }
        offset += len_cid;

    } else {
        /* Short Header. We handle only Q046 */

        proto_tree_add_uint(firstbyte_tree, hf_gquic_packet_number_length, tvb, offset, 1, first_byte);

        offset += 1;

        if(pinfo->srcport == gquic_info->server_port) { /* Server to client */
            len_cid = 0;
        } else {
            len_cid = 8;
            cid = tvb_get_guint64(tvb, offset, gquic_info->encoding);
            proto_tree_add_item(gquic_tree, hf_gquic_cid, tvb, offset, len_cid, gquic_info->encoding);
        }
        offset += len_cid;
    }

    /* Packet Number */
    proto_tree_add_item_ret_uint64(gquic_tree, hf_gquic_packet_number, tvb, offset, len_pkn, gquic_info->encoding, &pkn);
    offset += len_pkn;

    /* Unencrypt Message (Handshake or Connection Close...) */
    if (is_gquic_unencrypt(tvb, pinfo, offset, len_pkn, gquic_info) || g_gquic_debug){
        offset = dissect_gquic_unencrypt(tvb, pinfo, gquic_tree, offset, len_pkn, gquic_info);
    }else {     /* Payload... (encrypted... TODO FIX !) */
        col_add_str(pinfo->cinfo, COL_INFO, "Payload (Encrypted)");
        proto_tree_add_item(gquic_tree, hf_gquic_payload, tvb, offset, -1, ENC_NA);

    }

    col_append_fstr(pinfo->cinfo, COL_INFO, ", PKN: %" G_GINT64_MODIFIER "u", pkn);

    if(cid){
        col_append_fstr(pinfo->cinfo, COL_INFO, ", CID: %" G_GINT64_MODIFIER "u", cid);
    }

    return offset;
}
dissect_gquic_q046(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        void *data _U_)
{
    proto_item *ti, *ti_firstbyte;  
    proto_tree *gquic_tree, *firstbyte_tree;
    guint offset = 0;
    guint8 first_byte, len_cid, cil, len_pkn;
    guint64 cid = 0, pkn = 0;
    conversation_t  *conv;
    gquic_info_data_t  *gquic_info;

     
    conv = find_or_create_conversation(pinfo);

     
    gquic_info = (gquic_info_data_t *)conversation_get_proto_data(conv, proto_gquic);

    if (!gquic_info) {
        gquic_info = wmem_new(wmem_file_scope(), gquic_info_data_t);
        gquic_info->version = 0;
        gquic_info->encoding = ENC_BIG_ENDIAN;
        gquic_info->version_valid = TRUE;
        gquic_info->server_port = 443;
        conversation_add_proto_data(conv, proto_gquic, gquic_info);
    }

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "GQUIC");

    ti = proto_tree_add_item(tree, proto_gquic, tvb, 0, -1, ENC_NA);
    gquic_tree = proto_item_add_subtree(ti, ett_gquic);

     
    first_byte = tvb_get_guint8(tvb, offset);
    len_pkn = (first_byte & 0x03) + 1;

    ti_firstbyte = proto_tree_add_item(gquic_tree, hf_gquic_puflags, tvb, offset, 1, ENC_NA);
    firstbyte_tree = proto_item_add_subtree(ti_firstbyte, ett_gquic_puflags);
    proto_tree_add_item(firstbyte_tree, hf_gquic_header_form, tvb, offset, 1, ENC_NA);
    proto_tree_add_item(firstbyte_tree, hf_gquic_fixed_bit, tvb, offset, 1, ENC_NA);

    if((first_byte & PUFLAGS_MPTH) && (first_byte & PUFLAGS_RSV)) {
         

	gquic_info->version_valid = ws_strtou8(tvb_get_string_enc(wmem_packet_scope(), tvb,
            offset + 2, 3, ENC_ASCII), NULL, &gquic_info->version);
        if (!gquic_info->version_valid) {
            expert_add_info(pinfo, gquic_tree, &ei_gquic_version_invalid);
        }

	cil = tvb_get_guint8(tvb, offset + 5);
	if(pinfo->srcport == gquic_info->server_port) {  
	    len_cid = (cil & 0x0F) + 3;
	} else {
	    len_cid = ((cil & 0xF0) >> 4) + 3;
	}
	if (len_cid != 8) {
            expert_add_info(pinfo, gquic_tree, &ei_gquic_invalid_parameter);
        }

        proto_tree_add_item(firstbyte_tree, hf_gquic_long_packet_type, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(firstbyte_tree, hf_gquic_long_reserved, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(firstbyte_tree, hf_gquic_packet_number_length, tvb, offset, 1, ENC_NA);
        offset += 1;

        proto_tree_add_item(gquic_tree, hf_gquic_version, tvb, offset, 4, ENC_ASCII|ENC_NA);
        offset += 4;

        proto_tree_add_item(gquic_tree, hf_gquic_dcil, tvb, offset, 1, ENC_NA);
        proto_tree_add_item(gquic_tree, hf_gquic_scil, tvb, offset, 1, ENC_NA);
        offset += 1;

         
        if (len_cid > 0) {
            cid = tvb_get_guint64(tvb, offset, gquic_info->encoding);
            proto_tree_add_item(gquic_tree, hf_gquic_cid, tvb, offset, len_cid, gquic_info->encoding);
        }
        offset += len_cid;

    } else {
         

        proto_tree_add_uint(firstbyte_tree, hf_gquic_packet_number_length, tvb, offset, 1, first_byte);

        offset += 1;

        if(pinfo->srcport == gquic_info->server_port) {  
            len_cid = 0;
        } else {
            len_cid = 8;
            cid = tvb_get_guint64(tvb, offset, gquic_info->encoding);
            proto_tree_add_item(gquic_tree, hf_gquic_cid, tvb, offset, len_cid, gquic_info->encoding);
        }
        offset += len_cid;
    }

     
    proto_tree_add_item_ret_uint64(gquic_tree, hf_gquic_packet_number, tvb, offset, len_pkn, gquic_info->encoding, &pkn);
    offset += len_pkn;

     
    if (is_gquic_unencrypt(tvb, pinfo, offset, len_pkn, gquic_info) || g_gquic_debug){
        offset = dissect_gquic_unencrypt(tvb, pinfo, gquic_tree, offset, len_pkn, gquic_info);
    }else {      
        col_add_str(pinfo->cinfo, COL_INFO, "Payload (Encrypted)");
        proto_tree_add_item(gquic_tree, hf_gquic_payload, tvb, offset, -1, ENC_NA);

    }

    col_append_fstr(pinfo->cinfo, COL_INFO, ", PKN: %" G_GINT64_MODIFIER "u", pkn);

    if(cid){
        col_append_fstr(pinfo->cinfo, COL_INFO, ", CID: %" G_GINT64_MODIFIER "u", cid);
    }

    return offset;
}