static void
xmpp_conf_media(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_tree *media_tree;

    xmpp_attr_info attrs_info[] = {
        {"id", NULL, TRUE, TRUE, NULL, NULL},
        {"display-text", NULL, FALSE, TRUE, NULL, NULL},
        {"type", NULL, FALSE, TRUE, NULL, NULL},
        {"label", NULL, FALSE, TRUE, NULL, NULL},
        {"src-id", NULL, FALSE, TRUE, NULL, NULL},
        {"status", NULL, FALSE, TRUE, NULL, NULL},
    };

    media_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_media, NULL, "MEDIA");

    xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("type", "type", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("label", "label", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("src-id", "src-id", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("status", "status", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(media_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(media_tree, element, pinfo, tvb, NULL, 0);
}
static void
xmpp_conf_endpoint(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_tree *endpoint_tree;

    xmpp_attr_info attrs_info [] = {
        {"entity", NULL, FALSE, TRUE, NULL, NULL},
        {"state", NULL, FALSE, TRUE, NULL, NULL},
        {"display-text", NULL, FALSE, TRUE, NULL, NULL},
        {"status", NULL, FALSE, TRUE, NULL, NULL},
        {"joining-method", NULL, FALSE, TRUE, NULL, NULL},
        {"disconnection-method", NULL, FALSE, TRUE, NULL, NULL},
    };

    xmpp_elem_info elems_info [] = {
        /*{NAME,"referred",...,ONE},*/
        /*{NAME,"joining-info",...,ONE},*/
        /*{NAME,"disconnection-info",...,ONE},*/
        {NAME,"media", xmpp_conf_media, ONE},
        /*{NAME,"call-info",...,ONE},*/

    };

    endpoint_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_endpoint, NULL, "ENDPOINT");

    xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("status", "status", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("joining-method", "joining-method", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("disconnection-method", "disconnection-method", element, xmpp_transform_func_cdata);


    xmpp_display_attrs(endpoint_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(endpoint_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
}
static void
xmpp_conf_user(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_tree *user_tree;

    xmpp_attr_info attrs_info [] = {
        {"entity", NULL, FALSE, TRUE, NULL, NULL},
        {"state", NULL, FALSE, TRUE, NULL, NULL},
        {"display-text", NULL, FALSE, TRUE, NULL, NULL},
        {"cascaded-focus", NULL, FALSE, TRUE, NULL, NULL}
    };

    xmpp_elem_info elems_info [] = {
        /*{NAME, "associated-aors", xmpp_conf_assoc_aors, ONE},*/
        /*{NAME, "roles", xmpp_conf_roles, ONE},*/
        /*{NAME, "languages", xmpp_conf_langs, ONE},*/
        {NAME, "endpoint", xmpp_conf_endpoint, MANY},
    };

    user_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_user, NULL, "USERS");

    xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("cascaded-focus", "cascaded-focus", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(user_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(user_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
}
static void
xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_item *desc_item;
    proto_tree *desc_tree;

    xmpp_attr_info attrs_info [] = {
        {"subject", NULL, FALSE, TRUE, NULL, NULL},
        {"display-text", NULL, FALSE, FALSE, NULL, NULL},
        {"free-text", NULL, FALSE, FALSE, NULL, NULL},
        {"max-user-count", NULL, FALSE, FALSE, NULL, NULL},
    };

/*
    xmpp_elem_info elems_info [] = {
        {NAME, "keywords", xmpp_conf_desc_keywords, ONE},
        {NAME, "conf-uris", xmpp_conf_desc_conf_uris, ONE},
        {NAME, "service-uris", xmpp_conf_desc_serv_uris, ONE},
        {NAME, "available-media", xmpp_conf_desc_avil_media, ONE},
    };
*/

    desc_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "CONFERENCE DESCRIPTION");
    desc_tree = proto_item_add_subtree(desc_item, ett_xmpp_conf_desc);

    xmpp_change_elem_to_attrib("subject", "subject", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("free-text", "free-text", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("maximum-user-count", "max-user-count", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(desc_tree, element, pinfo, tvb, NULL,0);
}
static void
xmpp_jingle_file_transfer_file(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
{
    proto_item *file_item;
    proto_tree *file_tree;

    xmpp_attr_info attrs_info[] = {
        {"name", -1, FALSE, TRUE, NULL, NULL},
        {"size", -1, FALSE, TRUE, NULL, NULL},
        {"date", -1, FALSE, TRUE, NULL, NULL}
    };

    xmpp_elem_info elems_info[] = {
        {NAME, "hashes", xmpp_hashes, ONE}
    };

    file_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "FILE");
    file_tree = proto_item_add_subtree(file_item, ett_xmpp_jingle_file_transfer_file);

    xmpp_change_elem_to_attrib("name", "name", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("size", "size", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("date", "date", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(file_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(file_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
}
/*jabber:x:data*/
void
xmpp_x_data(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
{
    proto_item *x_item;
    proto_tree *x_tree;

    static const gchar *type_enums[] = {"cancel", "form", "result", "submit"};
    xmpp_array_t *type_array = xmpp_ep_init_array_t(type_enums, array_length(type_enums));

    xmpp_attr_info attrs_info[] = {
        {"xmlns", hf_xmpp_xmlns, TRUE, FALSE, NULL, NULL},
        {"type", -1, TRUE, TRUE, xmpp_val_enum_list, type_array},
        {"TITLE", -1, FALSE, TRUE, NULL, NULL}
    };

    xmpp_elem_info elems_info[] = {
        {NAME, "instructions", xmpp_x_data_instr, MANY},
        {NAME, "field", xmpp_x_data_field, MANY},
    };
    /*TODO reported, item*/

    x_item = proto_tree_add_item(tree, hf_xmpp_x_data, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
    x_tree = proto_item_add_subtree(x_item, ett_xmpp_x_data);

    xmpp_change_elem_to_attrib("title", "TITLE", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(x_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
}
static void
xmpp_conf_state(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_tree *state_tree;

    xmpp_attr_info attrs_info [] = {
        {"user-count", NULL, FALSE, TRUE, NULL, NULL},
        {"active", NULL, FALSE, TRUE, NULL, NULL},
        {"locked", NULL, FALSE, TRUE, NULL, NULL}
    };

    state_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length,
                                        ett_xmpp_conf_state, NULL, "CONFERENCE STATE");

    xmpp_change_elem_to_attrib("user-count", "user-count", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("active", "active", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("locked", "locked", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(state_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
    xmpp_display_elems(state_tree, element, pinfo, tvb, NULL,0);

}
void
xmpp_iq_bind(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
{
    proto_item *bind_item;
    proto_tree *bind_tree;

    xmpp_attr_info attrs_info[] = {
        {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL},
        {"resource", hf_xmpp_iq_bind_resource, FALSE, TRUE, NULL, NULL},
        {"jid", hf_xmpp_iq_bind_jid, FALSE, TRUE, NULL, NULL}
    };

    col_append_fstr(pinfo->cinfo, COL_INFO, "BIND ");

    bind_item = proto_tree_add_item(tree, hf_xmpp_iq_bind, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
    bind_tree = proto_item_add_subtree(bind_item, ett_xmpp_iq_bind);

    xmpp_change_elem_to_attrib("resource", "resource", element, xmpp_transform_func_cdata);
    xmpp_change_elem_to_attrib("jid", "jid", element, xmpp_transform_func_cdata);

    xmpp_display_attrs(bind_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));

    xmpp_unknown(bind_tree, tvb, pinfo, element);
}