dissect_kafka_stop_replica_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
                                   kafka_api_version_t api_version)
{
    proto_item *subti;
    proto_tree *subtree;
    gint32 controller_id;

    /* controller_id */
    controller_id = (gint32) tvb_get_ntohl(tvb, offset);
    proto_tree_add_item(tree, hf_kafka_controller_id, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

    /* controller_epoch */
    proto_tree_add_item(tree, hf_kafka_controller_epoch, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

    /* broker_epoch */
    if (api_version >= 1) {
        proto_tree_add_item(tree, hf_kafka_broker_epoch, tvb, offset, 8, ENC_BIG_ENDIAN);
        offset += 8;
    }

    /* delete_partitions */
    proto_tree_add_item(tree, hf_kafka_delete_partitions, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

    /* in V1 list of topic/partition was changed to list of topics with their partitions */
    if (api_version == 0) {
        /* [ungrouped_partitions] */
        subtree = proto_tree_add_subtree(tree, tvb, offset, -1,
                                         ett_kafka_partitions,
                                         &subti, "Ungrouped Partitions");
        offset = dissect_kafka_array(subtree, tvb, pinfo, offset, 0, api_version,
                                     &dissect_kafka_stop_replica_request_ungrouped_partition, NULL);
        proto_item_set_end(subti, tvb, offset);
    } else {
        /* [topics] */
        subtree = proto_tree_add_subtree(tree, tvb, offset, -1,
                                         ett_kafka_topics,
                                         &subti, "Topics");
        offset = dissect_kafka_array(subtree, tvb, pinfo, offset, api_version >= 2, api_version,
                                             &dissect_kafka_stop_replica_request_topic, NULL);
        proto_item_set_end(subti, tvb, offset);
    }

    if (api_version >= 2) {
        offset = dissect_kafka_tagged_fields(tvb, pinfo, tree, offset, 0);
    }

    col_append_fstr(pinfo->cinfo, COL_INFO, " (Controller-ID=%d)", controller_id);

    return offset;
}
dissect_kafka_stop_replica_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
                                   kafka_api_version_t api_version)
{
    proto_item *subti;
    proto_tree *subtree;
    gint32 controller_id;

     
    controller_id = (gint32) tvb_get_ntohl(tvb, offset);
    proto_tree_add_item(tree, hf_kafka_controller_id, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

     
    proto_tree_add_item(tree, hf_kafka_controller_epoch, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

     
    if (api_version >= 1) {
        proto_tree_add_item(tree, hf_kafka_broker_epoch, tvb, offset, 8, ENC_BIG_ENDIAN);
        offset += 8;
    }

     
    proto_tree_add_item(tree, hf_kafka_delete_partitions, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

     
    if (api_version == 0) {
         
        subtree = proto_tree_add_subtree(tree, tvb, offset, -1,
                                         ett_kafka_partitions,
                                         &subti, "Ungrouped Partitions");
        offset = dissect_kafka_array(subtree, tvb, pinfo, offset, 0, api_version,
                                     &dissect_kafka_stop_replica_request_ungrouped_partition, NULL);
        proto_item_set_end(subti, tvb, offset);
    } else {
         
        subtree = proto_tree_add_subtree(tree, tvb, offset, -1,
                                         ett_kafka_topics,
                                         &subti, "Topics");
        offset = dissect_kafka_array(subtree, tvb, pinfo, offset, api_version >= 2, api_version,
                                             &dissect_kafka_stop_replica_request_topic, NULL);
        proto_item_set_end(subti, tvb, offset);
    }

    if (api_version >= 2) {
        offset = dissect_kafka_tagged_fields(tvb, pinfo, tree, offset, 0);
    }

    col_append_fstr(pinfo->cinfo, COL_INFO, " (Controller-ID=%d)", controller_id);

    return offset;
}