Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-xmpp-conference.c
blob66bccef9ce4d51e59e2abf05b4b1d60ff0cfdb3b
1 /* xmpp-conference.c
2 * Wireshark's XMPP dissector.
4 * XEP-0298: Delivering Conference Information to Jingle Participants (Coin)
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-conference.h"
23 static void xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
24 static void xmpp_conf_state(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
25 static void xmpp_conf_users(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
26 static void xmpp_conf_user(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
27 static void xmpp_conf_endpoint(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
28 static void xmpp_conf_media(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element);
30 void
31 xmpp_conferece_info_advert(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
33 proto_item *cinfo_item;
34 proto_tree *cinfo_tree;
36 xmpp_attr_info attrs_info [] = {
37 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
38 {"isfocus", NULL, true, true, NULL, NULL}
41 cinfo_item = proto_tree_add_item(tree, hf_xmpp_conf_info, tvb, element->offset, element->length,
42 ENC_BIG_ENDIAN);
43 cinfo_tree = proto_item_add_subtree(cinfo_item, ett_xmpp_conf_info);
45 xmpp_display_attrs(cinfo_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
46 xmpp_display_elems(cinfo_tree, element, pinfo, tvb, NULL, 0);
49 void
50 xmpp_conference_info(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
52 proto_item *cinfo_item;
53 proto_tree *cinfo_tree;
55 static const char *state_enums[] = {"full", "partial", "deleted"};
56 xmpp_array_t *state_array = xmpp_ep_init_array_t(pinfo->pool, state_enums, array_length(state_enums));
58 xmpp_attr_info attrs_info [] = {
59 {"xmlns", &hf_xmpp_xmlns, true, true, NULL, NULL},
60 {"entity", NULL, true, true, NULL, NULL},
61 {"state", NULL, false, true, xmpp_val_enum_list, state_array},
62 {"version", NULL, false, true, NULL, NULL},
63 {"sid", &hf_xmpp_conf_info_sid, false, true, NULL, NULL}
66 xmpp_elem_info elems_info [] = {
67 {NAME, "conference-description", xmpp_conf_desc, ONE},
68 {NAME, "conference-state", xmpp_conf_state, ONE},
69 /*{NAME, "host-info", xmpp_conf_host_info, ONE},*/
70 {NAME, "users", xmpp_conf_users, ONE},
71 /*{NAME, "sidebars-by-ref", xmpp_conf_sidebars_by_ref, ONE},*/
72 /*{NAME, "sidebars-by-val", xmpp_conf_sidebars_by_val, ONE},*/
75 col_append_str(pinfo->cinfo, COL_INFO, "CONFERENC-INFO ");
77 cinfo_item = proto_tree_add_item(tree, hf_xmpp_conf_info, tvb, element->offset, element->length,
78 ENC_BIG_ENDIAN);
79 cinfo_tree = proto_item_add_subtree(cinfo_item, ett_xmpp_conf_info);
81 xmpp_display_attrs(cinfo_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
82 xmpp_display_elems(cinfo_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
85 static void
86 xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
88 proto_tree *desc_tree;
90 xmpp_attr_info attrs_info [] = {
91 {"subject", NULL, false, true, NULL, NULL},
92 {"display-text", NULL, false, false, NULL, NULL},
93 {"free-text", NULL, false, false, NULL, NULL},
94 {"max-user-count", NULL, false, false, NULL, NULL},
98 xmpp_elem_info elems_info [] = {
99 {NAME, "keywords", xmpp_conf_desc_keywords, ONE},
100 {NAME, "conf-uris", xmpp_conf_desc_conf_uris, ONE},
101 {NAME, "service-uris", xmpp_conf_desc_serv_uris, ONE},
102 {NAME, "available-media", xmpp_conf_desc_avil_media, ONE},
106 desc_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_desc, NULL, "CONFERENCE DESCRIPTION");
108 xmpp_change_elem_to_attrib(pinfo->pool, "subject", "subject", element, xmpp_transform_func_cdata);
109 xmpp_change_elem_to_attrib(pinfo->pool, "display-text", "display-text", element, xmpp_transform_func_cdata);
110 xmpp_change_elem_to_attrib(pinfo->pool, "free-text", "free-text", element, xmpp_transform_func_cdata);
111 xmpp_change_elem_to_attrib(pinfo->pool, "maximum-user-count", "max-user-count", element, xmpp_transform_func_cdata);
113 xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
114 xmpp_display_elems(desc_tree, element, pinfo, tvb, NULL,0);
117 static void
118 xmpp_conf_state(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
120 proto_tree *state_tree;
122 xmpp_attr_info attrs_info [] = {
123 {"user-count", NULL, false, true, NULL, NULL},
124 {"active", NULL, false, true, NULL, NULL},
125 {"locked", NULL, false, true, NULL, NULL}
128 state_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length,
129 ett_xmpp_conf_state, NULL, "CONFERENCE STATE");
131 xmpp_change_elem_to_attrib(pinfo->pool, "user-count", "user-count", element, xmpp_transform_func_cdata);
132 xmpp_change_elem_to_attrib(pinfo->pool, "active", "active", element, xmpp_transform_func_cdata);
133 xmpp_change_elem_to_attrib(pinfo->pool, "locked", "locked", element, xmpp_transform_func_cdata);
135 xmpp_display_attrs(state_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
136 xmpp_display_elems(state_tree, element, pinfo, tvb, NULL,0);
140 static void
141 xmpp_conf_users(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
143 proto_tree *users_tree;
145 xmpp_attr_info attrs_info [] = {
146 {"state", NULL, false, true, NULL, NULL}
149 xmpp_elem_info elems_info [] = {
150 {NAME, "user", xmpp_conf_user, MANY}
153 users_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_users, NULL, "USERS");
155 xmpp_display_attrs(users_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
156 xmpp_display_elems(users_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
158 static void
159 xmpp_conf_user(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
161 proto_tree *user_tree;
163 xmpp_attr_info attrs_info [] = {
164 {"entity", NULL, false, true, NULL, NULL},
165 {"state", NULL, false, true, NULL, NULL},
166 {"display-text", NULL, false, true, NULL, NULL},
167 {"cascaded-focus", NULL, false, true, NULL, NULL}
170 xmpp_elem_info elems_info [] = {
171 /*{NAME, "associated-aors", xmpp_conf_assoc_aors, ONE},*/
172 /*{NAME, "roles", xmpp_conf_roles, ONE},*/
173 /*{NAME, "languages", xmpp_conf_langs, ONE},*/
174 {NAME, "endpoint", xmpp_conf_endpoint, MANY},
177 user_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_user, NULL, "USERS");
179 xmpp_change_elem_to_attrib(pinfo->pool, "display-text", "display-text", element, xmpp_transform_func_cdata);
180 xmpp_change_elem_to_attrib(pinfo->pool, "cascaded-focus", "cascaded-focus", element, xmpp_transform_func_cdata);
182 xmpp_display_attrs(user_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
183 xmpp_display_elems(user_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
186 static void
187 xmpp_conf_endpoint(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
189 proto_tree *endpoint_tree;
191 xmpp_attr_info attrs_info [] = {
192 {"entity", NULL, false, true, NULL, NULL},
193 {"state", NULL, false, true, NULL, NULL},
194 {"display-text", NULL, false, true, NULL, NULL},
195 {"status", NULL, false, true, NULL, NULL},
196 {"joining-method", NULL, false, true, NULL, NULL},
197 {"disconnection-method", NULL, false, true, NULL, NULL},
200 xmpp_elem_info elems_info [] = {
201 /*{NAME,"referred",...,ONE},*/
202 /*{NAME,"joining-info",...,ONE},*/
203 /*{NAME,"disconnection-info",...,ONE},*/
204 {NAME,"media", xmpp_conf_media, ONE},
205 /*{NAME,"call-info",...,ONE},*/
209 endpoint_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_endpoint, NULL, "ENDPOINT");
211 xmpp_change_elem_to_attrib(pinfo->pool, "display-text", "display-text", element, xmpp_transform_func_cdata);
212 xmpp_change_elem_to_attrib(pinfo->pool, "status", "status", element, xmpp_transform_func_cdata);
213 xmpp_change_elem_to_attrib(pinfo->pool, "joining-method", "joining-method", element, xmpp_transform_func_cdata);
214 xmpp_change_elem_to_attrib(pinfo->pool, "disconnection-method", "disconnection-method", element, xmpp_transform_func_cdata);
217 xmpp_display_attrs(endpoint_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
218 xmpp_display_elems(endpoint_tree, element, pinfo, tvb, elems_info, array_length(elems_info));
221 static void
222 xmpp_conf_media(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element)
224 proto_tree *media_tree;
226 xmpp_attr_info attrs_info[] = {
227 {"id", NULL, true, true, NULL, NULL},
228 {"display-text", NULL, false, true, NULL, NULL},
229 {"type", NULL, false, true, NULL, NULL},
230 {"label", NULL, false, true, NULL, NULL},
231 {"src-id", NULL, false, true, NULL, NULL},
232 {"status", NULL, false, true, NULL, NULL},
235 media_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_media, NULL, "MEDIA");
237 xmpp_change_elem_to_attrib(pinfo->pool, "display-text", "display-text", element, xmpp_transform_func_cdata);
238 xmpp_change_elem_to_attrib(pinfo->pool, "type", "type", element, xmpp_transform_func_cdata);
239 xmpp_change_elem_to_attrib(pinfo->pool, "label", "label", element, xmpp_transform_func_cdata);
240 xmpp_change_elem_to_attrib(pinfo->pool, "src-id", "src-id", element, xmpp_transform_func_cdata);
241 xmpp_change_elem_to_attrib(pinfo->pool, "status", "status", element, xmpp_transform_func_cdata);
243 xmpp_display_attrs(media_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info));
244 xmpp_display_elems(media_tree, element, pinfo, tvb, NULL, 0);
247 * Editor modelines - https://www.wireshark.org/tools/modelines.html
249 * Local variables:
250 * c-basic-offset: 4
251 * tab-width: 8
252 * indent-tabs-mode: nil
253 * End:
255 * ex: set shiftwidth=4 tabstop=8 expandtab:
256 * :indentSize=4:tabSize=8:noTabs=true: