2 * Routines for T.38 packet dissection
4 * 2004 Alejandro Vaquero, add support Conversations for SDP
5 * 2006 Alejandro Vaquero, add T30 reassemble and dissection
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /* Depending on what ASN.1 specification is used you may have to change
30 * the preference setting regarding Pre-Corrigendum ASN.1 specification:
31 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/1998/T38.html (Pre-Corrigendum=TRUE)
32 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(1998).html (Pre-Corrigendum=TRUE)
34 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2003/T38(2002).html (Pre-Corrigendum=FALSE)
35 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002/t38.html (Pre-Corrigendum=FALSE)
36 * http://www.itu.int/ITU-T/asn1/database/itu-t/t/t38/2002-Amd1/T38.html (Pre-Corrigendum=FALSE)
40 * - TCP desegmentation is currently not supported for T.38 IFP directly over TCP.
41 * - H.245 dissectors should be updated to start conversations for T.38 similar to RTP.
42 * - Sometimes the last octet is not high-lighted when selecting something in the tree. Bug in PER dissector?
43 * - Add support for RTP payload audio/t38 (draft-jones-avt-audio-t38-03.txt), i.e. T38 in RTP packets.
52 #include <epan/packet.h>
53 #include <epan/reassemble.h>
54 #include <epan/conversation.h>
56 #include <epan/expert.h>
61 #include "packet-t38.h"
62 #include <epan/prefs.h>
63 #include <epan/ipproto.h>
64 #include <epan/asn1.h>
65 #include "packet-per.h"
66 #include "packet-tpkt.h"
67 #include <epan/emem.h>
68 #include <epan/strutil.h>
71 static guint global_t38_tcp_port = PORT_T38;
72 static guint global_t38_udp_port = PORT_T38;
74 static int t38_tap = -1;
76 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
77 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
79 /* dissect packets that looks like RTP version 2 packets as RTP */
80 /* instead of as T.38. This may result in that some T.38 UPTL */
81 /* packets with sequence number values higher than 32767 may be */
82 /* shown as RTP packets. */
83 static gboolean dissect_possible_rtpv2_packets_as_rtp = FALSE;
86 /* Reassembly of T.38 PDUs over TPKT over TCP */
87 static gboolean t38_tpkt_reassembly = TRUE;
89 /* Preference setting whether TPKT header is used when sending T.38 over TCP.
90 * The default setting is Maybe where the dissector will look on the first
91 * bytes to try to determine whether TPKT header is used or not. This may not
92 * work so well in some cases. You may want to change the setting to Always or
95 #define T38_TPKT_NEVER 0 /* Assume that there is never a TPKT header */
96 #define T38_TPKT_ALWAYS 1 /* Assume that there is always a TPKT header */
97 #define T38_TPKT_MAYBE 2 /* Assume TPKT if first octets are 03-00-xx-xx */
98 static gint t38_tpkt_usage = T38_TPKT_MAYBE;
100 static const enum_val_t t38_tpkt_options[] = {
101 {"never", "Never", T38_TPKT_NEVER},
102 {"always", "Always", T38_TPKT_ALWAYS},
103 {"maybe", "Maybe", T38_TPKT_MAYBE},
110 static dissector_handle_t t38_udp_handle;
111 static dissector_handle_t t38_tcp_handle;
112 static dissector_handle_t t38_tcp_pdu_handle;
113 static dissector_handle_t rtp_handle;
114 static dissector_handle_t t30_hdlc_handle;
115 static dissector_handle_t data_handle;
117 static gint32 Type_of_msg_value;
118 static guint32 Data_Field_field_type_value;
119 static guint32 Data_value;
120 static guint32 T30ind_value;
121 static guint32 Data_Field_item_num;
123 static int proto_t38 = -1;
124 #include "packet-t38-hf.c"
126 /* T38 setup fields */
127 static int hf_t38_setup = -1;
128 static int hf_t38_setup_frame = -1;
129 static int hf_t38_setup_method = -1;
131 /* T38 Data reassemble fields */
132 static int hf_t38_fragments = -1;
133 static int hf_t38_fragment = -1;
134 static int hf_t38_fragment_overlap = -1;
135 static int hf_t38_fragment_overlap_conflicts = -1;
136 static int hf_t38_fragment_multiple_tails = -1;
137 static int hf_t38_fragment_too_long_fragment = -1;
138 static int hf_t38_fragment_error = -1;
139 static int hf_t38_reassembled_in = -1;
141 static gint ett_t38 = -1;
142 #include "packet-t38-ett.c"
143 static gint ett_t38_setup = -1;
145 static gint ett_data_fragment = -1;
146 static gint ett_data_fragments = -1;
148 static gboolean primary_part = TRUE;
149 static guint32 seq_number = 0;
151 /* Tables for reassembly of Data fragments. */
152 static GHashTable *data_fragment_table = NULL;
153 static GHashTable *data_reassembled_table = NULL;
155 static const fragment_items data_frag_items = {
156 /* Fragment subtrees */
159 /* Fragment fields */
162 &hf_t38_fragment_overlap,
163 &hf_t38_fragment_overlap_conflicts,
164 &hf_t38_fragment_multiple_tails,
165 &hf_t38_fragment_too_long_fragment,
166 &hf_t38_fragment_error,
167 /* Reassembled in field */
168 &hf_t38_reassembled_in,
173 typedef struct _fragment_key {
179 static conversation_t *p_conv= NULL;
180 static t38_conv *p_t38_conv = NULL;
181 static t38_conv *p_t38_packet_conv = NULL;
182 static t38_conv_info *p_t38_conv_info = NULL;
183 static t38_conv_info *p_t38_packet_conv_info = NULL;
185 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
186 #define RTP_VERSION(octet) ((octet) >> 6)
188 void proto_reg_handoff_t38(void);
190 static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
191 /* Preferences bool to control whether or not setup info should be shown */
192 static gboolean global_t38_show_setup_info = TRUE;
194 /* Can tap up to 4 T38 packets within same packet */
195 /* We only tap the primary part, not the redundancy */
196 #define MAX_T38_MESSAGES_IN_PACKET 4
197 static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET];
198 static int t38_info_current=0;
199 static t38_packet_info *t38_info=NULL;
201 static void t38_defragment_init(void)
203 /* Init reassemble tables */
204 fragment_table_init(&data_fragment_table);
205 reassembled_table_init(&data_reassembled_table);
209 /* Set up an T38 conversation */
210 void t38_add_address(packet_info *pinfo,
211 address *addr, int port,
213 const gchar *setup_method, guint32 setup_frame_number)
216 conversation_t* p_conv;
217 t38_conv* p_conv_data = NULL;
220 * If this isn't the first time this packet has been processed,
221 * we've already done this work, so we don't need to do it
224 if (pinfo->fd->flags.visited)
229 SET_ADDRESS(&null_addr, AT_NONE, 0, NULL);
232 * Check if the ip address and port combination is not
233 * already registered as a conversation.
235 p_conv = find_conversation( setup_frame_number, addr, &null_addr, PT_UDP, port, other_port,
236 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
239 * If not, create a new conversation.
241 if ( !p_conv || p_conv->setup_frame != setup_frame_number) {
242 p_conv = conversation_new( setup_frame_number, addr, &null_addr, PT_UDP,
243 (guint32)port, (guint32)other_port,
244 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
248 conversation_set_dissector(p_conv, t38_udp_handle);
251 * Check if the conversation has data associated with it.
253 p_conv_data = conversation_get_proto_data(p_conv, proto_t38);
256 * If not, add a new data item.
258 if ( ! p_conv_data ) {
259 /* Create conversation data */
260 p_conv_data = se_alloc(sizeof(t38_conv));
262 conversation_add_proto_data(p_conv, proto_t38, p_conv_data);
266 * Update the conversation data.
268 g_strlcpy(p_conv_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE);
269 p_conv_data->setup_frame_number = setup_frame_number;
270 p_conv_data->src_t38_info.reass_ID = 0;
271 p_conv_data->src_t38_info.reass_start_seqnum = -1;
272 p_conv_data->src_t38_info.reass_data_type = 0;
273 p_conv_data->src_t38_info.last_seqnum = -1;
274 p_conv_data->src_t38_info.packet_lost = 0;
275 p_conv_data->src_t38_info.burst_lost = 0;
276 p_conv_data->src_t38_info.time_first_t4_data = 0;
279 p_conv_data->dst_t38_info.reass_ID = 0;
280 p_conv_data->dst_t38_info.reass_start_seqnum = -1;
281 p_conv_data->dst_t38_info.reass_data_type = 0;
282 p_conv_data->dst_t38_info.last_seqnum = -1;
283 p_conv_data->dst_t38_info.packet_lost = 0;
284 p_conv_data->dst_t38_info.burst_lost = 0;
285 p_conv_data->dst_t38_info.time_first_t4_data = 0;
290 force_reassemble_seq(packet_info *pinfo, guint32 id,
291 GHashTable *fragment_table)
294 fragment_data *fd_head;
296 fragment_data *last_fd;
297 guint32 dfpos, size, packet_lost, burst_lost, seq_num;
299 /* create key to search hash with */
300 key.src = pinfo->src;
301 key.dst = pinfo->dst;
304 fd_head = g_hash_table_lookup(fragment_table, &key);
306 /* have we already seen this frame ?*/
307 if (pinfo->fd->flags.visited) {
308 if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
316 /* we must have it to continue */
320 /* check for packet lost and count the burst of packet lost */
324 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
325 if (seq_num != fd_i->offset) {
326 packet_lost += fd_i->offset - seq_num;
327 if ( (fd_i->offset - seq_num) > burst_lost ) {
328 burst_lost = fd_i->offset - seq_num;
331 seq_num = fd_i->offset + 1;
334 /* we have received an entire packet, defragment it and
339 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
340 if(!last_fd || last_fd->offset!=fd_i->offset){
345 fd_head->data = g_malloc(size);
346 fd_head->len = size; /* record size for caller */
348 /* add all data fragments */
351 for (fd_i=fd_head->next;fd_i && fd_i->len + dfpos <= size;fd_i=fd_i->next) {
353 if(!last_fd || last_fd->offset!=fd_i->offset){
354 memcpy(fd_head->data+dfpos,fd_i->data,fd_i->len);
357 /* duplicate/retransmission/overlap */
358 fd_i->flags |= FD_OVERLAP;
359 fd_head->flags |= FD_OVERLAP;
360 if( (last_fd->len!=fd_i->datalen)
361 || memcmp(last_fd->data, fd_i->data, last_fd->len) ){
362 fd_i->flags |= FD_OVERLAPCONFLICT;
363 fd_head->flags |= FD_OVERLAPCONFLICT;
370 /* we have defragmented the pdu, now free all fragments*/
371 for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
378 /* mark this packet as defragmented */
379 fd_head->flags |= FD_DEFRAGMENTED;
380 fd_head->reassembled_in=pinfo->fd->num;
382 if (check_col(pinfo->cinfo, COL_INFO))
383 col_append_fstr(pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost, burst_lost);
385 p_t38_packet_conv_info->packet_lost = packet_lost;
386 p_t38_packet_conv_info->burst_lost = burst_lost;
392 #include "packet-t38-fn.c"
394 /* initialize the tap t38_info and the conversation */
396 init_t38_info_conv(packet_info *pinfo)
400 if (t38_info_current==MAX_T38_MESSAGES_IN_PACKET) {
403 t38_info = &t38_info_arr[t38_info_current];
405 t38_info->seq_num = 0;
406 t38_info->type_msg = 0;
407 t38_info->data_value = 0;
408 t38_info->t30ind_value =0;
409 t38_info->setup_frame_number = 0;
410 t38_info->Data_Field_field_type_value = 0;
411 t38_info->desc[0] = '\0';
412 t38_info->desc_comment[0] = '\0';
413 t38_info->time_first_t4_data = 0;
414 t38_info->frame_num_first_t4_data = 0;
418 p_t38_packet_conv hold the conversation info in each of the packets.
419 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
420 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
421 need to use p_t38_conv
423 p_t38_packet_conv = NULL;
426 /* Use existing packet info if available */
427 p_t38_packet_conv = p_get_proto_data(pinfo->fd, proto_t38);
430 /* find the conversation used for Reassemble and Setup Info */
431 p_conv = find_conversation(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
433 pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
435 /* create a conv if it doen't exist */
437 p_conv = conversation_new(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
438 pinfo->ptype, pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
441 conversation_set_dissector(p_conv, t38_udp_handle);
444 if (!p_t38_packet_conv) {
445 p_t38_conv = conversation_get_proto_data(p_conv, proto_t38);
447 /* create the conversation if it doen't exist */
449 p_t38_conv = se_alloc(sizeof(t38_conv));
450 p_t38_conv->setup_method[0] = '\0';
451 p_t38_conv->setup_frame_number = 0;
453 p_t38_conv->src_t38_info.reass_ID = 0;
454 p_t38_conv->src_t38_info.reass_start_seqnum = -1;
455 p_t38_conv->src_t38_info.reass_data_type = 0;
456 p_t38_conv->src_t38_info.last_seqnum = -1;
457 p_t38_conv->src_t38_info.packet_lost = 0;
458 p_t38_conv->src_t38_info.burst_lost = 0;
459 p_t38_conv->src_t38_info.time_first_t4_data = 0;
461 p_t38_conv->dst_t38_info.reass_ID = 0;
462 p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
463 p_t38_conv->dst_t38_info.reass_data_type = 0;
464 p_t38_conv->dst_t38_info.last_seqnum = -1;
465 p_t38_conv->dst_t38_info.packet_lost = 0;
466 p_t38_conv->dst_t38_info.burst_lost = 0;
467 p_t38_conv->dst_t38_info.time_first_t4_data = 0;
469 conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
472 /* copy the t38 conversation info to the packet t38 conversation */
473 p_t38_packet_conv = se_alloc(sizeof(t38_conv));
474 g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);
475 p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number;
477 memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info));
478 memcpy(&(p_t38_packet_conv->dst_t38_info), &(p_t38_conv->dst_t38_info), sizeof(t38_conv_info));
480 p_add_proto_data(pinfo->fd, proto_t38, p_t38_packet_conv);
483 if (ADDRESSES_EQUAL(&p_conv->key_ptr->addr1, &pinfo->net_src)) {
484 p_t38_conv_info = &(p_t38_conv->src_t38_info);
485 p_t38_packet_conv_info = &(p_t38_packet_conv->src_t38_info);
487 p_t38_conv_info = &(p_t38_conv->dst_t38_info);
488 p_t38_packet_conv_info = &(p_t38_packet_conv->dst_t38_info);
491 /* update t38_info */
492 t38_info->setup_frame_number = p_t38_packet_conv->setup_frame_number;
495 /* Entry point for dissection */
497 dissect_t38_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
505 * XXX - heuristic to check for misidentified packets.
507 if (dissect_possible_rtpv2_packets_as_rtp){
508 octet1 = tvb_get_guint8(tvb, offset);
509 if (RTP_VERSION(octet1) == 2){
510 call_dissector(rtp_handle,tvb,pinfo,tree);
515 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
516 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
518 if (check_col(pinfo->cinfo, COL_INFO)){
519 col_clear(pinfo->cinfo, COL_INFO);
524 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
525 Data_Field_item_num = 0;
527 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
528 tr=proto_item_add_subtree(it, ett_t38);
530 /* init tap and conv info */
531 init_t38_info_conv(pinfo);
533 /* Show Conversation setup info if exists*/
534 if (global_t38_show_setup_info) {
535 show_setup_info(tvb, tr, p_t38_packet_conv);
538 if (check_col(pinfo->cinfo, COL_INFO)){
539 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
542 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr);
544 if (tvb_length_remaining(tvb,offset)>0){
546 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
547 "[MALFORMED PACKET or wrong preference settings]");
549 if (check_col(pinfo->cinfo, COL_INFO)){
550 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
556 dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
562 guint16 ifp_packet_number=1;
564 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
565 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
567 if (check_col(pinfo->cinfo, COL_INFO)){
568 col_clear(pinfo->cinfo, COL_INFO);
573 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
574 Data_Field_item_num = 0;
576 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
577 tr=proto_item_add_subtree(it, ett_t38);
579 /* init tap and conv info */
580 init_t38_info_conv(pinfo);
582 /* Show Conversation setup info if exists*/
583 if (global_t38_show_setup_info) {
584 show_setup_info(tvb, tr, p_t38_packet_conv);
587 if (check_col(pinfo->cinfo, COL_INFO)){
588 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
591 while(tvb_length_remaining(tvb,offset)>0)
593 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
594 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr);
597 if(tvb_length_remaining(tvb,offset)>0){
598 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
600 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
601 "[MALFORMED PACKET or wrong preference settings]");
603 if (check_col(pinfo->cinfo, COL_INFO)){
604 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
609 if (check_col(pinfo->cinfo, COL_INFO)){
610 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
619 dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
623 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
624 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
626 else if((t38_tpkt_usage == T38_TPKT_NEVER) || (is_tpkt(tvb,1) == -1)){
627 dissect_t38_tcp_pdu(tvb, pinfo, tree);
630 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
635 dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
637 if(pinfo->ipproto == IP_PROTO_TCP)
639 dissect_t38_tcp(tvb, pinfo, tree);
641 else if(pinfo->ipproto == IP_PROTO_UDP)
643 dissect_t38_udp(tvb, pinfo, tree);
647 /* Look for conversation info and display any setup info found */
649 show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv)
651 proto_tree *t38_setup_tree;
654 if (!p_t38_conv || p_t38_conv->setup_frame_number == 0) {
655 /* there is no Setup info */
659 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
661 "Stream setup by %s (frame %u)",
662 p_t38_conv->setup_method,
663 p_t38_conv->setup_frame_number);
664 PROTO_ITEM_SET_GENERATED(ti);
665 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
668 /* Add details into subtree */
669 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
670 tvb, 0, 0, p_t38_conv->setup_frame_number);
671 PROTO_ITEM_SET_GENERATED(item);
672 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
673 tvb, 0, 0, p_t38_conv->setup_method);
674 PROTO_ITEM_SET_GENERATED(item);
680 /* Wireshark Protocol Registration */
682 proto_register_t38(void)
684 static hf_register_info hf[] =
686 #include "packet-t38-hfarr.c"
688 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
689 NULL, 0x0, "Stream setup, method and frame number", HFILL }},
690 { &hf_t38_setup_frame,
691 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
692 NULL, 0x0, "Frame that set up this stream", HFILL }},
693 { &hf_t38_setup_method,
694 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
695 NULL, 0x0, "Method used to set up this stream", HFILL }},
697 {"Message fragments", "t38.fragments",
698 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
700 {"Message fragment", "t38.fragment",
701 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
702 {&hf_t38_fragment_overlap,
703 {"Message fragment overlap", "t38.fragment.overlap",
704 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
705 {&hf_t38_fragment_overlap_conflicts,
706 {"Message fragment overlapping with conflicting data",
707 "t38.fragment.overlap.conflicts",
708 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
709 {&hf_t38_fragment_multiple_tails,
710 {"Message has multiple tail fragments",
711 "t38.fragment.multiple_tails",
712 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
713 {&hf_t38_fragment_too_long_fragment,
714 {"Message fragment too long", "t38.fragment.too_long_fragment",
715 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
716 {&hf_t38_fragment_error,
717 {"Message defragmentation error", "t38.fragment.error",
718 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
719 {&hf_t38_reassembled_in,
720 {"Reassembled in", "t38.reassembled.in",
721 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
727 #include "packet-t38-ettarr.c"
733 module_t *t38_module;
735 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
736 proto_register_field_array(proto_t38, hf, array_length(hf));
737 proto_register_subtree_array(ett, array_length(ett));
738 register_dissector("t38", dissect_t38, proto_t38);
740 /* Init reassemble tables for HDLC */
741 register_init_routine(t38_defragment_init);
743 t38_tap = register_tap("t38");
745 t38_module = prefs_register_protocol(proto_t38, proto_reg_handoff_t38);
746 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
747 "Use the Pre-Corrigendum ASN.1 specification",
748 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
749 "ASN.1 specification (1998).",
750 &use_pre_corrigendum_asn1_specification);
751 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
752 "Dissect possible RTP version 2 packets with RTP dissector",
753 "Whether a UDP packet that looks like RTP version 2 packet will "
754 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
755 "packets with sequence number higher than 32767 may be dissected as RTP.",
756 &dissect_possible_rtpv2_packets_as_rtp);
757 prefs_register_uint_preference(t38_module, "tcp.port",
759 "Set the TCP port for T.38 messages",
760 10, &global_t38_tcp_port);
761 prefs_register_uint_preference(t38_module, "udp.port",
763 "Set the UDP port for T.38 messages",
764 10, &global_t38_udp_port);
765 prefs_register_bool_preference(t38_module, "reassembly",
766 "Reassemble T.38 PDUs over TPKT over TCP",
767 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
768 "when TPKT is used over TCP. "
769 "To use this option, you must also enable \"Allow subdissectors to reassemble "
770 "TCP streams\" in the TCP protocol settings.",
771 &t38_tpkt_reassembly);
772 prefs_register_enum_preference(t38_module, "tpkt_usage",
773 "TPKT used over TCP",
774 "Whether T.38 is used with TPKT for TCP",
775 (gint *)&t38_tpkt_usage,t38_tpkt_options,FALSE);
777 prefs_register_bool_preference(t38_module, "show_setup_info",
778 "Show stream setup information",
779 "Where available, show which protocol and frame caused "
780 "this T.38 stream to be created",
781 &global_t38_show_setup_info);
786 proto_reg_handoff_t38(void)
788 static gboolean t38_prefs_initialized = FALSE;
789 static guint tcp_port;
790 static guint udp_port;
792 if (!t38_prefs_initialized) {
793 t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
794 t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
795 t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
796 rtp_handle = find_dissector("rtp");
797 t30_hdlc_handle = find_dissector("t30.hdlc");
798 data_handle = find_dissector("data");
799 t38_prefs_initialized = TRUE;
802 dissector_delete("tcp.port", tcp_port, t38_tcp_handle);
803 dissector_delete("udp.port", udp_port, t38_udp_handle);
805 tcp_port = global_t38_tcp_port;
806 udp_port = global_t38_udp_port;
808 dissector_add("tcp.port", tcp_port, t38_tcp_handle);
809 dissector_add("udp.port", udp_port, t38_udp_handle);