Don't do fcn calls in arg of g_?to??(); Macro may very well eval args multiple times.
[obnox/wireshark/wip.git] / epan / dissectors / packet-sndcp-xid.c
1 /* packet-sndcp-xid.c
2  * Routines for Subnetwork Dependent Convergence Protocol (SNDCP) XID dissection
3  * Used to dissect XID compression parameters negotiated in GSM (TS44.065)
4  * Copyright 2008, Vincent Helfre <vincent.helfre [AT] ericsson.com>
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25  */
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <stdlib.h>
32
33 #include <glib.h>
34
35 #include <epan/packet.h>
36
37
38 /* Parameter types: TS 44.065 8
39 */
40 #define SNDCP_VERSION_PAR_TYPE 0
41 #define DATA_COMPRESSION_PAR_TYPE 1
42 #define PROTOCOL_COMPRESSION_PAR_TYPE 2
43
44 /* Algorithm identifiers: TS 44.065 6.6.1.1.4 and 6.5.1.1.4
45 */
46 #define ALGO_V42BIS 0
47 #define ALGO_V44 1
48 #define ALGO_RFC1144 0
49 #define ALGO_RFC2507 1
50 #define ALGO_ROHC 2
51
52 static const value_string sndcp_xid_dcomp_algo_str[] = {
53         {0x0, "V.42 bis"},
54         {0x1, "V.44"},
55         {0, NULL}
56 };
57
58 static const value_string sndcp_xid_pcomp_algo_str[] = {
59         {0x0, "RFC 1144"},
60         {0x1, "RFC 2507"},
61         {0x2, "ROHC (RFC 3095)"},
62         {0, NULL}
63 };
64
65 typedef struct
66 {
67         guint8 nb_of_dcomp_pcomp; /* note that a DCOMP or a PCOMP is 4 bit wide */
68         guint16 (**func_array_ptr) (tvbuff_t *, proto_tree *, guint16);
69 } algo_parameters_t;
70
71 /* Initialize the protocol and registered fields
72 */
73 static int proto_sndcp_xid   = -1;
74
75 /* These fields are used to store store the algorithm ID
76 * When the P bit is not set, try to decode the algo based on what whas stored.
77 * Entity ranges from 0 to 31 (6.5.1.1.3)
78 */
79 static guint8 dcomp_entity_algo_id[32]={-1, -1, -1, -1, -1, -1, -1, -1,
80                                                                                 -1, -1, -1, -1, -1, -1, -1, -1,
81                                                                                 -1, -1, -1, -1, -1, -1, -1, -1,
82                                                                                 -1, -1, -1, -1, -1, -1, -1, -1};
83 static guint8 pcomp_entity_algo_id[32]={-1, -1, -1, -1, -1, -1, -1, -1,
84                                                                                 -1, -1, -1, -1, -1, -1, -1, -1,
85                                                                                 -1, -1, -1, -1, -1, -1, -1, -1,
86                                                                                 -1, -1, -1, -1, -1, -1, -1, -1};
87
88
89
90 /* L3 XID parsing */
91 static int hf_sndcp_xid_type = -1;
92 static int hf_sndcp_xid_len = -1;
93 static int hf_sndcp_xid_value = -1;
94 static int hf_sndcp_xid_comp_pbit = -1;
95 static int hf_sndcp_xid_comp_spare_byte1 = -1;
96 static int hf_sndcp_xid_comp_entity = -1;
97 static int hf_sndcp_xid_comp_spare_byte2 = -1;
98 static int hf_sndcp_xid_comp_algo_id = -1;
99 static int hf_sndcp_xid_comp_len = -1;
100 /* There is currently a maximum of 15 DCOMP/PCOMP: 6.5.1.1.5 */
101 static int hf_sndcp_xid_comp[15] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
102 static int hf_sndcp_xid_comp_spare = -1;
103
104 static int hf_element_applicable_nsapi_15 = -1;
105 static int hf_element_applicable_nsapi_14 = -1;
106 static int hf_element_applicable_nsapi_13 = -1;
107 static int hf_element_applicable_nsapi_12 = -1;
108 static int hf_element_applicable_nsapi_11 = -1;
109 static int hf_element_applicable_nsapi_10 = -1;
110 static int hf_element_applicable_nsapi_9 = -1;
111 static int hf_element_applicable_nsapi_8 = -1;
112 static int hf_element_applicable_nsapi_7 = -1;
113 static int hf_element_applicable_nsapi_6 = -1;
114 static int hf_element_applicable_nsapi_5 = -1;
115 static int hf_element_applicable_nsapi_spare = -1;
116
117 static int hf_sndcp_xid_rfc1144_s0 = -1;
118 static int hf_sndcp_xid_rfc2507_f_max_period_msb = -1;
119 static int hf_sndcp_xid_rfc2507_f_max_period_lsb = -1;
120 static int hf_sndcp_xid_rfc2507_f_max_time = -1;
121 static int hf_sndcp_xid_rfc2507_max_header = -1;
122 static int hf_sndcp_xid_rfc2507_tcp_space = -1;
123 static int hf_sndcp_xid_rfc2507_non_tcp_space_msb = -1;
124 static int hf_sndcp_xid_rfc2507_non_tcp_space_lsb = -1;
125 static int hf_sndcp_xid_rohc_max_cid_spare = -1;
126 static int hf_sndcp_xid_rohc_max_cid_msb = -1;
127 static int hf_sndcp_xid_rohc_max_cid_lsb = -1;
128 static int hf_sndcp_xid_rohc_max_header = -1;
129 static int hf_sndcp_xid_rohc_profile_msb = -1;
130 static int hf_sndcp_xid_rohc_profile_lsb = -1;
131
132 static int hf_sndcp_xid_V42bis_p0_spare = -1;
133 static int hf_sndcp_xid_V42bis_p0 = -1;
134 static int hf_sndcp_xid_V42bis_p1_msb = -1;
135 static int hf_sndcp_xid_V42bis_p1_lsb = -1;
136 static int hf_sndcp_xid_V42bis_p2 = -1;
137 static int hf_sndcp_xid_V44_c0 = -1;
138 static int hf_sndcp_xid_V44_c0_spare = -1;
139 static int hf_sndcp_xid_V44_p0_spare = -1;
140 static int hf_sndcp_xid_V44_p0 = -1;
141 static int hf_sndcp_xid_V44_p1t_msb = -1;
142 static int hf_sndcp_xid_V44_p1t_lsb = -1;
143 static int hf_sndcp_xid_V44_p1r_msb = -1;
144 static int hf_sndcp_xid_V44_p1r_lsb = -1;
145 static int hf_sndcp_xid_V44_p3t_msb = -1;
146 static int hf_sndcp_xid_V44_p3t_lsb = -1;
147 static int hf_sndcp_xid_V44_p3r_msb = -1;
148 static int hf_sndcp_xid_V44_p3r_lsb = -1;
149
150
151 /* Initialize the subtree pointers
152 */
153 static gint ett_sndcp_xid                = -1;
154 static gint ett_sndcp_xid_version_field  = -1;
155 static gint ett_sndcp_comp_field        = -1;
156
157 static void parse_compression_parameters(tvbuff_t *tvb, proto_tree *tree, gboolean dcomp);
158 /******************************************************/
159 /* Compression algorithms element dissector functions */
160 /******************************************************/
161 static guint16 parse_applicable_nsapi(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
162 {
163         guint8 nsapi_byte1, nsapi_byte2;
164         nsapi_byte1 = tvb_get_guint8(tvb, offset);
165         nsapi_byte2 = tvb_get_guint8(tvb, offset+1);
166
167         proto_tree_add_uint(tree, hf_element_applicable_nsapi_15, tvb, offset, 1, nsapi_byte1);
168         proto_tree_add_uint(tree, hf_element_applicable_nsapi_14, tvb, offset, 1, nsapi_byte1);
169         proto_tree_add_uint(tree, hf_element_applicable_nsapi_13, tvb, offset, 1, nsapi_byte1);
170         proto_tree_add_uint(tree, hf_element_applicable_nsapi_12, tvb, offset, 1, nsapi_byte1);
171         proto_tree_add_uint(tree, hf_element_applicable_nsapi_11, tvb, offset, 1, nsapi_byte1);
172         proto_tree_add_uint(tree, hf_element_applicable_nsapi_10, tvb, offset, 1, nsapi_byte1);
173         proto_tree_add_uint(tree, hf_element_applicable_nsapi_9, tvb, offset, 1, nsapi_byte1);
174         proto_tree_add_uint(tree, hf_element_applicable_nsapi_8, tvb, offset, 1, nsapi_byte1);
175
176         proto_tree_add_uint(tree, hf_element_applicable_nsapi_7, tvb, offset+1, 1, nsapi_byte2);
177         proto_tree_add_uint(tree, hf_element_applicable_nsapi_6, tvb, offset+1, 1, nsapi_byte2);
178         proto_tree_add_uint(tree, hf_element_applicable_nsapi_5, tvb, offset+1, 1, nsapi_byte2);
179         proto_tree_add_uint(tree, hf_element_applicable_nsapi_spare, tvb, offset+1, 1, nsapi_byte2);
180
181         return 2U;
182 }
183
184 static guint16 parse_rfc1144_s0(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
185 {
186         guint8 s0;
187         s0 = tvb_get_guint8(tvb, offset);
188
189         proto_tree_add_uint(tree, hf_sndcp_xid_rfc1144_s0, tvb, offset, 1, s0);
190
191         return 1U;
192 }
193
194 static guint16 parse_rfc2507_f_max_period(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
195 {
196         guint8 f_max_period_byte1, f_max_period_byte2;
197         f_max_period_byte1 = tvb_get_guint8(tvb, offset);
198         f_max_period_byte2 = tvb_get_guint8(tvb, offset+1);
199
200         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_f_max_period_msb, tvb, offset, 1, f_max_period_byte1);
201         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_f_max_period_lsb, tvb, offset, 1, f_max_period_byte2);
202
203         return 2U;
204 }
205
206 static guint16 parse_rfc2507_f_max_time(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
207 {
208         guint8 f_max_time;
209         f_max_time = tvb_get_guint8(tvb, offset);
210
211         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_f_max_time, tvb, offset, 1, f_max_time);
212
213         return 1U;
214 }
215
216 static guint16 parse_rfc2507_max_header(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
217 {
218         guint8 max_header;
219         max_header = tvb_get_guint8(tvb, offset);
220
221         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_max_header, tvb, offset, 1, max_header);
222
223         return 1U;
224 }
225
226 static guint16 parse_rfc2507_tcp_space(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
227 {
228         guint8 tcp_space;
229         tcp_space = tvb_get_guint8(tvb, offset);
230
231         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_tcp_space, tvb, offset, 1, tcp_space);
232
233         return 1U;
234 }
235
236 static guint16 parse_rfc2507_non_tcp_space(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
237 {
238         guint8 tcp_space_msb, tcp_space_lsb;
239         tcp_space_msb = tvb_get_guint8(tvb, offset);
240         tcp_space_lsb = tvb_get_guint8(tvb, offset+1);
241
242         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_non_tcp_space_msb, tvb, offset, 1, tcp_space_msb);
243         proto_tree_add_uint(tree, hf_sndcp_xid_rfc2507_non_tcp_space_lsb, tvb, offset, 1, tcp_space_lsb);
244
245         return 2U;
246 }
247
248 static guint16 parse_rohc_max_cid(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
249 {
250         guint8 max_cid_msb, max_cid_lsb;
251         max_cid_msb = tvb_get_guint8(tvb, offset);
252         max_cid_lsb = tvb_get_guint8(tvb, offset+1);
253
254         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_max_cid_spare, tvb, offset, 1, max_cid_msb);
255         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_max_cid_msb, tvb, offset, 1, max_cid_msb);
256         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_max_cid_lsb, tvb, offset+1, 1, max_cid_lsb);
257
258         return 2U;
259 }
260 static guint16 parse_rohc_max_header(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
261 {
262         guint8 max_header;
263
264         max_header = tvb_get_guint8(tvb, offset+1);
265
266         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_max_header, tvb, offset+1, 1, max_header);
267
268         return 2U;
269 }
270
271 static guint16 parse_rohc_profile(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
272 {
273         guint8 profile_msb, profile_lsb;
274         profile_msb = tvb_get_guint8(tvb, offset);
275         profile_lsb = tvb_get_guint8(tvb, offset+1);
276
277         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_profile_msb, tvb, offset, 1, profile_msb);
278         proto_tree_add_uint(tree, hf_sndcp_xid_rohc_profile_lsb, tvb, offset+1, 1, profile_lsb);
279
280         return 2U;
281 }
282
283 static guint16 parse_V42bis_p0(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
284 {
285         guint8 p0;
286
287         p0 = tvb_get_guint8(tvb, offset);
288
289         proto_tree_add_uint(tree, hf_sndcp_xid_V42bis_p0_spare, tvb, offset, 1, p0);
290         proto_tree_add_uint(tree, hf_sndcp_xid_V42bis_p0, tvb, offset, 1, p0);
291
292         return 1U;
293 }
294
295 static guint16 parse_V42bis_p1(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
296 {
297         guint8 p1_msb, p1_lsb;
298
299         p1_msb = tvb_get_guint8(tvb, offset);
300         p1_lsb = tvb_get_guint8(tvb, offset+1);
301
302         proto_tree_add_uint(tree, hf_sndcp_xid_V42bis_p1_msb, tvb, offset, 1, p1_msb);
303         proto_tree_add_uint(tree, hf_sndcp_xid_V42bis_p1_lsb, tvb, offset+1, 1, p1_lsb);
304
305         return 2U;
306 }
307
308 static guint16 parse_V42bis_p2(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
309 {
310         guint8 p2;
311
312         p2 = tvb_get_guint8(tvb, offset);
313
314         proto_tree_add_uint(tree, hf_sndcp_xid_V42bis_p2, tvb, offset, 1, p2);
315
316         return 1U;
317 }
318
319 static guint16 parse_V44_c0(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
320 {
321         guint8 c0;
322
323         c0 = tvb_get_guint8(tvb, offset);
324         proto_tree_add_uint(tree, hf_sndcp_xid_V44_c0_spare, tvb, offset, 1, c0);
325         proto_tree_add_uint(tree, hf_sndcp_xid_V44_c0, tvb, offset, 1, c0);
326
327         return 1U;
328 }
329
330 static guint16 parse_V44_p0(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
331 {
332         guint8 p0;
333
334         p0 = tvb_get_guint8(tvb, offset);
335
336         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p0_spare, tvb, offset, 1, p0);
337         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p0, tvb, offset, 1, p0);
338
339         return 1U;
340 }
341
342
343 static guint16 parse_V44_p1t(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
344 {
345         guint8 p1t_msb, p1t_lsb;
346
347         p1t_msb = tvb_get_guint8(tvb, offset);
348         p1t_lsb = tvb_get_guint8(tvb, offset+1);
349
350         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p1t_msb, tvb, offset, 1, p1t_msb);
351         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p1t_lsb, tvb, offset+1, 1, p1t_lsb);
352
353         return 2U;
354 }
355
356 static guint16 parse_V44_p1r(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
357 {
358         guint8 p1r_msb, p1r_lsb;
359
360         p1r_msb = tvb_get_guint8(tvb, offset);
361         p1r_lsb = tvb_get_guint8(tvb, offset+1);
362
363         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p1r_msb, tvb, offset, 1, p1r_msb);
364         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p1r_lsb, tvb, offset+1, 1, p1r_lsb);
365
366         return 2U;
367 }
368
369 static guint16 parse_V44_p3t(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
370 {
371         guint8 p3t_msb, p3t_lsb;
372
373         p3t_msb = tvb_get_guint8(tvb, offset);
374         p3t_lsb = tvb_get_guint8(tvb, offset+1);
375
376         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p3t_msb, tvb, offset, 1, p3t_msb);
377         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p3t_lsb, tvb, offset+1, 1, p3t_lsb);
378
379         return 2U;
380 }
381
382 static guint16 parse_V44_p3r(tvbuff_t *tvb, proto_tree *tree, guint16 offset)
383 {
384         guint8 p3r_msb, p3r_lsb;
385
386         p3r_msb = tvb_get_guint8(tvb, offset);
387         p3r_lsb = tvb_get_guint8(tvb, offset+1);
388
389         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p3r_msb, tvb, offset, 1, p3r_msb);
390         proto_tree_add_uint(tree, hf_sndcp_xid_V44_p3r_lsb, tvb, offset+1, 1, p3r_lsb);
391
392         return 2U;
393 }
394
395
396 /***************************************************/
397 /* Compression algorithms element dissector arrays */
398 /***************************************************/
399 static guint16 (*rfc1144_elem_fcn[])(tvbuff_t *, proto_tree *, guint16) = {
400     parse_applicable_nsapi,
401         parse_rfc1144_s0,
402         NULL
403 };
404
405
406 static guint16 (*rfc2507_elem_fcn[])(tvbuff_t *, proto_tree *, guint16) = {
407         parse_applicable_nsapi,
408         parse_rfc2507_f_max_period,
409         parse_rfc2507_f_max_time,
410         parse_rfc2507_max_header,
411         parse_rfc2507_tcp_space,
412         parse_rfc2507_non_tcp_space,
413         NULL
414 };
415
416 static guint16 (*rohc_elem_fcn[])(tvbuff_t *, proto_tree *, guint16) = {
417         parse_applicable_nsapi,
418         parse_rohc_max_cid,
419         parse_rohc_max_header,
420         parse_rohc_profile, /* Profile 1 */
421         parse_rohc_profile, /* Profile 2 */
422         parse_rohc_profile, /* Profile 3 */
423         parse_rohc_profile, /* Profile 4 */
424         parse_rohc_profile, /* Profile 5 */
425         parse_rohc_profile, /* Profile 6 */
426         parse_rohc_profile, /* Profile 7 */
427         parse_rohc_profile, /* Profile 8 */
428         parse_rohc_profile, /* Profile 9 */
429         parse_rohc_profile, /* Profile 10 */
430         parse_rohc_profile, /* Profile 11 */
431         parse_rohc_profile, /* Profile 12 */
432         parse_rohc_profile, /* Profile 13 */
433         parse_rohc_profile, /* Profile 14 */
434         parse_rohc_profile, /* Profile 15 */
435         parse_rohc_profile, /* Profile 16 */
436         NULL
437 };
438
439 /* Array containing the number of pcomp and the function array pointer */
440 static algo_parameters_t pcomp_algo_pars[] = {
441         {2, rfc1144_elem_fcn},
442         {5, rfc2507_elem_fcn},
443         {2, rohc_elem_fcn}
444 };
445
446 /* Data compression algorithms */
447
448 static guint16 (*v42bis_elem_fcn[])(tvbuff_t *, proto_tree *, guint16) = {
449         parse_applicable_nsapi,
450         parse_V42bis_p0,
451         parse_V42bis_p1,
452         parse_V42bis_p2,
453         NULL
454 };
455
456 static guint16 (*v44_elem_fcn[])(tvbuff_t *, proto_tree *, guint16) = {
457         parse_applicable_nsapi,
458         parse_V44_c0,
459         parse_V44_p0,
460         parse_V44_p1t,
461         parse_V44_p1r,
462         parse_V44_p3t,
463         parse_V44_p3r,
464         NULL
465 };
466
467 /* Array containing the number of dcomp and the function array pointer */
468 static algo_parameters_t dcomp_algo_pars[] = {
469         {1, v42bis_elem_fcn},
470         {2, v44_elem_fcn},
471
472 };
473
474 /* Code to actually dissect the packets
475 */
476 static void
477 dissect_sndcp_xid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
478 {
479         /* Set up structures needed to add the protocol subtree and manage it
480         */
481         proto_item *ti, *version_item, *dcomp_item, *pcomp_item;
482         proto_tree *sndcp_tree, *version_tree, *dcomp_tree, *pcomp_tree;
483         guint16 offset = 0, l3_param_len;
484         guint8 parameter_type, parameter_len;
485
486         /* create display subtree for the protocol
487         */
488         ti = proto_tree_add_item(tree, proto_sndcp_xid, tvb, 0, -1, ENC_NA);
489         sndcp_tree = proto_item_add_subtree(ti, ett_sndcp_xid);
490         l3_param_len = tvb_reported_length(tvb);
491
492         while (offset < l3_param_len-1)
493         {
494                 parameter_type = tvb_get_guint8(tvb, offset);
495                 parameter_len = tvb_get_guint8(tvb, offset+1);
496
497                 if (parameter_type == SNDCP_VERSION_PAR_TYPE)
498                 {
499                         guint8 value = tvb_get_guint8(tvb, offset+2);
500                         version_item = proto_tree_add_text(sndcp_tree, tvb, offset, parameter_len+2,
501                                         "Version (SNDCP version number) - Value %d", value);
502
503                         version_tree = proto_item_add_subtree(version_item, ett_sndcp_xid_version_field);
504                         proto_tree_add_uint(version_tree, hf_sndcp_xid_type, tvb, offset,
505                         1, parameter_type);
506                         proto_tree_add_uint(version_tree, hf_sndcp_xid_len, tvb, offset+1,
507                         1, parameter_len);
508                         proto_tree_add_uint(version_tree, hf_sndcp_xid_value, tvb, offset+2,
509                         1, value);
510                         offset += 3;
511                 }
512
513                 else if (parameter_type == DATA_COMPRESSION_PAR_TYPE)
514                 {
515                         tvbuff_t * dcomp_tvb;
516
517                         dcomp_item = proto_tree_add_text(sndcp_tree, tvb, offset, parameter_len+2,
518                                 "Data Compression");
519                         dcomp_tree = proto_item_add_subtree(dcomp_item, ett_sndcp_comp_field);
520                         proto_tree_add_uint(dcomp_tree, hf_sndcp_xid_type, tvb, offset,
521                         1, parameter_type);
522                         proto_tree_add_uint(dcomp_tree, hf_sndcp_xid_len, tvb, offset+1,
523                         1, parameter_len);
524                         offset += 2;
525
526                         dcomp_tvb = tvb_new_subset(tvb, offset, parameter_len, parameter_len);
527                         parse_compression_parameters(dcomp_tvb, dcomp_tree, TRUE);
528                         offset += parameter_len;
529
530
531                 }
532                 else if (parameter_type == PROTOCOL_COMPRESSION_PAR_TYPE)
533                 {
534                         tvbuff_t * pcomp_tvb;
535
536                         pcomp_item = proto_tree_add_text(sndcp_tree, tvb, offset, parameter_len+2,
537                                 "Protocol Control Information Compression");
538                         pcomp_tree = proto_item_add_subtree(pcomp_item, ett_sndcp_comp_field);
539                         proto_tree_add_uint(pcomp_tree, hf_sndcp_xid_type, tvb, offset,
540                         1, parameter_type);
541                         proto_tree_add_uint(pcomp_tree, hf_sndcp_xid_len, tvb, offset+1,
542                         1, parameter_len);
543                         offset += 2;
544
545                         pcomp_tvb = tvb_new_subset(tvb, offset, parameter_len, parameter_len);
546                         parse_compression_parameters(pcomp_tvb, pcomp_tree, FALSE);
547                         offset += parameter_len;
548
549                 }
550                 else
551                 {
552                         break; /* error: exit */
553                 }
554         }
555 }
556
557
558 static void parse_compression_parameters(tvbuff_t *tvb, proto_tree *tree, gboolean dcomp)
559 {
560         guint8 entity, len, algo_id;
561         guint8 number_of_comp, i;
562         gboolean p_bit_set;
563         algo_parameters_t * algo_pars;
564         guint8 function_index;
565         proto_item *comp_entity_field = NULL;
566         proto_tree *comp_entity_tree = NULL;
567         guint16 tvb_len, offset=0 , new_offset, entity_offset;
568         value_string const * comp_algo_str;
569
570         tvb_len = tvb_reported_length(tvb);
571         if (tvb_len < 3) return; /* entity, algo and length bytes should always be present 6.5.1.1 and 6.6.1.1 */
572
573         /* Loop to decode each entity (cf Figure 10) */
574         while (offset < tvb_len)
575         {
576                 /* Read the entity byte */
577                 entity = tvb_get_guint8(tvb, offset);
578                 p_bit_set = ((entity & 0x80) == 0x80) ? 1 : 0;
579                 entity = entity & 0x1F;
580
581                 /* P bit is set: means that algo identifier and dcomp are present */
582                 if (p_bit_set)
583                 {
584                         /* Read the algorithm id. TODO: store the algo in a different variable for each different entity */
585                         algo_id = tvb_get_guint8(tvb, offset+1) & 0x1F;
586
587                         /* sanity check: check that the algo id that will be used inside the array has a valid range */
588                         if (dcomp)
589                         {
590                                 if(algo_id <= ALGO_V44)
591                                 {
592                                         algo_pars = dcomp_algo_pars;
593                                         dcomp_entity_algo_id[entity] = algo_id;
594                                         comp_algo_str = sndcp_xid_dcomp_algo_str;
595                                 }
596                                 else return;
597                         }
598                         else
599                         {
600                                 if (algo_id <= ALGO_ROHC)
601                                 {
602                                         algo_pars = pcomp_algo_pars;
603                                         pcomp_entity_algo_id[entity] = algo_id;
604                                         comp_algo_str = sndcp_xid_pcomp_algo_str;
605                                 }
606                                 else return;
607                         }
608
609                         /* Read the length */
610                         len = tvb_get_guint8(tvb, offset+2);
611
612                         comp_entity_field = proto_tree_add_text(tree, tvb, offset, len + 3,
613                                 "Entity %d, Algorithm %s",
614                                 entity & 0x1F, val_to_str(algo_id & 0x1F, comp_algo_str,"Undefined Algorithm Identifier:%X"));
615                         comp_entity_tree = proto_item_add_subtree(comp_entity_field, ett_sndcp_comp_field);
616
617                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_pbit, tvb, offset, 1, p_bit_set << 7);
618                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_spare_byte1, tvb, offset, 1, entity);
619                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_entity, tvb, offset, 1, entity);
620
621                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_spare_byte2, tvb, offset+1, 1, algo_id);
622                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_algo_id, tvb, offset+1, 1, algo_id);
623                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_len, tvb, offset+2, 1, len);
624
625                         /* Read the dcomp/pcomp field */
626                         offset += 3; /* entity_offset will be used as the offset from length byte */
627                         number_of_comp = algo_pars[algo_id].nb_of_dcomp_pcomp;
628
629                         for (i=0; i < (number_of_comp+1) / 2; i++)
630                         {
631                                 guint8 byte;
632
633                                 byte = tvb_get_guint8(tvb, offset+i);
634                                 proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp[2*i], tvb, offset+i, 1, byte);
635
636                                 /* if there is an even number of dcomp/pcomp */
637                                 if (2*i+1 < number_of_comp)
638                                 {
639                                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp[2*i+1], tvb, offset+i, 1, byte);
640                                 }
641                                 /* else there is padding in the end */
642                                 else
643                                 {
644                                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_spare, tvb, offset+i, 1, byte);
645                                 }
646
647                         }
648                         entity_offset = i;
649                         function_index = 0;
650
651                         /* Process the elements byte per byte */
652                         while ((entity_offset < len) && (algo_pars[algo_id].func_array_ptr[function_index] != NULL))
653                         {
654                                 new_offset = offset+entity_offset;
655                                 entity_offset += algo_pars[algo_id].func_array_ptr[function_index](tvb, comp_entity_tree, new_offset);
656                                 function_index++;
657                         }
658                         offset += entity_offset;
659
660                 }
661                 else /* P bit not set */
662                 {
663                         len = tvb_get_guint8(tvb, offset+1);
664
665                         if (dcomp)
666                         {
667                                 algo_pars = dcomp_algo_pars;
668                                 algo_id = dcomp_entity_algo_id[entity];
669                                 comp_algo_str = sndcp_xid_dcomp_algo_str;
670                         }
671                         else
672                         {
673                                 algo_pars = pcomp_algo_pars;
674                                 algo_id = pcomp_entity_algo_id[entity];
675                                 comp_algo_str = sndcp_xid_pcomp_algo_str;
676                         }
677                         comp_entity_field = proto_tree_add_text(tree, tvb, offset, len + 2,
678                                 "Entity %d decoded as Algorithm %s",
679                                 entity & 0x1F, val_to_str(algo_id & 0x1F, comp_algo_str,"Undefined Algorithm Identifier:%X"));
680
681                         comp_entity_tree = proto_item_add_subtree(comp_entity_field, ett_sndcp_comp_field);
682
683                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_pbit, tvb, offset, 1, p_bit_set << 7);
684                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_spare_byte1, tvb, offset, 1, entity);
685                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_entity, tvb, offset, 1, entity);
686                         proto_tree_add_uint(comp_entity_tree, hf_sndcp_xid_comp_len, tvb, offset+2, 1, len);
687
688                         offset += 2;
689                         entity_offset = 0;
690                         function_index = 0;
691
692                         if (dcomp)
693                         {
694                                 if (algo_id > ALGO_V44) return;
695                         }
696                         else
697                         {
698                                 if (algo_id > ALGO_ROHC) return;
699                         }
700
701                         /* Process the elements byte per byte */
702                         while ((entity_offset < len) && (algo_pars[algo_id].func_array_ptr[function_index] != NULL))
703                         {
704                                 new_offset = offset+entity_offset;
705                                 entity_offset += algo_pars[algo_id].func_array_ptr[function_index](tvb, comp_entity_tree, new_offset);
706                                 function_index++;
707                         }
708                         offset += entity_offset;
709                 }
710         }
711
712         /* Else if length is lower than 3, the packet is not correctly formatted */
713 }
714
715 /* Register the protocol with Wireshark
716    this format is required because a script is used to build the C function
717    that calls all the protocol registration.
718 */
719
720 void
721 proto_register_sndcp_xid(void)
722 {
723   /* Setup list of header fields
724    */
725         static hf_register_info hf[] = {
726                 /* L3 XID Parameter Parsing Info */
727                 {&hf_sndcp_xid_type,
728                                 { "Parameter type","llcgprs.l3xidpartype", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
729                 {&hf_sndcp_xid_len,
730                                 { "Length","llcgprs.l3xidparlen", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
731                 {&hf_sndcp_xid_value,
732                                 { "Value","llcgprs.l3xidparvalue", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
733                 {&hf_sndcp_xid_comp_pbit,
734                                 { "P bit","llcgprs.l3xiddcomppbit", FT_UINT8, BASE_DEC, NULL, 0x80, "Data", HFILL}},
735                 {&hf_sndcp_xid_comp_spare_byte1,
736                                 { "Spare","llcgprs.l3xidspare", FT_UINT8, BASE_HEX, NULL, 0x60, "Ignore", HFILL}},
737                 {&hf_sndcp_xid_comp_entity,
738                                 { "Entity","llcgprs.l3xidentity", FT_UINT8, BASE_DEC, NULL, 0x1F, "Data", HFILL}},
739                 {&hf_sndcp_xid_comp_spare_byte2,
740                                 { "Spare","llcgprs.l3xidspare", FT_UINT8, BASE_HEX, NULL, 0xE0, "Ignore", HFILL}},
741                 {&hf_sndcp_xid_comp_algo_id,
742                                 { "Algorithm identifier","llcgprs.l3xidalgoid", FT_UINT8, BASE_DEC, NULL, 0x1F, "Data", HFILL}},
743                 {&hf_sndcp_xid_comp_len,
744                                 { "Length","llcgprs.l3xidcomplen", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
745                 {&hf_sndcp_xid_comp[0],
746                                 { "DCOMP1","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
747                 {&hf_sndcp_xid_comp[1],
748                                 { "DCOMP2","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
749                 {&hf_sndcp_xid_comp[2],
750                                 { "DCOMP3","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
751                 {&hf_sndcp_xid_comp[3],
752                                 { "DCOMP4","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
753                 {&hf_sndcp_xid_comp[4],
754                                 { "DCOMP5","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
755                 {&hf_sndcp_xid_comp[5],
756                                 { "DCOMP6","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
757                 {&hf_sndcp_xid_comp[6],
758                                 { "DCOMP7","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
759                 {&hf_sndcp_xid_comp[7],
760                                 { "DCOMP8","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
761                 {&hf_sndcp_xid_comp[8],
762                                 { "DCOMP9","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
763                 {&hf_sndcp_xid_comp[9],
764                                 { "DCOMP10","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
765                 {&hf_sndcp_xid_comp[10],
766                                 { "DCOMP11","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
767                 {&hf_sndcp_xid_comp[11],
768                                 { "DCOMP12","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
769                 {&hf_sndcp_xid_comp[12],
770                                 { "DCOMP13","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
771                 {&hf_sndcp_xid_comp[13],
772                                 { "DCOMP14","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0x0F, "Data", HFILL}},
773                 {&hf_sndcp_xid_comp[14],
774                                 { "DCOMP15","llcgprs.l3xiddcomp", FT_UINT8, BASE_DEC, NULL, 0xF0, "Data", HFILL}},
775                 {&hf_sndcp_xid_comp_spare,
776                                 { "Spare","llcgprs.l3xidspare", FT_UINT8, BASE_HEX, NULL, 0x0F, "Ignore", HFILL}},
777                 {&hf_element_applicable_nsapi_15,
778                                 { "NSAPI 15","sndcpxid.nsapi15", FT_UINT8, BASE_DEC, NULL, 0x80, "Data", HFILL}},
779                 {&hf_element_applicable_nsapi_14,
780                                 { "NSAPI 14","sndcpxid.nsapi14", FT_UINT8, BASE_DEC, NULL, 0x40, "Data", HFILL}},
781                 {&hf_element_applicable_nsapi_13,
782                                 { "NSAPI 13","sndcpxid.nsapi13", FT_UINT8, BASE_DEC, NULL, 0x20, "Data", HFILL}},
783                 {&hf_element_applicable_nsapi_12,
784                                 { "NSAPI 12","sndcpxid.nsapi12", FT_UINT8, BASE_DEC, NULL, 0x10, "Data", HFILL}},
785                 {&hf_element_applicable_nsapi_11,
786                                 { "NSAPI 11","sndcpxid.nsapi11", FT_UINT8, BASE_DEC, NULL, 0x08, "Data", HFILL}},
787                 {&hf_element_applicable_nsapi_10,
788                                 { "NSAPI 10","sndcpxid.nsapi10", FT_UINT8, BASE_DEC, NULL, 0x04, "Data", HFILL}},
789                 {&hf_element_applicable_nsapi_9,
790                                 { "NSAPI 9","sndcpxid.nsapi9", FT_UINT8, BASE_DEC, NULL, 0x02, "Data", HFILL}},
791                 {&hf_element_applicable_nsapi_8,
792                                 { "NSAPI 8","sndcpxid.nsapi8", FT_UINT8, BASE_DEC, NULL, 0x01, "Data", HFILL}},
793                 {&hf_element_applicable_nsapi_7,
794                                 { "NSAPI 7","sndcpxid.nsapi7", FT_UINT8, BASE_DEC, NULL, 0x80, "Data", HFILL}},
795                 {&hf_element_applicable_nsapi_6,
796                                 { "NSAPI 6","sndcpxid.nsapi6", FT_UINT8, BASE_DEC, NULL, 0x40, "Data", HFILL}},
797                 {&hf_element_applicable_nsapi_5,
798                                 { "NSAPI 5","sndcpxid.nsapi5", FT_UINT8, BASE_DEC, NULL, 0x20, "Data", HFILL}},
799                 {&hf_element_applicable_nsapi_spare,
800                                 { "Spare","sndcpxid.spare", FT_UINT8, BASE_DEC, NULL, 0x1F, "Ignore", HFILL}},
801                 {&hf_sndcp_xid_rfc1144_s0,
802                                 { "S0 - 1","sndcpxid.rfc1144_s0", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
803                 {&hf_sndcp_xid_rfc2507_f_max_period_msb,
804                                 { "F Max Period MSB","sndcpxid.rfc2507_f_max_period_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
805                 {&hf_sndcp_xid_rfc2507_f_max_period_lsb,
806                                 { "F Max Period LSB","sndcpxid.rfc2507_f_max_period_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
807                 {&hf_sndcp_xid_rfc2507_f_max_time,
808                                 { "F Max Time","sndcpxid.rfc2507_f_max_time", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
809                 {&hf_sndcp_xid_rfc2507_max_header,
810                                 { "Max Header","sndcpxid.rfc2507_max_header", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
811                 {&hf_sndcp_xid_rfc2507_tcp_space,
812                                 { "TCP Space","sndcpxid.rfc2507_max_tcp_space", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
813                 {&hf_sndcp_xid_rfc2507_non_tcp_space_msb,
814                                 { "TCP non space MSB","sndcpxid.rfc2507_max_non_tcp_space_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
815                 {&hf_sndcp_xid_rfc2507_non_tcp_space_lsb,
816                                 { "TCP non space LSB","sndcpxid.rfc2507_max_non_tcp_space_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
817                 {&hf_sndcp_xid_rohc_max_cid_spare,
818                                 { "Spare","sndcpxid.rohc_max_cid_spare", FT_UINT8, BASE_DEC, NULL, 0xC0, "Ignore", HFILL}},
819                 {&hf_sndcp_xid_rohc_max_cid_msb,
820                                 { "Max CID MSB","sndcpxid.rohc_max_cid_msb", FT_UINT8, BASE_HEX, NULL, 0x3F, "Data", HFILL}},
821                 {&hf_sndcp_xid_rohc_max_cid_lsb,
822                                 { "Max CID LSB","sndcpxid.rohc_max_cid_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
823                 {&hf_sndcp_xid_rohc_max_header,
824                                 { "Max header","sndcpxid.rohc_max_header", FT_UINT8, BASE_DEC, NULL, 0xFF, "Data", HFILL}},
825                 {&hf_sndcp_xid_rohc_profile_msb,
826                                 { "Profile MSB","sndcpxid.rohc_profile_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
827                 {&hf_sndcp_xid_rohc_profile_lsb,
828                                 { "Profile LSB","sndcpxid.rohc_profile_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
829                 {&hf_sndcp_xid_V42bis_p0_spare,
830                                 { "Spare","sndcpxid.V42bis_p0spare", FT_UINT8, BASE_DEC, NULL, 0xFC, "Ignore", HFILL}},
831                 {&hf_sndcp_xid_V42bis_p0,
832                                 { "P0","sndcpxid.V42bis_p0", FT_UINT8, BASE_HEX, NULL, 0x03, "Data", HFILL}},
833                 {&hf_sndcp_xid_V42bis_p1_msb,
834                                 { "P1 MSB","sndcpxid.V42bis_p1_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
835                 {&hf_sndcp_xid_V42bis_p1_lsb,
836                                 { "P1 LSB","sndcpxid.V42bis_p1_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
837                 {&hf_sndcp_xid_V42bis_p2,
838                                 { "P2","sndcpxid.V42bis_p2", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
839                 {&hf_sndcp_xid_V44_c0_spare,
840                                 { "P2","sndcpxid.V44_c0_spare", FT_UINT8, BASE_HEX, NULL, 0x3F, "Ignore", HFILL}},
841                 {&hf_sndcp_xid_V44_c0,
842                                 { "P2","sndcpxid.V44_c0", FT_UINT8, BASE_HEX, NULL, 0xC0, "Data", HFILL}},
843                 {&hf_sndcp_xid_V44_p0_spare,
844                                 { "Spare","sndcpxid.V44_p0spare", FT_UINT8, BASE_DEC, NULL, 0xFC, "Ignore", HFILL}},
845                 {&hf_sndcp_xid_V44_p0,
846                                 { "P0","sndcpxid.V44_p0", FT_UINT8, BASE_HEX, NULL, 0x03, "Data", HFILL}},
847                 {&hf_sndcp_xid_V44_p1t_msb,
848                                 { "P1t MSB","sndcpxid.V44_p1t_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
849                 {&hf_sndcp_xid_V44_p1t_lsb,
850                                 { "P1t LSB","sndcpxid.V44_p1t_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
851                 {&hf_sndcp_xid_V44_p1r_msb,
852                                 { "P1r MSB","sndcpxid.V44_p1r_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
853                 {&hf_sndcp_xid_V44_p1r_lsb,
854                                 { "P1r LSB","sndcpxid.V44_p1r_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
855                 {&hf_sndcp_xid_V44_p3t_msb,
856                                 { "P3t MSB","sndcpxid.V44_p3t_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
857                 {&hf_sndcp_xid_V44_p3t_lsb,
858                                 { "P3t LSB","sndcpxid.V44_p3t_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
859                 {&hf_sndcp_xid_V44_p3r_msb,
860                                 { "P3r MSB","sndcpxid.V44_p3r_msb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
861                 {&hf_sndcp_xid_V44_p3r_lsb,
862                                 { "P3r LSB","sndcpxid.V44_p3r_lsb", FT_UINT8, BASE_HEX, NULL, 0xFF, "Data", HFILL}},
863         };
864
865    /* Setup protocol subtree array */
866   static gint *ett[] = {
867     &ett_sndcp_xid,
868     &ett_sndcp_xid_version_field,
869     &ett_sndcp_comp_field
870   };
871
872   /* Register the protocol name and description */
873   proto_sndcp_xid = proto_register_protocol("Subnetwork Dependent Convergence Protocol XID",
874                                         "SNDCP XID", "sndcpxid");
875
876   /* Required function calls to register the header fields and subtrees used */
877   proto_register_field_array(proto_sndcp_xid, hf, array_length(hf));
878   proto_register_subtree_array(ett, array_length(ett));
879   register_dissector("sndcpxid", dissect_sndcp_xid, proto_sndcp_xid);
880 }
881
882 /* If this dissector uses sub-dissector registration add a registration routine.
883    This format is required because a script is used to find these routines and
884    create the code that calls these routines.
885 */
886 void
887 proto_reg_handoff_sndcp_xid(void)
888 {
889 }