Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-t38.c
Warning:line 399, column 12
Potential leak of memory pointed to by 'data'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name packet-t38.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-22/lib/clang/22 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /builds/wireshark/wireshark/epan/dissectors -isystem /builds/wireshark/wireshark/build/epan/dissectors -isystem /usr/include/mit-krb5 -isystem /builds/wireshark/wireshark/epan -isystem /usr/include/libxml2 -D CARES_NO_DEPRECATED -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu17 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /builds/wireshark/wireshark/sbout/2026-12-04-100315-3660-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-t38.c
1/* Do not modify this file. Changes will be overwritten. */
2/* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3/* packet-t38.c */
4/* asn2wrs.py -q -L -p t38 -c ./t38.cnf -s ./packet-t38-template -D . -O ../.. T38_2002.asn */
5
6/* packet-t38.c
7 * Routines for T.38 packet dissection
8 * 2003 Hans Viens
9 * 2004 Alejandro Vaquero, add support Conversations for SDP
10 * 2006 Alejandro Vaquero, add T30 reassemble and dissection
11 *
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
15 *
16 * SPDX-License-Identifier: GPL-2.0-or-later
17 */
18
19
20/* Depending on what ASN.1 specification is used you may have to change
21 * the preference setting regarding Pre-Corrigendum ASN.1 specification:
22 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/1998/T38.html (Pre-Corrigendum=true)
23 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(1998).html (Pre-Corrigendum=true)
24 *
25 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(2002).html (Pre-Corrigendum=false)
26 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002/t38.html (Pre-Corrigendum=false)
27 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002-Amd1/T38.html (Pre-Corrigendum=false)
28 */
29
30/* TO DO:
31 * - TCP desegmentation is currently not supported for T.38 IFP directly over TCP.
32 * - H.245 dissectors should be updated to start conversations for T.38 similar to RTP.
33 * - Sometimes the last octet is not high-lighted when selecting something in the tree. Bug in PER dissector?
34 * - Add support for RTP payload audio/t38 (draft-jones-avt-audio-t38-03.txt), i.e. T38 in RTP packets.
35 */
36
37
38#include "config.h"
39
40#include <epan/packet.h>
41#include <epan/reassemble.h>
42#include <epan/conversation.h>
43#include <epan/tap.h>
44#include <epan/expert.h>
45#include <epan/strutil.h>
46#include <epan/prefs.h>
47#include <epan/asn1.h>
48#include <epan/proto_data.h>
49#include <wsutil/array.h>
50#include <epan/iana-info.h>
51
52#include "packet-t38.h"
53#include "packet-per.h"
54#include "packet-tpkt.h"
55#include "packet-acdr.h"
56
57void proto_register_t38(void);
58
59static int t38_tap;
60
61/* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
62static bool_Bool use_pre_corrigendum_asn1_specification = true1;
63
64/* dissect packets that looks like RTP version 2 packets as RTP */
65/* instead of as T.38. This may result in that some T.38 UPTL */
66/* packets with sequence number values higher than 32767 may be */
67/* shown as RTP packets. */
68static bool_Bool dissect_possible_rtpv2_packets_as_rtp;
69
70
71/* Reassembly of T.38 PDUs over TPKT over TCP */
72static bool_Bool t38_tpkt_reassembly = true1;
73
74/* Preference setting whether TPKT header is used when sending T.38 over TCP.
75 * The default setting is Maybe where the dissector will look on the first
76 * bytes to try to determine whether TPKT header is used or not. This may not
77 * work so well in some cases. You may want to change the setting to Always or
78 * Newer.
79 */
80#define T38_TPKT_NEVER0 0 /* Assume that there is never a TPKT header */
81#define T38_TPKT_ALWAYS1 1 /* Assume that there is always a TPKT header */
82#define T38_TPKT_MAYBE2 2 /* Assume TPKT if first octets are 03-00-xx-xx */
83static int t38_tpkt_usage = T38_TPKT_MAYBE2;
84
85static const enum_val_t t38_tpkt_options[] = {
86 {"never", "Never", T38_TPKT_NEVER0},
87 {"always", "Always", T38_TPKT_ALWAYS1},
88 {"maybe", "Maybe", T38_TPKT_MAYBE2},
89 {NULL((void*)0), NULL((void*)0), -1}
90};
91
92
93
94/* T38 */
95static dissector_handle_t t38_udp_handle;
96static dissector_handle_t t38_tcp_handle;
97static dissector_handle_t t38_tcp_pdu_handle;
98static dissector_handle_t rtp_handle;
99static dissector_handle_t t30_hdlc_handle;
100static dissector_handle_t data_handle;
101
102static int32_t Type_of_msg_value;
103static uint32_t Data_Field_field_type_value;
104static uint32_t Data_value;
105static uint32_t T30ind_value;
106static uint32_t Data_Field_item_num;
107
108static int proto_t38;
109static int proto_acdr;
110static int hf_t38_IFPPacket_PDU; /* IFPPacket */
111static int hf_t38_UDPTLPacket_PDU; /* UDPTLPacket */
112static int hf_t38_type_of_msg; /* Type_of_msg */
113static int hf_t38_data_field; /* Data_Field */
114static int hf_t38_t30_indicator; /* T30_indicator */
115static int hf_t38_t30_data; /* T30_data */
116static int hf_t38_Data_Field_item; /* Data_Field_item */
117static int hf_t38_field_type; /* T_field_type */
118static int hf_t38_field_data; /* T_field_data */
119static int hf_t38_seq_number; /* T_seq_number */
120static int hf_t38_primary_ifp_packet; /* T_primary_ifp_packet */
121static int hf_t38_error_recovery; /* T_error_recovery */
122static int hf_t38_secondary_ifp_packets; /* T_secondary_ifp_packets */
123static int hf_t38_secondary_ifp_packets_item; /* OpenType_IFPPacket */
124static int hf_t38_fec_info; /* T_fec_info */
125static int hf_t38_fec_npackets; /* INTEGER */
126static int hf_t38_fec_data; /* T_fec_data */
127static int hf_t38_fec_data_item; /* OCTET_STRING */
128
129/* T38 setup fields */
130static int hf_t38_setup;
131static int hf_t38_setup_frame;
132static int hf_t38_setup_method;
133
134/* T38 Data reassemble fields */
135static int hf_t38_fragments;
136static int hf_t38_fragment;
137static int hf_t38_fragment_overlap;
138static int hf_t38_fragment_overlap_conflicts;
139static int hf_t38_fragment_multiple_tails;
140static int hf_t38_fragment_too_long_fragment;
141static int hf_t38_fragment_error;
142static int hf_t38_fragment_count;
143static int hf_t38_reassembled_in;
144static int hf_t38_reassembled_length;
145
146static int ett_t38;
147static int ett_t38_IFPPacket;
148static int ett_t38_Type_of_msg;
149static int ett_t38_Data_Field;
150static int ett_t38_Data_Field_item;
151static int ett_t38_UDPTLPacket;
152static int ett_t38_T_error_recovery;
153static int ett_t38_T_secondary_ifp_packets;
154static int ett_t38_T_fec_info;
155static int ett_t38_T_fec_data;
156static int ett_t38_setup;
157
158static int ett_data_fragment;
159static int ett_data_fragments;
160
161static expert_field ei_t38_malformed;
162
163static bool_Bool primary_part = true1;
164static uint32_t seq_number;
165
166/* One-up counter for the reassembly IDs, assigned on the first pass */
167static uint32_t t38_reass_id_counter;
168
169static void
170t38_init_routine(void)
171{
172 t38_reass_id_counter = 0;
173}
174
175/* Tables for reassembly of Data fragments. */
176static reassembly_table data_reassembly_table;
177
178static const fragment_items data_frag_items = {
179 /* Fragment subtrees */
180 &ett_data_fragment,
181 &ett_data_fragments,
182 /* Fragment fields */
183 &hf_t38_fragments,
184 &hf_t38_fragment,
185 &hf_t38_fragment_overlap,
186 &hf_t38_fragment_overlap_conflicts,
187 &hf_t38_fragment_multiple_tails,
188 &hf_t38_fragment_too_long_fragment,
189 &hf_t38_fragment_error,
190 &hf_t38_fragment_count,
191 /* Reassembled in field */
192 &hf_t38_reassembled_in,
193 /* Reassembled length field */
194 &hf_t38_reassembled_length,
195 /* Reassembled data field */
196 NULL((void*)0),
197 /* Tag */
198 "Data fragments"
199};
200
201typedef struct _fragment_key {
202 address src;
203 address dst;
204 uint32_t id;
205} fragment_key;
206
207static conversation_t *p_conv;
208static t38_conv *p_t38_conv;
209static t38_conv *p_t38_packet_conv;
210static t38_conv_info *p_t38_conv_info;
211static t38_conv_info *p_t38_packet_conv_info;
212
213/* RTP Version is the first 2 bits of the first octet in the UDP payload*/
214#define RTP_VERSION(octet)((octet) >> 6) ((octet) >> 6)
215
216void proto_reg_handoff_t38(void);
217
218static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
219/* Preferences bool to control whether or not setup info should be shown */
220static bool_Bool global_t38_show_setup_info = true1;
221
222/* Can tap up to 4 T38 packets within same packet */
223/* We only tap the primary part, not the redundancy */
224#define MAX_T38_MESSAGES_IN_PACKET4 4
225static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET4];
226static int t38_info_current=0;
227static t38_packet_info *t38_info;
228
229
230/* Set up an T38 conversation */
231void t38_add_address(packet_info *pinfo,
232 address *addr, int port,
233 int other_port,
234 const char *setup_method, uint32_t setup_frame_number)
235{
236 address null_addr;
237 conversation_t* p_conversation;
238 t38_conv* p_conversation_data = NULL((void*)0);
239
240 /*
241 * If this isn't the first time this packet has been processed,
242 * we've already done this work, so we don't need to do it
243 * again.
244 */
245 if ((pinfo->fd->visited) || (t38_udp_handle == NULL((void*)0)))
246 {
247 return;
248 }
249
250 clear_address(&null_addr);
251
252 /*
253 * Check if the ip address and port combination is not
254 * already registered as a conversation.
255 */
256 p_conversation = find_conversation_strat_xtd(pinfo, setup_frame_number, addr, &null_addr, CONVERSATION_UDP, port, other_port,
257 NO_ADDR_B0x00010000 | (!other_port ? NO_PORT_B0x00020000 : 0));
258
259
260 /*
261 * If not, create a new conversation.
262 */
263 if ( !p_conversation || p_conversation->setup_frame != setup_frame_number) {
264 p_conversation = conversation_new_strat_xtd(pinfo, setup_frame_number, addr, &null_addr, CONVERSATION_UDP,
265 (uint32_t)port, (uint32_t)other_port,
266 NO_ADDR20x01 | (!other_port ? NO_PORT20x02 : 0));
267 }
268
269 /* Set dissector */
270 conversation_set_dissector(p_conversation, t38_udp_handle);
271
272 /*
273 * Check if the conversation has data associated with it.
274 */
275 p_conversation_data = (t38_conv*)conversation_get_proto_data(p_conversation, proto_t38);
276
277 /*
278 * If not, add a new data item.
279 */
280 if ( ! p_conversation_data ) {
281 /* Create conversation data */
282 p_conversation_data = wmem_new(wmem_file_scope(), t38_conv)((t38_conv*)wmem_alloc((wmem_file_scope()), sizeof(t38_conv))
)
;
283
284 conversation_add_proto_data(p_conversation, proto_t38, p_conversation_data);
285 }
286
287 /*
288 * Update the conversation data.
289 */
290 (void) g_strlcpy(p_conversation_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE7);
291 p_conversation_data->setup_frame_number = setup_frame_number;
292 p_conversation_data->src_t38_info.reass_ID = 0;
293 p_conversation_data->src_t38_info.reass_start_seqnum = -1;
294 p_conversation_data->src_t38_info.reass_start_data_field = 0;
295 p_conversation_data->src_t38_info.reass_data_type = 0;
296 p_conversation_data->src_t38_info.reass_first_frame = 0;
297 p_conversation_data->src_t38_info.last_seqnum = -1;
298 p_conversation_data->src_t38_info.packet_lost = 0;
299 p_conversation_data->src_t38_info.burst_lost = 0;
300 p_conversation_data->src_t38_info.time_first_t4_data = 0;
301 p_conversation_data->src_t38_info.additional_hdlc_data_field_counter = 0;
302 p_conversation_data->src_t38_info.seqnum_prev_data_field = -1;
303 p_conversation_data->src_t38_info.next = NULL((void*)0);
304
305 p_conversation_data->dst_t38_info.reass_ID = 0;
306 p_conversation_data->dst_t38_info.reass_start_seqnum = -1;
307 p_conversation_data->dst_t38_info.reass_start_data_field = 0;
308 p_conversation_data->dst_t38_info.reass_data_type = 0;
309 p_conversation_data->dst_t38_info.reass_first_frame = 0;
310 p_conversation_data->dst_t38_info.last_seqnum = -1;
311 p_conversation_data->dst_t38_info.packet_lost = 0;
312 p_conversation_data->dst_t38_info.burst_lost = 0;
313 p_conversation_data->dst_t38_info.time_first_t4_data = 0;
314 p_conversation_data->dst_t38_info.additional_hdlc_data_field_counter = 0;
315 p_conversation_data->dst_t38_info.seqnum_prev_data_field = -1;
316 p_conversation_data->dst_t38_info.next = NULL((void*)0);
317}
318
319
320static fragment_head *
321force_reassemble_seq(reassembly_table *table, packet_info *pinfo, uint32_t id)
322{
323 fragment_head *fd_head;
324 fragment_item *fd_i;
325 fragment_item *last_fd;
326 uint32_t dfpos, size, packet_lost, burst_lost, seq_num;
327 uint8_t *data;
328
329 fd_head = fragment_get(table, pinfo, id, NULL((void*)0));
330
331 /* have we already seen this frame ?*/
332 if (pinfo->fd->visited) {
15
Assuming field 'visited' is 0
16
Taking false branch
333 if (fd_head != NULL((void*)0) && fd_head->flags & FD_DEFRAGMENTED0x0001) {
334 return fd_head;
335 } else {
336 return NULL((void*)0);
337 }
338 }
339
340 if (fd_head==NULL((void*)0)){
17
Assuming 'fd_head' is not equal to NULL
18
Taking false branch
341 /* we must have it to continue */
342 return NULL((void*)0);
343 }
344
345 /* check for packet lost and count the burst of packet lost */
346 packet_lost = 0;
347 burst_lost = 0;
348 seq_num = 0;
349 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
19
Loop condition is false. Execution continues on line 362
350 if (seq_num != fd_i->offset) {
351 packet_lost += fd_i->offset - seq_num;
352 if ( (fd_i->offset - seq_num) > burst_lost ) {
353 burst_lost = fd_i->offset - seq_num;
354 }
355 }
356 seq_num = fd_i->offset + 1;
357 }
358
359 /* we have received an entire packet, defragment it and
360 * free all fragments
361 */
362 size=0;
363 last_fd=NULL((void*)0);
364 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
20
Loop condition is false. Execution continues on line 371
365 if(!last_fd || last_fd->offset!=fd_i->offset){
366 size+=fd_i->len;
367 }
368 last_fd=fd_i;
369 }
370
371 data = (uint8_t *) g_malloc(size);
21
Memory is allocated
372 fd_head->tvb_data = tvb_new_real_data(data, size, size);
373 tvb_set_free_cb(fd_head->tvb_data, g_free);
374 fd_head->len = size; /* record size for caller */
375
376 /* add all data fragments */
377 dfpos = 0;
378 last_fd=NULL((void*)0);
379 for (fd_i=fd_head->next;fd_i
21.1
'fd_i' is null
&& fd_i->len + dfpos <= size;fd_i=fd_i->next) {
380 if (fd_i->len) {
381 if(!last_fd || last_fd->offset!=fd_i->offset){
382 tvb_memcpy(fd_i->tvb_data, data+dfpos, 0, fd_i->len);
383 dfpos += fd_i->len;
384 } else {
385 /* duplicate/retransmission/overlap */
386 fd_i->flags |= FD_OVERLAP0x0002;
387 fd_head->flags |= FD_OVERLAP0x0002;
388 if( (last_fd->len!=fd_i->len)
389 || tvb_memeql(last_fd->tvb_data, 0, tvb_get_ptr(fd_i->tvb_data, 0, last_fd->len), last_fd->len) ){
390 fd_i->flags |= FD_OVERLAPCONFLICT0x0004;
391 fd_head->flags |= FD_OVERLAPCONFLICT0x0004;
392 }
393 }
394 }
395 last_fd=fd_i;
396 }
397
398 /* we have defragmented the pdu, now free all fragments*/
399 for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
22
Potential leak of memory pointed to by 'data'
400 if(fd_i->tvb_data){
401 tvb_free(fd_i->tvb_data);
402 fd_i->tvb_data=NULL((void*)0);
403 }
404 }
405
406 /* mark this packet as defragmented */
407 fd_head->flags |= FD_DEFRAGMENTED0x0001;
408 fd_head->reassembled_in=pinfo->num;
409
410 p_t38_packet_conv_info->packet_lost = packet_lost;
411 p_t38_packet_conv_info->burst_lost = burst_lost;
412
413 return fd_head;
414}
415
416/* T38 Routines */
417
418const value_string t38_T30_indicator_vals[] = {
419 { 0, "no-signal" },
420 { 1, "cng" },
421 { 2, "ced" },
422 { 3, "v21-preamble" },
423 { 4, "v27-2400-training" },
424 { 5, "v27-4800-training" },
425 { 6, "v29-7200-training" },
426 { 7, "v29-9600-training" },
427 { 8, "v17-7200-short-training" },
428 { 9, "v17-7200-long-training" },
429 { 10, "v17-9600-short-training" },
430 { 11, "v17-9600-long-training" },
431 { 12, "v17-12000-short-training" },
432 { 13, "v17-12000-long-training" },
433 { 14, "v17-14400-short-training" },
434 { 15, "v17-14400-long-training" },
435 { 16, "v8-ansam" },
436 { 17, "v8-signal" },
437 { 18, "v34-cntl-channel-1200" },
438 { 19, "v34-pri-channel" },
439 { 20, "v34-CC-retrain" },
440 { 21, "v33-12000-training" },
441 { 22, "v33-14400-training" },
442 { 0, NULL((void*)0) }
443};
444
445
446static unsigned
447dissect_t38_T30_indicator(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
448 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
449 16, &T30ind_value, true1, 7, NULL((void*)0));
450
451 if (primary_part){
452 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
453 val_to_str_const(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
454 }
455
456 /* info for tap */
457 if (primary_part)
458 t38_info->t30ind_value = T30ind_value;
459 return offset;
460}
461
462
463const value_string t38_T30_data_vals[] = {
464 { 0, "v21" },
465 { 1, "v27-2400" },
466 { 2, "v27-4800" },
467 { 3, "v29-7200" },
468 { 4, "v29-9600" },
469 { 5, "v17-7200" },
470 { 6, "v17-9600" },
471 { 7, "v17-12000" },
472 { 8, "v17-14400" },
473 { 9, "v8" },
474 { 10, "v34-pri-rate" },
475 { 11, "v34-CC-1200" },
476 { 12, "v34-pri-ch" },
477 { 13, "v33-12000" },
478 { 14, "v33-14400" },
479 { 0, NULL((void*)0) }
480};
481
482
483static unsigned
484dissect_t38_T30_data(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
485 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
486 9, &Data_value, true1, 6, NULL((void*)0));
487
488 if (primary_part){
489 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
490 val_to_str_const(Data_value,t38_T30_data_vals,"<unknown>"));
491 }
492
493
494 /* info for tap */
495 if (primary_part)
496 t38_info->data_value = Data_value;
497 return offset;
498}
499
500
501static const value_string t38_Type_of_msg_vals[] = {
502 { 0, "t30-indicator" },
503 { 1, "t30-data" },
504 { 0, NULL((void*)0) }
505};
506
507static const per_choice_t Type_of_msg_choice[] = {
508 { 0, &hf_t38_t30_indicator , ASN1_NO_EXTENSIONS0 , dissect_t38_T30_indicator },
509 { 1, &hf_t38_t30_data , ASN1_NO_EXTENSIONS0 , dissect_t38_T30_data },
510 { 0, NULL((void*)0), 0, NULL((void*)0) }
511};
512
513static unsigned
514dissect_t38_Type_of_msg(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
515 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
516 ett_t38_Type_of_msg, Type_of_msg_choice,
517 &Type_of_msg_value);
518
519 /* info for tap */
520 if (primary_part)
521 t38_info->type_msg = Type_of_msg_value;
522 return offset;
523}
524
525
526static const value_string t38_T_field_type_vals[] = {
527 { 0, "hdlc-data" },
528 { 1, "hdlc-sig-end" },
529 { 2, "hdlc-fcs-OK" },
530 { 3, "hdlc-fcs-BAD" },
531 { 4, "hdlc-fcs-OK-sig-end" },
532 { 5, "hdlc-fcs-BAD-sig-end" },
533 { 6, "t4-non-ecm-data" },
534 { 7, "t4-non-ecm-sig-end" },
535 { 8, "cm-message" },
536 { 9, "jm-message" },
537 { 10, "ci-message" },
538 { 11, "v34rate" },
539 { 0, NULL((void*)0) }
540};
541
542
543static unsigned
544dissect_t38_T_field_type(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
545 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
2
'?' condition is false
546 8, &Data_Field_field_type_value, (use_pre_corrigendum_asn1_specification)?false0:true1, (use_pre_corrigendum_asn1_specification
2.1
'use_pre_corrigendum_asn1_specification' is false
)?0:4, NULL((void*)0));
1
Assuming 'use_pre_corrigendum_asn1_specification' is false
3
'?' condition is false
547
548 if (primary_part){
4
Assuming 'primary_part' is true
5
Taking true branch
549 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
550 val_to_str_const(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
551 }
552
553 if (primary_part) {
6
Assuming 'primary_part' is true
554 if (Data_Field_field_type_value == 2 || Data_Field_field_type_value == 4 || Data_Field_field_type_value == 7) {/* hdlc-fcs-OK or hdlc-fcs-OK-sig-end or t4-non-ecm-sig-end*/
7
Assuming 'Data_Field_field_type_value' is equal to 2
555 fragment_head *frag_msg = NULL((void*)0);
556 tvbuff_t* new_tvb = NULL((void*)0);
557 bool_Bool save_fragmented = actx->pinfo->fragmented;
558
559 actx->pinfo->fragmented = true1;
560
561 /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
562 if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
8
Assuming the condition is true
9
Taking true branch
563 uint32_t frag_seq_num;
564 if (seq_number == (uint32_t)p_t38_packet_conv_info->reass_start_seqnum) {
10
Assuming 'seq_number' is equal to field 'reass_start_seqnum'
11
Taking true branch
565 frag_seq_num = (uint32_t)p_t38_packet_conv_info->additional_hdlc_data_field_counter + Data_Field_item_num - p_t38_packet_conv_info->reass_start_data_field;
566 } else {
567 frag_seq_num = seq_number - (uint32_t)p_t38_packet_conv_info->reass_start_seqnum + (uint32_t)p_t38_packet_conv_info->additional_hdlc_data_field_counter + Data_Field_item_num;
568 }
569 frag_msg = fragment_add_seq(&data_reassembly_table, /* reassembly table */
570 tvb, offset, actx->pinfo,
571 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
572 NULL((void*)0),
573 frag_seq_num, /* fragment sequence number */
574 /*0,*/
575 0, /* fragment length */
576 false0, /* More fragments */
577 0);
578 if ( Data_Field_field_type_value == 7 ) {
12
Assuming 'Data_Field_field_type_value' is equal to 7
579 /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
580 * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
581 * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
582 * and get some stat, like packet lost and burst number of packet lost
583 */
584 if (!frag_msg || (PINFO_FD_VISITED(actx->pinfo)((actx->pinfo)->fd->visited) && p_t38_packet_conv_info->packet_lost)) {
13
Assuming 'frag_msg' is null
585 /* On a later pass the forced reassembly is already complete, so
586 * fragment_add_seq() returns it; the packet copy tells that it was forced.
587 */
588 frag_msg = force_reassemble_seq(&data_reassembly_table, /* reassembly table */
14
Calling 'force_reassemble_seq'
589 actx->pinfo,
590 p_t38_packet_conv_info->reass_ID /* ID for fragments belonging together */
591 );
592 if (frag_msg) {
593 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %u pack lost, %u pack burst lost)",
594 p_t38_packet_conv_info->packet_lost, p_t38_packet_conv_info->burst_lost);
595 }
596 } else {
597 col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
598
599 snprintf(t38_info->desc_comment, MAX_T38_DESC128, "No packet lost");
600 }
601
602
603 if (p_t38_packet_conv_info->packet_lost) {
604 snprintf(t38_info->desc_comment, MAX_T38_DESC128, " Pack lost: %d, Pack burst lost: %d", p_t38_packet_conv_info->packet_lost, p_t38_packet_conv_info->burst_lost);
605 } else {
606 snprintf(t38_info->desc_comment, MAX_T38_DESC128, "No packet lost");
607 }
608
609 process_reassembled_data(tvb, offset, actx->pinfo,
610 "Reassembled T38", frag_msg, &data_frag_items, NULL((void*)0), tree);
611
612 /* Now reset fragmentation information in pinfo */
613 actx->pinfo->fragmented = save_fragmented;
614
615 t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
616 t38_info->frame_num_first_t4_data = p_t38_packet_conv_info->reass_first_frame; /* Frame number of the first t4 fragment */
617
618 } else {
619 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
620 "Reassembled T38", frag_msg, &data_frag_items, NULL((void*)0), tree);
621
622 /* Now reset fragmentation information in pinfo */
623 actx->pinfo->fragmented = save_fragmented;
624
625 if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info);
626 }
627 } else {
628 /* If this is the same sequence number as the previous packet
629 * (i.e., a retransmission), we don't expect to have any
630 * fragment data (we reassembled it in the previous packet).
631 */
632 if (p_t38_packet_conv && ((int32_t) seq_number != p_t38_packet_conv_info->last_seqnum)) {
633 proto_tree_add_expert_format(tree, actx->pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
634 "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
635 col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
636 }
637 actx->pinfo->fragmented = save_fragmented;
638 }
639 }
640
641 /* reset the reassemble ID and the start seq number if it is not HDLC data */
642 if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
643 /* The conversation state is only updated on the first pass */
644 if (!PINFO_FD_VISITED(actx->pinfo)((actx->pinfo)->fd->visited)) {
645 p_t38_conv_info->reass_ID = 0;
646 p_t38_conv_info->reass_data_type = 0;
647 p_t38_conv_info->reass_first_frame = 0;
648 p_t38_conv_info->reass_start_seqnum = -1;
649 p_t38_conv_info->additional_hdlc_data_field_counter = 0;
650 p_t38_conv_info->seqnum_prev_data_field = -1;
651
652 if (p_t38_packet_conv_info->next == NULL((void*)0)) {
653 p_t38_packet_conv_info->next = wmem_new(wmem_file_scope(), t38_conv_info)((t38_conv_info*)wmem_alloc((wmem_file_scope()), sizeof(t38_conv_info
)))
;
654 memcpy(p_t38_packet_conv_info->next, p_t38_conv_info, sizeof(t38_conv_info));
655 p_t38_packet_conv_info->next->next = NULL((void*)0);
656 }
657 }
658 /* The next items of this packet use the state copy made after this one, on every pass */
659 if (p_t38_packet_conv_info->next != NULL((void*)0)) {
660 p_t38_packet_conv_info = p_t38_packet_conv_info->next;
661 }
662
663 }
664 t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
665 }
666 return offset;
667}
668
669
670
671static unsigned
672dissect_t38_T_field_data(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
673 tvbuff_t *value_tvb = NULL((void*)0);
674 uint32_t value_len;
675
676 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
677 1, 65535, false0, &value_tvb);
678
679 value_len = tvb_reported_length(value_tvb);
680
681
682 if (primary_part){
683 if(value_len < 8){
684 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
685 tvb_bytes_to_str(actx->pinfo->pool, value_tvb,0,value_len));
686 }
687 else {
688 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
689 tvb_bytes_to_str(actx->pinfo->pool, value_tvb,0,7));
690 }
691 }
692
693 if (primary_part) {
694 fragment_head *frag_msg = NULL((void*)0);
695
696 /* HDLC Data or t4-non-ecm-data */
697 if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
698 bool_Bool save_fragmented = actx->pinfo->fragmented;
699
700 actx->pinfo->fragmented = true1;
701
702 /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
703 if (p_t38_packet_conv && p_t38_conv && !PINFO_FD_VISITED(actx->pinfo)((actx->pinfo)->fd->visited) && (p_t38_packet_conv_info->reass_start_seqnum == -1)) {
704 /* The protocol doesn't provide a fragment ID, so assign a one-up
705 * one on the first pass (it is kept in the per-packet copy). More
706 * than one reassembly can begin in the same frame, so the frame
707 * number is not usable. The frame number of the first fragment is
708 * kept in reass_first_frame for the tap.
709 */
710 t38_reass_id_counter++;
711 if (t38_reass_id_counter == 0) {
712 t38_reass_id_counter = 1;
713 }
714 p_t38_conv_info->reass_ID = t38_reass_id_counter;
715 p_t38_conv_info->reass_first_frame = actx->pinfo->num;
716 p_t38_packet_conv_info->reass_first_frame = actx->pinfo->num;
717 p_t38_conv_info->reass_start_seqnum = seq_number;
718 p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->rel_ts);
719 p_t38_conv_info->additional_hdlc_data_field_counter = 0;
720 p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
721 p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
722 p_t38_packet_conv_info->reass_start_data_field = Data_Field_item_num;
723 p_t38_packet_conv_info->seqnum_prev_data_field = p_t38_conv_info->seqnum_prev_data_field;
724 p_t38_packet_conv_info->additional_hdlc_data_field_counter = p_t38_conv_info->additional_hdlc_data_field_counter;
725 p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
726 }
727 if (seq_number == (uint32_t)p_t38_packet_conv_info->seqnum_prev_data_field){
728 if(p_t38_conv && !PINFO_FD_VISITED(actx->pinfo)((actx->pinfo)->fd->visited)){
729 p_t38_conv_info->additional_hdlc_data_field_counter++;
730 }
731 }
732 uint32_t frag_seq_num;
733 if (seq_number == (uint32_t)p_t38_packet_conv_info->reass_start_seqnum) {
734 frag_seq_num = (uint32_t)p_t38_packet_conv_info->additional_hdlc_data_field_counter + Data_Field_item_num - (uint32_t)p_t38_packet_conv_info->reass_start_data_field;
735 } else {
736 frag_seq_num = seq_number - (uint32_t)p_t38_packet_conv_info->reass_start_seqnum + (uint32_t)p_t38_packet_conv_info->additional_hdlc_data_field_counter + Data_Field_item_num;
737 }
738 frag_msg = fragment_add_seq(&data_reassembly_table,
739 value_tvb, 0,
740 actx->pinfo,
741 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
742 NULL((void*)0),
743 frag_seq_num, /* fragment sequence number */
744 value_len, /* fragment length */
745 true1, /* More fragments */
746 0);
747 p_t38_packet_conv_info->seqnum_prev_data_field = (int32_t)seq_number;
748 process_reassembled_data(tvb, offset, actx->pinfo,
749 "Reassembled T38", frag_msg, &data_frag_items, NULL((void*)0), tree);
750
751 if (!frag_msg) { /* Not last packet of reassembled */
752 if (Data_Field_field_type_value == 0) {
753 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (HDLC fragment %u)", frag_seq_num);
754 } else {
755 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", frag_seq_num);
756 }
757 }
758
759 /* Now reset fragmentation information in pinfo */
760 actx->pinfo->fragmented = save_fragmented;
761 }
762 }
763 return offset;
764}
765
766
767static const per_sequence_t Data_Field_item_sequence[] = {
768 { &hf_t38_field_type , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_T_field_type },
769 { &hf_t38_field_data , ASN1_NO_EXTENSIONS0 , ASN1_OPTIONAL0x04 , dissect_t38_T_field_data },
770 { NULL((void*)0), 0, 0, NULL((void*)0) }
771};
772
773static unsigned
774dissect_t38_Data_Field_item(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
775 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
776 ett_t38_Data_Field_item, Data_Field_item_sequence);
777
778 if (primary_part) Data_Field_item_num++;
779 return offset;
780}
781
782
783static const per_sequence_t Data_Field_sequence_of[1] = {
784 { &hf_t38_Data_Field_item , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_Data_Field_item },
785};
786
787static unsigned
788dissect_t38_Data_Field(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
789 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
790 ett_t38_Data_Field, Data_Field_sequence_of);
791
792 return offset;
793}
794
795
796static const per_sequence_t IFPPacket_sequence[] = {
797 { &hf_t38_type_of_msg , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_Type_of_msg },
798 { &hf_t38_data_field , ASN1_NO_EXTENSIONS0 , ASN1_OPTIONAL0x04 , dissect_t38_Data_Field },
799 { NULL((void*)0), 0, 0, NULL((void*)0) }
800};
801
802static unsigned
803dissect_t38_IFPPacket(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
804 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
805 ett_t38_IFPPacket, IFPPacket_sequence);
806
807 return offset;
808}
809
810
811
812static unsigned
813dissect_t38_T_seq_number(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
814 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
815 0U, 65535U, &seq_number, false0);
816
817 /* info for tap */
818 if (primary_part)
819 t38_info->seq_num = seq_number;
820
821 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
822 return offset;
823}
824
825
826
827static unsigned
828dissect_t38_T_primary_ifp_packet(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
829 primary_part = true1;
830 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
831
832 /* if is a valid t38 packet, add to tap */
833 /* Note that t4-non-ecm-sig-end without first_t4_data is not valid */
834 if (p_t38_packet_conv && (!actx->pinfo->flags.in_error_pkt) && ((int32_t) seq_number != p_t38_packet_conv_info->last_seqnum) &&
835 !(t38_info->type_msg == 1 && t38_info->Data_Field_field_type_value == 7 && t38_info->frame_num_first_t4_data == 0))
836 tap_queue_packet(t38_tap, actx->pinfo, t38_info);
837
838 if (p_t38_conv && !PINFO_FD_VISITED(actx->pinfo)((actx->pinfo)->fd->visited)) p_t38_conv_info->last_seqnum = (int32_t) seq_number;
839 return offset;
840}
841
842
843
844static unsigned
845dissect_t38_OpenType_IFPPacket(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
846 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
847
848 return offset;
849}
850
851
852static const per_sequence_t T_secondary_ifp_packets_sequence_of[1] = {
853 { &hf_t38_secondary_ifp_packets_item, ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_OpenType_IFPPacket },
854};
855
856static unsigned
857dissect_t38_T_secondary_ifp_packets(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
858 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
859 ett_t38_T_secondary_ifp_packets, T_secondary_ifp_packets_sequence_of);
860
861 return offset;
862}
863
864
865
866static unsigned
867dissect_t38_INTEGER(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
868 offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL((void*)0));
869
870 return offset;
871}
872
873
874
875static unsigned
876dissect_t38_OCTET_STRING(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
877 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
878 NO_BOUND-1, NO_BOUND-1, false0, NULL((void*)0));
879
880 return offset;
881}
882
883
884static const per_sequence_t T_fec_data_sequence_of[1] = {
885 { &hf_t38_fec_data_item , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_OCTET_STRING },
886};
887
888static unsigned
889dissect_t38_T_fec_data(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
890 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
891 ett_t38_T_fec_data, T_fec_data_sequence_of);
892
893 return offset;
894}
895
896
897static const per_sequence_t T_fec_info_sequence[] = {
898 { &hf_t38_fec_npackets , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_INTEGER },
899 { &hf_t38_fec_data , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_T_fec_data },
900 { NULL((void*)0), 0, 0, NULL((void*)0) }
901};
902
903static unsigned
904dissect_t38_T_fec_info(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
905 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
906 ett_t38_T_fec_info, T_fec_info_sequence);
907
908 return offset;
909}
910
911
912static const value_string t38_T_error_recovery_vals[] = {
913 { 0, "secondary-ifp-packets" },
914 { 1, "fec-info" },
915 { 0, NULL((void*)0) }
916};
917
918static const per_choice_t T_error_recovery_choice[] = {
919 { 0, &hf_t38_secondary_ifp_packets, ASN1_NO_EXTENSIONS0 , dissect_t38_T_secondary_ifp_packets },
920 { 1, &hf_t38_fec_info , ASN1_NO_EXTENSIONS0 , dissect_t38_T_fec_info },
921 { 0, NULL((void*)0), 0, NULL((void*)0) }
922};
923
924static unsigned
925dissect_t38_T_error_recovery(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
926 primary_part = false0;
927 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
928 ett_t38_T_error_recovery, T_error_recovery_choice,
929 NULL((void*)0));
930
931 primary_part = true1;
932 return offset;
933}
934
935
936static const per_sequence_t UDPTLPacket_sequence[] = {
937 { &hf_t38_seq_number , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_T_seq_number },
938 { &hf_t38_primary_ifp_packet, ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_T_primary_ifp_packet },
939 { &hf_t38_error_recovery , ASN1_NO_EXTENSIONS0 , ASN1_NOT_OPTIONAL0, dissect_t38_T_error_recovery },
940 { NULL((void*)0), 0, 0, NULL((void*)0) }
941};
942
943static unsigned
944dissect_t38_UDPTLPacket(tvbuff_t *tvb _U___attribute__((unused)), uint32_t offset _U___attribute__((unused)), asn1_ctx_t *actx _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), int hf_index _U___attribute__((unused))) {
945 /* Initialize to something else than data type */
946 Data_Field_field_type_value = 1;
947 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
948 ett_t38_UDPTLPacket, UDPTLPacket_sequence);
949
950 return offset;
951}
952
953/*--- PDUs ---*/
954
955static int dissect_IFPPacket_PDU(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void *data _U___attribute__((unused))) {
956 unsigned offset = 0;
957 asn1_ctx_t asn1_ctx;
958 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, true1, pinfo);
959 offset = dissect_t38_IFPPacket(tvb, offset, &asn1_ctx, tree, hf_t38_IFPPacket_PDU);
960 offset += 7; offset >>= 3;
961 return offset;
962}
963static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void *data _U___attribute__((unused))) {
964 unsigned offset = 0;
965 asn1_ctx_t asn1_ctx;
966 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, true1, pinfo);
967 offset = dissect_t38_UDPTLPacket(tvb, offset, &asn1_ctx, tree, hf_t38_UDPTLPacket_PDU);
968 offset += 7; offset >>= 3;
969 return offset;
970}
971
972
973/* initialize the tap t38_info and the conversation */
974static void
975init_t38_info_conv(packet_info *pinfo)
976{
977 /* tap info */
978 t38_info_current++;
979 if (t38_info_current==MAX_T38_MESSAGES_IN_PACKET4) {
980 t38_info_current=0;
981 }
982 t38_info = &t38_info_arr[t38_info_current];
983
984 t38_info->seq_num = 0;
985 t38_info->type_msg = 0;
986 t38_info->data_value = 0;
987 t38_info->t30ind_value =0;
988 t38_info->setup_frame_number = 0;
989 t38_info->Data_Field_field_type_value = 0;
990 t38_info->desc[0] = '\0';
991 t38_info->desc_comment[0] = '\0';
992 t38_info->time_first_t4_data = 0;
993 t38_info->frame_num_first_t4_data = 0;
994
995
996 /*
997 p_t38_packet_conv hold the conversation info in each of the packets.
998 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
999 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
1000 need to use p_t38_conv
1001 */
1002 p_t38_packet_conv = NULL((void*)0);
1003 p_t38_conv = NULL((void*)0);
1004
1005 /* Use existing packet info if available */
1006 p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
1007
1008
1009 /* find the conversation used for Reassemble and Setup Info */
1010 p_conv = find_conversation_strat_xtd(pinfo, pinfo->num, &pinfo->net_dst, &pinfo->net_src,
1011 conversation_pt_to_conversation_type(pinfo->ptype),
1012 pinfo->destport, pinfo->srcport, NO_ADDR_B0x00010000 | NO_PORT_B0x00020000);
1013
1014 /* create a conv if it doesn't exist */
1015 if (!p_conv) {
1016 p_conv = conversation_new_strat_xtd(pinfo, pinfo->num, &pinfo->net_src, &pinfo->net_dst,
1017 conversation_pt_to_conversation_type(pinfo->ptype), pinfo->srcport, pinfo->destport, NO_ADDR20x01 | NO_PORT20x02);
1018
1019 /* Set dissector */
1020 conversation_set_dissector(p_conv, t38_udp_handle);
1021 }
1022
1023 p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
1024
1025 /* create the conversation if it doesn't exist */
1026 if (!p_t38_conv) {
1027 p_t38_conv = wmem_new(wmem_file_scope(), t38_conv)((t38_conv*)wmem_alloc((wmem_file_scope()), sizeof(t38_conv))
)
;
1028 p_t38_conv->setup_method[0] = '\0';
1029 p_t38_conv->setup_frame_number = 0;
1030
1031 p_t38_conv->src_t38_info.reass_ID = 0;
1032 p_t38_conv->src_t38_info.reass_start_seqnum = -1;
1033 p_t38_conv->src_t38_info.reass_start_data_field = 0;
1034 p_t38_conv->src_t38_info.reass_data_type = 0;
1035 p_t38_conv->src_t38_info.reass_first_frame = 0;
1036 p_t38_conv->src_t38_info.last_seqnum = -1;
1037 p_t38_conv->src_t38_info.packet_lost = 0;
1038 p_t38_conv->src_t38_info.burst_lost = 0;
1039 p_t38_conv->src_t38_info.time_first_t4_data = 0;
1040 p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
1041 p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
1042 p_t38_conv->src_t38_info.next = NULL((void*)0);
1043
1044 p_t38_conv->dst_t38_info.reass_ID = 0;
1045 p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
1046 p_t38_conv->dst_t38_info.reass_start_data_field = 0;
1047 p_t38_conv->dst_t38_info.reass_data_type = 0;
1048 p_t38_conv->dst_t38_info.reass_first_frame = 0;
1049 p_t38_conv->dst_t38_info.last_seqnum = -1;
1050 p_t38_conv->dst_t38_info.packet_lost = 0;
1051 p_t38_conv->dst_t38_info.burst_lost = 0;
1052 p_t38_conv->dst_t38_info.time_first_t4_data = 0;
1053 p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
1054 p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
1055 p_t38_conv->dst_t38_info.next = NULL((void*)0);
1056
1057 conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
1058 }
1059
1060 if (!p_t38_packet_conv) {
1061 /* copy the t38 conversation info to the packet t38 conversation */
1062 p_t38_packet_conv = wmem_new(wmem_file_scope(), t38_conv)((t38_conv*)wmem_alloc((wmem_file_scope()), sizeof(t38_conv))
)
;
1063 (void) g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE7);
1064 p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number;
1065
1066 memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info));
1067 memcpy(&(p_t38_packet_conv->dst_t38_info), &(p_t38_conv->dst_t38_info), sizeof(t38_conv_info));
1068
1069 p_add_proto_data(wmem_file_scope(), pinfo, proto_t38, 0, p_t38_packet_conv);
1070 }
1071
1072 if (addresses_equal(conversation_key_addr1(p_conv->key_ptr), &pinfo->net_src)) {
1073 p_t38_conv_info = &(p_t38_conv->src_t38_info);
1074 p_t38_packet_conv_info = &(p_t38_packet_conv->src_t38_info);
1075 } else {
1076 p_t38_conv_info = &(p_t38_conv->dst_t38_info);
1077 p_t38_packet_conv_info = &(p_t38_packet_conv->dst_t38_info);
1078 }
1079
1080 /* update t38_info */
1081 t38_info->setup_frame_number = p_t38_packet_conv->setup_frame_number;
1082}
1083
1084/* Entry point for dissection */
1085static int
1086dissect_t38_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
1087{
1088 uint8_t octet1;
1089 proto_item *it;
1090 proto_tree *tr;
1091 uint32_t offset=0;
1092
1093 /*
1094 * XXX - heuristic to check for misidentified packets.
1095 */
1096 if (dissect_possible_rtpv2_packets_as_rtp){
1097 octet1 = tvb_get_uint8(tvb, offset);
1098 if (RTP_VERSION(octet1)((octet1) >> 6) == 2){
1099 return call_dissector(rtp_handle,tvb,pinfo,tree);
1100 }
1101 }
1102
1103 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1104 col_clear(pinfo->cinfo, COL_INFO);
1105
1106 primary_part = true1;
1107
1108 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1109 Data_Field_item_num = 0;
1110
1111 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1112 tr=proto_item_add_subtree(it, ett_t38);
1113
1114 /* init tap and conv info */
1115 init_t38_info_conv(pinfo);
1116
1117 /* Show Conversation setup info if exists*/
1118 if (global_t38_show_setup_info) {
1119 show_setup_info(tvb, tr, p_t38_packet_conv);
1120 }
1121
1122 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
1123
1124 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr, NULL((void*)0));
1125
1126 if (tvb_reported_length_remaining(tvb,offset)>0){
1127 proto_tree_add_expert_format(tr, pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1128 "[MALFORMED PACKET or wrong preference settings]");
1129 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1130 }
1131 return tvb_captured_length(tvb);
1132}
1133
1134static int
1135dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
1136{
1137 proto_item *it;
1138 proto_tree *tr;
1139 uint32_t offset=0;
1140 tvbuff_t *next_tvb;
1141 uint16_t ifp_packet_number=1;
1142
1143 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1144 col_clear(pinfo->cinfo, COL_INFO);
1145
1146 primary_part = true1;
1147
1148 /* There is no UDPTL sequence number over TCP; do not use the one of an earlier packet */
1149 seq_number = 0;
1150
1151 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1152 Data_Field_item_num = 0;
1153
1154 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1155 tr=proto_item_add_subtree(it, ett_t38);
1156
1157 /* init tap and conv info */
1158 init_t38_info_conv(pinfo);
1159
1160 /* Show Conversation setup info if exists*/
1161 if (global_t38_show_setup_info) {
1162 show_setup_info(tvb, tr, p_t38_packet_conv);
1163 }
1164
1165 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
1166
1167 while(tvb_reported_length_remaining(tvb,offset)>0)
1168 {
1169 next_tvb = tvb_new_subset_remaining(tvb, offset);
1170 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr, NULL((void*)0));
1171 ifp_packet_number++;
1172
1173 if(tvb_reported_length_remaining(tvb,offset)>0){
1174 if(t38_tpkt_usage == T38_TPKT_ALWAYS1){
1175 proto_tree_add_expert_format(tr, pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1176 "[MALFORMED PACKET or wrong preference settings]");
1177 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1178 break;
1179 }else {
1180 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
1181 }
1182 }
1183 }
1184
1185 return tvb_captured_length(tvb);
1186}
1187
1188static int
1189dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
1190{
1191 primary_part = true1;
1192
1193 if(t38_tpkt_usage == T38_TPKT_ALWAYS1){
1194 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1195 }
1196 else if((t38_tpkt_usage == T38_TPKT_NEVER0) || (!is_tpkt(tvb,1, NULL((void*)0)))){
1197 dissect_t38_tcp_pdu(tvb, pinfo, tree, data);
1198 }
1199 else {
1200 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1201 }
1202 return tvb_captured_length(tvb);
1203}
1204
1205/* Look for conversation info and display any setup info found */
1206void
1207show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conversation)
1208{
1209 proto_tree *t38_setup_tree;
1210 proto_item *ti;
1211
1212 if (!p_t38_conversation || p_t38_conversation->setup_frame_number == 0) {
1213 /* there is no Setup info */
1214 return;
1215 }
1216
1217 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
1218 "",
1219 "Stream setup by %s (frame %u)",
1220 p_t38_conversation->setup_method,
1221 p_t38_conversation->setup_frame_number);
1222 proto_item_set_generated(ti);
1223 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
1224 if (t38_setup_tree)
1225 {
1226 /* Add details into subtree */
1227 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
1228 tvb, 0, 0, p_t38_conversation->setup_frame_number);
1229 proto_item_set_generated(item);
1230 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
1231 tvb, 0, 0, p_t38_conversation->setup_method);
1232 proto_item_set_generated(item);
1233 }
1234}
1235
1236/* This function tries to understand if the payload is sitting on top of AC DR */
1237static bool_Bool
1238dissect_t38_acdr_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1239{
1240 unsigned acdr_prot = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_acdr, 0))((guint) (gulong) (p_get_proto_data(pinfo->pool, pinfo, proto_acdr
, 0)))
;
1241 if (acdr_prot == ACDR_T38)
1242 return dissect_t38_udp(tvb, pinfo, tree, data);
1243 return false0;
1244}
1245
1246
1247/* Wireshark Protocol Registration */
1248void
1249proto_register_t38(void)
1250{
1251 static hf_register_info hf[] =
1252 {
1253 { &hf_t38_IFPPacket_PDU,
1254 { "IFPPacket", "t38.IFPPacket_element",
1255 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1256 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1257 { &hf_t38_UDPTLPacket_PDU,
1258 { "UDPTLPacket", "t38.UDPTLPacket_element",
1259 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1260 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1261 { &hf_t38_type_of_msg,
1262 { "type-of-msg", "t38.type_of_msg",
1263 FT_UINT32, BASE_DEC, VALS(t38_Type_of_msg_vals)((0 ? (const struct _value_string*)0 : ((t38_Type_of_msg_vals
))))
, 0,
1264 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1265 { &hf_t38_data_field,
1266 { "data-field", "t38.data_field",
1267 FT_UINT32, BASE_DEC, NULL((void*)0), 0,
1268 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1269 { &hf_t38_t30_indicator,
1270 { "t30-indicator", "t38.t30_indicator",
1271 FT_UINT32, BASE_DEC, VALS(t38_T30_indicator_vals)((0 ? (const struct _value_string*)0 : ((t38_T30_indicator_vals
))))
, 0,
1272 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1273 { &hf_t38_t30_data,
1274 { "t30-data", "t38.t30_data",
1275 FT_UINT32, BASE_DEC, VALS(t38_T30_data_vals)((0 ? (const struct _value_string*)0 : ((t38_T30_data_vals)))
)
, 0,
1276 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1277 { &hf_t38_Data_Field_item,
1278 { "Data-Field item", "t38.Data_Field_item_element",
1279 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1280 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1281 { &hf_t38_field_type,
1282 { "field-type", "t38.field_type",
1283 FT_UINT32, BASE_DEC, VALS(t38_T_field_type_vals)((0 ? (const struct _value_string*)0 : ((t38_T_field_type_vals
))))
, 0,
1284 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1285 { &hf_t38_field_data,
1286 { "field-data", "t38.field_data",
1287 FT_BYTES, BASE_NONE, NULL((void*)0), 0,
1288 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1289 { &hf_t38_seq_number,
1290 { "seq-number", "t38.seq_number",
1291 FT_UINT32, BASE_DEC, NULL((void*)0), 0,
1292 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1293 { &hf_t38_primary_ifp_packet,
1294 { "primary-ifp-packet", "t38.primary_ifp_packet_element",
1295 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1296 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1297 { &hf_t38_error_recovery,
1298 { "error-recovery", "t38.error_recovery",
1299 FT_UINT32, BASE_DEC, VALS(t38_T_error_recovery_vals)((0 ? (const struct _value_string*)0 : ((t38_T_error_recovery_vals
))))
, 0,
1300 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1301 { &hf_t38_secondary_ifp_packets,
1302 { "secondary-ifp-packets", "t38.secondary_ifp_packets",
1303 FT_UINT32, BASE_DEC, NULL((void*)0), 0,
1304 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1305 { &hf_t38_secondary_ifp_packets_item,
1306 { "secondary-ifp-packets item", "t38.secondary_ifp_packets_item_element",
1307 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1308 "OpenType_IFPPacket", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1309 { &hf_t38_fec_info,
1310 { "fec-info", "t38.fec_info_element",
1311 FT_NONE, BASE_NONE, NULL((void*)0), 0,
1312 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1313 { &hf_t38_fec_npackets,
1314 { "fec-npackets", "t38.fec_npackets",
1315 FT_INT32, BASE_DEC, NULL((void*)0), 0,
1316 "INTEGER", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1317 { &hf_t38_fec_data,
1318 { "fec-data", "t38.fec_data",
1319 FT_UINT32, BASE_DEC, NULL((void*)0), 0,
1320 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1321 { &hf_t38_fec_data_item,
1322 { "fec-data item", "t38.fec_data_item",
1323 FT_BYTES, BASE_NONE, NULL((void*)0), 0,
1324 "OCTET_STRING", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1325 { &hf_t38_setup,
1326 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
1327 NULL((void*)0), 0x0, "Stream setup, method and frame number", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1328 { &hf_t38_setup_frame,
1329 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
1330 NULL((void*)0), 0x0, "Frame that set up this stream", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1331 { &hf_t38_setup_method,
1332 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
1333 NULL((void*)0), 0x0, "Method used to set up this stream", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1334 {&hf_t38_fragments,
1335 {"Message fragments", "t38.fragments",
1336 FT_NONE, BASE_NONE, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1337 {&hf_t38_fragment,
1338 {"Message fragment", "t38.fragment",
1339 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1340 {&hf_t38_fragment_overlap,
1341 {"Message fragment overlap", "t38.fragment.overlap",
1342 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1343 {&hf_t38_fragment_overlap_conflicts,
1344 {"Message fragment overlapping with conflicting data",
1345 "t38.fragment.overlap.conflicts",
1346 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1347 {&hf_t38_fragment_multiple_tails,
1348 {"Message has multiple tail fragments",
1349 "t38.fragment.multiple_tails",
1350 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1351 {&hf_t38_fragment_too_long_fragment,
1352 {"Message fragment too long", "t38.fragment.too_long_fragment",
1353 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1354 {&hf_t38_fragment_error,
1355 {"Message defragmentation error", "t38.fragment.error",
1356 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1357 {&hf_t38_fragment_count,
1358 {"Message fragment count", "t38.fragment.count",
1359 FT_UINT32, BASE_DEC, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1360 {&hf_t38_reassembled_in,
1361 {"Reassembled in", "t38.reassembled.in",
1362 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1363 {&hf_t38_reassembled_length,
1364 {"Reassembled T38 length", "t38.reassembled.length",
1365 FT_UINT32, BASE_DEC, NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1366 };
1367
1368 static int *ett[] =
1369 {
1370 &ett_t38,
1371 &ett_t38_IFPPacket,
1372 &ett_t38_Type_of_msg,
1373 &ett_t38_Data_Field,
1374 &ett_t38_Data_Field_item,
1375 &ett_t38_UDPTLPacket,
1376 &ett_t38_T_error_recovery,
1377 &ett_t38_T_secondary_ifp_packets,
1378 &ett_t38_T_fec_info,
1379 &ett_t38_T_fec_data,
1380 &ett_t38_setup,
1381 &ett_data_fragment,
1382 &ett_data_fragments
1383 };
1384
1385 static ei_register_info ei[] = {
1386 { &ei_t38_malformed, { "t38.malformed", PI_MALFORMED0x07000000, PI_ERROR0x00800000, "Malformed packet", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
1387 };
1388
1389 module_t *t38_module;
1390 expert_module_t* expert_t38;
1391
1392 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
1393 proto_register_field_array(proto_t38, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
1394 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
1395 expert_t38 = expert_register_protocol(proto_t38);
1396 expert_register_field_array(expert_t38, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
1397 t38_udp_handle=register_dissector("t38_udp", dissect_t38_udp, proto_t38);
1398 t38_tcp_handle=register_dissector("t38_tcp", dissect_t38_tcp, proto_t38);
1399 t38_tcp_pdu_handle=register_dissector("t38_tcp_pdu", dissect_t38_tcp_pdu, proto_t38);
1400
1401 /* Register reassemble tables for HDLC */
1402 reassembly_table_register(&data_reassembly_table,
1403 &addresses_reassembly_table_functions);
1404
1405 register_init_routine(t38_init_routine);
1406
1407 t38_tap = register_tap("t38");
1408
1409 t38_module = prefs_register_protocol(proto_t38, NULL((void*)0));
1410 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
1411 "Use the Pre-Corrigendum ASN.1 specification",
1412 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
1413 "ASN.1 specification (1998).",
1414 &use_pre_corrigendum_asn1_specification);
1415 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
1416 "Dissect possible RTP version 2 packets with RTP dissector",
1417 "Whether a UDP packet that looks like RTP version 2 packet will "
1418 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
1419 "packets with sequence number higher than 32767 may be dissected as RTP.",
1420 &dissect_possible_rtpv2_packets_as_rtp);
1421 prefs_register_bool_preference(t38_module, "reassembly",
1422 "Reassemble T.38 PDUs over TPKT over TCP",
1423 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
1424 "when TPKT is used over TCP. "
1425 "To use this option, you must also enable \"Allow subdissectors to reassemble "
1426 "TCP streams\" in the TCP protocol settings.",
1427 &t38_tpkt_reassembly);
1428 prefs_register_enum_preference(t38_module, "tpkt_usage",
1429 "TPKT used over TCP",
1430 "Whether T.38 is used with TPKT for TCP",
1431 (int *)&t38_tpkt_usage,t38_tpkt_options,false0);
1432
1433 prefs_register_bool_preference(t38_module, "show_setup_info",
1434 "Show stream setup information",
1435 "Where available, show which protocol and frame caused "
1436 "this T.38 stream to be created",
1437 &global_t38_show_setup_info);
1438
1439 register_external_value_string("t38_T30_indicator_vals", t38_T30_indicator_vals);
1440 register_external_value_string("t38_T30_data_vals", t38_T30_data_vals);
1441}
1442
1443void
1444proto_reg_handoff_t38(void)
1445{
1446 rtp_handle = find_dissector_add_dependency("rtp", proto_t38);
1447 t30_hdlc_handle = find_dissector_add_dependency("t30.hdlc", proto_t38);
1448 proto_acdr = proto_get_id_by_filter_name("acdr");
1449 data_handle = find_dissector("data");
1450 dissector_add_for_decode_as("tcp.port", t38_tcp_handle);
1451 dissector_add_for_decode_as("udp.port", t38_udp_handle);
1452 heur_dissector_add("udp", dissect_t38_acdr_heur, "T38 over AC DR", "t38_acdr", proto_t38, HEURISTIC_DISABLE);
1453 dissector_add_uint("acdr.media_type", ACDR_T38, t38_udp_handle);
1454}