Define some fcns & vars as static...
[metze/wireshark/wip.git] / epan / dissectors / packet-v52.c
1 /* packet-v52.c
2  * $Id$
3  * Implementation for V5.2 Interface dissection
4  * References:
5  * ETSI EN 300 324-1 V2.1.1 (2000-04)
6  * ETSI EN 300 347-1 V2.2.2 (1999-12)
7  *
8  * Copyright 2009
9  *
10  * ISKRATEL d.o.o.             |       4S d.o.o.
11  * http://www.iskratel.si/     |       http://www.4es.si/
12  * <info@iskratel.si>          |       <projects@4es.si>
13  * Vladimir Smrekar <vladimir.smrekar@gmail.com>
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include <epan/expert.h>
41
42 static int proto_v52                           = -1;
43 static int hf_v52_discriminator                = -1;
44
45 static gint ett_v52                            = -1;
46 static gint ett_v52_info                       = -1;
47
48 static int hf_v52_address                      = -1;
49 static int hf_v52_low_address                  = -1;
50
51 static int hf_v52_msg_type                     = -1;
52 static int hf_v52_info_element                 = -1;
53
54 static int hf_v52_isdn_address                 = -1;
55 static int hf_v52_isdn_low_address             = -1;
56 static int hf_v52_pstn_address                 = -1;
57 static int hf_v52_pstn_low_address             = -1;
58 static int hf_v52_link_address                 = -1;
59 static int hf_v52_link_low_address             = -1;
60 static int hf_v52_bcc_address                  = -1;
61 static int hf_v52_bcc_low_address              = -1;
62 static int hf_v52_prot_address                 = -1;
63 static int hf_v52_prot_low_address             = -1;
64 static int hf_v52_ctrl_address                 = -1;
65 static int hf_v52_ctrl_low_address             = -1;
66 static int hf_v52_cadenced_ring                = -1;
67 static int hf_v52_pulse_notification           = -1;
68 static int hf_v52_info_length                  = -1;
69
70 /*PSTN Message*/
71 static int hf_v52_line_info                    = -1;
72 static int hf_v52_pulse_type                   = -1;
73 static int hf_v52_suppression_indicator        = -1;
74 static int hf_v52_pulse_duration               = -1;
75 static int hf_v52_ack_request_indicator        = -1;
76 static int hf_v52_number_of_pulses             = -1;
77 static int hf_v52_steady_signal                = -1;
78 static int hf_v52_auto_signalling_sequence     = -1;
79 static int hf_v52_sequence_response            = -1;
80 static int hf_v52_digit_ack                    = -1;
81 static int hf_v52_digit_spare                  = -1;
82 static int hf_v52_digit_info                   = -1;
83 static int hf_v52_res_unavailable              = -1;
84 static int hf_v52_state                        = -1;
85 static int hf_v52_cause_type                   = -1;
86 static int hf_v52_pstn_sequence_number         = -1;
87 static int hf_v52_duration_type                = -1;
88 /*Link control*/
89 static int hf_v52_link_control_function        = -1;
90 /*Protection protocol*/
91 static int hf_v52_rejection_cause              = -1;
92 static int hf_v52_error_cause                  = -1;
93 static int hf_v52_diagnostic_msg               = -1;
94 static int hf_v52_diagnostic_element           = -1;
95 /*BCC protocol*/
96 static int hf_v52_pstn_user_port_id            = -1;
97 static int hf_v52_pstn_user_port_id_lower      = -1;
98
99 static int hf_v52_isdn_user_port_id            = -1;
100 static int hf_v52_isdn_user_port_id_lower      = -1;
101
102 static int hf_v52_isdn_user_port_ts_num        = -1;
103 static int hf_v52_override                     = -1;
104 static int hf_v52_reject_cause_type            = -1;
105 static int hf_v52_bcc_protocol_error_cause     = -1;
106 static int hf_v52_connection_incomplete_reason = -1;
107
108 static int hf_v52_diagnostic_message           = -1;
109 static int hf_v52_diagnostic_information       = -1;
110
111 /*Control protocol*/
112 static int hf_v52_control_function_element     = -1;
113 static int hf_v52_control_function_id          = -1;
114 static int hf_v52_variant                      = -1;
115 static int hf_v52_if_up_id                     = -1;
116 static int hf_v52_if_id                        = -1;
117 static int hf_v52_if_low_id                    = -1;
118 static int hf_v52_if_all_id                    = -1;
119 static int hf_v52_performance_grading          = -1;
120 static int hf_v52_cp_rejection_cause           = -1;
121
122 static int hf_v52_v5_link_id                   = -1;
123 static int hf_v52_v5_time_slot                 = -1;
124 static int hf_v52_sequence_number              = -1;
125
126 static int hf_v52_v5_multi_slot_elements       = -1;
127
128 static int message_type_tmp                    = -1;
129
130 static void
131 dissect_v52_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
132 {
133     unsigned int discriminator = tvb_get_guint8(tvb, offset);
134
135
136     if (discriminator == 0x48) {
137         proto_tree_add_uint_format(tree, hf_v52_discriminator, tvb, offset, 1, discriminator,
138             "Protocol discriminator: V5.2 (0x%02X)",
139             discriminator);
140     } else {
141         proto_tree_add_uint_format(tree, hf_v52_discriminator,
142             tvb, offset, 1, discriminator,
143             "Protocol discriminator: Reserved (0x%02X)",
144             discriminator);
145     }
146 }
147
148 /*============================*/
149 /*   V52 MESSAGE TYPE START   */
150 /*============================*/
151
152 /* message types of PSTN */
153 #define ESTABLISH              0x00
154 #define ESTABLISH_ACK          0x01
155 #define SIGNAL                 0x02
156 #define SIGNAL_ACK             0x03
157 #define DISCONNECT             0x08
158 #define DISCONNECT_COMPLETE    0x09
159 #define STATUS_ENQUIRY         0x0c
160 #define STATUS                 0x0d
161 #define PROTOCOL_PARAMETER     0x0e
162 /* message types of Control protocol */
163 #define PORT_CONTROL           0x10
164 #define PORT_CONTROL_ACK       0x11
165 #define COMMON_CONTROL         0x12
166 #define COMMON_CONTROL_ACK     0x13
167 /* message types of PROT protocol */
168 #define SWITCH_OVER_REQ        0x18
169 #define SWITCH_OVER_COM        0x19
170 #define OS_SWITCH_OVER_COM     0x1a
171 #define SWITCH_OVER_ACK        0x1b
172 #define SWITCH_OVER_REJECT     0x1c
173 #define PROT_PROTOCOL_ERROR    0x1d
174 #define RESET_SN_COM           0x1e
175 #define RESET_SN_ACK           0x1f
176 /* message types of BCC */
177 #define ALLOCATION             0x20
178 #define ALLOCATION_COMPLETE    0x21
179 #define ALLOCATION_REJECT      0x22
180 #define DE_ALLOCATION          0x23
181 #define DE_ALLOCATION_COMPLETE 0x24
182 #define DE_ALLOCATION_REJECT   0x25
183 #define AUDIT                  0x26
184 #define AUDIT_COMPLETE         0x27
185 #define AN_FAULT               0x28
186 #define AN_FAULT_ACKNOWLEDGE   0x29
187 #define BCC_PROTOCOL_ERROR     0x2a
188 /* message types of Link Control protocol */
189 #define LINK_CONTROL           0x30
190 #define LINK_CONTROL_ACK       0x31
191
192 static const value_string msg_type_values [] = {
193     { ESTABLISH,             "Establish" },
194     { ESTABLISH_ACK,         "Establish Ack" },
195     { SIGNAL,                "Signal" },
196     { SIGNAL_ACK,            "Signal Ack" },
197     { DISCONNECT,            "Disconnect" },
198     { DISCONNECT_COMPLETE,   "Disconnect Complete" },
199     { STATUS_ENQUIRY,        "Status Enqury" },
200     { STATUS,                "Status" },
201     { PROTOCOL_PARAMETER,    "Protocol Parameter" },
202     { PORT_CONTROL,          "Port Control" },
203     { PORT_CONTROL_ACK,      "Port Control Ack" },
204     { COMMON_CONTROL,        "Common Control" },
205     { COMMON_CONTROL_ACK,    "Common Control Ack" },
206     { SWITCH_OVER_REQ,       "Switch-Over Request" },
207     { SWITCH_OVER_COM,       "Switch-Over Com" },
208     { OS_SWITCH_OVER_COM,    "OS-Switch-Over Com" },
209     { SWITCH_OVER_ACK,       "Switch-Over Ack" },
210     { SWITCH_OVER_REJECT,    "Switch-Over Reject" },
211     { PROT_PROTOCOL_ERROR,   "Protocol Error" },
212     { RESET_SN_COM,          "Reset SN Com" },
213     { RESET_SN_ACK,          "Reset SN Ack" },
214     { ALLOCATION,            "Allocation" },
215     { ALLOCATION_COMPLETE,   "Allocation Complete" },
216     { ALLOCATION_REJECT,     "Allocation Reject" },
217     { DE_ALLOCATION,         "DE Allocation" },
218     { DE_ALLOCATION_COMPLETE,"DE Allocation Complete" },
219     { DE_ALLOCATION_REJECT,  "DE Allocation Reject" },
220     { AUDIT,                 "Audit" },
221     { AUDIT_COMPLETE,        "Audit Complete" },
222     { AN_FAULT,              "AN Fault" },
223     { AN_FAULT_ACKNOWLEDGE,  "AN Fault Ack" },
224     { BCC_PROTOCOL_ERROR,    "Protocol Error" },
225     { LINK_CONTROL,          "Link Control" },
226     { LINK_CONTROL_ACK,      "Link Control Ack" },
227     { 0,                     NULL } };
228
229 /* SHORT */
230 static const value_string msg_type_values_short [] = {
231     { ESTABLISH,             "Establish" },
232     { ESTABLISH_ACK,         "Establish Ack" },
233     { SIGNAL,                "Signal" },
234     { SIGNAL_ACK,            "Signal Ack" },
235     { DISCONNECT,            "Disconnect" },
236     { DISCONNECT_COMPLETE,   "Disconnect Com" },
237     { STATUS_ENQUIRY,        "Status Enq" },
238     { STATUS,                "Status" },
239     { PROTOCOL_PARAMETER,    "Prot Para" },
240     { PORT_CONTROL,          "PortCtrl" },
241     { PORT_CONTROL_ACK,      "PortCtrl Ack" },
242     { COMMON_CONTROL,        "CCtrl" },
243     { COMMON_CONTROL_ACK,    "CCtrl Ack" },
244     { SWITCH_OVER_REQ,       "SO Req" },
245     { SWITCH_OVER_COM,       "SO Com" },
246     { OS_SWITCH_OVER_COM,    "OS SO Com" },
247     { SWITCH_OVER_ACK,       "SO Ack" },
248     { SWITCH_OVER_REJECT,    "SO Rej" },
249     { PROT_PROTOCOL_ERROR,   "Prot Err" },
250     { RESET_SN_COM,          "Res SN Com" },
251     { RESET_SN_ACK,          "Res SN Ack" },
252     { ALLOCATION,            "BCC Alloc" },
253     { ALLOCATION_COMPLETE,   "BCC Alloc Comp" },
254     { ALLOCATION_REJECT,     "BCC Allo Rej" },
255     { DE_ALLOCATION,         "BCC DE-Alloc" },
256     { DE_ALLOCATION_COMPLETE,"BCC DE-Alloc Comp" },
257     { DE_ALLOCATION_REJECT,  "BCC DE-Alloc Rej" },
258     { AUDIT,                 "BCC Audit" },
259     { AUDIT_COMPLETE,        "BCC Audit Comp" },
260     { AN_FAULT,              "BCC AN Fault" },
261     { AN_FAULT_ACKNOWLEDGE,  "BCC AN Fault Ack" },
262     { BCC_PROTOCOL_ERROR,    "BCC Prot Error" },
263     { LINK_CONTROL,          "LinkCtrl" },
264     { LINK_CONTROL_ACK,      "LinkCtrl Ack" },
265     { 0,                     NULL } };
266
267 static const value_string pulse_type_values [] = {
268     { 0xff, "Pulsed normal polarity" },
269     { 0xfe, "Pulsed reversed polarity" },
270     { 0xfd, "Pulsed battery on c-wire" },
271     { 0xfc, "Pulsed on hook" },
272     { 0xfb, "Pulsed reduced battery" },
273     { 0xfa, "Pulsed no battery" },
274     { 0xf9, "Initial ring" },
275     { 0xf8, "Meter pulse" },
276     { 0xf7, "50 Hz pulse" },
277     { 0xf6, "Register recall (timed loop open)" },
278     { 0xf5, "Pulsed off hook (pulsed loop closed)" },
279     { 0xf4, "Pulsed b-wire connected to earth" },
280     { 0xf3, "Earth loop pulse" },
281     { 0xf2, "Pulsed b-wire connected to battery" },
282     { 0xf1, "Pulsed a-wire connected to earth" },
283     { 0xf0, "Pulsed a-wire connected to battery" },
284     { 0xef, "Pulsed c-wire connected to earth" },
285     { 0xee, "Pulsed c-wire disconnected" },
286     { 0xed, "Pulsed normal battery" },
287     { 0xec, "Pulsed a-wire disconnected" },
288     { 0xeb, "Pulsed b-wire disconnected" },
289     { 0,    NULL } };
290
291 static const value_string suppression_indication_values [] = {
292     { 0x0, "No suppression" },
293     { 0x1, "Suppression allowed by pre-defined V5.1 SIGNAL msg from LE" },
294     { 0x2, "Suppression allowed by pre-defined line signal from TE" },
295     { 0x3, "Suppression allowed by pre-defined V5.1 SIGNAL msg from LE or line signal from TE" },
296     { 0,   NULL } };
297
298 static const value_string ack_request_indication_values [] = {
299     { 0x0, "No acknowledgement requested" },
300     { 0x1, "Ending acknowledgement requested when finished each pulses" },
301     { 0x2, "Ending acknowledgement requested when finished all pulses" },
302     { 0x3, "Start of pulse acknowledgement requested" },
303     { 0,   NULL } };
304
305 static const value_string steady_signal_values [] = {
306     { 0x00, "Normal polarity" },
307     { 0x01, "Reversed polarity" },
308     { 0x02, "Battery on c-wire" },
309     { 0x03, "No battery on c-wire" },
310     { 0x04, "Off hook (loop closed)" },
311     { 0x05, "On hook (loop open)" },
312     { 0x06, "Battery on a-wire" },
313     { 0x07, "A-wire on earth" },
314     { 0x08, "No battery on a-wire" },
315     { 0x09, "No batery on b-wire" },
316     { 0x0a, "Reduced battery" },
317     { 0x0b, "No battery" },
318     { 0x0c, "Alternate reduced power / no power" },
319     { 0x0d, "Normal battery" },
320     { 0x0e, "Stop ringing" },
321     { 0x0f, "Start pilot frequency" },
322     { 0x10, "Stop pilot frequency" },
323     { 0x11, "Low impedance on b-wire" },
324     { 0x12, "B-wire connected to earth" },
325     { 0x13, "B-wire disconnected from earth" },
326     { 0x14, "Battery on b-wire" },
327     { 0x15, "Low loop impedance" },
328     { 0x16, "High loop impedance" },
329     { 0x17, "Anomalous loop impedance" },
330     { 0x18, "A-wire disconnected from earth" },
331     { 0x19, "C-wire on earth" },
332     { 0x1a, "C-wire disconnected from earth" },
333     { 0x1d, "Ramp to reverse polarity" },
334     { 0x1e, "Ramp to normal polarity" },
335     { 0,    NULL } };
336
337 static const value_string digit_ack_values [] = {
338     { 0x0, "No ending acknowledgement requested" },
339     { 0x1, "Ending acknowledgement requested when digit transmission is finished" },
340     { 0,   NULL } };
341
342 static const value_string line_info_values [] = {
343     { 0x00, "Impedance marker reset" },
344     { 0x01, "Impedance marker set" },
345     { 0x02, "Low loop impedance" },
346     { 0x03, "Anomalous loop impedance" },
347     { 0x04, "Anomalous line condition received"},
348     { 0,    NULL } };
349
350 static const value_string state_values [] = {
351     { 0x00, "AN0" },
352     { 0x01, "AN1" },
353     { 0x02, "AN2" },
354     { 0x03, "AN3" },
355     { 0x04, "AN4" },
356     { 0x05, "AN5" },
357     { 0x06, "AN6" },
358     { 0x07, "AN7" },
359     { 0x0f, "Not applicable" },
360     { 0,    NULL } };
361
362 static const value_string control_function_element_values [] = {
363     { 0x01, "FE101 (activate access)" },
364     { 0x02, "FE102 (activation initiated by user)" },
365     { 0x03, "FE103 (DS activated)" },
366     { 0x04, "FE104 (access activated)" },
367     { 0x05, "FE105 (deactivate access)" },
368     { 0x06, "FE106 (access deactivated)" },
369     { 0x11, "FE201/202 (unblock)" },
370     { 0x13, "FE203/204 (block)" },
371     { 0x15, "FE205 (block request)" },
372     { 0x16, "FE206 (performance grading)" },
373     { 0x17, "FE207 (D-channel block)" },
374     { 0x18, "FE208 (D-channel unblock)" },
375     { 0x19, "FE209 (TE out of service)" },
376     { 0x1A, "FE210 (failure inside network)" },
377     { 0,    NULL } };
378
379 static const value_string control_function_id_values [] = {
380     { 0x00, "Verify re-provisioning" },
381     { 0x01, "Ready for re-provisioning" },
382     { 0x02, "Not ready for re-provisioning" },
383     { 0x03, "Switch-over to new variant" },
384     { 0x04, "Re-provisioning started" },
385     { 0x05, "Cannot re-provision" },
386     { 0x06, "Request variant and interface ID" },
387     { 0x07, "Variant and interface ID" },
388     { 0x08, "Blocking started" },
389     { 0x10, "Restart request" },
390     { 0x11, "Restart complete" },
391     { 0x12, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS REQUEST" },
392     { 0x13, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS ACCEPTED" },
393     { 0x14, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS REJECTED" },
394     { 0x15, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS COMPLETED" },
395     { 0x16, "UNBLOCK ALL RELEVANT PSTN PORTS REQUEST" },
396     { 0x17, "UNBLOCK ALL RELEVANT PSTN PORTS ACCEPTED" },
397     { 0x18, "UNBLOCK ALL RELEVANT PSTN PORTS REJECTED" },
398     { 0x19, "UNBLOCK ALL RELEVANT PSTN PORTS COMPLETED" },
399     { 0x1a, "UNBLOCK ALL RELEVANT ISDN PORTS REQUEST" },
400     { 0x1b, "UNBLOCK ALL RELEVANT ISDN PORTS ACCEPTED" },
401     { 0x1c, "UNBLOCK ALL RELEVANT ISDN PORTS REJECTED" },
402     { 0x1d, "UNBLOCK ALL RELEVANT ISDN PORTS COMPLETED" },
403     { 0x1e, "BLOCK ALL PSTN PORTS REQUEST" },
404     { 0x1f, "BLOCK ALL PSTN PORTS ACCEPTED" },
405     { 0x20, "BLOCK ALL PSTN PORTS REJECTED" },
406     { 0x21, "BLOCK ALL PSTN PORTS COMPLETED" },
407     { 0x22, "BLOCK ALL ISDN PORTS REQUEST" },
408     { 0x23, "BLOCK ALL ISDN PORTS ACCEPTED" },
409     { 0x24, "BLOCK ALL ISDN PORTS REJECTED" },
410     { 0x25, "BLOCK ALL ISDN PORTS COMPLETED" },
411     { 0,    NULL } };
412
413 static const value_string control_function_id_values_short [] = {
414     { 0x00, "VerifyRe-pro" },
415     { 0x01, "ReadyForRe-pro" },
416     { 0x02, "NotReadyForRe-pro" },
417     { 0x03, "SO ToNewVar" },
418     { 0x04, "Re-pro Started" },
419     { 0x05, "CannotRe-pro" },
420     { 0x06, "ReqVar & intf ID" },
421     { 0x07, "Var & intf ID" },
422     { 0x08, "BlockStarted" },
423     { 0x10, "RestartReq" },
424     { 0x11, "RestartCompl" },
425     { 0x12, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS REQUEST" },
426     { 0x13, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS ACCEPTED" },
427     { 0x14, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS REJECTED" },
428     { 0x15, "UNBLOCK ALL RELEVANT PSTN AND ISDN PORTS COMPLETED" },
429     { 0x16, "UNBLOCK ALL RELEVANT PSTN PORTS REQUEST" },
430     { 0x17, "UNBLOCK ALL RELEVANT PSTN PORTS ACCEPTED" },
431     { 0x18, "UNBLOCK ALL RELEVANT PSTN PORTS REJECTED" },
432     { 0x19, "UNBLOCK ALL RELEVANT PSTN PORTS COMPLETED" },
433     { 0x1a, "UNBLOCK ALL RELEVANT ISDN PORTS REQUEST" },
434     { 0x1b, "UNBLOCK ALL RELEVANT ISDN PORTS ACCEPTED" },
435     { 0x1c, "UNBLOCK ALL RELEVANT ISDN PORTS REJECTED" },
436     { 0x1d, "UNBLOCK ALL RELEVANT ISDN PORTS COMPLETED" },
437     { 0x1e, "BLOCK ALL PSTN PORTS REQUEST" },
438     { 0x1f, "BLOCK ALL PSTN PORTS ACCEPTED" },
439     { 0x20, "BLOCK ALL PSTN PORTS REJECTED" },
440     { 0x21, "BLOCK ALL PSTN PORTS COMPLETED" },
441     { 0x22, "BLOCK ALL ISDN PORTS REQUEST" },
442     { 0x23, "BLOCK ALL ISDN PORTS ACCEPTED" },
443     { 0x24, "BLOCK ALL ISDN PORTS REJECTED" },
444     { 0x25, "BLOCK ALL ISDN PORTS COMPLETED" },
445     { 0,    NULL } };
446
447 static const value_string rejection_cause_values [] = {
448     { 0x00, "No standby C-channel available" },
449     { 0x01, "Target physical C-channel not operational" },
450     { 0x02, "Target physical C-channel not provisioned" },
451     { 0x03, "Protection switching impossible (AN/LE failure)" },
452     { 0x04, "Protection group mismatch" },
453     { 0x05, "Requested allocation exists already" },
454     { 0x06, "Target physical C-channel already has logical C-channel" },
455     { 0,    NULL } };
456
457 static const value_string error_cause_values [] = {
458     { 0x01, "Protocol discriminator error" },
459     { 0x04, "Message type unrecognized" },
460     { 0x07, "Mandatory information element missing" },
461     { 0x08, "Unrecognized information element" },
462     { 0x09, "Mandatory information element content error" },
463     { 0x0b, "Message not compatible with protection protocol state" },
464     { 0x0c, "Repeated mandatory information element" },
465     { 0x0d, "Too many information elements" },
466     { 0x0f, "Logical C-Channel identification error" },
467     { 0,    NULL } };
468
469 static const value_string performance_grading_values [] = {
470     { 0x00, "normal grade" },
471     { 0x01, "degraded" },
472     { 0,    NULL } };
473
474 static const value_string cp_rejection_cause_values [] = {
475     { 0x00, "variant unknown" },
476     { 0x01, "variant known, not ready" },
477     { 0x02, "re-provisioning in progress (re-pro)" },
478     { 0,    NULL } };
479
480 static const value_string reject_cause_type_values [] = {
481     { 0x00, "Unspecified" },
482     { 0x01, "Access network fault" },
483     { 0x02, "Access network blocked (internally)" },
484     { 0x03, "Connection already present at the PSTN user port to a different V5 time slot" },
485     { 0x04, "Connection already present at the V5 time slot(s) to a different port or ISDN user port time slot(s)" },
486     { 0x05, "Connection already present at the ISDN user port time slot(s) to a different V5 time slot(s)" },
487     { 0x06, "User port unavailable (blocked)" },
488     { 0x07, "De-allocation cannot completeddue to incompatible data content" },
489     { 0x08, "De-allocation cannot completeddue to V5 time slot(s) data incompatibility" },
490     { 0x09, "De-allocation cannot completeddue to port data incompatibility" },
491     { 0x0a, "De-allocation cannot completeddue to user port time slot(s) data incompatibility" },
492     { 0x0b, "User port not provisioned" },
493     { 0x0c, "Invalid V5 time slot(s) indication(s)" },
494     { 0x0d, "Invalid V5 2048 kbit/s link indication" },
495     { 0x0e, "Invalid user time slot(s) indication(s)" },
496     { 0x0f, "V5 time slot(s) being used as physikal C-channel(s)" },
497     { 0x10, "V5 link unavailable (blocked)" },
498     { 0,    NULL } };
499
500 static const value_string bcc_protocol_error_cause_type_values [] = {
501     { 0x01, "Protocol discriminator error" },
502     { 0x04, "Message type unrecognized" },
503     { 0x05, "Out of sequence information element" },
504     { 0x06, "Repeated optional information element" },
505     { 0x07, "Mandatory information element missing" },
506     { 0x08, "Unrecognized information element" },
507     { 0x09, "Mandatory information element content error" },
508     { 0x0a, "Optional infromation element content error" },
509     { 0x0b, "Message not compatible with the BCC protocol state" },
510     { 0x0c, "Repeated mandatory information element" },
511     { 0x0d, "Too many information element" },
512     { 0x0f, "BCC Reference Number coding error" },
513     { 0,    NULL } };
514
515 static const value_string connection_incomplete_reason_values [] = {
516     { 0x00, "Incomplete normal" },
517     { 0x01, "Access network fault" },
518     { 0x02, "User port not provisioned" },
519     { 0x03, "Invalid V5 time slot identification" },
520     { 0x04, "Invalid V5 2048 kbit/s link identification" },
521     { 0x05, "Time slot being used as physical C-channel" },
522     { 0,    NULL } };
523
524 static const value_string link_control_function_values [] = {
525     { 0x00, "FE-IDReq" },
526     { 0x01, "FE-IDAck" },
527     { 0x02, "FE-IDRel" },
528     { 0x03, "FE-IDRej" },
529     { 0x04, "FE301/302 (link unblock)" },
530     { 0x05, "FE303/304 (link block)" },
531     { 0x06, "FE305 (deferred link block request" },
532     { 0x07, "FE306 (non-deferred link block request)" },
533     { 0,    NULL } };
534
535 static const value_string cause_type_values [] = {
536     { 0x00, "Response to STATUS ENQUIRY" },
537     { 0x01, "Not used" },
538     { 0x03, "L3 address error" },
539     { 0x04, "Message type unrecognized" },
540     { 0x05, "Out of sequence information element" },
541     { 0x06, "Repeated optional information element" },
542     { 0x07, "Mandatory information element missing" },
543     { 0x08, "Unrecognized information element" },
544     { 0x09, "Mandatory information element content error" },
545     { 0x0a, "Optional information element content error" },
546     { 0x0b, "Message not compatible with path state" },
547     { 0x0c, "Repeated mandatory information element" },
548     { 0x0d, "Too many information elements" },
549     { 0,    NULL } };
550
551 /* PSTN protocol message info elements */
552 #define PULSE_NOTIFICATION       0xc0
553 #define LINE_INFORMATION         0x80
554 #define STATE                    0x90
555 #define AUTO_SIG_SEQUENCE        0xa0
556 #define SEQUENCE_RESPONSE        0xb0
557 #define PSTN_SEQUENCE_NUMBER     0x00
558 #define CADENCED_RINGING         0x01
559 #define PULSED_SIGNAL            0x02
560 #define STEADY_SIGNAL            0x03
561 #define DIGIT_SIGNAL             0x04
562 #define RECOGNITION_TIME         0x10
563 #define ENABLE_AUTO_ACK          0x11
564 #define DISABLE_AUTO_ACK         0x12
565 #define CAUSE                    0x13
566 #define RESOURCE_UNAVAILABLE     0x14
567 #define ENABLE_METERING          0x22
568 #define METERING_REPORT          0x23
569 #define ATTENUATION              0x24
570 /* Control protocol message info elements  */
571 #define PERFORMANCE_GRADING      0xe0
572 #define CP_REJECTION_CAUSE       0xf0
573 #define CONTROL_FUNCTION_ELEMENT 0x20
574 #define CONTROL_FUNCTION_ID      0x21
575 #define VARIANT                  0x22
576 #define INTERFACE_ID             0x23
577 /* Link control protocol message info elements */
578 #define LINK_CONTROL_FUNCTION 0x30
579 /* BCC protocol message info elements */
580 #define USER_PORT_ID             0x40
581 #define ISDN_PORT_TS_ID          0x41
582 #define V5_TIME_SLOT_ID          0x42
583 #define MULTI_SLOT_MAP           0x43
584 #define BCC_REJECT_CAUSE         0x44
585 #define BCC_PROTOCOL_ERROR_CAUSE 0x45
586 #define CONNECTION_INCOMPLETE    0x46
587 /* Protection protocol message info elements */
588 #define SEQUENCE_NUMBER          0x50
589 #define C_CHANNEL_ID             0x51
590 #define PP_REJECTION_CAUSE       0x52
591 #define PROTOCOL_ERROR           0x53
592
593 static const value_string info_element_values [] = {
594     { PULSE_NOTIFICATION,      "Pulse notification" },
595     { LINE_INFORMATION,        "Line information" },
596     { STATE,                   "State" },
597     { AUTO_SIG_SEQUENCE,       "Autonomous signal sequence" },
598     { SEQUENCE_RESPONSE,       "Sequence response" },
599     { PSTN_SEQUENCE_NUMBER,    "Sequence number" },
600     { CADENCED_RINGING,        "Cadenced ringing" },
601     { PULSED_SIGNAL,           "Pulsed signal" },
602     { STEADY_SIGNAL,           "Steady signal" },
603     { DIGIT_SIGNAL,            "Digit signal" },
604     { RECOGNITION_TIME,        "Recognition time" },
605     { ENABLE_AUTO_ACK,         "Enable autonomous acknowledge" },
606     { DISABLE_AUTO_ACK,        "Disable autonomous acknowledge" },
607     { CAUSE,                   "Cause" },
608     { RESOURCE_UNAVAILABLE,    "Resource unavailable" },
609     { ENABLE_METERING,         "Enable metering" },
610     { METERING_REPORT,         "Metering report" },
611     { ATTENUATION,             "Attenuation" },
612     { PERFORMANCE_GRADING,     "Performance grading" },
613     { CP_REJECTION_CAUSE,      "Rejection cause" },
614     { CONTROL_FUNCTION_ELEMENT,"Control function element" },
615     { CONTROL_FUNCTION_ID,     "Control function ID" },
616     { VARIANT,                 "Variant" },
617     { INTERFACE_ID,            "Interface ID" },
618     { LINK_CONTROL_FUNCTION,   "Link control funktion" },
619     { USER_PORT_ID,            "User port ID" },
620     { ISDN_PORT_TS_ID,         "ISDN port TS ID" },
621     { V5_TIME_SLOT_ID,         "V5 TS ID" },
622     { MULTI_SLOT_MAP,          "Multi-Slot map" },
623     { BCC_REJECT_CAUSE,        "Reject cause" },
624     { BCC_PROTOCOL_ERROR_CAUSE,"Protocol error cause" },
625     { CONNECTION_INCOMPLETE,   "Connection incomplete" },
626     { SEQUENCE_NUMBER,         "Sequence number" },
627     { C_CHANNEL_ID,            "Physical C-Channel ID" },
628     { PP_REJECTION_CAUSE,      "Rejection cause" },
629     { PROTOCOL_ERROR,          "Protocol error cause" },
630     { 0,                       NULL } };
631
632 static const value_string info_element_values_short [] = {
633     { PULSE_NOTIFICATION,      "PN" },
634     { LINE_INFORMATION,        "LI" },
635     { STATE,                   "ST" },
636     { AUTO_SIG_SEQUENCE,       "ASS" },
637     { SEQUENCE_RESPONSE,       "SR" },
638     { PSTN_SEQUENCE_NUMBER,    "SN" },
639     { CADENCED_RINGING,        "CR" },
640     { PULSED_SIGNAL,           "PS" },
641     { STEADY_SIGNAL,           "SS" },
642     { DIGIT_SIGNAL,            "DS" },
643     { RECOGNITION_TIME,        "RT" },
644     { ENABLE_AUTO_ACK,         "EAA" },
645     { DISABLE_AUTO_ACK,        "DAA" },
646     { CAUSE,                   "CA" },
647     { RESOURCE_UNAVAILABLE,    "RU" },
648     { ENABLE_METERING,         "EM" },
649     { METERING_REPORT,         "MR" },
650     { ATTENUATION,             "ATT" },
651     { PERFORMANCE_GRADING,     "PG" },
652     { CP_REJECTION_CAUSE,      "RC" },
653     { CONTROL_FUNCTION_ELEMENT,"CF element" },
654     { CONTROL_FUNCTION_ID,     "CF ID" },
655     { VARIANT,                 "Var" },
656     { INTERFACE_ID,            "Interface ID" },
657     { LINK_CONTROL_FUNCTION,   "LC F" },
658     { USER_PORT_ID,            "UP ID" },
659     { ISDN_PORT_TS_ID,         "ISDNP TS ID" },
660     { V5_TIME_SLOT_ID,         "V5 TS ID" },
661     { MULTI_SLOT_MAP,          "MS map" },
662     { BCC_REJECT_CAUSE,        "RC" },
663     { BCC_PROTOCOL_ERROR_CAUSE,"PEC" },
664     { CONNECTION_INCOMPLETE,   "CI" },
665     { SEQUENCE_NUMBER,         "SN" },
666     { C_CHANNEL_ID,            "Phy CChannel ID" },
667     { PP_REJECTION_CAUSE,      "RC" },
668     { PROTOCOL_ERROR,          "PEC" },
669     { 0,                       NULL } };
670
671
672 #define ADDRESS_OFFSET       1
673 #define ADDRESS_LENGTH       1
674 #define LOW_ADDRESS_OFFSET   2
675 #define LOW_ADDRESS_LENGTH   1
676 #define MSG_TYPE_OFFSET      3
677 #define MSG_TYPE_LENGTH      1
678 #define INFO_ELEMENT_OFFSET  4
679 #define INFO_ELEMENT_LENGTH  1
680
681
682 static void
683 dissect_pstn_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
684 {
685     proto_tree  *info_tree = NULL;
686     proto_item  *ti_info;
687     guint8      info_element_length = 1;
688     guint8      info_element = 0;
689     guint8      pstn_sequence_number_tmp = 0;
690
691     guint16 data_length;
692     tvbuff_t *info_tvb;
693     int info_offset = 0;
694
695     info_element = tvb_get_guint8(tvb, offset);
696
697     data_length = tvb_get_guint8(tvb, offset+1)+2;
698     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
699
700     if (tree) {
701         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
702         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
703     }
704
705     if (info_tree != NULL) {
706         pstn_sequence_number_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
707
708         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
709         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
710         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
711         proto_tree_add_item(info_tree, hf_v52_pstn_sequence_number, info_tvb, info_offset+2, info_element_length, FALSE);
712
713         col_append_fstr(pinfo->cinfo, COL_INFO, " | SN: %u", pstn_sequence_number_tmp);
714     }
715 }
716
717 static void
718 dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
719 {
720     proto_tree  *info_tree = NULL;
721     proto_item  *ti_info;
722     guint8      info_element_length = 1;
723     guint8      info_element = 0;
724     guint8      cadenced_ring_tmp = 0;
725     guint16 data_length;
726     tvbuff_t *info_tvb;
727     int info_offset = 0;
728
729     info_element = tvb_get_guint8(tvb, offset);
730
731     data_length = tvb_get_guint8(tvb, offset+1)+2;
732     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
733
734     if (tree) {
735         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
736         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
737     }
738
739     if (info_tree != NULL) {
740         cadenced_ring_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
741         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
742         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
743         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
744         proto_tree_add_item(info_tree, hf_v52_cadenced_ring, info_tvb, info_offset+2, info_element_length, FALSE);
745
746         col_append_str(pinfo->cinfo, COL_INFO, " | ");
747         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
748
749         col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", cadenced_ring_tmp);
750
751     }
752 }
753
754 static void
755 dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
756 {
757     proto_tree  *info_tree = NULL;
758     proto_item  *ti_info;
759     guint8      info_element_length = 1;
760     guint8      info_element = 0;
761
762     guint16 data_length;
763     tvbuff_t *info_tvb;
764     int info_offset = 0;
765
766     info_element = tvb_get_guint8(tvb, offset);
767
768     data_length = tvb_get_guint8(tvb, offset+1)+2;
769     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
770
771     if (tree) {
772         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
773         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
774     }
775
776     if (info_tree != NULL) {
777         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
778         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
779         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
780         proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, FALSE);
781
782         if (data_length > 3) {
783             proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+3, 1, FALSE);
784             proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+3, 1, FALSE);
785         }
786
787         if (data_length > 4) {
788             proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+4, 1, FALSE);
789             proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+4, 1, FALSE);
790         }
791
792         col_append_str(pinfo->cinfo, COL_INFO, " | ");
793         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
794
795         col_append_str(pinfo->cinfo, COL_INFO, ": ");
796         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2), pulse_type_values, "Unknown element"));
797
798     }
799 }
800
801 static void
802 dissect_steady_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
803 {
804     proto_tree  *info_tree = NULL;
805     proto_item  *ti_info;
806     guint8      info_element_length = 1;
807
808     guint8      info_element = 0;
809
810     guint16 data_length;
811     tvbuff_t *info_tvb;
812     int info_offset = 0;
813
814     info_element = tvb_get_guint8(tvb, offset);
815
816     data_length = tvb_get_guint8(tvb, offset+1)+2;
817     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
818
819     if (tree) {
820         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
821         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
822     }
823
824     if (info_tree != NULL) {
825         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
826         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
827         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
828         proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, FALSE);
829
830         col_append_str(pinfo->cinfo, COL_INFO, " | ");
831         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
832
833         col_append_str(pinfo->cinfo, COL_INFO, ": ");
834         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, steady_signal_values, "Unknown element"));
835     }
836 }
837
838 static void
839 dissect_digit_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
840 {
841     proto_tree  *info_tree = NULL;
842     proto_item  *ti_info;
843     guint8      info_element_length = 1;
844     guint8      buffer = 0;
845     guint8      info_element = 0;
846
847     guint16 data_length;
848     tvbuff_t *info_tvb;
849     int info_offset = 0;
850
851     info_element = tvb_get_guint8(tvb, offset);
852
853     data_length = tvb_get_guint8(tvb, offset+1)+2;
854     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
855
856     if (tree) {
857         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
858         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
859     }
860
861     if (info_tree != NULL) {
862         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
863         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
864         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
865
866         buffer = tvb_get_guint8(info_tvb, info_offset+2)>>6;
867         buffer = buffer&0x01;
868
869         proto_tree_add_uint_format(info_tree, hf_v52_digit_ack, info_tvb, info_offset+2, 1, buffer,
870                     "Digit ack request indication: %s",val_to_str(buffer,digit_ack_values,"unknown"));
871
872         buffer = tvb_get_guint8(info_tvb, info_offset+2)>>4;
873         buffer = buffer&0x03;
874
875         proto_tree_add_item(info_tree, hf_v52_digit_spare, info_tvb, info_offset+2, info_element_length, FALSE);
876         proto_tree_add_item(info_tree, hf_v52_digit_info, info_tvb, info_offset+2, info_element_length, FALSE);
877
878         col_append_str(pinfo->cinfo, COL_INFO, " | ");
879         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
880
881         col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", buffer);
882
883
884     }
885 }
886
887 static void
888 dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
889 {
890     proto_tree  *info_tree = NULL;
891     proto_item  *ti_info;
892     guint8      info_element_length = 1;
893     guint8      buffer = 0;
894     guint8      info_element = 0;
895
896     guint16 data_length;
897     tvbuff_t *info_tvb;
898     int info_offset = 0;
899
900     info_element = tvb_get_guint8(tvb, offset);
901
902     data_length = tvb_get_guint8(tvb, offset+1)+2;
903     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
904
905     if (tree) {
906         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
907         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
908     }
909
910     if (info_tree != NULL) {
911         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
912         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
913         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
914
915         buffer = tvb_get_guint8(info_tvb, info_offset+2)&0x7f;
916         /*Signal = Coding of pulse type*/
917         if(buffer>=0x6b)
918             proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, FALSE);
919         /*Signal = Coding of steady signal type*/
920         else if(buffer<=0x1a)
921             proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, FALSE);
922
923         proto_tree_add_item(info_tree, hf_v52_duration_type, info_tvb, info_offset+3, 1, FALSE);
924
925         col_append_str(pinfo->cinfo, COL_INFO, " | ");
926         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
927     }
928 }
929
930 static void
931 dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
932 {
933     proto_tree  *info_tree = NULL;
934     proto_item  *ti_info;
935     guint8      info_element_length = 1;
936     guint8      buffer = 0;
937     guint8      info_element = 0;
938
939     guint16 data_length;
940     tvbuff_t *info_tvb;
941     int info_offset = 0;
942
943     info_element = tvb_get_guint8(tvb, offset);
944
945     data_length = tvb_get_guint8(tvb, offset+1)+2;
946     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
947
948     if (tree) {
949         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
950         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
951     }
952
953     if (info_tree != NULL) {
954         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
955         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
956         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
957
958         buffer = tvb_get_guint8(info_tvb, info_offset+2)&0x7f;
959         /*Signal*/
960         if(buffer>=0x6b)
961             proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, FALSE);
962         else if(buffer<=0x1a)
963             proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, FALSE);
964
965         buffer = tvb_get_guint8(info_tvb, info_offset+3)&0x7f;
966         /*Response*/
967         if(buffer>=0x6b)
968             proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+3, 1, FALSE);
969         else if(buffer<=0x1a)
970             proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+3,1,FALSE);
971
972         if(tvb_length_remaining(info_tvb, info_offset+4)){
973             proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+4,1,FALSE);
974             proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+4,1,FALSE);
975         }
976         if(tvb_length_remaining(info_tvb, info_offset+5)){
977             proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+5,1,FALSE);
978             proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+5,1,FALSE);
979         }
980
981         col_append_str(pinfo->cinfo, COL_INFO, " | ");
982         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
983     }
984 }
985
986 static void
987 dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
988 {
989     proto_tree  *info_tree = NULL;
990     proto_item  *ti_info;
991     guint8      info_element_length = 1;
992     guint8      buffer = 0;
993     guint8      info_element = 0;
994
995     guint16 data_length;
996     tvbuff_t *info_tvb;
997     int info_offset = 0;
998
999     info_element = tvb_get_guint8(tvb, offset);
1000
1001     data_length = tvb_get_guint8(tvb, offset+1)+2;
1002     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1003
1004     if (tree) {
1005         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1006         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1007     }
1008
1009     if (info_tree != NULL) {
1010         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1011         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1012         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1013
1014         buffer = tvb_get_guint8(info_tvb, info_offset+2)&0x7f;
1015
1016         if(buffer>=0x6b)
1017             proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, FALSE);
1018         else if(buffer<=0x1a)
1019             proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, FALSE);
1020
1021         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1022         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1023     }
1024 }
1025
1026 static void
1027 dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1028 {
1029     proto_tree  *info_tree = NULL;
1030     proto_item  *ti_info;
1031     guint8      info_element_length = 1;
1032     guint8      info_element = 0;
1033
1034     guint16 data_length;
1035     tvbuff_t *info_tvb;
1036     int info_offset = 0;
1037
1038     info_element = tvb_get_guint8(tvb, offset);
1039
1040     data_length = tvb_get_guint8(tvb, offset+1)+2;
1041     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1042
1043     if (tree) {
1044         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1045         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1046     }
1047
1048     if (info_tree != NULL) {
1049         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1050         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1051         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"), info_element);
1052         proto_tree_add_item(info_tree, hf_v52_cause_type, info_tvb, info_offset+2, 1, FALSE);
1053
1054         if(tvb_length_remaining(info_tvb, info_offset+3))
1055             proto_tree_add_uint_format(info_tree, hf_v52_msg_type, info_tvb, info_offset+3, 1, tvb_get_guint8(info_tvb, info_offset+3),
1056                                 "Diagnostic: %s",val_to_str(tvb_get_guint8(info_tvb, info_offset+3), msg_type_values,"unknown"));
1057
1058         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1059         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1060
1061         col_append_str(pinfo->cinfo, COL_INFO, ": ");
1062         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, cause_type_values, "Unknown element"));
1063     }
1064 }
1065
1066 static void
1067 dissect_resource_unavailable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1068 {
1069     proto_tree  *info_tree = NULL;
1070     proto_item  *ti_info;
1071     guint8      info_element_length = 1;
1072     guint8      info_element = 0;
1073
1074     guint16 data_length;
1075     tvbuff_t *info_tvb;
1076     int info_offset = 0;
1077
1078     info_element = tvb_get_guint8(tvb, offset);
1079
1080     data_length = tvb_get_guint8(tvb, offset+1)+2;
1081     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1082
1083     if (tree) {
1084         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1085         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1086     }
1087
1088     if (info_tree != NULL) {
1089         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1090         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1091         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1092         proto_tree_add_item(info_tree, hf_v52_res_unavailable, info_tvb, info_offset+2, info_element_length, FALSE);
1093
1094         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1095         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1096     }
1097 }
1098
1099 static void
1100 dissect_pulse_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1101 {
1102     proto_tree  *info_tree = NULL;
1103     proto_item  *ti_info;
1104     guint8      info_element_length = 1;
1105     guint8      info_element = 0;
1106
1107     guint16 data_length;
1108     tvbuff_t *info_tvb;
1109     int info_offset = 0;
1110
1111     info_element = tvb_get_guint8(tvb, offset);
1112
1113     data_length = 1;
1114     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1115
1116     if (tree) {
1117         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1118         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1119     }
1120
1121     if (info_tree != NULL) {
1122         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1123         proto_tree_add_item(info_tree, hf_v52_pulse_notification, info_tvb, info_offset, info_element_length, FALSE);
1124
1125         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1126         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1127     }
1128 }
1129
1130 static void
1131 dissect_line_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1132 {
1133     proto_tree  *info_tree = NULL;
1134     proto_item  *ti_info;
1135     guint8      info_element_length = 1;
1136     guint8      info_element = 0;
1137
1138     guint16 data_length;
1139     tvbuff_t *info_tvb;
1140     int info_offset = 0;
1141
1142     info_element = tvb_get_guint8(tvb, offset);
1143
1144     data_length = 1;
1145     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1146
1147     if (tree) {
1148         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1149         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1150     }
1151
1152     if (info_tree != NULL) {
1153         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1154         proto_tree_add_item(info_tree, hf_v52_line_info, info_tvb, info_offset, info_element_length, FALSE);
1155
1156         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1157         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1158     }
1159 }
1160
1161 static void
1162 dissect_state(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1163 {
1164     proto_tree  *info_tree = NULL;
1165     proto_item  *ti_info;
1166     guint8      info_element_length = 1;
1167     guint8      info_element = 0;
1168
1169     guint16 data_length;
1170     tvbuff_t *info_tvb;
1171     int info_offset = 0;
1172
1173     info_element = tvb_get_guint8(tvb, offset);
1174
1175     data_length = 1;
1176     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1177
1178     if (tree) {
1179         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1180         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1181     }
1182
1183     if (info_tree != NULL) {
1184         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1185         proto_tree_add_item(info_tree, hf_v52_state, info_tvb, info_offset, info_element_length, FALSE);
1186
1187         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1188         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1189     }
1190 }
1191
1192 static void
1193 dissect_auto_sig_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1194 {
1195     proto_tree  *info_tree = NULL;
1196     proto_item  *ti_info;
1197     guint8      info_element_length = 1;
1198     guint8      info_element = 0;
1199
1200     guint16 data_length;
1201     tvbuff_t *info_tvb;
1202     int info_offset = 0;
1203
1204     info_element = tvb_get_guint8(tvb, offset);
1205
1206     data_length = 1;
1207     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1208
1209     if (tree) {
1210         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1211         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1212     }
1213
1214     if (info_tree != NULL) {
1215         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1216         proto_tree_add_item(info_tree, hf_v52_auto_signalling_sequence, info_tvb, info_offset, info_element_length, FALSE);
1217
1218         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1219         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1220     }
1221 }
1222
1223 static void
1224 dissect_sequence_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1225 {
1226     proto_tree  *info_tree = NULL;
1227     proto_item  *ti_info;
1228     guint8      info_element_length = 1;
1229     guint8      info_element = 0;
1230
1231     guint16 data_length;
1232     tvbuff_t *info_tvb;
1233     int info_offset = 0;
1234
1235     info_element = tvb_get_guint8(tvb, offset);
1236
1237     data_length = 1;
1238     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1239
1240     if (tree) {
1241         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1242         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1243     }
1244
1245     if (info_tree != NULL) {
1246         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1247         proto_tree_add_item(info_tree, hf_v52_sequence_response, info_tvb, info_offset, info_element_length, FALSE);
1248
1249         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1250         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1251     }
1252 }
1253
1254 static void
1255 dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1256 {
1257     proto_tree  *info_tree = NULL;
1258     proto_item  *ti_info;
1259     guint8      info_element_length = 1;
1260     guint8      info_element = 0;
1261
1262     guint16 data_length;
1263     tvbuff_t *info_tvb;
1264     int info_offset = 0;
1265
1266     info_element = tvb_get_guint8(tvb, offset);
1267
1268     data_length = tvb_get_guint8(tvb, offset+1)+2;
1269     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1270
1271     if (tree) {
1272         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1273         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1274     }
1275
1276     if (info_tree != NULL) {
1277         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1278         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1279         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1280         proto_tree_add_item(info_tree, hf_v52_control_function_element, info_tvb, info_offset+2, info_element_length, FALSE);
1281
1282         if (message_type_tmp == 0x11) {}
1283         else {
1284             col_append_str(pinfo->cinfo, COL_INFO, " | ");
1285             col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_element_values, "Unknown element"));
1286         }
1287     }
1288 }
1289
1290 static void
1291 dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1292 {
1293     proto_tree  *info_tree = NULL;
1294     proto_item  *ti_info;
1295     guint8      info_element_length = 1;
1296     guint8      info_element = 0;
1297
1298     guint16 data_length;
1299     tvbuff_t *info_tvb;
1300     int info_offset = 0;
1301
1302     info_element = tvb_get_guint8(tvb, offset);
1303
1304     data_length = tvb_get_guint8(tvb, offset+1)+2;
1305     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1306
1307     if (tree) {
1308         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1309         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1310     }
1311
1312     if (info_tree != NULL) {
1313         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1314         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1315         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1316         proto_tree_add_item(info_tree, hf_v52_control_function_id, info_tvb, info_offset+2, info_element_length, FALSE);
1317
1318         if (message_type_tmp == 0x13) {}
1319         else {
1320             col_append_str(pinfo->cinfo, COL_INFO, " | ");
1321             col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, control_function_id_values_short, "Unknown layer3 element"));
1322         }
1323     }
1324 }
1325
1326 static void
1327 dissect_variant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1328 {
1329     proto_tree  *info_tree = NULL;
1330     proto_item  *ti_info;
1331     guint8      info_element_length = 1;
1332     guint8      info_element = 0;
1333     guint8      variantValue = 0;
1334
1335     guint16 data_length;
1336     tvbuff_t *info_tvb;
1337     int info_offset = 0;
1338
1339     info_element = tvb_get_guint8(tvb, offset);
1340
1341     data_length = tvb_get_guint8(tvb, offset+1)+2;
1342     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1343
1344     if (tree) {
1345         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1346         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1347     }
1348
1349     if (info_tree != NULL) {
1350         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1351         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1352         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1353         proto_tree_add_item(info_tree, hf_v52_variant, info_tvb, info_offset+2, info_element_length, FALSE);
1354
1355         variantValue = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
1356         col_append_fstr(pinfo->cinfo, COL_INFO, " | Var: %u", variantValue);
1357     }
1358 }
1359
1360 static void
1361 dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1362 {
1363     proto_tree  *info_tree = NULL;
1364     proto_item  *ti_info;
1365     guint8      info_element_length = 1;
1366     guint8      info_element = 0;
1367     guint8      interfaceAllIdValue = 0;
1368
1369     guint16 data_length;
1370     tvbuff_t *info_tvb;
1371     int info_offset = 0;
1372
1373     info_element = tvb_get_guint8(tvb, offset);
1374
1375     data_length = tvb_get_guint8(tvb, offset+1)+2;
1376     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1377
1378     if (tree) {
1379         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1380         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1381     }
1382
1383     if (info_tree != NULL) {
1384         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1385         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1386         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1387         proto_tree_add_item(info_tree, hf_v52_if_up_id, info_tvb, info_offset+2, info_element_length, FALSE);
1388         proto_tree_add_item(info_tree, hf_v52_if_id, info_tvb, info_offset+3, info_element_length, FALSE);
1389         proto_tree_add_item(info_tree, hf_v52_if_low_id, info_tvb, info_offset+4, info_element_length, FALSE);
1390         proto_tree_add_item(info_tree, hf_v52_if_all_id, info_tvb, info_offset+2, info_element_length, FALSE);
1391
1392         interfaceAllIdValue = (tvb_get_guint8(info_tvb, info_offset+2)<<16)+(tvb_get_guint8(info_tvb, info_offset+3)<<8)+(tvb_get_guint8(info_tvb, info_offset+4));
1393
1394         col_append_fstr(pinfo->cinfo, COL_INFO, " | Intf. ID: %u", interfaceAllIdValue);
1395     }
1396 }
1397
1398 static void
1399 dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1400 {
1401     proto_tree  *info_tree = NULL;
1402     proto_item  *ti_info;
1403     guint8      info_element_length = 1;
1404     guint8      info_element = 0;
1405     guint8      hf_v52_sequence_number_tmp = 0;
1406     guint16 data_length;
1407     tvbuff_t *info_tvb;
1408     int info_offset = 0;
1409
1410     info_element = tvb_get_guint8(tvb, offset);
1411
1412     data_length = tvb_get_guint8(tvb, offset+1)+2;
1413     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1414
1415     if (tree) {
1416         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1417         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1418     }
1419
1420     if (info_tree != NULL) {
1421         hf_v52_sequence_number_tmp = tvb_get_guint8(info_tvb, info_offset+2)-0x80;
1422         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1423         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1424         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1425         proto_tree_add_item(info_tree, hf_v52_sequence_number, info_tvb, info_offset+2, info_element_length, FALSE);
1426
1427         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1428         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset), info_element_values_short, "Unknown element"));
1429
1430         col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", hf_v52_sequence_number_tmp);
1431
1432
1433     }
1434 }
1435
1436 static void
1437 dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1438 {
1439     proto_tree  *info_tree = NULL;
1440     proto_item  *ti_info;
1441     guint8      info_element_length = 1;
1442     guint8      info_element = 0;
1443     guint8      hf_v52_v5_link_id_cc_tmp = 0;
1444     guint8      hf_v52_v5_time_slot_cc_tmp = 0;
1445
1446     guint16 data_length;
1447     tvbuff_t *info_tvb;
1448     int info_offset = 0;
1449
1450     info_element = tvb_get_guint8(tvb, offset);
1451
1452     data_length = tvb_get_guint8(tvb, offset+1)+2;
1453     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1454
1455     if (tree) {
1456         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1457         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1458     }
1459
1460     if (info_tree != NULL) {
1461         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1462         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1463         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1464         proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, FALSE);
1465         proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, FALSE);
1466
1467         hf_v52_v5_link_id_cc_tmp = tvb_get_guint8(info_tvb, info_offset+2);
1468         hf_v52_v5_time_slot_cc_tmp =tvb_get_guint8(info_tvb, info_offset+3);
1469
1470         col_append_fstr(pinfo->cinfo, COL_INFO, " | Phy C-ch: %u, %u", hf_v52_v5_link_id_cc_tmp, hf_v52_v5_time_slot_cc_tmp);
1471     }
1472 }
1473
1474 static void
1475 dissect_pp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1476 {
1477     proto_tree  *info_tree = NULL;
1478     proto_item  *ti_info;
1479     guint8      info_element_length = 1;
1480     guint8      info_element = 0;
1481
1482     guint16 data_length;
1483     tvbuff_t *info_tvb;
1484     int info_offset = 0;
1485
1486     info_element = tvb_get_guint8(tvb, offset);
1487
1488     data_length = tvb_get_guint8(tvb, offset+1)+2;
1489     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1490
1491     if (tree) {
1492         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1493         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1494     }
1495
1496     if (info_tree != NULL) {
1497         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1498         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1499         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1500         proto_tree_add_item(info_tree, hf_v52_rejection_cause, info_tvb, info_offset+2, info_element_length, FALSE);
1501
1502         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1503         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, rejection_cause_values, "Unknown element"));
1504     }
1505 }
1506
1507 static void
1508 dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1509 {
1510     proto_tree  *info_tree = NULL;
1511     proto_item  *ti_info;
1512     guint8      info_element_length = 1;
1513     guint8      info_element = 0;
1514
1515     guint16 data_length;
1516     tvbuff_t *info_tvb;
1517     int info_offset = 0;
1518
1519     info_element = tvb_get_guint8(tvb, offset);
1520
1521     data_length = tvb_get_guint8(tvb, offset+1)+2;
1522     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1523
1524     if (tree) {
1525         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1526         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1527     }
1528
1529     if (info_tree != NULL) {
1530         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1531         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1532         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1533         proto_tree_add_item(info_tree, hf_v52_error_cause, info_tvb, info_offset+2, info_element_length, FALSE);
1534         proto_tree_add_item(info_tree, hf_v52_diagnostic_msg, info_tvb, info_offset+3, info_element_length, FALSE);
1535         proto_tree_add_item(info_tree, hf_v52_diagnostic_element, info_tvb, info_offset+4, info_element_length, FALSE);
1536
1537         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1538         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, error_cause_values, "Unknown element"));
1539
1540     }
1541 }
1542
1543 static void
1544 dissect_performance_grading(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1545 {
1546     proto_tree  *info_tree = NULL;
1547     proto_item  *ti_info;
1548     guint8      info_element_length = 1;
1549     guint8      info_element = 0;
1550
1551     guint16 data_length;
1552     tvbuff_t *info_tvb;
1553     int info_offset = 0;
1554
1555     info_element = tvb_get_guint8(tvb, offset);
1556
1557     data_length = 1;
1558     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1559
1560     if (tree) {
1561         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1562         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1563     }
1564
1565     if (info_tree != NULL) {
1566         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1567         proto_tree_add_item(info_tree, hf_v52_performance_grading, info_tvb, info_offset, info_element_length, FALSE);
1568
1569         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1570         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset)-0xe0, performance_grading_values, "Unknown element"));
1571
1572     }
1573 }
1574
1575 static void
1576 dissect_cp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1577 {
1578     proto_tree  *info_tree = NULL;
1579     proto_item  *ti_info;
1580     guint8      info_element_length = 1;
1581     guint8      info_element = 0;
1582
1583     guint16 data_length;
1584     tvbuff_t *info_tvb;
1585     int info_offset = 0;
1586
1587     info_element = tvb_get_guint8(tvb, offset);
1588
1589     data_length = 1;
1590     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1591
1592     if (tree) {
1593         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1594         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1595     }
1596
1597     if (info_tree != NULL) {
1598         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1599         proto_tree_add_item(info_tree, hf_v52_cp_rejection_cause, info_tvb, info_offset, info_element_length, FALSE);
1600
1601         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1602         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset)-0xe0, cp_rejection_cause_values, "Unknown element"));
1603     }
1604 }
1605
1606 static void
1607 dissect_user_port_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1608 {
1609     proto_tree  *info_tree = NULL;
1610     proto_item  *ti_info;
1611     int         hf_v52_pstn_user_port_tmp = 0;
1612     int         hf_v52_isdn_user_port_tmp = 0;
1613     guint8      info_element_length = 1;
1614     guint8      buffer = 0;
1615     guint8      info_element = 0;
1616
1617     guint16 data_length;
1618     tvbuff_t *info_tvb;
1619     int info_offset = 0;
1620
1621     info_element = tvb_get_guint8(tvb, offset);
1622
1623     data_length = tvb_get_guint8(tvb, offset+1)+2;
1624     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1625
1626     if (tree) {
1627         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1628         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1629     }
1630
1631     if (info_tree != NULL) {
1632         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1633         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1634         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1635
1636         buffer = tvb_get_guint8(info_tvb, info_offset+2)&0x01;
1637
1638         if(buffer==0x01){
1639             proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id, info_tvb, info_offset+2, 1, FALSE);
1640             proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id_lower, info_tvb, info_offset+3, 1, FALSE);
1641
1642             hf_v52_pstn_user_port_tmp = (((tvb_get_guint8(info_tvb, info_offset+2)>>1)<<8)+(tvb_get_guint8(info_tvb, info_offset+3)));
1643
1644             col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN port: %u", hf_v52_pstn_user_port_tmp);
1645         }
1646         else if(buffer == 0x00){
1647             proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id, info_tvb, info_offset+2, 1, FALSE);
1648             proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id_lower, info_tvb, info_offset+3, 1, FALSE);
1649
1650             hf_v52_isdn_user_port_tmp = (((tvb_get_guint8(info_tvb, info_offset+2)>>2)<<7)+((tvb_get_guint8( info_tvb, info_offset+3)>>1)));
1651
1652             col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", hf_v52_isdn_user_port_tmp);
1653         }
1654     }
1655 }
1656
1657 static void
1658 dissect_isdn_port_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1659 {
1660     proto_tree  *info_tree = NULL;
1661     proto_item  *ti_info;
1662     guint8      info_element_length = 1;
1663     guint8      info_element = 0;
1664     guint8      isdn_user_port_ts_num_tmp = 0;
1665
1666     guint16 data_length;
1667     tvbuff_t *info_tvb;
1668     int info_offset = 0;
1669
1670     info_element = tvb_get_guint8(tvb, offset);
1671
1672     data_length = tvb_get_guint8(tvb, offset+1)+2;
1673     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1674
1675     if (tree) {
1676         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1677         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1678     }
1679
1680     if (info_tree != NULL) {
1681         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1682         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1683         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1684         proto_tree_add_item(info_tree, hf_v52_isdn_user_port_ts_num, info_tvb, info_offset+2, info_element_length, FALSE);
1685
1686         isdn_user_port_ts_num_tmp = (tvb_get_guint8(info_tvb, info_offset+2)) -  128;
1687         col_append_str(pinfo->cinfo, COL_INFO, ", ");
1688         col_append_fstr(pinfo->cinfo, COL_INFO, "%x", isdn_user_port_ts_num_tmp);
1689     }
1690 }
1691
1692 static void
1693 dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1694 {
1695     proto_tree  *info_tree = NULL;
1696     proto_item  *ti_info;
1697     guint8      info_element_length = 1;
1698     guint8      info_element = 0;
1699     guint8      v5_link_id_tmp = 0;
1700     guint8      v5_time_slot_tmp = 0;
1701
1702     guint16 data_length;
1703     tvbuff_t *info_tvb;
1704     int info_offset = 0;
1705
1706     info_element = tvb_get_guint8(tvb, offset);
1707
1708     data_length = tvb_get_guint8(tvb, offset+1)+2;
1709     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1710
1711     if (tree) {
1712         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1713         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1714     }
1715
1716     if (info_tree != NULL) {
1717         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1718         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1719         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1720         proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, FALSE);
1721         proto_tree_add_item(info_tree, hf_v52_override, info_tvb, info_offset+3, info_element_length, FALSE);
1722         proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, FALSE);
1723
1724         v5_link_id_tmp = tvb_get_guint8(info_tvb, info_offset+2);
1725         v5_time_slot_tmp = tvb_get_guint8(info_tvb, info_offset+3);
1726
1727         if (v5_time_slot_tmp >= 64) {
1728             v5_time_slot_tmp = v5_time_slot_tmp - 64;
1729         } else {};
1730
1731         if (v5_time_slot_tmp >= 32) {
1732             v5_time_slot_tmp = v5_time_slot_tmp - 32;
1733         } else {};
1734
1735             col_append_fstr(pinfo->cinfo, COL_INFO, " | V5 Link: %u, %u ", v5_link_id_tmp, v5_time_slot_tmp);
1736     }
1737 }
1738
1739 static void
1740 dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1741 {
1742     proto_tree  *info_tree = NULL;
1743     proto_item  *ti_info;
1744     guint8      info_element_length = 1;
1745     guint8      info_element = 0;
1746
1747     guint16 data_length;
1748     tvbuff_t *info_tvb;
1749     int info_offset = 0;
1750
1751     info_element = tvb_get_guint8(tvb, offset);
1752
1753     data_length = tvb_get_guint8(tvb, offset+1)+2;
1754     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1755
1756     if (tree) {
1757         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1758         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1759     }
1760
1761     if (info_tree != NULL) {
1762         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1763         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1764         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1765         proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, FALSE);
1766
1767         col_append_fstr(pinfo->cinfo, COL_INFO, " | V5MSlink ID:%u",tvb_get_guint8(info_tvb, info_offset+2));
1768
1769         if(tvb_length_remaining(info_tvb, info_offset+3))
1770             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+3, info_element_length, FALSE);
1771         if(tvb_length_remaining(info_tvb, info_offset+4))
1772             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+4, info_element_length, FALSE);
1773         if(tvb_length_remaining(info_tvb, info_offset+5))
1774             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+5, info_element_length, FALSE);
1775         if(tvb_length_remaining(info_tvb, info_offset+6))
1776             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+6, info_element_length, FALSE);
1777         if(tvb_length_remaining(info_tvb, info_offset+7))
1778             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+7, info_element_length, FALSE);
1779         if(tvb_length_remaining(info_tvb, info_offset+8))
1780             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+8, info_element_length, FALSE);
1781         if(tvb_length_remaining(info_tvb, info_offset+9))
1782             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+9, info_element_length, FALSE);
1783         if(tvb_length_remaining(info_tvb, info_offset+10))
1784             proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+10, info_element_length, FALSE);
1785     }
1786 }
1787
1788 static void
1789 dissect_bcc_rejct_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1790 {
1791     proto_tree  *info_tree = NULL;
1792     proto_item  *ti_info;
1793     guint8      info_element_length = 1;
1794     guint8      info_element = 0;
1795
1796     guint16 data_length;
1797     tvbuff_t *info_tvb;
1798     int info_offset = 0;
1799
1800     info_element = tvb_get_guint8(tvb, offset);
1801
1802     data_length = tvb_get_guint8(tvb, offset+1)+2;
1803     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1804
1805     if (tree) {
1806         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1807         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1808     }
1809
1810     if (info_tree != NULL) {
1811         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1812         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1813         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1814         proto_tree_add_item(info_tree, hf_v52_reject_cause_type, info_tvb, info_offset+2, info_element_length, FALSE);
1815
1816         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1817         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, reject_cause_type_values, "Unknown element"));
1818     }
1819 }
1820
1821 static void
1822 dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1823 {
1824     proto_tree  *info_tree = NULL;
1825     proto_item  *ti_info;
1826     guint8      info_element_length = 1;
1827     guint8      info_element = 0;
1828
1829     guint16 data_length;
1830     tvbuff_t *info_tvb;
1831     int info_offset = 0;
1832
1833     info_element = tvb_get_guint8(tvb, offset);
1834
1835     data_length = tvb_get_guint8(tvb, offset+1)+2;
1836     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1837
1838     if (tree) {
1839         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1840         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1841     }
1842
1843     if (info_tree != NULL) {
1844         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1845         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1846         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1847         proto_tree_add_item(info_tree, hf_v52_bcc_protocol_error_cause, info_tvb, info_offset+2, info_element_length, FALSE);
1848
1849         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1850         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, bcc_protocol_error_cause_type_values, "Unknown element"));
1851
1852         if(tvb_length_remaining(info_tvb, info_offset+3))
1853             proto_tree_add_item(info_tree, hf_v52_diagnostic_message, info_tvb, info_offset+3, info_element_length, FALSE);
1854         if(tvb_length_remaining(info_tvb, info_offset+4))
1855             proto_tree_add_item(info_tree, hf_v52_diagnostic_information, info_tvb, info_offset+4, info_element_length, FALSE);
1856     }
1857 }
1858
1859 static void
1860 dissect_connection_incomplete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1861 {
1862     proto_tree  *info_tree = NULL;
1863     proto_item  *ti_info;
1864     guint8      info_element_length = 1;
1865     guint8      info_element = 0;
1866
1867     guint16 data_length;
1868     tvbuff_t *info_tvb;
1869     int info_offset = 0;
1870
1871     info_element = tvb_get_guint8(tvb, offset);
1872
1873     data_length = tvb_get_guint8(tvb, offset+1)+2;
1874     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1875
1876     if (tree) {
1877         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1878         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1879     }
1880
1881     if (info_tree != NULL) {
1882         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1883         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1884         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1885         proto_tree_add_item(info_tree, hf_v52_connection_incomplete_reason, info_tvb, info_offset+2, info_element_length, FALSE);
1886
1887
1888         col_append_str(pinfo->cinfo, COL_INFO, " | ");
1889         if ((tvb_get_guint8(info_tvb, info_offset+2) < 0x80)) {
1890             col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2), connection_incomplete_reason_values, "Unknown element"));
1891         }
1892         else {
1893             col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, connection_incomplete_reason_values, "Unknown element"));
1894         }
1895
1896     }
1897 }
1898
1899 static void
1900 dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1901 {
1902     proto_tree  *info_tree = NULL;
1903     proto_item  *ti_info;
1904     guint8      info_element_length = 1;
1905     guint8      info_element = 0;
1906
1907     guint16 data_length;
1908     tvbuff_t *info_tvb;
1909     int info_offset = 0;
1910
1911     info_element = tvb_get_guint8(tvb, offset);
1912
1913     data_length = tvb_get_guint8(tvb, offset+1)+2;
1914     info_tvb    = tvb_new_subset(tvb, offset, data_length, data_length);
1915
1916     if (tree) {
1917         ti_info = proto_tree_add_text(tree, info_tvb, info_offset, -1, "Info Element:");
1918         info_tree = proto_item_add_subtree(ti_info, ett_v52_info);
1919     }
1920
1921     if (info_tree != NULL) {
1922         proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, FALSE);
1923         proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, FALSE);
1924         proto_item_append_text(ti_info, " %s (0x%x)",val_to_str(info_element, info_element_values, "unknown info element"),info_element);
1925         proto_tree_add_item(info_tree, hf_v52_link_control_function, info_tvb, info_offset+2, info_element_length, FALSE);
1926
1927         if (message_type_tmp == 0x31) {}
1928         else {
1929             col_append_str(pinfo->cinfo, COL_INFO, " | ");
1930             col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(info_tvb, info_offset+2)-0x80, link_control_function_values, "Unknown element"));
1931         }
1932     }
1933 }
1934
1935
1936
1937 static void
1938 dissect_v52_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1939 {
1940     int     offset = 4;
1941     guint8      info_element, info_element_length;
1942     int     old_offset;
1943     int     singleoctet;
1944
1945     while(tvb_length_remaining(tvb,offset)){
1946         singleoctet = 0;
1947         old_offset = offset;
1948         info_element = tvb_get_guint8(tvb, offset);
1949         switch(info_element){
1950             case PSTN_SEQUENCE_NUMBER:
1951                 info_element_length = tvb_get_guint8(tvb,offset+1);
1952                 dissect_pstn_sequence_number(tvb, pinfo, tree, offset);
1953                 offset +=info_element_length+2;
1954             break;
1955             case CADENCED_RINGING:
1956                 info_element_length = tvb_get_guint8(tvb,offset+1);
1957                 dissect_cadenced_ring(tvb, pinfo, tree, offset);
1958                 offset +=info_element_length+2;
1959             break;
1960             case PULSED_SIGNAL:
1961                 info_element_length = tvb_get_guint8(tvb,offset+1);
1962                 dissect_pulsed_signal(tvb, pinfo, tree, offset);
1963                 offset +=info_element_length+2;
1964             break;
1965             case STEADY_SIGNAL:
1966                 info_element_length = tvb_get_guint8(tvb,offset+1);
1967                 dissect_steady_signal(tvb, pinfo, tree, offset);
1968                 offset +=info_element_length+2;
1969             break;
1970             case DIGIT_SIGNAL:
1971                 info_element_length = tvb_get_guint8(tvb,offset+1);
1972                 dissect_digit_signal(tvb, pinfo, tree, offset);
1973                 offset +=info_element_length+2;
1974             break;
1975             case RECOGNITION_TIME:
1976                 info_element_length = tvb_get_guint8(tvb,offset+1);
1977                 dissect_recognition_time(tvb, pinfo, tree, offset);
1978                 offset +=info_element_length+2;
1979             break;
1980             case ENABLE_AUTO_ACK:
1981                 info_element_length = tvb_get_guint8(tvb,offset+1);
1982                 dissect_enable_auto_ack(tvb, pinfo, tree, offset);
1983                 offset +=info_element_length+2;
1984             break;
1985             case DISABLE_AUTO_ACK:
1986                 info_element_length = tvb_get_guint8(tvb,offset+1);
1987                 dissect_disable_auto_ack(tvb, pinfo, tree, offset);
1988                 offset +=info_element_length+2;
1989             break;
1990             case CAUSE:
1991                 info_element_length = tvb_get_guint8(tvb,offset+1);
1992                 dissect_cause(tvb, pinfo, tree, offset);
1993                 offset +=info_element_length+2;
1994             break;
1995             case RESOURCE_UNAVAILABLE:
1996                 info_element_length = tvb_get_guint8(tvb,offset+1);
1997                 dissect_resource_unavailable(tvb, pinfo, tree, offset);
1998                 offset +=info_element_length+2;
1999             break;
2000             case PULSE_NOTIFICATION:
2001                 dissect_pulse_notification(tvb, pinfo, tree, offset);
2002                 singleoctet = 1;
2003             break;
2004             case LINE_INFORMATION:
2005                 dissect_line_information(tvb, pinfo, tree, offset);
2006                 singleoctet = 1;
2007             break;
2008             case STATE:
2009                 dissect_state(tvb, pinfo, tree, offset);
2010                 singleoctet = 1;
2011             break;
2012             case AUTO_SIG_SEQUENCE:
2013                 dissect_auto_sig_sequence(tvb, pinfo, tree, offset);
2014                 singleoctet = 1;
2015             break;
2016             case SEQUENCE_RESPONSE:
2017                 dissect_sequence_response(tvb, pinfo, tree, offset);
2018                 singleoctet = 1;
2019             break;
2020
2021             case CONTROL_FUNCTION_ELEMENT:
2022                 info_element_length = tvb_get_guint8(tvb,offset+1);
2023                 dissect_control_function_element(tvb, pinfo, tree, offset);
2024                 offset +=info_element_length+2;
2025             break;
2026             case CONTROL_FUNCTION_ID:
2027                 info_element_length = tvb_get_guint8(tvb,offset+1);
2028                 dissect_control_function_id(tvb, pinfo, tree, offset);
2029                 offset +=info_element_length+2;
2030             break;
2031             case VARIANT:
2032                 info_element_length = tvb_get_guint8(tvb,offset+1);
2033                 dissect_variant(tvb, pinfo, tree, offset);
2034                 offset +=info_element_length+2;
2035             break;
2036             case INTERFACE_ID:
2037                 info_element_length = tvb_get_guint8(tvb,offset+1);
2038                 dissect_interface_id(tvb, pinfo, tree, offset);
2039                 offset +=info_element_length+2;
2040             break;
2041             case SEQUENCE_NUMBER:
2042                 info_element_length = tvb_get_guint8(tvb,offset+1);
2043                 dissect_sequence_number(tvb, pinfo, tree, offset);
2044                 offset +=info_element_length+2;
2045             break;
2046             case C_CHANNEL_ID:
2047                 info_element_length = tvb_get_guint8(tvb,offset+1);
2048                 dissect_physical_c_channel_id(tvb, pinfo, tree, offset);
2049                 offset +=info_element_length+2;
2050             break;
2051             case PP_REJECTION_CAUSE:
2052                 info_element_length = tvb_get_guint8(tvb,offset+1);
2053                 dissect_pp_rejection_cause(tvb, pinfo, tree, offset);
2054                 offset +=info_element_length+2;
2055             break;
2056             case PROTOCOL_ERROR:
2057                 info_element_length = tvb_get_guint8(tvb,offset+1);
2058                 dissect_protocol_error(tvb, pinfo, tree, offset);
2059                 offset +=info_element_length+2;
2060             break;
2061             case PERFORMANCE_GRADING:
2062                 dissect_performance_grading(tvb, pinfo, tree, offset);
2063                 singleoctet = 1;
2064             break;
2065             case CP_REJECTION_CAUSE:
2066                 dissect_cp_rejection_cause(tvb, pinfo, tree, offset);
2067                 singleoctet = 1;
2068             break;
2069             case USER_PORT_ID:
2070                 info_element_length = tvb_get_guint8(tvb,offset+1);
2071                 dissect_user_port_identification(tvb, pinfo, tree, offset);
2072                 offset +=info_element_length+2;
2073             break;
2074             case ISDN_PORT_TS_ID:
2075                 info_element_length = tvb_get_guint8(tvb,offset+1);
2076                 dissect_isdn_port_time_slot_identification(tvb, pinfo, tree, offset);
2077                 offset +=info_element_length+2;
2078             break;
2079             case V5_TIME_SLOT_ID:
2080                 info_element_length = tvb_get_guint8(tvb,offset+1);
2081                 dissect_v5_time_slot_identification(tvb, pinfo, tree, offset);
2082                 offset +=info_element_length+2;
2083             break;
2084             case MULTI_SLOT_MAP:
2085                 info_element_length = tvb_get_guint8(tvb,offset+1);
2086                 dissect_multi_slot_map(tvb, pinfo, tree, offset);
2087                 offset +=info_element_length+2;
2088             break;
2089             case BCC_REJECT_CAUSE:
2090                 info_element_length = tvb_get_guint8(tvb,offset+1);
2091                 dissect_bcc_rejct_cause(tvb, pinfo, tree, offset);
2092                 offset +=info_element_length+2;
2093             break;
2094             case BCC_PROTOCOL_ERROR_CAUSE:
2095                 info_element_length = tvb_get_guint8(tvb,offset+1);
2096                 dissect_bcc_protocol_error_cause(tvb, pinfo, tree, offset);
2097                 offset +=info_element_length+2;
2098             break;
2099             case CONNECTION_INCOMPLETE:
2100                 info_element_length = tvb_get_guint8(tvb,offset+1);
2101                 dissect_connection_incomplete(tvb, pinfo, tree, offset);
2102                 offset +=info_element_length+2;
2103             break;
2104             case LINK_CONTROL_FUNCTION:
2105                 info_element_length = tvb_get_guint8(tvb,offset+1);
2106                 dissect_link_control_function(tvb, pinfo, tree, offset);
2107                 offset +=info_element_length+2;
2108             break;
2109             default:
2110                 offset += 1;
2111             break;
2112         }
2113         if (singleoctet == 1) {
2114             offset += 1;
2115         }
2116 /*
2117         if (old_offset <= offset) {
2118             expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_WARN, "Zero-length information element");
2119             return;
2120         }
2121 */
2122     }
2123 }
2124
2125
2126 static void
2127 dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2128 {
2129     int     offset = 0;
2130     proto_tree  *v52_tree = NULL;
2131     proto_item  *ti;
2132     gboolean    addr = FALSE;
2133     guint8      bcc_all_address_tmp_up = -1;
2134     guint16     pstn_all_address_tmp, isdn_all_address_tmp, bcc_all_address_tmp, prot_all_address_tmp, link_all_address_tmp;
2135
2136     col_set_str(pinfo->cinfo, COL_PROTOCOL, "V52");
2137
2138     if (tree) {
2139         ti = proto_tree_add_item(tree, proto_v52, tvb, offset, -1, FALSE);
2140         v52_tree = proto_item_add_subtree(ti, ett_v52);
2141
2142         dissect_v52_protocol_discriminator(tvb, offset, v52_tree);
2143     }
2144
2145
2146     if (v52_tree != NULL) {
2147
2148
2149         message_type_tmp = tvb_get_guint8(tvb, MSG_TYPE_OFFSET);
2150
2151         if ((message_type_tmp >= 0x00) && (message_type_tmp <= 0x0e)) {
2152             addr = TRUE;
2153             proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2154             proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2155
2156             pstn_all_address_tmp = (((tvb_get_guint8(tvb,ADDRESS_OFFSET)>>1)<<8)+(tvb_get_guint8(tvb,LOW_ADDRESS_OFFSET)));
2157
2158
2159             col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2160         }
2161
2162         if ((message_type_tmp >= 0x10) && (message_type_tmp <= 0x13)) {
2163             addr = TRUE;
2164             if ((tvb_get_guint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2165                 pstn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET)));
2166                 proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2167                 proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2168
2169                 col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2170             }
2171             else {
2172                 isdn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2173                 proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2174                 proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2175
2176                 col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2177             }
2178         }
2179
2180         if ((message_type_tmp == 0x30) || (message_type_tmp == 0x31)) {
2181             addr = TRUE;
2182             link_all_address_tmp = tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET);
2183             proto_tree_add_item(v52_tree, hf_v52_link_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2184             proto_tree_add_item(v52_tree, hf_v52_link_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2185
2186             col_append_fstr(pinfo->cinfo, COL_INFO, " | LinkId: %u", link_all_address_tmp);
2187         }
2188
2189         if ((message_type_tmp >= 0x20) && (message_type_tmp <= 0x2a)) {
2190             addr = TRUE;
2191             proto_tree_add_item(v52_tree, hf_v52_bcc_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2192             proto_tree_add_item(v52_tree, hf_v52_bcc_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2193
2194             bcc_all_address_tmp_up = tvb_get_guint8(tvb, ADDRESS_OFFSET);
2195             if (bcc_all_address_tmp_up >= 128) {
2196                 bcc_all_address_tmp_up = bcc_all_address_tmp_up - 128;
2197             }
2198             bcc_all_address_tmp = (bcc_all_address_tmp_up<<6) + tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET);
2199
2200             col_append_fstr(pinfo->cinfo, COL_INFO, " | ref: %u", bcc_all_address_tmp);
2201         }
2202
2203         if ((message_type_tmp >= 0x18) && (message_type_tmp <= 0x1f)) {
2204             addr = TRUE;
2205             prot_all_address_tmp = (tvb_get_guint8(tvb, ADDRESS_OFFSET)<<8) + (tvb_get_guint8(tvb,LOW_ADDRESS_OFFSET));
2206             proto_tree_add_item(v52_tree, hf_v52_prot_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2207             proto_tree_add_item(v52_tree, hf_v52_prot_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2208
2209             if ((message_type_tmp == 0x1e) || (message_type_tmp == 0x1f)) {}
2210             else {
2211                 col_append_fstr(pinfo->cinfo, COL_INFO, " | Log C-ch: %u", prot_all_address_tmp);
2212             }
2213         }
2214
2215         if (addr == FALSE) {
2216             if ((tvb_get_guint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2217                 pstn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET)));
2218                 proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2219                 proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2220
2221                 col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2222
2223             }
2224             else {
2225                 isdn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2226                 proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE);
2227                 proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE);
2228
2229                 col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2230
2231             }
2232         }
2233
2234         proto_tree_add_item(v52_tree, hf_v52_msg_type, tvb, MSG_TYPE_OFFSET, MSG_TYPE_LENGTH, FALSE);
2235
2236
2237         col_append_str(pinfo->cinfo, COL_INFO, " | ");
2238         col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb, MSG_TYPE_OFFSET), msg_type_values_short, "Unknown msg type"));
2239
2240         dissect_v52_info(tvb, pinfo, v52_tree);
2241     }
2242 }
2243
2244 static void
2245 dissect_v52(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2246 {
2247     dissect_v52_message(tvb, pinfo, tree);
2248 }
2249
2250 void
2251 proto_register_v52(void)
2252 {
2253     static hf_register_info hf[] = {
2254         { &hf_v52_discriminator,
2255           { "Protocol discriminator", "v52.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2256             NULL, HFILL }},
2257         { &hf_v52_address,
2258           { "Address",    "v52.address",
2259              FT_UINT8,    BASE_HEX, NULL,                               0xff,
2260              NULL, HFILL } },
2261         { &hf_v52_low_address,
2262           { "Address Low",    "v52.low_address",
2263              FT_UINT8,    BASE_HEX, NULL,                               0xff,
2264              NULL, HFILL } },
2265 /* ISDN */
2266         { &hf_v52_isdn_address,
2267           { "Address isdn",    "v52.isdn_address",
2268              FT_UINT8,    BASE_HEX, NULL,                               0xfc,
2269              NULL, HFILL } },
2270         { &hf_v52_isdn_low_address,
2271           { "Address isdn Low",    "v52.isdn_low_address",
2272              FT_UINT8,    BASE_HEX, NULL,                               0xfe,
2273              NULL, HFILL } },
2274 /* PSTN */
2275         { &hf_v52_pstn_address,
2276           { "Address pstn",    "v52.pstn_address",
2277           FT_UINT8,    BASE_HEX, NULL,                                  0xfe,
2278           NULL, HFILL } },
2279         { &hf_v52_pstn_low_address,
2280           { "Address pstn Low",    "v52.pstn_low_address",
2281           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2282           NULL, HFILL } },
2283 /* LINK */
2284         { &hf_v52_link_address,
2285           { "Address link",    "v52.link_address",
2286           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2287           NULL, HFILL } },
2288         { &hf_v52_link_low_address,
2289           { "Address link Low",    "v52.link_low_address",
2290           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2291           NULL, HFILL } },
2292 /* BCC */
2293         { &hf_v52_bcc_address,
2294           { "Address bcc",    "v52.bcc_address",
2295           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2296           NULL, HFILL } },
2297         { &hf_v52_bcc_low_address,
2298           { "Address bcc Low",    "v52.bcc_low_address",
2299           FT_UINT8,    BASE_HEX, NULL,                                  0x3f,
2300           NULL, HFILL } },
2301 /* PROTECTION */
2302         { &hf_v52_prot_address,
2303           { "Address prot",    "v52.prot_address",
2304           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2305           NULL, HFILL } },
2306         { &hf_v52_prot_low_address,
2307           { "Address prot Low",    "v52.prot_low_address",
2308           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2309           NULL, HFILL } },
2310 /* CONTROL */
2311         { &hf_v52_ctrl_address,
2312           { "Address ctrl",    "v52.ctrl_address",
2313           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2314           NULL, HFILL } },
2315         { &hf_v52_ctrl_low_address,
2316           { "Address ctrl Low",    "v52.ctrl_low_address",
2317           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2318           NULL, HFILL } },
2319 /* OTHER */
2320         {&hf_v52_msg_type,
2321           { "Message type",   "v52.msg_type",
2322           FT_UINT8,    BASE_HEX, VALS(msg_type_values),                 0x0,
2323           NULL, HFILL } },
2324         {&hf_v52_info_element,
2325           { "Information element",   "v52.info_element",
2326           FT_UINT8,    BASE_HEX, VALS(info_element_values),             0x0,
2327           NULL, HFILL } },
2328         {&hf_v52_info_length,
2329           { "Information length",   "v52.info_length",
2330           FT_UINT8,    BASE_DEC, NULL,                                  0x0,
2331           NULL, HFILL } },
2332         {&hf_v52_pulse_notification,
2333           { "Pulse notification",   "v52.pulse_notification",
2334           FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2335           NULL, HFILL } },
2336         {&hf_v52_pstn_sequence_number,
2337           { "Sequence number",    "v52.pstn_sequence_number",
2338           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2339           NULL, HFILL } },
2340         {&hf_v52_cadenced_ring,
2341           { "Cadenced ring",    "v52.cadenced_ring",
2342           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2343           NULL, HFILL } },
2344         {&hf_v52_pulse_type,
2345           { "Pulse Type",       "v52.pulse_type",
2346           FT_UINT8,    BASE_HEX, VALS(pulse_type_values),               0x0,
2347           NULL, HFILL } },
2348         {&hf_v52_suppression_indicator,
2349           { "Suppression indicator",  "v52.suppression_indicator",
2350           FT_UINT8,    BASE_HEX, VALS(suppression_indication_values),   0x60,
2351           NULL, HFILL } },
2352         {&hf_v52_pulse_duration,
2353           { "Pulse duration type",   "v52.pulse_duration",
2354           FT_UINT8,    BASE_HEX, NULL,                                  0x1f,
2355           NULL, HFILL } },
2356         {&hf_v52_ack_request_indicator,
2357           { "Ack request indicator",    "v52.ack_request_indicator",
2358           FT_UINT8,    BASE_HEX, VALS(ack_request_indication_values),   0x60,
2359           NULL, HFILL } },
2360         {&hf_v52_number_of_pulses,
2361           { "Number of pulses",      "v52.number_of_pulses",
2362           FT_UINT8,    BASE_DEC, NULL,                                  0x1f,
2363           NULL, HFILL } },
2364         {&hf_v52_steady_signal,
2365           { "Steady Signal",         "v52.steady_signal",
2366           FT_UINT8,    BASE_HEX, VALS(steady_signal_values),            0x7f,
2367           NULL, HFILL } },
2368         {&hf_v52_digit_ack,
2369           { "Digit ack request indication","v2.digit_ack",
2370           FT_UINT8,    BASE_HEX, VALS(digit_ack_values),                0x40,
2371           NULL, HFILL } },
2372         {&hf_v52_digit_spare,
2373           { "Digit spare","v52.digit_spare",
2374           FT_UINT8,    BASE_HEX, NULL,                                  0x30,
2375           NULL, HFILL } },
2376         {&hf_v52_digit_info,
2377           { "Digit information",    "v52.digit_info",
2378           FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2379           NULL, HFILL } },
2380         {&hf_v52_duration_type,
2381           { "Duration Type",    "v52.duration_type",
2382           FT_UINT8,    BASE_HEX, NULL,                                  0x3f,
2383           NULL, HFILL } },
2384         {&hf_v52_res_unavailable,
2385           { "Resource unavailable", "v52.res_unavailable",
2386           FT_STRING,   BASE_NONE,NULL,                                  0x0,
2387           NULL, HFILL } },
2388         {&hf_v52_line_info,
2389           { "Line_Information",      "v52.line_info",
2390           FT_UINT8,    BASE_HEX, VALS(line_info_values),                0x0f,
2391           NULL, HFILL } },
2392         {&hf_v52_state,
2393           { "PSTN FSM state",       "v52.state",
2394           FT_UINT8,    BASE_HEX, VALS(state_values),                    0x0f,
2395           NULL, HFILL } },
2396         {&hf_v52_auto_signalling_sequence,
2397           { "Autonomous signalling sequence","v52.auto_signalling_sequence",
2398           FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2399           NULL, HFILL } },
2400         {&hf_v52_sequence_response,
2401           { "Sequence response",    "v52.sequence_response",
2402           FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2403           NULL, HFILL } },
2404         {&hf_v52_control_function_element,
2405           { "Control function element",    "v52.control_function_element",
2406           FT_UINT8,    BASE_HEX, VALS(control_function_element_values), 0x7f,
2407           NULL, HFILL } },
2408         {&hf_v52_control_function_id,
2409           { "Control function ID",    "v52.control_function",
2410           FT_UINT8,    BASE_HEX, VALS(control_function_id_values),      0x7f,
2411           NULL, HFILL } },
2412         {&hf_v52_variant,
2413           { "Variant",    "v52.variant",
2414           FT_UINT8,    BASE_DEC, NULL,                                  0x7f,
2415           NULL, HFILL } },
2416         {&hf_v52_if_up_id,
2417           { "Interface up ID",    "v52.interface_up_id",
2418           FT_UINT8,   BASE_HEX, NULL,                                   0xff,
2419           NULL, HFILL } },
2420         {&hf_v52_if_id,
2421           { "Interface ID",    "v52.interface_id",
2422           FT_UINT8,   BASE_HEX, NULL,                                   0xff,
2423           NULL, HFILL } },
2424         {&hf_v52_if_low_id,
2425           { "Interface down ID",    "v52.interface_low_id",
2426           FT_UINT8,   BASE_HEX, NULL,                                   0xff,
2427           NULL, HFILL } },
2428         {&hf_v52_if_all_id,
2429           { "Interface all ID",    "v52.interface_all_id",
2430           FT_UINT24,   BASE_DEC, NULL,                                  0xffffff,
2431           NULL, HFILL } },
2432         {&hf_v52_sequence_number,
2433           { "Sequence number",    "v52.sequence_number",
2434           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2435           NULL, HFILL } },
2436         {&hf_v52_v5_link_id,
2437           { "V5 2048 kbit/s Link Identifier",    "v52.V5_ln_id",
2438           FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2439                    NULL, HFILL } },
2440         {&hf_v52_v5_multi_slot_elements,
2441           { "Additional MS ID",    "v52.add_ms_id",
2442           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2443           NULL, HFILL } },
2444         {&hf_v52_v5_time_slot,
2445           { "V5 Time Slot Number",    "v52.v5_time_slot",
2446           FT_UINT8,    BASE_DEC, NULL,                                  0x1f,
2447           NULL, HFILL } },
2448         {&hf_v52_rejection_cause,
2449           { "Rejection cause",    "v52.rejection_cause",
2450           FT_UINT8,    BASE_HEX, VALS(rejection_cause_values),          0x7f,
2451           NULL, HFILL } },
2452         {&hf_v52_error_cause,
2453           { "Protocol Error Cause type",    "v52.error_cause",
2454           FT_UINT8,    BASE_HEX, VALS(error_cause_values),              0x7f,
2455           NULL, HFILL } },
2456         {&hf_v52_diagnostic_msg,
2457           { "Diagnostic message",    "v52.diagnostic_message",
2458           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2459           NULL, HFILL } },
2460         {&hf_v52_diagnostic_element,
2461           { "Diagnostic element",    "v52.diagnostic_element",
2462           FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2463           NULL, HFILL } },
2464         {&hf_v52_performance_grading,
2465           { "Performance grading",    "v52.performance_grading",
2466           FT_UINT8,    BASE_HEX, VALS(performance_grading_values),      0x0f,
2467           NULL, HFILL } },
2468         {&hf_v52_cp_rejection_cause,
2469           { "Rejection cp cause",    "v52.cp_rejection_cause",
2470           FT_UINT8,    BASE_HEX, VALS(cp_rejection_cause_values),       0x0f,
2471           NULL, HFILL } },
2472         {&hf_v52_pstn_user_port_id,
2473           { "PSTN User Port identification Value","v52.pstn_user_port_id",
2474             FT_UINT8,    BASE_HEX, NULL,                                0xfe,
2475             NULL, HFILL } },
2476         {&hf_v52_pstn_user_port_id_lower,
2477           { "PSTN User Port Identification Value (lower)","v52.pstn_user_port_id_lower",
2478             FT_UINT8,    BASE_HEX, NULL,                                0xff,
2479             NULL, HFILL } },
2480         {&hf_v52_isdn_user_port_id,
2481           { "ISDN User Port Identification Value","v52.isdn_user_port_id",
2482           FT_UINT8,    BASE_HEX, NULL,                                  0xfc,
2483           NULL, HFILL } },
2484         {&hf_v52_isdn_user_port_id_lower,
2485           { "ISDN User Port Identification Value (lower)","v52.user_port_id_lower",
2486           FT_UINT8,    BASE_HEX, NULL,                                  0xfe,
2487           NULL, HFILL } },
2488         {&hf_v52_isdn_user_port_ts_num,
2489           { "ISDN user port time slot number","v52.isdn_user_port_ts_num",
2490           FT_UINT8,    BASE_HEX, NULL,                                  0x1f,
2491           NULL, HFILL } },
2492         {&hf_v52_override,
2493           { "Override",    "v52.override",
2494           FT_BOOLEAN,  8,        NULL,                                  0x20,
2495           NULL, HFILL } },
2496         {&hf_v52_reject_cause_type,
2497           { "Reject cause type",    "v52.reject_cause_type",
2498           FT_UINT8,    BASE_HEX, VALS(reject_cause_type_values),        0x7f,
2499           NULL, HFILL } },
2500         {&hf_v52_bcc_protocol_error_cause,
2501           { "Protocol error cause type",    "v52.bcc_protocol_cause",
2502           FT_UINT8,    BASE_HEX, VALS(bcc_protocol_error_cause_type_values),0x7f,
2503           NULL, HFILL } },
2504         {&hf_v52_diagnostic_message,
2505           { "Diagnostic message",    "v52.diagnoatic_message",
2506           FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2507           NULL, HFILL } },
2508         {&hf_v52_diagnostic_information,
2509           { "Diagnostic information",    "v52.diagnostic_inforation",
2510           FT_UINT8,    BASE_HEX, NULL,                                  0xff,
2511           NULL, HFILL } },
2512         {&hf_v52_connection_incomplete_reason,
2513           { "Reason",    "v52.connection_incomplete_reason",
2514           FT_UINT8,    BASE_HEX, VALS(connection_incomplete_reason_values), 0x0,
2515           NULL, HFILL } },
2516         {&hf_v52_link_control_function,
2517           { "Link control function","v52.link_control_function",
2518           FT_UINT8,    BASE_HEX, VALS(link_control_function_values),0x7f,
2519           NULL, HFILL } },
2520         {&hf_v52_cause_type,
2521           { "Cause type",           "v52.cause_type",
2522           FT_UINT8,    BASE_HEX, VALS(cause_type_values),       0x7f,
2523           NULL, HFILL } }
2524     };
2525     static gint *ett[] = {
2526         &ett_v52,
2527         &ett_v52_info,
2528     };
2529
2530     proto_v52 = proto_register_protocol("V5.2", "V5.2", "v52");
2531     proto_register_field_array (proto_v52, hf, array_length(hf));
2532     proto_register_subtree_array(ett, array_length(ett));
2533
2534     register_dissector("v52", dissect_v52, proto_v52);
2535 }
2536
2537
2538 void
2539 proto_reg_handoff_v52(void)
2540 {
2541 }
2542
2543 /*
2544  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
2545  *
2546  * Local variables:
2547  * c-basic-offset: 4
2548  * tab-width: 8
2549  * indent-tabs-mode: nil
2550  * End:
2551  *
2552  * vi: set shiftwidth=4 tabstop=8 expandtab
2553  * :indentSize=4:tabSize=8:noTabs=true:
2554  */