Coverage Report

Created: 2026-05-14 06:28

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