Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-v150fw.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-v150fw.c
2
 *
3
 * v150fw = v.150.1 SSE messages, contained in RTP packets
4
 *
5
 * Written by Jamison Adcock <jamison.adcock@cobham.com>
6
 * for Sparta Inc., dba Cobham Analytic Solutions
7
 * This code is largely based on the RTP parsing code
8
 *
9
 * Wireshark - Network traffic analyzer
10
 * By Gerald Combs <gerald@wireshark.org>
11
 * Copyright 1998 Gerald Combs
12
 *
13
 * SPDX-License-Identifier: GPL-2.0-or-later
14
 */
15
16
17
#include "config.h"
18
19
#include <epan/packet.h>
20
#include <epan/tfs.h>
21
#include <wsutil/array.h>
22
23
void proto_register_v150fw(void);
24
25
/* Initialize the protocol & registered fields
26
 * Look familiar?  This is in the same format as an NTE (named telephone event) from RFC 2833:
27
 */
28
static int proto_v150fw;
29
30
static int hf_v150fw_event_id; /* 6 bits */
31
static int hf_v150fw_force_response_bit;
32
static int hf_v150fw_extension_bit;
33
34
static int hf_v150fw_reason_id_code; /* value & string */
35
36
static int hf_v150fw_reason_id_code_info; /* 16 bits */
37
38
static int hf_v150fw_ric_info_mod_avail; /* ric = 1,2 */
39
static int hf_v150fw_cm_jm_mod_avail_pcm_mode;
40
static int hf_v150fw_cm_jm_mod_avail_v34_duplex;
41
static int hf_v150fw_cm_jm_mod_avail_v34_half_duplex;
42
static int hf_v150fw_cm_jm_mod_avail_v32_v32bis;
43
static int hf_v150fw_cm_jm_mod_avail_v22_v22bis;
44
static int hf_v150fw_cm_jm_mod_avail_v17;
45
static int hf_v150fw_cm_jm_mod_avail_v29_half_duplex;
46
static int hf_v150fw_cm_jm_mod_avail_v27ter;
47
static int hf_v150fw_cm_jm_mod_avail_v26ter;
48
static int hf_v150fw_cm_jm_mod_avail_v26bis;
49
static int hf_v150fw_cm_jm_mod_avail_v23_duplex;
50
static int hf_v150fw_cm_jm_mod_avail_v23_half_duplex;
51
static int hf_v150fw_cm_jm_mod_avail_v21;
52
static int hf_v150fw_cm_jm_mod_avail_v90_or_v92_analog;
53
static int hf_v150fw_cm_jm_mod_avail_v90_or_v92_digital;
54
static int hf_v150fw_cm_jm_mod_avail_v91;
55
56
static int hf_v150fw_ric_info_timeout; /* ric= 18 */
57
static int hf_v150fw_ric_info_timeout_vendor;
58
59
static int hf_v150fw_ric_info_cleardown; /* ric = 20 */
60
static int hf_v150fw_ric_info_cleardown_reserved;
61
static int hf_v150fw_ric_info_cleardown_vendor_tag; /* extension fields */
62
static int hf_v150fw_ric_info_cleardown_vendor_info;
63
64
static int hf_v150fw_reserved; /* 5 bits */
65
static int hf_v150fw_extension_len; /* 11 bits */
66
static int hf_v150fw_remainder;
67
68
/* initialize the subtree pointers */
69
static int ett_v150fw;
70
static int ett_available_modulations;
71
72
/* for some "range_string"s, there's only one value in the range  */
73
#define V150FW_VALUE_RANGE(a) a,a
74
75
76
/* V.150.1 State Signalling Events (SSE): */
77
#define V150FW_EVENT_RESERVED1          0
78
#define V150FW_EVENT_INITIAL_AUDIO      1
79
#define V150FW_EVENT_VOICEBAND_DATA     2
80
#define V150FW_EVENT_MODEM_RELAY        3
81
#define V150FW_EVENT_FAX_RELAY          4
82
#define V150FW_EVENT_TEXT_RELAY         5
83
#define V150FW_EVENT_TEXT_PROBE         6 /* new in ITU-T Rec. V.150.1 (2003)/Amd.2 (05/2006) */
84
/* 7 - 31 reserved for future use */
85
#define V150FW_EVENT_RESERVED2_START    7
86
#define V150FW_EVENT_RESERVED2_END      31
87
/* 32 - 63 vendor-defined */
88
#define V150FW_EVENT_VENDOR_START       32
89
#define V150FW_EVENT_VENDOR_END         63
90
91
92
/* V.150.1 SSE reason ID codes: */
93
#define V150FW_RIC_NULL                     0
94
0
#define V150FW_RIC_CM                       1
95
0
#define V150FW_RIC_JM                       2
96
#define V150FW_RIC_AA                       3
97
#define V150FW_RIC_AC                       4
98
#define V150FW_RIC_USB1                     5
99
#define V150FW_RIC_SB1                      6
100
#define V150FW_RIC_S1                       7
101
#define V150FW_RIC_V21_CH2                  8
102
#define V150FW_RIC_V21_CH1                  9
103
#define V150FW_RIC_V23_HIGH_CHANNEL         10
104
#define V150FW_RIC_V23_LOW_CHANNEL          11
105
#define V150FW_RIC_TONE_2225_HZ             12
106
#define V150FW_RIC_V21_CH2_HDLC_FLAGS       13
107
#define V150FW_RIC_INDETERMINATE_SIGNAL     14
108
#define V150FW_RIC_SILENCE                  15
109
#define V150FW_RIC_CNG                      16
110
#define V150FW_RIC_VOICE                    17
111
0
#define V150FW_RIC_TIMEOUT                  18
112
#define V150FW_RIC_P_STATE_TRANS            19
113
0
#define V150FW_RIC_CLEARDOWN                20
114
#define V150FW_RIC_ANS_CED_2100_HZ          21
115
#define V150FW_RIC_ANSAM                    22
116
#define V150FW_RIC_SLASH_ANS                23
117
#define V150FW_RIC_SLASH_ANSAM              24
118
#define V150FW_RIC_QC1A                     25
119
#define V150FW_RIC_QC1D                     26
120
#define V150FW_RIC_QC2A                     27
121
#define V150FW_RIC_QC2D                     28
122
#define V150FW_RIC_CRE                      29
123
#define V150FW_RIC_CRD                      30
124
/* new from ITU-T V.150.1 Amendment 1: */
125
#define V150FW_RIC_TIA_825A_45              31
126
#define V150FW_RIC_TIA_825A_50              32
127
#define V150FW_RIC_EDT                      33
128
#define V150FW_RIC_BELL_103_MODEM           34
129
#define V150FW_RIC_V21_TEXT_PHONE_T50       35
130
#define V150FW_RIC_V23_TEXT_MINITEL         36
131
#define V150FW_RIC_V18_TEXT_PHONE_T140      37
132
#define V150FW_RIC_DTMF_BASED_TEXT_RELAY    38
133
#define V150FW_RIC_CTM                      39
134
/* 40 - 127 reserved */
135
#define V150FW_RIC_RESERVED_START           40
136
#define V150FW_RIC_RESERVED_END             127
137
/* 128 - 255 for vendor use */
138
#define V150FW_RIC_VENDOR_START             128
139
#define V150FW_RIC_VENDOR_END               255
140
141
142
/* Timeout (V150FW_RIC_TIMEOUT) reason info: */
143
#define V150FW_RIC_INFO_TIMEOUT_NULL                            0
144
#define V150FW_RIC_INFO_TIMEOUT_CALL_DISCRIMINATION_TIMEOUT     1
145
#define V150FW_RIC_INFO_TIMEOUT_IP_TLP_TIMEOUT                  2
146
#define V150FW_RIC_INFO_TIMEOUT_SSE_EXPLICIT_ACK_TIMEOUT        3
147
148
149
/* Cleardown (V150FW_RIC_CLEARDOWN) reason info: */
150
#define V150FW_RIC_INFO_CLEARDOWN_UNKNOWN                       0
151
#define V150FW_RIC_INFO_CLEARDOWN_PHYSICAL_LAYER_RELEASE        1
152
#define V150FW_RIC_INFO_CLEARDOWN_LINK_LAYER_DISCONNECT         2
153
#define V150FW_RIC_INFO_CLEARDOWN_DATA_COMPRESSION_DISCONNECT   3
154
#define V150FW_RIC_INFO_CLEARDOWN_ABORT                         4
155
#define V150FW_RIC_INFO_CLEARDOWN_ON_HOOK                       5
156
#define V150FW_RIC_INFO_CLEARDOWN_NETWORK_LAYER_TERMINATION     6
157
#define V150FW_RIC_INFO_CLEARDOWN_ADMINISTRATIVE                7
158
159
/* value strings & range strings */
160
static const range_string v150fw_event_id_name[] = {
161
    { V150FW_VALUE_RANGE(V150FW_EVENT_RESERVED1),               "Event ID reserved" },
162
    { V150FW_VALUE_RANGE(V150FW_EVENT_INITIAL_AUDIO),           "Initial audio" },
163
    { V150FW_VALUE_RANGE(V150FW_EVENT_VOICEBAND_DATA),          "Voice band data" },
164
    { V150FW_VALUE_RANGE(V150FW_EVENT_MODEM_RELAY),             "Modem relay" },
165
    { V150FW_VALUE_RANGE(V150FW_EVENT_FAX_RELAY),               "Fax relay" },
166
    { V150FW_VALUE_RANGE(V150FW_EVENT_TEXT_RELAY),              "Text relay" },
167
    { V150FW_VALUE_RANGE(V150FW_EVENT_TEXT_PROBE),              "Text probe" },
168
    { V150FW_EVENT_RESERVED2_START, V150FW_EVENT_RESERVED2_END, "Reserved for ITU_T" },
169
    { V150FW_EVENT_VENDOR_START, V150FW_EVENT_VENDOR_END,       "Vendor-defined event" },
170
    { 0, 0, NULL }
171
};
172
173
static const range_string v150fw_ric_name[] = {
174
    { V150FW_VALUE_RANGE(V150FW_RIC_NULL),                  "None" },
175
    { V150FW_VALUE_RANGE(V150FW_RIC_CM),                    "CM" },
176
    { V150FW_VALUE_RANGE(V150FW_RIC_JM),                    "JM" },
177
    { V150FW_VALUE_RANGE(V150FW_RIC_AA),                    "AA" },
178
    { V150FW_VALUE_RANGE(V150FW_RIC_AC),                    "AC" },
179
    { V150FW_VALUE_RANGE(V150FW_RIC_USB1),                  "USB1" },
180
    { V150FW_VALUE_RANGE(V150FW_RIC_SB1),                   "SB1" },
181
    { V150FW_VALUE_RANGE(V150FW_RIC_S1),                    "S1" },
182
    { V150FW_VALUE_RANGE(V150FW_RIC_V21_CH2),               "V.21 Ch2" },
183
    { V150FW_VALUE_RANGE(V150FW_RIC_V21_CH1),               "V.21 Ch1" },
184
    { V150FW_VALUE_RANGE(V150FW_RIC_V23_HIGH_CHANNEL),      "V.23 High Channel" },
185
    { V150FW_VALUE_RANGE(V150FW_RIC_V23_LOW_CHANNEL),       "V.23 Low Channel" },
186
    { V150FW_VALUE_RANGE(V150FW_RIC_TONE_2225_HZ),          "Tone (2225 Hz)" },
187
    { V150FW_VALUE_RANGE(V150FW_RIC_V21_CH2_HDLC_FLAGS),    "V.21 Ch2 HDLC Flags" },
188
    { V150FW_VALUE_RANGE(V150FW_RIC_INDETERMINATE_SIGNAL),  "Indeterminate signal" },
189
    { V150FW_VALUE_RANGE(V150FW_RIC_SILENCE),               "Silence" },
190
    { V150FW_VALUE_RANGE(V150FW_RIC_CNG),                   "CNG" },
191
    { V150FW_VALUE_RANGE(V150FW_RIC_VOICE),                 "Voice" },
192
    { V150FW_VALUE_RANGE(V150FW_RIC_TIMEOUT),               "Timeout" },
193
    { V150FW_VALUE_RANGE(V150FW_RIC_P_STATE_TRANS),         "p' State Transition" },
194
    { V150FW_VALUE_RANGE(V150FW_RIC_CLEARDOWN),             "Cleardown" },
195
    { V150FW_VALUE_RANGE(V150FW_RIC_ANS_CED_2100_HZ),       "ANS/CED (2100Hz)" },
196
    { V150FW_VALUE_RANGE(V150FW_RIC_ANSAM),                 "ANSam" },
197
    { V150FW_VALUE_RANGE(V150FW_RIC_SLASH_ANS),             "/ANS" },
198
    { V150FW_VALUE_RANGE(V150FW_RIC_SLASH_ANSAM),           "/ANSam" },
199
    { V150FW_VALUE_RANGE(V150FW_RIC_QC1A),                  "QC1a" },
200
    { V150FW_VALUE_RANGE(V150FW_RIC_QC1D),                  "QC1d" },
201
    { V150FW_VALUE_RANGE(V150FW_RIC_QC2A),                  "QC2a" },
202
    { V150FW_VALUE_RANGE(V150FW_RIC_QC2D),                  "QC2d" },
203
    { V150FW_VALUE_RANGE(V150FW_RIC_CRE),                   "Cre" },
204
    { V150FW_VALUE_RANGE(V150FW_RIC_CRD),                   "CRd" },
205
    { V150FW_VALUE_RANGE(V150FW_RIC_TIA_825A_45),           "TIA-825A (45.45 bit/s)" },
206
    { V150FW_VALUE_RANGE(V150FW_RIC_TIA_825A_50),           "TIA-825A (50 bit/s)" },
207
    { V150FW_VALUE_RANGE(V150FW_RIC_EDT),                   "EDT (European Deaf Telephone)" },
208
    { V150FW_VALUE_RANGE(V150FW_RIC_BELL_103_MODEM),        "Bell 103 Modem" },
209
    { V150FW_VALUE_RANGE(V150FW_RIC_V21_TEXT_PHONE_T50),    "V.21 text telephone, T-50 encoding" },
210
    { V150FW_VALUE_RANGE(V150FW_RIC_V23_TEXT_MINITEL),      "V.23 text (Minitel)" },
211
    { V150FW_VALUE_RANGE(V150FW_RIC_V18_TEXT_PHONE_T140),   "V.18 text telephone, T-140 encoding" },
212
    { V150FW_VALUE_RANGE(V150FW_RIC_DTMF_BASED_TEXT_RELAY), "DTMF based Text Relay (Annex B/V.18)" },
213
    { V150FW_VALUE_RANGE(V150FW_RIC_CTM),                   "CTM" },
214
    { V150FW_RIC_RESERVED_START, V150FW_RIC_RESERVED_END,   "Reserved for use by ITU-T" },
215
    { V150FW_RIC_VENDOR_START, V150FW_RIC_VENDOR_END,       "For use by vendor" },
216
    { 0, 0, NULL }
217
};
218
219
static const value_string v150fw_ric_info_timeout_type[] = {
220
    { V150FW_RIC_INFO_TIMEOUT_NULL,                         "Null" },
221
    { V150FW_RIC_INFO_TIMEOUT_CALL_DISCRIMINATION_TIMEOUT,  "Call discrimination timeout" },
222
    { V150FW_RIC_INFO_TIMEOUT_IP_TLP_TIMEOUT,               "IP TLP timeout" },
223
    { V150FW_RIC_INFO_TIMEOUT_SSE_EXPLICIT_ACK_TIMEOUT,     "Explicit acknowledgement timeout" },
224
    { 0, NULL }
225
};
226
227
static const value_string v150fw_ric_info_cleardown_type[] = {
228
    { V150FW_RIC_INFO_CLEARDOWN_UNKNOWN,                     "Unknown/unspecified" },
229
    { V150FW_RIC_INFO_CLEARDOWN_PHYSICAL_LAYER_RELEASE,      "Physical layer release" },
230
    { V150FW_RIC_INFO_CLEARDOWN_LINK_LAYER_DISCONNECT,       "Link layer disconnect" },
231
    { V150FW_RIC_INFO_CLEARDOWN_DATA_COMPRESSION_DISCONNECT, "Data compression disconnect" },
232
    { V150FW_RIC_INFO_CLEARDOWN_ABORT,                       "Abort" },
233
    { V150FW_RIC_INFO_CLEARDOWN_ON_HOOK,                     "On hook" },
234
    { V150FW_RIC_INFO_CLEARDOWN_NETWORK_LAYER_TERMINATION,   "Network layer termination" },
235
    { V150FW_RIC_INFO_CLEARDOWN_ADMINISTRATIVE,              "Administrative" },
236
    { 0, NULL }
237
};
238
239
240
#if 0 /* XXX: The following doesn't actually dissect anything. Is dissect_v150fw() supposed to be called ? */
241
static bool
242
dissect_v150fw_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_)
243
{
244
    uint8_t octet1;
245
    uint8_t extb, ric;
246
    uint16_t ric_info;
247
    int payload_length = tvb_captured_length(tvb);
248
    unsigned int offset = 0;
249
250
    /* see appendix C (State Signalling Events) in ITU-T Rec. V.150.1 for details */
251
252
    /* Get the fields */
253
    octet1 = tvb_get_uint8(tvb, offset);
254
    extb = octet1 & 0x01;
255
    ric = tvb_get_uint8(tvb, offset + 1) & 0xFF;
256
257
    ric_info = tvb_get_ntohs(tvb, offset + 2);
258
259
    /* minimum lengths */
260
    if(!extb && payload_length <= 4) /* extb is not set, so minimum length is 4 bytes */
261
        return false;
262
    if(extb && payload_length <= 6) /* ext bit is set, but no extension found? */
263
        return false;
264
265
    if(ric == 0 || (ric >= 6 && ric <= 31)) /* values reserved for future use */
266
        return false;
267
268
    switch(ric)
269
    {
270
        case 0:
271
            if(ric_info != 0) /* ric_info must be NULL if ric is NULL */
272
                return false;
273
        case V150FW_RIC_CM:
274
        case V150FW_RIC_JM:
275
            if(!extb && payload_length > 4) /* payload too long */
276
                return false;
277
            break;
278
        case V150FW_RIC_TIMEOUT:
279
        case V150FW_RIC_CLEARDOWN:
280
            break;
281
        default:
282
            if(ric < 31 && ric_info != 0) /* ric_info is zero unless ric is CM, JM, TIMEOUT ro CLEARDOWN */
283
                return false;
284
            if(ric >= 31 && ric <= 127) /* 31 - 127 are reserved for future use */
285
                return false;
286
            /* 128 - 255 are vendor-specific */
287
            break;
288
    }
289
290
    return true;
291
}
292
#endif
293
294
static int
295
dissect_v150fw(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
296
0
{
297
    /* Set up structures needed to add the protocol subtree and manage it */
298
0
    proto_item *ti;
299
0
    proto_tree *v150fw_tree, *field_tree;
300
0
    uint8_t extb, ric;
301
0
    int payload_length;
302
0
    unsigned int offset = 0;
303
304
0
    if(tree)
305
0
    {
306
        /* create the trees */
307
0
        ti = proto_tree_add_item(tree, proto_v150fw, tvb, 0, -1, ENC_NA);
308
0
        v150fw_tree = proto_item_add_subtree(ti, ett_v150fw);
309
310
0
        payload_length = tvb_reported_length(tvb);
311
312
        /* Get fields needed for further dissection */
313
0
        extb = tvb_get_uint8(tvb, offset) & 0x01; /* extension bit */
314
0
        ric = tvb_get_uint8(tvb, offset + 1);
315
316
0
        proto_tree_add_item(v150fw_tree, hf_v150fw_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
317
0
        proto_tree_add_item(v150fw_tree, hf_v150fw_force_response_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
318
0
        proto_tree_add_item(v150fw_tree, hf_v150fw_extension_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
319
0
        offset++;
320
321
0
        proto_tree_add_item(v150fw_tree, hf_v150fw_reason_id_code, tvb, offset, 1, ENC_BIG_ENDIAN);
322
0
        offset++;
323
324
        /* reason identifier code information */
325
0
        switch(ric)
326
0
        {
327
0
        case V150FW_RIC_CM:
328
0
        case V150FW_RIC_JM:
329
0
            ti = proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_mod_avail, tvb, offset, 2, ENC_BIG_ENDIAN);
330
0
            field_tree = proto_item_add_subtree(ti, ett_available_modulations);
331
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_pcm_mode,           tvb, offset, 2, ENC_BIG_ENDIAN);
332
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v34_duplex,         tvb, offset, 2, ENC_BIG_ENDIAN);
333
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v34_half_duplex,    tvb, offset, 2, ENC_BIG_ENDIAN);
334
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v32_v32bis,         tvb, offset, 2, ENC_BIG_ENDIAN);
335
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v22_v22bis,         tvb, offset, 2, ENC_BIG_ENDIAN);
336
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v17,                tvb, offset, 2, ENC_BIG_ENDIAN);
337
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v29_half_duplex,    tvb, offset, 2, ENC_BIG_ENDIAN);
338
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v27ter,             tvb, offset, 2, ENC_BIG_ENDIAN);
339
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v26ter,             tvb, offset, 2, ENC_BIG_ENDIAN);
340
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v26bis,             tvb, offset, 2, ENC_BIG_ENDIAN);
341
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v23_duplex,         tvb, offset, 2, ENC_BIG_ENDIAN);
342
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v23_half_duplex,    tvb, offset, 2, ENC_BIG_ENDIAN);
343
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v21,                tvb, offset, 2, ENC_BIG_ENDIAN);
344
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v90_or_v92_analog,  tvb, offset, 2, ENC_BIG_ENDIAN);
345
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v90_or_v92_digital, tvb, offset, 2, ENC_BIG_ENDIAN);
346
0
            proto_tree_add_item(field_tree, hf_v150fw_cm_jm_mod_avail_v91,                tvb, offset, 2, ENC_BIG_ENDIAN);
347
0
            break;
348
0
        case V150FW_RIC_TIMEOUT:
349
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_timeout,                  tvb, offset,     1, ENC_BIG_ENDIAN);
350
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_timeout_vendor,           tvb, offset + 1, 1, ENC_BIG_ENDIAN);
351
0
            break;
352
0
        case V150FW_RIC_CLEARDOWN:
353
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_cleardown,                tvb, offset,     1, ENC_BIG_ENDIAN);
354
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_cleardown_reserved,       tvb, offset + 1, 1, ENC_BIG_ENDIAN);
355
0
            break;
356
0
        default:
357
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_reason_id_code_info,               tvb, offset,     2, ENC_BIG_ENDIAN);
358
0
            break;
359
0
        } /* switch(ric) */
360
0
        offset += 2;
361
362
0
        if(extb && payload_length >= 6) /* display optional extension fields */
363
0
        {
364
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
365
            /* TODO ext field len doesn't match actual len (ext_len != (payload_length - 6)),
366
             * that isn't illegal, but is perhaps worth noting */
367
0
            proto_tree_add_item(v150fw_tree, hf_v150fw_extension_len, tvb, offset, 2, ENC_BIG_ENDIAN);
368
0
            offset += 2;
369
370
            /* display optional extension fields */
371
0
            switch(ric) {
372
0
            case V150FW_RIC_CLEARDOWN: /* show vendor tag & vendor-specific info */
373
0
                proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_cleardown_vendor_tag,  tvb, offset, 1, ENC_BIG_ENDIAN);
374
0
                proto_tree_add_item(v150fw_tree, hf_v150fw_ric_info_cleardown_vendor_info, tvb, offset+1, 1, ENC_BIG_ENDIAN);
375
0
                break;
376
0
            default:
377
                /* just dump the bytes for now */
378
0
                proto_tree_add_item(v150fw_tree, hf_v150fw_remainder, tvb, offset, (payload_length - 6), ENC_NA);
379
0
                break;
380
0
            }
381
0
        }
382
0
    }
383
384
0
    return tvb_captured_length(tvb);
385
0
}
386
387
void
388
proto_register_v150fw(void)
389
14
{
390
    /* set up header fields */
391
14
    static hf_register_info hf[] =
392
14
    {
393
14
        {
394
14
            &hf_v150fw_event_id,
395
14
            {
396
14
                "Event ID",
397
14
                "v150fw.event",
398
14
                FT_UINT8,
399
14
                BASE_DEC | BASE_RANGE_STRING,
400
14
                RVALS(v150fw_event_id_name),
401
14
                0xFC,
402
14
                NULL, HFILL
403
14
            }
404
14
        },
405
14
        {
406
14
            &hf_v150fw_force_response_bit,
407
14
            {
408
14
                "Force response",
409
14
                "v150fw.frb",
410
14
                FT_BOOLEAN,
411
14
                8,
412
14
                TFS(&tfs_yes_no),
413
14
                0x02,
414
14
                NULL, HFILL
415
14
            }
416
14
        },
417
14
        {
418
14
            &hf_v150fw_extension_bit,
419
14
            {
420
14
                "Payload extension",
421
14
                "v150fw.extb",
422
14
                FT_BOOLEAN,
423
14
                8,
424
14
                TFS(&tfs_present_absent),
425
14
                0x01,
426
14
                NULL, HFILL
427
14
            }
428
14
        },
429
14
        {
430
14
            &hf_v150fw_reason_id_code, /* ric value + string */
431
14
            {
432
14
                "Reason ID",
433
14
                "v150fw.ric",
434
14
                FT_UINT8,
435
14
                BASE_DEC | BASE_RANGE_STRING,
436
14
                RVALS(v150fw_ric_name),
437
14
                0x0,
438
14
                NULL, HFILL
439
14
            }
440
14
        },
441
14
        {
442
14
            &hf_v150fw_reason_id_code_info,
443
14
            {
444
14
                "Info",
445
14
                "v150fw.ricinfo",
446
14
                FT_UINT16,
447
14
                BASE_HEX,
448
14
                NULL,
449
14
                0x0,
450
14
                NULL, HFILL
451
14
            }
452
14
        },
453
14
        {
454
14
            &hf_v150fw_ric_info_timeout,
455
14
            {
456
14
                "Timeout type",
457
14
                "v150fw.ricinfo.timeout",
458
14
                FT_UINT16,
459
14
                BASE_HEX,
460
14
                VALS(v150fw_ric_info_timeout_type),
461
14
                0xFF00,
462
14
                NULL, HFILL
463
14
            }
464
14
        },
465
14
        {
466
14
            &hf_v150fw_ric_info_timeout_vendor,
467
14
            {
468
14
                "Vendor-specific timeout info",
469
14
                "v150fw.ricinfo.timeout_vendor",
470
14
                FT_UINT16,
471
14
                BASE_HEX,
472
14
                NULL,
473
14
                0x00FF,
474
14
                NULL, HFILL
475
14
            }
476
14
        },
477
14
        {
478
14
            &hf_v150fw_ric_info_cleardown,
479
14
            {
480
14
                "Cleardown type",
481
14
                "v150fw.ricinfo.cleardown",
482
14
                FT_UINT16,
483
14
                BASE_HEX,
484
14
                VALS(v150fw_ric_info_cleardown_type),
485
14
                0xFF00,
486
14
                NULL, HFILL
487
14
            }
488
14
        },
489
14
        {
490
14
            &hf_v150fw_ric_info_cleardown_reserved,
491
14
            {
492
14
                "Reserved for use by the ITU-T",
493
14
                "v150fw.ricinfo.cleardown_reserved",
494
14
                FT_UINT16,
495
14
                BASE_HEX,
496
14
                NULL,
497
14
                0x00FF,
498
14
                NULL, HFILL
499
14
            }
500
14
        },
501
14
        {
502
14
            &hf_v150fw_ric_info_cleardown_vendor_tag,
503
14
            {
504
14
                "Vendor tag",
505
14
                "v150fw.cleardown_vendor_tag",
506
14
                FT_UINT8,
507
14
                BASE_HEX,
508
14
                NULL,
509
14
                0x0,
510
14
                NULL, HFILL
511
14
            }
512
14
        },
513
14
        {
514
14
            &hf_v150fw_ric_info_cleardown_vendor_info,
515
14
            {
516
14
                "Vendor-specific info",
517
14
                "v150fw.cleardown_vendor_info",
518
14
                FT_UINT8,
519
14
                BASE_HEX,
520
14
                NULL,
521
14
                0x0,
522
14
                NULL, HFILL
523
14
            }
524
14
        },
525
14
        {
526
14
            &hf_v150fw_ric_info_mod_avail,
527
14
            {
528
14
                "Modulation availability",
529
14
                "v150fw.rinfo.mod_avail",
530
14
                FT_UINT16,
531
14
                BASE_HEX,
532
14
                NULL,
533
14
                0x0,
534
14
                NULL, HFILL
535
14
            }
536
14
        },
537
14
        {
538
14
            &hf_v150fw_cm_jm_mod_avail_pcm_mode,
539
14
            {
540
14
                "PCM mode",
541
14
                "v150fw.rinfo.mod_avail.pcm_mode",
542
14
                FT_BOOLEAN,
543
14
                16,
544
14
                TFS(&tfs_available_not_available),
545
14
                0x8000,
546
14
                NULL, HFILL
547
14
            }
548
14
        },
549
14
        {
550
14
            &hf_v150fw_cm_jm_mod_avail_v34_duplex,
551
14
            {
552
14
                "V.34 duplex",
553
14
                "v150fw.rinfo.mod_avail.v34_duplex",
554
14
                FT_BOOLEAN,
555
14
                16,
556
14
                TFS(&tfs_available_not_available),
557
14
                0x4000,
558
14
                NULL, HFILL
559
14
            }
560
14
        },
561
14
        {
562
14
            &hf_v150fw_cm_jm_mod_avail_v34_half_duplex,
563
14
            {
564
14
                "V.34 half-duplex",
565
14
                "v150fw.rinfo.mod_avail.v34_half_duplex",
566
14
                FT_BOOLEAN,
567
14
                16,
568
14
                TFS(&tfs_available_not_available),
569
14
                0x2000,
570
14
                NULL, HFILL
571
14
            }
572
14
        },
573
14
        {
574
14
            &hf_v150fw_cm_jm_mod_avail_v32_v32bis,
575
14
            {
576
14
                "V.32/V.32bis",
577
14
                "v150fw.rinfo.mod_avail.v32_v32bis",
578
14
                FT_BOOLEAN,
579
14
                16,
580
14
                TFS(&tfs_available_not_available),
581
14
                0x1000,
582
14
                NULL, HFILL
583
14
            }
584
14
        },
585
14
        {
586
14
            &hf_v150fw_cm_jm_mod_avail_v22_v22bis,
587
14
            {
588
14
                "V.22/V.22bis",
589
14
                "v150fw.rinfo.mod_avail.v22_v22bis",
590
14
                FT_BOOLEAN,
591
14
                16,
592
14
                TFS(&tfs_available_not_available),
593
14
                0x0800,
594
14
                NULL, HFILL
595
14
            }
596
14
        },
597
14
        {
598
14
            &hf_v150fw_cm_jm_mod_avail_v17,
599
14
            {
600
14
                "V.17",
601
14
                "v150fw.rinfo.mod_avail.v17",
602
14
                FT_BOOLEAN,
603
14
                16,
604
14
                TFS(&tfs_available_not_available),
605
14
                0x0400,
606
14
                NULL, HFILL
607
14
            }
608
14
        },
609
14
        {
610
14
            &hf_v150fw_cm_jm_mod_avail_v29_half_duplex,
611
14
            {
612
14
                "V.29 half-duplex",
613
14
                "v150fw.rinfo.mod_avail.v29_half_duplex",
614
14
                FT_BOOLEAN,
615
14
                16,
616
14
                TFS(&tfs_available_not_available),
617
14
                0x0200,
618
14
                NULL, HFILL
619
14
            }
620
14
        },
621
14
        {
622
14
            &hf_v150fw_cm_jm_mod_avail_v27ter,
623
14
            {
624
14
                "V.27ter",
625
14
                "v150fw.rinfo.mod_avail.v27ter",
626
14
                FT_BOOLEAN,
627
14
                16,
628
14
                TFS(&tfs_available_not_available),
629
14
                0x0100,
630
14
                NULL, HFILL
631
14
            }
632
14
        },
633
14
        {
634
14
            &hf_v150fw_cm_jm_mod_avail_v26ter,
635
14
            {
636
14
                "V.26ter",
637
14
                "v150fw.rinfo.mod_avail.v26ter",
638
14
                FT_BOOLEAN,
639
14
                16,
640
14
                TFS(&tfs_available_not_available),
641
14
                0x0080,
642
14
                NULL, HFILL
643
14
            }
644
14
        },
645
14
        {
646
14
            &hf_v150fw_cm_jm_mod_avail_v26bis,
647
14
            {
648
14
                "V.26bis",
649
14
                "v150fw.rinfo.mod_avail.v26bis",
650
14
                FT_BOOLEAN,
651
14
                16,
652
14
                TFS(&tfs_available_not_available),
653
14
                0x0040,
654
14
                NULL, HFILL
655
14
            }
656
14
        },
657
14
        {
658
14
            &hf_v150fw_cm_jm_mod_avail_v23_duplex,
659
14
            {
660
14
                "V.23 duplex",
661
14
                "v150fw.rinfo.mod_avail.v23_duplex",
662
14
                FT_BOOLEAN,
663
14
                16,
664
14
                TFS(&tfs_available_not_available),
665
14
                0x0020,
666
14
                NULL, HFILL
667
14
            }
668
14
        },
669
14
        {
670
14
            &hf_v150fw_cm_jm_mod_avail_v23_half_duplex,
671
14
            {
672
14
                "V.23 half-duplex",
673
14
                "v150fw.rinfo.mod_avail.half_duplex",
674
14
                FT_BOOLEAN,
675
14
                16,
676
14
                TFS(&tfs_available_not_available),
677
14
                0x0010,
678
14
                NULL, HFILL
679
14
            }
680
14
        },
681
14
        {
682
14
            &hf_v150fw_cm_jm_mod_avail_v21,
683
14
            {
684
14
                "V.21",
685
14
                "v150fw.rinfo.mod_avail.v21",
686
14
                FT_BOOLEAN,
687
14
                16,
688
14
                TFS(&tfs_available_not_available),
689
14
                0x0008,
690
14
                NULL, HFILL
691
14
            }
692
14
        },
693
14
        {
694
14
            &hf_v150fw_cm_jm_mod_avail_v90_or_v92_analog,
695
14
            {
696
14
                "V.90 or V.92 analog",
697
14
                "v150fw.rinfo.mod_avail.v90_or_v92_analog",
698
14
                FT_BOOLEAN,
699
14
                16,
700
14
                TFS(&tfs_available_not_available),
701
14
                0x0004,
702
14
                NULL, HFILL
703
14
            }
704
14
        },
705
14
        {
706
14
            &hf_v150fw_cm_jm_mod_avail_v90_or_v92_digital,
707
14
            {
708
14
                "V.90 or V.92 digital",
709
14
                "v150fw.rinfo.mod_avail.v90_or_v92_digital",
710
14
                FT_BOOLEAN,
711
14
                16,
712
14
                TFS(&tfs_available_not_available),
713
14
                0x0002,
714
14
                NULL, HFILL
715
14
            }
716
14
        },
717
14
        {
718
14
            &hf_v150fw_cm_jm_mod_avail_v91,
719
14
            {
720
14
                "V.91",
721
14
                "v150fw.rinfo.mod_avail.v91",
722
14
                FT_BOOLEAN,
723
14
                16,
724
14
                TFS(&tfs_available_not_available),
725
14
                0x0001,
726
14
                NULL, HFILL
727
14
            }
728
14
        },
729
14
        {
730
14
            &hf_v150fw_reserved,
731
14
            {
732
14
                "Reserved",
733
14
                "v150fw.reserved",
734
14
                FT_UINT16,
735
14
                BASE_HEX,
736
14
                NULL,
737
14
                0xF800,
738
14
                NULL, HFILL
739
14
            }
740
14
        },
741
14
        {
742
14
            &hf_v150fw_extension_len,
743
14
            {
744
14
                "Extension field length",
745
14
                "v150fw.eflen",
746
14
                FT_UINT16,
747
14
                BASE_DEC,
748
14
                NULL,
749
14
                0x07FF,
750
14
                NULL, HFILL
751
14
            }
752
14
        },
753
        /* dump remaining bytes: */
754
14
        {
755
14
            &hf_v150fw_remainder,
756
14
            {
757
14
                "Remaining bytes",
758
14
                "v150fw.remainder",
759
14
                FT_BYTES,
760
14
                BASE_NONE,
761
14
                NULL,
762
14
                0x0,
763
14
                NULL, HFILL
764
14
            }
765
14
        }
766
14
    }; /* hf_register_info hf[] */
767
768
    /* setup protocol subtree array */
769
14
    static int *ett[] = {
770
14
        &ett_v150fw,
771
14
        &ett_available_modulations
772
14
    };
773
774
    /* register protocol name & description */
775
14
    proto_v150fw = proto_register_protocol("V.150.1 State Signaling Event", "V.150.1 SSE", "v150fw");
776
777
    /* required function calls to register the header fields and subtrees used */
778
14
    proto_register_field_array(proto_v150fw, hf, array_length(hf));
779
14
    proto_register_subtree_array(ett, array_length(ett));
780
781
    /* register the dissector */
782
14
    register_dissector("v150fw", dissect_v150fw, proto_v150fw);
783
14
}
784
785
/*
786
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
787
 *
788
 * Local variables:
789
 * c-basic-offset: 4
790
 * tab-width: 8
791
 * indent-tabs-mode: nil
792
 * End:
793
 *
794
 * vi: set shiftwidth=4 tabstop=8 expandtab:
795
 * :indentSize=4:tabSize=8:noTabs=true:
796
 */