### Bug Summary

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