### Bug Summary

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

### Annotated Source Code

Press '?' to see keyboard shortcuts

Show analyzer invocation
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 /usr/include/libxml2 -isystem /builds/wireshark/wireshark/epan -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-07-20-100411-3661-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-t38.c

Keyboard shortcuts:

- Use 'j/k' keys for keyboard navigation
- Use 'Shift+S' to show/hide relevant lines
- Use '?' to toggle this window

Close
Show only relevant lines Show control flow arrows

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