Coverage Report

Created: 2025-12-27 06:52

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
163
{
120
163
    unsigned int discriminator = tvb_get_uint8(tvb, offset);
121
122
123
163
    if (discriminator == 0x48) {
124
94
        proto_tree_add_uint_format_value(tree, hf_v52_discriminator, tvb, offset, 1, discriminator,
125
94
            "V5.2 (0x%02X)",
126
94
            discriminator);
127
94
    } else {
128
69
        proto_tree_add_uint_format_value(tree, hf_v52_discriminator,
129
69
            tvb, offset, 1, discriminator,
130
69
            "Reserved (0x%02X)",
131
69
            discriminator);
132
69
    }
133
163
}
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
208
#define PSTN_SEQUENCE_NUMBER     0x00 /* PSTN */
545
112
#define CADENCED_RINGING         0x01 /* PSTN */
546
50
#define PULSED_SIGNAL            0x02 /* PSTN */
547
93
#define STEADY_SIGNAL            0x03 /* PSTN */
548
104
#define DIGIT_SIGNAL             0x04 /* PSTN */
549
14
#define RECOGNITION_TIME         0x10 /* PSTN */
550
74
#define ENABLE_AUTO_ACK          0x11 /* PSTN */
551
30
#define DISABLE_AUTO_ACK         0x12 /* PSTN */
552
12
#define CAUSE                    0x13 /* PSTN */
553
50
#define RESOURCE_UNAVAILABLE     0x14 /* PSTN */
554
45
#define CONTROL_FUNCTION_ELEMENT 0x20 /* Control */
555
11
#define CONTROL_FUNCTION_ID      0x21 /* Control */
556
#define ENABLE_METERING          0x22 /* PSTN */
557
22
#define VARIANT                  0x22 /* Control */
558
#define METERING_REPORT          0x23 /* PSTN */
559
11
#define INTERFACE_ID             0x23 /* Control */
560
#define ATTENUATION              0x24 /* PSTN */
561
54
#define LINK_CONTROL_FUNCTION    0x30 /* Link Control */
562
24
#define USER_PORT_ID             0x40 /* BCC */
563
11
#define ISDN_PORT_TS_ID          0x41 /* BCC */
564
51
#define V5_TIME_SLOT_ID          0x42 /* BCC */
565
18
#define MULTI_SLOT_MAP           0x43 /* BCC */
566
33
#define BCC_REJECT_CAUSE         0x44 /* BCC */
567
20
#define BCC_PROTOCOL_ERROR_CAUSE 0x45 /* BCC */
568
25
#define CONNECTION_INCOMPLETE    0x46 /* BCC */
569
19
#define SEQUENCE_NUMBER          0x50 /* Protection */
570
8
#define C_CHANNEL_ID             0x51 /* Protection */
571
8
#define PP_REJECTION_CAUSE       0x52 /* Protection */
572
21
#define PROTOCOL_ERROR           0x53 /* Protection */
573
262
#define LINE_INFORMATION         0x80 /* PSTN */
574
120
#define STATE                    0x90 /* PSTN */
575
406
#define AUTO_SIG_SEQUENCE        0xa0 /* PSTN */
576
165
#define SEQUENCE_RESPONSE        0xb0 /* PSTN */
577
120
#define PULSE_NOTIFICATION       0xc0 /* PSTN */
578
135
#define PERFORMANCE_GRADING      0xe0 /* Control */
579
370
#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
441
#define ADDRESS_OFFSET       1
664
163
#define ADDRESS_LENGTH       1
665
326
#define LOW_ADDRESS_OFFSET   2
666
163
#define LOW_ADDRESS_LENGTH   1
667
489
#define MSG_TYPE_OFFSET      3
668
163
#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
207
{
676
207
    proto_tree   *info_tree;
677
207
    proto_item   *ti_info;
678
207
    const uint8_t info_element_length = 1;
679
207
    uint8_t       info_element;
680
207
    uint8_t       pstn_sequence_number_tmp;
681
682
207
    uint16_t      data_length;
683
207
    tvbuff_t     *info_tvb;
684
207
    const int     info_offset = 0;
685
686
207
    info_element = tvb_get_uint8(tvb, offset);
687
688
207
    data_length = tvb_get_uint8(tvb, offset+1)+2;
689
207
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
690
691
207
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
692
693
207
    pstn_sequence_number_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
694
207
    col_append_fstr(pinfo->cinfo, COL_INFO, " | SN: %u", pstn_sequence_number_tmp);
695
696
207
    if (info_tree != NULL) {
697
169
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
698
169
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
699
169
        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
169
        proto_tree_add_item(info_tree, hf_v52_pstn_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
701
169
    }
702
207
}
703
704
static void
705
dissect_cadenced_ring(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
706
110
{
707
110
    proto_tree   *info_tree;
708
110
    proto_item   *ti_info;
709
110
    const uint8_t info_element_length = 1;
710
110
    uint8_t       info_element;
711
110
    uint8_t       cadenced_ring_tmp;
712
110
    uint16_t      data_length;
713
110
    tvbuff_t     *info_tvb;
714
110
    const int     info_offset = 0;
715
716
110
    info_element = tvb_get_uint8(tvb, offset);
717
718
110
    data_length = tvb_get_uint8(tvb, offset+1)+2;
719
110
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
720
721
110
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
722
723
110
    cadenced_ring_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
724
110
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
725
110
    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
110
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", cadenced_ring_tmp);
728
729
110
    if (info_tree != NULL) {
730
107
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
731
107
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
732
107
        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
107
        proto_tree_add_item(info_tree, hf_v52_cadenced_ring, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
734
735
736
107
    }
737
110
}
738
739
static void
740
dissect_pulsed_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
741
50
{
742
50
    proto_tree   *info_tree;
743
50
    proto_item   *ti_info;
744
50
    const uint8_t info_element_length = 1;
745
50
    uint8_t       info_element;
746
747
50
    uint16_t      data_length;
748
50
    tvbuff_t     *info_tvb;
749
50
    const int     info_offset = 0;
750
751
50
    info_element = tvb_get_uint8(tvb, offset);
752
753
50
    data_length = tvb_get_uint8(tvb, offset+1)+2;
754
50
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
755
756
50
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
757
758
50
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
759
50
    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
50
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
762
50
    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
50
    if (info_tree != NULL) {
765
45
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
766
45
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
767
45
        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
45
        proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
769
770
45
        if (data_length > 3) {
771
40
            proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
772
40
            proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
773
40
        }
774
775
45
        if (data_length > 4) {
776
16
            proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
777
16
            proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
778
16
        }
779
45
    }
780
50
}
781
782
static void
783
dissect_steady_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
784
93
{
785
93
    proto_tree   *info_tree;
786
93
    proto_item   *ti_info;
787
93
    const uint8_t info_element_length = 1;
788
93
    uint8_t       info_element;
789
790
93
    uint16_t      data_length;
791
93
    tvbuff_t     *info_tvb;
792
93
    const int     info_offset = 0;
793
794
93
    info_element = tvb_get_uint8(tvb, offset);
795
796
93
    data_length = tvb_get_uint8(tvb, offset+1)+2;
797
93
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
798
799
93
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
800
801
93
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
802
93
    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
93
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
805
93
    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
93
    if (info_tree != NULL) {
808
92
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
809
92
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
810
92
        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
92
        proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
812
92
    }
813
93
}
814
815
static void
816
dissect_digit_signal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
817
104
{
818
104
    proto_tree   *info_tree;
819
104
    proto_item   *ti_info;
820
104
    const uint8_t info_element_length = 1;
821
104
    uint8_t       buffer;
822
104
    uint8_t       info_element;
823
824
104
    uint16_t      data_length;
825
104
    tvbuff_t     *info_tvb;
826
104
    const int     info_offset = 0;
827
828
104
    info_element = tvb_get_uint8(tvb, offset);
829
830
104
    data_length = tvb_get_uint8(tvb, offset+1)+2;
831
104
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
832
833
104
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
834
835
104
    proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
836
104
    proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
837
104
    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
104
    proto_tree_add_item(info_tree, hf_v52_digit_ack, info_tvb, info_offset+2, 1, ENC_NA);
840
841
104
    buffer = tvb_get_uint8(info_tvb, info_offset+2)>>4;
842
104
    buffer = buffer&0x03;
843
844
104
    proto_tree_add_item(info_tree, hf_v52_digit_spare, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
845
104
    proto_tree_add_item(info_tree, hf_v52_digit_info, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
846
847
104
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
848
104
    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
104
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", buffer);
851
104
}
852
853
static void
854
dissect_recognition_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
855
14
{
856
14
    proto_tree   *info_tree;
857
14
    proto_item   *ti_info;
858
14
    const uint8_t info_element_length = 1;
859
14
    uint8_t       info_element;
860
861
14
    uint16_t      data_length;
862
14
    tvbuff_t     *info_tvb;
863
14
    const int     info_offset = 0;
864
865
14
    info_element = tvb_get_uint8(tvb, offset);
866
867
14
    data_length = tvb_get_uint8(tvb, offset+1)+2;
868
14
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
869
870
14
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
871
872
14
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
873
14
    col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(tvb_get_uint8(info_tvb, info_offset), &info_element_values_short_ext, "Unknown element"));
874
875
14
    if (info_tree != NULL) {
876
14
        uint8_t buffer;
877
14
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
878
14
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
879
14
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
880
881
14
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
882
        /*Signal = Coding of pulse type*/
883
14
        if (buffer >= 0x6b)
884
1
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
885
        /*Signal = Coding of steady signal type*/
886
13
        else if (buffer <= 0x1a)
887
8
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
888
889
14
        proto_tree_add_item(info_tree, hf_v52_duration_type, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
890
14
    }
891
14
}
892
893
static void
894
dissect_enable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
895
74
{
896
74
    proto_tree   *info_tree;
897
74
    proto_item   *ti_info;
898
74
    const uint8_t info_element_length = 1;
899
74
    uint8_t       info_element;
900
901
74
    uint16_t      data_length;
902
74
    tvbuff_t     *info_tvb;
903
74
    const int     info_offset = 0;
904
905
74
    info_element = tvb_get_uint8(tvb, offset);
906
907
74
    data_length = tvb_get_uint8(tvb, offset+1)+2;
908
74
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
909
910
74
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
911
912
74
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
913
74
    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
74
    if (info_tree != NULL) {
916
74
        uint8_t buffer;
917
74
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
918
74
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
919
74
        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
74
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
922
        /*Signal*/
923
74
        if (buffer >= 0x6b)
924
9
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
925
65
        else if (buffer <= 0x1a)
926
56
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
927
928
74
        buffer = tvb_get_uint8(info_tvb, info_offset+3)&0x7f;
929
        /*Response*/
930
74
        if (buffer >= 0x6b)
931
8
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
932
66
        else if (buffer <= 0x1a)
933
56
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
934
935
74
        if (tvb_reported_length_remaining(info_tvb, info_offset+4)) {
936
73
            proto_tree_add_item(info_tree, hf_v52_suppression_indicator, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
937
73
            proto_tree_add_item(info_tree, hf_v52_pulse_duration, info_tvb, info_offset+4, 1, ENC_BIG_ENDIAN);
938
73
        }
939
74
        if (tvb_reported_length_remaining(info_tvb, info_offset+5)) {
940
70
            proto_tree_add_item(info_tree, hf_v52_ack_request_indicator, info_tvb, info_offset+5, 1, ENC_BIG_ENDIAN);
941
70
            proto_tree_add_item(info_tree, hf_v52_number_of_pulses, info_tvb, info_offset+5, 1, ENC_BIG_ENDIAN);
942
70
        }
943
74
    }
944
74
}
945
946
static void
947
dissect_disable_auto_ack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
948
30
{
949
30
    proto_tree   *info_tree;
950
30
    proto_item   *ti_info;
951
30
    const uint8_t info_element_length = 1;
952
30
    uint8_t       info_element;
953
954
30
    uint16_t      data_length;
955
30
    tvbuff_t     *info_tvb;
956
30
    const int     info_offset = 0;
957
958
30
    info_element = tvb_get_uint8(tvb, offset);
959
960
30
    data_length = tvb_get_uint8(tvb, offset+1)+2;
961
30
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
962
963
30
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
964
965
30
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
966
30
    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
30
    if (info_tree != NULL) {
969
30
        uint8_t buffer;
970
30
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
971
30
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
972
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);
973
974
30
        buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x7f;
975
976
30
        if (buffer >= 0x6b)
977
0
            proto_tree_add_item(info_tree, hf_v52_pulse_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
978
30
        else if (buffer <= 0x1a)
979
26
            proto_tree_add_item(info_tree, hf_v52_steady_signal, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
980
30
    }
981
30
}
982
983
static void
984
dissect_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
985
12
{
986
12
    proto_tree   *info_tree;
987
12
    proto_item   *ti_info;
988
12
    const uint8_t info_element_length = 1;
989
12
    uint8_t       info_element;
990
991
12
    uint16_t      data_length;
992
12
    tvbuff_t     *info_tvb;
993
12
    const int     info_offset = 0;
994
995
12
    info_element = tvb_get_uint8(tvb, offset);
996
997
12
    data_length = tvb_get_uint8(tvb, offset+1)+2;
998
12
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
999
1000
12
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1001
1002
12
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1003
12
    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
12
    col_append_str(pinfo->cinfo, COL_INFO, ": ");
1006
12
    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
12
    if (info_tree != NULL) {
1009
12
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1010
12
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1011
12
        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
12
        proto_tree_add_item(info_tree, hf_v52_cause_type, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1013
1014
12
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1015
11
            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
11
                                "Diagnostic: %s", val_to_str_ext_const(tvb_get_uint8(info_tvb, info_offset+3), &msg_type_values_ext, "unknown"));
1017
12
    }
1018
12
}
1019
1020
static void
1021
dissect_resource_unavailable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1022
50
{
1023
50
    proto_tree   *info_tree;
1024
50
    proto_item   *ti_info;
1025
50
    const uint8_t info_element_length = 1;
1026
50
    uint8_t       info_element;
1027
1028
50
    uint16_t      data_length;
1029
50
    tvbuff_t     *info_tvb;
1030
50
    const int     info_offset = 0;
1031
1032
50
    info_element = tvb_get_uint8(tvb, offset);
1033
1034
50
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1035
50
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1036
1037
50
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1038
1039
50
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1040
50
    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
50
    if (info_tree != NULL) {
1043
50
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1044
50
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1045
50
        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
50
        proto_tree_add_item(info_tree, hf_v52_res_unavailable, info_tvb, info_offset+2, info_element_length, ENC_ASCII);
1047
50
    }
1048
50
}
1049
1050
static void
1051
dissect_pulse_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1052
120
{
1053
120
    proto_tree   *info_tree;
1054
120
    proto_item   *ti_info;
1055
120
    const uint8_t info_element_length = 1;
1056
120
    uint8_t       info_element;
1057
1058
120
    uint16_t      data_length;
1059
120
    tvbuff_t     *info_tvb;
1060
120
    const int     info_offset = 0;
1061
1062
120
    info_element = tvb_get_uint8(tvb, offset);
1063
1064
120
    data_length = 1;
1065
120
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1066
1067
120
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1068
1069
120
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1070
120
    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
120
    if (info_tree != NULL) {
1073
120
        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
120
        proto_tree_add_item(info_tree, hf_v52_pulse_notification, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1075
120
    }
1076
120
}
1077
1078
static void
1079
dissect_line_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1080
262
{
1081
262
    proto_tree   *info_tree;
1082
262
    proto_item   *ti_info;
1083
262
    const uint8_t info_element_length = 1;
1084
262
    uint8_t       info_element;
1085
1086
262
    uint16_t      data_length;
1087
262
    tvbuff_t     *info_tvb;
1088
262
    const int     info_offset = 0;
1089
1090
262
    info_element = tvb_get_uint8(tvb, offset);
1091
1092
262
    data_length = 1;
1093
262
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1094
1095
262
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1096
1097
262
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1098
262
    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
262
    if (info_tree != NULL) {
1101
262
        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
262
        proto_tree_add_item(info_tree, hf_v52_line_info, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1103
262
    }
1104
262
}
1105
1106
static void
1107
dissect_state(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1108
120
{
1109
120
    proto_tree   *info_tree;
1110
120
    proto_item   *ti_info;
1111
120
    const uint8_t info_element_length = 1;
1112
120
    uint8_t       info_element;
1113
1114
120
    uint16_t      data_length;
1115
120
    tvbuff_t     *info_tvb;
1116
120
    const int     info_offset = 0;
1117
1118
120
    info_element = tvb_get_uint8(tvb, offset);
1119
1120
120
    data_length = 1;
1121
120
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1122
1123
120
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1124
1125
120
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1126
120
    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
120
    if (info_tree != NULL) {
1129
120
        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
120
        proto_tree_add_item(info_tree, hf_v52_state, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1131
120
    }
1132
120
}
1133
1134
static void
1135
dissect_auto_sig_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1136
406
{
1137
406
    proto_tree   *info_tree;
1138
406
    proto_item   *ti_info;
1139
406
    const uint8_t info_element_length = 1;
1140
406
    uint8_t       info_element;
1141
1142
406
    uint16_t      data_length;
1143
406
    tvbuff_t     *info_tvb;
1144
406
    const int     info_offset = 0;
1145
1146
406
    info_element = tvb_get_uint8(tvb, offset);
1147
1148
406
    data_length = 1;
1149
406
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1150
1151
406
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1152
1153
406
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1154
406
    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
406
    if (info_tree != NULL) {
1157
406
        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
406
        proto_tree_add_item(info_tree, hf_v52_auto_signalling_sequence, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1159
406
    }
1160
406
}
1161
1162
static void
1163
dissect_sequence_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1164
165
{
1165
165
    proto_tree   *info_tree;
1166
165
    proto_item   *ti_info;
1167
165
    const uint8_t info_element_length = 1;
1168
165
    uint8_t       info_element;
1169
1170
165
    uint16_t      data_length;
1171
165
    tvbuff_t     *info_tvb;
1172
165
    const int     info_offset = 0;
1173
1174
165
    info_element = tvb_get_uint8(tvb, offset);
1175
1176
165
    data_length = 1;
1177
165
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1178
1179
165
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1180
1181
165
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1182
165
    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
165
    if (info_tree != NULL) {
1185
165
        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
165
        proto_tree_add_item(info_tree, hf_v52_sequence_response, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1187
165
    }
1188
165
}
1189
1190
static void
1191
dissect_control_function_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1192
45
{
1193
45
    proto_tree   *info_tree;
1194
45
    proto_item   *ti_info;
1195
45
    const uint8_t info_element_length = 1;
1196
45
    uint8_t       info_element;
1197
1198
45
    uint16_t      data_length;
1199
45
    tvbuff_t     *info_tvb;
1200
45
    const int     info_offset = 0;
1201
1202
45
    info_element = tvb_get_uint8(tvb, offset);
1203
1204
45
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1205
45
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1206
1207
45
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1208
1209
45
    if (message_type_tmp != 0x11) {
1210
27
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1211
27
        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
27
    }
1213
1214
45
    if (info_tree != NULL) {
1215
44
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1216
44
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1217
44
        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
44
        proto_tree_add_item(info_tree, hf_v52_control_function_element, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1219
44
    }
1220
45
}
1221
1222
static void
1223
dissect_control_function_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1224
11
{
1225
11
    proto_tree   *info_tree;
1226
11
    proto_item   *ti_info;
1227
11
    const uint8_t info_element_length = 1;
1228
11
    uint8_t       info_element;
1229
1230
11
    uint16_t      data_length;
1231
11
    tvbuff_t     *info_tvb;
1232
11
    const int     info_offset = 0;
1233
1234
11
    info_element = tvb_get_uint8(tvb, offset);
1235
1236
11
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1237
11
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1238
1239
11
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1240
1241
11
    if (message_type_tmp != 0x13) {
1242
11
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1243
11
        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
11
    }
1245
1246
11
    if (info_tree != NULL) {
1247
11
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1248
11
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1249
11
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1250
11
        proto_tree_add_item(info_tree, hf_v52_control_function_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1251
11
    }
1252
11
}
1253
1254
static void
1255
dissect_variant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1256
22
{
1257
22
    proto_tree   *info_tree;
1258
22
    proto_item   *ti_info;
1259
22
    const uint8_t info_element_length = 1;
1260
22
    uint8_t       info_element;
1261
22
    uint8_t       variantValue;
1262
1263
22
    uint16_t      data_length;
1264
22
    tvbuff_t     *info_tvb;
1265
22
    const int     info_offset = 0;
1266
1267
22
    info_element = tvb_get_uint8(tvb, offset);
1268
1269
22
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1270
22
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1271
1272
22
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1273
1274
22
    variantValue = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
1275
22
    col_append_fstr(pinfo->cinfo, COL_INFO, " | Var: %u", variantValue);
1276
1277
22
    if (info_tree != NULL) {
1278
22
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1279
22
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1280
22
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1281
22
        proto_tree_add_item(info_tree, hf_v52_variant, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1282
22
    }
1283
22
}
1284
1285
static void
1286
dissect_interface_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1287
11
{
1288
11
    proto_tree   *info_tree;
1289
11
    proto_item   *ti_info;
1290
11
    const uint8_t info_element_length = 1;
1291
11
    uint8_t       info_element;
1292
11
    uint8_t       interfaceAllIdValue;
1293
1294
11
    uint16_t      data_length;
1295
11
    tvbuff_t     *info_tvb;
1296
11
    const int     info_offset = 0;
1297
1298
11
    info_element = tvb_get_uint8(tvb, offset);
1299
1300
11
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1301
11
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1302
1303
11
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1304
1305
11
    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
11
    col_append_fstr(pinfo->cinfo, COL_INFO, " | Intf. ID: %u", interfaceAllIdValue);
1307
1308
11
    if (info_tree != NULL) {
1309
11
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1310
11
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1311
11
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1312
11
        proto_tree_add_item(info_tree, hf_v52_if_up_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1313
11
        proto_tree_add_item(info_tree, hf_v52_if_id, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1314
11
        proto_tree_add_item(info_tree, hf_v52_if_low_id, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1315
11
        proto_tree_add_item(info_tree, hf_v52_if_all_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1316
11
    }
1317
11
}
1318
1319
static void
1320
dissect_sequence_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1321
19
{
1322
19
    proto_tree   *info_tree;
1323
19
    proto_item   *ti_info;
1324
19
    const uint8_t info_element_length = 1;
1325
19
    uint8_t       info_element;
1326
19
    uint8_t       hf_v52_sequence_number_tmp;
1327
19
    uint16_t      data_length;
1328
19
    tvbuff_t     *info_tvb;
1329
19
    const int     info_offset = 0;
1330
1331
19
    info_element = tvb_get_uint8(tvb, offset);
1332
1333
19
    data_length  = tvb_get_uint8(tvb, offset+1)+2;
1334
19
    info_tvb     = tvb_new_subset_length(tvb, offset, data_length);
1335
1336
19
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1337
1338
19
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1339
19
    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
19
    hf_v52_sequence_number_tmp = tvb_get_uint8(info_tvb, info_offset+2)-0x80;
1342
19
    col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", hf_v52_sequence_number_tmp);
1343
1344
19
    if (info_tree != NULL) {
1345
19
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1346
19
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1347
19
        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
19
        proto_tree_add_item(info_tree, hf_v52_sequence_number, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1349
19
    }
1350
19
}
1351
1352
static void
1353
dissect_physical_c_channel_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1354
8
{
1355
8
    proto_tree   *info_tree;
1356
8
    proto_item   *ti_info;
1357
8
    const uint8_t info_element_length = 1;
1358
8
    uint8_t       info_element;
1359
1360
8
    uint16_t      data_length;
1361
8
    tvbuff_t     *info_tvb;
1362
8
    const int     info_offset = 0;
1363
1364
8
    info_element = tvb_get_uint8(tvb, offset);
1365
1366
8
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1367
8
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1368
1369
8
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1370
1371
8
    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
8
    if (info_tree != NULL) {
1374
8
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1375
8
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1376
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);
1377
8
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1378
8
        proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1379
8
    }
1380
8
}
1381
1382
static void
1383
dissect_pp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1384
8
{
1385
8
    proto_tree   *info_tree;
1386
8
    proto_item   *ti_info;
1387
8
    const uint8_t info_element_length = 1;
1388
8
    uint8_t       info_element;
1389
1390
8
    uint16_t      data_length;
1391
8
    tvbuff_t     *info_tvb;
1392
8
    const int     info_offset = 0;
1393
1394
8
    info_element = tvb_get_uint8(tvb, offset);
1395
1396
8
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1397
8
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1398
1399
8
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1400
1401
8
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1402
8
    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
8
    if (info_tree != NULL) {
1405
8
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1406
8
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1407
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);
1408
8
        proto_tree_add_item(info_tree, hf_v52_rejection_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1409
8
    }
1410
8
}
1411
1412
static void
1413
dissect_protocol_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1414
21
{
1415
21
    proto_tree   *info_tree;
1416
21
    proto_item   *ti_info;
1417
21
    const uint8_t info_element_length = 1;
1418
21
    uint8_t       info_element;
1419
1420
21
    uint16_t      data_length;
1421
21
    tvbuff_t     *info_tvb;
1422
21
    const int     info_offset = 0;
1423
1424
21
    info_element = tvb_get_uint8(tvb, offset);
1425
1426
21
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1427
21
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1428
1429
21
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1430
1431
21
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1432
21
    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
21
    if (info_tree != NULL) {
1435
21
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1436
21
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1437
21
        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
21
        proto_tree_add_item(info_tree, hf_v52_error_cause, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1439
21
        proto_tree_add_item(info_tree, hf_v52_diagnostic_msg, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1440
21
        proto_tree_add_item(info_tree, hf_v52_diagnostic_element, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1441
21
    }
1442
21
}
1443
1444
static void
1445
dissect_performance_grading(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1446
135
{
1447
135
    proto_tree   *info_tree;
1448
135
    proto_item   *ti_info;
1449
135
    const uint8_t info_element_length = 1;
1450
135
    uint8_t       info_element;
1451
1452
135
    uint16_t      data_length;
1453
135
    tvbuff_t     *info_tvb;
1454
135
    const int     info_offset = 0;
1455
1456
135
    info_element = tvb_get_uint8(tvb, offset);
1457
1458
135
    data_length = 1;
1459
135
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1460
1461
135
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1462
1463
135
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1464
135
    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
135
    if (info_tree != NULL) {
1467
135
        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
135
        proto_tree_add_item(info_tree, hf_v52_performance_grading, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1469
135
    }
1470
135
}
1471
1472
static void
1473
dissect_cp_rejection_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1474
370
{
1475
370
    proto_tree   *info_tree;
1476
370
    proto_item   *ti_info;
1477
370
    const uint8_t info_element_length = 1;
1478
370
    uint8_t       info_element;
1479
1480
370
    uint16_t      data_length;
1481
370
    tvbuff_t     *info_tvb;
1482
370
    const int     info_offset = 0;
1483
1484
370
    info_element = tvb_get_uint8(tvb, offset);
1485
1486
370
    data_length = 1;
1487
370
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1488
1489
370
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1490
1491
370
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1492
370
    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
370
    if (info_tree != NULL) {
1495
370
        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
370
        proto_tree_add_item(info_tree, hf_v52_cp_rejection_cause, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1497
370
    }
1498
370
}
1499
1500
static void
1501
dissect_user_port_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1502
24
{
1503
24
    proto_tree   *info_tree;
1504
24
    proto_item   *ti_info;
1505
24
    const uint8_t info_element_length = 1;
1506
24
    uint8_t       buffer;
1507
24
    uint8_t       info_element;
1508
1509
24
    uint16_t      data_length;
1510
24
    tvbuff_t     *info_tvb;
1511
24
    const int     info_offset = 0;
1512
1513
24
    info_element = tvb_get_uint8(tvb, offset);
1514
1515
24
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1516
24
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1517
1518
24
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1519
1520
24
    proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1521
24
    proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1522
24
    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
24
    buffer = tvb_get_uint8(info_tvb, info_offset+2)&0x01;
1525
1526
24
    if (buffer == 0x01) {
1527
12
        proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1528
12
        proto_tree_add_item(info_tree, hf_v52_pstn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
1529
1530
12
        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
12
    }
1532
12
    else if (buffer == 0x00) {
1533
11
        proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id, info_tvb, info_offset+2, 1, ENC_BIG_ENDIAN);
1534
11
        proto_tree_add_item(info_tree, hf_v52_isdn_user_port_id_lower, info_tvb, info_offset+3, 1, ENC_BIG_ENDIAN);
1535
1536
11
        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
11
    }
1538
24
}
1539
1540
static void
1541
dissect_isdn_port_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1542
11
{
1543
11
    proto_tree   *info_tree;
1544
11
    proto_item   *ti_info;
1545
11
    const uint8_t info_element_length = 1;
1546
11
    uint8_t       info_element;
1547
11
    uint8_t       isdn_user_port_ts_num_tmp;
1548
1549
11
    uint16_t      data_length;
1550
11
    tvbuff_t     *info_tvb;
1551
11
    const int     info_offset = 0;
1552
1553
11
    info_element = tvb_get_uint8(tvb, offset);
1554
1555
11
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1556
11
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1557
1558
11
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1559
1560
11
    isdn_user_port_ts_num_tmp = (tvb_get_uint8(info_tvb, info_offset+2)) -  128;
1561
11
    col_append_str(pinfo->cinfo, COL_INFO, ", ");
1562
11
    col_append_fstr(pinfo->cinfo, COL_INFO, "%x", isdn_user_port_ts_num_tmp);
1563
1564
11
    if (info_tree != NULL) {
1565
10
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1566
10
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1567
10
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1568
10
        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
10
    }
1570
11
}
1571
1572
static void
1573
dissect_v5_time_slot_identification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1574
51
{
1575
51
    proto_tree   *info_tree;
1576
51
    proto_item   *ti_info;
1577
51
    const uint8_t info_element_length = 1;
1578
51
    uint8_t       info_element;
1579
51
    uint8_t       v5_link_id_tmp;
1580
51
    uint8_t       v5_time_slot_tmp;
1581
1582
51
    uint16_t      data_length;
1583
51
    tvbuff_t     *info_tvb;
1584
51
    const int     info_offset = 0;
1585
1586
51
    info_element = tvb_get_uint8(tvb, offset);
1587
1588
51
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1589
51
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1590
1591
51
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1592
1593
51
    v5_link_id_tmp = tvb_get_uint8(info_tvb, info_offset+2);
1594
51
    v5_time_slot_tmp = tvb_get_uint8(info_tvb, info_offset+3);
1595
1596
51
    if (v5_time_slot_tmp >= 64) {
1597
28
        v5_time_slot_tmp = v5_time_slot_tmp - 64;
1598
28
    }
1599
1600
51
    if (v5_time_slot_tmp >= 32) {
1601
12
        v5_time_slot_tmp = v5_time_slot_tmp - 32;
1602
12
    }
1603
1604
51
    col_append_fstr(pinfo->cinfo, COL_INFO, " | V5 Link: %u, %u ", v5_link_id_tmp, v5_time_slot_tmp);
1605
1606
51
    if (info_tree != NULL) {
1607
51
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1608
51
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1609
51
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1610
51
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1611
51
        proto_tree_add_item(info_tree, hf_v52_override, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1612
51
        proto_tree_add_item(info_tree, hf_v52_v5_time_slot, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1613
51
    }
1614
51
}
1615
1616
static void
1617
dissect_multi_slot_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1618
18
{
1619
18
    proto_tree   *info_tree;
1620
18
    proto_item   *ti_info;
1621
18
    const uint8_t info_element_length = 1;
1622
18
    uint8_t       info_element;
1623
1624
18
    uint16_t      data_length;
1625
18
    tvbuff_t     *info_tvb;
1626
18
    const int     info_offset = 0;
1627
1628
18
    info_element = tvb_get_uint8(tvb, offset);
1629
1630
18
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1631
18
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1632
1633
18
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1634
1635
18
    col_append_fstr(pinfo->cinfo, COL_INFO, " | V5MSlink ID:%u", tvb_get_uint8(info_tvb, info_offset+2));
1636
1637
18
    if (info_tree != NULL) {
1638
18
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1639
18
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1640
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);
1641
18
        proto_tree_add_item(info_tree, hf_v52_v5_link_id, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1642
1643
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1644
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1645
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+4))
1646
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1647
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+5))
1648
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+5, info_element_length, ENC_BIG_ENDIAN);
1649
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+6))
1650
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+6, info_element_length, ENC_BIG_ENDIAN);
1651
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+7))
1652
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+7, info_element_length, ENC_BIG_ENDIAN);
1653
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+8))
1654
17
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+8, info_element_length, ENC_BIG_ENDIAN);
1655
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+9))
1656
15
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+9, info_element_length, ENC_BIG_ENDIAN);
1657
18
        if (tvb_reported_length_remaining(info_tvb, info_offset+10))
1658
15
            proto_tree_add_item(info_tree, hf_v52_v5_multi_slot_elements, info_tvb, info_offset+10, info_element_length, ENC_BIG_ENDIAN);
1659
18
    }
1660
18
}
1661
1662
static void
1663
dissect_bcc_rejct_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1664
33
{
1665
33
    proto_tree   *info_tree;
1666
33
    proto_item   *ti_info;
1667
33
    const uint8_t info_element_length = 1;
1668
33
    uint8_t       info_element;
1669
1670
33
    uint16_t      data_length;
1671
33
    tvbuff_t     *info_tvb;
1672
33
    const int     info_offset = 0;
1673
1674
33
    info_element = tvb_get_uint8(tvb, offset);
1675
1676
33
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1677
33
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1678
1679
33
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1680
1681
33
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1682
33
    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
33
    if (info_tree != NULL) {
1685
33
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1686
33
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1687
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);
1688
33
        proto_tree_add_item(info_tree, hf_v52_reject_cause_type, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1689
33
    }
1690
33
}
1691
1692
static void
1693
dissect_bcc_protocol_error_cause(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1694
20
{
1695
20
    proto_tree   *info_tree;
1696
20
    proto_item   *ti_info;
1697
20
    const uint8_t info_element_length = 1;
1698
20
    uint8_t       info_element;
1699
1700
20
    uint16_t      data_length;
1701
20
    tvbuff_t     *info_tvb;
1702
20
    const int     info_offset = 0;
1703
1704
20
    info_element = tvb_get_uint8(tvb, offset);
1705
1706
20
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1707
20
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1708
1709
20
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1710
1711
20
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1712
20
    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
20
    if (info_tree != NULL) {
1715
20
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1716
20
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1717
20
        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
20
        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
20
        if (tvb_reported_length_remaining(info_tvb, info_offset+3))
1721
20
            proto_tree_add_item(info_tree, hf_v52_diagnostic_message, info_tvb, info_offset+3, info_element_length, ENC_BIG_ENDIAN);
1722
20
        if (tvb_reported_length_remaining(info_tvb, info_offset+4))
1723
19
            proto_tree_add_item(info_tree, hf_v52_diagnostic_information, info_tvb, info_offset+4, info_element_length, ENC_BIG_ENDIAN);
1724
20
    }
1725
20
}
1726
1727
static void
1728
dissect_connection_incomplete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1729
25
{
1730
25
    proto_tree   *info_tree;
1731
25
    proto_item   *ti_info;
1732
25
    const uint8_t info_element_length = 1;
1733
25
    uint8_t       info_element;
1734
1735
25
    uint16_t      data_length;
1736
25
    tvbuff_t     *info_tvb;
1737
25
    const int     info_offset = 0;
1738
1739
25
    info_element = tvb_get_uint8(tvb, offset);
1740
1741
25
    data_length = tvb_get_uint8(tvb, offset+1)+2;
1742
25
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1743
1744
25
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1745
1746
25
    col_append_str(pinfo->cinfo, COL_INFO, " | ");
1747
25
    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
25
    if (info_tree != NULL) {
1750
25
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1751
25
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1752
25
        proto_item_append_text(ti_info, " %s (0x%x)", val_to_str_ext_const(info_element, &info_element_values_ext, "unknown info element"), info_element);
1753
25
        proto_tree_add_item(info_tree, hf_v52_connection_incomplete_reason, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1754
25
    }
1755
25
}
1756
1757
static void
1758
dissect_link_control_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1759
54
{
1760
54
    proto_tree   *info_tree;
1761
54
    proto_item   *ti_info;
1762
54
    const uint8_t info_element_length = 1;
1763
54
    uint8_t       info_element;
1764
1765
54
    uint16_t      data_length;
1766
54
    tvbuff_t     *info_tvb;
1767
54
    const int     info_offset = 0;
1768
1769
54
    info_element = tvb_get_uint8(tvb, offset);
1770
1771
54
    data_length = tvb_get_uint8(tvb, offset+1) + 2;
1772
54
    info_tvb    = tvb_new_subset_length(tvb, offset, data_length);
1773
1774
54
    info_tree = proto_tree_add_subtree(tree, info_tvb, info_offset, -1, ett_v52_info, &ti_info, "Info Element:");
1775
1776
54
    if (message_type_tmp != 0x31) {
1777
49
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
1778
49
        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
49
    }
1780
1781
54
    if (info_tree != NULL) {
1782
54
        proto_tree_add_item(info_tree, hf_v52_info_element, info_tvb, info_offset, info_element_length, ENC_BIG_ENDIAN);
1783
54
        proto_tree_add_item(info_tree, hf_v52_info_length, info_tvb, info_offset+1, info_element_length, ENC_BIG_ENDIAN);
1784
54
        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
54
        proto_tree_add_item(info_tree, hf_v52_link_control_function, info_tvb, info_offset+2, info_element_length, ENC_BIG_ENDIAN);
1786
54
    }
1787
54
}
1788
1789
1790
1791
static void
1792
dissect_v52_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1793
163
{
1794
163
    int    offset = 4;
1795
163
    uint8_t info_element, info_element_length;
1796
    /*int    old_offset;*/
1797
163
    int    singleoctet;
1798
1799
8.50k
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
1800
8.41k
        singleoctet = 0;
1801
        /* old_offset = offset; */
1802
8.41k
        info_element = tvb_get_uint8(tvb, offset);
1803
8.41k
        switch (info_element) {
1804
208
            case PSTN_SEQUENCE_NUMBER:
1805
208
                info_element_length = tvb_get_uint8(tvb, offset+1);
1806
208
                dissect_pstn_sequence_number(tvb, pinfo, tree, offset);
1807
208
                offset += info_element_length+2;
1808
208
            break;
1809
112
            case CADENCED_RINGING:
1810
112
                info_element_length = tvb_get_uint8(tvb, offset+1);
1811
112
                dissect_cadenced_ring(tvb, pinfo, tree, offset);
1812
112
                offset += info_element_length+2;
1813
112
            break;
1814
50
            case PULSED_SIGNAL:
1815
50
                info_element_length = tvb_get_uint8(tvb, offset+1);
1816
50
                dissect_pulsed_signal(tvb, pinfo, tree, offset);
1817
50
                offset += info_element_length+2;
1818
50
            break;
1819
93
            case STEADY_SIGNAL:
1820
93
                info_element_length = tvb_get_uint8(tvb, offset+1);
1821
93
                dissect_steady_signal(tvb, pinfo, tree, offset);
1822
93
                offset += info_element_length+2;
1823
93
            break;
1824
104
            case DIGIT_SIGNAL:
1825
104
                info_element_length = tvb_get_uint8(tvb, offset+1);
1826
104
                dissect_digit_signal(tvb, pinfo, tree, offset);
1827
104
                offset += info_element_length+2;
1828
104
            break;
1829
14
            case RECOGNITION_TIME:
1830
14
                info_element_length = tvb_get_uint8(tvb, offset+1);
1831
14
                dissect_recognition_time(tvb, pinfo, tree, offset);
1832
14
                offset += info_element_length+2;
1833
14
            break;
1834
74
            case ENABLE_AUTO_ACK:
1835
74
                info_element_length = tvb_get_uint8(tvb, offset+1);
1836
74
                dissect_enable_auto_ack(tvb, pinfo, tree, offset);
1837
74
                offset += info_element_length+2;
1838
74
            break;
1839
30
            case DISABLE_AUTO_ACK:
1840
30
                info_element_length = tvb_get_uint8(tvb, offset+1);
1841
30
                dissect_disable_auto_ack(tvb, pinfo, tree, offset);
1842
30
                offset += info_element_length+2;
1843
30
            break;
1844
12
            case CAUSE:
1845
12
                info_element_length = tvb_get_uint8(tvb, offset+1);
1846
12
                dissect_cause(tvb, pinfo, tree, offset);
1847
12
                offset += info_element_length+2;
1848
12
            break;
1849
50
            case RESOURCE_UNAVAILABLE:
1850
50
                info_element_length = tvb_get_uint8(tvb, offset+1);
1851
50
                dissect_resource_unavailable(tvb, pinfo, tree, offset);
1852
50
                offset += info_element_length+2;
1853
50
            break;
1854
120
            case PULSE_NOTIFICATION:
1855
120
                dissect_pulse_notification(tvb, pinfo, tree, offset);
1856
120
                singleoctet = 1;
1857
120
            break;
1858
262
            case LINE_INFORMATION:
1859
262
                dissect_line_information(tvb, pinfo, tree, offset);
1860
262
                singleoctet = 1;
1861
262
            break;
1862
120
            case STATE:
1863
120
                dissect_state(tvb, pinfo, tree, offset);
1864
120
                singleoctet = 1;
1865
120
            break;
1866
406
            case AUTO_SIG_SEQUENCE:
1867
406
                dissect_auto_sig_sequence(tvb, pinfo, tree, offset);
1868
406
                singleoctet = 1;
1869
406
            break;
1870
165
            case SEQUENCE_RESPONSE:
1871
165
                dissect_sequence_response(tvb, pinfo, tree, offset);
1872
165
                singleoctet = 1;
1873
165
            break;
1874
1875
45
            case CONTROL_FUNCTION_ELEMENT:
1876
45
                info_element_length = tvb_get_uint8(tvb, offset+1);
1877
45
                dissect_control_function_element(tvb, pinfo, tree, offset);
1878
45
                offset += info_element_length+2;
1879
45
            break;
1880
11
            case CONTROL_FUNCTION_ID:
1881
11
                info_element_length = tvb_get_uint8(tvb, offset+1);
1882
11
                dissect_control_function_id(tvb, pinfo, tree, offset);
1883
11
                offset += info_element_length+2;
1884
11
            break;
1885
22
            case VARIANT:
1886
22
                info_element_length = tvb_get_uint8(tvb, offset+1);
1887
22
                dissect_variant(tvb, pinfo, tree, offset);
1888
22
                offset += info_element_length+2;
1889
22
            break;
1890
11
            case INTERFACE_ID:
1891
11
                info_element_length = tvb_get_uint8(tvb, offset+1);
1892
11
                dissect_interface_id(tvb, pinfo, tree, offset);
1893
11
                offset += info_element_length+2;
1894
11
            break;
1895
19
            case SEQUENCE_NUMBER:
1896
19
                info_element_length = tvb_get_uint8(tvb, offset+1);
1897
19
                dissect_sequence_number(tvb, pinfo, tree, offset);
1898
19
                offset += info_element_length+2;
1899
19
            break;
1900
8
            case C_CHANNEL_ID:
1901
8
                info_element_length = tvb_get_uint8(tvb, offset+1);
1902
8
                dissect_physical_c_channel_id(tvb, pinfo, tree, offset);
1903
8
                offset += info_element_length+2;
1904
8
            break;
1905
8
            case PP_REJECTION_CAUSE:
1906
8
                info_element_length = tvb_get_uint8(tvb, offset+1);
1907
8
                dissect_pp_rejection_cause(tvb, pinfo, tree, offset);
1908
8
                offset += info_element_length+2;
1909
8
            break;
1910
21
            case PROTOCOL_ERROR:
1911
21
                info_element_length = tvb_get_uint8(tvb, offset+1);
1912
21
                dissect_protocol_error(tvb, pinfo, tree, offset);
1913
21
                offset += info_element_length+2;
1914
21
            break;
1915
135
            case PERFORMANCE_GRADING:
1916
135
                dissect_performance_grading(tvb, pinfo, tree, offset);
1917
135
                singleoctet = 1;
1918
135
            break;
1919
370
            case CP_REJECTION_CAUSE:
1920
370
                dissect_cp_rejection_cause(tvb, pinfo, tree, offset);
1921
370
                singleoctet = 1;
1922
370
            break;
1923
24
            case USER_PORT_ID:
1924
24
                info_element_length = tvb_get_uint8(tvb, offset+1);
1925
24
                dissect_user_port_identification(tvb, pinfo, tree, offset);
1926
24
                offset += info_element_length+2;
1927
24
            break;
1928
11
            case ISDN_PORT_TS_ID:
1929
11
                info_element_length = tvb_get_uint8(tvb, offset+1);
1930
11
                dissect_isdn_port_time_slot_identification(tvb, pinfo, tree, offset);
1931
11
                offset += info_element_length+2;
1932
11
            break;
1933
51
            case V5_TIME_SLOT_ID:
1934
51
                info_element_length = tvb_get_uint8(tvb, offset+1);
1935
51
                dissect_v5_time_slot_identification(tvb, pinfo, tree, offset);
1936
51
                offset += info_element_length+2;
1937
51
            break;
1938
18
            case MULTI_SLOT_MAP:
1939
18
                info_element_length = tvb_get_uint8(tvb, offset+1);
1940
18
                dissect_multi_slot_map(tvb, pinfo, tree, offset);
1941
18
                offset += info_element_length+2;
1942
18
            break;
1943
33
            case BCC_REJECT_CAUSE:
1944
33
                info_element_length = tvb_get_uint8(tvb, offset+1);
1945
33
                dissect_bcc_rejct_cause(tvb, pinfo, tree, offset);
1946
33
                offset += info_element_length+2;
1947
33
            break;
1948
20
            case BCC_PROTOCOL_ERROR_CAUSE:
1949
20
                info_element_length = tvb_get_uint8(tvb, offset+1);
1950
20
                dissect_bcc_protocol_error_cause(tvb, pinfo, tree, offset);
1951
20
                offset += info_element_length+2;
1952
20
            break;
1953
25
            case CONNECTION_INCOMPLETE:
1954
25
                info_element_length = tvb_get_uint8(tvb, offset+1);
1955
25
                dissect_connection_incomplete(tvb, pinfo, tree, offset);
1956
25
                offset += info_element_length+2;
1957
25
            break;
1958
54
            case LINK_CONTROL_FUNCTION:
1959
54
                info_element_length = tvb_get_uint8(tvb, offset+1);
1960
54
                dissect_link_control_function(tvb, pinfo, tree, offset);
1961
54
                offset += info_element_length+2;
1962
54
            break;
1963
5.69k
            default:
1964
5.69k
                offset += 1;
1965
5.69k
            break;
1966
8.41k
        }
1967
8.34k
        if (singleoctet == 1) {
1968
1.57k
            offset += 1;
1969
1.57k
        }
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
8.34k
    }
1977
163
}
1978
1979
1980
static void
1981
dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1982
163
{
1983
163
    int         offset   = 0;
1984
163
    proto_tree *v52_tree = NULL;
1985
163
    bool        addr     = false;
1986
163
    uint8_t     bcc_all_address_tmp_up = -1;
1987
163
    uint16_t    pstn_all_address_tmp, isdn_all_address_tmp, bcc_all_address_tmp;
1988
163
    uint16_t    prot_all_address_tmp, link_all_address_tmp;
1989
1990
163
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "V52");
1991
1992
163
    if (tree) {
1993
163
        proto_item *ti;
1994
163
        ti = proto_tree_add_item(tree, proto_v52, tvb, offset, -1, ENC_NA);
1995
163
        v52_tree = proto_item_add_subtree(ti, ett_v52);
1996
1997
163
        dissect_v52_protocol_discriminator(tvb, offset, v52_tree);
1998
163
    }
1999
2000
2001
    /* if (v52_tree != NULL) */ {
2002
2003
163
        message_type_tmp = tvb_get_uint8(tvb, MSG_TYPE_OFFSET);
2004
2005
163
        if ((message_type_tmp >= 0x00) && (message_type_tmp <= 0x0e)) {
2006
21
            addr = true;
2007
21
            proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2008
21
            proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2009
2010
21
            pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2011
2012
2013
21
            col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2014
21
        }
2015
2016
163
        if ((message_type_tmp >= 0x10) && (message_type_tmp <= 0x13)) {
2017
34
            addr = true;
2018
34
            if ((tvb_get_uint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2019
11
                pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2020
11
                proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2021
11
                proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2022
2023
11
                col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2024
11
            }
2025
23
            else {
2026
23
                isdn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2027
23
                proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2028
23
                proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2029
2030
23
                col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2031
23
            }
2032
34
        }
2033
2034
163
        if ((message_type_tmp == 0x30) || (message_type_tmp == 0x31)) {
2035
8
            addr = true;
2036
8
            link_all_address_tmp = tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET);
2037
8
            proto_tree_add_item(v52_tree, hf_v52_link_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2038
8
            proto_tree_add_item(v52_tree, hf_v52_link_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2039
2040
8
            col_append_fstr(pinfo->cinfo, COL_INFO, " | LinkId: %u", link_all_address_tmp);
2041
8
        }
2042
2043
163
        if ((message_type_tmp >= 0x20) && (message_type_tmp <= 0x2a)) {
2044
2
            addr = true;
2045
2
            proto_tree_add_item(v52_tree, hf_v52_bcc_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2046
2
            proto_tree_add_item(v52_tree, hf_v52_bcc_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2047
2048
2
            bcc_all_address_tmp_up = tvb_get_uint8(tvb, ADDRESS_OFFSET);
2049
2
            if (bcc_all_address_tmp_up >= 128) {
2050
1
                bcc_all_address_tmp_up = bcc_all_address_tmp_up - 128;
2051
1
            }
2052
2
            bcc_all_address_tmp = (bcc_all_address_tmp_up<<6) + tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET);
2053
2054
2
            col_append_fstr(pinfo->cinfo, COL_INFO, " | ref: %u", bcc_all_address_tmp);
2055
2
        }
2056
2057
163
        if ((message_type_tmp >= 0x18) && (message_type_tmp <= 0x1f)) {
2058
9
            addr = true;
2059
9
            prot_all_address_tmp = (tvb_get_uint8(tvb, ADDRESS_OFFSET)<<8) + (tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET));
2060
9
            proto_tree_add_item(v52_tree, hf_v52_prot_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2061
9
            proto_tree_add_item(v52_tree, hf_v52_prot_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2062
2063
9
            if ((message_type_tmp == 0x1e) || (message_type_tmp == 0x1f)) {}
2064
9
            else {
2065
9
                col_append_fstr(pinfo->cinfo, COL_INFO, " | Log C-ch: %u", prot_all_address_tmp);
2066
9
            }
2067
9
        }
2068
2069
163
        if (addr == false) {
2070
89
            if ((tvb_get_uint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) {
2071
19
                pstn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)));
2072
19
                proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2073
19
                proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2074
2075
19
                col_append_fstr(pinfo->cinfo, COL_INFO, " | PSTN: %u", pstn_all_address_tmp);
2076
2077
19
            }
2078
70
            else {
2079
70
                isdn_all_address_tmp = (((tvb_get_uint8(tvb, ADDRESS_OFFSET)>>2)<<7)+((tvb_get_uint8(tvb, LOW_ADDRESS_OFFSET)>>1)));
2080
70
                proto_tree_add_item(v52_tree, hf_v52_isdn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2081
70
                proto_tree_add_item(v52_tree, hf_v52_isdn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
2082
2083
70
                col_append_fstr(pinfo->cinfo, COL_INFO, " | ISDN: %u", isdn_all_address_tmp);
2084
2085
70
            }
2086
89
        }
2087
2088
163
        proto_tree_add_item(v52_tree, hf_v52_msg_type, tvb, MSG_TYPE_OFFSET, MSG_TYPE_LENGTH, ENC_BIG_ENDIAN);
2089
2090
2091
163
        col_append_str(pinfo->cinfo, COL_INFO, " | ");
2092
163
        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
163
        dissect_v52_info(tvb, pinfo, v52_tree);
2095
163
    }
2096
163
}
2097
2098
static int
2099
dissect_v52(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2100
163
{
2101
163
    dissect_v52_message(tvb, pinfo, tree);
2102
163
    return tvb_captured_length(tvb);
2103
163
}
2104
2105
void
2106
proto_register_v52(void)
2107
14
{
2108
14
    static hf_register_info hf[] = {
2109
14
        { &hf_v52_discriminator,
2110
14
          { "Protocol discriminator", "v52.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2111
14
            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
14
        { &hf_v52_isdn_address,
2126
14
          { "Address isdn",    "v52.isdn_address",
2127
14
             FT_UINT8,    BASE_HEX, NULL,                               0xfc,
2128
14
             NULL, HFILL } },
2129
14
        { &hf_v52_isdn_low_address,
2130
14
          { "Address isdn Low",    "v52.isdn_low_address",
2131
14
             FT_UINT8,    BASE_HEX, NULL,                               0xfe,
2132
14
             NULL, HFILL } },
2133
/* PSTN */
2134
14
        { &hf_v52_pstn_address,
2135
14
          { "Address pstn",    "v52.pstn_address",
2136
14
          FT_UINT8,    BASE_HEX, NULL,                                  0xfe,
2137
14
          NULL, HFILL } },
2138
14
        { &hf_v52_pstn_low_address,
2139
14
          { "Address pstn Low",    "v52.pstn_low_address",
2140
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2141
14
          NULL, HFILL } },
2142
/* LINK */
2143
14
        { &hf_v52_link_address,
2144
14
          { "Address link",    "v52.link_address",
2145
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2146
14
          NULL, HFILL } },
2147
14
        { &hf_v52_link_low_address,
2148
14
          { "Address link Low",    "v52.link_low_address",
2149
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2150
14
          NULL, HFILL } },
2151
/* BCC */
2152
14
        { &hf_v52_bcc_address,
2153
14
          { "Address bcc",    "v52.bcc_address",
2154
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2155
14
          NULL, HFILL } },
2156
14
        { &hf_v52_bcc_low_address,
2157
14
          { "Address bcc Low",    "v52.bcc_low_address",
2158
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x3f,
2159
14
          NULL, HFILL } },
2160
/* PROTECTION */
2161
14
        { &hf_v52_prot_address,
2162
14
          { "Address prot",    "v52.prot_address",
2163
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2164
14
          NULL, HFILL } },
2165
14
        { &hf_v52_prot_low_address,
2166
14
          { "Address prot Low",    "v52.prot_low_address",
2167
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2168
14
          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
14
        {&hf_v52_msg_type,
2184
14
          { "Message type",   "v52.msg_type",
2185
14
          FT_UINT8,    BASE_HEX|BASE_EXT_STRING, &msg_type_values_ext,  0x0,
2186
14
          NULL, HFILL } },
2187
14
        {&hf_v52_info_element,
2188
14
          { "Information element",   "v52.info_element",
2189
14
          FT_UINT8,    BASE_HEX|BASE_EXT_STRING, &info_element_values_ext, 0x0,
2190
14
          NULL, HFILL } },
2191
14
        {&hf_v52_info_length,
2192
14
          { "Information length",   "v52.info_length",
2193
14
          FT_UINT8,    BASE_DEC, NULL,                                  0x0,
2194
14
          NULL, HFILL } },
2195
14
        {&hf_v52_pulse_notification,
2196
14
          { "Pulse notification",   "v52.pulse_notification",
2197
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2198
14
          NULL, HFILL } },
2199
14
        {&hf_v52_pstn_sequence_number,
2200
14
          { "Sequence number",    "v52.pstn_sequence_number",
2201
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2202
14
          NULL, HFILL } },
2203
14
        {&hf_v52_cadenced_ring,
2204
14
          { "Cadenced ring",    "v52.cadenced_ring",
2205
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2206
14
          NULL, HFILL } },
2207
14
        {&hf_v52_pulse_type,
2208
14
          { "Pulse Type",       "v52.pulse_type",
2209
14
          FT_UINT8,    BASE_HEX|BASE_EXT_STRING, &pulse_type_values_ext, 0x0,
2210
14
          NULL, HFILL } },
2211
14
        {&hf_v52_suppression_indicator,
2212
14
          { "Suppression indicator",  "v52.suppression_indicator",
2213
14
          FT_UINT8,    BASE_HEX, VALS(suppression_indication_values),   0x60,
2214
14
          NULL, HFILL } },
2215
14
        {&hf_v52_pulse_duration,
2216
14
          { "Pulse duration type",   "v52.pulse_duration",
2217
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x1f,
2218
14
          NULL, HFILL } },
2219
14
        {&hf_v52_ack_request_indicator,
2220
14
          { "Ack request indicator",    "v52.ack_request_indicator",
2221
14
          FT_UINT8,    BASE_HEX, VALS(ack_request_indication_values),   0x60,
2222
14
          NULL, HFILL } },
2223
14
        {&hf_v52_number_of_pulses,
2224
14
          { "Number of pulses",      "v52.number_of_pulses",
2225
14
          FT_UINT8,    BASE_DEC, NULL,                                  0x1f,
2226
14
          NULL, HFILL } },
2227
14
        {&hf_v52_steady_signal,
2228
14
          { "Steady Signal",         "v52.steady_signal",
2229
14
          FT_UINT8,    BASE_HEX|BASE_EXT_STRING, &steady_signal_values_ext, 0x7f,
2230
14
          NULL, HFILL } },
2231
14
        {&hf_v52_digit_ack,
2232
14
          { "Digit ack request indication", "v52.digit_ack",
2233
14
          FT_BOOLEAN,    8, TFS(&tfs_digit_ack_values),                 0x40,
2234
14
          NULL, HFILL } },
2235
14
        {&hf_v52_digit_spare,
2236
14
          { "Digit spare", "v52.digit_spare",
2237
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x30,
2238
14
          NULL, HFILL } },
2239
14
        {&hf_v52_digit_info,
2240
14
          { "Digit information",    "v52.digit_info",
2241
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2242
14
          NULL, HFILL } },
2243
14
        {&hf_v52_duration_type,
2244
14
          { "Duration Type",    "v52.duration_type",
2245
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x3f,
2246
14
          NULL, HFILL } },
2247
14
        {&hf_v52_res_unavailable,
2248
14
          { "Resource unavailable", "v52.res_unavailable",
2249
14
          FT_STRING,   BASE_NONE, NULL,                                  0x0,
2250
14
          NULL, HFILL } },
2251
14
        {&hf_v52_line_info,
2252
14
          { "Line_Information",      "v52.line_info",
2253
14
          FT_UINT8,    BASE_HEX, VALS(line_info_values),                0x0f,
2254
14
          NULL, HFILL } },
2255
14
        {&hf_v52_state,
2256
14
          { "PSTN FSM state",       "v52.state",
2257
14
          FT_UINT8,    BASE_HEX, VALS(state_values),                    0x0f,
2258
14
          NULL, HFILL } },
2259
14
        {&hf_v52_auto_signalling_sequence,
2260
14
          { "Autonomous signalling sequence", "v52.auto_signalling_sequence",
2261
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2262
14
          NULL, HFILL } },
2263
14
        {&hf_v52_sequence_response,
2264
14
          { "Sequence response",    "v52.sequence_response",
2265
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0f,
2266
14
          NULL, HFILL } },
2267
14
        {&hf_v52_control_function_element,
2268
14
          { "Control function element",    "v52.control_function_element",
2269
14
          FT_UINT8,    BASE_HEX, VALS(control_function_element_values), 0x7f,
2270
14
          NULL, HFILL } },
2271
14
        {&hf_v52_control_function_id,
2272
14
          { "Control function ID",    "v52.control_function",
2273
14
          FT_UINT8,    BASE_HEX|BASE_EXT_STRING, &control_function_id_values_ext, 0x7f,
2274
14
          NULL, HFILL } },
2275
14
        {&hf_v52_variant,
2276
14
          { "Variant",    "v52.variant",
2277
14
          FT_UINT8,    BASE_DEC, NULL,                                  0x7f,
2278
14
          NULL, HFILL } },
2279
14
        {&hf_v52_if_up_id,
2280
14
          { "Interface up ID",    "v52.interface_up_id",
2281
14
          FT_UINT8,   BASE_HEX, NULL,                                   0x0,
2282
14
          NULL, HFILL } },
2283
14
        {&hf_v52_if_id,
2284
14
          { "Interface ID",    "v52.interface_id",
2285
14
          FT_UINT8,   BASE_HEX, NULL,                                   0x0,
2286
14
          NULL, HFILL } },
2287
14
        {&hf_v52_if_low_id,
2288
14
          { "Interface down ID",    "v52.interface_low_id",
2289
14
          FT_UINT8,   BASE_HEX, NULL,                                   0x0,
2290
14
          NULL, HFILL } },
2291
14
        {&hf_v52_if_all_id,
2292
14
          { "Interface all ID",    "v52.interface_all_id",
2293
14
          FT_UINT24,   BASE_DEC, NULL,                                  0x0,
2294
14
          NULL, HFILL } },
2295
14
        {&hf_v52_sequence_number,
2296
14
          { "Sequence number",    "v52.sequence_number",
2297
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2298
14
          NULL, HFILL } },
2299
14
        {&hf_v52_v5_link_id,
2300
14
          { "V5 2048 kbit/s Link Identifier",    "v52.V5_ln_id",
2301
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2302
14
                   NULL, HFILL } },
2303
14
        {&hf_v52_v5_multi_slot_elements,
2304
14
          { "Additional MS ID",    "v52.add_ms_id",
2305
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2306
14
          NULL, HFILL } },
2307
14
        {&hf_v52_v5_time_slot,
2308
14
          { "V5 Time Slot Number",    "v52.v5_time_slot",
2309
14
          FT_UINT8,    BASE_DEC, NULL,                                  0x1f,
2310
14
          NULL, HFILL } },
2311
14
        {&hf_v52_rejection_cause,
2312
14
          { "Rejection cause",    "v52.rejection_cause",
2313
14
          FT_UINT8,    BASE_HEX, VALS(rejection_cause_values),          0x7f,
2314
14
          NULL, HFILL } },
2315
14
        {&hf_v52_error_cause,
2316
14
          { "Protocol Error Cause type",    "v52.error_cause",
2317
14
          FT_UINT8,    BASE_HEX, VALS(error_cause_values),              0x7f,
2318
14
          NULL, HFILL } },
2319
14
        {&hf_v52_diagnostic_msg,
2320
14
          { "Diagnostic message",    "v52.diagnostic_message",
2321
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2322
14
          NULL, HFILL } },
2323
14
        {&hf_v52_diagnostic_element,
2324
14
          { "Diagnostic element",    "v52.diagnostic_element",
2325
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2326
14
          NULL, HFILL } },
2327
14
        {&hf_v52_performance_grading,
2328
14
          { "Performance grading",    "v52.performance_grading",
2329
14
          FT_UINT8,    BASE_HEX, VALS(performance_grading_values),      0x0f,
2330
14
          NULL, HFILL } },
2331
14
        {&hf_v52_cp_rejection_cause,
2332
14
          { "Rejection cp cause",    "v52.cp_rejection_cause",
2333
14
          FT_UINT8,    BASE_HEX, VALS(cp_rejection_cause_values),       0x0f,
2334
14
          NULL, HFILL } },
2335
14
        {&hf_v52_pstn_user_port_id,
2336
14
          { "PSTN User Port identification Value", "v52.pstn_user_port_id",
2337
14
            FT_UINT8,    BASE_HEX, NULL,                                0xfe,
2338
14
            NULL, HFILL } },
2339
14
        {&hf_v52_pstn_user_port_id_lower,
2340
14
          { "PSTN User Port Identification Value (lower)", "v52.pstn_user_port_id_lower",
2341
14
            FT_UINT8,    BASE_HEX, NULL,                                0x0,
2342
14
            NULL, HFILL } },
2343
14
        {&hf_v52_isdn_user_port_id,
2344
14
          { "ISDN User Port Identification Value", "v52.isdn_user_port_id",
2345
14
          FT_UINT8,    BASE_HEX, NULL,                                  0xfc,
2346
14
          NULL, HFILL } },
2347
14
        {&hf_v52_isdn_user_port_id_lower,
2348
14
          { "ISDN User Port Identification Value (lower)", "v52.user_port_id_lower",
2349
14
          FT_UINT8,    BASE_HEX, NULL,                                  0xfe,
2350
14
          NULL, HFILL } },
2351
14
        {&hf_v52_isdn_user_port_ts_num,
2352
14
          { "ISDN user port time slot number", "v52.isdn_user_port_ts_num",
2353
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x1f,
2354
14
          NULL, HFILL } },
2355
14
        {&hf_v52_override,
2356
14
          { "Override",    "v52.override",
2357
14
          FT_BOOLEAN,  8,        NULL,                                  0x20,
2358
14
          NULL, HFILL } },
2359
14
        {&hf_v52_reject_cause_type,
2360
14
          { "Reject cause type",    "v52.reject_cause_type",
2361
14
          FT_UINT8,    BASE_HEX, VALS(reject_cause_type_values),        0x7f,
2362
14
          NULL, HFILL } },
2363
14
        {&hf_v52_bcc_protocol_error_cause,
2364
14
          { "Protocol error cause type",    "v52.bcc_protocol_cause",
2365
14
          FT_UINT8,    BASE_HEX, VALS(bcc_protocol_error_cause_type_values), 0x7f,
2366
14
          NULL, HFILL } },
2367
14
        {&hf_v52_diagnostic_message,
2368
14
          { "Diagnostic message",    "v52.diagnostic_message",
2369
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x7f,
2370
14
          NULL, HFILL } },
2371
14
        {&hf_v52_diagnostic_information,
2372
14
          { "Diagnostic information",    "v52.diagnostic_information",
2373
14
          FT_UINT8,    BASE_HEX, NULL,                                  0x0,
2374
14
          NULL, HFILL } },
2375
14
        {&hf_v52_connection_incomplete_reason,
2376
14
          { "Reason",    "v52.connection_incomplete_reason",
2377
14
          FT_UINT8,    BASE_HEX, VALS(connection_incomplete_reason_values), 0x0,
2378
14
          NULL, HFILL } },
2379
14
        {&hf_v52_link_control_function,
2380
14
          { "Link control function", "v52.link_control_function",
2381
14
          FT_UINT8,    BASE_HEX, VALS(link_control_function_values), 0x7f,
2382
14
          NULL, HFILL } },
2383
14
        {&hf_v52_cause_type,
2384
14
          { "Cause type",           "v52.cause_type",
2385
14
          FT_UINT8,    BASE_HEX, VALS(cause_type_values),       0x7f,
2386
14
          NULL, HFILL } }
2387
14
    };
2388
14
    static int *ett[] = {
2389
14
        &ett_v52,
2390
14
        &ett_v52_info,
2391
14
    };
2392
2393
14
    proto_v52 = proto_register_protocol("V5.2", "V5.2", "v52");
2394
14
    proto_register_field_array (proto_v52, hf, array_length(hf));
2395
14
    proto_register_subtree_array(ett, array_length(ett));
2396
2397
14
    register_dissector("v52", dissect_v52, proto_v52);
2398
14
}
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
 */