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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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.
50 #include <epan/packet.h>
51 #include <epan/reassemble.h>
52 #include <epan/conversation.h>
54 #include <epan/expert.h>
58 #include "packet-t38.h"
59 #include <epan/prefs.h>
60 #include <epan/ipproto.h>
61 #include <epan/asn1.h>
62 #include "packet-per.h"
63 #include "packet-tpkt.h"
64 #include <epan/wmem/wmem.h>
65 #include <epan/strutil.h>
67 void proto_register_t38(void);
68 void proto_reg_handoff_t38(void);
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_fragment_count
= -1;
140 static int hf_t38_reassembled_in
= -1;
141 static int hf_t38_reassembled_length
= -1;
143 static gint ett_t38
= -1;
144 #include "packet-t38-ett.c"
145 static gint ett_t38_setup
= -1;
147 static gint ett_data_fragment
= -1;
148 static gint ett_data_fragments
= -1;
150 static gboolean primary_part
= TRUE
;
151 static guint32 seq_number
= 0;
153 /* Tables for reassembly of Data fragments. */
154 static reassembly_table data_reassembly_table
;
156 static const fragment_items data_frag_items
= {
157 /* Fragment subtrees */
160 /* Fragment fields */
163 &hf_t38_fragment_overlap
,
164 &hf_t38_fragment_overlap_conflicts
,
165 &hf_t38_fragment_multiple_tails
,
166 &hf_t38_fragment_too_long_fragment
,
167 &hf_t38_fragment_error
,
168 &hf_t38_fragment_count
,
169 /* Reassembled in field */
170 &hf_t38_reassembled_in
,
171 /* Reassembled length field */
172 &hf_t38_reassembled_length
,
173 /* Reassembled data field */
179 typedef struct _fragment_key
{
185 static conversation_t
*p_conv
= NULL
;
186 static t38_conv
*p_t38_conv
= NULL
;
187 static t38_conv
*p_t38_packet_conv
= NULL
;
188 static t38_conv_info
*p_t38_conv_info
= NULL
;
189 static t38_conv_info
*p_t38_packet_conv_info
= NULL
;
191 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
192 #define RTP_VERSION(octet) ((octet) >> 6)
194 void proto_reg_handoff_t38(void);
196 static void show_setup_info(tvbuff_t
*tvb
, proto_tree
*tree
, t38_conv
*p_t38_conv
);
197 /* Preferences bool to control whether or not setup info should be shown */
198 static gboolean global_t38_show_setup_info
= TRUE
;
200 /* Can tap up to 4 T38 packets within same packet */
201 /* We only tap the primary part, not the redundancy */
202 #define MAX_T38_MESSAGES_IN_PACKET 4
203 static t38_packet_info t38_info_arr
[MAX_T38_MESSAGES_IN_PACKET
];
204 static int t38_info_current
=0;
205 static t38_packet_info
*t38_info
=NULL
;
207 static void t38_defragment_init(void)
209 /* Init reassembly table */
210 reassembly_table_init(&data_reassembly_table
,
211 &addresses_reassembly_table_functions
);
215 /* Set up an T38 conversation */
216 void t38_add_address(packet_info
*pinfo
,
217 address
*addr
, int port
,
219 const gchar
*setup_method
, guint32 setup_frame_number
)
222 conversation_t
* p_conversation
;
223 t38_conv
* p_conversation_data
= NULL
;
226 * If this isn't the first time this packet has been processed,
227 * we've already done this work, so we don't need to do it
230 if ((pinfo
->fd
->flags
.visited
) || (t38_udp_handle
== NULL
))
235 SET_ADDRESS(&null_addr
, AT_NONE
, 0, NULL
);
238 * Check if the ip address and port combination is not
239 * already registered as a conversation.
241 p_conversation
= find_conversation( setup_frame_number
, addr
, &null_addr
, PT_UDP
, port
, other_port
,
242 NO_ADDR_B
| (!other_port
? NO_PORT_B
: 0));
245 * If not, create a new conversation.
247 if ( !p_conversation
|| p_conversation
->setup_frame
!= setup_frame_number
) {
248 p_conversation
= conversation_new( setup_frame_number
, addr
, &null_addr
, PT_UDP
,
249 (guint32
)port
, (guint32
)other_port
,
250 NO_ADDR2
| (!other_port
? NO_PORT2
: 0));
254 conversation_set_dissector(p_conversation
, t38_udp_handle
);
257 * Check if the conversation has data associated with it.
259 p_conversation_data
= (t38_conv
*)conversation_get_proto_data(p_conversation
, proto_t38
);
262 * If not, add a new data item.
264 if ( ! p_conversation_data
) {
265 /* Create conversation data */
266 p_conversation_data
= wmem_new(wmem_file_scope(), t38_conv
);
268 conversation_add_proto_data(p_conversation
, proto_t38
, p_conversation_data
);
272 * Update the conversation data.
274 g_strlcpy(p_conversation_data
->setup_method
, setup_method
, MAX_T38_SETUP_METHOD_SIZE
);
275 p_conversation_data
->setup_frame_number
= setup_frame_number
;
276 p_conversation_data
->src_t38_info
.reass_ID
= 0;
277 p_conversation_data
->src_t38_info
.reass_start_seqnum
= -1;
278 p_conversation_data
->src_t38_info
.reass_data_type
= 0;
279 p_conversation_data
->src_t38_info
.last_seqnum
= -1;
280 p_conversation_data
->src_t38_info
.packet_lost
= 0;
281 p_conversation_data
->src_t38_info
.burst_lost
= 0;
282 p_conversation_data
->src_t38_info
.time_first_t4_data
= 0;
285 p_conversation_data
->dst_t38_info
.reass_ID
= 0;
286 p_conversation_data
->dst_t38_info
.reass_start_seqnum
= -1;
287 p_conversation_data
->dst_t38_info
.reass_data_type
= 0;
288 p_conversation_data
->dst_t38_info
.last_seqnum
= -1;
289 p_conversation_data
->dst_t38_info
.packet_lost
= 0;
290 p_conversation_data
->dst_t38_info
.burst_lost
= 0;
291 p_conversation_data
->dst_t38_info
.time_first_t4_data
= 0;
296 force_reassemble_seq(reassembly_table
*table
, packet_info
*pinfo
, guint32 id
)
298 fragment_head
*fd_head
;
300 fragment_item
*last_fd
;
301 guint32 dfpos
, size
, packet_lost
, burst_lost
, seq_num
;
304 fd_head
= fragment_get(table
, pinfo
, id
, NULL
);
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
){
346 data
= (guint8
*) g_malloc(size
);
347 fd_head
->tvb_data
= tvb_new_real_data(data
, size
, size
);
348 fd_head
->len
= size
; /* record size for caller */
350 /* add all data fragments */
353 for (fd_i
=fd_head
->next
;fd_i
&& fd_i
->len
+ dfpos
<= size
;fd_i
=fd_i
->next
) {
355 if(!last_fd
|| last_fd
->offset
!=fd_i
->offset
){
356 memcpy(data
+dfpos
,tvb_get_ptr(fd_i
->tvb_data
,0,fd_i
->len
),fd_i
->len
);
359 /* duplicate/retransmission/overlap */
360 fd_i
->flags
|= FD_OVERLAP
;
361 fd_head
->flags
|= FD_OVERLAP
;
362 if( (last_fd
->len
!=fd_i
->datalen
)
363 || tvb_memeql(last_fd
->tvb_data
, 0, tvb_get_ptr(fd_i
->tvb_data
, 0, last_fd
->len
), last_fd
->len
) ){
364 fd_i
->flags
|= FD_OVERLAPCONFLICT
;
365 fd_head
->flags
|= FD_OVERLAPCONFLICT
;
372 /* we have defragmented the pdu, now free all fragments*/
373 for (fd_i
=fd_head
->next
;fd_i
;fd_i
=fd_i
->next
) {
375 tvb_free(fd_i
->tvb_data
);
380 /* mark this packet as defragmented */
381 fd_head
->flags
|= FD_DEFRAGMENTED
;
382 fd_head
->reassembled_in
=pinfo
->fd
->num
;
384 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost
, burst_lost
);
386 p_t38_packet_conv_info
->packet_lost
= packet_lost
;
387 p_t38_packet_conv_info
->burst_lost
= burst_lost
;
393 #include "packet-t38-fn.c"
395 /* initialize the tap t38_info and the conversation */
397 init_t38_info_conv(packet_info
*pinfo
)
401 if (t38_info_current
==MAX_T38_MESSAGES_IN_PACKET
) {
404 t38_info
= &t38_info_arr
[t38_info_current
];
406 t38_info
->seq_num
= 0;
407 t38_info
->type_msg
= 0;
408 t38_info
->data_value
= 0;
409 t38_info
->t30ind_value
=0;
410 t38_info
->setup_frame_number
= 0;
411 t38_info
->Data_Field_field_type_value
= 0;
412 t38_info
->desc
[0] = '\0';
413 t38_info
->desc_comment
[0] = '\0';
414 t38_info
->time_first_t4_data
= 0;
415 t38_info
->frame_num_first_t4_data
= 0;
419 p_t38_packet_conv hold the conversation info in each of the packets.
420 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
421 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
422 need to use p_t38_conv
424 p_t38_packet_conv
= NULL
;
427 /* Use existing packet info if available */
428 p_t38_packet_conv
= (t38_conv
*)p_get_proto_data(pinfo
->fd
, proto_t38
, 0);
431 /* find the conversation used for Reassemble and Setup Info */
432 p_conv
= find_conversation(pinfo
->fd
->num
, &pinfo
->net_dst
, &pinfo
->net_src
,
434 pinfo
->destport
, pinfo
->srcport
, NO_ADDR_B
| NO_PORT_B
);
436 /* create a conv if it doen't exist */
438 p_conv
= conversation_new(pinfo
->fd
->num
, &pinfo
->net_src
, &pinfo
->net_dst
,
439 pinfo
->ptype
, pinfo
->srcport
, pinfo
->destport
, NO_ADDR_B
| NO_PORT_B
);
442 conversation_set_dissector(p_conv
, t38_udp_handle
);
445 if (!p_t38_packet_conv
) {
446 p_t38_conv
= (t38_conv
*)conversation_get_proto_data(p_conv
, proto_t38
);
448 /* create the conversation if it doen't exist */
450 p_t38_conv
= wmem_new(wmem_file_scope(), t38_conv
);
451 p_t38_conv
->setup_method
[0] = '\0';
452 p_t38_conv
->setup_frame_number
= 0;
454 p_t38_conv
->src_t38_info
.reass_ID
= 0;
455 p_t38_conv
->src_t38_info
.reass_start_seqnum
= -1;
456 p_t38_conv
->src_t38_info
.reass_data_type
= 0;
457 p_t38_conv
->src_t38_info
.last_seqnum
= -1;
458 p_t38_conv
->src_t38_info
.packet_lost
= 0;
459 p_t38_conv
->src_t38_info
.burst_lost
= 0;
460 p_t38_conv
->src_t38_info
.time_first_t4_data
= 0;
461 p_t38_conv
->src_t38_info
.additional_hdlc_data_field_counter
= 0;
462 p_t38_conv
->src_t38_info
.seqnum_prev_data_field
= -1;
464 p_t38_conv
->dst_t38_info
.reass_ID
= 0;
465 p_t38_conv
->dst_t38_info
.reass_start_seqnum
= -1;
466 p_t38_conv
->dst_t38_info
.reass_data_type
= 0;
467 p_t38_conv
->dst_t38_info
.last_seqnum
= -1;
468 p_t38_conv
->dst_t38_info
.packet_lost
= 0;
469 p_t38_conv
->dst_t38_info
.burst_lost
= 0;
470 p_t38_conv
->dst_t38_info
.time_first_t4_data
= 0;
471 p_t38_conv
->dst_t38_info
.additional_hdlc_data_field_counter
= 0;
472 p_t38_conv
->dst_t38_info
.seqnum_prev_data_field
= -1;
474 conversation_add_proto_data(p_conv
, proto_t38
, p_t38_conv
);
477 /* copy the t38 conversation info to the packet t38 conversation */
478 p_t38_packet_conv
= wmem_new(wmem_file_scope(), t38_conv
);
479 g_strlcpy(p_t38_packet_conv
->setup_method
, p_t38_conv
->setup_method
, MAX_T38_SETUP_METHOD_SIZE
);
480 p_t38_packet_conv
->setup_frame_number
= p_t38_conv
->setup_frame_number
;
482 memcpy(&(p_t38_packet_conv
->src_t38_info
), &(p_t38_conv
->src_t38_info
), sizeof(t38_conv_info
));
483 memcpy(&(p_t38_packet_conv
->dst_t38_info
), &(p_t38_conv
->dst_t38_info
), sizeof(t38_conv_info
));
485 p_add_proto_data(pinfo
->fd
, proto_t38
, 0, p_t38_packet_conv
);
488 if (ADDRESSES_EQUAL(&p_conv
->key_ptr
->addr1
, &pinfo
->net_src
)) {
489 p_t38_conv_info
= &(p_t38_conv
->src_t38_info
);
490 p_t38_packet_conv_info
= &(p_t38_packet_conv
->src_t38_info
);
492 p_t38_conv_info
= &(p_t38_conv
->dst_t38_info
);
493 p_t38_packet_conv_info
= &(p_t38_packet_conv
->dst_t38_info
);
496 /* update t38_info */
497 t38_info
->setup_frame_number
= p_t38_packet_conv
->setup_frame_number
;
500 /* Entry point for dissection */
502 dissect_t38_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
510 * XXX - heuristic to check for misidentified packets.
512 if (dissect_possible_rtpv2_packets_as_rtp
){
513 octet1
= tvb_get_guint8(tvb
, offset
);
514 if (RTP_VERSION(octet1
) == 2){
515 call_dissector(rtp_handle
,tvb
,pinfo
,tree
);
520 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "T.38");
521 col_clear(pinfo
->cinfo
, COL_INFO
);
525 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
526 Data_Field_item_num
= 0;
528 it
=proto_tree_add_protocol_format(tree
, proto_t38
, tvb
, 0, -1, "ITU-T Recommendation T.38");
529 tr
=proto_item_add_subtree(it
, ett_t38
);
531 /* init tap and conv info */
532 init_t38_info_conv(pinfo
);
534 /* Show Conversation setup info if exists*/
535 if (global_t38_show_setup_info
) {
536 show_setup_info(tvb
, tr
, p_t38_packet_conv
);
539 col_append_str(pinfo
->cinfo
, COL_INFO
, "UDP: UDPTLPacket ");
541 offset
= dissect_UDPTLPacket_PDU(tvb
, pinfo
, tr
, NULL
);
543 if (tvb_length_remaining(tvb
,offset
)>0){
545 proto_tree_add_text(tr
, tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
),
546 "[MALFORMED PACKET or wrong preference settings]");
548 col_append_str(pinfo
->cinfo
, COL_INFO
, " [Malformed?]");
553 dissect_t38_tcp_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
559 guint16 ifp_packet_number
=1;
561 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "T.38");
562 col_clear(pinfo
->cinfo
, COL_INFO
);
566 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
567 Data_Field_item_num
= 0;
569 it
=proto_tree_add_protocol_format(tree
, proto_t38
, tvb
, 0, -1, "ITU-T Recommendation T.38");
570 tr
=proto_item_add_subtree(it
, ett_t38
);
572 /* init tap and conv info */
573 init_t38_info_conv(pinfo
);
575 /* Show Conversation setup info if exists*/
576 if (global_t38_show_setup_info
) {
577 show_setup_info(tvb
, tr
, p_t38_packet_conv
);
580 col_append_str(pinfo
->cinfo
, COL_INFO
, "TCP: IFPPacket");
582 while(tvb_length_remaining(tvb
,offset
)>0)
584 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
585 offset
+= dissect_IFPPacket_PDU(next_tvb
, pinfo
, tr
, NULL
);
588 if(tvb_length_remaining(tvb
,offset
)>0){
589 if(t38_tpkt_usage
== T38_TPKT_ALWAYS
){
591 proto_tree_add_text(tr
, tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
),
592 "[MALFORMED PACKET or wrong preference settings]");
594 col_append_str(pinfo
->cinfo
, COL_INFO
, " [Malformed?]");
597 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " IFPPacket#%u",ifp_packet_number
);
605 dissect_t38_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
609 if(t38_tpkt_usage
== T38_TPKT_ALWAYS
){
610 dissect_tpkt_encap(tvb
,pinfo
,tree
,t38_tpkt_reassembly
,t38_tcp_pdu_handle
);
612 else if((t38_tpkt_usage
== T38_TPKT_NEVER
) || (is_tpkt(tvb
,1) == -1)){
613 dissect_t38_tcp_pdu(tvb
, pinfo
, tree
);
616 dissect_tpkt_encap(tvb
,pinfo
,tree
,t38_tpkt_reassembly
,t38_tcp_pdu_handle
);
621 dissect_t38(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
623 if(pinfo
->ipproto
== IP_PROTO_TCP
)
625 dissect_t38_tcp(tvb
, pinfo
, tree
);
627 else if(pinfo
->ipproto
== IP_PROTO_UDP
)
629 dissect_t38_udp(tvb
, pinfo
, tree
);
633 /* Look for conversation info and display any setup info found */
635 show_setup_info(tvbuff_t
*tvb
, proto_tree
*tree
, t38_conv
*p_t38_conversation
)
637 proto_tree
*t38_setup_tree
;
640 if (!p_t38_conversation
|| p_t38_conversation
->setup_frame_number
== 0) {
641 /* there is no Setup info */
645 ti
= proto_tree_add_string_format(tree
, hf_t38_setup
, tvb
, 0, 0,
647 "Stream setup by %s (frame %u)",
648 p_t38_conversation
->setup_method
,
649 p_t38_conversation
->setup_frame_number
);
650 PROTO_ITEM_SET_GENERATED(ti
);
651 t38_setup_tree
= proto_item_add_subtree(ti
, ett_t38_setup
);
654 /* Add details into subtree */
655 proto_item
* item
= proto_tree_add_uint(t38_setup_tree
, hf_t38_setup_frame
,
656 tvb
, 0, 0, p_t38_conversation
->setup_frame_number
);
657 PROTO_ITEM_SET_GENERATED(item
);
658 item
= proto_tree_add_string(t38_setup_tree
, hf_t38_setup_method
,
659 tvb
, 0, 0, p_t38_conversation
->setup_method
);
660 PROTO_ITEM_SET_GENERATED(item
);
666 /* Wireshark Protocol Registration */
668 proto_register_t38(void)
670 static hf_register_info hf
[] =
672 #include "packet-t38-hfarr.c"
674 { "Stream setup", "t38.setup", FT_STRING
, BASE_NONE
,
675 NULL
, 0x0, "Stream setup, method and frame number", HFILL
}},
676 { &hf_t38_setup_frame
,
677 { "Stream frame", "t38.setup-frame", FT_FRAMENUM
, BASE_NONE
,
678 NULL
, 0x0, "Frame that set up this stream", HFILL
}},
679 { &hf_t38_setup_method
,
680 { "Stream Method", "t38.setup-method", FT_STRING
, BASE_NONE
,
681 NULL
, 0x0, "Method used to set up this stream", HFILL
}},
683 {"Message fragments", "t38.fragments",
684 FT_NONE
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
686 {"Message fragment", "t38.fragment",
687 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
688 {&hf_t38_fragment_overlap
,
689 {"Message fragment overlap", "t38.fragment.overlap",
690 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
691 {&hf_t38_fragment_overlap_conflicts
,
692 {"Message fragment overlapping with conflicting data",
693 "t38.fragment.overlap.conflicts",
694 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
695 {&hf_t38_fragment_multiple_tails
,
696 {"Message has multiple tail fragments",
697 "t38.fragment.multiple_tails",
698 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
699 {&hf_t38_fragment_too_long_fragment
,
700 {"Message fragment too long", "t38.fragment.too_long_fragment",
701 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
702 {&hf_t38_fragment_error
,
703 {"Message defragmentation error", "t38.fragment.error",
704 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
705 {&hf_t38_fragment_count
,
706 {"Message fragment count", "t38.fragment.count",
707 FT_UINT32
, BASE_DEC
, NULL
, 0x00, NULL
, HFILL
} },
708 {&hf_t38_reassembled_in
,
709 {"Reassembled in", "t38.reassembled.in",
710 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
711 {&hf_t38_reassembled_length
,
712 {"Reassembled T38 length", "t38.reassembled.length",
713 FT_UINT32
, BASE_DEC
, NULL
, 0x00, NULL
, HFILL
} },
719 #include "packet-t38-ettarr.c"
725 module_t
*t38_module
;
727 proto_t38
= proto_register_protocol("T.38", "T.38", "t38");
728 proto_register_field_array(proto_t38
, hf
, array_length(hf
));
729 proto_register_subtree_array(ett
, array_length(ett
));
730 register_dissector("t38", dissect_t38
, proto_t38
);
732 /* Init reassemble tables for HDLC */
733 register_init_routine(t38_defragment_init
);
735 t38_tap
= register_tap("t38");
737 t38_module
= prefs_register_protocol(proto_t38
, proto_reg_handoff_t38
);
738 prefs_register_bool_preference(t38_module
, "use_pre_corrigendum_asn1_specification",
739 "Use the Pre-Corrigendum ASN.1 specification",
740 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
741 "ASN.1 specification (1998).",
742 &use_pre_corrigendum_asn1_specification
);
743 prefs_register_bool_preference(t38_module
, "dissect_possible_rtpv2_packets_as_rtp",
744 "Dissect possible RTP version 2 packets with RTP dissector",
745 "Whether a UDP packet that looks like RTP version 2 packet will "
746 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
747 "packets with sequence number higher than 32767 may be dissected as RTP.",
748 &dissect_possible_rtpv2_packets_as_rtp
);
749 prefs_register_uint_preference(t38_module
, "tcp.port",
751 "Set the TCP port for T.38 messages",
752 10, &global_t38_tcp_port
);
753 prefs_register_uint_preference(t38_module
, "udp.port",
755 "Set the UDP port for T.38 messages",
756 10, &global_t38_udp_port
);
757 prefs_register_bool_preference(t38_module
, "reassembly",
758 "Reassemble T.38 PDUs over TPKT over TCP",
759 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
760 "when TPKT is used over TCP. "
761 "To use this option, you must also enable \"Allow subdissectors to reassemble "
762 "TCP streams\" in the TCP protocol settings.",
763 &t38_tpkt_reassembly
);
764 prefs_register_enum_preference(t38_module
, "tpkt_usage",
765 "TPKT used over TCP",
766 "Whether T.38 is used with TPKT for TCP",
767 (gint
*)&t38_tpkt_usage
,t38_tpkt_options
,FALSE
);
769 prefs_register_bool_preference(t38_module
, "show_setup_info",
770 "Show stream setup information",
771 "Where available, show which protocol and frame caused "
772 "this T.38 stream to be created",
773 &global_t38_show_setup_info
);
778 proto_reg_handoff_t38(void)
780 static gboolean t38_prefs_initialized
= FALSE
;
781 static guint tcp_port
;
782 static guint udp_port
;
784 if (!t38_prefs_initialized
) {
785 t38_udp_handle
=create_dissector_handle(dissect_t38_udp
, proto_t38
);
786 t38_tcp_handle
=create_dissector_handle(dissect_t38_tcp
, proto_t38
);
787 t38_tcp_pdu_handle
=create_dissector_handle(dissect_t38_tcp_pdu
, proto_t38
);
788 rtp_handle
= find_dissector("rtp");
789 t30_hdlc_handle
= find_dissector("t30.hdlc");
790 data_handle
= find_dissector("data");
791 t38_prefs_initialized
= TRUE
;
794 dissector_delete_uint("tcp.port", tcp_port
, t38_tcp_handle
);
795 dissector_delete_uint("udp.port", udp_port
, t38_udp_handle
);
797 tcp_port
= global_t38_tcp_port
;
798 udp_port
= global_t38_udp_port
;
800 dissector_add_uint("tcp.port", tcp_port
, t38_tcp_handle
);
801 dissector_add_uint("udp.port", udp_port
, t38_udp_handle
);