1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler */
4 /* ../../tools/asn2wrs.py -p t38 -c ./t38.cnf -s ./packet-t38-template -D . T38_2002.asn */
6 /* Input file: packet-t38-template.c */
8 #line 1 "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
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 /* Depending on what ASN.1 specification is used you may have to change
38 * the preference setting regarding Pre-Corrigendum ASN.1 specification:
39 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/1998/T38.html (Pre-Corrigendum=TRUE)
40 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(1998).html (Pre-Corrigendum=TRUE)
42 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(2002).html (Pre-Corrigendum=FALSE)
43 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002/t38.html (Pre-Corrigendum=FALSE)
44 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002-Amd1/T38.html (Pre-Corrigendum=FALSE)
48 * - TCP desegmentation is currently not supported for T.38 IFP directly over TCP.
49 * - H.245 dissectors should be updated to start conversations for T.38 similar to RTP.
50 * - Sometimes the last octet is not high-lighted when selecting something in the tree. Bug in PER dissector?
51 * - Add support for RTP payload audio/t38 (draft-jones-avt-audio-t38-03.txt), i.e. T38 in RTP packets.
60 #include <epan/packet.h>
61 #include <epan/reassemble.h>
62 #include <epan/conversation.h>
64 #include <epan/expert.h>
69 #include "packet-t38.h"
70 #include <epan/prefs.h>
71 #include <epan/ipproto.h>
72 #include <epan/asn1.h>
73 #include "packet-per.h"
74 #include "packet-tpkt.h"
75 #include <epan/emem.h>
76 #include <epan/strutil.h>
79 static guint global_t38_tcp_port = PORT_T38;
80 static guint global_t38_udp_port = PORT_T38;
82 static int t38_tap = -1;
84 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
85 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
87 /* dissect packets that looks like RTP version 2 packets as RTP */
88 /* instead of as T.38. This may result in that some T.38 UPTL */
89 /* packets with sequence number values higher than 32767 may be */
90 /* shown as RTP packets. */
91 static gboolean dissect_possible_rtpv2_packets_as_rtp = FALSE;
94 /* Reassembly of T.38 PDUs over TPKT over TCP */
95 static gboolean t38_tpkt_reassembly = TRUE;
97 /* Preference setting whether TPKT header is used when sending T.38 over TCP.
98 * The default setting is Maybe where the dissector will look on the first
99 * bytes to try to determine whether TPKT header is used or not. This may not
100 * work so well in some cases. You may want to change the setting to Always or
103 #define T38_TPKT_NEVER 0 /* Assume that there is never a TPKT header */
104 #define T38_TPKT_ALWAYS 1 /* Assume that there is always a TPKT header */
105 #define T38_TPKT_MAYBE 2 /* Assume TPKT if first octets are 03-00-xx-xx */
106 static gint t38_tpkt_usage = T38_TPKT_MAYBE;
108 static const enum_val_t t38_tpkt_options[] = {
109 {"never", "Never", T38_TPKT_NEVER},
110 {"always", "Always", T38_TPKT_ALWAYS},
111 {"maybe", "Maybe", T38_TPKT_MAYBE},
118 static dissector_handle_t t38_udp_handle;
119 static dissector_handle_t t38_tcp_handle;
120 static dissector_handle_t t38_tcp_pdu_handle;
121 static dissector_handle_t rtp_handle;
122 static dissector_handle_t t30_hdlc_handle;
123 static dissector_handle_t data_handle;
125 static gint32 Type_of_msg_value;
126 static guint32 Data_Field_field_type_value;
127 static guint32 Data_value;
128 static guint32 T30ind_value;
129 static guint32 Data_Field_item_num;
131 static int proto_t38 = -1;
133 /*--- Included file: packet-t38-hf.c ---*/
134 #line 1 "packet-t38-hf.c"
135 static int hf_t38_IFPPacket_PDU = -1; /* IFPPacket */
136 static int hf_t38_UDPTLPacket_PDU = -1; /* UDPTLPacket */
137 static int hf_t38_type_of_msg = -1; /* Type_of_msg */
138 static int hf_t38_data_field = -1; /* Data_Field */
139 static int hf_t38_t30_indicator = -1; /* T30_indicator */
140 static int hf_t38_t30_data = -1; /* T30_data */
141 static int hf_t38_Data_Field_item = -1; /* Data_Field_item */
142 static int hf_t38_field_type = -1; /* T_field_type */
143 static int hf_t38_field_data = -1; /* T_field_data */
144 static int hf_t38_seq_number = -1; /* T_seq_number */
145 static int hf_t38_primary_ifp_packet = -1; /* T_primary_ifp_packet */
146 static int hf_t38_error_recovery = -1; /* T_error_recovery */
147 static int hf_t38_secondary_ifp_packets = -1; /* T_secondary_ifp_packets */
148 static int hf_t38_secondary_ifp_packets_item = -1; /* OpenType_IFPPacket */
149 static int hf_t38_fec_info = -1; /* T_fec_info */
150 static int hf_t38_fec_npackets = -1; /* INTEGER */
151 static int hf_t38_fec_data = -1; /* T_fec_data */
152 static int hf_t38_fec_data_item = -1; /* OCTET_STRING */
154 /*--- End of included file: packet-t38-hf.c ---*/
155 #line 125 "packet-t38-template.c"
157 /* T38 setup fields */
158 static int hf_t38_setup = -1;
159 static int hf_t38_setup_frame = -1;
160 static int hf_t38_setup_method = -1;
162 /* T38 Data reassemble fields */
163 static int hf_t38_fragments = -1;
164 static int hf_t38_fragment = -1;
165 static int hf_t38_fragment_overlap = -1;
166 static int hf_t38_fragment_overlap_conflicts = -1;
167 static int hf_t38_fragment_multiple_tails = -1;
168 static int hf_t38_fragment_too_long_fragment = -1;
169 static int hf_t38_fragment_error = -1;
170 static int hf_t38_reassembled_in = -1;
172 static gint ett_t38 = -1;
174 /*--- Included file: packet-t38-ett.c ---*/
175 #line 1 "packet-t38-ett.c"
176 static gint ett_t38_IFPPacket = -1;
177 static gint ett_t38_Type_of_msg = -1;
178 static gint ett_t38_Data_Field = -1;
179 static gint ett_t38_Data_Field_item = -1;
180 static gint ett_t38_UDPTLPacket = -1;
181 static gint ett_t38_T_error_recovery = -1;
182 static gint ett_t38_T_secondary_ifp_packets = -1;
183 static gint ett_t38_T_fec_info = -1;
184 static gint ett_t38_T_fec_data = -1;
186 /*--- End of included file: packet-t38-ett.c ---*/
187 #line 143 "packet-t38-template.c"
188 static gint ett_t38_setup = -1;
190 static gint ett_data_fragment = -1;
191 static gint ett_data_fragments = -1;
193 static gboolean primary_part = TRUE;
194 static guint32 seq_number = 0;
196 /* Tables for reassembly of Data fragments. */
197 static GHashTable *data_fragment_table = NULL;
198 static GHashTable *data_reassembled_table = NULL;
200 static const fragment_items data_frag_items = {
201 /* Fragment subtrees */
204 /* Fragment fields */
207 &hf_t38_fragment_overlap,
208 &hf_t38_fragment_overlap_conflicts,
209 &hf_t38_fragment_multiple_tails,
210 &hf_t38_fragment_too_long_fragment,
211 &hf_t38_fragment_error,
212 /* Reassembled in field */
213 &hf_t38_reassembled_in,
218 typedef struct _fragment_key {
224 static conversation_t *p_conv= NULL;
225 static t38_conv *p_t38_conv = NULL;
226 static t38_conv *p_t38_packet_conv = NULL;
227 static t38_conv_info *p_t38_conv_info = NULL;
228 static t38_conv_info *p_t38_packet_conv_info = NULL;
230 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
231 #define RTP_VERSION(octet) ((octet) >> 6)
233 void proto_reg_handoff_t38(void);
235 static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
236 /* Preferences bool to control whether or not setup info should be shown */
237 static gboolean global_t38_show_setup_info = TRUE;
239 /* Can tap up to 4 T38 packets within same packet */
240 /* We only tap the primary part, not the redundancy */
241 #define MAX_T38_MESSAGES_IN_PACKET 4
242 static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET];
243 static int t38_info_current=0;
244 static t38_packet_info *t38_info=NULL;
246 static void t38_defragment_init(void)
248 /* Init reassemble tables */
249 fragment_table_init(&data_fragment_table);
250 reassembled_table_init(&data_reassembled_table);
254 /* Set up an T38 conversation */
255 void t38_add_address(packet_info *pinfo,
256 address *addr, int port,
258 const gchar *setup_method, guint32 setup_frame_number)
261 conversation_t* p_conv;
262 t38_conv* p_conv_data = NULL;
265 * If this isn't the first time this packet has been processed,
266 * we've already done this work, so we don't need to do it
269 if (pinfo->fd->flags.visited)
274 SET_ADDRESS(&null_addr, AT_NONE, 0, NULL);
277 * Check if the ip address and port combination is not
278 * already registered as a conversation.
280 p_conv = find_conversation( setup_frame_number, addr, &null_addr, PT_UDP, port, other_port,
281 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
284 * If not, create a new conversation.
286 if ( !p_conv || p_conv->setup_frame != setup_frame_number) {
287 p_conv = conversation_new( setup_frame_number, addr, &null_addr, PT_UDP,
288 (guint32)port, (guint32)other_port,
289 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
293 conversation_set_dissector(p_conv, t38_udp_handle);
296 * Check if the conversation has data associated with it.
298 p_conv_data = conversation_get_proto_data(p_conv, proto_t38);
301 * If not, add a new data item.
303 if ( ! p_conv_data ) {
304 /* Create conversation data */
305 p_conv_data = se_alloc(sizeof(t38_conv));
307 conversation_add_proto_data(p_conv, proto_t38, p_conv_data);
311 * Update the conversation data.
313 g_strlcpy(p_conv_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE);
314 p_conv_data->setup_frame_number = setup_frame_number;
315 p_conv_data->src_t38_info.reass_ID = 0;
316 p_conv_data->src_t38_info.reass_start_seqnum = -1;
317 p_conv_data->src_t38_info.reass_data_type = 0;
318 p_conv_data->src_t38_info.last_seqnum = -1;
319 p_conv_data->src_t38_info.packet_lost = 0;
320 p_conv_data->src_t38_info.burst_lost = 0;
321 p_conv_data->src_t38_info.time_first_t4_data = 0;
324 p_conv_data->dst_t38_info.reass_ID = 0;
325 p_conv_data->dst_t38_info.reass_start_seqnum = -1;
326 p_conv_data->dst_t38_info.reass_data_type = 0;
327 p_conv_data->dst_t38_info.last_seqnum = -1;
328 p_conv_data->dst_t38_info.packet_lost = 0;
329 p_conv_data->dst_t38_info.burst_lost = 0;
330 p_conv_data->dst_t38_info.time_first_t4_data = 0;
335 force_reassemble_seq(packet_info *pinfo, guint32 id,
336 GHashTable *fragment_table)
339 fragment_data *fd_head;
341 fragment_data *last_fd;
342 guint32 dfpos, size, packet_lost, burst_lost, seq_num;
344 /* create key to search hash with */
345 key.src = pinfo->src;
346 key.dst = pinfo->dst;
349 fd_head = g_hash_table_lookup(fragment_table, &key);
351 /* have we already seen this frame ?*/
352 if (pinfo->fd->flags.visited) {
353 if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
361 /* we must have it to continue */
365 /* check for packet lost and count the burst of packet lost */
369 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
370 if (seq_num != fd_i->offset) {
371 packet_lost += fd_i->offset - seq_num;
372 if ( (fd_i->offset - seq_num) > burst_lost ) {
373 burst_lost = fd_i->offset - seq_num;
376 seq_num = fd_i->offset + 1;
379 /* we have received an entire packet, defragment it and
384 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
385 if(!last_fd || last_fd->offset!=fd_i->offset){
390 fd_head->data = g_malloc(size);
391 fd_head->len = size; /* record size for caller */
393 /* add all data fragments */
396 for (fd_i=fd_head->next;fd_i && fd_i->len + dfpos <= size;fd_i=fd_i->next) {
398 if(!last_fd || last_fd->offset!=fd_i->offset){
399 memcpy(fd_head->data+dfpos,fd_i->data,fd_i->len);
402 /* duplicate/retransmission/overlap */
403 fd_i->flags |= FD_OVERLAP;
404 fd_head->flags |= FD_OVERLAP;
405 if( (last_fd->len!=fd_i->datalen)
406 || memcmp(last_fd->data, fd_i->data, last_fd->len) ){
407 fd_i->flags |= FD_OVERLAPCONFLICT;
408 fd_head->flags |= FD_OVERLAPCONFLICT;
415 /* we have defragmented the pdu, now free all fragments*/
416 for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
423 /* mark this packet as defragmented */
424 fd_head->flags |= FD_DEFRAGMENTED;
425 fd_head->reassembled_in=pinfo->fd->num;
427 if (check_col(pinfo->cinfo, COL_INFO))
428 col_append_fstr(pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost, burst_lost);
430 p_t38_packet_conv_info->packet_lost = packet_lost;
431 p_t38_packet_conv_info->burst_lost = burst_lost;
438 /*--- Included file: packet-t38-fn.c ---*/
439 #line 1 "packet-t38-fn.c"
441 const value_string t38_T30_indicator_vals[] = {
445 { 3, "v21-preamble" },
446 { 4, "v27-2400-training" },
447 { 5, "v27-4800-training" },
448 { 6, "v29-7200-training" },
449 { 7, "v29-9600-training" },
450 { 8, "v17-7200-short-training" },
451 { 9, "v17-7200-long-training" },
452 { 10, "v17-9600-short-training" },
453 { 11, "v17-9600-long-training" },
454 { 12, "v17-12000-short-training" },
455 { 13, "v17-12000-long-training" },
456 { 14, "v17-14400-short-training" },
457 { 15, "v17-14400-long-training" },
460 { 18, "v34-cntl-channel-1200" },
461 { 19, "v34-pri-channel" },
462 { 20, "v34-CC-retrain" },
463 { 21, "v33-12000-training" },
464 { 22, "v33-14400-training" },
470 dissect_t38_T30_indicator(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
471 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
472 16, &T30ind_value, TRUE, 7, NULL);
475 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
476 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
477 val_to_str(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
482 t38_info->t30ind_value = T30ind_value;
488 const value_string t38_T30_data_vals[] = {
499 { 10, "v34-pri-rate" },
500 { 11, "v34-CC-1200" },
501 { 12, "v34-pri-ch" },
509 dissect_t38_T30_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
510 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
511 9, &Data_value, TRUE, 6, NULL);
514 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
515 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
516 val_to_str(Data_value,t38_T30_data_vals,"<unknown>"));
522 t38_info->data_value = Data_value;
528 static const value_string t38_Type_of_msg_vals[] = {
529 { 0, "t30-indicator" },
534 static const per_choice_t Type_of_msg_choice[] = {
535 { 0, &hf_t38_t30_indicator , ASN1_NO_EXTENSIONS , dissect_t38_T30_indicator },
536 { 1, &hf_t38_t30_data , ASN1_NO_EXTENSIONS , dissect_t38_T30_data },
541 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_) {
542 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
543 ett_t38_Type_of_msg, Type_of_msg_choice,
549 t38_info->type_msg = Type_of_msg_value;
555 static const value_string t38_T_field_type_vals[] = {
557 { 1, "hdlc-sig-end" },
558 { 2, "hdlc-fcs-OK" },
559 { 3, "hdlc-fcs-BAD" },
560 { 4, "hdlc-fcs-OK-sig-end" },
561 { 5, "hdlc-fcs-BAD-sig-end" },
562 { 6, "t4-non-ecm-data" },
563 { 7, "t4-non-ecm-sig-end" },
566 { 10, "ci-message" },
573 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_) {
574 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
575 8, &Data_Field_field_type_value, (use_pre_corrigendum_asn1_specification)?FALSE:TRUE, (use_pre_corrigendum_asn1_specification)?0:4, NULL);
578 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
579 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
580 val_to_str(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
583 /* We only reassmeble packets in the Primary part and in the first two Items. */
584 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
585 /* using the current ressaemble functions. */
586 /* TODO: reassemble all the Items in one frame */
587 if (primary_part && (Data_Field_item_num<2)) {
588 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*/
589 fragment_data *frag_msg = NULL;
590 tvbuff_t* new_tvb = NULL;
591 gboolean save_fragmented = actx->pinfo->fragmented;
593 actx->pinfo->fragmented = TRUE;
595 /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
596 if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
597 frag_msg = fragment_add_seq(tvb, offset, actx->pinfo,
598 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
599 data_fragment_table, /* list of message fragments */
600 seq_number + Data_Field_item_num - (guint32)p_t38_packet_conv_info->reass_start_seqnum, /* fragment sequence number */
602 0, /* fragment length */
603 FALSE); /* More fragments */
604 if ( Data_Field_field_type_value == 7 ) {
605 /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
606 * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
607 * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
608 * and get some stat, like packet lost and burst number of packet lost
611 force_reassemble_seq(actx->pinfo,
612 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
613 data_fragment_table /* list of message fragments */
616 if (check_col(actx->pinfo->cinfo, COL_INFO))
617 col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
619 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
623 if (p_t38_packet_conv_info->packet_lost) {
624 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);
626 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
629 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
630 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
632 /* Now reset fragmentation information in pinfo */
633 actx->pinfo->fragmented = save_fragmented;
635 t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
636 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 */
639 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
640 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
642 /* Now reset fragmentation information in pinfo */
643 actx->pinfo->fragmented = save_fragmented;
644 actx->pinfo->private_data = t38_info;
646 if (new_tvb) call_dissector((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree);
650 proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset),
651 "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
653 if (check_col(actx->pinfo->cinfo, COL_INFO)){
654 col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
656 actx->pinfo->fragmented = save_fragmented;
660 /* reset the reassemble ID and the start seq number if it is not HDLC data */
661 if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
662 p_t38_conv_info->reass_ID = 0;
663 p_t38_conv_info->reass_start_seqnum = -1;
665 t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
674 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_) {
676 tvbuff_t *value_tvb = NULL;
679 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
680 1, 65535, FALSE, &value_tvb);
682 value_len = tvb_length(value_tvb);
687 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
689 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
690 tvb_bytes_to_str(value_tvb,0,value_len));
693 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
694 tvb_bytes_to_str(value_tvb,0,7));
698 /* We only reassmeble packets in the Primary part and in the first two Items. */
699 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
700 /* using the current ressaemble functions. */
701 /* TODO: reassemble all the Items in one frame */
702 if (primary_part && (Data_Field_item_num<2)) {
703 tvbuff_t* new_tvb = NULL;
704 fragment_data *frag_msg = NULL;
706 /* HDLC Data or t4-non-ecm-data */
707 if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
708 gboolean save_fragmented = actx->pinfo->fragmented;
710 actx->pinfo->fragmented = TRUE;
712 /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
713 if (p_t38_packet_conv && p_t38_conv && (p_t38_packet_conv_info->reass_ID == 0)) {
714 /* we use the first fragment's frame_number as fragment ID because the protocol doesn't provide it */
715 p_t38_conv_info->reass_ID = actx->pinfo->fd->num;
716 p_t38_conv_info->reass_start_seqnum = seq_number;
717 p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->fd->rel_ts);
718 p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
719 p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
720 p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
723 frag_msg = fragment_add_seq(value_tvb, 0, actx->pinfo,
724 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
725 data_fragment_table, /* list of message fragments */
726 seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum, /* fragment sequence number */
727 value_len, /* fragment length */
728 TRUE); /* More fragments */
730 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
731 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
733 if (!frag_msg) { /* Not last packet of reassembled */
734 if (Data_Field_field_type_value == 0) {
735 if (check_col(actx->pinfo->cinfo, COL_INFO))
736 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (HDLC fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
738 if (check_col(actx->pinfo->cinfo, COL_INFO))
739 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
743 /* Now reset fragmentation information in pinfo */
744 actx->pinfo->fragmented = save_fragmented;
752 static const per_sequence_t Data_Field_item_sequence[] = {
753 { &hf_t38_field_type , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_field_type },
754 { &hf_t38_field_data , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_T_field_data },
759 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_) {
760 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
761 ett_t38_Data_Field_item, Data_Field_item_sequence);
764 if (primary_part) Data_Field_item_num++;
770 static const per_sequence_t Data_Field_sequence_of[1] = {
771 { &hf_t38_Data_Field_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Data_Field_item },
775 dissect_t38_Data_Field(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_of(tvb, offset, actx, tree, hf_index,
777 ett_t38_Data_Field, Data_Field_sequence_of);
783 static const per_sequence_t IFPPacket_sequence[] = {
784 { &hf_t38_type_of_msg , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Type_of_msg },
785 { &hf_t38_data_field , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_Data_Field },
790 dissect_t38_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
791 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
792 ett_t38_IFPPacket, IFPPacket_sequence);
800 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_) {
801 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
802 0U, 65535U, &seq_number, FALSE);
807 t38_info->seq_num = seq_number;
809 if (check_col(actx->pinfo->cinfo, COL_INFO)){
810 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
819 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_) {
823 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
826 /* if is a valid t38 packet, add to tap */
827 if (p_t38_packet_conv && (!actx->pinfo->in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum))
828 tap_queue_packet(t38_tap, actx->pinfo, t38_info);
830 if (p_t38_conv) p_t38_conv_info->last_seqnum = (gint32) seq_number;
838 dissect_t38_OpenType_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
839 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
845 static const per_sequence_t T_secondary_ifp_packets_sequence_of[1] = {
846 { &hf_t38_secondary_ifp_packets_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OpenType_IFPPacket },
850 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_) {
851 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
852 ett_t38_T_secondary_ifp_packets, T_secondary_ifp_packets_sequence_of);
860 dissect_t38_INTEGER(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
861 offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
869 dissect_t38_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
870 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
871 NO_BOUND, NO_BOUND, FALSE, NULL);
877 static const per_sequence_t T_fec_data_sequence_of[1] = {
878 { &hf_t38_fec_data_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OCTET_STRING },
882 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_) {
883 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
884 ett_t38_T_fec_data, T_fec_data_sequence_of);
890 static const per_sequence_t T_fec_info_sequence[] = {
891 { &hf_t38_fec_npackets , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_INTEGER },
892 { &hf_t38_fec_data , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_fec_data },
897 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_) {
898 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
899 ett_t38_T_fec_info, T_fec_info_sequence);
905 static const value_string t38_T_error_recovery_vals[] = {
906 { 0, "secondary-ifp-packets" },
911 static const per_choice_t T_error_recovery_choice[] = {
912 { 0, &hf_t38_secondary_ifp_packets, ASN1_NO_EXTENSIONS , dissect_t38_T_secondary_ifp_packets },
913 { 1, &hf_t38_fec_info , ASN1_NO_EXTENSIONS , dissect_t38_T_fec_info },
918 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_) {
920 primary_part = FALSE;
922 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
923 ett_t38_T_error_recovery, T_error_recovery_choice,
933 static const per_sequence_t UDPTLPacket_sequence[] = {
934 { &hf_t38_seq_number , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_seq_number },
935 { &hf_t38_primary_ifp_packet, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_primary_ifp_packet },
936 { &hf_t38_error_recovery , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_error_recovery },
941 dissect_t38_UDPTLPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
943 /* Initialize to something else than data type */
944 Data_Field_field_type_value = 1;
946 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
947 ett_t38_UDPTLPacket, UDPTLPacket_sequence);
954 static int dissect_IFPPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
957 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
958 offset = dissect_t38_IFPPacket(tvb, offset, &asn1_ctx, tree, hf_t38_IFPPacket_PDU);
959 offset += 7; offset >>= 3;
962 static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
965 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
966 offset = dissect_t38_UDPTLPacket(tvb, offset, &asn1_ctx, tree, hf_t38_UDPTLPacket_PDU);
967 offset += 7; offset >>= 3;
972 /*--- End of included file: packet-t38-fn.c ---*/
973 #line 393 "packet-t38-template.c"
975 /* initialize the tap t38_info and the conversation */
977 init_t38_info_conv(packet_info *pinfo)
981 if (t38_info_current==MAX_T38_MESSAGES_IN_PACKET) {
984 t38_info = &t38_info_arr[t38_info_current];
986 t38_info->seq_num = 0;
987 t38_info->type_msg = 0;
988 t38_info->data_value = 0;
989 t38_info->t30ind_value =0;
990 t38_info->setup_frame_number = 0;
991 t38_info->Data_Field_field_type_value = 0;
992 t38_info->desc[0] = '\0';
993 t38_info->desc_comment[0] = '\0';
994 t38_info->time_first_t4_data = 0;
995 t38_info->frame_num_first_t4_data = 0;
999 p_t38_packet_conv hold the conversation info in each of the packets.
1000 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
1001 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
1002 need to use p_t38_conv
1004 p_t38_packet_conv = NULL;
1007 /* Use existing packet info if available */
1008 p_t38_packet_conv = p_get_proto_data(pinfo->fd, proto_t38);
1011 /* find the conversation used for Reassemble and Setup Info */
1012 p_conv = find_conversation(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
1014 pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
1016 /* create a conv if it doen't exist */
1018 p_conv = conversation_new(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
1019 pinfo->ptype, pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
1022 conversation_set_dissector(p_conv, t38_udp_handle);
1025 if (!p_t38_packet_conv) {
1026 p_t38_conv = conversation_get_proto_data(p_conv, proto_t38);
1028 /* create the conversation if it doen't exist */
1030 p_t38_conv = se_alloc(sizeof(t38_conv));
1031 p_t38_conv->setup_method[0] = '\0';
1032 p_t38_conv->setup_frame_number = 0;
1034 p_t38_conv->src_t38_info.reass_ID = 0;
1035 p_t38_conv->src_t38_info.reass_start_seqnum = -1;
1036 p_t38_conv->src_t38_info.reass_data_type = 0;
1037 p_t38_conv->src_t38_info.last_seqnum = -1;
1038 p_t38_conv->src_t38_info.packet_lost = 0;
1039 p_t38_conv->src_t38_info.burst_lost = 0;
1040 p_t38_conv->src_t38_info.time_first_t4_data = 0;
1042 p_t38_conv->dst_t38_info.reass_ID = 0;
1043 p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
1044 p_t38_conv->dst_t38_info.reass_data_type = 0;
1045 p_t38_conv->dst_t38_info.last_seqnum = -1;
1046 p_t38_conv->dst_t38_info.packet_lost = 0;
1047 p_t38_conv->dst_t38_info.burst_lost = 0;
1048 p_t38_conv->dst_t38_info.time_first_t4_data = 0;
1050 conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
1053 /* copy the t38 conversation info to the packet t38 conversation */
1054 p_t38_packet_conv = se_alloc(sizeof(t38_conv));
1055 g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);
1056 p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number;
1058 memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info));
1059 memcpy(&(p_t38_packet_conv->dst_t38_info), &(p_t38_conv->dst_t38_info), sizeof(t38_conv_info));
1061 p_add_proto_data(pinfo->fd, proto_t38, p_t38_packet_conv);
1064 if (ADDRESSES_EQUAL(&p_conv->key_ptr->addr1, &pinfo->net_src)) {
1065 p_t38_conv_info = &(p_t38_conv->src_t38_info);
1066 p_t38_packet_conv_info = &(p_t38_packet_conv->src_t38_info);
1068 p_t38_conv_info = &(p_t38_conv->dst_t38_info);
1069 p_t38_packet_conv_info = &(p_t38_packet_conv->dst_t38_info);
1072 /* update t38_info */
1073 t38_info->setup_frame_number = p_t38_packet_conv->setup_frame_number;
1076 /* Entry point for dissection */
1078 dissect_t38_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1086 * XXX - heuristic to check for misidentified packets.
1088 if (dissect_possible_rtpv2_packets_as_rtp){
1089 octet1 = tvb_get_guint8(tvb, offset);
1090 if (RTP_VERSION(octet1) == 2){
1091 call_dissector(rtp_handle,tvb,pinfo,tree);
1096 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
1097 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1099 if (check_col(pinfo->cinfo, COL_INFO)){
1100 col_clear(pinfo->cinfo, COL_INFO);
1103 primary_part = TRUE;
1105 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1106 Data_Field_item_num = 0;
1108 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1109 tr=proto_item_add_subtree(it, ett_t38);
1111 /* init tap and conv info */
1112 init_t38_info_conv(pinfo);
1114 /* Show Conversation setup info if exists*/
1115 if (global_t38_show_setup_info) {
1116 show_setup_info(tvb, tr, p_t38_packet_conv);
1119 if (check_col(pinfo->cinfo, COL_INFO)){
1120 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
1123 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr);
1125 if (tvb_length_remaining(tvb,offset)>0){
1127 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1128 "[MALFORMED PACKET or wrong preference settings]");
1130 if (check_col(pinfo->cinfo, COL_INFO)){
1131 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1137 dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1143 guint16 ifp_packet_number=1;
1145 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
1146 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1148 if (check_col(pinfo->cinfo, COL_INFO)){
1149 col_clear(pinfo->cinfo, COL_INFO);
1152 primary_part = TRUE;
1154 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1155 Data_Field_item_num = 0;
1157 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1158 tr=proto_item_add_subtree(it, ett_t38);
1160 /* init tap and conv info */
1161 init_t38_info_conv(pinfo);
1163 /* Show Conversation setup info if exists*/
1164 if (global_t38_show_setup_info) {
1165 show_setup_info(tvb, tr, p_t38_packet_conv);
1168 if (check_col(pinfo->cinfo, COL_INFO)){
1169 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
1172 while(tvb_length_remaining(tvb,offset)>0)
1174 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
1175 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr);
1176 ifp_packet_number++;
1178 if(tvb_length_remaining(tvb,offset)>0){
1179 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1181 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1182 "[MALFORMED PACKET or wrong preference settings]");
1184 if (check_col(pinfo->cinfo, COL_INFO)){
1185 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1190 if (check_col(pinfo->cinfo, COL_INFO)){
1191 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
1200 dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1202 primary_part = TRUE;
1204 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1205 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1207 else if((t38_tpkt_usage == T38_TPKT_NEVER) || (is_tpkt(tvb,1) == -1)){
1208 dissect_t38_tcp_pdu(tvb, pinfo, tree);
1211 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1216 dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1218 if(pinfo->ipproto == IP_PROTO_TCP)
1220 dissect_t38_tcp(tvb, pinfo, tree);
1222 else if(pinfo->ipproto == IP_PROTO_UDP)
1224 dissect_t38_udp(tvb, pinfo, tree);
1228 /* Look for conversation info and display any setup info found */
1230 show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv)
1232 proto_tree *t38_setup_tree;
1235 if (!p_t38_conv || p_t38_conv->setup_frame_number == 0) {
1236 /* there is no Setup info */
1240 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
1242 "Stream setup by %s (frame %u)",
1243 p_t38_conv->setup_method,
1244 p_t38_conv->setup_frame_number);
1245 PROTO_ITEM_SET_GENERATED(ti);
1246 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
1249 /* Add details into subtree */
1250 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
1251 tvb, 0, 0, p_t38_conv->setup_frame_number);
1252 PROTO_ITEM_SET_GENERATED(item);
1253 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
1254 tvb, 0, 0, p_t38_conv->setup_method);
1255 PROTO_ITEM_SET_GENERATED(item);
1261 /* Wireshark Protocol Registration */
1263 proto_register_t38(void)
1265 static hf_register_info hf[] =
1268 /*--- Included file: packet-t38-hfarr.c ---*/
1269 #line 1 "packet-t38-hfarr.c"
1270 { &hf_t38_IFPPacket_PDU,
1271 { "IFPPacket", "t38.IFPPacket",
1272 FT_NONE, BASE_NONE, NULL, 0,
1273 "t38.IFPPacket", HFILL }},
1274 { &hf_t38_UDPTLPacket_PDU,
1275 { "UDPTLPacket", "t38.UDPTLPacket",
1276 FT_NONE, BASE_NONE, NULL, 0,
1277 "t38.UDPTLPacket", HFILL }},
1278 { &hf_t38_type_of_msg,
1279 { "type-of-msg", "t38.type_of_msg",
1280 FT_UINT32, BASE_DEC, VALS(t38_Type_of_msg_vals), 0,
1281 "t38.Type_of_msg", HFILL }},
1282 { &hf_t38_data_field,
1283 { "data-field", "t38.data_field",
1284 FT_UINT32, BASE_DEC, NULL, 0,
1285 "t38.Data_Field", HFILL }},
1286 { &hf_t38_t30_indicator,
1287 { "t30-indicator", "t38.t30_indicator",
1288 FT_UINT32, BASE_DEC, VALS(t38_T30_indicator_vals), 0,
1289 "t38.T30_indicator", HFILL }},
1291 { "t30-data", "t38.t30_data",
1292 FT_UINT32, BASE_DEC, VALS(t38_T30_data_vals), 0,
1293 "t38.T30_data", HFILL }},
1294 { &hf_t38_Data_Field_item,
1295 { "Data-Field item", "t38.Data_Field_item",
1296 FT_NONE, BASE_NONE, NULL, 0,
1297 "t38.Data_Field_item", HFILL }},
1298 { &hf_t38_field_type,
1299 { "field-type", "t38.field_type",
1300 FT_UINT32, BASE_DEC, VALS(t38_T_field_type_vals), 0,
1301 "t38.T_field_type", HFILL }},
1302 { &hf_t38_field_data,
1303 { "field-data", "t38.field_data",
1304 FT_BYTES, BASE_HEX, NULL, 0,
1305 "t38.T_field_data", HFILL }},
1306 { &hf_t38_seq_number,
1307 { "seq-number", "t38.seq_number",
1308 FT_UINT32, BASE_DEC, NULL, 0,
1309 "t38.T_seq_number", HFILL }},
1310 { &hf_t38_primary_ifp_packet,
1311 { "primary-ifp-packet", "t38.primary_ifp_packet",
1312 FT_NONE, BASE_NONE, NULL, 0,
1313 "t38.T_primary_ifp_packet", HFILL }},
1314 { &hf_t38_error_recovery,
1315 { "error-recovery", "t38.error_recovery",
1316 FT_UINT32, BASE_DEC, VALS(t38_T_error_recovery_vals), 0,
1317 "t38.T_error_recovery", HFILL }},
1318 { &hf_t38_secondary_ifp_packets,
1319 { "secondary-ifp-packets", "t38.secondary_ifp_packets",
1320 FT_UINT32, BASE_DEC, NULL, 0,
1321 "t38.T_secondary_ifp_packets", HFILL }},
1322 { &hf_t38_secondary_ifp_packets_item,
1323 { "secondary-ifp-packets item", "t38.secondary_ifp_packets_item",
1324 FT_NONE, BASE_NONE, NULL, 0,
1325 "t38.OpenType_IFPPacket", HFILL }},
1327 { "fec-info", "t38.fec_info",
1328 FT_NONE, BASE_NONE, NULL, 0,
1329 "t38.T_fec_info", HFILL }},
1330 { &hf_t38_fec_npackets,
1331 { "fec-npackets", "t38.fec_npackets",
1332 FT_INT32, BASE_DEC, NULL, 0,
1333 "t38.INTEGER", HFILL }},
1335 { "fec-data", "t38.fec_data",
1336 FT_UINT32, BASE_DEC, NULL, 0,
1337 "t38.T_fec_data", HFILL }},
1338 { &hf_t38_fec_data_item,
1339 { "fec-data item", "t38.fec_data_item",
1340 FT_BYTES, BASE_HEX, NULL, 0,
1341 "t38.OCTET_STRING", HFILL }},
1343 /*--- End of included file: packet-t38-hfarr.c ---*/
1344 #line 687 "packet-t38-template.c"
1346 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
1347 NULL, 0x0, "Stream setup, method and frame number", HFILL }},
1348 { &hf_t38_setup_frame,
1349 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
1350 NULL, 0x0, "Frame that set up this stream", HFILL }},
1351 { &hf_t38_setup_method,
1352 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
1353 NULL, 0x0, "Method used to set up this stream", HFILL }},
1355 {"Message fragments", "t38.fragments",
1356 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1358 {"Message fragment", "t38.fragment",
1359 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1360 {&hf_t38_fragment_overlap,
1361 {"Message fragment overlap", "t38.fragment.overlap",
1362 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1363 {&hf_t38_fragment_overlap_conflicts,
1364 {"Message fragment overlapping with conflicting data",
1365 "t38.fragment.overlap.conflicts",
1366 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1367 {&hf_t38_fragment_multiple_tails,
1368 {"Message has multiple tail fragments",
1369 "t38.fragment.multiple_tails",
1370 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1371 {&hf_t38_fragment_too_long_fragment,
1372 {"Message fragment too long", "t38.fragment.too_long_fragment",
1373 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1374 {&hf_t38_fragment_error,
1375 {"Message defragmentation error", "t38.fragment.error",
1376 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1377 {&hf_t38_reassembled_in,
1378 {"Reassembled in", "t38.reassembled.in",
1379 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1382 static gint *ett[] =
1386 /*--- Included file: packet-t38-ettarr.c ---*/
1387 #line 1 "packet-t38-ettarr.c"
1389 &ett_t38_Type_of_msg,
1390 &ett_t38_Data_Field,
1391 &ett_t38_Data_Field_item,
1392 &ett_t38_UDPTLPacket,
1393 &ett_t38_T_error_recovery,
1394 &ett_t38_T_secondary_ifp_packets,
1395 &ett_t38_T_fec_info,
1396 &ett_t38_T_fec_data,
1398 /*--- End of included file: packet-t38-ettarr.c ---*/
1399 #line 728 "packet-t38-template.c"
1405 module_t *t38_module;
1407 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
1408 proto_register_field_array(proto_t38, hf, array_length(hf));
1409 proto_register_subtree_array(ett, array_length(ett));
1410 register_dissector("t38", dissect_t38, proto_t38);
1412 /* Init reassemble tables for HDLC */
1413 register_init_routine(t38_defragment_init);
1415 t38_tap = register_tap("t38");
1417 t38_module = prefs_register_protocol(proto_t38, proto_reg_handoff_t38);
1418 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
1419 "Use the Pre-Corrigendum ASN.1 specification",
1420 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
1421 "ASN.1 specification (1998).",
1422 &use_pre_corrigendum_asn1_specification);
1423 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
1424 "Dissect possible RTP version 2 packets with RTP dissector",
1425 "Whether a UDP packet that looks like RTP version 2 packet will "
1426 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
1427 "packets with sequence number higher than 32767 may be dissected as RTP.",
1428 &dissect_possible_rtpv2_packets_as_rtp);
1429 prefs_register_uint_preference(t38_module, "tcp.port",
1431 "Set the TCP port for T.38 messages",
1432 10, &global_t38_tcp_port);
1433 prefs_register_uint_preference(t38_module, "udp.port",
1435 "Set the UDP port for T.38 messages",
1436 10, &global_t38_udp_port);
1437 prefs_register_bool_preference(t38_module, "reassembly",
1438 "Reassemble T.38 PDUs over TPKT over TCP",
1439 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
1440 "when TPKT is used over TCP. "
1441 "To use this option, you must also enable \"Allow subdissectors to reassemble "
1442 "TCP streams\" in the TCP protocol settings.",
1443 &t38_tpkt_reassembly);
1444 prefs_register_enum_preference(t38_module, "tpkt_usage",
1445 "TPKT used over TCP",
1446 "Whether T.38 is used with TPKT for TCP",
1447 (gint *)&t38_tpkt_usage,t38_tpkt_options,FALSE);
1449 prefs_register_bool_preference(t38_module, "show_setup_info",
1450 "Show stream setup information",
1451 "Where available, show which protocol and frame caused "
1452 "this T.38 stream to be created",
1453 &global_t38_show_setup_info);
1458 proto_reg_handoff_t38(void)
1460 static gboolean t38_prefs_initialized = FALSE;
1461 static guint tcp_port;
1462 static guint udp_port;
1464 if (!t38_prefs_initialized) {
1465 t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
1466 t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
1467 t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
1468 rtp_handle = find_dissector("rtp");
1469 t30_hdlc_handle = find_dissector("t30.hdlc");
1470 data_handle = find_dissector("data");
1471 t38_prefs_initialized = TRUE;
1474 dissector_delete("tcp.port", tcp_port, t38_tcp_handle);
1475 dissector_delete("udp.port", udp_port, t38_udp_handle);
1477 tcp_port = global_t38_tcp_port;
1478 udp_port = global_t38_udp_port;
1480 dissector_add("tcp.port", tcp_port, t38_tcp_handle);
1481 dissector_add("udp.port", udp_port, t38_udp_handle);