static void xmpp_roster_item(proto_tree *tree, tvbuff_t *tvb, packet_info* pinfo, xmpp_element_t *element) { proto_item *item_item; proto_tree *item_tree; static const gchar *ask_enums[] = {"subscribe"}; static const gchar *subscription_enums[] = {"both", "from", "none", "remove", "to"}; xmpp_array_t *ask_enums_array = xmpp_ep_init_array_t(ask_enums,array_length(ask_enums)); xmpp_array_t *subscription_array = xmpp_ep_init_array_t(subscription_enums,array_length(subscription_enums)); xmpp_attr_info attrs_info[] = { {"jid", hf_xmpp_query_item_jid, TRUE, TRUE, NULL, NULL}, {"name", hf_xmpp_query_item_name, FALSE, TRUE, NULL, NULL}, {"ask", hf_xmpp_query_item_ask, FALSE, TRUE, xmpp_val_enum_list, ask_enums_array}, {"approved", hf_xmpp_query_item_approved, FALSE, TRUE, NULL, NULL}, {"subscription", hf_xmpp_query_item_subscription, FALSE, TRUE, xmpp_val_enum_list, subscription_array}, }; xmpp_element_t *group; item_item = proto_tree_add_item(tree, hf_xmpp_query_item, tvb, element->offset, element->length, ENC_BIG_ENDIAN); item_tree = proto_item_add_subtree(item_item, ett_xmpp_query_item); xmpp_display_attrs(item_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); while((group = xmpp_steal_element_by_name(element,"group"))!=NULL) { proto_tree_add_string(item_tree, hf_xmpp_query_item_group, tvb, group->offset, group->length, xmpp_elem_cdata(group)); } xmpp_unknown(item_tree, tvb, pinfo, element); }
void xmpp_presence(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet) { proto_item *presence_item; proto_tree *presence_tree; static const gchar *type_enums[] = {"error", "probe", "subscribe", "subscribed", "unavailable", "unsubscribe", "unsubscribed"}; xmpp_array_t *type_array = xmpp_ep_init_array_t(type_enums, array_length(type_enums)); static const gchar *show_enums[] = {"away", "chat", "dnd", "xa"}; xmpp_array_t *show_array = xmpp_ep_init_array_t(show_enums, array_length(show_enums)); xmpp_attr_info attrs_info[] = { {"from", hf_xmpp_from, FALSE, FALSE, NULL, NULL}, {"id", hf_xmpp_id, FALSE, TRUE, NULL, NULL}, {"to", hf_xmpp_to, FALSE, FALSE, NULL, NULL}, {"type", hf_xmpp_type, FALSE, TRUE, xmpp_val_enum_list, type_array}, {"xml:lang",-1, FALSE, FALSE, NULL,NULL}, {"show", hf_xmpp_presence_show, FALSE, TRUE, xmpp_val_enum_list, show_array}, {"priority", -1, FALSE, FALSE, NULL, NULL} }; xmpp_elem_info elems_info[] = { {NAME, "status", xmpp_presence_status, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("c","xmlns","http://jabber.org/protocol/caps"), xmpp_presence_caps, ONE}, {NAME, "delay", xmpp_delay, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns", "jabber:x:delay"), xmpp_delay, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns", "vcard-temp:x:update"), xmpp_vcard_x_update, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns","http://jabber.org/protocol/muc"), xmpp_muc_x, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns","http://jabber.org/protocol/muc#user"), xmpp_muc_user_x, ONE}, {NAME, "error", xmpp_error, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("query", "xmlns","jabber:iq:last"), xmpp_last_query, ONE} }; xmpp_element_t *show, *priority; col_clear(pinfo->cinfo, COL_INFO); col_append_fstr(pinfo->cinfo, COL_INFO, "PRESENCE "); presence_item = proto_tree_add_item(tree, hf_xmpp_presence, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); presence_tree = proto_item_add_subtree(presence_item, ett_xmpp_presence); if((show = xmpp_steal_element_by_name(packet, "show"))!=NULL) { xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(show->data?show->data->value:"",show->offset, show->length); g_hash_table_insert(packet->attrs, (gpointer)"show", fake_show); } if((priority = xmpp_steal_element_by_name(packet, "priority"))!=NULL) { xmpp_attr_t *fake_priority = xmpp_ep_init_attr_t(priority->data?priority->data->value:"",priority->offset, priority->length); g_hash_table_insert(packet->attrs, (gpointer)"priority", fake_priority); } xmpp_display_attrs(presence_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(presence_tree, packet, 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)); }
void xmpp_conference_info(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *cinfo_item; proto_tree *cinfo_tree; static const gchar *state_enums[] = {"full", "partial", "deleted"}; xmpp_array_t *state_array = xmpp_ep_init_array_t(state_enums, array_length(state_enums)); xmpp_attr_info attrs_info [] = { {"xmlns", &hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}, {"entity", NULL, TRUE, TRUE, NULL, NULL}, {"state", NULL, FALSE, TRUE, xmpp_val_enum_list, state_array}, {"version", NULL, FALSE, TRUE, NULL, NULL}, {"sid", &hf_xmpp_conf_info_sid, FALSE, TRUE, NULL, NULL} }; xmpp_elem_info elems_info [] = { {NAME, "conference-description", xmpp_conf_desc, ONE}, {NAME, "conference-state", xmpp_conf_state, ONE}, /*{NAME, "host-info", xmpp_conf_host_info, ONE},*/ {NAME, "users", xmpp_conf_users, ONE}, /*{NAME, "sidebars-by-ref", xmpp_conf_sidebars_by_ref, ONE},*/ /*{NAME, "sidebars-by-val", xmpp_conf_sidebars_by_val, ONE},*/ }; col_append_str(pinfo->cinfo, COL_INFO, "CONFERENC-INFO "); cinfo_item = proto_tree_add_item(tree, hf_xmpp_conf_info, tvb, element->offset, element->length, ENC_BIG_ENDIAN); cinfo_tree = proto_item_add_subtree(cinfo_item, ett_xmpp_conf_info); xmpp_display_attrs(cinfo_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(cinfo_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); }
static void xmpp_jingle_cont_trans_raw_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *cand_item; proto_tree *cand_tree; const gchar *type_enums[] = {"host", "prflx", "relay", "srflx"}; xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(type_enums,array_length(type_enums)); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, FALSE, FALSE, NULL, NULL}, {"component", -1, TRUE, FALSE, NULL, NULL}, {"generation", -1, TRUE, FALSE, NULL, NULL}, {"id", -1, TRUE, FALSE, NULL, NULL}, {"ip", -1, TRUE, TRUE, NULL, NULL}, {"port", -1, TRUE, TRUE, NULL, NULL}, {"type", -1, TRUE, TRUE, xmpp_val_enum_list, type_enums_array} }; cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0); }
static void xmpp_jingle_cont_trans_ice_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *cand_item; proto_tree *cand_tree; const gchar *type_enums[] = {"host", "prflx", "relay", "srflx"}; xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(type_enums,array_length(type_enums)); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, FALSE, FALSE, NULL, NULL}, {"component", -1, TRUE, FALSE, NULL, NULL}, {"foundation", -1, TRUE, FALSE, NULL, NULL}, {"generation", -1, TRUE, FALSE, NULL, NULL}, {"id", -1, FALSE, FALSE, NULL, NULL}, /*in schemas id is marked as required, but in jitsi logs it doesn't appear*/ {"ip", -1, TRUE, TRUE, NULL, NULL}, {"network", -1, TRUE, FALSE, NULL, NULL}, {"port", -1, TRUE, FALSE, NULL, NULL}, {"priority", -1, TRUE, TRUE, NULL, NULL}, {"protocol", -1, TRUE, TRUE, NULL, NULL}, {"rel-addr", -1, FALSE, FALSE, NULL, NULL}, {"rel-port", -1, FALSE, FALSE, NULL, NULL}, {"type", -1, TRUE, TRUE, xmpp_val_enum_list, type_enums_array} }; cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(cand_tree, tvb, pinfo, element); }
/*urn:xmpp:jingle:apps:rtp:rtp-hdrext:0*/ static void xmpp_jingle_cont_desc_rtp_hdrext(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) { proto_item *rtp_hdr_item; proto_tree *rtp_hdr_tree; const gchar *senders[] = {"both", "initiator", "responder"}; xmpp_array_t *senders_enums = xmpp_ep_init_array_t(senders, 3); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, FALSE, FALSE, NULL, NULL}, {"id", -1, TRUE, FALSE, NULL, NULL}, {"uri", -1, TRUE, TRUE, NULL, NULL}, {"senders", -1, FALSE, TRUE, xmpp_val_enum_list, senders_enums}, {"parameter", -1, FALSE, TRUE, NULL, NULL} }; xmpp_element_t *parameter; rtp_hdr_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_rtp_hdr, tvb, element->offset, element->length, ENC_BIG_ENDIAN); rtp_hdr_tree = proto_item_add_subtree(rtp_hdr_item, ett_xmpp_jingle_cont_desc_rtp_hdr); if((parameter = xmpp_steal_element_by_name(element, "parameter"))!=NULL) { xmpp_attr_t *name = xmpp_get_attr(element, "name"); xmpp_attr_t *fake_attr = xmpp_ep_init_attr_t(name?name->value:"", parameter->offset, parameter->length); g_hash_table_insert(element->attrs, "parameter", fake_attr); } xmpp_display_attrs(rtp_hdr_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(rtp_hdr_tree, tvb, pinfo, element); }
/*XEP-0166: Jingle urn:xmpp:jingle:1*/ void xmpp_jingle(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *jingle_item; proto_tree *jingle_tree; const gchar *rtp_info_msgs[] = {"active", "hold", "mute", "ringing", "unhold", "unmute"}; const gchar *action_enums[] = {"content-accept","content-add", "content-modify", "content-modify", "content-remove", "description-info", "security-info", "session-accept", "session-info", "session-initiate", "session-terminate", "transport-accept", "transport-info", "transport-reject", "transport-replace" }; xmpp_array_t *action_array = xmpp_ep_init_array_t(action_enums,array_length(action_enums)); xmpp_array_t *rtp_info_array = xmpp_ep_init_array_t(rtp_info_msgs, array_length(rtp_info_msgs)); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, FALSE, NULL, NULL}, {"action", hf_xmpp_jingle_action, TRUE, TRUE, xmpp_val_enum_list, action_array}, {"sid", hf_xmpp_jingle_sid, TRUE, FALSE, NULL, NULL}, {"initiator", hf_xmpp_jingle_initiator, FALSE, FALSE, NULL, NULL}, {"responder", hf_xmpp_jingle_responder, FALSE, FALSE, NULL, NULL} }; xmpp_elem_info elems_info [] = { {NAME, "content", xmpp_jingle_content, MANY}, {NAME, "reason", xmpp_jingle_reason, MANY}, {NAMES, rtp_info_array, xmpp_jingle_rtp_info, ONE}, {NAME, "conference-info", xmpp_conferece_info_advert, ONE} }; xmpp_attr_t *action = xmpp_get_attr(element,"action"); col_append_fstr(pinfo->cinfo, COL_INFO, "JINGLE(%s) ", action?action->value:""); jingle_item = proto_tree_add_item(tree, hf_xmpp_jingle, tvb, element->offset, element->length, ENC_BIG_ENDIAN); jingle_tree = proto_item_add_subtree(jingle_item, ett_xmpp_jingle); xmpp_display_attrs(jingle_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(jingle_item, element, pinfo, tvb, elems_info, array_length(elems_info)); }
void xmpp_bytestreams_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *query_item; proto_tree *query_tree; static const gchar *mode_enums[] = {"tcp", "udp"}; xmpp_array_t *mode_array = xmpp_ep_init_array_t(mode_enums, array_length(mode_enums)); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}, {"sid", -1, FALSE, TRUE, NULL, NULL}, {"mode", -1, FALSE, TRUE, xmpp_val_enum_list, mode_array}, {"dstaddr", -1, FALSE, TRUE, NULL, NULL} }; xmpp_element_t *streamhost, *streamhost_used, *activate, *udpsuccess; col_append_fstr(pinfo->cinfo, COL_INFO, "QUERY(bytestreams) "); query_item = proto_tree_add_item(tree, hf_xmpp_query, tvb, element->offset, element->length, ENC_BIG_ENDIAN); query_tree = proto_item_add_subtree(query_item, ett_xmpp_query); xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); while((streamhost = xmpp_steal_element_by_name(element, "streamhost")) != NULL) { xmpp_bytestreams_streamhost(query_tree, tvb, pinfo, streamhost); } if((streamhost_used = xmpp_steal_element_by_name(element, "streamhost-used")) != NULL) { xmpp_bytestreams_streamhost_used(query_tree, tvb, pinfo, streamhost_used); } if((activate = xmpp_steal_element_by_name(element, "activate")) != NULL) { xmpp_bytestreams_activate(query_tree, tvb, pinfo, activate); } if((udpsuccess = xmpp_steal_element_by_name(element, "udpsuccess")) != NULL) { xmpp_bytestreams_udpsuccess(query_tree, tvb, pinfo, udpsuccess); } xmpp_unknown(query_tree, tvb, pinfo, element); }
static void xmpp_x_data_field(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *field_item; proto_tree *field_tree; static const gchar *type_enums[] = {"boolean", "fixed", "hidden", "jid-multi", "jid-single", "list-multi", "list-single", "text-multi", "text-single", "text-private" }; xmpp_array_t *type_array = xmpp_ep_init_array_t(type_enums, array_length(type_enums)); xmpp_attr_info attrs_info[] = { {"label", -1, FALSE, TRUE, NULL, NULL}, {"type", -1, FALSE, TRUE, xmpp_val_enum_list, type_array}, {"var", -1, FALSE, TRUE, NULL, NULL} }; xmpp_element_t /**desc, *required,*/ *value, *option; field_item = proto_tree_add_item(tree, hf_xmpp_x_data_field, tvb, element->offset, element->length, ENC_BIG_ENDIAN); field_tree = proto_item_add_subtree(field_item, ett_xmpp_x_data_field); xmpp_display_attrs(field_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); while((option = xmpp_steal_element_by_name(element, "option"))!=NULL) { xmpp_x_data_field_option(field_tree, tvb, pinfo, option); } while((value = xmpp_steal_element_by_name(element, "value"))!=NULL) { xmpp_x_data_field_value(field_tree, tvb, pinfo, value); } xmpp_unknown(field_item, tvb, pinfo, element); }
/*urn:xmpp:jingle:apps:rtp:info:1*/ static void xmpp_jingle_rtp_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *rtp_info_item; proto_tree *rtp_info_tree; const gchar *creator[] = {"initiator","responder"}; xmpp_array_t *creator_enums = xmpp_ep_init_array_t(creator, array_length(creator)); xmpp_attr_info mute_attrs_info[] = { {"creator", -1, TRUE, TRUE, xmpp_val_enum_list, creator_enums}, {"name", -1, TRUE, TRUE, NULL, NULL} }; rtp_info_item = proto_tree_add_string(tree, hf_xmpp_jingle_rtp_info, tvb, element->offset, element->length, element->name); rtp_info_tree = proto_item_add_subtree(rtp_info_item, ett_xmpp_jingle_rtp_info); if(strcmp("mute", element->name) == 0 || strcmp("unmute", element->name) == 0) xmpp_display_attrs(rtp_info_tree, element, pinfo, tvb, mute_attrs_info, array_length(mute_attrs_info)); xmpp_unknown(rtp_info_tree, tvb, pinfo, element); }
static void xmpp_jingle_content(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *content_item; proto_tree *content_tree; const gchar *creator_enums[] = {"initiator","responder"}; xmpp_array_t *creator_enums_array = xmpp_ep_init_array_t(creator_enums,array_length(creator_enums)); xmpp_attr_info attrs_info[] = { {"creator", hf_xmpp_jingle_content_creator, TRUE, FALSE, xmpp_val_enum_list, creator_enums_array}, {"name", hf_xmpp_jingle_content_name, TRUE, TRUE, NULL, NULL}, {"disposition", hf_xmpp_jingle_content_disposition, FALSE, FALSE, NULL, NULL}, {"senders", hf_xmpp_jingle_content_senders, FALSE, FALSE, NULL, NULL} }; xmpp_elem_info elems_info [] = { {NAME_AND_ATTR, xmpp_name_attr_struct("description", "xmlns", "urn:xmpp:jingle:apps:rtp:1"), xmpp_jingle_content_description_rtp, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("description", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_desc, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("transport", "xmlns", "urn:xmpp:jingle:transports:ice-udp:1"), xmpp_jingle_cont_trans_ice, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("transport", "xmlns", "urn:xmpp:jingle:transports:raw-udp:1"), xmpp_jingle_cont_trans_raw, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("transport", "xmlns", "urn:xmpp:jingle:transports:s5b:1"), xmpp_jingle_cont_trans_s5b, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("transport", "xmlns", "urn:xmpp:jingle:transports:ibb:1"), xmpp_jingle_cont_trans_ibb, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("transport", "xmlns", "http://www.google.com/transport/p2p"), xmpp_gtalk_transport_p2p, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("received", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_received, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("abort", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_abort, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("checksum", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_checksum, MANY}, {NAME_AND_ATTR, xmpp_name_attr_struct("inputevt", "xmlns","http://jitsi.org/protocol/inputevt"), xmpp_jitsi_inputevt, ONE}, }; content_item = proto_tree_add_item(tree, hf_xmpp_jingle_content, tvb, element->offset, element->length, ENC_BIG_ENDIAN); content_tree = proto_item_add_subtree(content_item, ett_xmpp_jingle_content); xmpp_display_attrs(content_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(content_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); }
static void xmpp_jingle_cont_trans_s5b_candidate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *cand_item; proto_tree *cand_tree; const gchar * type_enums[] = {"assisted", "direct", "proxy", "tunnel"}; xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(type_enums, array_length(type_enums)); xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, FALSE, FALSE, NULL, NULL}, {"cid", -1, TRUE, TRUE, NULL, NULL}, {"jid", -1, TRUE, TRUE, NULL, NULL}, {"port", -1, FALSE, TRUE, NULL, NULL}, {"priority", -1, TRUE, TRUE, NULL, NULL}, {"type", -1, TRUE, TRUE, xmpp_val_enum_list, type_enums_array} }; cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0); }
void xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet) { proto_item *message_item; proto_tree *message_tree; static const gchar *type_enums[] = {"chat", "error", "groupchat", "headline", "normal"}; xmpp_array_t *type_array = xmpp_ep_init_array_t(type_enums, array_length(type_enums)); xmpp_attr_info attrs_info[] = { {"from", &hf_xmpp_from, FALSE, FALSE, NULL, NULL}, {"id", &hf_xmpp_id, FALSE, TRUE, NULL, NULL}, {"to", &hf_xmpp_to, FALSE, FALSE, NULL, NULL}, {"type", &hf_xmpp_type, FALSE, TRUE, xmpp_val_enum_list, type_array}, {"xml:lang", NULL, FALSE, FALSE, NULL,NULL}, {"chatstate", &hf_xmpp_message_chatstate, FALSE, TRUE, NULL, NULL} }; xmpp_elem_info elems_info [] = { {NAME_AND_ATTR, xmpp_name_attr_struct("data", "xmlns", "http://jabber.org/protocol/ibb"), xmpp_ibb_data, ONE}, {NAME, "thread", xmpp_message_thread, ONE}, {NAME, "body", xmpp_message_body, MANY}, {NAME, "subject", xmpp_message_subject, MANY}, {NAME, "delay", xmpp_delay, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns","jabber:x:event"), xmpp_x_event, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns","http://jabber.org/protocol/muc#user"), xmpp_muc_user_x, ONE}, {NAME_AND_ATTR, xmpp_name_attr_struct("x","xmlns","google:nosave"), xmpp_gtalk_nosave_x, ONE}, {NAME, "error", xmpp_error, ONE} }; xmpp_element_t *chatstate; xmpp_attr_t *id; conversation_t *conversation; xmpp_conv_info_t *xmpp_info; col_set_str(pinfo->cinfo, COL_INFO, "MESSAGE "); id = xmpp_get_attr(packet, "id"); conversation = find_or_create_conversation(pinfo); xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp); message_item = proto_tree_add_item(tree, hf_xmpp_message, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); message_tree = proto_item_add_subtree(message_item, ett_xmpp_message); if((chatstate = xmpp_steal_element_by_attr(packet, "xmlns", "http://jabber.org/protocol/chatstates"))!=NULL) { xmpp_attr_t *fake_chatstate_attr = xmpp_ep_init_attr_t(chatstate->name, chatstate->offset, chatstate->length); g_hash_table_insert(packet->attrs, (gpointer)"chatstate", fake_chatstate_attr); } xmpp_display_attrs(message_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(message_tree, packet, pinfo, tvb, elems_info, array_length(elems_info)); /*Displays data about IBB session*/ if(xmpp_info && id) { gchar *ibb_sid; ibb_sid = (gchar *)wmem_tree_lookup_string(xmpp_info->ibb_sessions, id->value, WMEM_TREE_STRING_NOCASE); if (ibb_sid) { proto_item *it = proto_tree_add_string(tree, hf_xmpp_ibb, tvb, 0, 0, ibb_sid); PROTO_ITEM_SET_GENERATED(it); } } }