Coverage Report

Created: 2026-07-12 07:10

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
206
{
120
206
    unsigned int discriminator = tvb_get_uint8(tvb, offset);
121
122
123
206
    if (discriminator == 0x48) {
124
102
        proto_tree_add_uint_format_value(tree, hf_v52_discriminator, tvb, offset, 1, discriminator,
125
102
            "V5.2 (0x%02X)",
126
102
            discriminator);
127
104
    } else {
128
104
        proto_tree_add_uint_format_value(tree, hf_v52_discriminator,
129
104
            tvb, offset, 1, discriminator,
130
104
            "Reserved (0x%02X)",
131
104
            discriminator);
132
104
    }
133
206
}
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
226
#define PSTN_SEQUENCE_NUMBER     0x00 /* PSTN */
545
118
#define CADENCED_RINGING         0x01 /* PSTN */
546
124
#define PULSED_SIGNAL            0x02 /* PSTN */
547
107
#define STEADY_SIGNAL            0x03 /* PSTN */
548
81
#define DIGIT_SIGNAL             0x04 /* PSTN */
549
27
#define RECOGNITION_TIME         0x10 /* PSTN */
550
131
#define ENABLE_AUTO_ACK          0x11 /* PSTN */
551
42
#define DISABLE_AUTO_ACK         0x12 /* PSTN */
552
38
#define CAUSE                    0x13 /* PSTN */
553
57
#define RESOURCE_UNAVAILABLE     0x14 /* PSTN */
554
42
#define CONTROL_FUNCTION_ELEMENT 0x20 /* Control */
555
15
#define CONTROL_FUNCTION_ID      0x21 /* Control */
556
#define ENABLE_METERING          0x22 /* PSTN */
557
34
#define VARIANT                  0x22 /* Control */
558
#define METERING_REPORT          0x23 /* PSTN */
559
18
#define INTERFACE_ID             0x23 /* Control */
560
#define ATTENUATION              0x24 /* PSTN */
561
70
#define LINK_CONTROL_FUNCTION    0x30 /* Link Control */
562
39
#define USER_PORT_ID             0x40 /* BCC */
563
8
#define ISDN_PORT_TS_ID          0x41 /* BCC */
564
67
#define V5_TIME_SLOT_ID          0x42 /* BCC */
565
32
#define MULTI_SLOT_MAP           0x43 /* BCC */
566
36
#define BCC_REJECT_CAUSE         0x44 /* BCC */
567
14
#define BCC_PROTOCOL_ERROR_CAUSE 0x45 /* BCC */
568
31
#define CONNECTION_INCOMPLETE    0x46 /* BCC */
569
13
#define SEQUENCE_NUMBER          0x50 /* Protection */
570
23
#define C_CHANNEL_ID             0x51 /* Protection */
571
30
#define PP_REJECTION_CAUSE       0x52 /* Protection */
572
9
#define PROTOCOL_ERROR           0x53 /* Protection */
573
379
#define LINE_INFORMATION         0x80 /* PSTN */
574
71
#define STATE                    0x90 /* PSTN */
575
308
#define AUTO_SIG_SEQUENCE        0xa0 /* PSTN */
576
374
#define SEQUENCE_RESPONSE        0xb0 /* PSTN */
577
162
#define PULSE_NOTIFICATION       0xc0 /* PSTN */
578
89
#define PERFORMANCE_GRADING      0xe0 /* Control */
579
173
#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
528
#define ADDRESS_OFFSET       1
664
206
#define ADDRESS_LENGTH       1
665
412
#define LOW_ADDRESS_OFFSET   2
666
206
#define LOW_ADDRESS_LENGTH   1
667
618
#define MSG_TYPE_OFFSET      3
668
206
#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
220
{
676
220
    proto_tree   *info_tree;
677
220
    proto_item   *ti_info;
678
220
    const uint8_t info_element_length = 1;
679
220
    uint8_t       info_element;
680
220
    uint8_t       pstn_sequence_number_tmp;
681
682
220
    uint16_t      data_length;
683
220
    tvbuff_t     *info_tvb;
684
220
    const int     info_offset = 0;
685
686
220
    info_element = tvb_get_uint8(tvb, offset);
687
688
220
    data_length = tvb_get_uint8(tvb, offset+1)+2;
689
220
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
690
691
220
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
692
693
220
    pstn_sequence_number_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
694
220
    col_append_fstr(pinfo->cinfo, COL_INFO, " | SN: %u", pstn_sequence_number_tmp);
695
696
220
    if (info_tree != NULL) {
697
190
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
698
190
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
699
190
        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
190
        proto_tree_add_item(info_tree, hf_v52_pstn_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
701
190
    }
702
220
}
703
704
static void
705
dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
706
118
{
707
118
    proto_tree   *info_tree;
708
118
    proto_item   *ti_info;
709
118
    const uint8_t info_element_length = 1;
710
118
    uint8_t       info_element;
711
118
    uint8_t       cadenced_ring_tmp;
712
118
    uint16_t      data_length;
713
118
    tvbuff_t     *info_tvb;
714
118
    const int     info_offset = 0;
715
716
118
    info_element = tvb_get_uint8(tvb, offset);
717
718
118
    data_length = tvb_get_uint8(tvb, offset+1)+2;
719
118
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
720
721
118
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
722
723
118
    cadenced_ring_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
724
118
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
725
118
    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
118
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", cadenced_ring_tmp);
728
729
118
    if (info_tree != NULL) {
730
113
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
731
113
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
732
113
        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
113
        proto_tree_add_item(info_tree, hf_v52_cadenced_ring, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
734
735
736
113
    }
737
118
}
738
739
static void
740
dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
741
124
{
742
124
    proto_tree   *info_tree;
743
124
    proto_item   *ti_info;
744
124
    const uint8_t info_element_length = 1;
745
124
    uint8_t       info_element;
746
747
124
    uint16_t      data_length;
748
124
    tvbuff_t     *info_tvb;
749
124
    const int     info_offset = 0;
750
751
124
    info_element = tvb_get_uint8(tvb, offset);
752
753
124
    data_length = tvb_get_uint8(tvb, offset+1)+2;
754
124
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
755
756
124
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
757
758
124
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
759
124
    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
124
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
762
124
    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
124
    if (info_tree != NULL) {
765
119
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
766
119
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
767
119
        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
119
        proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
769
770
119
        if (data_length > 3) {
771
114
            proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
772
114
            proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
773
114
        }
774
775
119
        if (data_length > 4) {
776
15
            proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
777
15
            proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
778
15
        }
779
119
    }
780
124
}
781
782
static void
783
dissect_steady_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
784
107
{
785
107
    proto_tree   *info_tree;
786
107
    proto_item   *ti_info;
787
107
    const uint8_t info_element_length = 1;
788
107
    uint8_t       info_element;
789
790
107
    uint16_t      data_length;
791
107
    tvbuff_t     *info_tvb;
792
107
    const int     info_offset = 0;
793
794
107
    info_element = tvb_get_uint8(tvb, offset);
795
796
107
    data_length = tvb_get_uint8(tvb, offset+1)+2;
797
107
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
798
799
107
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
800
801
107
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
802
107
    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
107
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
805
107
    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
107
    if (info_tree != NULL) {
808
102
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
809
102
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
810
102
        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
102
        proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
812
102
    }
813
107
}
814
815
static void
816
dissect_digit_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
817
81
{
818
81
    proto_tree   *info_tree;
819
81
    proto_item   *ti_info;
820
81
    const uint8_t info_element_length = 1;
821
81
    uint8_t       buffer;
822
81
    uint8_t       info_element;
823
824
81
    uint16_t      data_length;
825
81
    tvbuff_t     *info_tvb;
826
81
    const int     info_offset = 0;
827
828
81
    info_element = tvb_get_uint8(tvb, offset);
829
830
81
    data_length = tvb_get_uint8(tvb, offset+1)+2;
831
81
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
832
833
81
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
834
835
81
    proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
836
81
    proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
837
81
    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
81
    proto_tree_add_item(info_tree, hf_v52_digit_ack, info_tvb, info_offset+2, 1, ENC_NA);
840
841
81
    buffer = tvb_get_uint8(info_tvb, info_offset+2)>>4;
842
81
    buffer = buffer&0x03;
843
844
81
    proto_tree_add_item(info_tree, hf_v52_digit_spare, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
845
81
    proto_tree_add_item(info_tree, hf_v52_digit_info, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
846
847
81
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
848
81
    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
81
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", buffer);
851
81
}
852
853
static void
854
dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
855
27
{
856
27
    proto_tree   *info_tree;
857
27
    proto_item   *ti_info;
858
27
    const uint8_t info_element_length = 1;
859
27
    uint8_t       info_element;
860
861
27
    uint16_t      data_length;
862
27
    tvbuff_t     *info_tvb;
863
27
    const int     info_offset = 0;
864
865
27
    info_element = tvb_get_uint8(tvb, offset);
866
867
27
    data_length = tvb_get_uint8(tvb, offset+1)+2;
868
27
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
869
870
27
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
871
872
27
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
873
27
    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
27
    if (info_tree != NULL) {
876
27
        uint8_t buffer;
877
27
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
878
27
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
879
27
        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
27
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
882
        /*Signal = Coding of pulse type*/
883
27
        if (buffer >= 0x6b)
884
2
            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
25
        else if (buffer <= 0x1a)
887
20
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
888
889
27
        proto_tree_add_item(info_tree, hf_v52_duration_type, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
890
27
    }
891
27
}
892
893
static void
894
dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
895
131
{
896
131
    proto_tree   *info_tree;
897
131
    proto_item   *ti_info;
898
131
    const uint8_t info_element_length = 1;
899
131
    uint8_t       info_element;
900
901
131
    uint16_t      data_length;
902
131
    tvbuff_t     *info_tvb;
903
131
    const int     info_offset = 0;
904
905
131
    info_element = tvb_get_uint8(tvb, offset);
906
907
131
    data_length = tvb_get_uint8(tvb, offset+1)+2;
908
131
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
909
910
131
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
911
912
131
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
913
131
    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
131
    if (info_tree != NULL) {
916
131
        uint8_t buffer;
917
131
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
918
131
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
919
131
        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
131
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
922
        /*Signal*/
923
131
        if (buffer >= 0x6b)
924
33
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
925
98
        else if (buffer <= 0x1a)
926
60
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
927
928
131
        buffer = tvb_get_uint8(info_tvb, info_offset+3)&0x7f;
929
        /*Response*/
930
131
        if (buffer >= 0x6b)
931
19
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
932
112
        else if (buffer <= 0x1a)
933
72
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
934
935
131
        if (tvb_reported_length_remaining(info_tvb, info_offset+4)) {
936
127
            proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
937
127
            proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
938
127
        }
939
131
        if (tvb_reported_length_remaining(info_tvb, info_offset+5)) {
940
126
            proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+5, 1, ENC_BIG_ENDIAN);
941
126
            proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+5, 1, ENC_BIG_ENDIAN);
942
126
        }
943
131
    }
944
131
}
945
946
static void
947
dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
948
42
{
949
42
    proto_tree   *info_tree;
950
42
    proto_item   *ti_info;
951
42
    const uint8_t info_element_length = 1;
952
42
    uint8_t       info_element;
953
954
42
    uint16_t      data_length;
955
42
    tvbuff_t     *info_tvb;
956
42
    const int     info_offset = 0;
957
958
42
    info_element = tvb_get_uint8(tvb, offset);
959
960
42
    data_length = tvb_get_uint8(tvb, offset+1)+2;
961
42
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
962
963
42
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
964
965
42
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
966
42
    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
42
    if (info_tree != NULL) {
969
42
        uint8_t buffer;
970
42
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
971
42
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
972
42
        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
42
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
975
976
42
        if (buffer >= 0x6b)
977
3
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
978
39
        else if (buffer <= 0x1a)
979
30
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
980
42
    }
981
42
}
982
983
static void
984
dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
985
38
{
986
38
    proto_tree   *info_tree;
987
38
    proto_item   *ti_info;
988
38
    const uint8_t info_element_length = 1;
989
38
    uint8_t       info_element;
990
991
38
    uint16_t      data_length;
992
38
    tvbuff_t     *info_tvb;
993
38
    const int     info_offset = 0;
994
995
38
    info_element = tvb_get_uint8(tvb, offset);
996
997
38
    data_length = tvb_get_uint8(tvb, offset+1)+2;
998
38
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
999
1000
38
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1001
1002
38
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1003
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"));
1004
1005
38
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
1006
38
    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
38
    if (info_tree != NULL) {
1009
38
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1010
38
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1011
38
        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
38
        proto_tree_add_item(info_tree, hf_v52_cause_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1013
1014
38
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1015
35
            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
35
                                "Diagnostic: %s", val_to_str_ext_const(tvb_get_uint8(info_tvb, info_offset+3), &msg_type_values_ext, "unknown"));
1017
38
    }
1018
38
}
1019
1020
static void
1021
dissect_resource_unavailable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1022
57
{
1023
57
    proto_tree   *info_tree;
1024
57
    proto_item   *ti_info;
1025
57
    const uint8_t info_element_length = 1;
1026
57
    uint8_t       info_element;
1027
1028
57
    uint16_t      data_length;
1029
57
    tvbuff_t     *info_tvb;
1030
57
    const int     info_offset = 0;
1031
1032
57
    info_element = tvb_get_uint8(tvb, offset);
1033
1034
57
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1035
57
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1036
1037
57
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1038
1039
57
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1040
57
    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
57
    if (info_tree != NULL) {
1043
57
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1044
57
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1045
57
        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
57
        proto_tree_add_item(info_tree, hf_v52_res_unavailable, info_tvb, info_offset+2, info_element_length, ENC_ASCII);
1047
57
    }
1048
57
}
1049
1050
static void
1051
dissect_pulse_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1052
162
{
1053
162
    proto_tree   *info_tree;
1054
162
    proto_item   *ti_info;
1055
162
    const uint8_t info_element_length = 1;
1056
162
    uint8_t       info_element;
1057
1058
162
    uint16_t      data_length;
1059
162
    tvbuff_t     *info_tvb;
1060
162
    const int     info_offset = 0;
1061
1062
162
    info_element = tvb_get_uint8(tvb, offset);
1063
1064
162
    data_length = 1;
1065
162
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1066
1067
162
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1068
1069
162
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1070
162
    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
162
    if (info_tree != NULL) {
1073
162
        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
162
        proto_tree_add_item(info_tree, hf_v52_pulse_notification, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1075
162
    }
1076
162
}
1077
1078
static void
1079
dissect_line_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1080
379
{
1081
379
    proto_tree   *info_tree;
1082
379
    proto_item   *ti_info;
1083
379
    const uint8_t info_element_length = 1;
1084
379
    uint8_t       info_element;
1085
1086
379
    uint16_t      data_length;
1087
379
    tvbuff_t     *info_tvb;
1088
379
    const int     info_offset = 0;
1089
1090
379
    info_element = tvb_get_uint8(tvb, offset);
1091
1092
379
    data_length = 1;
1093
379
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1094
1095
379
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1096
1097
379
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1098
379
    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
379
    if (info_tree != NULL) {
1101
379
        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
379
        proto_tree_add_item(info_tree, hf_v52_line_info, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1103
379
    }
1104
379
}
1105
1106
static void
1107
dissect_state(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1108
71
{
1109
71
    proto_tree   *info_tree;
1110
71
    proto_item   *ti_info;
1111
71
    const uint8_t info_element_length = 1;
1112
71
    uint8_t       info_element;
1113
1114
71
    uint16_t      data_length;
1115
71
    tvbuff_t     *info_tvb;
1116
71
    const int     info_offset = 0;
1117
1118
71
    info_element = tvb_get_uint8(tvb, offset);
1119
1120
71
    data_length = 1;
1121
71
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1122
1123
71
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1124
1125
71
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1126
71
    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
71
    if (info_tree != NULL) {
1129
71
        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
71
        proto_tree_add_item(info_tree, hf_v52_state, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1131
71
    }
1132
71
}
1133
1134
static void
1135
dissect_auto_sig_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1136
308
{
1137
308
    proto_tree   *info_tree;
1138
308
    proto_item   *ti_info;
1139
308
    const uint8_t info_element_length = 1;
1140
308
    uint8_t       info_element;
1141
1142
308
    uint16_t      data_length;
1143
308
    tvbuff_t     *info_tvb;
1144
308
    const int     info_offset = 0;
1145
1146
308
    info_element = tvb_get_uint8(tvb, offset);
1147
1148
308
    data_length = 1;
1149
308
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1150
1151
308
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1152
1153
308
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1154
308
    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
308
    if (info_tree != NULL) {
1157
308
        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
308
        proto_tree_add_item(info_tree, hf_v52_auto_signalling_sequence, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1159
308
    }
1160
308
}
1161
1162
static void
1163
dissect_sequence_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1164
374
{
1165
374
    proto_tree   *info_tree;
1166
374
    proto_item   *ti_info;
1167
374
    const uint8_t info_element_length = 1;
1168
374
    uint8_t       info_element;
1169
1170
374
    uint16_t      data_length;
1171
374
    tvbuff_t     *info_tvb;
1172
374
    const int     info_offset = 0;
1173
1174
374
    info_element = tvb_get_uint8(tvb, offset);
1175
1176
374
    data_length = 1;
1177
374
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1178
1179
374
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1180
1181
374
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1182
374
    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
374
    if (info_tree != NULL) {
1185
374
        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
374
        proto_tree_add_item(info_tree, hf_v52_sequence_response, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1187
374
    }
1188
374
}
1189
1190
static void
1191
dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1192
42
{
1193
42
    proto_tree   *info_tree;
1194
42
    proto_item   *ti_info;
1195
42
    const uint8_t info_element_length = 1;
1196
42
    uint8_t       info_element;
1197
1198
42
    uint16_t      data_length;
1199
42
    tvbuff_t     *info_tvb;
1200
42
    const int     info_offset = 0;
1201
1202
42
    info_element = tvb_get_uint8(tvb, offset);
1203
1204
42
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1205
42
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1206
1207
42
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1208
1209
42
    if (message_type_tmp != 0x11) {
1210
35
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1211
35
        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
35
    }
1213
1214
42
    if (info_tree != NULL) {
1215
41
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1216
41
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1217
41
        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
41
        proto_tree_add_item(info_tree, hf_v52_control_function_element, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1219
41
    }
1220
42
}
1221
1222
static void
1223
dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1224
15
{
1225
15
    proto_tree   *info_tree;
1226
15
    proto_item   *ti_info;
1227
15
    const uint8_t info_element_length = 1;
1228
15
    uint8_t       info_element;
1229
1230
15
    uint16_t      data_length;
1231
15
    tvbuff_t     *info_tvb;
1232
15
    const int     info_offset = 0;
1233
1234
15
    info_element = tvb_get_uint8(tvb, offset);
1235
1236
15
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1237
15
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1238
1239
15
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1240
1241
15
    if (message_type_tmp != 0x13) {
1242
15
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1243
15
        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
15
    }
1245
1246
15
    if (info_tree != NULL) {
1247
14
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1248
14
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1249
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);
1250
14
        proto_tree_add_item(info_tree, hf_v52_control_function_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1251
14
    }
1252
15
}
1253
1254
static void
1255
dissect_variant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1256
33
{
1257
33
    proto_tree   *info_tree;
1258
33
    proto_item   *ti_info;
1259
33
    const uint8_t info_element_length = 1;
1260
33
    uint8_t       info_element;
1261
33
    uint8_t       variantValue;
1262
1263
33
    uint16_t      data_length;
1264
33
    tvbuff_t     *info_tvb;
1265
33
    const int     info_offset = 0;
1266
1267
33
    info_element = tvb_get_uint8(tvb, offset);
1268
1269
33
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1270
33
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1271
1272
33
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1273
1274
33
    variantValue = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
1275
33
    col_append_fstr(pinfo->cinfo, COL_INFO, " | Var: %u", variantValue);
1276
1277
33
    if (info_tree != NULL) {
1278
33
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1279
33
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1280
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);
1281
33
        proto_tree_add_item(info_tree, hf_v52_variant, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1282
33
    }
1283
33
}
1284
1285
static void
1286
dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1287
18
{
1288
18
    proto_tree   *info_tree;
1289
18
    proto_item   *ti_info;
1290
18
    const uint8_t info_element_length = 1;
1291
18
    uint8_t       info_element;
1292
18
    uint8_t       interfaceAllIdValue;
1293
1294
18
    uint16_t      data_length;
1295
18
    tvbuff_t     *info_tvb;
1296
18
    const int     info_offset = 0;
1297
1298
18
    info_element = tvb_get_uint8(tvb, offset);
1299
1300
18
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1301
18
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1302
1303
18
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1304
1305
18
    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
18
    col_append_fstr(pinfo->cinfo, COL_INFO, " | Intf. ID: %u", interfaceAllIdValue);
1307
1308
18
    if (info_tree != NULL) {
1309
18
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1310
18
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1311
18
        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
18
        proto_tree_add_item(info_tree, hf_v52_if_up_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1313
18
        proto_tree_add_item(info_tree, hf_v52_if_id, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1314
18
        proto_tree_add_item(info_tree, hf_v52_if_low_id, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1315
18
        proto_tree_add_item(info_tree, hf_v52_if_all_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1316
18
    }
1317
18
}
1318
1319
static void
1320
dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1321
13
{
1322
13
    proto_tree   *info_tree;
1323
13
    proto_item   *ti_info;
1324
13
    const uint8_t info_element_length = 1;
1325
13
    uint8_t       info_element;
1326
13
    uint8_t       hf_v52_sequence_number_tmp;
1327
13
    uint16_t      data_length;
1328
13
    tvbuff_t     *info_tvb;
1329
13
    const int     info_offset = 0;
1330
1331
13
    info_element = tvb_get_uint8(tvb, offset);
1332
1333
13
    data_length  = tvb_get_uint8(tvb, offset+1)+2;
1334
13
    info_tvb     = tvb_new_subset_length(tvb, offset, data_length);
1335
1336
13
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1337
1338
13
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1339
13
    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
13
    hf_v52_sequence_number_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
1342
13
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", hf_v52_sequence_number_tmp);
1343
1344
13
    if (info_tree != NULL) {
1345
13
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1346
13
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1347
13
        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
13
        proto_tree_add_item(info_tree, hf_v52_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1349
13
    }
1350
13
}
1351
1352
static void
1353
dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1354
23
{
1355
23
    proto_tree   *info_tree;
1356
23
    proto_item   *ti_info;
1357
23
    const uint8_t info_element_length = 1;
1358
23
    uint8_t       info_element;
1359
1360
23
    uint16_t      data_length;
1361
23
    tvbuff_t     *info_tvb;
1362
23
    const int     info_offset = 0;
1363
1364
23
    info_element = tvb_get_uint8(tvb, offset);
1365
1366
23
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1367
23
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1368
1369
23
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1370
1371
23
    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
23
    if (info_tree != NULL) {
1374
23
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1375
23
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1376
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);
1377
23
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1378
23
        proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1379
23
    }
1380
23
}
1381
1382
static void
1383
dissect_pp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1384
30
{
1385
30
    proto_tree   *info_tree;
1386
30
    proto_item   *ti_info;
1387
30
    const uint8_t info_element_length = 1;
1388
30
    uint8_t       info_element;
1389
1390
30
    uint16_t      data_length;
1391
30
    tvbuff_t     *info_tvb;
1392
30
    const int     info_offset = 0;
1393
1394
30
    info_element = tvb_get_uint8(tvb, offset);
1395
1396
30
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1397
30
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1398
1399
30
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1400
1401
30
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1402
30
    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
30
    if (info_tree != NULL) {
1405
30
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1406
30
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1407
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);
1408
30
        proto_tree_add_item(info_tree, hf_v52_rejection_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1409
30
    }
1410
30
}
1411
1412
static void
1413
dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1414
9
{
1415
9
    proto_tree   *info_tree;
1416
9
    proto_item   *ti_info;
1417
9
    const uint8_t info_element_length = 1;
1418
9
    uint8_t       info_element;
1419
1420
9
    uint16_t      data_length;
1421
9
    tvbuff_t     *info_tvb;
1422
9
    const int     info_offset = 0;
1423
1424
9
    info_element = tvb_get_uint8(tvb, offset);
1425
1426
9
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1427
9
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1428
1429
9
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1430
1431
9
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1432
9
    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
9
    if (info_tree != NULL) {
1435
9
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1436
9
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1437
9
        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
9
        proto_tree_add_item(info_tree, hf_v52_error_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1439
9
        proto_tree_add_item(info_tree, hf_v52_diagnostic_msg, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1440
9
        proto_tree_add_item(info_tree, hf_v52_diagnostic_element, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1441
9
    }
1442
9
}
1443
1444
static void
1445
dissect_performance_grading(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1446
89
{
1447
89
    proto_tree   *info_tree;
1448
89
    proto_item   *ti_info;
1449
89
    const uint8_t info_element_length = 1;
1450
89
    uint8_t       info_element;
1451
1452
89
    uint16_t      data_length;
1453
89
    tvbuff_t     *info_tvb;
1454
89
    const int     info_offset = 0;
1455
1456
89
    info_element = tvb_get_uint8(tvb, offset);
1457
1458
89
    data_length = 1;
1459
89
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1460
1461
89
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1462
1463
89
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1464
89
    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
89
    if (info_tree != NULL) {
1467
89
        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
89
        proto_tree_add_item(info_tree, hf_v52_performance_grading, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1469
89
    }
1470
89
}
1471
1472
static void
1473
dissect_cp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1474
173
{
1475
173
    proto_tree   *info_tree;
1476
173
    proto_item   *ti_info;
1477
173
    const uint8_t info_element_length = 1;
1478
173
    uint8_t       info_element;
1479
1480
173
    uint16_t      data_length;
1481
173
    tvbuff_t     *info_tvb;
1482
173
    const int     info_offset = 0;
1483
1484
173
    info_element = tvb_get_uint8(tvb, offset);
1485
1486
173
    data_length = 1;
1487
173
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1488
1489
173
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1490
1491
173
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1492
173
    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
173
    if (info_tree != NULL) {
1495
173
        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
173
        proto_tree_add_item(info_tree, hf_v52_cp_rejection_cause, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1497
173
    }
1498
173
}
1499
1500
static void
1501
dissect_user_port_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1502
39
{
1503
39
    proto_tree   *info_tree;
1504
39
    proto_item   *ti_info;
1505
39
    const uint8_t info_element_length = 1;
1506
39
    uint8_t       buffer;
1507
39
    uint8_t       info_element;
1508
1509
39
    uint16_t      data_length;
1510
39
    tvbuff_t     *info_tvb;
1511
39
    const int     info_offset = 0;
1512
1513
39
    info_element = tvb_get_uint8(tvb, offset);
1514
1515
39
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1516
39
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1517
1518
39
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1519
1520
39
    proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1521
39
    proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1522
39
    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
39
    buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x01;
1525
1526
39
    if (buffer == 0x01) {
1527
4
        proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1528
4
        proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
1529
1530
4
        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
4
    }
1532
35
    else if (buffer == 0x00) {
1533
32
        proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1534
32
        proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
1535
1536
32
        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
32
    }
1538
39
}
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
8
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1566
8
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1567
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);
1568
8
        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
8
    }
1570
8
}
1571
1572
static void
1573
dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1574
67
{
1575
67
    proto_tree   *info_tree;
1576
67
    proto_item   *ti_info;
1577
67
    const uint8_t info_element_length = 1;
1578
67
    uint8_t       info_element;
1579
67
    uint8_t       v5_link_id_tmp;
1580
67
    uint8_t       v5_time_slot_tmp;
1581
1582
67
    uint16_t      data_length;
1583
67
    tvbuff_t     *info_tvb;
1584
67
    const int     info_offset = 0;
1585
1586
67
    info_element = tvb_get_uint8(tvb, offset);
1587
1588
67
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1589
67
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1590
1591
67
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1592
1593
67
    v5_link_id_tmp = tvb_get_uint8(info_tvb, info_offset+2);
1594
67
    v5_time_slot_tmp = tvb_get_uint8(info_tvb, info_offset+3);
1595
1596
67
    if (v5_time_slot_tmp >= 64) {
1597
33
        v5_time_slot_tmp = v5_time_slot_tmp - 64;
1598
33
    }
1599
1600
67
    if (v5_time_slot_tmp >= 32) {
1601
9
        v5_time_slot_tmp = v5_time_slot_tmp - 32;
1602
9
    }
1603
1604
67
    col_append_fstr(pinfo->cinfo, COL_INFO, " | V5 Link: %u, %u ", v5_link_id_tmp, v5_time_slot_tmp);
1605
1606
67
    if (info_tree != NULL) {
1607
67
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1608
67
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1609
67
        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
67
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1611
67
        proto_tree_add_item(info_tree, hf_v52_override, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1612
67
        proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1613
67
    }
1614
67
}
1615
1616
static void
1617
dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1618
32
{
1619
32
    proto_tree   *info_tree;
1620
32
    proto_item   *ti_info;
1621
32
    const uint8_t info_element_length = 1;
1622
32
    uint8_t       info_element;
1623
1624
32
    uint16_t      data_length;
1625
32
    tvbuff_t     *info_tvb;
1626
32
    const int     info_offset = 0;
1627
1628
32
    info_element = tvb_get_uint8(tvb, offset);
1629
1630
32
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1631
32
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1632
1633
32
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1634
1635
32
    col_append_fstr(pinfo->cinfo, COL_INFO, " | V5MSlink ID:%u", tvb_get_uint8(info_tvb, info_offset+2));
1636
1637
32
    if (info_tree != NULL) {
1638
32
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1639
32
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1640
32
        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
32
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1642
1643
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1644
31
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1645
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+4))
1646
31
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1647
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+5))
1648
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+5, info_element_length, ENC_BIG_ENDIAN);
1649
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+6))
1650
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+6, info_element_length, ENC_BIG_ENDIAN);
1651
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+7))
1652
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+7, info_element_length, ENC_BIG_ENDIAN);
1653
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+8))
1654
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+8, info_element_length, ENC_BIG_ENDIAN);
1655
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+9))
1656
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+9, info_element_length, ENC_BIG_ENDIAN);
1657
32
        if (tvb_reported_length_remaining(info_tvb, info_offset+10))
1658
30
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+10, info_element_length, ENC_BIG_ENDIAN);
1659
32
    }
1660
32
}
1661
1662
static void
1663
dissect_bcc_rejct_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1664
36
{
1665
36
    proto_tree   *info_tree;
1666
36
    proto_item   *ti_info;
1667
36
    const uint8_t info_element_length = 1;
1668
36
    uint8_t       info_element;
1669
1670
36
    uint16_t      data_length;
1671
36
    tvbuff_t     *info_tvb;
1672
36
    const int     info_offset = 0;
1673
1674
36
    info_element = tvb_get_uint8(tvb, offset);
1675
1676
36
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1677
36
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1678
1679
36
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1680
1681
36
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1682
36
    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
36
    if (info_tree != NULL) {
1685
36
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1686
36
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1687
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);
1688
36
        proto_tree_add_item(info_tree, hf_v52_reject_cause_type, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1689
36
    }
1690
36
}
1691
1692
static void
1693
dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1694
14
{
1695
14
    proto_tree   *info_tree;
1696
14
    proto_item   *ti_info;
1697
14
    const uint8_t info_element_length = 1;
1698
14
    uint8_t       info_element;
1699
1700
14
    uint16_t      data_length;
1701
14
    tvbuff_t     *info_tvb;
1702
14
    const int     info_offset = 0;
1703
1704
14
    info_element = tvb_get_uint8(tvb, offset);
1705
1706
14
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1707
14
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1708
1709
14
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1710
1711
14
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1712
14
    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
14
    if (info_tree != NULL) {
1715
14
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1716
14
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1717
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);
1718
14
        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
14
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1721
14
            proto_tree_add_item(info_tree, hf_v52_diagnostic_message, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1722
14
        if (tvb_reported_length_remaining(info_tvb, info_offset+4))
1723
14
            proto_tree_add_item(info_tree, hf_v52_diagnostic_information, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1724
14
    }
1725
14
}
1726
1727
static void
1728
dissect_connection_incomplete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1729
31
{
1730
31
    proto_tree   *info_tree;
1731
31
    proto_item   *ti_info;
1732
31
    const uint8_t info_element_length = 1;
1733
31
    uint8_t       info_element;
1734
1735
31
    uint16_t      data_length;
1736
31
    tvbuff_t     *info_tvb;
1737
31
    const int     info_offset = 0;
1738
1739
31
    info_element = tvb_get_uint8(tvb, offset);
1740
1741
31
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1742
31
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1743
1744
31
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1745
1746
31
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1747
31
    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
31
    if (info_tree != NULL) {
1750
31
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1751
31
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1752
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);
1753
31
        proto_tree_add_item(info_tree, hf_v52_connection_incomplete_reason, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1754
31
    }
1755
31
}
1756
1757
static void
1758
dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1759
69
{
1760
69
    proto_tree   *info_tree;
1761
69
    proto_item   *ti_info;
1762
69
    const uint8_t info_element_length = 1;
1763
69
    uint8_t       info_element;
1764
1765
69
    uint16_t      data_length;
1766
69
    tvbuff_t     *info_tvb;
1767
69
    const int     info_offset = 0;
1768
1769
69
    info_element = tvb_get_uint8(tvb, offset);
1770
1771
69
    data_length = tvb_get_uint8(tvb, offset+1) + 2;
1772
69
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1773
1774
69
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1775
1776
69
    if (message_type_tmp != 0x31) {
1777
42
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1778
42
        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
42
    }
1780
1781
69
    if (info_tree != NULL) {
1782
69
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1783
69
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1784
69
        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
69
        proto_tree_add_item(info_tree, hf_v52_link_control_function, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1786
69
    }
1787
69
}
1788
1789
1790
1791
static void
1792
dissect_v52_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1793
206
{
1794
206
    int    offset = 4;
1795
206
    uint8_t info_element, info_element_length;
1796
    /*int    old_offset;*/
1797
206
    int    singleoctet;
1798
1799
11.3k
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
1800
11.2k
        singleoctet = 0;
1801
        /* old_offset = offset; */
1802
11.2k
        info_element = tvb_get_uint8(tvb, offset);
1803
11.2k
        switch (info_element) {
1804
226
            case PSTN_SEQUENCE_NUMBER:
1805
226
                info_element_length = tvb_get_uint8(tvb, offset+1);
1806
226
                dissect_pstn_sequence_number(tvb, pinfo, tree, offset);
1807
226
                offset += info_element_length+2;
1808
226
            break;
1809
118
            case CADENCED_RINGING:
1810
118
                info_element_length = tvb_get_uint8(tvb, offset+1);
1811
118
                dissect_cadenced_ring(tvb, pinfo, tree, offset);
1812
118
                offset += info_element_length+2;
1813
118
            break;
1814
124
            case PULSED_SIGNAL:
1815
124
                info_element_length = tvb_get_uint8(tvb, offset+1);
1816
124
                dissect_pulsed_signal(tvb, pinfo, tree, offset);
1817
124
                offset += info_element_length+2;
1818
124
            break;
1819
107
            case STEADY_SIGNAL:
1820
107
                info_element_length = tvb_get_uint8(tvb, offset+1);
1821
107
                dissect_steady_signal(tvb, pinfo, tree, offset);
1822
107
                offset += info_element_length+2;
1823
107
            break;
1824
81
            case DIGIT_SIGNAL:
1825
81
                info_element_length = tvb_get_uint8(tvb, offset+1);
1826
81
                dissect_digit_signal(tvb, pinfo, tree, offset);
1827
81
                offset += info_element_length+2;
1828
81
            break;
1829
27
            case RECOGNITION_TIME:
1830
27
                info_element_length = tvb_get_uint8(tvb, offset+1);
1831
27
                dissect_recognition_time(tvb, pinfo, tree, offset);
1832
27
                offset += info_element_length+2;
1833
27
            break;
1834
131
            case ENABLE_AUTO_ACK:
1835
131
                info_element_length = tvb_get_uint8(tvb, offset+1);
1836
131
                dissect_enable_auto_ack(tvb, pinfo, tree, offset);
1837
131
                offset += info_element_length+2;
1838
131
            break;
1839
42
            case DISABLE_AUTO_ACK:
1840
42
                info_element_length = tvb_get_uint8(tvb, offset+1);
1841
42
                dissect_disable_auto_ack(tvb, pinfo, tree, offset);
1842
42
                offset += info_element_length+2;
1843
42
            break;
1844
38
            case CAUSE:
1845
38
                info_element_length = tvb_get_uint8(tvb, offset+1);
1846
38
                dissect_cause(tvb, pinfo, tree, offset);
1847
38
                offset += info_element_length+2;
1848
38
            break;
1849
57
            case RESOURCE_UNAVAILABLE:
1850
57
                info_element_length = tvb_get_uint8(tvb, offset+1);
1851
57
                dissect_resource_unavailable(tvb, pinfo, tree, offset);
1852
57
                offset += info_element_length+2;
1853
57
            break;
1854
162
            case PULSE_NOTIFICATION:
1855
162
                dissect_pulse_notification(tvb, pinfo, tree, offset);
1856
162
                singleoctet = 1;
1857
162
            break;
1858
379
            case LINE_INFORMATION:
1859
379
                dissect_line_information(tvb, pinfo, tree, offset);
1860
379
                singleoctet = 1;
1861
379
            break;
1862
71
            case STATE:
1863
71
                dissect_state(tvb, pinfo, tree, offset);
1864
71
                singleoctet = 1;
1865
71
            break;
1866
308
            case AUTO_SIG_SEQUENCE:
1867
308
                dissect_auto_sig_sequence(tvb, pinfo, tree, offset);
1868
308
                singleoctet = 1;
1869
308
            break;
1870
374
            case SEQUENCE_RESPONSE:
1871
374
                dissect_sequence_response(tvb, pinfo, tree, offset);
1872
374
                singleoctet = 1;
1873
374
            break;
1874
1875
42
            case CONTROL_FUNCTION_ELEMENT:
1876
42
                info_element_length = tvb_get_uint8(tvb, offset+1);
1877
42
                dissect_control_function_element(tvb, pinfo, tree, offset);
1878
42
                offset += info_element_length+2;
1879
42
            break;
1880
15
            case CONTROL_FUNCTION_ID:
1881
15
                info_element_length = tvb_get_uint8(tvb, offset+1);
1882
15
                dissect_control_function_id(tvb, pinfo, tree, offset);
1883
15
                offset += info_element_length+2;
1884
15
            break;
1885
34
            case VARIANT:
1886
34
                info_element_length = tvb_get_uint8(tvb, offset+1);
1887
34
                dissect_variant(tvb, pinfo, tree, offset);
1888
34
                offset += info_element_length+2;
1889
34
            break;
1890
18
            case INTERFACE_ID:
1891
18
                info_element_length = tvb_get_uint8(tvb, offset+1);
1892
18
                dissect_interface_id(tvb, pinfo, tree, offset);
1893
18
                offset += info_element_length+2;
1894
18
            break;
1895
13
            case SEQUENCE_NUMBER:
1896
13
                info_element_length = tvb_get_uint8(tvb, offset+1);
1897
13
                dissect_sequence_number(tvb, pinfo, tree, offset);
1898
13
                offset += info_element_length+2;
1899
13
            break;
1900
23
            case C_CHANNEL_ID:
1901
23
                info_element_length = tvb_get_uint8(tvb, offset+1);
1902
23
                dissect_physical_c_channel_id(tvb, pinfo, tree, offset);
1903
23
                offset += info_element_length+2;
1904
23
            break;
1905
30
            case PP_REJECTION_CAUSE:
1906
30
                info_element_length = tvb_get_uint8(tvb, offset+1);
1907
30
                dissect_pp_rejection_cause(tvb, pinfo, tree, offset);
1908
30
                offset += info_element_length+2;
1909
30
            break;
1910
9
            case PROTOCOL_ERROR:
1911
9
                info_element_length = tvb_get_uint8(tvb, offset+1);
1912
9
                dissect_protocol_error(tvb, pinfo, tree, offset);
1913
9
                offset += info_element_length+2;
1914
9
            break;
1915
89
            case PERFORMANCE_GRADING:
1916
89
                dissect_performance_grading(tvb, pinfo, tree, offset);
1917
89
                singleoctet = 1;
1918
89
            break;
1919
173
            case CP_REJECTION_CAUSE:
1920
173
                dissect_cp_rejection_cause(tvb, pinfo, tree, offset);
1921
173
                singleoctet = 1;
1922
173
            break;
1923
39
            case USER_PORT_ID:
1924
39
                info_element_length = tvb_get_uint8(tvb, offset+1);
1925
39
                dissect_user_port_identification(tvb, pinfo, tree, offset);
1926
39
                offset += info_element_length+2;
1927
39
            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
67
            case V5_TIME_SLOT_ID:
1934
67
                info_element_length = tvb_get_uint8(tvb, offset+1);
1935
67
                dissect_v5_time_slot_identification(tvb, pinfo, tree, offset);
1936
67
                offset += info_element_length+2;
1937
67
            break;
1938
32
            case MULTI_SLOT_MAP:
1939
32
                info_element_length = tvb_get_uint8(tvb, offset+1);
1940
32
                dissect_multi_slot_map(tvb, pinfo, tree, offset);
1941
32
                offset += info_element_length+2;
1942
32
            break;
1943
36
            case BCC_REJECT_CAUSE:
1944
36
                info_element_length = tvb_get_uint8(tvb, offset+1);
1945
36
                dissect_bcc_rejct_cause(tvb, pinfo, tree, offset);
1946
36
                offset += info_element_length+2;
1947
36
            break;
1948
14
            case BCC_PROTOCOL_ERROR_CAUSE:
1949
14
                info_element_length = tvb_get_uint8(tvb, offset+1);
1950
14
                dissect_bcc_protocol_error_cause(tvb, pinfo, tree, offset);
1951
14
                offset += info_element_length+2;
1952
14
            break;
1953
31
            case CONNECTION_INCOMPLETE:
1954
31
                info_element_length = tvb_get_uint8(tvb, offset+1);
1955
31
                dissect_connection_incomplete(tvb, pinfo, tree, offset);
1956
31
                offset += info_element_length+2;
1957
31
            break;
1958
70
            case LINK_CONTROL_FUNCTION:
1959
70
                info_element_length = tvb_get_uint8(tvb, offset+1);
1960
70
                dissect_link_control_function(tvb, pinfo, tree, offset);
1961
70
                offset += info_element_length+2;
1962
70
            break;
1963
8.23k
            default:
1964
8.23k
                offset += 1;
1965
8.23k
            break;
1966
11.2k
        }
1967
11.1k
        if (singleoctet == 1) {
1968
1.55k
            offset += 1;
1969
1.55k
        }
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
11.1k
    }
1977
206
}
1978
1979
1980
static void
1981
dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1982
206
{
1983
206
    int         offset   = 0;
1984
206
    proto_tree *v52_tree = NULL;
1985
206
    bool        addr     = false;
1986
206
    uint8_t     bcc_all_address_tmp_up = -1;
1987
206
    uint16_t    pstn_all_address_tmp, isdn_all_address_tmp, bcc_all_address_tmp;
1988
206
    uint16_t    prot_all_address_tmp, link_all_address_tmp;
1989
1990
206
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "V52");
1991
1992
206
    if (tree) {
1993
206
        proto_item *ti;
1994
206
        ti = proto_tree_add_item(tree, proto_v52, tvb, offset, -1, ENC_NA);
1995
206
        v52_tree = proto_item_add_subtree(ti, ett_v52);
1996
1997
206
        dissect_v52_protocol_discriminator(tvb, offset, v52_tree);
1998
206
    }
1999
2000
2001
    /* if (v52_tree != NULL) */ {
2002
2003
206
        message_type_tmp = tvb_get_uint8(tvb, MSG_TYPE_OFFSET);
2004
2005
206
        if ((message_type_tmp >= 0x00) && (message_type_tmp <= 0x0e)) {
2006
27
            addr = true;
2007
27
            proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2008
27
            proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2009
2010
27
            pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2011
2012
2013
27
            col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2014
27
        }
2015
2016
206
        if ((message_type_tmp >= 0x10) && (message_type_tmp <= 0x13)) {
2017
32
            addr = true;
2018
32
            if ((tvb_get_uint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2019
16
                pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2020
16
                proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2021
16
                proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2022
2023
16
                col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2024
16
            }
2025
16
            else {
2026
16
                isdn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2027
16
                proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2028
16
                proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2029
2030
16
                col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2031
16
            }
2032
32
        }
2033
2034
206
        if ((message_type_tmp == 0x30) || (message_type_tmp == 0x31)) {
2035
19
            addr = true;
2036
19
            link_all_address_tmp = tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET);
2037
19
            proto_tree_add_item(v52_tree, hf_v52_link_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2038
19
            proto_tree_add_item(v52_tree, hf_v52_link_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2039
2040
19
            col_append_fstr(pinfo->cinfo, COL_INFO, " | LinkId: %u", link_all_address_tmp);
2041
19
        }
2042
2043
206
        if ((message_type_tmp >= 0x20) && (message_type_tmp <= 0x2a)) {
2044
8
            addr = true;
2045
8
            proto_tree_add_item(v52_tree, hf_v52_bcc_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2046
8
            proto_tree_add_item(v52_tree, hf_v52_bcc_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2047
2048
8
            bcc_all_address_tmp_up = tvb_get_uint8(tvb, ADDRESS_OFFSET);
2049
8
            if (bcc_all_address_tmp_up >= 128) {
2050
1
                bcc_all_address_tmp_up = bcc_all_address_tmp_up - 128;
2051
1
            }
2052
8
            bcc_all_address_tmp = (bcc_all_address_tmp_up<<6) + tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET);
2053
2054
8
            col_append_fstr(pinfo->cinfo, COL_INFO, " | ref: %u", bcc_all_address_tmp);
2055
8
        }
2056
2057
206
        if ((message_type_tmp >= 0x18) && (message_type_tmp <= 0x1f)) {
2058
17
            addr = true;
2059
17
            prot_all_address_tmp = (tvb_get_uint8(tvb, ADDRESS_OFFSET)<<8) + (tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET));
2060
17
            proto_tree_add_item(v52_tree, hf_v52_prot_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2061
17
            proto_tree_add_item(v52_tree, hf_v52_prot_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2062
2063
17
            if ((message_type_tmp == 0x1e) || (message_type_tmp == 0x1f)) {}
2064
17
            else {
2065
17
                col_append_fstr(pinfo->cinfo, COL_INFO, " | Log C-ch: %u", prot_all_address_tmp);
2066
17
            }
2067
17
        }
2068
2069
206
        if (addr == false) {
2070
103
            if ((tvb_get_uint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2071
23
                pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2072
23
                proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2073
23
                proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2074
2075
23
                col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2076
2077
23
            }
2078
80
            else {
2079
80
                isdn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2080
80
                proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2081
80
                proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2082
2083
80
                col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2084
2085
80
            }
2086
103
        }
2087
2088
206
        proto_tree_add_item(v52_tree, hf_v52_msg_type, tvb, MSG_TYPE_OFFSET, MSG_TYPE_LENGTH, ENC_BIG_ENDIAN);
2089
2090
2091
206
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
2092
206
        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
206
        dissect_v52_info(tvb, pinfo, v52_tree);
2095
206
    }
2096
206
}
2097
2098
static int
2099
dissect_v52(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2100
206
{
2101
206
    dissect_v52_message(tvb, pinfo, tree);
2102
206
    return tvb_captured_length(tvb);
2103
206
}
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
 */