/src/wireshark/epan/dissectors/packet-xmpp-jingle.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* xmpp-jingle.c |
2 | | * Wireshark's XMPP dissector. |
3 | | * |
4 | | * urn:xmpp:jingle:1 |
5 | | * urn:xmpp:jingle:apps:rtp:1 |
6 | | * urn:xmpp:jingle:apps:rtp:errors:1 |
7 | | * urn:xmpp:jingle:apps:rtp:info:1 |
8 | | * urn:xmpp:jingle:apps:rtp:rtp-hdrext:0 |
9 | | * urn:xmpp:jingle:apps:rtp:izrtp:1 |
10 | | * |
11 | | * urn:xmpp:jingle:transports:ice-udp:1 |
12 | | * urn:xmpp:jingle:transports:raw-udp:1 |
13 | | * urn:xmpp:jingle:transports:s5b:1 |
14 | | * urn:xmpp:jingle:transports:ibb:1 |
15 | | * |
16 | | * http://jabber.org/protocol/jinglenodes |
17 | | * http://jabber.org/protocol/jinglenodes#channel |
18 | | * |
19 | | * Copyright 2011, Mariusz Okroj <okrojmariusz[]gmail.com> |
20 | | * |
21 | | * Wireshark - Network traffic analyzer |
22 | | * By Gerald Combs <gerald@wireshark.org> |
23 | | * Copyright 1998 Gerald Combs |
24 | | * |
25 | | * SPDX-License-Identifier: GPL-2.0-or-later |
26 | | */ |
27 | | |
28 | | #include "config.h" |
29 | | |
30 | | #include <epan/packet.h> |
31 | | |
32 | | #include "packet-xmpp.h" |
33 | | #include "packet-xmpp-jingle.h" |
34 | | #include "packet-xmpp-conference.h" |
35 | | #include "packet-xmpp-gtalk.h" |
36 | | #include "packet-xmpp-other.h" |
37 | | |
38 | | static void xmpp_jingle_content(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
39 | | static void xmpp_jingle_content_description_rtp(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
40 | | static void xmpp_jingle_cont_desc_rtp_payload(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
41 | | static void xmpp_jingle_cont_desc_rtp_payload_param(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
42 | | static void xmpp_jingle_cont_desc_rtp_enc(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
43 | | static void xmpp_jingle_cont_desc_rtp_enc_zrtp_hash(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
44 | | static void xmpp_jingle_cont_desc_rtp_enc_crypto(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
45 | | static void xmpp_jingle_cont_desc_rtp_bandwidth(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
46 | | static void xmpp_jingle_cont_desc_rtp_hdrext(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element); |
47 | | static void xmpp_jingle_cont_trans_ice(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
48 | | static void xmpp_jingle_cont_trans_ice_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
49 | | static void xmpp_jingle_cont_trans_ice_remote_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
50 | | static void xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
51 | | static void xmpp_jingle_rtp_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
52 | | static void xmpp_jinglenodes_relay_stun_tracker(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
53 | | static void xmpp_jingle_cont_trans_raw(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
54 | | static void xmpp_jingle_cont_trans_raw_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
55 | | static void xmpp_jingle_cont_trans_s5b(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
56 | | static void xmpp_jingle_cont_trans_s5b_candidate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
57 | | static void xmpp_jingle_cont_trans_s5b_activated(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
58 | | static void xmpp_jingle_cont_trans_s5b_cand_used(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
59 | | static void xmpp_jingle_cont_trans_s5b_cand_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
60 | | static void xmpp_jingle_cont_trans_s5b_proxy_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
61 | | static void xmpp_jingle_cont_trans_ibb(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element); |
62 | | |
63 | | static void xmpp_jingle_file_transfer_desc(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
64 | | static void xmpp_jingle_file_transfer_offer(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
65 | | static void xmpp_jingle_file_transfer_file(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
66 | | static void xmpp_jingle_file_transfer_request(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
67 | | static void xmpp_jingle_file_transfer_received(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
68 | | static void xmpp_jingle_file_transfer_abort(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
69 | | static void xmpp_jingle_file_transfer_checksum(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); |
70 | | |
71 | | /*XEP-0166: Jingle urn:xmpp:jingle:1*/ |
72 | | void |
73 | | xmpp_jingle(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
74 | 0 | { |
75 | 0 | proto_item *jingle_item; |
76 | 0 | proto_tree *jingle_tree; |
77 | |
|
78 | 0 | static const char *rtp_info_msgs[] = {"active", "hold", "mute", "ringing", "unhold", "unmute"}; |
79 | |
|
80 | 0 | static const char *action_enums[] = {"content-accept","content-add", "content-modify", |
81 | 0 | "content-modify", "content-remove", "description-info", "security-info", |
82 | 0 | "session-accept", "session-info", "session-initiate", "session-terminate", |
83 | 0 | "transport-accept", "transport-info", "transport-reject", "transport-replace" |
84 | 0 | }; |
85 | |
|
86 | 0 | xmpp_array_t *action_array = xmpp_ep_init_array_t(pinfo->pool, action_enums,array_length(action_enums)); |
87 | 0 | xmpp_array_t *rtp_info_array = xmpp_ep_init_array_t(pinfo->pool, rtp_info_msgs, array_length(rtp_info_msgs)); |
88 | |
|
89 | 0 | xmpp_attr_info attrs_info[] = { |
90 | 0 | {"xmlns", &hf_xmpp_xmlns, true, false, NULL, NULL}, |
91 | 0 | {"action", &hf_xmpp_jingle_action, true, true, xmpp_val_enum_list, action_array}, |
92 | 0 | {"sid", &hf_xmpp_jingle_sid, true, false, NULL, NULL}, |
93 | 0 | {"initiator", &hf_xmpp_jingle_initiator, false, false, NULL, NULL}, |
94 | 0 | {"responder", &hf_xmpp_jingle_responder, false, false, NULL, NULL} |
95 | 0 | }; |
96 | |
|
97 | 0 | xmpp_elem_info elems_info [] = { |
98 | 0 | {NAME, "content", xmpp_jingle_content, MANY}, |
99 | 0 | {NAME, "reason", xmpp_jingle_reason, MANY}, |
100 | 0 | {NAMES, rtp_info_array, xmpp_jingle_rtp_info, ONE}, |
101 | 0 | {NAME, "conference-info", xmpp_conferece_info_advert, ONE} |
102 | 0 | }; |
103 | |
|
104 | 0 | xmpp_attr_t *action = xmpp_get_attr(element,"action"); |
105 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "JINGLE(%s) ", action?action->value:""); |
106 | | |
107 | |
|
108 | 0 | jingle_item = proto_tree_add_item(tree, hf_xmpp_jingle, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
109 | 0 | jingle_tree = proto_item_add_subtree(jingle_item, ett_xmpp_jingle); |
110 | |
|
111 | 0 | xmpp_display_attrs(jingle_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
112 | |
|
113 | 0 | xmpp_display_elems(jingle_item, element, pinfo, tvb, elems_info, array_length(elems_info)); |
114 | 0 | } |
115 | | |
116 | | static void |
117 | | xmpp_jingle_content(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
118 | 0 | { |
119 | 0 | proto_item *content_item; |
120 | 0 | proto_tree *content_tree; |
121 | |
|
122 | 0 | static const char *creator_enums[] = {"initiator","responder"}; |
123 | 0 | xmpp_array_t *creator_enums_array = xmpp_ep_init_array_t(pinfo->pool, creator_enums,array_length(creator_enums)); |
124 | |
|
125 | 0 | xmpp_attr_info attrs_info[] = { |
126 | 0 | {"creator", &hf_xmpp_jingle_content_creator, true, false, xmpp_val_enum_list, creator_enums_array}, |
127 | 0 | {"name", &hf_xmpp_jingle_content_name, true, true, NULL, NULL}, |
128 | 0 | {"disposition", &hf_xmpp_jingle_content_disposition, false, false, NULL, NULL}, |
129 | 0 | {"senders", &hf_xmpp_jingle_content_senders, false, false, NULL, NULL} |
130 | 0 | }; |
131 | |
|
132 | 0 | xmpp_elem_info elems_info [] = { |
133 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "description", "xmlns", "urn:xmpp:jingle:apps:rtp:1"), xmpp_jingle_content_description_rtp, MANY}, |
134 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "description", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_desc, MANY}, |
135 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "urn:xmpp:jingle:transports:ice-udp:1"), xmpp_jingle_cont_trans_ice, MANY}, |
136 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "urn:xmpp:jingle:transports:raw-udp:1"), xmpp_jingle_cont_trans_raw, MANY}, |
137 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "urn:xmpp:jingle:transports:s5b:1"), xmpp_jingle_cont_trans_s5b, MANY}, |
138 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "urn:xmpp:jingle:transports:ibb:1"), xmpp_jingle_cont_trans_ibb, MANY}, |
139 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "http://www.google.com/transport/p2p"), xmpp_gtalk_transport_p2p, MANY}, |
140 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "received", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_received, MANY}, |
141 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "abort", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_abort, MANY}, |
142 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "checksum", "xmlns", "urn:xmpp:jingle:apps:file-transfer:3"), xmpp_jingle_file_transfer_checksum, MANY}, |
143 | 0 | {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "inputevt", "xmlns","http://jitsi.org/protocol/inputevt"), xmpp_jitsi_inputevt, ONE}, |
144 | 0 | }; |
145 | |
|
146 | 0 | content_item = proto_tree_add_item(tree, hf_xmpp_jingle_content, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
147 | 0 | content_tree = proto_item_add_subtree(content_item, ett_xmpp_jingle_content); |
148 | |
|
149 | 0 | xmpp_display_attrs(content_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
150 | |
|
151 | 0 | xmpp_display_elems(content_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
152 | 0 | } |
153 | | |
154 | | static void |
155 | | xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
156 | 0 | { |
157 | 0 | proto_item *reason_item; |
158 | 0 | proto_tree *reason_tree; |
159 | |
|
160 | 0 | xmpp_attr_info attrs_info[] = { |
161 | 0 | {"condition", &hf_xmpp_jingle_reason_condition, true, true, NULL, NULL}, |
162 | 0 | {"sid", NULL, false, true, NULL, NULL}, |
163 | 0 | {"rtp-error", NULL, false, true, NULL, NULL}, |
164 | 0 | {"text", &hf_xmpp_jingle_reason_text, false, false, NULL, NULL} |
165 | 0 | }; |
166 | |
|
167 | 0 | xmpp_element_t *condition; /*1?*/ |
168 | 0 | xmpp_element_t *text; /*0-1*/ |
169 | 0 | xmpp_element_t *rtp_error; |
170 | |
|
171 | 0 | static const char *reason_names[] = { "success", "busy", "failed-application", "cancel", "connectivity-error", |
172 | 0 | "decline", "expired", "failed-transport", "general-error", "gone", "incompatible-parameters", |
173 | 0 | "media-error", "security-error", "timeout", "unsupported-applications", "unsupported-transports"}; |
174 | |
|
175 | 0 | static const char *rtp_error_names[] = {"crypto-required", "invalid-crypto"}; |
176 | |
|
177 | 0 | reason_item = proto_tree_add_item(tree, hf_xmpp_jingle_reason, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
178 | 0 | reason_tree = proto_item_add_subtree(reason_item, ett_xmpp_jingle_reason); |
179 | | |
180 | | |
181 | | /*Looks for reason description. "alternative-session" may contain "sid" element |
182 | | Elements are changed into attribute*/ |
183 | 0 | if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) |
184 | 0 | { |
185 | 0 | xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(pinfo->pool, condition->name, condition->offset, condition->length); |
186 | 0 | g_hash_table_insert(element->attrs, (void *)"condition", fake_cond); |
187 | |
|
188 | 0 | } else if((condition = xmpp_steal_element_by_name(element, "alternative-session"))!=NULL) |
189 | 0 | { |
190 | 0 | xmpp_attr_t *fake_cond,*fake_alter_sid; |
191 | 0 | xmpp_element_t *sid; |
192 | |
|
193 | 0 | fake_cond = xmpp_ep_init_attr_t(pinfo->pool, condition->name, condition->offset, condition->length); |
194 | 0 | g_hash_table_insert(element->attrs, (void *)"condition", fake_cond); |
195 | | |
196 | |
|
197 | 0 | if((sid = xmpp_steal_element_by_name(condition, "sid"))!=NULL) |
198 | 0 | { |
199 | 0 | fake_alter_sid = xmpp_ep_init_attr_t(pinfo->pool, sid->name, sid->offset, sid->length); |
200 | 0 | g_hash_table_insert(element->attrs, (void *)"sid", fake_alter_sid); |
201 | 0 | } |
202 | 0 | } |
203 | |
|
204 | 0 | if((rtp_error = xmpp_steal_element_by_names(element, rtp_error_names, array_length(rtp_error_names)))!=NULL) |
205 | 0 | { |
206 | 0 | xmpp_attr_t *fake_rtp_error = xmpp_ep_init_attr_t(pinfo->pool, rtp_error->name, rtp_error->offset, rtp_error->length); |
207 | 0 | g_hash_table_insert(element->attrs, (void *)"rtp-error", fake_rtp_error); |
208 | 0 | } |
209 | |
|
210 | 0 | if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) |
211 | 0 | { |
212 | 0 | xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(pinfo->pool, text->data?text->data->value:"", text->offset, text->length); |
213 | 0 | g_hash_table_insert(element->attrs, (void *)"text", fake_text); |
214 | 0 | } |
215 | |
|
216 | 0 | xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
217 | |
|
218 | 0 | xmpp_unknown(reason_tree, tvb, pinfo, element); |
219 | 0 | } |
220 | | |
221 | | /*XEP-0167: Jingle RTP Sessions urn:xmpp:jingle:apps:rtp:1*/ |
222 | | static void |
223 | | xmpp_jingle_content_description_rtp(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
224 | 0 | { |
225 | 0 | proto_item *desc_item; |
226 | 0 | proto_tree *desc_tree; |
227 | |
|
228 | 0 | xmpp_attr_info attrs_info[] = { |
229 | 0 | {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL}, |
230 | 0 | {"media", &hf_xmpp_jingle_content_description_media, true, true, NULL, NULL}, |
231 | 0 | {"ssrc", &hf_xmpp_jingle_content_description_ssrc , false, true, NULL, NULL} |
232 | 0 | }; |
233 | |
|
234 | 0 | xmpp_elem_info elems_info[] = { |
235 | 0 | {NAME, "payload-type", xmpp_jingle_cont_desc_rtp_payload, MANY}, |
236 | 0 | {NAME, "bandwidth", xmpp_jingle_cont_desc_rtp_bandwidth, ONE}, |
237 | 0 | {NAME, "encryption", xmpp_jingle_cont_desc_rtp_enc, ONE}, |
238 | 0 | {NAME, "rtp-hdrext", xmpp_jingle_cont_desc_rtp_hdrext, MANY}, |
239 | 0 | {NAME, "zrtp-hash", xmpp_jingle_cont_desc_rtp_enc_zrtp_hash, MANY}/*IMHO it shouldn't appear in description*/ |
240 | |
|
241 | 0 | }; |
242 | |
|
243 | 0 | desc_item = proto_tree_add_item(tree, hf_xmpp_jingle_content_description, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
244 | 0 | desc_tree = proto_item_add_subtree(desc_item, ett_xmpp_jingle_content_description); |
245 | |
|
246 | 0 | xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
247 | |
|
248 | 0 | xmpp_display_elems(desc_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
249 | 0 | } |
250 | | |
251 | | static void |
252 | | xmpp_jingle_cont_desc_rtp_payload(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
253 | 0 | { |
254 | 0 | proto_item *payload_item; |
255 | 0 | proto_tree *payload_tree; |
256 | |
|
257 | 0 | xmpp_attr_info attrs_info[] = { |
258 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
259 | 0 | {"id", &hf_xmpp_jingle_cont_desc_payload_id, true, true, NULL, NULL}, |
260 | 0 | {"channels", &hf_xmpp_jingle_cont_desc_payload_channels, false, false, NULL, NULL}, |
261 | 0 | {"clockrate", &hf_xmpp_jingle_cont_desc_payload_clockrate, false, false, NULL, NULL}, |
262 | 0 | {"maxptime", &hf_xmpp_jingle_cont_desc_payload_maxptime, false, false, NULL, NULL}, |
263 | 0 | {"name", &hf_xmpp_jingle_cont_desc_payload_name, false, true, NULL, NULL}, |
264 | 0 | {"ptime", &hf_xmpp_jingle_cont_desc_payload_ptime, false, false, NULL, NULL} |
265 | 0 | }; |
266 | |
|
267 | 0 | xmpp_elem_info elems_info [] = |
268 | 0 | { |
269 | 0 | {NAME, "parameter", xmpp_jingle_cont_desc_rtp_payload_param, MANY} |
270 | 0 | }; |
271 | |
|
272 | 0 | payload_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_payload, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
273 | 0 | payload_tree = proto_item_add_subtree(payload_item, ett_xmpp_jingle_cont_desc_payload); |
274 | |
|
275 | 0 | xmpp_display_attrs(payload_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
276 | |
|
277 | 0 | xmpp_display_elems(payload_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
278 | 0 | } |
279 | | |
280 | | static void |
281 | | xmpp_jingle_cont_desc_rtp_payload_param(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
282 | 0 | { |
283 | 0 | proto_item *param_item; |
284 | 0 | proto_tree *param_tree; |
285 | |
|
286 | 0 | proto_item *parent_item; |
287 | 0 | xmpp_attr_t *name, *value; |
288 | |
|
289 | 0 | xmpp_attr_info attrs_info[] = { |
290 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
291 | 0 | {"name", &hf_xmpp_jingle_cont_desc_payload_param_name, true, true, NULL, NULL}, |
292 | 0 | {"value", &hf_xmpp_jingle_cont_desc_payload_param_value, true, true, NULL, NULL} |
293 | 0 | }; |
294 | |
|
295 | 0 | name = xmpp_get_attr(element, "name"); |
296 | 0 | value = xmpp_get_attr(element, "value"); |
297 | |
|
298 | 0 | if(name && value) |
299 | 0 | { |
300 | 0 | char *parent_item_label; |
301 | |
|
302 | 0 | parent_item = proto_tree_get_parent(tree); |
303 | |
|
304 | 0 | parent_item_label = proto_item_get_text(pinfo->pool, parent_item); |
305 | |
|
306 | 0 | if(parent_item_label) |
307 | 0 | { |
308 | 0 | parent_item_label[strlen(parent_item_label)-1]= '\0'; |
309 | 0 | proto_item_set_text(parent_item, "%s param(\"%s\")=%s]", parent_item_label ,name->value, value->value); |
310 | 0 | } |
311 | 0 | } |
312 | |
|
313 | 0 | param_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_payload_param, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
314 | 0 | param_tree = proto_item_add_subtree(param_item, ett_xmpp_jingle_cont_desc_payload_param); |
315 | |
|
316 | 0 | xmpp_display_attrs(param_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
317 | |
|
318 | 0 | xmpp_unknown(param_tree, tvb, pinfo, element); |
319 | |
|
320 | 0 | } |
321 | | |
322 | | static void |
323 | | xmpp_jingle_cont_desc_rtp_enc(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
324 | 0 | { |
325 | 0 | proto_item *enc_item; |
326 | 0 | proto_tree *enc_tree; |
327 | |
|
328 | 0 | xmpp_elem_info elems_info [] = { |
329 | 0 | {NAME, "zrtp-hash", xmpp_jingle_cont_desc_rtp_enc_zrtp_hash, MANY}, |
330 | 0 | {NAME, "crypto", xmpp_jingle_cont_desc_rtp_enc_crypto, MANY} |
331 | 0 | }; |
332 | |
|
333 | 0 | enc_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_enc, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
334 | 0 | enc_tree = proto_item_add_subtree(enc_item, ett_xmpp_jingle_cont_desc_enc); |
335 | |
|
336 | 0 | xmpp_display_attrs(enc_tree, element, pinfo, tvb, NULL, 0); |
337 | 0 | xmpp_display_elems(enc_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
338 | 0 | } |
339 | | |
340 | | /*urn:xmpp:jingle:apps:rtp:zrtp:1*/ |
341 | | static void |
342 | | xmpp_jingle_cont_desc_rtp_enc_zrtp_hash(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
343 | 0 | { |
344 | 0 | proto_item *zrtp_hash_item; |
345 | 0 | proto_tree *zrtp_hash_tree; |
346 | |
|
347 | 0 | xmpp_attr_info attrs_info[] = { |
348 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
349 | 0 | {"version", NULL, true, true,NULL,NULL}, |
350 | 0 | {"hash", NULL, true, false, NULL, NULL} |
351 | 0 | }; |
352 | |
|
353 | 0 | zrtp_hash_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_enc_zrtp_hash, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
354 | 0 | zrtp_hash_tree = proto_item_add_subtree(zrtp_hash_item, ett_xmpp_jingle_cont_desc_enc_zrtp_hash); |
355 | |
|
356 | 0 | if(element->data) |
357 | 0 | { |
358 | 0 | xmpp_attr_t *fake_hash = xmpp_ep_init_attr_t(pinfo->pool, element->data->value, element->offset, element->length); |
359 | 0 | g_hash_table_insert(element->attrs, (void *)"hash", fake_hash); |
360 | 0 | } |
361 | |
|
362 | 0 | xmpp_display_attrs(zrtp_hash_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
363 | |
|
364 | 0 | xmpp_unknown(zrtp_hash_tree, tvb, pinfo, element); |
365 | 0 | } |
366 | | |
367 | | static void |
368 | | xmpp_jingle_cont_desc_rtp_enc_crypto(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
369 | 0 | { |
370 | 0 | proto_item *crypto_item; |
371 | 0 | proto_tree *crypto_tree; |
372 | |
|
373 | 0 | xmpp_attr_info attrs_info[] = { |
374 | 0 | {"crypto-suite", NULL, true, true, NULL, NULL}, |
375 | 0 | {"key-params", NULL, true, false,NULL,NULL}, |
376 | 0 | {"session-params", NULL, false, true, NULL, NULL}, |
377 | 0 | {"tag", NULL, true, false, NULL, NULL} |
378 | 0 | }; |
379 | |
|
380 | 0 | crypto_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_enc_crypto, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
381 | 0 | crypto_tree = proto_item_add_subtree(crypto_item, ett_xmpp_jingle_cont_desc_enc_crypto); |
382 | | |
383 | |
|
384 | 0 | xmpp_display_attrs(crypto_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
385 | |
|
386 | 0 | xmpp_unknown(crypto_tree, tvb, pinfo, element); |
387 | 0 | } |
388 | | |
389 | | static void |
390 | | xmpp_jingle_cont_desc_rtp_bandwidth(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
391 | 0 | { |
392 | 0 | proto_item *bandwidth_item; |
393 | 0 | proto_tree *bandwidth_tree; |
394 | |
|
395 | 0 | xmpp_attr_info attrs_info[] = { |
396 | 0 | {"type", NULL, true, true, NULL, NULL}, |
397 | 0 | {"value", NULL, true, true, NULL, NULL} |
398 | 0 | }; |
399 | |
|
400 | 0 | bandwidth_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_bandwidth, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
401 | 0 | bandwidth_tree = proto_item_add_subtree(bandwidth_item, ett_xmpp_jingle_cont_desc_bandwidth); |
402 | |
|
403 | 0 | if(element->data) |
404 | 0 | { |
405 | 0 | xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(pinfo->pool, element->data->value, element->offset, element->length); |
406 | 0 | g_hash_table_insert(element->attrs, (void *)"value", fake_value); |
407 | 0 | } |
408 | |
|
409 | 0 | xmpp_display_attrs(bandwidth_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
410 | 0 | xmpp_unknown(bandwidth_tree, tvb, pinfo, element); |
411 | 0 | } |
412 | | |
413 | | /*urn:xmpp:jingle:apps:rtp:rtp-hdrext:0*/ |
414 | | static void |
415 | | xmpp_jingle_cont_desc_rtp_hdrext(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, xmpp_element_t* element) |
416 | 0 | { |
417 | 0 | proto_item *rtp_hdr_item; |
418 | 0 | proto_tree *rtp_hdr_tree; |
419 | |
|
420 | 0 | static const char *senders[] = {"both", "initiator", "responder"}; |
421 | 0 | xmpp_array_t *senders_enums = xmpp_ep_init_array_t(pinfo->pool, senders, 3); |
422 | |
|
423 | 0 | xmpp_attr_info attrs_info[] = { |
424 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
425 | 0 | {"id", NULL, true, false, NULL, NULL}, |
426 | 0 | {"uri", NULL, true, true, NULL, NULL}, |
427 | 0 | {"senders", NULL, false, true, xmpp_val_enum_list, senders_enums}, |
428 | 0 | {"parameter", NULL, false, true, NULL, NULL} |
429 | 0 | }; |
430 | |
|
431 | 0 | xmpp_element_t *parameter; |
432 | |
|
433 | 0 | rtp_hdr_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_desc_rtp_hdr, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
434 | 0 | rtp_hdr_tree = proto_item_add_subtree(rtp_hdr_item, ett_xmpp_jingle_cont_desc_rtp_hdr); |
435 | |
|
436 | 0 | if((parameter = xmpp_steal_element_by_name(element, "parameter"))!=NULL) |
437 | 0 | { |
438 | 0 | xmpp_attr_t *name = xmpp_get_attr(element, "name"); |
439 | 0 | xmpp_attr_t *fake_attr = xmpp_ep_init_attr_t(pinfo->pool, name?name->value:"", parameter->offset, parameter->length); |
440 | 0 | g_hash_table_insert(element->attrs, (void *)"parameter", fake_attr); |
441 | 0 | } |
442 | |
|
443 | 0 | xmpp_display_attrs(rtp_hdr_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
444 | |
|
445 | 0 | xmpp_unknown(rtp_hdr_tree, tvb, pinfo, element); |
446 | 0 | } |
447 | | |
448 | | /*urn:xmpp:jingle:apps:rtp:info:1*/ |
449 | | static void |
450 | | xmpp_jingle_rtp_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
451 | 0 | { |
452 | 0 | proto_item *rtp_info_item; |
453 | 0 | proto_tree *rtp_info_tree; |
454 | |
|
455 | 0 | static const char *creator[] = {"initiator","responder"}; |
456 | 0 | xmpp_array_t *creator_enums = xmpp_ep_init_array_t(pinfo->pool, creator, array_length(creator)); |
457 | |
|
458 | 0 | xmpp_attr_info mute_attrs_info[] = { |
459 | 0 | {"creator", NULL, true, true, xmpp_val_enum_list, creator_enums}, |
460 | 0 | {"name", NULL, true, true, NULL, NULL} |
461 | 0 | }; |
462 | |
|
463 | 0 | rtp_info_item = proto_tree_add_string(tree, hf_xmpp_jingle_rtp_info, tvb, element->offset, element->length, element->name); |
464 | 0 | rtp_info_tree = proto_item_add_subtree(rtp_info_item, ett_xmpp_jingle_rtp_info); |
465 | |
|
466 | 0 | if(strcmp("mute", element->name) == 0 || strcmp("unmute", element->name) == 0) |
467 | 0 | xmpp_display_attrs(rtp_info_tree, element, pinfo, tvb, mute_attrs_info, array_length(mute_attrs_info)); |
468 | |
|
469 | 0 | xmpp_unknown(rtp_info_tree, tvb, pinfo, element); |
470 | 0 | } |
471 | | |
472 | | /*XEP-0176: Jingle ICE-UDP Transport Method urn:xmpp:jingle:transports:ice-udp:1*/ |
473 | | static void |
474 | | xmpp_jingle_cont_trans_ice(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
475 | 0 | { |
476 | 0 | proto_item *trans_item; |
477 | 0 | proto_tree *trans_tree; |
478 | |
|
479 | 0 | xmpp_attr_info attrs_info[] = { |
480 | 0 | {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL}, |
481 | 0 | {"pwd", &hf_xmpp_jingle_cont_trans_pwd, false, false, NULL, NULL}, |
482 | 0 | {"ufrag", &hf_xmpp_jingle_cont_trans_ufrag, false, true, NULL, NULL} |
483 | 0 | }; |
484 | |
|
485 | 0 | xmpp_elem_info elems_info [] = { |
486 | 0 | {NAME, "candidate", xmpp_jingle_cont_trans_ice_candidate, MANY}, |
487 | 0 | {NAME, "remote-candidate", xmpp_jingle_cont_trans_ice_remote_candidate, ONE} |
488 | 0 | }; |
489 | |
|
490 | 0 | trans_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
491 | 0 | trans_tree = proto_item_add_subtree(trans_item, ett_xmpp_jingle_cont_trans); |
492 | |
|
493 | 0 | xmpp_display_attrs(trans_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
494 | |
|
495 | 0 | xmpp_display_elems(trans_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
496 | 0 | } |
497 | | |
498 | | static void |
499 | | xmpp_jingle_cont_trans_ice_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
500 | 0 | { |
501 | 0 | proto_item *cand_item; |
502 | 0 | proto_tree *cand_tree; |
503 | |
|
504 | 0 | static const char *type_enums[] = {"host", "prflx", "relay", "srflx"}; |
505 | 0 | xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(pinfo->pool, type_enums,array_length(type_enums)); |
506 | |
|
507 | 0 | xmpp_attr_info attrs_info[] = { |
508 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
509 | 0 | {"component", NULL, true, false, NULL, NULL}, |
510 | 0 | {"foundation", NULL, true, false, NULL, NULL}, |
511 | 0 | {"generation", NULL, true, false, NULL, NULL}, |
512 | 0 | {"id", NULL, false, false, NULL, NULL}, /*in schemas id is marked as required, but in jitsi logs it doesn't appear*/ |
513 | 0 | {"ip", NULL, true, true, NULL, NULL}, |
514 | 0 | {"network", NULL, true, false, NULL, NULL}, |
515 | 0 | {"port", NULL, true, false, NULL, NULL}, |
516 | 0 | {"priority", NULL, true, true, NULL, NULL}, |
517 | 0 | {"protocol", NULL, true, true, NULL, NULL}, |
518 | 0 | {"rel-addr", NULL, false, false, NULL, NULL}, |
519 | 0 | {"rel-port", NULL, false, false, NULL, NULL}, |
520 | 0 | {"type", NULL, true, true, xmpp_val_enum_list, type_enums_array} |
521 | 0 | }; |
522 | |
|
523 | 0 | cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
524 | 0 | cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); |
525 | |
|
526 | 0 | xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
527 | |
|
528 | 0 | xmpp_unknown(cand_tree, tvb, pinfo, element); |
529 | 0 | } |
530 | | |
531 | | static void |
532 | | xmpp_jingle_cont_trans_ice_remote_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
533 | 0 | { |
534 | 0 | proto_item *remote_cand_item; |
535 | 0 | proto_tree *remote_cand_tree; |
536 | |
|
537 | 0 | xmpp_attr_info attrs_info[] = { |
538 | 0 | {"component", NULL, true, false, NULL, NULL}, |
539 | 0 | {"ip", NULL, true, false, NULL, NULL}, |
540 | 0 | {"port", NULL, true, false, NULL, NULL} |
541 | 0 | }; |
542 | |
|
543 | 0 | remote_cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_rem_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
544 | 0 | remote_cand_tree = proto_item_add_subtree(remote_cand_item, ett_xmpp_jingle_cont_trans_rem_cand); |
545 | |
|
546 | 0 | xmpp_display_attrs(remote_cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
547 | |
|
548 | 0 | xmpp_unknown(remote_cand_tree, tvb, pinfo, element); |
549 | 0 | } |
550 | | |
551 | | /*XEP-0177: Jingle Raw UDP Transport Method urn:xmpp:jingle:transports:raw-udp:1*/ |
552 | | static void |
553 | | xmpp_jingle_cont_trans_raw(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
554 | 0 | { |
555 | 0 | proto_item *trans_item; |
556 | 0 | proto_tree *trans_tree; |
557 | |
|
558 | 0 | xmpp_attr_info attrs_info[] = { |
559 | 0 | {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL} |
560 | 0 | }; |
561 | |
|
562 | 0 | xmpp_elem_info elems_info [] = { |
563 | 0 | {NAME, "candidate", xmpp_jingle_cont_trans_raw_candidate, MANY} |
564 | 0 | }; |
565 | |
|
566 | 0 | trans_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
567 | 0 | trans_tree = proto_item_add_subtree(trans_item, ett_xmpp_jingle_cont_trans); |
568 | |
|
569 | 0 | xmpp_display_attrs(trans_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
570 | 0 | xmpp_display_elems(trans_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
571 | 0 | } |
572 | | |
573 | | static void |
574 | | xmpp_jingle_cont_trans_raw_candidate(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
575 | 0 | { |
576 | 0 | proto_item *cand_item; |
577 | 0 | proto_tree *cand_tree; |
578 | |
|
579 | 0 | static const char *type_enums[] = {"host", "prflx", "relay", "srflx"}; |
580 | 0 | xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(pinfo->pool, type_enums,array_length(type_enums)); |
581 | |
|
582 | 0 | xmpp_attr_info attrs_info[] = { |
583 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
584 | 0 | {"component", NULL, true, false, NULL, NULL}, |
585 | 0 | {"generation", NULL, true, false, NULL, NULL}, |
586 | 0 | {"id", NULL, true, false, NULL, NULL}, |
587 | 0 | {"ip", NULL, true, true, NULL, NULL}, |
588 | 0 | {"port", NULL, true, true, NULL, NULL}, |
589 | 0 | {"type", NULL, true, true, xmpp_val_enum_list, type_enums_array} |
590 | 0 | }; |
591 | |
|
592 | 0 | cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
593 | 0 | cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); |
594 | |
|
595 | 0 | xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
596 | 0 | xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0); |
597 | 0 | } |
598 | | |
599 | | /*XEP-0260: Jingle SOCKS5 Bytestreams Transport Method urn:xmpp:jingle:transports:s5b:1*/ |
600 | | static void |
601 | | xmpp_jingle_cont_trans_s5b(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
602 | 0 | { |
603 | 0 | proto_item *trans_item; |
604 | 0 | proto_tree *trans_tree; |
605 | |
|
606 | 0 | xmpp_attr_info attrs_info[] = { |
607 | 0 | {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL}, |
608 | 0 | {"mode", NULL, false, true, NULL, NULL}, |
609 | 0 | {"sid", NULL, false, true, NULL, NULL}, |
610 | 0 | }; |
611 | |
|
612 | 0 | xmpp_elem_info elems_info [] = { |
613 | 0 | {NAME, "candidate", xmpp_jingle_cont_trans_s5b_candidate, MANY}, |
614 | 0 | {NAME, "activated", xmpp_jingle_cont_trans_s5b_activated, ONE}, |
615 | 0 | {NAME, "candidate-used", xmpp_jingle_cont_trans_s5b_cand_used, ONE}, |
616 | 0 | {NAME, "candidate-error", xmpp_jingle_cont_trans_s5b_cand_error, ONE}, |
617 | 0 | {NAME, "proxy-error", xmpp_jingle_cont_trans_s5b_proxy_error, ONE}, |
618 | 0 | }; |
619 | |
|
620 | 0 | trans_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
621 | 0 | trans_tree = proto_item_add_subtree(trans_item, ett_xmpp_jingle_cont_trans); |
622 | |
|
623 | 0 | xmpp_display_attrs(trans_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
624 | 0 | xmpp_display_elems(trans_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
625 | 0 | } |
626 | | |
627 | | static void |
628 | | xmpp_jingle_cont_trans_s5b_candidate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
629 | 0 | { |
630 | 0 | proto_item *cand_item; |
631 | 0 | proto_tree *cand_tree; |
632 | |
|
633 | 0 | static const char * type_enums[] = {"assisted", "direct", "proxy", "tunnel"}; |
634 | 0 | xmpp_array_t *type_enums_array = xmpp_ep_init_array_t(pinfo->pool, type_enums, array_length(type_enums)); |
635 | |
|
636 | 0 | xmpp_attr_info attrs_info[] = { |
637 | 0 | {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL}, |
638 | 0 | {"cid", NULL, true, true, NULL, NULL}, |
639 | 0 | {"jid", NULL, true, true, NULL, NULL}, |
640 | 0 | {"port", NULL, false, true, NULL, NULL}, |
641 | 0 | {"priority", NULL, true, true, NULL, NULL}, |
642 | 0 | {"type", NULL, true, true, xmpp_val_enum_list, type_enums_array} |
643 | 0 | }; |
644 | |
|
645 | 0 | cand_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_cand, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
646 | 0 | cand_tree = proto_item_add_subtree(cand_item, ett_xmpp_jingle_cont_trans_cand); |
647 | |
|
648 | 0 | xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
649 | 0 | xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0); |
650 | 0 | } |
651 | | |
652 | | static void |
653 | | xmpp_jingle_cont_trans_s5b_activated(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
654 | 0 | { |
655 | 0 | proto_item *activated_item; |
656 | 0 | xmpp_attr_t *cid = xmpp_get_attr(element, "cid"); |
657 | |
|
658 | 0 | activated_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_activated, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
659 | 0 | proto_item_append_text(activated_item, " [cid=\"%s\"]",cid?cid->value:""); |
660 | |
|
661 | 0 | xmpp_unknown(tree, tvb, pinfo, element); |
662 | 0 | } |
663 | | |
664 | | static void |
665 | | xmpp_jingle_cont_trans_s5b_cand_used(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
666 | 0 | { |
667 | 0 | proto_item *cand_used_item; |
668 | 0 | xmpp_attr_t *cid = xmpp_get_attr(element, "cid"); |
669 | |
|
670 | 0 | cand_used_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_candidate_used, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
671 | 0 | proto_item_append_text(cand_used_item, " [cid=\"%s\"]",cid?cid->value:""); |
672 | |
|
673 | 0 | xmpp_unknown(tree, tvb, pinfo, element); |
674 | 0 | } |
675 | | |
676 | | static void |
677 | | xmpp_jingle_cont_trans_s5b_cand_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
678 | 0 | { |
679 | 0 | proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_candidate_error, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
680 | 0 | xmpp_unknown(tree, tvb, pinfo, element); |
681 | 0 | } |
682 | | |
683 | | static void |
684 | | xmpp_jingle_cont_trans_s5b_proxy_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
685 | 0 | { |
686 | 0 | proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans_proxy_error, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
687 | 0 | xmpp_unknown(tree, tvb, pinfo, element); |
688 | 0 | } |
689 | | |
690 | | /*XEP-0261: Jingle In-Band Bytestreams Transport Method urn:xmpp:jingle:transports:ibb:1*/ |
691 | | static void |
692 | 0 | xmpp_jingle_cont_trans_ibb(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { |
693 | 0 | proto_item *trans_item; |
694 | 0 | proto_tree *trans_tree; |
695 | |
|
696 | 0 | xmpp_attr_info attrs_info[] = { |
697 | 0 | {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL}, |
698 | 0 | {"block-size", NULL, true, true, NULL, NULL}, |
699 | 0 | {"sid", NULL, true, true, NULL, NULL}, |
700 | 0 | {"stanza", NULL, false, true, NULL, NULL} |
701 | 0 | }; |
702 | |
|
703 | 0 | trans_item = proto_tree_add_item(tree, hf_xmpp_jingle_cont_trans, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
704 | 0 | trans_tree = proto_item_add_subtree(trans_item, ett_xmpp_jingle_cont_trans); |
705 | |
|
706 | 0 | xmpp_display_attrs(trans_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
707 | 0 | xmpp_display_elems(trans_tree, element, pinfo, tvb, NULL, 0); |
708 | 0 | } |
709 | | |
710 | | /*XEP-0234: Jingle File Transfer urn:xmpp:jingle:apps:file-transfer:3*/ |
711 | | static void |
712 | | xmpp_jingle_file_transfer_desc(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
713 | 0 | { |
714 | 0 | proto_item *desc_item; |
715 | 0 | proto_tree *desc_tree; |
716 | |
|
717 | 0 | xmpp_attr_info attrs_info[] = { |
718 | 0 | {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL} |
719 | 0 | }; |
720 | |
|
721 | 0 | xmpp_elem_info elems_info[] = { |
722 | 0 | {NAME, "offer", xmpp_jingle_file_transfer_offer, ONE}, |
723 | 0 | {NAME, "request", xmpp_jingle_file_transfer_request, ONE} |
724 | 0 | }; |
725 | |
|
726 | 0 | desc_item = proto_tree_add_item(tree, hf_xmpp_jingle_content_description, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
727 | 0 | desc_tree = proto_item_add_subtree(desc_item, ett_xmpp_jingle_content_description); |
728 | |
|
729 | 0 | xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
730 | 0 | xmpp_display_elems(desc_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
731 | 0 | } |
732 | | |
733 | | static void |
734 | | xmpp_jingle_file_transfer_offer(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
735 | 0 | { |
736 | 0 | proto_item *offer_item; |
737 | 0 | proto_tree *offer_tree; |
738 | |
|
739 | 0 | xmpp_elem_info elems_info[] = { |
740 | 0 | {NAME, "file", xmpp_jingle_file_transfer_file, MANY}, |
741 | 0 | }; |
742 | |
|
743 | 0 | offer_item = proto_tree_add_item(tree, hf_xmpp_jingle_file_transfer_offer, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
744 | 0 | offer_tree = proto_item_add_subtree(offer_item, ett_xmpp_jingle_file_transfer_offer); |
745 | |
|
746 | 0 | xmpp_display_attrs(offer_tree, element, pinfo, tvb, NULL, 0); |
747 | 0 | xmpp_display_elems(offer_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
748 | 0 | } |
749 | | |
750 | | static void |
751 | | xmpp_jingle_file_transfer_request(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
752 | 0 | { |
753 | 0 | proto_item *request_item; |
754 | 0 | proto_tree *request_tree; |
755 | |
|
756 | 0 | xmpp_elem_info elems_info[] = { |
757 | 0 | {NAME, "file", xmpp_jingle_file_transfer_file, MANY}, |
758 | 0 | }; |
759 | |
|
760 | 0 | request_item = proto_tree_add_item(tree, hf_xmpp_jingle_file_transfer_request, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
761 | 0 | request_tree = proto_item_add_subtree(request_item, ett_xmpp_jingle_file_transfer_request); |
762 | |
|
763 | 0 | xmpp_display_attrs(request_tree, element, pinfo, tvb, NULL, 0); |
764 | 0 | xmpp_display_elems(request_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
765 | 0 | } |
766 | | |
767 | | static void |
768 | | xmpp_jingle_file_transfer_received(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
769 | 0 | { |
770 | 0 | proto_item *received_item; |
771 | 0 | proto_tree *received_tree; |
772 | |
|
773 | 0 | xmpp_elem_info elems_info[] = { |
774 | 0 | {NAME, "file", xmpp_jingle_file_transfer_file, MANY}, |
775 | 0 | }; |
776 | |
|
777 | 0 | received_item = proto_tree_add_item(tree, hf_xmpp_jingle_file_transfer_received, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
778 | 0 | received_tree = proto_item_add_subtree(received_item, ett_xmpp_jingle_file_transfer_received); |
779 | |
|
780 | 0 | xmpp_display_attrs(received_tree, element, pinfo, tvb, NULL, 0); |
781 | 0 | xmpp_display_elems(received_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
782 | 0 | } |
783 | | |
784 | | static void |
785 | | xmpp_jingle_file_transfer_abort(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
786 | 0 | { |
787 | 0 | proto_item *abort_item; |
788 | 0 | proto_tree *abort_tree; |
789 | |
|
790 | 0 | xmpp_elem_info elems_info[] = { |
791 | 0 | {NAME, "file", xmpp_jingle_file_transfer_file, MANY}, |
792 | 0 | }; |
793 | |
|
794 | 0 | abort_item = proto_tree_add_item(tree, hf_xmpp_jingle_file_transfer_abort, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
795 | 0 | abort_tree = proto_item_add_subtree(abort_item, ett_xmpp_jingle_file_transfer_abort); |
796 | |
|
797 | 0 | xmpp_display_attrs(abort_tree, element, pinfo, tvb, NULL, 0); |
798 | 0 | xmpp_display_elems(abort_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
799 | 0 | } |
800 | | |
801 | | static void |
802 | | xmpp_jingle_file_transfer_checksum(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
803 | 0 | { |
804 | 0 | proto_item *checksum_item; |
805 | 0 | proto_tree *checksum_tree; |
806 | |
|
807 | 0 | xmpp_elem_info elems_info[] = { |
808 | 0 | {NAME, "file", xmpp_jingle_file_transfer_file, MANY}, |
809 | 0 | }; |
810 | |
|
811 | 0 | checksum_item = proto_tree_add_item(tree, hf_xmpp_jingle_file_transfer_checksum, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
812 | 0 | checksum_tree = proto_item_add_subtree(checksum_item, ett_xmpp_jingle_file_transfer_checksum); |
813 | |
|
814 | 0 | xmpp_display_attrs(checksum_tree, element, pinfo, tvb, NULL, 0); |
815 | 0 | xmpp_display_elems(checksum_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
816 | 0 | } |
817 | | |
818 | | static void |
819 | | xmpp_jingle_file_transfer_file(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) |
820 | 0 | { |
821 | 0 | proto_tree *file_tree; |
822 | |
|
823 | 0 | xmpp_attr_info attrs_info[] = { |
824 | 0 | {"name", NULL, false, true, NULL, NULL}, |
825 | 0 | {"size", NULL, false, true, NULL, NULL}, |
826 | 0 | {"date", NULL, false, true, NULL, NULL} |
827 | 0 | }; |
828 | |
|
829 | 0 | xmpp_elem_info elems_info[] = { |
830 | 0 | {NAME, "hashes", xmpp_hashes, ONE} |
831 | 0 | }; |
832 | |
|
833 | 0 | file_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_jingle_file_transfer_file, NULL, "FILE"); |
834 | |
|
835 | 0 | xmpp_change_elem_to_attrib(pinfo->pool, "name", "name", element, xmpp_transform_func_cdata); |
836 | 0 | xmpp_change_elem_to_attrib(pinfo->pool, "size", "size", element, xmpp_transform_func_cdata); |
837 | 0 | xmpp_change_elem_to_attrib(pinfo->pool, "date", "date", element, xmpp_transform_func_cdata); |
838 | |
|
839 | 0 | xmpp_display_attrs(file_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
840 | 0 | xmpp_display_elems(file_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
841 | 0 | } |
842 | | |
843 | | /*XEP-0278: Jingle Relay Nodes http://jabber.org/protocol/jinglenodes*/ |
844 | | void |
845 | | xmpp_jinglenodes_services(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
846 | 0 | { |
847 | 0 | proto_item *services_item; |
848 | 0 | proto_tree *services_tree; |
849 | |
|
850 | 0 | xmpp_attr_info attrs_info[] = { |
851 | 0 | {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL} |
852 | 0 | }; |
853 | |
|
854 | 0 | xmpp_elem_info elems_info[] = { |
855 | 0 | {NAME, "relay", xmpp_jinglenodes_relay_stun_tracker, ONE}, |
856 | 0 | {NAME, "tracker", xmpp_jinglenodes_relay_stun_tracker, ONE}, |
857 | 0 | {NAME, "stun", xmpp_jinglenodes_relay_stun_tracker, ONE}, |
858 | 0 | }; |
859 | |
|
860 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "SERVICES "); |
861 | |
|
862 | 0 | services_item = proto_tree_add_item(tree, hf_xmpp_services, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
863 | 0 | services_tree = proto_item_add_subtree(services_item, ett_xmpp_services); |
864 | |
|
865 | 0 | xmpp_display_attrs(services_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
866 | 0 | xmpp_display_elems(services_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); |
867 | 0 | } |
868 | | |
869 | | static void |
870 | | xmpp_jinglenodes_relay_stun_tracker(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
871 | 0 | { |
872 | 0 | proto_tree *relay_tree; |
873 | |
|
874 | 0 | xmpp_attr_info attrs_info[] = { |
875 | 0 | {"address", NULL, true, true, NULL, NULL}, |
876 | 0 | {"port", NULL, false, true, NULL, NULL}, |
877 | 0 | {"policy", NULL, true, true, NULL, NULL}, |
878 | 0 | {"protocol", NULL, true, true, NULL, NULL}, |
879 | 0 | }; |
880 | |
|
881 | 0 | relay_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_services_relay, NULL, element->name); |
882 | |
|
883 | 0 | xmpp_display_attrs(relay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
884 | 0 | xmpp_display_elems(relay_tree, element, pinfo, tvb, NULL, 0); |
885 | 0 | } |
886 | | |
887 | | void |
888 | | xmpp_jinglenodes_channel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) |
889 | 0 | { |
890 | 0 | proto_item *channel_item; |
891 | 0 | proto_tree *channel_tree; |
892 | |
|
893 | 0 | xmpp_attr_info attrs_info[] = { |
894 | 0 | {"xmlns", &hf_xmpp_xmlns, true, false, NULL, NULL}, |
895 | 0 | {"id", NULL, false, false, NULL, NULL}, |
896 | 0 | {"host", NULL, false, true, NULL, NULL}, |
897 | 0 | {"localport", NULL, false, true, NULL, NULL}, |
898 | 0 | {"remoteport", NULL, false, true, NULL, NULL}, |
899 | 0 | {"protocol", NULL, true, true, NULL, NULL}, |
900 | 0 | {"maxkbps", NULL, false, false, NULL, NULL}, |
901 | 0 | {"expire", NULL, false, false, NULL, NULL}, |
902 | 0 | }; |
903 | |
|
904 | 0 | channel_item = proto_tree_add_item(tree, hf_xmpp_channel, tvb, element->offset, element->length, ENC_BIG_ENDIAN); |
905 | 0 | channel_tree = proto_item_add_subtree(channel_item, ett_xmpp_channel); |
906 | |
|
907 | 0 | xmpp_display_attrs(channel_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); |
908 | 0 | xmpp_display_elems(channel_tree, element, pinfo, tvb, NULL, 0); |
909 | 0 | } |
910 | | /* |
911 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
912 | | * |
913 | | * Local variables: |
914 | | * c-basic-offset: 4 |
915 | | * tab-width: 8 |
916 | | * indent-tabs-mode: nil |
917 | | * End: |
918 | | * |
919 | | * ex: set shiftwidth=4 tabstop=8 expandtab: |
920 | | * :indentSize=4:tabSize=8:noTabs=true: |
921 | | */ |