1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
4 /* asn2wrs.py -p t38 -c ./t38.cnf -s ./packet-t38-template -D . -O ../.. T38_2002.asn */
6 /* Input file: packet-t38-template.c */
8 #line 1 "./asn1/t38/packet-t38-template.c"
10 * Routines for T.38 packet dissection
12 * 2004 Alejandro Vaquero, add support Conversations for SDP
13 * 2006 Alejandro Vaquero, add T30 reassemble and dissection
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 1998 Gerald Combs
19 * SPDX-License-Identifier: GPL-2.0-or-later
23 /* Depending on what ASN.1 specification is used you may have to change
24 * the preference setting regarding Pre-Corrigendum ASN.1 specification:
25 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/1998/T38.html (Pre-Corrigendum=TRUE)
26 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(1998).html (Pre-Corrigendum=TRUE)
28 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(2002).html (Pre-Corrigendum=FALSE)
29 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002/t38.html (Pre-Corrigendum=FALSE)
30 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002-Amd1/T38.html (Pre-Corrigendum=FALSE)
34 * - TCP desegmentation is currently not supported for T.38 IFP directly over TCP.
35 * - H.245 dissectors should be updated to start conversations for T.38 similar to RTP.
36 * - Sometimes the last octet is not high-lighted when selecting something in the tree. Bug in PER dissector?
37 * - Add support for RTP payload audio/t38 (draft-jones-avt-audio-t38-03.txt), i.e. T38 in RTP packets.
43 #include <epan/packet.h>
44 #include <epan/reassemble.h>
45 #include <epan/conversation.h>
47 #include <epan/expert.h>
48 #include <epan/strutil.h>
49 #include <epan/prefs.h>
50 #include <epan/ipproto.h>
51 #include <epan/asn1.h>
52 #include <epan/proto_data.h>
54 #include "packet-t38.h"
55 #include "packet-per.h"
56 #include "packet-tpkt.h"
58 void proto_register_t38(void);
60 static int t38_tap = -1;
62 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
63 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
65 /* dissect packets that looks like RTP version 2 packets as RTP */
66 /* instead of as T.38. This may result in that some T.38 UPTL */
67 /* packets with sequence number values higher than 32767 may be */
68 /* shown as RTP packets. */
69 static gboolean dissect_possible_rtpv2_packets_as_rtp = FALSE;
72 /* Reassembly of T.38 PDUs over TPKT over TCP */
73 static gboolean t38_tpkt_reassembly = TRUE;
75 /* Preference setting whether TPKT header is used when sending T.38 over TCP.
76 * The default setting is Maybe where the dissector will look on the first
77 * bytes to try to determine whether TPKT header is used or not. This may not
78 * work so well in some cases. You may want to change the setting to Always or
81 #define T38_TPKT_NEVER 0 /* Assume that there is never a TPKT header */
82 #define T38_TPKT_ALWAYS 1 /* Assume that there is always a TPKT header */
83 #define T38_TPKT_MAYBE 2 /* Assume TPKT if first octets are 03-00-xx-xx */
84 static gint t38_tpkt_usage = T38_TPKT_MAYBE;
86 static const enum_val_t t38_tpkt_options[] = {
87 {"never", "Never", T38_TPKT_NEVER},
88 {"always", "Always", T38_TPKT_ALWAYS},
89 {"maybe", "Maybe", T38_TPKT_MAYBE},
96 static dissector_handle_t t38_udp_handle;
97 static dissector_handle_t t38_tcp_handle;
98 static dissector_handle_t t38_tcp_pdu_handle;
99 static dissector_handle_t rtp_handle;
100 static dissector_handle_t t30_hdlc_handle;
101 static dissector_handle_t data_handle;
103 static gint32 Type_of_msg_value;
104 static guint32 Data_Field_field_type_value;
105 static guint32 Data_value;
106 static guint32 T30ind_value;
107 static guint32 Data_Field_item_num;
109 static int proto_t38 = -1;
111 /*--- Included file: packet-t38-hf.c ---*/
112 #line 1 "./asn1/t38/packet-t38-hf.c"
113 static int hf_t38_IFPPacket_PDU = -1; /* IFPPacket */
114 static int hf_t38_UDPTLPacket_PDU = -1; /* UDPTLPacket */
115 static int hf_t38_type_of_msg = -1; /* Type_of_msg */
116 static int hf_t38_data_field = -1; /* Data_Field */
117 static int hf_t38_t30_indicator = -1; /* T30_indicator */
118 static int hf_t38_t30_data = -1; /* T30_data */
119 static int hf_t38_Data_Field_item = -1; /* Data_Field_item */
120 static int hf_t38_field_type = -1; /* T_field_type */
121 static int hf_t38_field_data = -1; /* T_field_data */
122 static int hf_t38_seq_number = -1; /* T_seq_number */
123 static int hf_t38_primary_ifp_packet = -1; /* T_primary_ifp_packet */
124 static int hf_t38_error_recovery = -1; /* T_error_recovery */
125 static int hf_t38_secondary_ifp_packets = -1; /* T_secondary_ifp_packets */
126 static int hf_t38_secondary_ifp_packets_item = -1; /* OpenType_IFPPacket */
127 static int hf_t38_fec_info = -1; /* T_fec_info */
128 static int hf_t38_fec_npackets = -1; /* INTEGER */
129 static int hf_t38_fec_data = -1; /* T_fec_data */
130 static int hf_t38_fec_data_item = -1; /* OCTET_STRING */
132 /*--- End of included file: packet-t38-hf.c ---*/
133 #line 103 "./asn1/t38/packet-t38-template.c"
135 /* T38 setup fields */
136 static int hf_t38_setup = -1;
137 static int hf_t38_setup_frame = -1;
138 static int hf_t38_setup_method = -1;
140 /* T38 Data reassemble fields */
141 static int hf_t38_fragments = -1;
142 static int hf_t38_fragment = -1;
143 static int hf_t38_fragment_overlap = -1;
144 static int hf_t38_fragment_overlap_conflicts = -1;
145 static int hf_t38_fragment_multiple_tails = -1;
146 static int hf_t38_fragment_too_long_fragment = -1;
147 static int hf_t38_fragment_error = -1;
148 static int hf_t38_fragment_count = -1;
149 static int hf_t38_reassembled_in = -1;
150 static int hf_t38_reassembled_length = -1;
152 static gint ett_t38 = -1;
154 /*--- Included file: packet-t38-ett.c ---*/
155 #line 1 "./asn1/t38/packet-t38-ett.c"
156 static gint ett_t38_IFPPacket = -1;
157 static gint ett_t38_Type_of_msg = -1;
158 static gint ett_t38_Data_Field = -1;
159 static gint ett_t38_Data_Field_item = -1;
160 static gint ett_t38_UDPTLPacket = -1;
161 static gint ett_t38_T_error_recovery = -1;
162 static gint ett_t38_T_secondary_ifp_packets = -1;
163 static gint ett_t38_T_fec_info = -1;
164 static gint ett_t38_T_fec_data = -1;
166 /*--- End of included file: packet-t38-ett.c ---*/
167 #line 123 "./asn1/t38/packet-t38-template.c"
168 static gint ett_t38_setup = -1;
170 static gint ett_data_fragment = -1;
171 static gint ett_data_fragments = -1;
173 static expert_field ei_t38_malformed = EI_INIT;
175 static gboolean primary_part = TRUE;
176 static guint32 seq_number = 0;
178 /* Tables for reassembly of Data fragments. */
179 static reassembly_table data_reassembly_table;
181 static const fragment_items data_frag_items = {
182 /* Fragment subtrees */
185 /* Fragment fields */
188 &hf_t38_fragment_overlap,
189 &hf_t38_fragment_overlap_conflicts,
190 &hf_t38_fragment_multiple_tails,
191 &hf_t38_fragment_too_long_fragment,
192 &hf_t38_fragment_error,
193 &hf_t38_fragment_count,
194 /* Reassembled in field */
195 &hf_t38_reassembled_in,
196 /* Reassembled length field */
197 &hf_t38_reassembled_length,
198 /* Reassembled data field */
204 typedef struct _fragment_key {
210 static conversation_t *p_conv= NULL;
211 static t38_conv *p_t38_conv = NULL;
212 static t38_conv *p_t38_packet_conv = NULL;
213 static t38_conv_info *p_t38_conv_info = NULL;
214 static t38_conv_info *p_t38_packet_conv_info = NULL;
216 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
217 #define RTP_VERSION(octet) ((octet) >> 6)
219 void proto_reg_handoff_t38(void);
221 static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
222 /* Preferences bool to control whether or not setup info should be shown */
223 static gboolean global_t38_show_setup_info = TRUE;
225 /* Can tap up to 4 T38 packets within same packet */
226 /* We only tap the primary part, not the redundancy */
227 #define MAX_T38_MESSAGES_IN_PACKET 4
228 static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET];
229 static int t38_info_current=0;
230 static t38_packet_info *t38_info=NULL;
233 /* Set up an T38 conversation */
234 void t38_add_address(packet_info *pinfo,
235 address *addr, int port,
237 const gchar *setup_method, guint32 setup_frame_number)
240 conversation_t* p_conversation;
241 t38_conv* p_conversation_data = NULL;
244 * If this isn't the first time this packet has been processed,
245 * we've already done this work, so we don't need to do it
248 if ((pinfo->fd->visited) || (t38_udp_handle == NULL))
253 clear_address(&null_addr);
256 * Check if the ip address and port combination is not
257 * already registered as a conversation.
259 p_conversation = find_conversation( setup_frame_number, addr, &null_addr, ENDPOINT_UDP, port, other_port,
260 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
263 * If not, create a new conversation.
265 if ( !p_conversation || p_conversation->setup_frame != setup_frame_number) {
266 p_conversation = conversation_new( setup_frame_number, addr, &null_addr, ENDPOINT_UDP,
267 (guint32)port, (guint32)other_port,
268 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
272 conversation_set_dissector(p_conversation, t38_udp_handle);
275 * Check if the conversation has data associated with it.
277 p_conversation_data = (t38_conv*)conversation_get_proto_data(p_conversation, proto_t38);
280 * If not, add a new data item.
282 if ( ! p_conversation_data ) {
283 /* Create conversation data */
284 p_conversation_data = wmem_new(wmem_file_scope(), t38_conv);
286 conversation_add_proto_data(p_conversation, proto_t38, p_conversation_data);
290 * Update the conversation data.
292 g_strlcpy(p_conversation_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE);
293 p_conversation_data->setup_frame_number = setup_frame_number;
294 p_conversation_data->src_t38_info.reass_ID = 0;
295 p_conversation_data->src_t38_info.reass_start_seqnum = -1;
296 p_conversation_data->src_t38_info.reass_data_type = 0;
297 p_conversation_data->src_t38_info.last_seqnum = -1;
298 p_conversation_data->src_t38_info.packet_lost = 0;
299 p_conversation_data->src_t38_info.burst_lost = 0;
300 p_conversation_data->src_t38_info.time_first_t4_data = 0;
301 p_conversation_data->src_t38_info.additional_hdlc_data_field_counter = 0;
302 p_conversation_data->src_t38_info.seqnum_prev_data_field = -1;
304 p_conversation_data->dst_t38_info.reass_ID = 0;
305 p_conversation_data->dst_t38_info.reass_start_seqnum = -1;
306 p_conversation_data->dst_t38_info.reass_data_type = 0;
307 p_conversation_data->dst_t38_info.last_seqnum = -1;
308 p_conversation_data->dst_t38_info.packet_lost = 0;
309 p_conversation_data->dst_t38_info.burst_lost = 0;
310 p_conversation_data->dst_t38_info.time_first_t4_data = 0;
311 p_conversation_data->dst_t38_info.additional_hdlc_data_field_counter = 0;
312 p_conversation_data->dst_t38_info.seqnum_prev_data_field = -1;
316 static fragment_head *
317 force_reassemble_seq(reassembly_table *table, packet_info *pinfo, guint32 id)
319 fragment_head *fd_head;
321 fragment_item *last_fd;
322 guint32 dfpos, size, packet_lost, burst_lost, seq_num;
325 fd_head = fragment_get(table, pinfo, id, NULL);
327 /* have we already seen this frame ?*/
328 if (pinfo->fd->visited) {
329 if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
337 /* we must have it to continue */
341 /* check for packet lost and count the burst of packet lost */
345 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
346 if (seq_num != fd_i->offset) {
347 packet_lost += fd_i->offset - seq_num;
348 if ( (fd_i->offset - seq_num) > burst_lost ) {
349 burst_lost = fd_i->offset - seq_num;
352 seq_num = fd_i->offset + 1;
355 /* we have received an entire packet, defragment it and
360 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
361 if(!last_fd || last_fd->offset!=fd_i->offset){
367 data = (guint8 *) wmem_alloc(pinfo->pool, size);
368 fd_head->tvb_data = tvb_new_real_data(data, size, size);
369 fd_head->len = size; /* record size for caller */
371 /* add all data fragments */
374 for (fd_i=fd_head->next;fd_i && fd_i->len + dfpos <= size;fd_i=fd_i->next) {
376 if(!last_fd || last_fd->offset!=fd_i->offset){
377 tvb_memcpy(fd_i->tvb_data, data+dfpos, 0, fd_i->len);
380 /* duplicate/retransmission/overlap */
381 fd_i->flags |= FD_OVERLAP;
382 fd_head->flags |= FD_OVERLAP;
383 if( (last_fd->len!=fd_i->len)
384 || tvb_memeql(last_fd->tvb_data, 0, tvb_get_ptr(fd_i->tvb_data, 0, last_fd->len), last_fd->len) ){
385 fd_i->flags |= FD_OVERLAPCONFLICT;
386 fd_head->flags |= FD_OVERLAPCONFLICT;
393 /* we have defragmented the pdu, now free all fragments*/
394 for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
396 tvb_free(fd_i->tvb_data);
401 /* mark this packet as defragmented */
402 fd_head->flags |= FD_DEFRAGMENTED;
403 fd_head->reassembled_in=pinfo->num;
405 col_append_fstr(pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost, burst_lost);
407 p_t38_packet_conv_info->packet_lost = packet_lost;
408 p_t38_packet_conv_info->burst_lost = burst_lost;
415 /*--- Included file: packet-t38-fn.c ---*/
416 #line 1 "./asn1/t38/packet-t38-fn.c"
418 const value_string t38_T30_indicator_vals[] = {
422 { 3, "v21-preamble" },
423 { 4, "v27-2400-training" },
424 { 5, "v27-4800-training" },
425 { 6, "v29-7200-training" },
426 { 7, "v29-9600-training" },
427 { 8, "v17-7200-short-training" },
428 { 9, "v17-7200-long-training" },
429 { 10, "v17-9600-short-training" },
430 { 11, "v17-9600-long-training" },
431 { 12, "v17-12000-short-training" },
432 { 13, "v17-12000-long-training" },
433 { 14, "v17-14400-short-training" },
434 { 15, "v17-14400-long-training" },
437 { 18, "v34-cntl-channel-1200" },
438 { 19, "v34-pri-channel" },
439 { 20, "v34-CC-retrain" },
440 { 21, "v33-12000-training" },
441 { 22, "v33-14400-training" },
447 dissect_t38_T30_indicator(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
448 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
449 16, &T30ind_value, TRUE, 7, NULL);
451 #line 29 "./asn1/t38/t38.cnf"
453 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
454 val_to_str(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
459 t38_info->t30ind_value = T30ind_value;
465 const value_string t38_T30_data_vals[] = {
476 { 10, "v34-pri-rate" },
477 { 11, "v34-CC-1200" },
478 { 12, "v34-pri-ch" },
486 dissect_t38_T30_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
487 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
488 9, &Data_value, TRUE, 6, NULL);
490 #line 41 "./asn1/t38/t38.cnf"
492 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
493 val_to_str(Data_value,t38_T30_data_vals,"<unknown>"));
499 t38_info->data_value = Data_value;
505 static const value_string t38_Type_of_msg_vals[] = {
506 { 0, "t30-indicator" },
511 static const per_choice_t Type_of_msg_choice[] = {
512 { 0, &hf_t38_t30_indicator , ASN1_NO_EXTENSIONS , dissect_t38_T30_indicator },
513 { 1, &hf_t38_t30_data , ASN1_NO_EXTENSIONS , dissect_t38_T30_data },
518 dissect_t38_Type_of_msg(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
519 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
520 ett_t38_Type_of_msg, Type_of_msg_choice,
523 #line 22 "./asn1/t38/t38.cnf"
526 t38_info->type_msg = Type_of_msg_value;
532 static const value_string t38_T_field_type_vals[] = {
534 { 1, "hdlc-sig-end" },
535 { 2, "hdlc-fcs-OK" },
536 { 3, "hdlc-fcs-BAD" },
537 { 4, "hdlc-fcs-OK-sig-end" },
538 { 5, "hdlc-fcs-BAD-sig-end" },
539 { 6, "t4-non-ecm-data" },
540 { 7, "t4-non-ecm-sig-end" },
543 { 10, "ci-message" },
550 dissect_t38_T_field_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
551 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
552 8, &Data_Field_field_type_value, (use_pre_corrigendum_asn1_specification)?FALSE:TRUE, (use_pre_corrigendum_asn1_specification)?0:4, NULL);
554 #line 61 "./asn1/t38/t38.cnf"
556 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
557 val_to_str(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
560 /* We only reassmeble packets in the Primary part and in the first two Items. */
561 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
562 /* using the current ressaemble functions. */
563 /* TODO: reassemble all the Items in one frame */
564 if (primary_part && (Data_Field_item_num<2)) {
565 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*/
566 fragment_head *frag_msg = NULL;
567 tvbuff_t* new_tvb = NULL;
568 gboolean save_fragmented = actx->pinfo->fragmented;
570 actx->pinfo->fragmented = TRUE;
572 /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
573 if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
574 frag_msg = fragment_add_seq(&data_reassembly_table, /* reassembly table */
575 tvb, offset, actx->pinfo,
576 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
578 seq_number + Data_Field_item_num - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */
580 0, /* fragment length */
581 FALSE, /* More fragments */
583 if ( Data_Field_field_type_value == 7 ) {
584 /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
585 * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
586 * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
587 * and get some stat, like packet lost and burst number of packet lost
590 force_reassemble_seq(&data_reassembly_table, /* reassembly table */
592 p_t38_packet_conv_info->reass_ID /* ID for fragments belonging together */
595 col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
597 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
601 if (p_t38_packet_conv_info->packet_lost) {
602 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, " Pack lost: %d, Pack burst lost: %d", p_t38_packet_conv_info->packet_lost, p_t38_packet_conv_info->burst_lost);
604 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
607 process_reassembled_data(tvb, offset, actx->pinfo,
608 "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
610 /* Now reset fragmentation information in pinfo */
611 actx->pinfo->fragmented = save_fragmented;
613 t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
614 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 */
617 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
618 "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
620 /* Now reset fragmentation information in pinfo */
621 actx->pinfo->fragmented = save_fragmented;
623 if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info);
626 proto_tree_add_expert_format(tree, actx->pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
627 "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
628 col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
629 actx->pinfo->fragmented = save_fragmented;
633 /* reset the reassemble ID and the start seq number if it is not HDLC data */
634 if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
635 p_t38_conv_info->reass_ID = 0;
636 p_t38_conv_info->reass_start_seqnum = -1;
637 p_t38_conv_info->additional_hdlc_data_field_counter = 0;
638 p_t38_conv_info->seqnum_prev_data_field = -1;
640 t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
649 dissect_t38_T_field_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
650 #line 151 "./asn1/t38/t38.cnf"
651 tvbuff_t *value_tvb = NULL;
654 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
655 1, 65535, FALSE, &value_tvb);
657 value_len = tvb_reported_length(value_tvb);
661 #line 158 "./asn1/t38/t38.cnf"
664 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
665 tvb_bytes_to_str(wmem_packet_scope(), value_tvb,0,value_len));
668 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
669 tvb_bytes_to_str(wmem_packet_scope(), value_tvb,0,7));
673 /* We only reassmeble packets in the Primary part and in the first two Items. */
674 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
675 /* using the current ressaemble functions. */
676 /* TODO: reassemble all the Items in one frame */
677 if (primary_part && (Data_Field_item_num<2)) {
678 fragment_head *frag_msg = NULL;
680 /* HDLC Data or t4-non-ecm-data */
681 if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
682 gboolean save_fragmented = actx->pinfo->fragmented;
684 actx->pinfo->fragmented = TRUE;
686 /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
687 if (p_t38_packet_conv && p_t38_conv && (p_t38_packet_conv_info->reass_ID == 0)) {
688 /* we use the first fragment's frame_number as fragment ID because the protocol doesn't provide it */
689 p_t38_conv_info->reass_ID = actx->pinfo->num;
690 p_t38_conv_info->reass_start_seqnum = seq_number;
691 p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->rel_ts);
692 p_t38_conv_info->additional_hdlc_data_field_counter = 0;
693 p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
694 p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
695 p_t38_packet_conv_info->seqnum_prev_data_field = p_t38_conv_info->seqnum_prev_data_field;
696 p_t38_packet_conv_info->additional_hdlc_data_field_counter = p_t38_conv_info->additional_hdlc_data_field_counter;
697 p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
699 if (seq_number == (guint32)p_t38_packet_conv_info->seqnum_prev_data_field){
700 p_t38_packet_conv_info->additional_hdlc_data_field_counter ++;
702 p_t38_conv_info->additional_hdlc_data_field_counter = p_t38_packet_conv_info->additional_hdlc_data_field_counter;
705 frag_msg = fragment_add_seq(&data_reassembly_table,
708 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
710 seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */
711 value_len, /* fragment length */
712 TRUE, /* More fragments */
714 p_t38_packet_conv_info->seqnum_prev_data_field = (gint32)seq_number;
715 process_reassembled_data(tvb, offset, actx->pinfo,
716 "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
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)",
721 seq_number + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter
722 - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
724 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
728 /* Now reset fragmentation information in pinfo */
729 actx->pinfo->fragmented = save_fragmented;
737 static const per_sequence_t Data_Field_item_sequence[] = {
738 { &hf_t38_field_type , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_field_type },
739 { &hf_t38_field_data , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_T_field_data },
744 dissect_t38_Data_Field_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
745 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
746 ett_t38_Data_Field_item, Data_Field_item_sequence);
748 #line 53 "./asn1/t38/t38.cnf"
749 if (primary_part) Data_Field_item_num++;
755 static const per_sequence_t Data_Field_sequence_of[1] = {
756 { &hf_t38_Data_Field_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Data_Field_item },
760 dissect_t38_Data_Field(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
761 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
762 ett_t38_Data_Field, Data_Field_sequence_of);
768 static const per_sequence_t IFPPacket_sequence[] = {
769 { &hf_t38_type_of_msg , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Type_of_msg },
770 { &hf_t38_data_field , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_Data_Field },
775 dissect_t38_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
776 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
777 ett_t38_IFPPacket, IFPPacket_sequence);
785 dissect_t38_T_seq_number(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
786 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
787 0U, 65535U, &seq_number, FALSE);
789 #line 238 "./asn1/t38/t38.cnf"
792 t38_info->seq_num = seq_number;
794 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
802 dissect_t38_T_primary_ifp_packet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
803 #line 246 "./asn1/t38/t38.cnf"
806 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
808 #line 248 "./asn1/t38/t38.cnf"
809 /* if is a valid t38 packet, add to tap */
810 /* Note that t4-non-ecm-sig-end without first_t4_data is not valid */
811 if (p_t38_packet_conv && (!actx->pinfo->flags.in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum) &&
812 !(t38_info->type_msg == 1 && t38_info->Data_Field_field_type_value == 7 && t38_info->frame_num_first_t4_data == 0))
813 tap_queue_packet(t38_tap, actx->pinfo, t38_info);
815 if (p_t38_conv) p_t38_conv_info->last_seqnum = (gint32) seq_number;
823 dissect_t38_OpenType_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
824 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
830 static const per_sequence_t T_secondary_ifp_packets_sequence_of[1] = {
831 { &hf_t38_secondary_ifp_packets_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OpenType_IFPPacket },
835 dissect_t38_T_secondary_ifp_packets(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
836 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
837 ett_t38_T_secondary_ifp_packets, T_secondary_ifp_packets_sequence_of);
845 dissect_t38_INTEGER(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
846 offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
854 dissect_t38_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
855 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
856 NO_BOUND, NO_BOUND, FALSE, NULL);
862 static const per_sequence_t T_fec_data_sequence_of[1] = {
863 { &hf_t38_fec_data_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OCTET_STRING },
867 dissect_t38_T_fec_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
868 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
869 ett_t38_T_fec_data, T_fec_data_sequence_of);
875 static const per_sequence_t T_fec_info_sequence[] = {
876 { &hf_t38_fec_npackets , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_INTEGER },
877 { &hf_t38_fec_data , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_fec_data },
882 dissect_t38_T_fec_info(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
883 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
884 ett_t38_T_fec_info, T_fec_info_sequence);
890 static const value_string t38_T_error_recovery_vals[] = {
891 { 0, "secondary-ifp-packets" },
896 static const per_choice_t T_error_recovery_choice[] = {
897 { 0, &hf_t38_secondary_ifp_packets, ASN1_NO_EXTENSIONS , dissect_t38_T_secondary_ifp_packets },
898 { 1, &hf_t38_fec_info , ASN1_NO_EXTENSIONS , dissect_t38_T_fec_info },
903 dissect_t38_T_error_recovery(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
904 #line 258 "./asn1/t38/t38.cnf"
905 primary_part = FALSE;
907 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
908 ett_t38_T_error_recovery, T_error_recovery_choice,
911 #line 260 "./asn1/t38/t38.cnf"
918 static const per_sequence_t UDPTLPacket_sequence[] = {
919 { &hf_t38_seq_number , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_seq_number },
920 { &hf_t38_primary_ifp_packet, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_primary_ifp_packet },
921 { &hf_t38_error_recovery , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_error_recovery },
926 dissect_t38_UDPTLPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
927 #line 232 "./asn1/t38/t38.cnf"
928 /* Initialize to something else than data type */
929 Data_Field_field_type_value = 1;
931 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
932 ett_t38_UDPTLPacket, UDPTLPacket_sequence);
939 static int dissect_IFPPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
942 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
943 offset = dissect_t38_IFPPacket(tvb, offset, &asn1_ctx, tree, hf_t38_IFPPacket_PDU);
944 offset += 7; offset >>= 3;
947 static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
950 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
951 offset = dissect_t38_UDPTLPacket(tvb, offset, &asn1_ctx, tree, hf_t38_UDPTLPacket_PDU);
952 offset += 7; offset >>= 3;
957 /*--- End of included file: packet-t38-fn.c ---*/
958 #line 370 "./asn1/t38/packet-t38-template.c"
960 /* initialize the tap t38_info and the conversation */
962 init_t38_info_conv(packet_info *pinfo)
966 if (t38_info_current==MAX_T38_MESSAGES_IN_PACKET) {
969 t38_info = &t38_info_arr[t38_info_current];
971 t38_info->seq_num = 0;
972 t38_info->type_msg = 0;
973 t38_info->data_value = 0;
974 t38_info->t30ind_value =0;
975 t38_info->setup_frame_number = 0;
976 t38_info->Data_Field_field_type_value = 0;
977 t38_info->desc[0] = '\0';
978 t38_info->desc_comment[0] = '\0';
979 t38_info->time_first_t4_data = 0;
980 t38_info->frame_num_first_t4_data = 0;
984 p_t38_packet_conv hold the conversation info in each of the packets.
985 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
986 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
987 need to use p_t38_conv
989 p_t38_packet_conv = NULL;
992 /* Use existing packet info if available */
993 p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
996 /* find the conversation used for Reassemble and Setup Info */
997 p_conv = find_conversation(pinfo->num, &pinfo->net_dst, &pinfo->net_src,
998 conversation_pt_to_endpoint_type(pinfo->ptype),
999 pinfo->destport, pinfo->srcport, NO_ADDR_B | NO_PORT_B);
1001 /* create a conv if it doen't exist */
1003 p_conv = conversation_new(pinfo->num, &pinfo->net_src, &pinfo->net_dst,
1004 conversation_pt_to_endpoint_type(pinfo->ptype), pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
1007 conversation_set_dissector(p_conv, t38_udp_handle);
1010 p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
1012 /* create the conversation if it doesn't exist */
1014 p_t38_conv = wmem_new(wmem_file_scope(), t38_conv);
1015 p_t38_conv->setup_method[0] = '\0';
1016 p_t38_conv->setup_frame_number = 0;
1018 p_t38_conv->src_t38_info.reass_ID = 0;
1019 p_t38_conv->src_t38_info.reass_start_seqnum = -1;
1020 p_t38_conv->src_t38_info.reass_data_type = 0;
1021 p_t38_conv->src_t38_info.last_seqnum = -1;
1022 p_t38_conv->src_t38_info.packet_lost = 0;
1023 p_t38_conv->src_t38_info.burst_lost = 0;
1024 p_t38_conv->src_t38_info.time_first_t4_data = 0;
1025 p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
1026 p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
1028 p_t38_conv->dst_t38_info.reass_ID = 0;
1029 p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
1030 p_t38_conv->dst_t38_info.reass_data_type = 0;
1031 p_t38_conv->dst_t38_info.last_seqnum = -1;
1032 p_t38_conv->dst_t38_info.packet_lost = 0;
1033 p_t38_conv->dst_t38_info.burst_lost = 0;
1034 p_t38_conv->dst_t38_info.time_first_t4_data = 0;
1035 p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
1036 p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
1038 conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
1041 if (!p_t38_packet_conv) {
1042 /* copy the t38 conversation info to the packet t38 conversation */
1043 p_t38_packet_conv = wmem_new(wmem_file_scope(), t38_conv);
1044 g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);
1045 p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number;
1047 memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info));
1048 memcpy(&(p_t38_packet_conv->dst_t38_info), &(p_t38_conv->dst_t38_info), sizeof(t38_conv_info));
1050 p_add_proto_data(wmem_file_scope(), pinfo, proto_t38, 0, p_t38_packet_conv);
1053 if (addresses_equal(conversation_key_addr1(p_conv->key_ptr), &pinfo->net_src)) {
1054 p_t38_conv_info = &(p_t38_conv->src_t38_info);
1055 p_t38_packet_conv_info = &(p_t38_packet_conv->src_t38_info);
1057 p_t38_conv_info = &(p_t38_conv->dst_t38_info);
1058 p_t38_packet_conv_info = &(p_t38_packet_conv->dst_t38_info);
1061 /* update t38_info */
1062 t38_info->setup_frame_number = p_t38_packet_conv->setup_frame_number;
1065 /* Entry point for dissection */
1067 dissect_t38_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1075 * XXX - heuristic to check for misidentified packets.
1077 if (dissect_possible_rtpv2_packets_as_rtp){
1078 octet1 = tvb_get_guint8(tvb, offset);
1079 if (RTP_VERSION(octet1) == 2){
1080 return call_dissector(rtp_handle,tvb,pinfo,tree);
1084 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1085 col_clear(pinfo->cinfo, COL_INFO);
1087 primary_part = TRUE;
1089 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1090 Data_Field_item_num = 0;
1092 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1093 tr=proto_item_add_subtree(it, ett_t38);
1095 /* init tap and conv info */
1096 init_t38_info_conv(pinfo);
1098 /* Show Conversation setup info if exists*/
1099 if (global_t38_show_setup_info) {
1100 show_setup_info(tvb, tr, p_t38_packet_conv);
1103 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
1105 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr, NULL);
1107 if (tvb_reported_length_remaining(tvb,offset)>0){
1108 proto_tree_add_expert_format(tr, pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1109 "[MALFORMED PACKET or wrong preference settings]");
1110 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1112 return tvb_captured_length(tvb);
1116 dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1122 guint16 ifp_packet_number=1;
1124 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1125 col_clear(pinfo->cinfo, COL_INFO);
1127 primary_part = TRUE;
1129 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1130 Data_Field_item_num = 0;
1132 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1133 tr=proto_item_add_subtree(it, ett_t38);
1135 /* init tap and conv info */
1136 init_t38_info_conv(pinfo);
1138 /* Show Conversation setup info if exists*/
1139 if (global_t38_show_setup_info) {
1140 show_setup_info(tvb, tr, p_t38_packet_conv);
1143 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
1145 while(tvb_reported_length_remaining(tvb,offset)>0)
1147 next_tvb = tvb_new_subset_remaining(tvb, offset);
1148 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr, NULL);
1149 ifp_packet_number++;
1151 if(tvb_reported_length_remaining(tvb,offset)>0){
1152 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1153 proto_tree_add_expert_format(tr, pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1154 "[MALFORMED PACKET or wrong preference settings]");
1155 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1158 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
1163 return tvb_captured_length(tvb);
1167 dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1169 primary_part = TRUE;
1171 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1172 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1174 else if((t38_tpkt_usage == T38_TPKT_NEVER) || (is_tpkt(tvb,1) == -1)){
1175 dissect_t38_tcp_pdu(tvb, pinfo, tree, data);
1178 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1180 return tvb_captured_length(tvb);
1183 /* Look for conversation info and display any setup info found */
1185 show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conversation)
1187 proto_tree *t38_setup_tree;
1190 if (!p_t38_conversation || p_t38_conversation->setup_frame_number == 0) {
1191 /* there is no Setup info */
1195 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
1197 "Stream setup by %s (frame %u)",
1198 p_t38_conversation->setup_method,
1199 p_t38_conversation->setup_frame_number);
1200 PROTO_ITEM_SET_GENERATED(ti);
1201 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
1204 /* Add details into subtree */
1205 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
1206 tvb, 0, 0, p_t38_conversation->setup_frame_number);
1207 PROTO_ITEM_SET_GENERATED(item);
1208 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
1209 tvb, 0, 0, p_t38_conversation->setup_method);
1210 PROTO_ITEM_SET_GENERATED(item);
1216 /* Wireshark Protocol Registration */
1218 proto_register_t38(void)
1220 static hf_register_info hf[] =
1223 /*--- Included file: packet-t38-hfarr.c ---*/
1224 #line 1 "./asn1/t38/packet-t38-hfarr.c"
1225 { &hf_t38_IFPPacket_PDU,
1226 { "IFPPacket", "t38.IFPPacket_element",
1227 FT_NONE, BASE_NONE, NULL, 0,
1229 { &hf_t38_UDPTLPacket_PDU,
1230 { "UDPTLPacket", "t38.UDPTLPacket_element",
1231 FT_NONE, BASE_NONE, NULL, 0,
1233 { &hf_t38_type_of_msg,
1234 { "type-of-msg", "t38.type_of_msg",
1235 FT_UINT32, BASE_DEC, VALS(t38_Type_of_msg_vals), 0,
1237 { &hf_t38_data_field,
1238 { "data-field", "t38.data_field",
1239 FT_UINT32, BASE_DEC, NULL, 0,
1241 { &hf_t38_t30_indicator,
1242 { "t30-indicator", "t38.t30_indicator",
1243 FT_UINT32, BASE_DEC, VALS(t38_T30_indicator_vals), 0,
1246 { "t30-data", "t38.t30_data",
1247 FT_UINT32, BASE_DEC, VALS(t38_T30_data_vals), 0,
1249 { &hf_t38_Data_Field_item,
1250 { "Data-Field item", "t38.Data_Field_item_element",
1251 FT_NONE, BASE_NONE, NULL, 0,
1253 { &hf_t38_field_type,
1254 { "field-type", "t38.field_type",
1255 FT_UINT32, BASE_DEC, VALS(t38_T_field_type_vals), 0,
1257 { &hf_t38_field_data,
1258 { "field-data", "t38.field_data",
1259 FT_BYTES, BASE_NONE, NULL, 0,
1261 { &hf_t38_seq_number,
1262 { "seq-number", "t38.seq_number",
1263 FT_UINT32, BASE_DEC, NULL, 0,
1265 { &hf_t38_primary_ifp_packet,
1266 { "primary-ifp-packet", "t38.primary_ifp_packet_element",
1267 FT_NONE, BASE_NONE, NULL, 0,
1269 { &hf_t38_error_recovery,
1270 { "error-recovery", "t38.error_recovery",
1271 FT_UINT32, BASE_DEC, VALS(t38_T_error_recovery_vals), 0,
1273 { &hf_t38_secondary_ifp_packets,
1274 { "secondary-ifp-packets", "t38.secondary_ifp_packets",
1275 FT_UINT32, BASE_DEC, NULL, 0,
1277 { &hf_t38_secondary_ifp_packets_item,
1278 { "secondary-ifp-packets item", "t38.secondary_ifp_packets_item_element",
1279 FT_NONE, BASE_NONE, NULL, 0,
1280 "OpenType_IFPPacket", HFILL }},
1282 { "fec-info", "t38.fec_info_element",
1283 FT_NONE, BASE_NONE, NULL, 0,
1285 { &hf_t38_fec_npackets,
1286 { "fec-npackets", "t38.fec_npackets",
1287 FT_INT32, BASE_DEC, NULL, 0,
1288 "INTEGER", HFILL }},
1290 { "fec-data", "t38.fec_data",
1291 FT_UINT32, BASE_DEC, NULL, 0,
1293 { &hf_t38_fec_data_item,
1294 { "fec-data item", "t38.fec_data_item",
1295 FT_BYTES, BASE_NONE, NULL, 0,
1296 "OCTET_STRING", HFILL }},
1298 /*--- End of included file: packet-t38-hfarr.c ---*/
1299 #line 634 "./asn1/t38/packet-t38-template.c"
1301 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
1302 NULL, 0x0, "Stream setup, method and frame number", HFILL }},
1303 { &hf_t38_setup_frame,
1304 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
1305 NULL, 0x0, "Frame that set up this stream", HFILL }},
1306 { &hf_t38_setup_method,
1307 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
1308 NULL, 0x0, "Method used to set up this stream", HFILL }},
1310 {"Message fragments", "t38.fragments",
1311 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1313 {"Message fragment", "t38.fragment",
1314 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1315 {&hf_t38_fragment_overlap,
1316 {"Message fragment overlap", "t38.fragment.overlap",
1317 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1318 {&hf_t38_fragment_overlap_conflicts,
1319 {"Message fragment overlapping with conflicting data",
1320 "t38.fragment.overlap.conflicts",
1321 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1322 {&hf_t38_fragment_multiple_tails,
1323 {"Message has multiple tail fragments",
1324 "t38.fragment.multiple_tails",
1325 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1326 {&hf_t38_fragment_too_long_fragment,
1327 {"Message fragment too long", "t38.fragment.too_long_fragment",
1328 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1329 {&hf_t38_fragment_error,
1330 {"Message defragmentation error", "t38.fragment.error",
1331 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1332 {&hf_t38_fragment_count,
1333 {"Message fragment count", "t38.fragment.count",
1334 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
1335 {&hf_t38_reassembled_in,
1336 {"Reassembled in", "t38.reassembled.in",
1337 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1338 {&hf_t38_reassembled_length,
1339 {"Reassembled T38 length", "t38.reassembled.length",
1340 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
1343 static gint *ett[] =
1347 /*--- Included file: packet-t38-ettarr.c ---*/
1348 #line 1 "./asn1/t38/packet-t38-ettarr.c"
1350 &ett_t38_Type_of_msg,
1351 &ett_t38_Data_Field,
1352 &ett_t38_Data_Field_item,
1353 &ett_t38_UDPTLPacket,
1354 &ett_t38_T_error_recovery,
1355 &ett_t38_T_secondary_ifp_packets,
1356 &ett_t38_T_fec_info,
1357 &ett_t38_T_fec_data,
1359 /*--- End of included file: packet-t38-ettarr.c ---*/
1360 #line 681 "./asn1/t38/packet-t38-template.c"
1366 static ei_register_info ei[] = {
1367 { &ei_t38_malformed, { "t38.malformed", PI_MALFORMED, PI_ERROR, "Malformed packet", EXPFILL }},
1370 module_t *t38_module;
1371 expert_module_t* expert_t38;
1373 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
1374 proto_register_field_array(proto_t38, hf, array_length(hf));
1375 proto_register_subtree_array(ett, array_length(ett));
1376 expert_t38 = expert_register_protocol(proto_t38);
1377 expert_register_field_array(expert_t38, ei, array_length(ei));
1378 register_dissector("t38_udp", dissect_t38_udp, proto_t38);
1380 /* Register reassemble tables for HDLC */
1381 reassembly_table_register(&data_reassembly_table,
1382 &addresses_reassembly_table_functions);
1384 t38_tap = register_tap("t38");
1386 t38_module = prefs_register_protocol(proto_t38, NULL);
1387 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
1388 "Use the Pre-Corrigendum ASN.1 specification",
1389 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
1390 "ASN.1 specification (1998).",
1391 &use_pre_corrigendum_asn1_specification);
1392 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
1393 "Dissect possible RTP version 2 packets with RTP dissector",
1394 "Whether a UDP packet that looks like RTP version 2 packet will "
1395 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
1396 "packets with sequence number higher than 32767 may be dissected as RTP.",
1397 &dissect_possible_rtpv2_packets_as_rtp);
1398 prefs_register_bool_preference(t38_module, "reassembly",
1399 "Reassemble T.38 PDUs over TPKT over TCP",
1400 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
1401 "when TPKT is used over TCP. "
1402 "To use this option, you must also enable \"Allow subdissectors to reassemble "
1403 "TCP streams\" in the TCP protocol settings.",
1404 &t38_tpkt_reassembly);
1405 prefs_register_enum_preference(t38_module, "tpkt_usage",
1406 "TPKT used over TCP",
1407 "Whether T.38 is used with TPKT for TCP",
1408 (gint *)&t38_tpkt_usage,t38_tpkt_options,FALSE);
1410 prefs_register_bool_preference(t38_module, "show_setup_info",
1411 "Show stream setup information",
1412 "Where available, show which protocol and frame caused "
1413 "this T.38 stream to be created",
1414 &global_t38_show_setup_info);
1419 proto_reg_handoff_t38(void)
1421 t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
1422 t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
1423 t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
1424 rtp_handle = find_dissector_add_dependency("rtp", proto_t38);
1425 t30_hdlc_handle = find_dissector_add_dependency("t30.hdlc", proto_t38);
1426 data_handle = find_dissector("data");
1427 dissector_add_for_decode_as("tcp.port", t38_tcp_handle);
1428 dissector_add_for_decode_as("udp.port", t38_udp_handle);