void xmpp_failure(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet) { proto_item *fail_item; proto_tree *fail_tree; xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}, {"condition", -1, FALSE, TRUE, NULL, NULL} }; const gchar *fail_names[] = {"aborted","account-disabled", "credentials-expired", "encryption-required", "incorrect-encoding", "invalid-authzid", "invalid-mechanism", "malformed-request", "mechanism-too-weak", "not-authorized", "temporary-auth-failure", "transition-needed" }; xmpp_element_t *fail_condition, *text; col_add_fstr(pinfo->cinfo, COL_INFO, "FAILURE "); fail_item = proto_tree_add_item(tree, hf_xmpp_failure, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); fail_tree = proto_item_add_subtree(fail_item, ett_xmpp_failure); if((fail_condition = xmpp_steal_element_by_names(packet, fail_names, array_length(fail_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(fail_condition->name, fail_condition->offset, fail_condition->length); g_hash_table_insert(packet->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(packet, "text"))!=NULL) { xmpp_failure_text(fail_tree, tvb, text); } xmpp_display_attrs(fail_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(fail_tree, tvb, pinfo, packet); }
void xmpp_challenge_response_success(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet, gint hf, gint ett, const char *col_info) { proto_item *item; proto_tree *subtree; xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL} }; if (check_col(pinfo->cinfo, COL_INFO)) col_set_str(pinfo->cinfo, COL_INFO, col_info); item = proto_tree_add_item(tree, hf, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); subtree = proto_item_add_subtree(item, ett); xmpp_display_attrs(subtree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_cdata(subtree, tvb, packet, -1); xmpp_unknown(subtree, tvb, pinfo, packet); }
/*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; static 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", NULL, TRUE, TRUE, xmpp_val_enum_list, creator_enums}, {"name", NULL, 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); }
void xmpp_disco_info_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *query_item; proto_tree *query_tree; xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}, {"node", hf_xmpp_query_node, FALSE, TRUE, NULL, NULL} }; xmpp_element_t *identity, *feature, *x_data; col_append_fstr(pinfo->cinfo, COL_INFO, "QUERY(disco#info) "); 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((identity = xmpp_steal_element_by_name(element, "identity")) != NULL) { xmpp_disco_info_identity(query_tree, tvb, pinfo, identity); } while((feature = xmpp_steal_element_by_name(element, "feature")) != NULL) { xmpp_disco_info_feature(query_tree, tvb, feature); } if((x_data = xmpp_steal_element_by_name_and_attr(element, "x", "xmlns", "jabber:x:data")) != NULL) { xmpp_x_data(query_tree, tvb, pinfo, x_data); } xmpp_unknown(query_tree, tvb, pinfo, element); }
static void xmpp_gtalk_session_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *reason_item; proto_tree *reason_tree; xmpp_attr_info attrs_info[] = { {"condition", -1, TRUE, TRUE, NULL, NULL}, {"text", -1, FALSE, FALSE, NULL, NULL} }; xmpp_element_t *condition; xmpp_element_t *text; const gchar *reason_names[] = { "success", "busy", "cancel"}; reason_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "REASON"); reason_tree = proto_item_add_subtree(reason_item, ett_xmpp_gtalk_session_reason); /*Looks for reason description.*/ if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); g_hash_table_insert(element->attrs, (gpointer)"text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(reason_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", NULL, FALSE, TRUE, NULL, NULL}, {"type", NULL, FALSE, TRUE, xmpp_val_enum_list, type_array}, {"var", NULL, 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); }
static void xmpp_message_subject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *subject_item; proto_tree *subject_tree; xmpp_attr_info attrs_info[] = { {"xml:lang", NULL, FALSE, TRUE, NULL, NULL}, {"value", NULL, TRUE, FALSE, NULL, NULL} }; xmpp_attr_t *fake_data_attr; subject_item = proto_tree_add_item(tree, hf_xmpp_message_subject, tvb, element->offset, element->length, ENC_BIG_ENDIAN); subject_tree = proto_item_add_subtree(subject_item, ett_xmpp_message_subject); fake_data_attr = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); g_hash_table_insert(element->attrs, (gpointer)"value", fake_data_attr); xmpp_display_attrs(subject_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(subject_tree, tvb, pinfo, element); }
static void xmpp_jingle_cont_desc_rtp_bandwidth(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) { proto_item *bandwidth_item; proto_tree *bandwidth_tree; xmpp_attr_info attrs_info[] = { {"type", -1, TRUE, TRUE, NULL, NULL}, {"value", -1, TRUE, TRUE, NULL, NULL} }; bandwidth_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_bandwidth, tvb, element->offset, element->length, ENC_BIG_ENDIAN); bandwidth_tree = proto_item_add_subtree(bandwidth_item, ett_xmpp_jingle_cont_desc_bandwidth); if(element->data) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); g_hash_table_insert(element->attrs, "value", fake_value); } xmpp_display_attrs(bandwidth_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(bandwidth_tree, tvb, pinfo, element); }
static void xmpp_message_thread(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_item *thread_item; proto_tree *thread_tree; xmpp_attr_info attrs_info[] = { {"parent", &hf_xmpp_message_thread_parent, FALSE, TRUE, NULL, NULL}, {"value", NULL, TRUE, TRUE, NULL, NULL} }; xmpp_attr_t *fake_value; thread_item = proto_tree_add_item(tree, hf_xmpp_message_thread, tvb, element->offset, element->length, ENC_BIG_ENDIAN); thread_tree = proto_item_add_subtree(thread_item, ett_xmpp_message_thread); fake_value = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(thread_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(thread_tree, tvb, pinfo, element); }
static void xmpp_message_body(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, element_t *element) { proto_item *body_item; proto_tree *body_tree; attr_info attrs_info[] = { {"xml:lang", -1, FALSE, TRUE, NULL, NULL}, {"value", -1, TRUE, TRUE, NULL, NULL} }; attr_t *fake_data_attr; body_item = proto_tree_add_item(tree, hf_xmpp_message_body, tvb, element->offset, element->length, FALSE); body_tree = proto_item_add_subtree(body_item, ett_xmpp_message_body); fake_data_attr = ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); g_hash_table_insert(element->attrs, "value", fake_data_attr); display_attrs(body_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(body_tree, tvb, pinfo, element); }
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); }
/*Feature Negotiation*/ void xmpp_feature_neg(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *feature_item; proto_tree *feature_tree; xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL} }; xmpp_element_t *x_data; feature_item = proto_tree_add_item(tree, hf_xmpp_iq_feature_neg, tvb, element->offset, element->length, ENC_BIG_ENDIAN); feature_tree = proto_item_add_subtree(feature_item, ett_xmpp_iq_feature_neg); xmpp_display_attrs(feature_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); while((x_data = xmpp_steal_element_by_name_and_attr(element, "x", "xmlns", "jabber:x:data"))!=NULL) { xmpp_x_data(feature_tree, tvb, pinfo, x_data); } xmpp_unknown(feature_tree, tvb, pinfo, element); }
void xmpp_auth(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet) { proto_item *auth_item; proto_tree *auth_tree; xmpp_attr_info_ext attrs_info[]={ {"urn:ietf:params:xml:ns:xmpp-sasl", {"xmlns", &hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}}, {"urn:ietf:params:xml:ns:xmpp-sasl", {"mechanism", NULL, TRUE, TRUE, NULL, NULL}}, {"http://www.google.com/talk/protocol/auth", {"xmlns", &hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}}, {"http://www.google.com/talk/protocol/auth", {"client-uses-full-bind-result", NULL, TRUE, TRUE, NULL, NULL}}, }; col_set_str(pinfo->cinfo, COL_INFO, "AUTH"); auth_item = proto_tree_add_item(tree, hf_xmpp_auth, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); auth_tree = proto_item_add_subtree(auth_item, ett_xmpp_auth); xmpp_display_attrs_ext(auth_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_cdata(auth_tree, tvb, packet, -1); xmpp_unknown(auth_tree, tvb, pinfo, packet); }
/*SI File Transfer*/ void xmpp_si(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *si_item; proto_tree *si_tree; xmpp_attr_info attrs_info[] = { {"xmlns", hf_xmpp_xmlns, TRUE, TRUE, NULL, NULL}, {"id", -1, FALSE, FALSE, NULL, NULL}, {"mime-type", -1, FALSE, TRUE, NULL, NULL}, {"profile", -1, FALSE, TRUE, NULL, NULL} }; xmpp_element_t *file, *feature_neg; col_append_fstr(pinfo->cinfo, COL_INFO, "SI "); si_item = proto_tree_add_item(tree, hf_xmpp_si, tvb, element->offset, element->length, ENC_BIG_ENDIAN); si_tree = proto_item_add_subtree(si_item, ett_xmpp_si); xmpp_display_attrs(si_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); while((file = xmpp_steal_element_by_name(element, "file"))!=NULL) { xmpp_si_file(si_tree, tvb, pinfo, file); } while((feature_neg = xmpp_steal_element_by_name(element, "feature"))!=NULL) { xmpp_feature_neg(si_tree, tvb, pinfo, feature_neg); } xmpp_unknown(si_tree, tvb, pinfo, element); }
static void xmpp_bytestreams_activate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree_add_string(tree, hf_xmpp_query_activate, tvb, element->offset, element->length, xmpp_elem_cdata(element)); xmpp_unknown(tree, tvb, pinfo, element); }
static void xmpp_gtalk_mail_snippet(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_tree_add_text(tree, tvb, element->offset, element->length, "SNIPPET: %s",element->data?element->data->value:""); xmpp_unknown(tree, tvb, pinfo, element); }
static void xmpp_jingle_cont_trans_s5b_proxy_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_proxy_error, tvb, element->offset, element->length, ENC_BIG_ENDIAN); xmpp_unknown(tree, tvb, pinfo, element); }
static void xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_item *reason_item; proto_tree *reason_tree; xmpp_attr_info attrs_info[] = { {"condition", hf_xmpp_jingle_reason_condition, TRUE, TRUE, NULL, NULL}, {"sid", -1, FALSE, TRUE, NULL, NULL}, {"rtp-error", -1, FALSE, TRUE, NULL, NULL}, {"text", hf_xmpp_jingle_reason_text, FALSE, FALSE, NULL, NULL} }; xmpp_element_t *condition; /*1?*/ xmpp_element_t *text; /*0-1*/ xmpp_element_t *rtp_error; const gchar *reason_names[] = { "success", "busy", "failed-application", "cancel", "connectivity-error", "decline", "expired", "failed-transport", "general-error", "gone", "incompatible-parameters", "media-error", "security-error", "timeout", "unsupported-applications", "unsupported-transports"}; const gchar *rtp_error_names[] = {"crypto-required", "invalid-crypto"}; reason_item = proto_tree_add_item(tree, hf_xmpp_jingle_reason, tvb, element->offset, element->length, ENC_BIG_ENDIAN); reason_tree = proto_item_add_subtree(reason_item, ett_xmpp_jingle_reason); /*Looks for reason description. "alternative-session" may contain "sid" element Elements are changed into attribute*/ if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); g_hash_table_insert(element->attrs, "condition", fake_cond); } else if((condition = xmpp_steal_element_by_name(element, "alternative-session"))!=NULL) { xmpp_attr_t *fake_cond,*fake_alter_sid; xmpp_element_t *sid; fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); g_hash_table_insert(element->attrs, "condition", fake_cond); if((sid = xmpp_steal_element_by_name(condition, "sid"))!=NULL) { fake_alter_sid = xmpp_ep_init_attr_t(sid->name, sid->offset, sid->length); g_hash_table_insert(element->attrs, "sid", fake_alter_sid); } } if((rtp_error = xmpp_steal_element_by_names(element, rtp_error_names, array_length(rtp_error_names)))!=NULL) { xmpp_attr_t *fake_rtp_error = xmpp_ep_init_attr_t(rtp_error->name, rtp_error->offset, rtp_error->length); g_hash_table_insert(element->attrs, "rtp-error", fake_rtp_error); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); g_hash_table_insert(element->attrs, "text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_unknown(reason_tree, tvb, pinfo, element); }