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>
60 #include "packet-t38.h"
61 #include <epan/prefs.h>
62 #include <epan/ipproto.h>
63 #include <epan/asn1.h>
64 #include "packet-per.h"
65 #include "packet-tpkt.h"
66 #include <epan/emem.h>
67 #include <epan/strutil.h>
70 static guint global_t38_tcp_port = PORT_T38;
71 static guint global_t38_udp_port = PORT_T38;
73 static int t38_tap = -1;
75 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
76 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
78 /* dissect packets that looks like RTP version 2 packets as RTP */
79 /* instead of as T.38. This may result in that some T.38 UPTL */
80 /* packets with sequence number values higher than 32767 may be */
81 /* shown as RTP packets. */
82 static gboolean dissect_possible_rtpv2_packets_as_rtp = FALSE;
85 /* Reassembly of T.38 PDUs over TPKT over TCP */
86 static gboolean t38_tpkt_reassembly = TRUE;
88 /* Preference setting whether TPKT header is used when sending T.38 over TCP.
89 * The default setting is Maybe where the dissector will look on the first
90 * bytes to try to determine whether TPKT header is used or not. This may not
91 * work so well in some cases. You may want to change the setting to Always or
94 #define T38_TPKT_NEVER 0 /* Assume that there is never a TPKT header */
95 #define T38_TPKT_ALWAYS 1 /* Assume that there is always a TPKT header */
96 #define T38_TPKT_MAYBE 2 /* Assume TPKT if first octets are 03-00-xx-xx */
97 static gint t38_tpkt_usage = T38_TPKT_MAYBE;
99 static const enum_val_t t38_tpkt_options[] = {
100 {"never", "Never", T38_TPKT_NEVER},
101 {"always", "Always", T38_TPKT_ALWAYS},
102 {"maybe", "Maybe", T38_TPKT_MAYBE},
109 static dissector_handle_t t38_udp_handle;
110 static dissector_handle_t t38_tcp_handle;
111 static dissector_handle_t t38_tcp_pdu_handle;
112 static dissector_handle_t rtp_handle;
113 static dissector_handle_t t30_hdlc_handle;
114 static dissector_handle_t data_handle;
116 static gint32 Type_of_msg_value;
117 static guint32 Data_Field_field_type_value;
118 static guint32 Data_value;
119 static guint32 T30ind_value;
120 static guint32 Data_Field_item_num;
122 static int proto_t38 = -1;
123 #include "packet-t38-hf.c"
125 /* T38 setup fields */
126 static int hf_t38_setup = -1;
127 static int hf_t38_setup_frame = -1;
128 static int hf_t38_setup_method = -1;
130 /* T38 Data reassemble fields */
131 static int hf_t38_fragments = -1;
132 static int hf_t38_fragment = -1;
133 static int hf_t38_fragment_overlap = -1;
134 static int hf_t38_fragment_overlap_conflicts = -1;
135 static int hf_t38_fragment_multiple_tails = -1;
136 static int hf_t38_fragment_too_long_fragment = -1;
137 static int hf_t38_fragment_error = -1;
138 static int hf_t38_reassembled_in = -1;
139 static int hf_t38_reassembled_length = -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;
154 static const fragment_items data_frag_items = {
155 /* Fragment subtrees */
158 /* Fragment fields */
161 &hf_t38_fragment_overlap,
162 &hf_t38_fragment_overlap_conflicts,
163 &hf_t38_fragment_multiple_tails,
164 &hf_t38_fragment_too_long_fragment,
165 &hf_t38_fragment_error,
166 /* Reassembled in field */
167 &hf_t38_reassembled_in,
168 /* Reassembled length field */
169 &hf_t38_reassembled_length,
174 typedef struct _fragment_key {
180 static conversation_t *p_conv= NULL;
181 static t38_conv *p_t38_conv = NULL;
182 static t38_conv *p_t38_packet_conv = NULL;
183 static t38_conv_info *p_t38_conv_info = NULL;
184 static t38_conv_info *p_t38_packet_conv_info = NULL;
186 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
187 #define RTP_VERSION(octet) ((octet) >> 6)
189 void proto_reg_handoff_t38(void);
191 static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
192 /* Preferences bool to control whether or not setup info should be shown */
193 static gboolean global_t38_show_setup_info = TRUE;
195 /* Can tap up to 4 T38 packets within same packet */
196 /* We only tap the primary part, not the redundancy */
197 #define MAX_T38_MESSAGES_IN_PACKET 4
198 static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET];
199 static int t38_info_current=0;
200 static t38_packet_info *t38_info=NULL;
202 static void t38_defragment_init(void)
204 /* Init reassemble tables */
205 fragment_table_init(&data_fragment_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_conversation;
217 t38_conv* p_conversation_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_conversation = 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_conversation || p_conversation->setup_frame != setup_frame_number) {
242 p_conversation = 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_conversation, t38_udp_handle);
251 * Check if the conversation has data associated with it.
253 p_conversation_data = conversation_get_proto_data(p_conversation, proto_t38);
256 * If not, add a new data item.
258 if ( ! p_conversation_data ) {
259 /* Create conversation data */
260 p_conversation_data = se_alloc(sizeof(t38_conv));
262 conversation_add_proto_data(p_conversation, proto_t38, p_conversation_data);
266 * Update the conversation data.
268 g_strlcpy(p_conversation_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE);
269 p_conversation_data->setup_frame_number = setup_frame_number;
270 p_conversation_data->src_t38_info.reass_ID = 0;
271 p_conversation_data->src_t38_info.reass_start_seqnum = -1;
272 p_conversation_data->src_t38_info.reass_data_type = 0;
273 p_conversation_data->src_t38_info.last_seqnum = -1;
274 p_conversation_data->src_t38_info.packet_lost = 0;
275 p_conversation_data->src_t38_info.burst_lost = 0;
276 p_conversation_data->src_t38_info.time_first_t4_data = 0;
279 p_conversation_data->dst_t38_info.reass_ID = 0;
280 p_conversation_data->dst_t38_info.reass_start_seqnum = -1;
281 p_conversation_data->dst_t38_info.reass_data_type = 0;
282 p_conversation_data->dst_t38_info.last_seqnum = -1;
283 p_conversation_data->dst_t38_info.packet_lost = 0;
284 p_conversation_data->dst_t38_info.burst_lost = 0;
285 p_conversation_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_dst, &pinfo->net_src,
433 pinfo->destport, pinfo->srcport, 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 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
516 col_clear(pinfo->cinfo, COL_INFO);
520 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
521 Data_Field_item_num = 0;
523 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
524 tr=proto_item_add_subtree(it, ett_t38);
526 /* init tap and conv info */
527 init_t38_info_conv(pinfo);
529 /* Show Conversation setup info if exists*/
530 if (global_t38_show_setup_info) {
531 show_setup_info(tvb, tr, p_t38_packet_conv);
534 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
536 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr);
538 if (tvb_length_remaining(tvb,offset)>0){
540 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
541 "[MALFORMED PACKET or wrong preference settings]");
543 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
548 dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
554 guint16 ifp_packet_number=1;
556 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
557 col_clear(pinfo->cinfo, COL_INFO);
561 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
562 Data_Field_item_num = 0;
564 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
565 tr=proto_item_add_subtree(it, ett_t38);
567 /* init tap and conv info */
568 init_t38_info_conv(pinfo);
570 /* Show Conversation setup info if exists*/
571 if (global_t38_show_setup_info) {
572 show_setup_info(tvb, tr, p_t38_packet_conv);
575 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
577 while(tvb_length_remaining(tvb,offset)>0)
579 next_tvb = tvb_new_subset_remaining(tvb, offset);
580 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr);
583 if(tvb_length_remaining(tvb,offset)>0){
584 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
586 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
587 "[MALFORMED PACKET or wrong preference settings]");
589 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
593 if (check_col(pinfo->cinfo, COL_INFO)){
594 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
603 dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
607 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
608 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
610 else if((t38_tpkt_usage == T38_TPKT_NEVER) || (is_tpkt(tvb,1) == -1)){
611 dissect_t38_tcp_pdu(tvb, pinfo, tree);
614 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
619 dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
621 if(pinfo->ipproto == IP_PROTO_TCP)
623 dissect_t38_tcp(tvb, pinfo, tree);
625 else if(pinfo->ipproto == IP_PROTO_UDP)
627 dissect_t38_udp(tvb, pinfo, tree);
631 /* Look for conversation info and display any setup info found */
633 show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conversation)
635 proto_tree *t38_setup_tree;
638 if (!p_t38_conversation || p_t38_conversation->setup_frame_number == 0) {
639 /* there is no Setup info */
643 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
645 "Stream setup by %s (frame %u)",
646 p_t38_conversation->setup_method,
647 p_t38_conversation->setup_frame_number);
648 PROTO_ITEM_SET_GENERATED(ti);
649 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
652 /* Add details into subtree */
653 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
654 tvb, 0, 0, p_t38_conversation->setup_frame_number);
655 PROTO_ITEM_SET_GENERATED(item);
656 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
657 tvb, 0, 0, p_t38_conversation->setup_method);
658 PROTO_ITEM_SET_GENERATED(item);
664 /* Wireshark Protocol Registration */
666 proto_register_t38(void)
668 static hf_register_info hf[] =
670 #include "packet-t38-hfarr.c"
672 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
673 NULL, 0x0, "Stream setup, method and frame number", HFILL }},
674 { &hf_t38_setup_frame,
675 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
676 NULL, 0x0, "Frame that set up this stream", HFILL }},
677 { &hf_t38_setup_method,
678 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
679 NULL, 0x0, "Method used to set up this stream", HFILL }},
681 {"Message fragments", "t38.fragments",
682 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
684 {"Message fragment", "t38.fragment",
685 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
686 {&hf_t38_fragment_overlap,
687 {"Message fragment overlap", "t38.fragment.overlap",
688 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
689 {&hf_t38_fragment_overlap_conflicts,
690 {"Message fragment overlapping with conflicting data",
691 "t38.fragment.overlap.conflicts",
692 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
693 {&hf_t38_fragment_multiple_tails,
694 {"Message has multiple tail fragments",
695 "t38.fragment.multiple_tails",
696 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
697 {&hf_t38_fragment_too_long_fragment,
698 {"Message fragment too long", "t38.fragment.too_long_fragment",
699 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
700 {&hf_t38_fragment_error,
701 {"Message defragmentation error", "t38.fragment.error",
702 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
703 {&hf_t38_reassembled_in,
704 {"Reassembled in", "t38.reassembled.in",
705 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
706 {&hf_t38_reassembled_length,
707 {"Reassembled T38 length", "t38.reassembled.length",
708 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
714 #include "packet-t38-ettarr.c"
720 module_t *t38_module;
722 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
723 proto_register_field_array(proto_t38, hf, array_length(hf));
724 proto_register_subtree_array(ett, array_length(ett));
725 register_dissector("t38", dissect_t38, proto_t38);
727 /* Init reassemble tables for HDLC */
728 register_init_routine(t38_defragment_init);
730 t38_tap = register_tap("t38");
732 t38_module = prefs_register_protocol(proto_t38, proto_reg_handoff_t38);
733 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
734 "Use the Pre-Corrigendum ASN.1 specification",
735 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
736 "ASN.1 specification (1998).",
737 &use_pre_corrigendum_asn1_specification);
738 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
739 "Dissect possible RTP version 2 packets with RTP dissector",
740 "Whether a UDP packet that looks like RTP version 2 packet will "
741 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
742 "packets with sequence number higher than 32767 may be dissected as RTP.",
743 &dissect_possible_rtpv2_packets_as_rtp);
744 prefs_register_uint_preference(t38_module, "tcp.port",
746 "Set the TCP port for T.38 messages",
747 10, &global_t38_tcp_port);
748 prefs_register_uint_preference(t38_module, "udp.port",
750 "Set the UDP port for T.38 messages",
751 10, &global_t38_udp_port);
752 prefs_register_bool_preference(t38_module, "reassembly",
753 "Reassemble T.38 PDUs over TPKT over TCP",
754 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
755 "when TPKT is used over TCP. "
756 "To use this option, you must also enable \"Allow subdissectors to reassemble "
757 "TCP streams\" in the TCP protocol settings.",
758 &t38_tpkt_reassembly);
759 prefs_register_enum_preference(t38_module, "tpkt_usage",
760 "TPKT used over TCP",
761 "Whether T.38 is used with TPKT for TCP",
762 (gint *)&t38_tpkt_usage,t38_tpkt_options,FALSE);
764 prefs_register_bool_preference(t38_module, "show_setup_info",
765 "Show stream setup information",
766 "Where available, show which protocol and frame caused "
767 "this T.38 stream to be created",
768 &global_t38_show_setup_info);
773 proto_reg_handoff_t38(void)
775 static gboolean t38_prefs_initialized = FALSE;
776 static guint tcp_port;
777 static guint udp_port;
779 if (!t38_prefs_initialized) {
780 t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
781 t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
782 t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
783 rtp_handle = find_dissector("rtp");
784 t30_hdlc_handle = find_dissector("t30.hdlc");
785 data_handle = find_dissector("data");
786 t38_prefs_initialized = TRUE;
789 dissector_delete("tcp.port", tcp_port, t38_tcp_handle);
790 dissector_delete("udp.port", udp_port, t38_udp_handle);
792 tcp_port = global_t38_tcp_port;
793 udp_port = global_t38_udp_port;
795 dissector_add("tcp.port", tcp_port, t38_tcp_handle);
796 dissector_add("udp.port", udp_port, t38_udp_handle);