Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-sprt.c
blob4756ff377a22caea95f59af9c024dbe23373afdc
1 /* packet-sprt.h
3 * Routines for SPRT dissection
4 * SPRT = Simple Packet Relay Transport
6 * Written by Jamison Adcock <jamison.adcock@cobham.com>
7 * for Sparta Inc., dba Cobham Analytic Solutions
8 * This code is largely based on the RTP parsing code
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 /* TODO:
18 * - work on conversations
22 #include "config.h"
24 #include <epan/packet.h>
25 #include <epan/prefs.h>
26 #include <epan/conversation.h>
27 #include <epan/expert.h>
28 #include <epan/tfs.h>
29 #include <wsutil/array.h>
30 #include "packet-sprt.h"
32 void proto_register_sprt(void);
33 void proto_reg_handoff_sprt(void);
35 /* for some "range_string"s, there's only one value in the range */
36 #define SPRT_VALUE_RANGE(a) a,a
38 /* TODO - conversation states */
39 #define SPRT_STATE_XXX_TODO 0
41 #define SPRT_CONV_MAX_SETUP_METHOD_SIZE 12
43 /* is DLCI field present in I_OCTET message? See "DLCI enabled" in CONNECT message */
44 typedef enum {
45 DLCI_UNKNOWN,
46 DLCI_PRESENT,
47 DLCI_ABSENT
48 } i_octet_dlci_status_t;
51 /* Keep conversation info for one side of an SPRT conversation
52 * TODO - this needs to be bidirectional
54 struct _sprt_conversation_info
56 char method[SPRT_CONV_MAX_SETUP_METHOD_SIZE + 1];
57 bool stream_started;
58 uint32_t frame_number; /* the frame where this conversation is started */
60 /* sequence numbers for each channel: */
61 uint32_t seqnum[4];
63 /* are we using the DLCI field in I_OCTET messages? See CONNECT message ("DLCI enabled") */
64 i_octet_dlci_status_t i_octet_dlci_status;
65 uint32_t connect_frame_number; /* the CONNECT frame that tells us if the DLCI is enabled */
67 /* TODO - maintain state */
71 /* SPRT Message IDs: */
72 #define SPRT_MODEM_RELAY_MSG_ID_NULL 0
73 #define SPRT_MODEM_RELAY_MSG_ID_INIT 1
74 #define SPRT_MODEM_RELAY_MSG_ID_XID_XCHG 2
75 #define SPRT_MODEM_RELAY_MSG_ID_JM_INFO 3
76 #define SPRT_MODEM_RELAY_MSG_ID_START_JM 4
77 #define SPRT_MODEM_RELAY_MSG_ID_CONNECT 5
78 #define SPRT_MODEM_RELAY_MSG_ID_BREAK 6
79 #define SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK 7
80 #define SPRT_MODEM_RELAY_MSG_ID_MR_EVENT 8
81 #define SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN 9
82 #define SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG 10
83 /* 11 -15 Reserved */
84 #define SPRT_MODEM_RELAY_MSG_ID_RESERVED1_START 11
85 #define SPRT_MODEM_RELAY_MSG_ID_RESERVED1_END 15
86 /* Data */
87 #define SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET 16
88 #define SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT 17
89 #define SPRT_MODEM_RELAY_MSG_ID_I_OCTET 18
90 #define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT 19
91 #define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN 20
92 #define SPRT_MODEM_RELAY_MSG_ID_I_FRAME 21
93 #define SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS 22
94 #define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS 23
95 #define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS 24
96 /* 25 - 99 Reserved */
97 #define SPRT_MODEM_RELAY_MSG_ID_RESERVED2_START 25
98 #define SPRT_MODEM_RELAY_MSG_ID_RESERVED2_END 99
99 /* 100 - 127 Vendor-specific */
100 #define SPRT_MODEM_RELAY_MSG_ID_VENDOR_START 100
101 #define SPRT_MODEM_RELAY_MSG_ID_VENDOR_END 127
104 /* error correcting protocol in XID_XCHG message: */
105 #define SPRT_ECP_NO_LINK_LAYER_PROTO 0
106 #define SPRT_ECP_V42_LAPM 1
107 #define SPRT_ECP_ANNEX_AV42_1996 2
108 /* 3 - 25 Reserved for ITU-T */
109 #define SPRT_ECP_RESERVED_START 3
110 #define SPRT_ECP_RESERVED_END 25
113 /* category ID used in JM_INFO message: */
114 #define SPRT_JM_INFO_CAT_ID_CALL_FUNCT 0x8
115 #define SPRT_JM_INFO_CAT_ID_MOD_MODES 0xA
116 #define SPRT_JM_INFO_CAT_ID_PROTOCOLS 0x5
117 #define SPRT_JM_INFO_CAT_ID_PSTN_ACCESS 0xB
118 #define SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL 0xE
119 #define SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION 0x0
122 #define SPRT_JMINFO_TBC_CALL_FUNCT_PSTN_MULTIMEDIA_TERM 0x4
123 #define SPRT_JMINFO_TBC_CALL_FUNCT_TEXTPHONE_ITU_T_REC_V18 0x2
124 #define SPRT_JMINFO_TBC_CALL_FUNCT_VIDEOTEXT_ITU_T_REC_T101 0x6
125 #define SPRT_JMINFO_TBC_CALL_FUNCT_TRANS_FAX_ITU_T_REC_T30 0x1
126 #define SPRT_JMINFO_TBC_CALL_FUNCT_RECV_FAX_ITU_T_REC_T30 0x5
127 #define SPRT_JMINFO_TBC_CALL_FUNCT_DATA_V_SERIES_MODEM_REC 0x3
130 #define SPRT_JMINFO_TBC_PROTOCOL_LAPM_ITU_T_REC_V42 0x4
133 /* selected modulations in CONNECT message: */
134 #define SPRT_SELMOD_NULL 0
135 #define SPRT_SELMOD_V92 1
136 #define SPRT_SELMOD_V91 2
137 #define SPRT_SELMOD_V90 3
138 #define SPRT_SELMOD_V34 4
139 #define SPRT_SELMOD_V32_BIS 5
140 #define SPRT_SELMOD_V32 6
141 #define SPRT_SELMOD_V22_BIS 7
142 #define SPRT_SELMOD_V22 8
143 #define SPRT_SELMOD_V17 9
144 #define SPRT_SELMOD_V29 10
145 #define SPRT_SELMOD_V27_TER 11
146 #define SPRT_SELMOD_V26_TER 12
147 #define SPRT_SELMOD_V26_BIS 13
148 #define SPRT_SELMOD_V23 14
149 #define SPRT_SELMOD_V21 15
150 #define SPRT_SELMOD_BELL_212 16
151 #define SPRT_SELMOD_BELL_103 17
152 /* 18 - 30 Vendor-specific modulations */
153 #define SPRT_SELMOD_VENDOR_START 18
154 #define SPRT_SELMOD_VENDOR_END 30
155 /* 31 - 63 Reserved for ITU-T */
156 #define SPRT_SELMOD_RESERVED_START 31
157 #define SPRT_SELMOD_RESERVED_END 63
160 /* Compression direction in CONNECT message: */
161 #define SPRT_COMPR_DIR_NO_COMPRESSION 0
162 #define SPRT_COMPR_DIR_TRANSMIT 1
163 #define SPRT_COMPR_DIR_RECEIVE 2
164 #define SPRT_COMPR_DIR_BIDIRECTIONAL 3
167 /* Selected compression modes in CONNECT message: */
168 #define SPRT_SELECTED_COMPR_NONE 0
169 #define SPRT_SELECTED_COMPR_V42_BIS 1
170 #define SPRT_SELECTED_COMPR_V44 2
171 #define SPRT_SELECTED_COMPR_MNP5 3
172 /* 4 - 15 Reserved by ITU-T */
173 #define SPRT_SELECTED_COMPR_RESERVED_START 4
174 #define SPRT_SELECTED_COMPR_RESERVED_END 15
177 /* Selected error correction modes in CONNECT message: */
178 #define SPRT_SELECTED_ERR_CORR_V14_OR_NONE 0
179 #define SPRT_SELECTED_ERR_CORR_V42_LAPM 1
180 #define SPRT_SELECTED_ERR_CORR_ANNEX_AV42 2
181 /* 3 - 15 Reserved for ITU-T */
182 #define SPRT_SELECTED_ERR_CORR_RESERVED_START 3
183 #define SPRT_SELECTED_ERR_CORR_RESERVED_END 15
186 /* Break source protocol in BREAK message: */
187 #define SPRT_BREAK_SRC_PROTO_V42_LAPM 0
188 #define SPRT_BREAK_SRC_PROTO_ANNEX_AV42_1996 1
189 #define SPRT_BREAK_SRC_PROTO_V14 2
190 /* 3 - 15 Reserved for ITU-T */
191 #define SPRT_BREAK_SRC_PROTO_RESERVED_START 3
192 #define SPRT_BREAK_SRC_PROTO_RESERVED_END 15
195 #define SPRT_BREAK_TYPE_NOT_APPLICABLE 0
196 #define SPRT_BREAK_TYPE_DESTRUCTIVE_AND_EXPEDITED 1
197 #define SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_EXPEDITED 2
198 #define SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_NONEXPEDITED 3
199 /* 4 - 15 Reserved for ITU-T */
200 #define SPRT_BREAK_TYPE_RESERVED_START 4
201 #define SPRT_BREAK_TYPE_RESERVED_END 15
204 /* Modem relay info in MR_EVENT messages: */
205 #define SPRT_MREVT_EVENT_ID_NULL 0
206 #define SPRT_MREVT_EVENT_ID_RATE_RENEGOTIATION 1
207 #define SPRT_MREVT_EVENT_ID_RETRAIN 2
208 #define SPRT_MREVT_EVENT_ID_PHYSUP 3
209 /* 4 - 255 Reserved for ITU-T */
210 #define SPRT_MREVT_EVENT_ID_RESERVED_START 4
211 #define SPRT_MREVT_EVENT_ID_RESERVED_END 255
214 #define SPRT_MREVT_REASON_CODE_NULL 0
215 #define SPRT_MREVT_REASON_CODE_INIT 1
216 #define SPRT_MREVT_REASON_CODE_RESPONDING 2
217 /* 3 - 255 Undefined */
218 #define SPRT_MREVT_REASON_CODE_RESERVED_START 3
219 #define SPRT_MREVT_REASON_CODE_RESERVED_END 255
222 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_NULL 0
223 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_600 1
224 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1200 2
225 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1600 3
226 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2400 4
227 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2743 5
228 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3000 6
229 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3200 7
230 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3429 8
231 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_8000 9
232 /* 10 - 254 Reserved for ITU-T */
233 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_START 10
234 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_END 254
235 #define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_UNSPECIFIED 255
238 /* Cleardown reason codes: */
239 #define SPRT_CLEARDOWN_RIC_UNKNOWN 0
240 #define SPRT_CLEARDOWN_RIC_PHYSICAL_LAYER_RELEASE 1
241 #define SPRT_CLEARDOWN_RIC_LINK_LAYER_DISCONNECT 2
242 #define SPRT_CLEARDOWN_RIC_DATA_COMPRESSION_DISCONNECT 3
243 #define SPRT_CLEARDOWN_RIC_ABORT 4
244 #define SPRT_CLEARDOWN_RIC_ON_HOOK 5
245 #define SPRT_CLEARDOWN_RIC_NETWORK_LAYER_TERMINATION 6
246 #define SPRT_CLEARDOWN_RIC_ADMINISTRATIVE 7
249 /* PROF_XCHG messages (XID profile exchange for MR1): */
250 #define SPRT_PROF_XCHG_SUPPORT_NO 0
251 #define SPRT_PROF_XCHG_SUPPORT_YES 1
252 #define SPRT_PROF_XCHG_SUPPORT_UNKNOWN 2
255 /* DLCI field in I_OCTET: */
256 #define SPRT_PAYLOAD_DLCI1_DTE2DTE 0
257 #define SPRT_PAYLOAD_DLCI1_RESERVED_START 1
258 #define SPRT_PAYLOAD_DLCI1_RESERVED_END 31
259 #define SPRT_PAYLOAD_DLCI1_NOT_RESERVED_START 32
260 #define SPRT_PAYLOAD_DLCI1_NOT_RESERVED_END 62
261 #define SPRT_PAYLOAD_DLCI1_CTRLFN2CTRLFN 63
263 #define SPRT_PAYLOAD_DLCI2_START 0
264 #define SPRT_PAYLOAD_DLCI2_END 127
266 /* Payload fields for I_CHAR_STAT_CS, etc.: */
267 /* # of data bits */
268 #define SPRT_PAYLOAD_D_0 0
269 #define SPRT_PAYLOAD_D_1 1
270 #define SPRT_PAYLOAD_D_2 2
271 #define SPRT_PAYLOAD_D_3 3
274 /* parity */
275 #define SPRT_PAYLOAD_P_0 0
276 #define SPRT_PAYLOAD_P_1 1
277 #define SPRT_PAYLOAD_P_2 2
278 #define SPRT_PAYLOAD_P_3 3
279 #define SPRT_PAYLOAD_P_4 4
280 #define SPRT_PAYLOAD_P_5 5
281 #define SPRT_PAYLOAD_P_6 6
282 #define SPRT_PAYLOAD_P_7 7
285 /* # of stop bits */
286 #define SPRT_PAYLOAD_S_0 0
287 #define SPRT_PAYLOAD_S_1 1
288 #define SPRT_PAYLOAD_S_2 2
289 #define SPRT_PAYLOAD_S_3 3
292 /* data frame state */
293 #define SPRT_PAYLOAD_FR_0 0
294 #define SPRT_PAYLOAD_FR_1 1
295 #define SPRT_PAYLOAD_FR_2 2
296 #define SPRT_PAYLOAD_FR_3 3
299 /* Initialize the protocol & registered fields */
300 static int proto_sprt;
302 static int hf_sprt_setup;
303 static int hf_sprt_setup_frame;
304 static int hf_sprt_setup_method;
306 static int hf_sprt_header_extension_bit;
307 static int hf_sprt_subsession_id;
308 static int hf_sprt_reserved_bit;
309 static int hf_sprt_payload_type;
310 static int hf_sprt_transport_channel_id;
311 static int hf_sprt_sequence_number;
312 static int hf_sprt_number_of_ack_fields;
313 static int hf_sprt_base_sequence_number;
314 static int hf_sprt_ack_field_items;
315 static int hf_sprt_transport_channel_item;
316 static int hf_sprt_sequence_item;
318 static int hf_sprt_payload_length;
319 static int hf_sprt_payload_no_data;
320 static int hf_sprt_payload_reserved_bit;
321 static int hf_sprt_payload_message_id;
323 static int hf_sprt_payload_data; /* stuff after msgid */
324 /* INIT msg: */
325 static int hf_sprt_payload_msg_init_all_fields;
326 static int hf_sprt_payload_msg_init_necrxch;
327 static int hf_sprt_payload_msg_init_ecrxch;
328 static int hf_sprt_payload_msg_init_xid_prof_exch;
329 static int hf_sprt_payload_msg_init_asymm_data_types;
330 static int hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit;
331 static int hf_sprt_payload_msg_init_opt_moip_types_i_frame;
332 static int hf_sprt_payload_msg_init_opt_moip_types_i_char_stat;
333 static int hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn;
334 static int hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs;
335 static int hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs;
336 static int hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs;
337 static int hf_sprt_payload_msg_init_opt_moip_types_reserved;
338 /* XID_XCHG message: */
339 static int hf_sprt_payload_msg_xidxchg_ecp;
340 static int hf_sprt_payload_msg_xidxchg_xidlr1_v42bis;
341 static int hf_sprt_payload_msg_xidxchg_xidlr1_v44;
342 static int hf_sprt_payload_msg_xidxchg_xidlr1_mnp5;
343 static int hf_sprt_payload_msg_xidxchg_xidlr1_reserved;
344 static int hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req;
345 static int hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords;
346 static int hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen;
347 static int hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability;
348 static int hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req;
349 static int hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans;
350 static int hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv;
351 static int hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans;
352 static int hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv;
353 static int hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans;
354 static int hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv;
355 /* V.8 JM_INFO msg: */
356 static int hf_sprt_payload_msg_jminfo_category_data;
357 static int hf_sprt_payload_msg_jminfo_category_id;
358 static int hf_sprt_payload_msg_jminfo_category_ext_info;
359 static int hf_sprt_payload_msg_jminfo_unk_category_info;
360 static int hf_sprt_payload_msg_jminfo_category_leftover_bits;
361 static int hf_sprt_payload_msg_jminfo_call_function;
362 static int hf_sprt_payload_msg_jminfo_mod_v34_duplex;
363 static int hf_sprt_payload_msg_jminfo_mod_v34_half_duplex;
364 static int hf_sprt_payload_msg_jminfo_mod_v32bis_v32;
365 static int hf_sprt_payload_msg_jminfo_mod_v22bis_v22;
366 static int hf_sprt_payload_msg_jminfo_mod_v17;
367 static int hf_sprt_payload_msg_jminfo_mod_v29_half_duplex;
368 static int hf_sprt_payload_msg_jminfo_mod_v27ter;
369 static int hf_sprt_payload_msg_jminfo_mod_v26ter;
370 static int hf_sprt_payload_msg_jminfo_mod_v26bis;
371 static int hf_sprt_payload_msg_jminfo_mod_v23_duplex;
372 static int hf_sprt_payload_msg_jminfo_mod_v23_half_duplex;
373 static int hf_sprt_payload_msg_jminfo_mod_v21;
374 static int hf_sprt_payload_msg_jminfo_protocols;
375 static int hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell;
376 static int hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell;
377 static int hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net;
378 static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog;
379 static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital;
380 static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91;
381 /* CONNECT msg: */
382 static int hf_sprt_payload_msg_connect_selmod;
383 static int hf_sprt_payload_msg_connect_compr_dir;
384 static int hf_sprt_payload_msg_connect_selected_compr;
385 static int hf_sprt_payload_msg_connect_selected_err_corr;
386 static int hf_sprt_payload_msg_connect_tdsr;
387 static int hf_sprt_payload_msg_connect_rdsr;
388 static int hf_sprt_payload_msg_connect_dlci_enabled;
389 static int hf_sprt_payload_msg_connect_avail_data_types;
390 static int hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci;
391 static int hf_sprt_payload_msg_connect_adt_i_raw_bit;
392 static int hf_sprt_payload_msg_connect_adt_i_frame;
393 static int hf_sprt_payload_msg_connect_adt_i_char_stat;
394 static int hf_sprt_payload_msg_connect_adt_i_char_dyn;
395 static int hf_sprt_payload_msg_connect_adt_i_octet_cs;
396 static int hf_sprt_payload_msg_connect_adt_i_char_stat_cs;
397 static int hf_sprt_payload_msg_connect_adt_i_char_dyn_cs;
398 static int hf_sprt_payload_msg_connect_adt_reserved;
399 static int hf_sprt_payload_msg_connect_compr_trans_dict_sz;
400 static int hf_sprt_payload_msg_connect_compr_recv_dict_sz;
401 static int hf_sprt_payload_msg_connect_compr_trans_str_len;
402 static int hf_sprt_payload_msg_connect_compr_recv_str_len;
403 static int hf_sprt_payload_msg_connect_compr_trans_hist_sz;
404 static int hf_sprt_payload_msg_connect_compr_recv_hist_sz;
405 /* BREAK msg: */
406 static int hf_sprt_payload_msg_break_source_proto;
407 static int hf_sprt_payload_msg_break_type;
408 static int hf_sprt_payload_msg_break_length;
409 /* MR_EVENT msg: */
410 static int hf_sprt_payload_msg_mr_event_id;
411 static int hf_sprt_payload_msg_mr_evt_reason_code;
412 static int hf_sprt_payload_msg_mr_evt_selmod;
413 static int hf_sprt_payload_msg_mr_evt_txsen;
414 static int hf_sprt_payload_msg_mr_evt_rxsen;
415 static int hf_sprt_payload_msg_mr_evt_tdsr;
416 static int hf_sprt_payload_msg_mr_evt_rdsr;
417 static int hf_sprt_payload_msg_mr_evt_txsr;
418 static int hf_sprt_payload_msg_mr_evt_rxsr;
419 /* CLEARDOWN msg: */
420 static int hf_sprt_payload_msg_cleardown_reason_code;
421 static int hf_sprt_payload_msg_cleardown_vendor_tag;
422 static int hf_sprt_payload_msg_cleardown_vendor_info;
423 /* PROF_XCHG msg: */
424 static int hf_sprt_payload_msg_profxchg_v42_lapm;
425 static int hf_sprt_payload_msg_profxchg_annex_av42;
426 static int hf_sprt_payload_msg_profxchg_v44_compr;
427 static int hf_sprt_payload_msg_profxchg_v42bis_compr;
428 static int hf_sprt_payload_msg_profxchg_mnp5_compr;
429 static int hf_sprt_payload_msg_profxchg_reserved;
430 static int hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req;
431 static int hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords;
432 static int hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen;
433 static int hf_sprt_payload_msg_profxchg_xidlr6_v44_capability;
434 static int hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req;
435 static int hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans;
436 static int hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv;
437 static int hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans;
438 static int hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv;
439 static int hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans;
440 static int hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv;
441 /* I_OCTET */
442 static int hf_sprt_payload_i_octet_no_dlci;
443 static int hf_sprt_payload_i_octet_dlci_presence_unknown;
444 static int hf_sprt_payload_i_octet_dlci1;
445 static int hf_sprt_payload_i_octet_cr;
446 static int hf_sprt_payload_i_octet_ea;
447 static int hf_sprt_payload_i_octet_dlci2;
448 static int hf_sprt_payload_i_octet_dlci_setup_by_connect_frame;
450 /* I_OCTET_CS, I_CHAR_STAT_CS, I_CHAR_DYN_CS msgs: */
451 static int hf_sprt_payload_data_cs;
452 static int hf_sprt_payload_data_reserved_bit;
453 static int hf_sprt_payload_data_num_data_bits;
454 static int hf_sprt_payload_data_parity_type;
455 static int hf_sprt_payload_num_stop_bits;
456 static int hf_sprt_payload_frame_reserved_bits;
457 static int hf_sprt_payload_frame_state;
458 static int hf_sprt_payload_rawoctet_n_field_present;
459 static int hf_sprt_payload_rawoctet_l;
460 static int hf_sprt_payload_rawoctet_n;
461 static int hf_sprt_payload_rawbit_included_fields_l;
462 static int hf_sprt_payload_rawbit_included_fields_lp;
463 static int hf_sprt_payload_rawbit_included_fields_lpn;
464 static int hf_sprt_payload_rawbit_len_a;
465 static int hf_sprt_payload_rawbit_len_b;
466 static int hf_sprt_payload_rawbit_len_c;
467 static int hf_sprt_payload_rawbit_p;
468 static int hf_sprt_payload_rawbit_n;
470 /* Preferences */
471 static bool global_sprt_show_setup_info = true; /* show how this SPRT stream got started */
472 static bool global_sprt_show_dlci_info = true; /* show DLCI in I_OCTET messages, including setup frame (if we can) */
475 /* dissector handle */
476 static dissector_handle_t sprt_handle;
479 /* initialize the subtree pointers */
480 static int ett_sprt;
481 static int ett_sprt_setup;
482 static int ett_sprt_ack_fields;
483 static int ett_payload;
484 static int ett_init_msg_all_fields;
485 static int ett_jminfo_msg_cat_data;
486 static int ett_connect_msg_adt;
488 static expert_field ei_sprt_sequence_number_0;
490 /* value strings & range strings */
491 static const value_string sprt_transport_channel_characteristics[] = {
492 { 0, "Unreliable, unsequenced" },
493 { 1, "Reliable, sequenced" },
494 { 2, "Expedited, reliable, sequenced" },
495 { 3, "Unreliable, sequenced" },
496 { 0, NULL}
499 static const range_string sprt_modem_relay_msg_id_name[] = {
500 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_NULL), "NULL reserved for ITU-T" },
501 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_INIT), "INIT" },
502 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_XID_XCHG), "XID_XCHG" },
503 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_JM_INFO), "JM_INFO" },
504 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_START_JM), "START_JM" },
505 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_CONNECT), "CONNECT" },
506 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_BREAK), "BREAK" },
507 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK), "BREAK_ACK" },
508 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_MR_EVENT), "MR_EVENT" },
509 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN), "CLEARDOWN" },
510 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG), "PROF_XCHG" },
511 { SPRT_MODEM_RELAY_MSG_ID_RESERVED1_START, SPRT_MODEM_RELAY_MSG_ID_RESERVED1_END, "Reserved for ITU-T" },
512 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET), "I_RAW-OCTET" },
513 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT), "I_RAW-BIT" },
514 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_OCTET), "I_OCTET" },
515 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT), "I_CHAR-STAT" },
516 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN), "I_CHAR-DYN" },
517 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_FRAME), "I_FRAME" },
518 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS), "I_OCTET-CS" },
519 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS), "I_CHAR-STAT-CS" },
520 { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS), "I_CHAR-DYN-CS" },
521 { SPRT_MODEM_RELAY_MSG_ID_RESERVED2_START, SPRT_MODEM_RELAY_MSG_ID_RESERVED2_END, "Reserved for ITU-T" },
522 { SPRT_MODEM_RELAY_MSG_ID_VENDOR_START, SPRT_MODEM_RELAY_MSG_ID_VENDOR_END, "Vendor-specific message" },
523 { 0, 0, NULL }
526 static const range_string sprt_ecp_name[] = {
527 { SPRT_VALUE_RANGE(SPRT_ECP_NO_LINK_LAYER_PROTO), "No link layer protocol" },
528 { SPRT_VALUE_RANGE(SPRT_ECP_V42_LAPM), "V.42/LAPM" },
529 { SPRT_VALUE_RANGE(SPRT_ECP_ANNEX_AV42_1996), "Annex A/V.42(1996)" },
530 { SPRT_ECP_RESERVED_START, SPRT_ECP_RESERVED_END, "Reserved for ITU-T" },
531 { 0, 0, NULL }
534 static const value_string sprt_jm_info_cat_id_name[] = {
535 { SPRT_JM_INFO_CAT_ID_CALL_FUNCT, "Call function" },
536 { SPRT_JM_INFO_CAT_ID_MOD_MODES, "Modulation modes" },
537 { SPRT_JM_INFO_CAT_ID_PROTOCOLS, "Protocols" },
538 { SPRT_JM_INFO_CAT_ID_PSTN_ACCESS, "PSTN access" },
539 { SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL, "PCM modem availability" },
540 { SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION, "Extension of current category" },
541 { 0, NULL }
544 static const value_string sprt_jminfo_tbc_call_funct_name[] = {
545 { SPRT_JMINFO_TBC_CALL_FUNCT_PSTN_MULTIMEDIA_TERM, "PSTN Multimedia terminal (ITU-T Rec. H.324)" },
546 { SPRT_JMINFO_TBC_CALL_FUNCT_TEXTPHONE_ITU_T_REC_V18, "Textphone (ITU-T Rec. V.18)" },
547 { SPRT_JMINFO_TBC_CALL_FUNCT_VIDEOTEXT_ITU_T_REC_T101, "Videotext (ITU-T Rec. T.101)" },
548 { SPRT_JMINFO_TBC_CALL_FUNCT_TRANS_FAX_ITU_T_REC_T30, "Transmit facsimile from call terminal (ITU-T Rec. T.30)" },
549 { SPRT_JMINFO_TBC_CALL_FUNCT_RECV_FAX_ITU_T_REC_T30, "Receive facsimile at call terminal (ITU-T Rec. T.30)" },
550 { SPRT_JMINFO_TBC_CALL_FUNCT_DATA_V_SERIES_MODEM_REC, "Data (V-series modem Recommendations)" },
551 { 0, NULL }
554 static const range_string sprt_jminfo_tbc_protocol_name[] = {
555 { SPRT_VALUE_RANGE(SPRT_JMINFO_TBC_PROTOCOL_LAPM_ITU_T_REC_V42), "LAPM protocol according to ITU-T Rec. V.42" },
556 { 0, 0, NULL }
559 static const range_string sprt_selmod_name[] = {
560 { SPRT_VALUE_RANGE(SPRT_SELMOD_NULL), "NULL" },
561 { SPRT_VALUE_RANGE(SPRT_SELMOD_V92), "V.92" },
562 { SPRT_VALUE_RANGE(SPRT_SELMOD_V91), "V.91" },
563 { SPRT_VALUE_RANGE(SPRT_SELMOD_V90), "V.90" },
564 { SPRT_VALUE_RANGE(SPRT_SELMOD_V34), "V.34" },
565 { SPRT_VALUE_RANGE(SPRT_SELMOD_V32_BIS), "V.32bis" },
566 { SPRT_VALUE_RANGE(SPRT_SELMOD_V32), "V.32" },
567 { SPRT_VALUE_RANGE(SPRT_SELMOD_V22_BIS), "V.22bis" },
568 { SPRT_VALUE_RANGE(SPRT_SELMOD_V22), "V.22" },
569 { SPRT_VALUE_RANGE(SPRT_SELMOD_V17), "V.17" },
570 { SPRT_VALUE_RANGE(SPRT_SELMOD_V29), "V.29" },
571 { SPRT_VALUE_RANGE(SPRT_SELMOD_V27_TER), "V.27ter" },
572 { SPRT_VALUE_RANGE(SPRT_SELMOD_V26_TER), "V.26ter" },
573 { SPRT_VALUE_RANGE(SPRT_SELMOD_V26_BIS), "V.26bis" },
574 { SPRT_VALUE_RANGE(SPRT_SELMOD_V23), "V.23" },
575 { SPRT_VALUE_RANGE(SPRT_SELMOD_V21), "V.21" },
576 { SPRT_VALUE_RANGE(SPRT_SELMOD_BELL_212), "Bell 212" },
577 { SPRT_VALUE_RANGE(SPRT_SELMOD_BELL_103), "Bell 103" },
578 { SPRT_SELMOD_VENDOR_START, SPRT_SELMOD_VENDOR_END, "Vendor-specific modulation" },
579 { SPRT_SELMOD_RESERVED_START, SPRT_SELMOD_RESERVED_END, "Reserved for ITU-T" },
580 { 0, 0, NULL }
583 static const value_string sprt_comp_direction[] = {
584 { SPRT_COMPR_DIR_NO_COMPRESSION, "None" },
585 { SPRT_COMPR_DIR_TRANSMIT, "Transmit" },
586 { SPRT_COMPR_DIR_RECEIVE, "Receive" },
587 { SPRT_COMPR_DIR_BIDIRECTIONAL, "Bidirectional" },
588 { 0, NULL }
591 static const range_string sprt_selected_compr_name[] = {
592 { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_NONE), "None" },
593 { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_V42_BIS), "V.42bis" },
594 { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_V44), "V.44" },
595 { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_MNP5), "MNP5" },
596 { SPRT_SELECTED_COMPR_RESERVED_START, SPRT_SELECTED_COMPR_RESERVED_END, "Reserved by ITU-T" },
597 { 0, 0, NULL }
600 static const range_string sprt_selected_err_corr_name[] = {
601 { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_V14_OR_NONE), "V.14 or no error correction protocol" },
602 { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_V42_LAPM), "V.42/LAPM" },
603 { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_ANNEX_AV42), "Annex A/V.42" },
604 { SPRT_SELECTED_ERR_CORR_RESERVED_START, SPRT_SELECTED_ERR_CORR_RESERVED_END, "Reserved for ITU-T" },
605 { 0, 0, NULL }
608 static const range_string sprt_break_src_proto_name[] = {
609 { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_V42_LAPM), "V.42/LAPM" },
610 { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_ANNEX_AV42_1996), "Annex A/V.42(1996)" },
611 { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_V14), "V.14" },
612 { SPRT_BREAK_SRC_PROTO_RESERVED_START, SPRT_BREAK_SRC_PROTO_RESERVED_END, "Reserved for ITU-T" },
613 { 0, 0, NULL }
616 static const range_string sprt_break_type_name[] = {
617 { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NOT_APPLICABLE), "Not applicable" },
618 { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_DESTRUCTIVE_AND_EXPEDITED), "Destructive and expedited" },
619 { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_EXPEDITED), "Non-destructive and expedited" },
620 { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_NONEXPEDITED), "Non-destructive and non-expedited" },
621 { SPRT_BREAK_TYPE_RESERVED_START, SPRT_BREAK_TYPE_RESERVED_END, "Reserved for ITU-T" },
622 { 0, 0, NULL }
625 static const range_string sprt_mrevent_id_name[] = {
626 { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_NULL), "NULL" },
627 { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_RATE_RENEGOTIATION), "Rate renegotiation" },
628 { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_RETRAIN), "Retrain" },
629 { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_PHYSUP), "Physical layer ready" }, /* reason code should be 0 */
630 { SPRT_MREVT_EVENT_ID_RESERVED_START, SPRT_MREVT_EVENT_ID_RESERVED_END, "Reserved for ITU-T" },
631 { 0, 0, NULL }
634 static const range_string sprt_mrevent_reason_code_name[] = {
635 { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_NULL), "Null/not applicable" }, /* for eventid = PHYSUP */
636 { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_INIT), "Initiation" },
637 { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_RESPONDING), "Responding" },
638 { SPRT_MREVT_REASON_CODE_RESERVED_START, SPRT_MREVT_REASON_CODE_RESERVED_END, "Reserved for ITU-T" },
639 { 0, 0, NULL }
642 static const range_string sprt_mrevent_phys_layer_symbol_rate[] = {
643 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_NULL), "Null/not applicable" },
644 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_600), "600" },
645 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1200), "1200" },
646 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1600), "1600" },
647 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2400), "2400" },
648 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2743), "2743" },
649 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3000), "3000" },
650 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3200), "3200" },
651 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3429), "3249" },
652 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_8000), "8000" },
653 { SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_START, SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_END, "Reserved for ITU-T" },
654 { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_UNSPECIFIED), "Unspecified" },
655 { 0, 0, NULL }
658 static const value_string sprt_cleardown_reason[] = {
659 { SPRT_CLEARDOWN_RIC_UNKNOWN, "Unknown/unspecified" },
660 { SPRT_CLEARDOWN_RIC_PHYSICAL_LAYER_RELEASE, "Physical layer release" },
661 { SPRT_CLEARDOWN_RIC_LINK_LAYER_DISCONNECT, "Link layer disconnect" },
662 { SPRT_CLEARDOWN_RIC_DATA_COMPRESSION_DISCONNECT, "Data compression disconnect" },
663 { SPRT_CLEARDOWN_RIC_ABORT, "Abort" },
664 { SPRT_CLEARDOWN_RIC_ON_HOOK, "On hook" },
665 { SPRT_CLEARDOWN_RIC_NETWORK_LAYER_TERMINATION, "Network layer termination" },
666 { SPRT_CLEARDOWN_RIC_ADMINISTRATIVE, "Administrative" },
667 { 0, NULL }
670 static const value_string sprt_prof_xchg_support[] = {
671 { SPRT_PROF_XCHG_SUPPORT_NO, "No" },
672 { SPRT_PROF_XCHG_SUPPORT_YES, "Yes" },
673 { SPRT_PROF_XCHG_SUPPORT_UNKNOWN, "Unknown" },
674 { 0, NULL }
677 static const range_string sprt_payload_dlci1[] = {
678 { SPRT_VALUE_RANGE(SPRT_PAYLOAD_DLCI1_DTE2DTE), "DTE-to-DTE (V.24 interfaces) data" },
679 { SPRT_PAYLOAD_DLCI1_RESERVED_START, SPRT_PAYLOAD_DLCI1_RESERVED_END, "Reserved for ITU-T" },
680 { SPRT_PAYLOAD_DLCI1_NOT_RESERVED_START, SPRT_PAYLOAD_DLCI1_NOT_RESERVED_END, "Not reserved for ITU-T" },
681 { SPRT_VALUE_RANGE(SPRT_PAYLOAD_DLCI1_CTRLFN2CTRLFN), "Control-function to control-function information" },
682 { 0, 0, NULL }
685 static const true_false_string sprt_payload_ea_bit = {
686 "Last octet of address field", "Another octet of address field follows"
689 static const range_string sprt_payload_dlci2[] = {
690 { SPRT_PAYLOAD_DLCI2_START, SPRT_PAYLOAD_DLCI2_END, "Reserved by ITU-T for further study" },
691 { 0, 0, NULL }
694 static const value_string sprt_payload_data_bits[] = {
695 { SPRT_PAYLOAD_D_0, "5 bits" },
696 { SPRT_PAYLOAD_D_1, "6 bits" },
697 { SPRT_PAYLOAD_D_2, "7 bits" },
698 { SPRT_PAYLOAD_D_3, "8 bits" },
699 { 0, NULL }
702 static const value_string sprt_payload_parity[] = {
703 { SPRT_PAYLOAD_P_0, "Unknown" },
704 { SPRT_PAYLOAD_P_1, "None" },
705 { SPRT_PAYLOAD_P_2, "Even parity" },
706 { SPRT_PAYLOAD_P_3, "Odd parity" },
707 { SPRT_PAYLOAD_P_4, "Space parity" },
708 { SPRT_PAYLOAD_P_5, "Mark parity" },
709 { SPRT_PAYLOAD_P_6, "Reserved" },
710 { SPRT_PAYLOAD_P_7, "Reserved" },
711 { 0, NULL }
714 static const value_string sprt_payload_stop_bits[] = {
715 { SPRT_PAYLOAD_S_0, "1 stop bit" },
716 { SPRT_PAYLOAD_S_1, "2 stop bits" },
717 { SPRT_PAYLOAD_S_2, "Reserved" },
718 { SPRT_PAYLOAD_S_3, "Reserved" },
719 { 0, NULL }
722 static const value_string sprt_payload_frame_state[] = {
723 { SPRT_PAYLOAD_FR_0, "Data frame without termination" },
724 { SPRT_PAYLOAD_FR_1, "Data frame with termination" },
725 { SPRT_PAYLOAD_FR_2, "Data frame with abort termination" },
726 { SPRT_PAYLOAD_FR_3, "Undefined" },
727 { 0, NULL }
730 /* Fix for SPRT Parser Crash (Gitlab Issue #19559)
731 RTP Version is the first 2 bits of the first octet in the UDP payload */
732 #define RTP_VERSION(octet) ((octet) >> 6)
733 static dissector_handle_t rtp_handle;
735 /* look for a conversation & return the associated data */
736 static struct _sprt_conversation_info* find_sprt_conversation_data(packet_info *pinfo)
738 conversation_t *p_conv = NULL;
739 struct _sprt_conversation_info *p_conv_data = NULL;
740 /* Use existing packet info if available */
741 p_conv = find_conversation_pinfo(pinfo, NO_ADDR_B|NO_PORT_B);
742 if (p_conv)
744 p_conv_data = (struct _sprt_conversation_info*)conversation_get_proto_data(p_conv, proto_sprt);
746 return p_conv_data;
751 /* set up SPRT conversation */
752 void sprt_add_address(packet_info *pinfo,
753 address *addr, int port,
754 int other_port,
755 const char *setup_method,
756 uint32_t setup_frame_number)
758 address null_addr;
759 conversation_t* p_conv;
760 struct _sprt_conversation_info *p_conv_data = NULL;
763 * If this isn't the first time this packet has been processed,
764 * we've already done this work, so we don't need to do it
765 * again.
767 if (pinfo->fd->visited)
769 return;
772 clear_address(&null_addr);
775 * Check if the ip address and port combination is not
776 * already registered as a conversation.
778 p_conv = find_conversation(setup_frame_number, addr, &null_addr, CONVERSATION_UDP, port, other_port,
779 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
782 * If not, create a new conversation.
784 if (!p_conv || p_conv->setup_frame != setup_frame_number) {
785 p_conv = conversation_new(setup_frame_number, addr, &null_addr, CONVERSATION_UDP,
786 (uint32_t)port, (uint32_t)other_port,
787 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
790 /* Set dissector */
791 conversation_set_dissector(p_conv, sprt_handle);
794 * Check if the conversation has data associated with it.
796 p_conv_data = (struct _sprt_conversation_info *)conversation_get_proto_data(p_conv, proto_sprt);
799 * If not, add a new data item.
801 if (!p_conv_data) {
802 /* Create conversation data */
803 p_conv_data = wmem_new(wmem_file_scope(), struct _sprt_conversation_info);
804 p_conv_data->stream_started = false;
805 p_conv_data->seqnum[0] = 0;
806 p_conv_data->seqnum[1] = 0;
807 p_conv_data->seqnum[2] = 0;
808 p_conv_data->seqnum[3] = 0;
809 p_conv_data->i_octet_dlci_status = DLCI_UNKNOWN;
810 p_conv_data->connect_frame_number = 0;
811 conversation_add_proto_data(p_conv, proto_sprt, p_conv_data);
814 /* Update the conversation data. */
815 (void) g_strlcpy(p_conv_data->method, setup_method, SPRT_CONV_MAX_SETUP_METHOD_SIZE);
816 p_conv_data->frame_number = setup_frame_number;
821 /* Display setup info */
822 static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
824 struct _sprt_conversation_info *p_conv_data;
825 proto_tree *sprt_setup_tree;
826 proto_item *ti;
828 /* look up the conversation & get the data */
829 p_conv_data = find_sprt_conversation_data(pinfo);
831 if (!p_conv_data)
833 proto_tree_add_string_format(tree, hf_sprt_setup, tvb, 0, 0, "", "No setup info found");
834 return;
837 /* Create setup info subtree with summary info. */
838 ti = proto_tree_add_string_format(tree, hf_sprt_setup, tvb, 0, 0,
840 "Stream setup by %s (frame %u)",
841 p_conv_data->method,
842 p_conv_data->frame_number);
843 proto_item_set_generated(ti);
844 sprt_setup_tree = proto_item_add_subtree(ti, ett_sprt_setup);
845 if (sprt_setup_tree)
847 /* Add details into subtree */
848 proto_item* item = proto_tree_add_uint(sprt_setup_tree, hf_sprt_setup_frame,
849 tvb, 0, 0, p_conv_data->frame_number);
850 proto_item_set_generated(item);
851 item = proto_tree_add_string(sprt_setup_tree, hf_sprt_setup_method,
852 tvb, 0, 0, p_conv_data->method);
853 proto_item_set_generated(item);
858 /* code to actually dissect the packet payload data */
859 static int
860 dissect_sprt_data(tvbuff_t *tvb,
861 packet_info *pinfo,
862 struct _sprt_conversation_info *p_conv_data,
863 proto_tree *sprt_tree,
864 unsigned int offset,
865 unsigned payload_length)
867 proto_item *ti;
868 proto_tree *sprt_payload_tree, *field_subtree;
869 uint8_t octet, payload_msgid, category_id;
870 uint8_t selcompr, mr_event_id;
871 uint16_t word, category_count;
873 if (payload_length > 0)
875 ti = proto_tree_add_uint(sprt_tree, hf_sprt_payload_length, tvb, offset, 1, payload_length);
876 proto_item_set_len(ti, payload_length);
878 sprt_payload_tree = proto_item_add_subtree(ti, ett_payload);
880 payload_msgid = tvb_get_uint8(tvb, offset) & 0x7F;
882 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
883 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_message_id, tvb, offset, 1, ENC_BIG_ENDIAN);
884 offset++;
885 payload_length--;
887 /* what kind of message is this? */
888 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s(%d)",
889 rval_to_str_const(payload_msgid, sprt_modem_relay_msg_id_name, "Unknown"),
890 payload_msgid);
892 /* now parse payload stuff after ext. bit & msgid */
893 switch(payload_msgid)
895 case SPRT_MODEM_RELAY_MSG_ID_INIT:
896 /* make subtree */
897 ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_init_all_fields, tvb, offset, 2, ENC_BIG_ENDIAN);
898 field_subtree = proto_item_add_subtree(ti, ett_init_msg_all_fields);
899 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_necrxch, tvb, offset, 2, ENC_BIG_ENDIAN);
900 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_ecrxch, tvb, offset, 2, ENC_BIG_ENDIAN);
901 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_xid_prof_exch, tvb, offset, 2, ENC_BIG_ENDIAN);
902 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_asymm_data_types, tvb, offset, 2, ENC_BIG_ENDIAN);
903 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
904 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_frame, tvb, offset, 2, ENC_BIG_ENDIAN);
905 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_stat, tvb, offset, 2, ENC_BIG_ENDIAN);
906 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn, tvb, offset, 2, ENC_BIG_ENDIAN);
907 /* from V.150.1 amendment 2 (5-2006): */
908 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
909 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
910 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
911 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
912 offset += 2;
913 break;
914 case SPRT_MODEM_RELAY_MSG_ID_XID_XCHG:
915 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_ecp, tvb, offset, 1, ENC_BIG_ENDIAN);
916 offset++;
917 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_v42bis, tvb, offset, 1, ENC_BIG_ENDIAN);
918 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_v44, tvb, offset, 1, ENC_BIG_ENDIAN);
919 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_mnp5, tvb, offset, 1, ENC_BIG_ENDIAN);
920 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
921 offset++;
922 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
923 offset++;
924 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords, tvb, offset, 2, ENC_BIG_ENDIAN);
925 offset += 2;
926 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen, tvb, offset, 1, ENC_BIG_ENDIAN);
927 offset++;
928 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability, tvb, offset, 1, ENC_BIG_ENDIAN);
929 offset++;
930 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
931 offset++;
932 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
933 offset += 2;
934 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
935 offset += 2;
936 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans, tvb, offset, 1, ENC_BIG_ENDIAN);
937 offset++;
938 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv, tvb, offset, 1, ENC_BIG_ENDIAN);
939 offset++;
940 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
941 offset += 2;
942 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
943 offset += 2;
944 break;
945 case SPRT_MODEM_RELAY_MSG_ID_JM_INFO:
946 category_count = 1;
947 do /* there may be multiple categories */
949 word = tvb_get_ntohs(tvb, offset);
950 category_id = (word >> 12);
952 ti = proto_tree_add_uint_format_value(sprt_payload_tree, hf_sprt_payload_msg_jminfo_category_data, tvb, offset, 2, word,
953 "Item #%d: %s (0x%04x)", category_count, val_to_str_const(category_id, sprt_jm_info_cat_id_name, "Unknown"), category_id);
954 category_count++;
955 field_subtree = proto_item_add_subtree(ti, ett_jminfo_msg_cat_data);
956 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_id, tvb, offset, 2, ENC_BIG_ENDIAN);
958 switch(category_id)
960 case SPRT_JM_INFO_CAT_ID_CALL_FUNCT: /* 0x8 */
961 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_call_function, tvb, offset, 2, ENC_BIG_ENDIAN);
962 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
963 break;
964 case SPRT_JM_INFO_CAT_ID_MOD_MODES: /* 0xA */
965 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v34_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
966 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v34_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
967 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v32bis_v32, tvb, offset, 2, ENC_BIG_ENDIAN);
968 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v22bis_v22, tvb, offset, 2, ENC_BIG_ENDIAN);
969 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v17, tvb, offset, 2, ENC_BIG_ENDIAN);
970 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v29_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
971 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v27ter, tvb, offset, 2, ENC_BIG_ENDIAN);
972 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v26ter, tvb, offset, 2, ENC_BIG_ENDIAN);
973 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v26bis, tvb, offset, 2, ENC_BIG_ENDIAN);
974 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v23_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
975 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v23_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
976 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v21, tvb, offset, 2, ENC_BIG_ENDIAN);
977 break;
978 case SPRT_JM_INFO_CAT_ID_PROTOCOLS: /* 0x5 */
979 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_protocols, tvb, offset, 2, ENC_BIG_ENDIAN);
980 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
981 break;
982 case SPRT_JM_INFO_CAT_ID_PSTN_ACCESS: /* 0xB */
983 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell, tvb, offset, 2, ENC_BIG_ENDIAN);
984 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell, tvb, offset, 2, ENC_BIG_ENDIAN);
985 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net, tvb, offset, 2, ENC_BIG_ENDIAN);
986 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
987 break;
988 case SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL: /* 0xE */
989 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog, tvb, offset, 2, ENC_BIG_ENDIAN);
990 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital, tvb, offset, 2, ENC_BIG_ENDIAN);
991 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91, tvb, offset, 2, ENC_BIG_ENDIAN);
992 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
993 break;
994 case SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION: /* 0x0 */
995 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_ext_info, tvb, offset, 2, ENC_BIG_ENDIAN);
996 break;
997 default: /* unknown category ID */
998 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_unk_category_info, tvb, offset, 2, ENC_BIG_ENDIAN);
999 break;
1001 offset += 2;
1002 } while (tvb_reported_length_remaining(tvb, offset) >= 2);
1003 break;
1004 case SPRT_MODEM_RELAY_MSG_ID_START_JM:
1005 /* No additional content */
1006 break;
1007 case SPRT_MODEM_RELAY_MSG_ID_CONNECT: /***/
1008 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selmod, tvb, offset, 1, ENC_BIG_ENDIAN);
1009 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_dir, tvb, offset, 1, ENC_BIG_ENDIAN);
1010 offset++;
1011 selcompr = (tvb_get_uint8(tvb, offset) & 0xF0) >> 4;
1012 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selected_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
1013 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selected_err_corr, tvb, offset, 1, ENC_BIG_ENDIAN);
1014 offset++;
1015 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_tdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
1016 offset += 2;
1017 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_rdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
1018 offset += 2;
1019 word = tvb_get_ntohs(tvb, offset);
1020 /* is DLCI enabled (used w/I_OCTET messages)? */
1021 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_dlci_enabled, tvb, offset, 2, ENC_BIG_ENDIAN);
1022 /* have we previously seen a CONNECT msg in this conversation (i.e., do we know if DLCI is used w/I_OCTET?) */
1023 if (p_conv_data->connect_frame_number == 0)
1025 p_conv_data->connect_frame_number = pinfo->num;
1026 if (word & 0x8000)
1028 p_conv_data->i_octet_dlci_status = DLCI_PRESENT;
1029 } else {
1030 p_conv_data->i_octet_dlci_status = DLCI_ABSENT;
1034 /* do subtree for available data types */
1035 ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_avail_data_types, tvb, offset, 2, ENC_BIG_ENDIAN);
1036 field_subtree = proto_item_add_subtree(ti, ett_connect_msg_adt);
1037 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci, tvb, offset, 2, ENC_BIG_ENDIAN);
1038 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_raw_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
1039 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_frame, tvb, offset, 2, ENC_BIG_ENDIAN);
1040 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_stat, tvb, offset, 2, ENC_BIG_ENDIAN);
1041 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_dyn, tvb, offset, 2, ENC_BIG_ENDIAN);
1042 /* from V.150.1 amendment 2 (5-2006): */
1043 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_octet_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1044 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_stat_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1045 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_dyn_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1046 proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1047 offset += 2;
1048 if (selcompr != SPRT_SELECTED_COMPR_NONE &&
1049 selcompr != SPRT_SELECTED_COMPR_MNP5)
1051 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_dict_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
1052 offset += 2;
1053 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_dict_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
1054 offset += 2;
1055 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_str_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1056 offset++;
1057 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_str_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1058 offset++;
1060 if (selcompr != SPRT_SELECTED_COMPR_NONE &&
1061 selcompr != SPRT_SELECTED_COMPR_MNP5 &&
1062 selcompr != SPRT_SELECTED_COMPR_V42_BIS)
1064 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_hist_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
1065 offset += 2;
1066 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_hist_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
1067 offset += 2;
1069 break;
1070 case SPRT_MODEM_RELAY_MSG_ID_BREAK: /* no additional info */
1071 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_source_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
1072 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1073 offset++;
1074 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1075 offset++;
1076 break;
1077 case SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK:
1078 /* No additional content */
1079 break;
1080 case SPRT_MODEM_RELAY_MSG_ID_MR_EVENT:
1081 mr_event_id = tvb_get_uint8(tvb, offset);
1082 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1083 offset++;
1084 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
1085 offset++;
1086 if (mr_event_id == SPRT_MREVT_EVENT_ID_PHYSUP)
1088 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_selmod, tvb, offset, 1, ENC_BIG_ENDIAN);
1089 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_txsen, tvb, offset, 1, ENC_BIG_ENDIAN);
1090 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rxsen, tvb, offset, 1, ENC_BIG_ENDIAN);
1091 offset++;
1092 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_tdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
1093 offset += 2;
1094 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
1095 offset += 2;
1096 /* The next two fields are "optional"
1097 * they should only appear w/PHYSUP (MR_EVENT id = 3) messages, when TxSR and RxSR are true
1099 if (tvb_reported_length_remaining(tvb, offset) >= 2)
1101 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_txsr, tvb, offset, 1, ENC_BIG_ENDIAN);
1102 offset++;
1103 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rxsr, tvb, offset, 1, ENC_BIG_ENDIAN);
1104 offset++;
1107 break;
1108 case SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN:
1109 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
1110 offset++;
1111 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_vendor_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
1112 offset++;
1113 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_vendor_info, tvb, offset, 1, ENC_BIG_ENDIAN);
1114 offset++;
1115 break;
1116 case SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG:
1117 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v42_lapm, tvb, offset, 1, ENC_BIG_ENDIAN);
1118 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_annex_av42, tvb, offset, 1, ENC_BIG_ENDIAN);
1119 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v44_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
1120 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v42bis_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
1121 offset++;
1122 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_mnp5_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
1123 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1124 offset++;
1125 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
1126 offset++;
1127 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords, tvb, offset, 2, ENC_BIG_ENDIAN);
1128 offset += 2;
1129 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen, tvb, offset, 1, ENC_BIG_ENDIAN);
1130 offset++;
1131 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr6_v44_capability, tvb, offset, 1, ENC_BIG_ENDIAN);
1132 offset++;
1133 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
1134 offset++;
1135 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
1136 offset += 2;
1137 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
1138 offset += 2;
1139 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans, tvb, offset, 1, ENC_BIG_ENDIAN);
1140 offset++;
1141 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv, tvb, offset, 1, ENC_BIG_ENDIAN);
1142 offset++;
1143 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
1144 offset += 2;
1145 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
1146 offset += 2;
1147 break;
1148 case SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET: /* data */
1149 octet = tvb_get_uint8(tvb, offset);
1150 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_n_field_present, tvb, offset, 1, ENC_BIG_ENDIAN);
1151 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_l, tvb, offset, 1, ENC_BIG_ENDIAN);
1152 if (octet & 0x80) /* is N field present? */
1154 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_n, tvb, offset, 1, ENC_BIG_ENDIAN);
1156 offset++;
1157 payload_length--;
1158 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1159 break;
1160 case SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT: /* data */
1162 * L, P, N fields need to be parsed
1164 switch((tvb_get_uint8(tvb, offset) & 0xC0) >> 6)
1166 case 0x0: /* 00: get L (6 bits) */
1167 /* display leading "00" bits, followed by L */
1168 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_l, tvb, offset, 1, ENC_BIG_ENDIAN);
1169 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_a, tvb, offset, 1, ENC_BIG_ENDIAN);
1170 offset++;
1171 payload_length--;
1172 break;
1173 case 0x1: /* 01: get L (3 bits) & P (3 bits) */
1174 /* display leading "01" bits, followed by L,P */
1175 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_lp, tvb, offset, 1, ENC_BIG_ENDIAN);
1176 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_b, tvb, offset, 1, ENC_BIG_ENDIAN);
1177 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_p, tvb, offset, 1, ENC_BIG_ENDIAN);
1178 offset++;
1179 payload_length--;
1180 break;
1181 default: /* 10, 11: get L (4 bits), P (3 bits), N (8 bits) */
1182 /* display leading "1" bit, followed by L,P,N */
1183 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_lpn, tvb, offset, 1, ENC_BIG_ENDIAN);
1184 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_c, tvb, offset, 1, ENC_BIG_ENDIAN);
1185 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_p, tvb, offset, 1, ENC_BIG_ENDIAN);
1186 offset++;
1187 payload_length--;
1188 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_n, tvb, offset, 1, ENC_BIG_ENDIAN);
1189 offset++;
1190 payload_length--;
1191 break;
1193 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1194 break;
1195 case SPRT_MODEM_RELAY_MSG_ID_I_OCTET: /* data */
1196 if (global_sprt_show_dlci_info)
1198 /* DLCI field may be 0, 1, or 2 bytes, depending on CONNECT message (see "DLCI enabled")...
1199 * or UNKNOWN if we don't see the CONNECT message
1201 switch(p_conv_data->i_octet_dlci_status)
1203 case DLCI_PRESENT:
1204 octet = tvb_get_uint8(tvb, offset);
1205 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci1, tvb, offset, 1, ENC_BIG_ENDIAN);
1206 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_cr, tvb, offset, 1, ENC_BIG_ENDIAN);
1207 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_ea, tvb, offset, 1, ENC_BIG_ENDIAN);
1208 offset++;
1209 payload_length--;
1210 /* check address extension... if ea bit == 0, then DLCI has another octet (see ITU-T V42 spec for more info) */
1211 if (!(octet & 0x01))
1213 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci2, tvb, offset, 1, ENC_BIG_ENDIAN);
1214 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_ea, tvb, offset, 1, ENC_BIG_ENDIAN);
1215 offset++;
1216 payload_length--;
1218 ti = proto_tree_add_uint(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_setup_by_connect_frame, tvb, 0, 0, p_conv_data->connect_frame_number);
1219 proto_item_set_generated(ti);
1220 break;
1221 case DLCI_ABSENT:
1222 ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_no_dlci, tvb, 0, 0, ENC_NA);
1223 proto_item_set_generated(ti);
1224 ti = proto_tree_add_uint(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_setup_by_connect_frame, tvb, 0, 0, p_conv_data->connect_frame_number);
1225 proto_item_set_generated(ti);
1226 break;
1227 case DLCI_UNKNOWN: /* e.g., we didn't see the CONNECT msg so we don't know if there is a DLCI */
1228 default:
1229 ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_presence_unknown, tvb, 0, 0, ENC_NA);
1230 proto_item_set_generated(ti);
1231 break;
1234 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1235 break;
1236 case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT: /* data */
1237 /* r: 1-bit reserved */
1238 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1239 /* D: 2-bit field indicating # of data bits */
1240 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1241 /* P: 3-bit field for parity type */
1242 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1243 /* S: 2-bit field indicating # of stop bits */
1244 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1245 offset++;
1246 payload_length--;
1247 /* octets */
1248 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1249 break;
1250 case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN: /* data */
1251 /* r: 1-bit reserved */
1252 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1253 /* D: 2-bit field indicating # of data bits */
1254 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1255 /* P: 3-bit field for parity type */
1256 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1257 /* S: 2-bit field indicating # of stop bits */
1258 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1259 offset++;
1260 payload_length--;
1261 /* octets */
1262 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1263 break;
1264 case SPRT_MODEM_RELAY_MSG_ID_I_FRAME: /* data */
1265 /* R: 6 reserved bits */
1266 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_frame_reserved_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1267 /* Fr: data frame state */
1268 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_frame_state, tvb, offset, 1, ENC_BIG_ENDIAN);
1269 offset++;
1270 payload_length--;
1271 /* octets */
1272 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1273 break;
1274 case SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS: /* data */
1275 /* CS: 2-byte character sequence number */
1276 /* TODO - does this msg type ever have a DLCI? */
1277 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1278 offset += 2;
1279 payload_length -= 2;
1280 /* octets */
1281 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1282 break;
1283 case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS: /* data */
1284 /* r: 1-bit reserved */
1285 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1286 /* D: 2-bit field indicating # of data bits */
1287 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1288 /* P: 3-bit field for parity type */
1289 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1290 /* S: 2-bit field indicating # of stop bits */
1291 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1292 offset++;
1293 payload_length--;
1294 /* CS: 2-byte character sequence number */
1295 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1296 offset += 2;
1297 payload_length -= 2;
1298 /* octets */
1299 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1300 break;
1301 case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS: /* data */
1302 /* r: 1-bit reserved */
1303 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1304 /* D: 2-bit field indicating # of data bits */
1305 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1306 /* P: 3-bit field for parity type */
1307 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1308 /* S: 2-bit field indicating # of stop bits */
1309 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
1310 offset++;
1311 payload_length--;
1312 /* CS: 2-byte character sequence number */
1313 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
1314 offset += 2;
1315 payload_length -= 2;
1316 /* octets */
1317 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1318 break;
1319 default:
1320 proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
1321 break;
1323 } else {
1324 proto_tree_add_item(sprt_tree, hf_sprt_payload_no_data, tvb, offset, 0, ENC_NA);
1325 col_append_str(pinfo->cinfo, COL_INFO, ", No Payload");
1328 return offset;
1331 static int
1332 dissect_sprt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1334 /* Set up structures needed to add the protocol subtree and manage it */
1335 proto_item *ti;
1336 proto_tree *sprt_tree = NULL;
1337 proto_tree *sprt_ack_field_tree;
1338 uint16_t word1;
1339 unsigned int offset = 0;
1340 unsigned payload_length;
1341 struct _sprt_conversation_info *p_conv_data = NULL;
1342 int i;
1344 uint16_t tc;
1345 uint16_t seqnum; /* 0 if TC = 0 or if no payload */
1346 uint16_t noa;
1347 /* ack fields */
1348 /*uint16_t tcn;*/
1349 /*uint16_t sqn;*/
1351 /* Fix for SPRT Parser Crash (Gitlab Issue #19559)
1352 * XXX - heuristic to check for misidentified packets.
1355 uint8_t octet1;
1356 unsigned int version;
1357 octet1 = tvb_get_uint8(tvb, offset);
1358 version = RTP_VERSION( octet1 );
1360 if (version == 2){
1361 return call_dissector(rtp_handle,tvb,pinfo,tree);
1364 /* Get conversation data, or create it if not found */
1365 p_conv_data = find_sprt_conversation_data(pinfo);
1366 if (!p_conv_data)
1368 sprt_add_address(pinfo,
1369 &pinfo->src, pinfo->srcport,
1371 "SPRT stream",
1372 pinfo->num);
1373 p_conv_data = find_sprt_conversation_data(pinfo);
1374 if (!p_conv_data) {
1375 // This shouldn't happen; likely a new RTP conversation was set up
1376 // after this frame but with a setup frame before this one.
1377 return 0;
1381 /* Make entries in Protocol column and Info column on summary display */
1382 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPRT");
1383 col_clear(pinfo->cinfo, COL_INFO);
1385 if (tree)
1387 /* create the trees */
1388 ti = proto_tree_add_item(tree, proto_sprt, tvb, 0, -1, ENC_NA);
1389 sprt_tree = proto_item_add_subtree(ti, ett_sprt);
1391 /* show conversation setup info */
1392 if (global_sprt_show_setup_info)
1394 show_setup_info(tvb, pinfo, sprt_tree);
1398 /*SPRT header packet format
1399 +------+-------+-------+-------+-------+-------+---------+-------+
1400 |0 |1 |2 |3 |4 |5 |6 |7 |
1401 +------+-------+-------+-------+-------+-------+---------+-------+
1402 | X | SSID |
1403 +----------------------------------------------------------------+
1404 | R | PT |
1405 +--------------+-------------------------------------------------+
1406 | TC | Sequence Number |
1407 +--------------+-------------------------------------------------+
1408 | Sequence Number |
1409 +----------------------------------------------------------------+
1410 | NOA | Base Sequence Number |
1411 +--------------+-------------------------------------------------+
1412 | Base Sequence Number |
1413 +----------------------------------------------------------------+
1414 | TCN | SQN |
1415 +--------------+-------------------------------------------------+
1416 | SQN |
1417 +----------------------------------------------------------------+
1418 | TCN | SQN |
1419 +--------------+-------------------------------------------------+
1420 | SQN |
1421 +----------------------------------------------------------------+
1422 | TCN | SQN |
1423 +--------------+-------------------------------------------------+
1424 | SQN |
1425 +----------------------------------------------------------------+
1428 /* Get fields needed for further dissection */
1429 word1 = tvb_get_ntohs(tvb, offset + 2);
1430 tc = (word1 & 0xC000) >> 14;
1431 seqnum = word1 & 0x3FFF;
1433 noa = (tvb_get_ntohs(tvb, offset + 4) & 0xC000) >> 14;
1435 proto_tree_add_item(sprt_tree, hf_sprt_header_extension_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1436 proto_tree_add_item(sprt_tree, hf_sprt_subsession_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1437 offset++;
1439 proto_tree_add_item(sprt_tree, hf_sprt_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
1440 proto_tree_add_item(sprt_tree, hf_sprt_payload_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1441 offset++;
1443 proto_tree_add_item(sprt_tree, hf_sprt_transport_channel_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1444 ti = proto_tree_add_item(sprt_tree, hf_sprt_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
1445 if (tc == 0 && seqnum != 0)
1446 expert_add_info(pinfo, ti, &ei_sprt_sequence_number_0);
1448 p_conv_data->seqnum[tc] = seqnum; /* keep track of seqnum values */
1449 offset+=2;
1451 proto_tree_add_item(sprt_tree, hf_sprt_number_of_ack_fields, tvb, offset, 2, ENC_BIG_ENDIAN);
1452 proto_tree_add_item(sprt_tree, hf_sprt_base_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
1453 offset+=2;
1455 if (noa) /* parse ack fields? There can be 0 - 3 */
1457 ti = proto_tree_add_item(sprt_tree, hf_sprt_ack_field_items, tvb, offset, 2, ENC_BIG_ENDIAN);
1458 sprt_ack_field_tree = proto_item_add_subtree(ti, ett_sprt_ack_fields);
1460 for(i = 0; i < noa; i++)
1462 proto_tree_add_item(sprt_ack_field_tree, hf_sprt_transport_channel_item, tvb, offset, 2, ENC_BIG_ENDIAN);
1463 proto_tree_add_item(sprt_ack_field_tree, hf_sprt_sequence_item, tvb, offset, 2, ENC_BIG_ENDIAN);
1464 offset += 2;
1468 /* put details in the info column */
1469 col_append_fstr(pinfo->cinfo, COL_INFO, "TC=%u", tc);
1470 if (tc != 0)
1471 col_append_fstr(pinfo->cinfo, COL_INFO, ", Seq=%u", seqnum);
1473 /* dissect the payload, if any */
1474 payload_length = tvb_captured_length(tvb) - (6 + noa * 2); /* total sprt length - header stuff */
1475 dissect_sprt_data(tvb, pinfo, p_conv_data, sprt_tree, offset, payload_length);
1477 if (noa)
1478 col_append_str(pinfo->cinfo, COL_INFO, " (ACK fields present)");
1480 return tvb_captured_length(tvb);
1483 /* heuristic dissector */
1484 static bool
1485 dissect_sprt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1487 uint8_t octet, extension_bit, reserved_bit, payload_type;
1488 uint16_t word, tc, seqnum;
1489 unsigned int offset = 0;
1491 /* This is a heuristic dissector, which means we get all the UDP
1492 * traffic not sent to a known dissector and not claimed by
1493 * a heuristic dissector called before us!
1496 if (tvb_captured_length(tvb) < 6)
1497 return false; /* packet is waay to short */
1499 /* Get the fields in the first two octets */
1500 extension_bit = tvb_get_uint8(tvb, offset) & 0x7F;
1501 if (extension_bit != 0) /* must be 0 */
1502 return false;
1504 octet = tvb_get_uint8(tvb, offset + 1);
1505 reserved_bit = octet & 80;
1506 payload_type = octet & 0x7F;
1507 if (reserved_bit != 0) /* must be 0 */
1508 return false;
1509 if (payload_type < 96 || payload_type > 128) /* value within RTP dynamic payload type range */
1510 return false;
1512 word = tvb_get_ntohs(tvb, offset + 2);
1513 tc = word >> 14;
1514 seqnum = word & 0x3F;
1515 if ((tc == 0 || tc == 3) && (seqnum != 0)) /* seqnum only applies if tc is 1 or 2 */
1516 return false;
1518 dissect_sprt(tvb, pinfo, tree, data);
1519 return true;
1522 /* register the protocol with Wireshark */
1523 void
1524 proto_register_sprt(void)
1526 module_t *sprt_module;
1527 expert_module_t* expert_sprt;
1529 static hf_register_info hf[] =
1531 /* set up fields */
1533 &hf_sprt_setup,
1535 "Stream setup",
1536 "sprt.setup",
1537 FT_STRING,
1538 BASE_NONE,
1539 NULL,
1540 0x0,
1541 "Stream setup, method and frame number", HFILL
1545 &hf_sprt_setup_frame,
1547 "Setup frame",
1548 "sprt.setup-frame",
1549 FT_FRAMENUM,
1550 BASE_NONE,
1551 NULL,
1552 0x0,
1553 "Frame that set up this stream", HFILL
1557 &hf_sprt_setup_method,
1559 "Setup Method",
1560 "sprt.setup-method",
1561 FT_STRING,
1562 BASE_NONE,
1563 NULL,
1564 0x0,
1565 "Method used to set up this stream", HFILL
1568 /* SPRT header fields: */
1570 &hf_sprt_header_extension_bit,
1572 "Header extension bit",
1573 "sprt.x",
1574 FT_BOOLEAN,
1576 TFS(&tfs_set_notset),
1577 0x80,
1578 NULL, HFILL
1582 &hf_sprt_subsession_id,
1584 "Sub session ID",
1585 "sprt.ssid",
1586 FT_UINT8,
1587 BASE_DEC,
1588 NULL,
1589 0x7F,
1590 NULL, HFILL
1594 &hf_sprt_reserved_bit,
1596 "Reserved bit",
1597 "sprt.reserved",
1598 FT_BOOLEAN,
1600 TFS(&tfs_set_notset),
1601 0x80,
1602 NULL, HFILL
1606 &hf_sprt_payload_type,
1608 "Payload type",
1609 "sprt.pt",
1610 FT_UINT8,
1611 BASE_DEC,
1612 NULL,
1613 0x7F,
1614 NULL, HFILL
1618 &hf_sprt_transport_channel_id,
1620 "Transport channel ID",
1621 "sprt.tc",
1622 FT_UINT16,
1623 BASE_DEC,
1624 VALS(sprt_transport_channel_characteristics),
1625 0xC000,
1626 NULL, HFILL
1630 &hf_sprt_sequence_number,
1632 "Sequence number",
1633 "sprt.seq",
1634 FT_UINT16,
1635 BASE_DEC,
1636 NULL,
1637 0x3FFF,
1638 NULL, HFILL
1642 &hf_sprt_number_of_ack_fields,
1644 "Number of ACK fields",
1645 "sprt.noa",
1646 FT_UINT16,
1647 BASE_DEC,
1648 NULL,
1649 0xC000,
1650 NULL, HFILL
1654 &hf_sprt_base_sequence_number,
1656 "Base sequence number",
1657 "sprt.bsqn",
1658 FT_UINT16,
1659 BASE_DEC,
1660 NULL,
1661 0x3FFF,
1662 NULL, HFILL
1665 /* ACK fields, if any: */
1667 &hf_sprt_ack_field_items, /* 0 to 3 items (TCN + SQN) */
1669 "ACK fields",
1670 "sprt.ack.field",
1671 FT_UINT16,
1672 BASE_DEC,
1673 NULL,
1674 0xC000,
1675 NULL, HFILL
1679 &hf_sprt_transport_channel_item,
1681 "Transport control channel",
1682 "sprt.tcn",
1683 FT_UINT16,
1684 BASE_DEC,
1685 NULL,
1686 0xC000,
1687 NULL, HFILL
1691 &hf_sprt_sequence_item,
1693 "Sequence number",
1694 "sprt.sqn",
1695 FT_UINT16,
1696 BASE_DEC,
1697 NULL,
1698 0x3FFF,
1699 NULL, HFILL
1702 /* SPRT payload, if any: */
1704 &hf_sprt_payload_length,
1706 "Payload (in bytes)",
1707 "sprt.payload.length",
1708 FT_UINT32,
1709 BASE_DEC,
1710 NULL,
1711 0x0,
1712 NULL, HFILL
1716 &hf_sprt_payload_no_data,
1718 "No payload",
1719 "sprt.payload",
1720 FT_NONE,
1721 BASE_NONE,
1722 NULL,
1723 0x0,
1724 NULL, HFILL
1728 &hf_sprt_payload_reserved_bit,
1730 "Reserved bit",
1731 "sprt.payload.reserved_bit",
1732 FT_BOOLEAN,
1734 TFS(&tfs_set_notset),
1735 0x80,
1736 NULL, HFILL
1740 &hf_sprt_payload_message_id,
1742 "Payload message ID",
1743 "sprt.payload.msgid",
1744 FT_UINT8,
1745 BASE_DEC | BASE_RANGE_STRING,
1746 RVALS(sprt_modem_relay_msg_id_name),
1747 0x7F,
1748 NULL, HFILL
1751 /* SPRT payload fields, if any (depend on payload msgid): */
1752 /* INIT message */
1754 &hf_sprt_payload_msg_init_all_fields,
1756 "Init message fields",
1757 "sprt.payload.msg_init.all_fields",
1758 FT_UINT16,
1759 BASE_HEX,
1760 NULL,
1761 0xFFFF, /* 0x0 */
1762 NULL, HFILL
1766 &hf_sprt_payload_msg_init_necrxch,
1768 "NECRxCH",
1769 "sprt.payload.msg_init.NECRxCH",
1770 FT_BOOLEAN,
1772 NULL,
1773 0x8000,
1774 NULL, HFILL
1778 &hf_sprt_payload_msg_init_ecrxch,
1780 "ECRxCH",
1781 "sprt.payload.msg_init.ECRxCH",
1782 FT_BOOLEAN,
1784 NULL,
1785 0x4000,
1786 NULL, HFILL
1790 &hf_sprt_payload_msg_init_xid_prof_exch,
1792 "XID profile exchange",
1793 "sprt.payload.msg_init.XID_profile_exch",
1794 FT_BOOLEAN,
1796 TFS(&tfs_supported_not_supported),
1797 0x2000,
1798 NULL, HFILL
1802 &hf_sprt_payload_msg_init_asymm_data_types,
1804 "Asymmetrical data types",
1805 "sprt.payload.msg_init.asymm_data_types",
1806 FT_BOOLEAN,
1808 TFS(&tfs_supported_not_supported),
1809 0x1000,
1810 NULL, HFILL
1814 &hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit,
1816 "I_RAW-BIT",
1817 "sprt.payload.msg_init.opt_moip_types_i_raw_bit",
1818 FT_BOOLEAN,
1820 TFS(&tfs_supported_not_supported),
1821 0x0800,
1822 NULL, HFILL
1826 &hf_sprt_payload_msg_init_opt_moip_types_i_frame,
1828 "I_FRAME",
1829 "sprt.payload.msg_init.opt_moip_types_i_frame",
1830 FT_BOOLEAN,
1832 TFS(&tfs_supported_not_supported),
1833 0x0400,
1834 NULL, HFILL
1838 &hf_sprt_payload_msg_init_opt_moip_types_i_char_stat,
1840 "I_CHAR-STAT",
1841 "sprt.payload.msg_init.opt_moip_types_i_char_stat",
1842 FT_BOOLEAN,
1844 TFS(&tfs_supported_not_supported),
1845 0x0200,
1846 NULL, HFILL
1850 &hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn,
1852 "I_CHAR-DYN",
1853 "sprt.payload.msg_init.opt_moip_types_i_char_dyn",
1854 FT_BOOLEAN,
1856 TFS(&tfs_supported_not_supported),
1857 0x0100,
1858 NULL, HFILL
1862 &hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs,
1864 "I_OCTET-CS",
1865 "sprt.payload.msg_init.opt_moip_types_i_octet_cs",
1866 FT_BOOLEAN,
1868 TFS(&tfs_supported_not_supported),
1869 0x0080,
1870 NULL, HFILL
1874 &hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs,
1876 "I_CHAR-STAT-CS",
1877 "sprt.payload.msg_init.opt_moip_types_i_char_stat_cs",
1878 FT_BOOLEAN,
1880 TFS(&tfs_supported_not_supported),
1881 0x0040,
1882 NULL, HFILL
1886 &hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs,
1888 "I_CHAR-DYN-CS",
1889 "sprt.payload.msg_init.opt_moip_types_i_char_dyn_cs",
1890 FT_BOOLEAN,
1892 TFS(&tfs_supported_not_supported),
1893 0x0020,
1894 NULL, HFILL
1898 &hf_sprt_payload_msg_init_opt_moip_types_reserved,
1900 "Reserved for ITU-T",
1901 "sprt.payload.msg_init.opt_moip_types_reserved",
1902 FT_UINT16,
1903 BASE_HEX,
1904 NULL,
1905 0x001F,
1906 NULL, HFILL
1909 /* XID_XCHG message */
1911 &hf_sprt_payload_msg_xidxchg_ecp,
1913 "Error correcting protocol",
1914 "sprt.payload.msg_xidxchg.ecp",
1915 FT_UINT8,
1916 BASE_DEC | BASE_RANGE_STRING,
1917 RVALS(sprt_ecp_name),
1918 0x0,
1919 NULL, HFILL
1923 &hf_sprt_payload_msg_xidxchg_xidlr1_v42bis,
1925 "V.42 bis",
1926 "sprt.payload.msg_xidxchg.xidlr1_v42bis",
1927 FT_BOOLEAN,
1929 TFS(&tfs_supported_not_supported),
1930 0x80,
1931 NULL, HFILL
1935 &hf_sprt_payload_msg_xidxchg_xidlr1_v44,
1937 "V.44",
1938 "sprt.payload.msg_xidxchg.xidlr1_v44",
1939 FT_BOOLEAN,
1941 TFS(&tfs_supported_not_supported),
1942 0x40,
1943 NULL, HFILL
1947 &hf_sprt_payload_msg_xidxchg_xidlr1_mnp5,
1949 "MNP5",
1950 "sprt.payload.msg_xidxchg.xidlr1_mnp5",
1951 FT_BOOLEAN,
1953 TFS(&tfs_supported_not_supported),
1954 0x20,
1955 NULL, HFILL
1959 &hf_sprt_payload_msg_xidxchg_xidlr1_reserved,
1961 "Reserved for ITU-T",
1962 "sprt.payload.msg_xidxchg.xidlr1_reserved",
1963 FT_UINT8,
1964 BASE_HEX,
1965 NULL,
1966 0x1F,
1967 NULL, HFILL
1971 &hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req,
1973 "V.42bis data compression request",
1974 "sprt.payload.msg_xidxchg.xidlr2_v42bis_compr_req",
1975 FT_UINT8,
1976 BASE_DEC,
1977 NULL,
1978 0x0,
1979 NULL, HFILL
1983 &hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords,
1985 "V.42bis number of codewords",
1986 "sprt.payload.msg_xidxchg.xidlr3and4_v42bis_num_codewords",
1987 FT_UINT16,
1988 BASE_DEC,
1989 NULL,
1990 0x0,
1991 NULL, HFILL
1995 &hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen,
1997 "V.42bis maximum string length",
1998 "sprt.payload.msg_xidxchg.xidlr5_v42bis_max_strlen",
1999 FT_UINT8,
2000 BASE_DEC,
2001 NULL,
2002 0x0,
2003 NULL, HFILL
2007 &hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability,
2009 "V.44 capability",
2010 "sprt.payload.msg_xidxchg.xidlr6_v44_capability",
2011 FT_UINT8,
2012 BASE_DEC,
2013 NULL,
2014 0x0,
2015 NULL, HFILL
2019 &hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req,
2021 "V.44 data compression request",
2022 "sprt.payload.msg_xidxchg.xidlr7_v44_compr_req",
2023 FT_UINT8,
2024 BASE_DEC,
2025 NULL,
2026 0x0,
2027 NULL, HFILL
2031 &hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans,
2033 "V.44 number of codewords in transmit direction",
2034 "sprt.payload.msg_xidxchg.xidlr8and9_v44_num_codewords_trans",
2035 FT_UINT16,
2036 BASE_DEC,
2037 NULL,
2038 0x0,
2039 NULL, HFILL
2043 &hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv,
2045 "V.44 number of codewords in receive direction",
2046 "sprt.payload.msg_xidxchg.xidlr10and11_v44_num_codewords_recv",
2047 FT_UINT16,
2048 BASE_DEC,
2049 NULL,
2050 0x0,
2051 NULL, HFILL
2055 &hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans,
2057 "V.44 maximum string length in transmit direction",
2058 "sprt.payload.msg_xidxchg.xidlr12_v44_max_strlen_trans",
2059 FT_UINT8,
2060 BASE_DEC,
2061 NULL,
2062 0x0,
2063 NULL, HFILL
2067 &hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv,
2069 "V.44 maximum string length in receive direction",
2070 "sprt.payload.msg_xidxchg.xidlr13_v44_max_strlen_recv",
2071 FT_UINT8,
2072 BASE_DEC,
2073 NULL,
2074 0x0,
2075 NULL, HFILL
2079 &hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans,
2081 "V.44 length of history in transmit direction",
2082 "sprt.payload.msg_xidxchg.xidlr14and15_v44_history_len_trans",
2083 FT_UINT16,
2084 BASE_DEC,
2085 NULL,
2086 0x0,
2087 NULL, HFILL
2091 &hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv,
2093 "V.44 length of history in receive direction",
2094 "sprt.payload.msg_xidxchg.xidlr16and17_v44_history_len_recv",
2095 FT_UINT16,
2096 BASE_DEC,
2097 NULL,
2098 0x0,
2099 NULL, HFILL
2102 /* JM_INFO message */
2104 &hf_sprt_payload_msg_jminfo_category_data,
2106 "Category data",
2107 "sprt.payload.msg_jminfo.category_data",
2108 FT_UINT16,
2109 BASE_DEC,
2110 NULL,
2111 0xFFFF,
2112 NULL, HFILL
2116 &hf_sprt_payload_msg_jminfo_category_id,
2118 "Category ID",
2119 "sprt.payload.msg_jminfo.category_id",
2120 FT_UINT16,
2121 BASE_HEX,
2122 VALS(sprt_jm_info_cat_id_name),
2123 0xF000,
2124 NULL, HFILL
2128 &hf_sprt_payload_msg_jminfo_category_ext_info,
2130 "Unrecognized category data",
2131 "sprt.payload.msg_jminfo.category_ext_info",
2132 FT_UINT16,
2133 BASE_DEC,
2134 NULL,
2135 0x0FFF,
2136 NULL, HFILL
2140 &hf_sprt_payload_msg_jminfo_unk_category_info,
2142 "Category extension data",
2143 "sprt.payload.msg_jminfo.unk_category_info",
2144 FT_UINT16,
2145 BASE_DEC,
2146 NULL,
2147 0x0FFF,
2148 NULL, HFILL
2152 &hf_sprt_payload_msg_jminfo_category_leftover_bits,
2154 "Leftover bits", /* "Category info leftover bits", */
2155 "sprt.payload.msg_jminfo.category_leftover_bits",
2156 FT_UINT16,
2157 BASE_HEX,
2158 NULL,
2159 0x01FF,
2160 NULL, HFILL
2164 &hf_sprt_payload_msg_jminfo_call_function,
2166 "Call function",
2167 "sprt.payload.msg_jminfo.call_function",
2168 FT_UINT16,
2169 BASE_DEC,
2170 VALS(sprt_jminfo_tbc_call_funct_name),
2171 0x0E00,
2172 NULL, HFILL
2176 &hf_sprt_payload_msg_jminfo_mod_v34_duplex,
2178 "V.34 duplex",
2179 "sprt.payload.msg_jminfo.mod_v34_duplex",
2180 FT_BOOLEAN,
2182 TFS(&tfs_available_not_available),
2183 0x0800,
2184 NULL, HFILL
2188 &hf_sprt_payload_msg_jminfo_mod_v34_half_duplex,
2190 "V.34 half-duplex",
2191 "sprt.payload.msg_jminfo.mod_v34_half_duplex",
2192 FT_BOOLEAN,
2194 TFS(&tfs_available_not_available),
2195 0x0400,
2196 NULL, HFILL
2200 &hf_sprt_payload_msg_jminfo_mod_v32bis_v32,
2202 "V.32bis/V.32",
2203 "sprt.payload.msg_jminfo.mod_v32bis_v32",
2204 FT_BOOLEAN,
2206 TFS(&tfs_available_not_available),
2207 0x0200,
2208 NULL, HFILL
2212 &hf_sprt_payload_msg_jminfo_mod_v22bis_v22,
2214 "V.22bis/V.22",
2215 "sprt.payload.msg_jminfo.mod_v22bis_v22",
2216 FT_BOOLEAN,
2218 TFS(&tfs_available_not_available),
2219 0x0100,
2220 NULL, HFILL
2224 &hf_sprt_payload_msg_jminfo_mod_v17,
2226 "V.17",
2227 "sprt.payload.msg_jminfo.mod_v17",
2228 FT_BOOLEAN,
2230 TFS(&tfs_available_not_available),
2231 0x0080,
2232 NULL, HFILL
2236 &hf_sprt_payload_msg_jminfo_mod_v29_half_duplex,
2238 "V.29 half-duplex",
2239 "sprt.payload.msg_jminfo.mod_v29_half_duplex",
2240 FT_BOOLEAN,
2242 TFS(&tfs_available_not_available),
2243 0x0040,
2244 NULL, HFILL
2248 &hf_sprt_payload_msg_jminfo_mod_v27ter,
2250 "V.27ter",
2251 "sprt.payload.msg_jminfo.mod_v27ter",
2252 FT_BOOLEAN,
2254 TFS(&tfs_available_not_available),
2255 0x0020,
2256 NULL, HFILL
2260 &hf_sprt_payload_msg_jminfo_mod_v26ter,
2262 "V.26ter",
2263 "sprt.payload.msg_jminfo.mod_v26ter",
2264 FT_BOOLEAN,
2266 TFS(&tfs_available_not_available),
2267 0x0010,
2268 NULL, HFILL
2272 &hf_sprt_payload_msg_jminfo_mod_v26bis,
2274 "V.26bis",
2275 "sprt.payload.msg_jminfo.mod_v26bis",
2276 FT_BOOLEAN,
2278 TFS(&tfs_available_not_available),
2279 0x0008,
2280 NULL, HFILL
2284 &hf_sprt_payload_msg_jminfo_mod_v23_duplex,
2286 "V.23 duplex",
2287 "sprt.payload.msg_jminfo.mod_v23_duplex",
2288 FT_BOOLEAN,
2290 TFS(&tfs_available_not_available),
2291 0x0004,
2292 NULL, HFILL
2296 &hf_sprt_payload_msg_jminfo_mod_v23_half_duplex,
2298 "V.23 half-duplex",
2299 "sprt.payload.msg_jminfo.mod_v23_half_duplex",
2300 FT_BOOLEAN,
2302 TFS(&tfs_available_not_available),
2303 0x0002,
2304 NULL, HFILL
2308 &hf_sprt_payload_msg_jminfo_mod_v21,
2310 "V.21",
2311 "sprt.payload.msg_jminfo.mod_v21",
2312 FT_BOOLEAN,
2314 TFS(&tfs_available_not_available),
2315 0x0001,
2316 NULL, HFILL
2320 &hf_sprt_payload_msg_jminfo_protocols,
2322 "Protocols",
2323 "sprt.payload.msg_jminfo.protocols",
2324 FT_UINT16,
2325 BASE_DEC | BASE_RANGE_STRING,
2326 RVALS(sprt_jminfo_tbc_protocol_name),
2327 0x0E00,
2328 NULL, HFILL
2332 &hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell,
2334 "Call DCE is on a cellular connection",
2335 "sprt.payload.msg_jminfo.pstn_access_call_dce_cell",
2336 FT_BOOLEAN,
2338 NULL,
2339 0x0800,
2340 NULL, HFILL
2344 &hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell,
2346 "Answer DCE is on a cellular connection",
2347 "sprt.payload.msg_jminfo.pstn_access_answ_dce_cell",
2348 FT_BOOLEAN,
2350 NULL,
2351 0x0400,
2352 NULL, HFILL
2356 &hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net,
2358 "DCE is on a digital network connection",
2359 "sprt.payload.msg_jminfo.pstn_access_dce_on_digital_net",
2360 FT_BOOLEAN,
2362 NULL,
2363 0x0200,
2364 NULL, HFILL
2368 &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog,
2370 "V.90 or V.92 analog modem availability",
2371 "sprt.payload.msg_jminfo.pcm_modem_avail_v90_v92_analog",
2372 FT_BOOLEAN,
2374 TFS(&tfs_available_not_available),
2375 0x0800,
2376 NULL, HFILL
2380 &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital,
2382 "V.90 or V.92 digital modem availability",
2383 "sprt.payload.msg_jminfo.pcm_modem_avail_v90_v92_digital",
2384 FT_BOOLEAN,
2386 TFS(&tfs_available_not_available),
2387 0x0400,
2388 NULL, HFILL
2392 &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91,
2394 "V.91 modem availability",
2395 "sprt.payload.msg_jminfo.pcm_modem_avail_v91",
2396 FT_BOOLEAN,
2398 TFS(&tfs_available_not_available),
2399 0x0200,
2400 NULL, HFILL
2403 /* START_JM message has no additional fields */
2404 /* CONNECT message */
2406 &hf_sprt_payload_msg_connect_selmod,
2408 "Selected modulation",
2409 "sprt.payload.msg_connect.selmod",
2410 FT_UINT8,
2411 BASE_DEC | BASE_RANGE_STRING,
2412 RVALS(sprt_selmod_name),
2413 0xFC,
2414 NULL, HFILL
2418 &hf_sprt_payload_msg_connect_compr_dir,
2420 "Compression direction",
2421 "sprt.payload.msg_connect.compr_dir",
2422 FT_UINT8,
2423 BASE_DEC,
2424 VALS(sprt_comp_direction),
2425 0x03,
2426 NULL, HFILL
2430 &hf_sprt_payload_msg_connect_selected_compr,
2432 "Selected compression",
2433 "sprt.payload.msg_connect.selected_compr",
2434 FT_UINT8,
2435 BASE_DEC | BASE_RANGE_STRING,
2436 RVALS(sprt_selected_compr_name),
2437 0xF0,
2438 NULL, HFILL
2442 &hf_sprt_payload_msg_connect_selected_err_corr,
2444 "Selected error correction",
2445 "sprt.payload.msg_connect.selected_err_corr",
2446 FT_UINT8,
2447 BASE_DEC | BASE_RANGE_STRING,
2448 RVALS(sprt_selected_err_corr_name),
2449 0x0F,
2450 NULL, HFILL
2454 &hf_sprt_payload_msg_connect_tdsr,
2456 "Transmit data signalling rate (bits/sec)",
2457 "sprt.payload.msg_connect.tdsr",
2458 FT_UINT16,
2459 BASE_DEC,
2460 NULL,
2461 0x0,
2462 NULL, HFILL
2466 &hf_sprt_payload_msg_connect_rdsr,
2468 "Receive data signalling rate (bits/sec)",
2469 "sprt.payload.msg_connect.rdsr",
2470 FT_UINT16,
2471 BASE_DEC,
2472 NULL,
2473 0x0,
2474 NULL, HFILL
2478 &hf_sprt_payload_msg_connect_dlci_enabled,
2480 "DLCI",
2481 "sprt.payload.msg_connect.dlci_enabled",
2482 FT_BOOLEAN,
2484 TFS(&tfs_enabled_disabled),
2485 0x8000,
2486 NULL, HFILL
2490 &hf_sprt_payload_msg_connect_avail_data_types,
2492 "Available data types",
2493 "sprt.payload.msg_connect.avail_data_types",
2494 FT_UINT16,
2495 BASE_HEX,
2496 NULL,
2497 0x7FFF,
2498 NULL, HFILL
2502 &hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci,
2504 "Octet w/o formatting with no DLCI",
2505 "sprt.payload.msg_connect.adt_octet_no_format_no_dlci",
2506 FT_BOOLEAN,
2508 TFS(&tfs_available_not_available),
2509 0x4000,
2510 NULL, HFILL
2514 &hf_sprt_payload_msg_connect_adt_i_raw_bit,
2516 "I_RAW-BIT",
2517 "sprt.payload.msg_connect.adt_i_raw_bit",
2518 FT_BOOLEAN,
2520 TFS(&tfs_available_not_available),
2521 0x2000,
2522 NULL, HFILL
2526 &hf_sprt_payload_msg_connect_adt_i_frame,
2528 "I_FRAME",
2529 "sprt.payload.msg_connect.adt_i_frame",
2530 FT_BOOLEAN,
2532 TFS(&tfs_available_not_available),
2533 0x1000,
2534 NULL, HFILL
2538 &hf_sprt_payload_msg_connect_adt_i_char_stat,
2540 "I_CHAR-STAT",
2541 "sprt.payload.msg_connect.adt_i_char_stat",
2542 FT_BOOLEAN,
2544 TFS(&tfs_available_not_available),
2545 0x0800,
2546 NULL, HFILL
2550 &hf_sprt_payload_msg_connect_adt_i_char_dyn,
2552 "I_CHAR-DYN",
2553 "sprt.payload.msg_connect.adt_i_char_dyn",
2554 FT_BOOLEAN,
2556 TFS(&tfs_available_not_available),
2557 0x0400,
2558 NULL, HFILL
2561 { /* from V.150.1 amendment 2 (5-2006): */
2562 &hf_sprt_payload_msg_connect_adt_i_octet_cs,
2564 "I_OCTET-CS",
2565 "sprt.payload.msg_connect.adt_i_octet_cs",
2566 FT_BOOLEAN,
2568 TFS(&tfs_available_not_available),
2569 0x0200,
2570 NULL, HFILL
2573 { /* from V.150.1 amendment 2 (5-2006): */
2574 &hf_sprt_payload_msg_connect_adt_i_char_stat_cs,
2576 "I_CHAR-STAT-CS",
2577 "sprt.payload.msg_connect.adt_i_char_stat_cs",
2578 FT_BOOLEAN,
2580 TFS(&tfs_available_not_available),
2581 0x0100,
2582 NULL, HFILL
2585 { /* from V.150.1 amendment 2 (5-2006): */
2586 &hf_sprt_payload_msg_connect_adt_i_char_dyn_cs,
2588 "I_CHAR-DYN-CS",
2589 "sprt.payload.msg_connect.adt_i_char_dyn_cs",
2590 FT_BOOLEAN,
2592 TFS(&tfs_available_not_available),
2593 0x0080,
2594 NULL, HFILL
2598 &hf_sprt_payload_msg_connect_adt_reserved,
2600 "Reserved for ITU-T",
2601 "sprt.payload.msg_connect.adt_reserved",
2602 FT_UINT16,
2603 BASE_HEX,
2604 NULL,
2605 0x007F,
2606 NULL, HFILL
2610 &hf_sprt_payload_msg_connect_compr_trans_dict_sz,
2612 "Compression transmit dictionary size",
2613 "sprt.payload.msg_connect.compr_trans_dict_sz",
2614 FT_UINT16,
2615 BASE_DEC,
2616 NULL,
2617 0x0,
2618 NULL, HFILL
2622 &hf_sprt_payload_msg_connect_compr_recv_dict_sz,
2624 "Compression receive dictionary size",
2625 "sprt.payload.msg_connect.compr_recv_dict_sz",
2626 FT_UINT16,
2627 BASE_DEC,
2628 NULL,
2629 0x0,
2630 NULL, HFILL
2634 &hf_sprt_payload_msg_connect_compr_trans_str_len,
2636 "Compression transmit string length",
2637 "sprt.payload.msg_connect.compr_trans_str_len",
2638 FT_UINT8,
2639 BASE_DEC,
2640 NULL,
2641 0x0,
2642 NULL, HFILL
2646 &hf_sprt_payload_msg_connect_compr_recv_str_len,
2648 "Compression receive string length",
2649 "sprt.payload.msg_connect.compr_recv_str_len",
2650 FT_UINT8,
2651 BASE_DEC,
2652 NULL,
2653 0x0,
2654 NULL, HFILL
2658 &hf_sprt_payload_msg_connect_compr_trans_hist_sz,
2660 "Compression transmit history size",
2661 "sprt.payload.msg_connect.compr_trans_hist_sz",
2662 FT_UINT16,
2663 BASE_DEC,
2664 NULL,
2665 0x0,
2666 NULL, HFILL
2670 &hf_sprt_payload_msg_connect_compr_recv_hist_sz,
2672 "Compression receive history size",
2673 "sprt.payload.msg_connect.compr_recv_hist_sz",
2674 FT_UINT16,
2675 BASE_DEC,
2676 NULL,
2677 0x0,
2678 NULL, HFILL
2681 /* BREAK message */
2683 &hf_sprt_payload_msg_break_source_proto,
2685 "Break source protocol",
2686 "sprt.payload.msg_break.source_proto",
2687 FT_UINT8,
2688 BASE_DEC | BASE_RANGE_STRING,
2689 RVALS(sprt_break_src_proto_name),
2690 0xF0,
2691 NULL, HFILL
2695 &hf_sprt_payload_msg_break_type,
2697 "Break type",
2698 "sprt.payload.msg_break.type",
2699 FT_UINT8,
2700 BASE_DEC | BASE_RANGE_STRING,
2701 RVALS(sprt_break_type_name),
2702 0x0F,
2703 NULL, HFILL
2707 &hf_sprt_payload_msg_break_length,
2709 "Break length (x10 msec)",
2710 "sprt.payload.msg_break.length",
2711 FT_UINT8,
2712 BASE_DEC,
2713 NULL,
2714 0x0,
2715 NULL, HFILL
2718 /* BREAK_ACK message has no additional fields */
2719 /* MR_EVENT message */
2721 &hf_sprt_payload_msg_mr_event_id,
2723 "Modem relay event ID",
2724 "sprt.payload.msg_mr_event.id",
2725 FT_UINT8,
2726 BASE_DEC | BASE_RANGE_STRING,
2727 RVALS(sprt_mrevent_id_name),
2728 0x0,
2729 NULL, HFILL
2733 &hf_sprt_payload_msg_mr_evt_reason_code,
2735 "Reason code",
2736 "sprt.payload.msg_mr_event.reason_code",
2737 FT_UINT8,
2738 BASE_DEC | BASE_RANGE_STRING,
2739 RVALS(sprt_mrevent_reason_code_name),
2740 0x0,
2741 NULL, HFILL
2745 &hf_sprt_payload_msg_mr_evt_selmod,
2747 "Selected modulation",
2748 "sprt.payload.msg_mr_event.selmod",
2749 FT_UINT8,
2750 BASE_DEC | BASE_RANGE_STRING,
2751 RVALS(sprt_selmod_name),
2752 0xFC,
2753 NULL, HFILL
2757 &hf_sprt_payload_msg_mr_evt_txsen,
2759 "TxSEN",
2760 "sprt.payload.msg_mr_event.txsen",
2761 FT_BOOLEAN,
2763 TFS(&tfs_enabled_disabled),
2764 0x02,
2765 NULL, HFILL
2769 &hf_sprt_payload_msg_mr_evt_rxsen,
2771 "RxSEN",
2772 "sprt.payload.msg_mr_event.rxsen",
2773 FT_BOOLEAN,
2775 TFS(&tfs_enabled_disabled),
2776 0x01,
2777 NULL, HFILL
2781 &hf_sprt_payload_msg_mr_evt_tdsr,
2783 "Transmit data signalling rate (bits/sec)",
2784 "sprt.payload.msg_mr_event.tdsr",
2785 FT_UINT16,
2786 BASE_DEC,
2787 NULL,
2788 0x0,
2789 NULL, HFILL
2793 &hf_sprt_payload_msg_mr_evt_rdsr,
2795 "Receive data signalling rate (bits/sec)",
2796 "sprt.payload.msg_mr_event.rdsr",
2797 FT_UINT16,
2798 BASE_DEC,
2799 NULL,
2800 0x0,
2801 NULL, HFILL
2805 &hf_sprt_payload_msg_mr_evt_txsr,
2807 "Physical layer transmitter symbol rate (TxSR)",
2808 "sprt.payload.msg_mr_event.txsr",
2809 FT_UINT8,
2810 BASE_DEC | BASE_RANGE_STRING,
2811 RVALS(sprt_mrevent_phys_layer_symbol_rate),
2812 0x0,
2813 NULL, HFILL
2817 &hf_sprt_payload_msg_mr_evt_rxsr,
2819 "Physical layer receiver symbol rate (RxSR)",
2820 "sprt.payload.msg_mr_event.rxsr",
2821 FT_UINT8,
2822 BASE_DEC | BASE_RANGE_STRING,
2823 RVALS(sprt_mrevent_phys_layer_symbol_rate),
2824 0x0,
2825 NULL, HFILL
2828 /* CLEARDOWN message */
2830 &hf_sprt_payload_msg_cleardown_reason_code,
2832 "Reason code",
2833 "sprt.payload.msg_cleardown.reason_code",
2834 FT_UINT8,
2835 BASE_DEC,
2836 VALS(sprt_cleardown_reason),
2837 0x0,
2838 NULL, HFILL
2842 &hf_sprt_payload_msg_cleardown_vendor_tag,
2844 "Vendor tag",
2845 "sprt.payload.msg_cleardown.vendor_tag",
2846 FT_UINT8,
2847 BASE_DEC,
2848 NULL,
2849 0x0,
2850 NULL, HFILL
2854 &hf_sprt_payload_msg_cleardown_vendor_info,
2856 "Vendor info",
2857 "sprt.payload.msg_cleardown.vendor_info",
2858 FT_UINT8,
2859 BASE_DEC,
2860 NULL,
2861 0x0,
2862 NULL, HFILL
2865 /* PROF_XCHG message */
2867 &hf_sprt_payload_msg_profxchg_v42_lapm,
2869 "V.42/LAPM protocol support",
2870 "sprt.payload.msg_profxchg.v42_lapm",
2871 FT_UINT8,
2872 BASE_DEC,
2873 VALS(sprt_prof_xchg_support),
2874 0xC0,
2875 NULL, HFILL
2879 &hf_sprt_payload_msg_profxchg_annex_av42,
2881 "Annex A/V.42(1996) protocol support",
2882 "sprt.payload.msg_profxchg.annex_av42",
2883 FT_UINT8,
2884 BASE_DEC,
2885 VALS(sprt_prof_xchg_support),
2886 0x30,
2887 NULL, HFILL
2891 &hf_sprt_payload_msg_profxchg_v44_compr,
2893 "V.44 compression support",
2894 "sprt.payload.msg_profxchg.v44_compr",
2895 FT_UINT8,
2896 BASE_DEC,
2897 VALS(sprt_prof_xchg_support),
2898 0x0C,
2899 NULL, HFILL
2903 &hf_sprt_payload_msg_profxchg_v42bis_compr,
2905 "V.42bis compression support",
2906 "sprt.payload.msg_profxchg.v42bis_compr",
2907 FT_UINT8,
2908 BASE_DEC,
2909 VALS(sprt_prof_xchg_support),
2910 0x03,
2911 NULL, HFILL
2915 &hf_sprt_payload_msg_profxchg_mnp5_compr,
2917 "MNP5 compression support",
2918 "sprt.payload.msg_profxchg.mnp5_compr",
2919 FT_UINT8,
2920 BASE_DEC,
2921 VALS(sprt_prof_xchg_support),
2922 0xC0,
2923 NULL, HFILL
2927 &hf_sprt_payload_msg_profxchg_reserved,
2929 "Reserved for ITU-T",
2930 "sprt.payload.msg_profxchg.reserved",
2931 FT_UINT8,
2932 BASE_HEX,
2933 NULL,
2934 0x3F,
2935 NULL, HFILL
2939 &hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req,
2941 "V.42bis data compression request",
2942 "sprt.payload.msg_profxchg.xidlr2_v42bis_compr_req",
2943 FT_UINT8,
2944 BASE_DEC,
2945 NULL,
2946 0x0,
2947 NULL, HFILL
2951 &hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords,
2953 "V.42bis number of codewords",
2954 "sprt.payload.msg_profxchg.xidlr3and4_v42bis_num_codewords",
2955 FT_UINT16,
2956 BASE_DEC,
2957 NULL,
2958 0x0,
2959 NULL, HFILL
2963 &hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen,
2965 "V.42bis maximum string length",
2966 "sprt.payload.msg_profxchg.xidlr5_v42bis_max_strlen",
2967 FT_UINT8,
2968 BASE_DEC,
2969 NULL,
2970 0x0,
2971 NULL, HFILL
2975 &hf_sprt_payload_msg_profxchg_xidlr6_v44_capability,
2977 "V.44 capability",
2978 "sprt.payload.msg_profxchg.xidlr6_v44_capability",
2979 FT_UINT8,
2980 BASE_DEC,
2981 NULL,
2982 0x0,
2983 NULL, HFILL
2987 &hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req,
2989 "V.44 data compression request",
2990 "sprt.payload.msg_profxchg.xidlr7_v44_compr_req",
2991 FT_UINT8,
2992 BASE_DEC,
2993 NULL,
2994 0x0,
2995 NULL, HFILL
2999 &hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans,
3001 "V.44 number of codewords in transmit direction",
3002 "sprt.payload.msg_profxchg.xidlr8and9_v44_num_codewords_trans",
3003 FT_UINT16,
3004 BASE_DEC,
3005 NULL,
3006 0x0,
3007 NULL, HFILL
3011 &hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv,
3013 "V.44 number of codewords in receive direction",
3014 "sprt.payload.msg_profxchg.xidlr10and11_v44_num_codewords_recv",
3015 FT_UINT16,
3016 BASE_DEC,
3017 NULL,
3018 0x0,
3019 NULL, HFILL
3023 &hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans,
3025 "V.44 maximum string length in transmit direction",
3026 "sprt.payload.msg_profxchg.xidlr12_v44_max_strlen_trans",
3027 FT_UINT8,
3028 BASE_DEC,
3029 NULL,
3030 0x0,
3031 NULL, HFILL
3035 &hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv,
3037 "V.44 maximum string length in receive direction",
3038 "sprt.payload.msg_profxchg.xidlr13_v44_max_strlen_recv",
3039 FT_UINT8,
3040 BASE_DEC,
3041 NULL,
3042 0x0,
3043 NULL, HFILL
3047 &hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans,
3049 "V.44 length of history in transmit direction",
3050 "sprt.payload.msg_profxchg.xidlr14and15_v44_history_len_trans",
3051 FT_UINT16,
3052 BASE_DEC,
3053 NULL,
3054 0x0,
3055 NULL, HFILL
3059 &hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv,
3061 "V.44 length of history in receive direction",
3062 "sprt.payload.msg_profxchg.xidlr16and17_v44_history_len_recv",
3063 FT_UINT16,
3064 BASE_DEC,
3065 NULL,
3066 0x0,
3067 NULL, HFILL
3070 /* User data messages... */
3071 /* I_OCTET message: need to use DLCI field (8 or 16 bits) if indicated by CONNECT message */
3073 &hf_sprt_payload_i_octet_no_dlci,
3075 "No DLCI field",
3076 "sprt.payload.i_octet_no_dlci",
3077 FT_NONE,
3078 BASE_NONE,
3079 NULL,
3080 0x0,
3081 NULL, HFILL
3085 &hf_sprt_payload_i_octet_dlci_presence_unknown,
3087 "Not known if DLCI field is present",
3088 "sprt.payload.i_octet_dlci_presence_unknown",
3089 FT_NONE,
3090 BASE_NONE,
3091 NULL,
3092 0x0,
3093 NULL, HFILL
3097 &hf_sprt_payload_i_octet_dlci1,
3099 "DLCI #1",
3100 "sprt.payload.i_octet_dlci1",
3101 FT_UINT8,
3102 BASE_DEC | BASE_RANGE_STRING,
3103 RVALS(sprt_payload_dlci1),
3104 0xFC,
3105 NULL, HFILL
3109 &hf_sprt_payload_i_octet_cr,
3111 "Command/response bit",
3112 "sprt.payload.i_octet_cr",
3113 FT_BOOLEAN,
3115 NULL,
3116 0x02,
3117 NULL, HFILL
3121 &hf_sprt_payload_i_octet_ea,
3123 "Address field extension bit",
3124 "sprt.payload.i_octet_ea",
3125 FT_BOOLEAN,
3127 TFS(&sprt_payload_ea_bit),
3128 0x01,
3129 NULL, HFILL
3133 &hf_sprt_payload_i_octet_dlci2,
3135 "DLCI #2",
3136 "sprt.payload.i_octet_dlci2",
3137 FT_UINT8,
3138 BASE_DEC | BASE_RANGE_STRING,
3139 RVALS(sprt_payload_dlci2),
3140 0xFE,
3141 NULL, HFILL
3145 &hf_sprt_payload_i_octet_dlci_setup_by_connect_frame,
3147 "DLCI setup by CONNECT message at frame",
3148 "sprt.payload.i_octet_dlci_setup_by_connect_frame",
3149 FT_FRAMENUM,
3150 BASE_NONE,
3151 NULL,
3152 0x0,
3153 NULL, HFILL
3156 /* fields for I_RAW_OCTET message (L; L,N) */
3158 &hf_sprt_payload_rawoctet_n_field_present,
3160 "N field",
3161 "sprt.payload.rawoctet_n_field_present",
3162 FT_BOOLEAN,
3164 TFS(&tfs_present_absent),
3165 0x80,
3166 NULL, HFILL
3170 &hf_sprt_payload_rawoctet_l,
3172 "L: # of octets in segment minus one",
3173 "sprt.payload.rawoctet_l",
3174 FT_UINT8,
3175 BASE_DEC,
3176 NULL,
3177 0x7F,
3178 NULL, HFILL
3182 &hf_sprt_payload_rawoctet_n,
3184 "N: # of times octets appear in data minus 2",
3185 "sprt.payload.rawoctet_n",
3186 FT_UINT8,
3187 BASE_DEC,
3188 NULL,
3189 0xFF,
3190 NULL, HFILL
3193 /* fields for I_RAW_BIT (L; L,P; L,P,N) */
3195 &hf_sprt_payload_rawbit_included_fields_l,
3197 "Include field L only",
3198 "sprt.payload.rawbit_included_fields_l",
3199 FT_UINT8,
3200 BASE_DEC,
3201 NULL,
3202 0xC0, /* top two bits: 00 */
3203 NULL, HFILL
3207 &hf_sprt_payload_rawbit_included_fields_lp,
3209 "Include fields L, P",
3210 "sprt.payload.rawbit_field_format_lp",
3211 FT_UINT8,
3212 BASE_DEC,
3213 NULL,
3214 0xC0, /* top two bits: 01 */
3215 NULL, HFILL
3219 &hf_sprt_payload_rawbit_included_fields_lpn,
3221 "Include fields L, P, N",
3222 "sprt.payload.rawbit_included_fields_lpn",
3223 FT_UINT8,
3224 BASE_DEC,
3225 NULL,
3226 0x80, /* top bit: 1 */
3227 NULL, HFILL
3231 &hf_sprt_payload_rawbit_len_a,
3233 "L: # of octets in segment",
3234 "sprt.payload.rawbit_len_a",
3235 FT_UINT8,
3236 BASE_DEC,
3237 NULL,
3238 0x3F, /* six bits */
3239 NULL, HFILL
3243 &hf_sprt_payload_rawbit_len_b,
3245 "L: # of octets in segment",
3246 "sprt.payload.rawbit_len_b",
3247 FT_UINT8,
3248 BASE_DEC,
3249 NULL,
3250 0x38, /* three bits */
3251 NULL, HFILL
3255 &hf_sprt_payload_rawbit_len_c,
3257 "L: # of octets in segment",
3258 "sprt.payload.rawbit_len_c",
3259 FT_UINT8,
3260 BASE_DEC,
3261 NULL,
3262 0x78, /* four bits */
3263 NULL, HFILL
3267 &hf_sprt_payload_rawbit_p,
3269 "P: # of low-order bits in last octet that are not in segment",
3270 "sprt.payload.rawbit_p",
3271 FT_UINT8,
3272 BASE_DEC,
3273 NULL,
3274 0x7, /* three bits */
3275 NULL, HFILL
3279 &hf_sprt_payload_rawbit_n,
3281 "N: # of times octets appear in data minus 2",
3282 "sprt.payload.rawbit_n",
3283 FT_UINT8,
3284 BASE_DEC,
3285 NULL,
3286 0xFF, /* eight bits */
3287 NULL, HFILL
3290 /* fields in I_CHAR_STAT & I_CHAR_DYN messages */
3292 &hf_sprt_payload_data_reserved_bit,
3294 "Reserved bit",
3295 "sprt.payload.reserved_bit",
3296 FT_BOOLEAN,
3298 TFS(&tfs_set_notset),
3299 0x80,
3300 NULL, HFILL
3304 &hf_sprt_payload_data_num_data_bits,
3306 "D: Number of data bits",
3307 "sprt.payload.num_data_bits",
3308 FT_UINT8,
3309 BASE_DEC,
3310 VALS(sprt_payload_data_bits),
3311 0x60,
3312 NULL, HFILL
3316 &hf_sprt_payload_data_parity_type,
3318 "P: Parity type",
3319 "sprt.payload.parity_type",
3320 FT_UINT8,
3321 BASE_DEC,
3322 VALS(sprt_payload_parity),
3323 0x1C,
3324 NULL, HFILL
3328 &hf_sprt_payload_num_stop_bits,
3330 "S: Number stop bits",
3331 "sprt.payload.num_stop_bits",
3332 FT_UINT8,
3333 BASE_DEC,
3334 VALS(sprt_payload_stop_bits),
3335 0x03,
3336 NULL, HFILL
3339 /* sequence field in I_OCTET_CS, I_CHAR_STAT_CS, & I_CHAR_DYN_CS messages */
3341 &hf_sprt_payload_data_cs,
3343 "Character sequence number",
3344 "sprt.payload.cs",
3345 FT_UINT16,
3346 BASE_DEC,
3347 NULL,
3348 0x0,
3349 NULL, HFILL
3352 /* fields for I_FRAME: */
3354 &hf_sprt_payload_frame_reserved_bits,
3356 "Reserved bits",
3357 "sprt.payload.frame_reserved_bits",
3358 FT_UINT8,
3359 BASE_HEX,
3360 NULL,
3361 0xFC,
3362 NULL, HFILL
3366 &hf_sprt_payload_frame_state,
3368 "Frame state",
3369 "sprt.payload.frame_state",
3370 FT_UINT8,
3371 BASE_DEC,
3372 VALS(sprt_payload_frame_state),
3373 0x03,
3374 NULL, HFILL
3377 /* just dump remaining payload data: */
3379 &hf_sprt_payload_data,
3381 "Payload data",
3382 "sprt.payload.data",
3383 FT_BYTES,
3384 BASE_NONE,
3385 NULL,
3386 0x0,
3387 NULL, HFILL
3390 }; /* hf_register_info hf[] */
3392 /* setup protocol subtree array */
3393 static int *ett[] = {
3394 &ett_sprt,
3395 &ett_sprt_setup,
3396 &ett_sprt_ack_fields,
3397 &ett_payload,
3398 &ett_init_msg_all_fields,
3399 &ett_jminfo_msg_cat_data,
3400 &ett_connect_msg_adt
3403 static ei_register_info ei[] = {
3404 { &ei_sprt_sequence_number_0, { "sprt.sequence_number_0", PI_PROTOCOL, PI_WARN, "Should be 0 for transport channel 0", EXPFILL }},
3407 /* register protocol name & description */
3408 proto_sprt = proto_register_protocol("Simple Packet Relay Transport", "SPRT", "sprt");
3410 /* required function calls to register the header fields and subtrees used */
3411 proto_register_field_array(proto_sprt, hf, array_length(hf));
3412 proto_register_subtree_array(ett, array_length(ett));
3413 expert_sprt = expert_register_protocol(proto_sprt);
3414 expert_register_field_array(expert_sprt, ei, array_length(ei));
3416 /* register the dissector */
3417 sprt_handle = register_dissector("sprt", dissect_sprt, proto_sprt);
3419 sprt_module = prefs_register_protocol(proto_sprt, NULL);
3421 /* preferences */
3422 prefs_register_bool_preference(sprt_module, "show_setup_info",
3423 "Show stream setup information",
3424 "Where available, show which protocol and frame caused "
3425 "this SPRT stream to be created",
3426 &global_sprt_show_setup_info);
3427 prefs_register_bool_preference(sprt_module, "show_dlci_info",
3428 "Show DLCI in I_OCTET messages",
3429 "Show the DLCI field in I_OCTET messages as well as the frame that "
3430 "enabled/disabled the DLCI",
3431 &global_sprt_show_dlci_info);
3435 void
3436 proto_reg_handoff_sprt(void)
3438 rtp_handle = find_dissector_add_dependency("rtp", proto_sprt);
3440 dissector_add_for_decode_as_with_preference("udp.port", sprt_handle);
3442 heur_dissector_add( "udp", dissect_sprt_heur, "SPRT over UDP", "sprt_udp", proto_sprt, HEURISTIC_ENABLE);
3446 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3448 * Local variables:
3449 * c-basic-offset: 4
3450 * tab-width: 8
3451 * indent-tabs-mode: nil
3452 * End:
3454 * vi: set shiftwidth=4 tabstop=8 expandtab:
3455 * :indentSize=4:tabSize=8:noTabs=true: