Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-xmpp-gtalk.c
blob76803fe4c568c4ccdeb95d9a650a76ee0672b161
1 /* xmpp-gtalk.c
2 * Wireshark's XMPP dissector.
4 * GTalk extensions.
6 * Copyright 2011, Mariusz Okroj <okrojmariusz[]gmail.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include "config.h"
17 #include <epan/packet.h>
19 #include "packet-xmpp.h"
20 #include "packet-xmpp-gtalk.h"
21 #include "packet-xmpp-conference.h"
24 static void xmpp_gtalk_session_desc(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
25 static void xmpp_gtalk_session_desc_payload(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
26 static void xmpp_gtalk_session_cand(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
27 static void xmpp_gtalk_session_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
28 static void xmpp_gtalk_jingleinfo_stun(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
29 static void xmpp_gtalk_jingleinfo_server(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
30 static void xmpp_gtalk_jingleinfo_relay(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
31 static void xmpp_gtalk_jingleinfo_relay_serv(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
32 static void xmpp_gtalk_mail_mail_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
33 static void xmpp_gtalk_mail_senders(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
34 static void xmpp_gtalk_mail_sender(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
35 static void xmpp_gtalk_mail_snippet(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
36 static void xmpp_gtalk_status_status_list(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
37 static void xmpp_gtalk_transport_p2p_cand(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element);
39 void
40 xmpp_gtalk_session(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
42 proto_item *session_item;
43 proto_tree *session_tree;
45 xmpp_attr_info attrs_info [] = {
46 {"xmlns", &hf_xmpp_xmlns, true, false, NULL, NULL},
47 {"type", &hf_xmpp_gtalk_session_type, true, true, NULL, NULL},
48 {"initiator", NULL, false, true, NULL, NULL},
49 {"id", NULL, true, true, NULL, NULL}
52 xmpp_elem_info elems_info [] = {
53 {NAME,"description", xmpp_gtalk_session_desc, ONE},
54 {NAME, "candidate", xmpp_gtalk_session_cand, MANY},
55 {NAME, "reason", xmpp_gtalk_session_reason, ONE},
56 {NAME_AND_ATTR, xmpp_name_attr_struct(pinfo->pool, "transport", "xmlns", "http://www.google.com/transport/p2p"), xmpp_gtalk_transport_p2p, ONE},
57 {NAME, "conference-info", xmpp_conferece_info_advert, ONE}
60 xmpp_attr_t *attr_type = xmpp_get_attr(element, "type");
62 col_append_fstr(pinfo->cinfo, COL_INFO, "GTALK-SESSION(%s) ", attr_type?attr_type->value:"");
64 session_item = proto_tree_add_item(tree, hf_xmpp_gtalk_session, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
65 session_tree = proto_item_add_subtree(session_item, ett_xmpp_gtalk_session);
67 xmpp_display_attrs(session_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
69 xmpp_display_elems(session_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
72 static void
73 xmpp_gtalk_session_desc(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
75 proto_tree *desc_tree;
77 xmpp_attr_info attrs_info[] = {
78 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
79 {"xml:lang", NULL, false, false, NULL, NULL}
82 xmpp_elem_info elems_info[] = {
83 {NAME, "payload-type", xmpp_gtalk_session_desc_payload, MANY}
86 desc_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_session_desc, NULL, "DESCRIPTION");
88 xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
89 xmpp_display_elems(desc_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
92 static void
93 xmpp_gtalk_session_desc_payload(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
95 proto_tree *payload_tree;
97 xmpp_attr_info attrs_info[] = {
98 {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL},
99 {"id", NULL, false, true, NULL, NULL},
100 {"name", NULL, false, true, NULL, NULL},
101 {"channels", NULL, false, false, NULL, NULL},
102 {"clockrate", NULL, false, false, NULL, NULL},
103 {"bitrate", NULL, false, false, NULL, NULL},
104 {"width", NULL, false, false, NULL, NULL},
105 {"height", NULL, false, false, NULL, NULL},
106 {"framerate", NULL, false, false, NULL, NULL},
109 payload_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_session_desc_payload, NULL, "PAYLOAD-TYPE");
111 xmpp_display_attrs(payload_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
112 xmpp_display_elems(payload_tree, element, pinfo, tvb, NULL, 0);
115 static void
116 xmpp_gtalk_session_cand(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
118 proto_tree *cand_tree;
120 xmpp_attr_info attrs_info[] = {
121 {"name", NULL, true, true, NULL, NULL},
122 {"address", NULL, true, false, NULL, NULL},
123 {"port", NULL, true, false, NULL, NULL},
124 {"preference", NULL, true, false, NULL, NULL},
125 {"type", NULL, true, true, NULL, NULL},
126 {"protocol", NULL, true, true, NULL, NULL},
127 {"network", NULL, true, false, NULL, NULL},
128 {"username", NULL, true, false, NULL, NULL},
129 {"password", NULL, true, false, NULL, NULL},
130 {"generation", NULL, true, false, NULL, NULL},
131 {"foundation", NULL, false, false, NULL, NULL},
132 {"component", NULL, false, false, NULL, NULL}
135 cand_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_session_cand, NULL, "CANDIDATE");
137 xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
138 xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0);
141 static void
142 xmpp_gtalk_session_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
144 proto_tree *reason_tree;
146 xmpp_attr_info attrs_info[] = {
147 {"condition", NULL, true, true, NULL, NULL},
148 {"text", NULL, false, false, NULL, NULL}
151 xmpp_element_t *condition;
152 xmpp_element_t *text;
154 static const char *reason_names[] = { "success", "busy", "cancel"};
156 reason_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_session_reason, NULL, "REASON");
159 /*Looks for reason description.*/
160 if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL)
162 xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(pinfo->pool, condition->name, condition->offset, condition->length);
163 g_hash_table_insert(element->attrs, (void *)"condition", fake_cond);
167 if((text = xmpp_steal_element_by_name(element, "text"))!=NULL)
169 xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(pinfo->pool, text->data?text->data->value:"", text->offset, text->length);
170 g_hash_table_insert(element->attrs, (void *)"text", fake_text);
173 xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
175 xmpp_unknown(reason_tree, tvb, pinfo, element);
178 void
179 xmpp_gtalk_jingleinfo_query(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
181 proto_item *query_item;
182 proto_tree *query_tree;
184 xmpp_attr_info attrs_info[] = {
185 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL}
188 xmpp_elem_info elems_info [] = {
189 {NAME, "stun", xmpp_gtalk_jingleinfo_stun, ONE},
190 {NAME, "relay", xmpp_gtalk_jingleinfo_relay, ONE}
193 col_append_str(pinfo->cinfo, COL_INFO, "QUERY(google:jingleinfo) ");
195 query_item = proto_tree_add_item(tree, hf_xmpp_query, tvb, element->offset, element->length,
196 ENC_BIG_ENDIAN);
197 query_tree = proto_item_add_subtree(query_item, ett_xmpp_query);
199 xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
200 xmpp_display_elems(query_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
203 static void
204 xmpp_gtalk_jingleinfo_stun(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
206 proto_tree *stun_tree;
208 xmpp_elem_info elems_info [] = {
209 {NAME, "server", xmpp_gtalk_jingleinfo_server, MANY},
212 stun_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_jingleinfo_stun, NULL, "STUN");
214 xmpp_display_attrs(stun_tree, element, pinfo, tvb, NULL, 0);
215 xmpp_display_elems(stun_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
219 static void
220 xmpp_gtalk_jingleinfo_server(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
222 proto_tree *serv_tree;
224 xmpp_attr_info attrs_info[] = {
225 {"host", NULL, true, true, NULL, NULL},
226 {"udp", NULL, true, true, NULL, NULL}
229 serv_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_jingleinfo_server, NULL, "SERVER");
231 xmpp_display_attrs(serv_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
232 xmpp_display_elems(serv_tree, element, pinfo, tvb, NULL, 0);
235 static void
236 xmpp_gtalk_jingleinfo_relay(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
238 proto_tree *relay_tree;
240 xmpp_attr_info attrs_info[] = {
241 {"token", NULL, false, false, NULL, NULL}
244 xmpp_elem_info elems_info [] = {
245 {NAME, "server", xmpp_gtalk_jingleinfo_relay_serv, ONE}
248 xmpp_element_t *token;
250 relay_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_jingleinfo_relay, NULL, "RELAY");
252 if((token = xmpp_steal_element_by_name(element, "token"))!=NULL)
254 xmpp_attr_t *fake_token = xmpp_ep_init_attr_t(pinfo->pool, token->data?token->data->value:"", token->offset, token->length);
255 g_hash_table_insert(element->attrs, (void *)"token", fake_token);
258 xmpp_display_attrs(relay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
259 xmpp_display_elems(relay_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
262 static void
263 xmpp_gtalk_jingleinfo_relay_serv(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
265 proto_tree *serv_tree;
267 xmpp_attr_info attrs_info[] = {
268 {"host", NULL, true, true, NULL, NULL},
269 {"udp", NULL, false, true, NULL, NULL},
270 {"tcp", NULL, false, true, NULL, NULL},
271 {"tcpssl", NULL, false, true, NULL, NULL}
274 serv_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_jingleinfo_relay_serv, NULL, "SERVER");
276 xmpp_display_attrs(serv_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
277 xmpp_display_elems(serv_tree, element, pinfo, tvb, NULL, 0);
280 void
281 xmpp_gtalk_usersetting(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
283 proto_item *sett_item;
284 proto_tree *sett_tree;
286 xmpp_attr_info attrs_info [] = {
287 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL}
290 unsigned i;
292 sett_item = proto_tree_add_item(tree, hf_xmpp_gtalk_setting, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
293 sett_tree = proto_item_add_subtree(sett_item, ett_xmpp_gtalk_setting);
295 xmpp_display_attrs(sett_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
297 for(i = 0; i < g_list_length(element->elements); i++)
299 GList *elem_l = g_list_nth(element->elements,i);
300 xmpp_element_t *elem = (xmpp_element_t *)(elem_l?elem_l->data:NULL);
302 if(elem)
304 xmpp_attr_t *val = xmpp_get_attr(elem,"value");
305 proto_tree_add_string_format(sett_tree, hf_xmpp_gtalk_setting_element, tvb, elem->offset, elem->length, val?val->value:"",
306 "%s [%s]",elem->name,val?val->value:"");
311 void
312 xmpp_gtalk_nosave_x(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
314 proto_item *x_item;
315 proto_tree *x_tree;
317 xmpp_attr_info attrs_info [] = {
318 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
319 {"value", NULL, false, true, NULL, NULL}
322 x_item = proto_tree_add_item(tree, hf_xmpp_gtalk_nosave_x, tvb, element->offset, element->length,
323 ENC_BIG_ENDIAN);
324 x_tree = proto_item_add_subtree(x_item, ett_xmpp_gtalk_nosave_x);
326 xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
327 xmpp_display_elems(x_tree, element, pinfo, tvb, NULL, 0);
330 void
331 xmpp_gtalk_mail_query(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
333 proto_item *query_item;
334 proto_tree *query_tree;
336 xmpp_attr_info attrs_info[] = {
337 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
338 {"newer-than-time", NULL, false, true, NULL, NULL},
339 {"newer-than-tid", NULL, false, true, NULL, NULL},
340 {"q", NULL, false, true, NULL, NULL}
343 col_append_str(pinfo->cinfo, COL_INFO, "QUERY(google:mail:notify) ");
345 query_item = proto_tree_add_item(tree, hf_xmpp_query, tvb, element->offset, element->length,
346 ENC_BIG_ENDIAN);
347 query_tree = proto_item_add_subtree(query_item, ett_xmpp_query);
349 xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
350 xmpp_display_elems(query_tree, element, pinfo, tvb, NULL, 0);
353 void
354 xmpp_gtalk_mail_mailbox(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
356 proto_item *mail_item;
357 proto_tree *mail_tree;
359 xmpp_attr_info attrs_info [] = {
360 {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL},
361 {"result-time", NULL, false, true, NULL, NULL},
362 {"total-matched", NULL, false, true, NULL, NULL},
363 {"total-estimate", NULL, false, true, NULL, NULL},
364 {"url", NULL, false, true, NULL, NULL}
367 xmpp_elem_info elems_info [] = {
368 {NAME,"mail-thread-info", xmpp_gtalk_mail_mail_info, MANY}
371 col_append_str(pinfo->cinfo, COL_INFO, "MAILBOX ");
373 mail_item = proto_tree_add_item(tree, hf_xmpp_gtalk_mail_mailbox, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
374 mail_tree = proto_item_add_subtree(mail_item, ett_xmpp_gtalk_mail_mailbox);
376 xmpp_display_attrs(mail_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
377 xmpp_display_elems(mail_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
380 static void
381 xmpp_gtalk_mail_mail_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
383 proto_tree *mail_info_tree;
385 xmpp_attr_info attrs_info [] = {
386 {"tid", NULL, false, false, NULL, NULL},
387 {"participation", NULL, false, false, NULL, NULL},
388 {"messages", NULL, false, true, NULL, NULL},
389 {"date", NULL, false, true, NULL, NULL},
390 {"url", NULL, false, false, NULL, NULL},
391 {"labels", NULL, false, false, NULL, NULL},
392 {"subject", NULL, false, true, NULL, NULL}
395 xmpp_elem_info elems_info [] = {
396 {NAME, "senders", xmpp_gtalk_mail_senders, ONE},
397 {NAME, "snippet", xmpp_gtalk_mail_snippet, ONE}/*or MANY?*/
400 xmpp_element_t *labels, *subject;
402 mail_info_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_mail_mail_info, NULL, "MAIL-THREAD-INFO");
404 if((labels = xmpp_steal_element_by_name(element,"labels"))!=NULL)
406 xmpp_attr_t *fake_labels = xmpp_ep_init_attr_t(pinfo->pool, labels->data?labels->data->value:"",labels->offset, labels->length);
407 g_hash_table_insert(element->attrs, (void *)"labels", fake_labels);
409 if((subject = xmpp_steal_element_by_name(element,"subject"))!=NULL)
411 xmpp_attr_t *fake_subject = xmpp_ep_init_attr_t(pinfo->pool, subject->data?subject->data->value:"",subject->offset, subject->length);
412 g_hash_table_insert(element->attrs, (void *)"subject", fake_subject);
415 xmpp_display_attrs(mail_info_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
416 xmpp_display_elems(mail_info_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
420 static void
421 xmpp_gtalk_mail_senders(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
423 proto_tree *senders_tree;
425 xmpp_elem_info elems_info [] = {
426 {NAME, "sender", xmpp_gtalk_mail_sender, MANY}
429 senders_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_mail_senders, NULL, "SENDERS");
431 xmpp_display_attrs(senders_tree, element, pinfo, tvb, NULL, 0);
432 xmpp_display_elems(senders_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
435 static void
436 xmpp_gtalk_mail_sender(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
438 proto_tree *sender_tree;
440 xmpp_attr_info attrs_info [] = {
441 {"name", NULL, false, true, NULL, NULL},
442 {"address", NULL, false, true, NULL, NULL},
443 {"originator", NULL, false, true, NULL, NULL},
444 {"unread", NULL, false, true, NULL, NULL}
447 sender_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_mail_sender, NULL, "SENDER");
449 xmpp_display_attrs(sender_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
450 xmpp_display_elems(sender_tree, element, pinfo, tvb, NULL, 0);
453 static void
454 xmpp_gtalk_mail_snippet(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
456 proto_tree_add_string(tree, hf_xmpp_gtalk_mail_snippet, tvb, element->offset, element->length, element->data?element->data->value:"");
457 xmpp_unknown(tree, tvb, pinfo, element);
460 void
461 xmpp_gtalk_mail_new_mail(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
463 col_append_str(pinfo->cinfo, COL_INFO, "NEW-MAIL ");
464 proto_tree_add_item(tree, hf_xmpp_gtalk_mail_new_mail, tvb, element->offset, element->length,
465 ENC_BIG_ENDIAN);
466 xmpp_unknown(tree, tvb, pinfo, element);
470 void
471 xmpp_gtalk_status_query(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
473 proto_item *query_item;
474 proto_tree *query_tree;
476 xmpp_attr_info attrs_info[] = {
477 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
478 {"version", NULL, false, true, NULL, NULL},
479 {"status-max", NULL, false, false, NULL, NULL},
480 {"status-list-max", NULL, false, false, NULL, NULL},
481 {"status-list-contents-max", NULL, false, false, NULL, NULL},
482 {"status-min-ver", NULL, false, true, NULL, NULL},
483 {"show", NULL, false, true, NULL, NULL},
484 {"status", NULL, false, true, NULL, NULL},
485 {"invisible", NULL, false, true, NULL, NULL},
488 xmpp_elem_info elems_info [] = {
489 {NAME, "status-list", xmpp_gtalk_status_status_list, MANY}
492 xmpp_element_t *status, *show, *invisible;
494 col_append_str(pinfo->cinfo, COL_INFO, "QUERY(google:shared-status) ");
496 query_item = proto_tree_add_item(tree, hf_xmpp_query, tvb, element->offset, element->length,
497 ENC_BIG_ENDIAN);
498 query_tree = proto_item_add_subtree(query_item, ett_xmpp_query);
500 if((status = xmpp_steal_element_by_name(element,"status"))!=NULL)
502 xmpp_attr_t *fake_status = xmpp_ep_init_attr_t(pinfo->pool, status->data?status->data->value:"",status->offset, status->length);
503 g_hash_table_insert(element->attrs, (void *)"status", fake_status);
506 if((show = xmpp_steal_element_by_name(element,"show"))!=NULL)
508 xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(pinfo->pool, show->data?show->data->value:"",show->offset, show->length);
509 g_hash_table_insert(element->attrs, (void *)"show", fake_show);
512 if((invisible = xmpp_steal_element_by_name(element,"invisible"))!=NULL)
514 xmpp_attr_t *value = xmpp_get_attr(invisible, "value");
515 xmpp_attr_t *fake_invisible = xmpp_ep_init_attr_t(pinfo->pool, value?value->value:"",invisible->offset, invisible->length);
516 g_hash_table_insert(element->attrs, (void *)"invisible", fake_invisible);
519 xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
520 xmpp_display_elems(query_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
523 static void
524 xmpp_gtalk_status_status_list(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
526 proto_tree *list_tree;
528 xmpp_attr_info attrs_info [] = {
529 {"show", NULL, true, true, NULL, NULL}
532 xmpp_element_t *status;
534 list_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_status_status_list, NULL, "STATUS LIST");
536 while((status = xmpp_steal_element_by_name(element, "status"))!=NULL)
538 proto_tree_add_string(list_tree, hf_xmpp_gtalk_status_status_list, tvb, status->offset, status->length, status->data?status->data->value:"");
541 xmpp_display_attrs(list_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
542 xmpp_display_elems(list_tree, element, pinfo, tvb, NULL, 0);
545 /*http://www.google.com/transport/p2p*/
546 void
547 xmpp_gtalk_transport_p2p(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element)
549 proto_item *trans_item;
550 proto_tree *trans_tree;
552 xmpp_attr_info attrs_info[] = {
553 {"xmlns", &hf_xmpp_xmlns, false, true, NULL, NULL}
556 xmpp_elem_info elems_info [] = {
557 {NAME, "candidate", xmpp_gtalk_transport_p2p_cand, MANY}
560 trans_item = proto_tree_add_item(tree, hf_xmpp_gtalk_transport_p2p, tvb, element->offset, element->length, ENC_BIG_ENDIAN);
561 trans_tree = proto_item_add_subtree(trans_item, ett_xmpp_gtalk_transport_p2p);
563 xmpp_display_attrs(trans_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
565 xmpp_display_elems(trans_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
568 static void
569 xmpp_gtalk_transport_p2p_cand(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) {
570 proto_tree *cand_tree;
572 xmpp_attr_info attrs_info[] = {
573 {"xmlns", &hf_xmpp_xmlns, false, false, NULL, NULL},
574 {"name", NULL, false, true, NULL, NULL},
575 {"generation", NULL, false, false, NULL, NULL},
576 {"network", NULL, false, false, NULL, NULL},
577 {"component", NULL, false, false, NULL, NULL},
578 {"type", NULL, false, false, NULL, NULL},
579 {"protocol", NULL, false, true, NULL, NULL},
580 {"preference", NULL, false, false, NULL, NULL},
581 {"password", NULL, false, false, NULL, NULL},
582 {"username", NULL, false, false, NULL, NULL},
583 {"port", NULL, false, true, NULL, NULL},
584 {"address", NULL, false, true, NULL, NULL}
587 cand_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_transport_p2p_cand, NULL, "CANDIDATE");
589 xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
590 xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0);
594 * Editor modelines - https://www.wireshark.org/tools/modelines.html
596 * Local variables:
597 * c-basic-offset: 4
598 * tab-width: 8
599 * indent-tabs-mode: nil
600 * End:
602 * ex: set shiftwidth=4 tabstop=8 expandtab:
603 * :indentSize=4:tabSize=8:noTabs=true: