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>
78 static guint global_t38_tcp_port = PORT_T38;
79 static guint global_t38_udp_port = PORT_T38;
81 static int t38_tap = -1;
84 * Variables to allow for proper deletion of dissector registration when
85 * the user changes port from the gui.
87 static guint tcp_port = 0;
88 static guint udp_port = 0;
90 /* dissect using the Pre Corrigendum T.38 ASN.1 specification (1998) */
91 static gboolean use_pre_corrigendum_asn1_specification = TRUE;
93 /* dissect packets that looks like RTP version 2 packets as RTP */
94 /* instead of as T.38. This may result in that some T.38 UPTL */
95 /* packets with sequence number values higher than 32767 may be */
96 /* shown as RTP packets. */
97 static gboolean dissect_possible_rtpv2_packets_as_rtp = FALSE;
100 /* Reassembly of T.38 PDUs over TPKT over TCP */
101 static gboolean t38_tpkt_reassembly = TRUE;
103 /* Preference setting whether TPKT header is used when sending T.38 over TCP.
104 * The default setting is Maybe where the dissector will look on the first
105 * bytes to try to determine whether TPKT header is used or not. This may not
106 * work so well in some cases. You may want to change the setting to Always or
109 #define T38_TPKT_NEVER 0 /* Assume that there is never a TPKT header */
110 #define T38_TPKT_ALWAYS 1 /* Assume that there is always a TPKT header */
111 #define T38_TPKT_MAYBE 2 /* Assume TPKT if first octets are 03-00-xx-xx */
112 static gint t38_tpkt_usage = T38_TPKT_MAYBE;
114 static const enum_val_t t38_tpkt_options[] = {
115 {"never", "Never", T38_TPKT_NEVER},
116 {"always", "Always", T38_TPKT_ALWAYS},
117 {"maybe", "Maybe", T38_TPKT_MAYBE},
124 static dissector_handle_t t38_udp_handle;
125 static dissector_handle_t t38_tcp_handle;
126 static dissector_handle_t t38_tcp_pdu_handle;
127 static dissector_handle_t rtp_handle;
128 static dissector_handle_t t30_hdlc_handle;
129 static dissector_handle_t data_handle;
131 static guint32 Type_of_msg_value;
132 static guint32 Data_Field_field_type_value;
133 static guint32 Data_value;
134 static guint32 T30ind_value;
135 static guint32 Data_Field_item_num;
137 static int proto_t38 = -1;
139 /*--- Included file: packet-t38-hf.c ---*/
140 #line 1 "packet-t38-hf.c"
141 static int hf_t38_IFPPacket_PDU = -1; /* IFPPacket */
142 static int hf_t38_UDPTLPacket_PDU = -1; /* UDPTLPacket */
143 static int hf_t38_type_of_msg = -1; /* Type_of_msg */
144 static int hf_t38_data_field = -1; /* Data_Field */
145 static int hf_t38_t30_indicator = -1; /* T30_indicator */
146 static int hf_t38_t30_data = -1; /* T30_data */
147 static int hf_t38_Data_Field_item = -1; /* Data_Field_item */
148 static int hf_t38_field_type = -1; /* T_field_type */
149 static int hf_t38_field_data = -1; /* T_field_data */
150 static int hf_t38_seq_number = -1; /* T_seq_number */
151 static int hf_t38_primary_ifp_packet = -1; /* T_primary_ifp_packet */
152 static int hf_t38_error_recovery = -1; /* T_error_recovery */
153 static int hf_t38_secondary_ifp_packets = -1; /* T_secondary_ifp_packets */
154 static int hf_t38_secondary_ifp_packets_item = -1; /* OpenType_IFPPacket */
155 static int hf_t38_fec_info = -1; /* T_fec_info */
156 static int hf_t38_fec_npackets = -1; /* INTEGER */
157 static int hf_t38_fec_data = -1; /* T_fec_data */
158 static int hf_t38_fec_data_item = -1; /* OCTET_STRING */
160 /*--- End of included file: packet-t38-hf.c ---*/
161 #line 131 "packet-t38-template.c"
163 /* T38 setup fields */
164 static int hf_t38_setup = -1;
165 static int hf_t38_setup_frame = -1;
166 static int hf_t38_setup_method = -1;
168 /* T38 Data reassemble fields */
169 static int hf_data_fragments = -1;
170 static int hf_data_fragment = -1;
171 static int hf_data_fragment_overlap = -1;
172 static int hf_data_fragment_overlap_conflicts = -1;
173 static int hf_data_fragment_multiple_tails = -1;
174 static int hf_data_fragment_too_long_fragment = -1;
175 static int hf_data_fragment_error = -1;
176 static int hf_data_reassembled_in = -1;
178 static gint ett_t38 = -1;
180 /*--- Included file: packet-t38-ett.c ---*/
181 #line 1 "packet-t38-ett.c"
182 static gint ett_t38_IFPPacket = -1;
183 static gint ett_t38_Type_of_msg = -1;
184 static gint ett_t38_Data_Field = -1;
185 static gint ett_t38_Data_Field_item = -1;
186 static gint ett_t38_UDPTLPacket = -1;
187 static gint ett_t38_T_error_recovery = -1;
188 static gint ett_t38_T_secondary_ifp_packets = -1;
189 static gint ett_t38_T_fec_info = -1;
190 static gint ett_t38_T_fec_data = -1;
192 /*--- End of included file: packet-t38-ett.c ---*/
193 #line 149 "packet-t38-template.c"
194 static gint ett_t38_setup = -1;
196 static gint ett_data_fragment = -1;
197 static gint ett_data_fragments = -1;
199 static gboolean primary_part = TRUE;
200 static guint32 seq_number = 0;
202 /* Tables for reassembly of Data fragments. */
203 static GHashTable *data_fragment_table = NULL;
204 static GHashTable *data_reassembled_table = NULL;
206 static const fragment_items data_frag_items = {
207 /* Fragment subtrees */
210 /* Fragment fields */
213 &hf_data_fragment_overlap,
214 &hf_data_fragment_overlap_conflicts,
215 &hf_data_fragment_multiple_tails,
216 &hf_data_fragment_too_long_fragment,
217 &hf_data_fragment_error,
218 /* Reassembled in field */
219 &hf_data_reassembled_in,
224 typedef struct _fragment_key {
230 static conversation_t *p_conv= NULL;
231 static t38_conv *p_t38_conv = NULL;
232 static t38_conv *p_t38_packet_conv = NULL;
233 static t38_conv_info *p_t38_conv_info = NULL;
234 static t38_conv_info *p_t38_packet_conv_info = NULL;
236 /* RTP Version is the first 2 bits of the first octet in the UDP payload*/
237 #define RTP_VERSION(octet) ((octet) >> 6)
239 void proto_reg_handoff_t38(void);
241 static void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv);
242 /* Preferences bool to control whether or not setup info should be shown */
243 static gboolean global_t38_show_setup_info = TRUE;
245 /* Can tap up to 4 T38 packets within same packet */
246 /* We only tap the primary part, not the redundancy */
247 #define MAX_T38_MESSAGES_IN_PACKET 4
248 static t38_packet_info t38_info_arr[MAX_T38_MESSAGES_IN_PACKET];
249 static int t38_info_current=0;
250 static t38_packet_info *t38_info=NULL;
252 static void t38_defragment_init(void)
254 /* Init reassemble tables */
255 fragment_table_init(&data_fragment_table);
256 reassembled_table_init(&data_reassembled_table);
260 /* Set up an T38 conversation */
261 void t38_add_address(packet_info *pinfo,
262 address *addr, int port,
264 const gchar *setup_method, guint32 setup_frame_number)
267 conversation_t* p_conv;
268 t38_conv* p_conv_data = NULL;
271 * If this isn't the first time this packet has been processed,
272 * we've already done this work, so we don't need to do it
275 if (pinfo->fd->flags.visited)
280 SET_ADDRESS(&null_addr, AT_NONE, 0, NULL);
283 * Check if the ip address and port combination is not
284 * already registered as a conversation.
286 p_conv = find_conversation( setup_frame_number, addr, &null_addr, PT_UDP, port, other_port,
287 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
290 * If not, create a new conversation.
292 if ( !p_conv || p_conv->setup_frame != setup_frame_number) {
293 p_conv = conversation_new( setup_frame_number, addr, &null_addr, PT_UDP,
294 (guint32)port, (guint32)other_port,
295 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
299 conversation_set_dissector(p_conv, t38_udp_handle);
302 * Check if the conversation has data associated with it.
304 p_conv_data = conversation_get_proto_data(p_conv, proto_t38);
307 * If not, add a new data item.
309 if ( ! p_conv_data ) {
310 /* Create conversation data */
311 p_conv_data = se_alloc(sizeof(t38_conv));
313 conversation_add_proto_data(p_conv, proto_t38, p_conv_data);
317 * Update the conversation data.
319 strncpy(p_conv_data->setup_method, setup_method, MAX_T38_SETUP_METHOD_SIZE);
320 p_conv_data->setup_method[MAX_T38_SETUP_METHOD_SIZE] = '\0';
321 p_conv_data->setup_frame_number = setup_frame_number;
322 p_conv_data->src_t38_info.reass_ID = 0;
323 p_conv_data->src_t38_info.reass_start_seqnum = -1;
324 p_conv_data->src_t38_info.reass_data_type = 0;
325 p_conv_data->src_t38_info.last_seqnum = -1;
326 p_conv_data->src_t38_info.packet_lost = 0;
327 p_conv_data->src_t38_info.burst_lost = 0;
328 p_conv_data->src_t38_info.time_first_t4_data = 0;
331 p_conv_data->dst_t38_info.reass_ID = 0;
332 p_conv_data->dst_t38_info.reass_start_seqnum = -1;
333 p_conv_data->dst_t38_info.reass_data_type = 0;
334 p_conv_data->dst_t38_info.last_seqnum = -1;
335 p_conv_data->dst_t38_info.packet_lost = 0;
336 p_conv_data->dst_t38_info.burst_lost = 0;
337 p_conv_data->dst_t38_info.time_first_t4_data = 0;
342 force_reassemble_seq(packet_info *pinfo, guint32 id,
343 GHashTable *fragment_table)
346 fragment_data *fd_head;
348 fragment_data *last_fd;
349 guint32 dfpos, size, packet_lost, burst_lost, seq_num;
351 /* create key to search hash with */
352 key.src = pinfo->src;
353 key.dst = pinfo->dst;
356 fd_head = g_hash_table_lookup(fragment_table, &key);
358 /* have we already seen this frame ?*/
359 if (pinfo->fd->flags.visited) {
360 if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
368 /* we must have it to continue */
372 /* check for packet lost and count the burst of packet lost */
376 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
377 if (seq_num != fd_i->offset) {
378 packet_lost += fd_i->offset - seq_num;
379 if ( (fd_i->offset - seq_num) > burst_lost ) {
380 burst_lost = fd_i->offset - seq_num;
383 seq_num = fd_i->offset + 1;
386 /* we have received an entire packet, defragment it and
391 for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
392 if(!last_fd || last_fd->offset!=fd_i->offset){
397 fd_head->data = g_malloc(size);
398 fd_head->len = size; /* record size for caller */
400 /* add all data fragments */
403 for (fd_i=fd_head->next;fd_i && fd_i->len + dfpos <= size;fd_i=fd_i->next) {
405 if(!last_fd || last_fd->offset!=fd_i->offset){
406 memcpy(fd_head->data+dfpos,fd_i->data,fd_i->len);
409 /* duplicate/retransmission/overlap */
410 fd_i->flags |= FD_OVERLAP;
411 fd_head->flags |= FD_OVERLAP;
412 if( (last_fd->len!=fd_i->datalen)
413 || memcmp(last_fd->data, fd_i->data, last_fd->len) ){
414 fd_i->flags |= FD_OVERLAPCONFLICT;
415 fd_head->flags |= FD_OVERLAPCONFLICT;
422 /* we have defragmented the pdu, now free all fragments*/
423 for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
430 /* mark this packet as defragmented */
431 fd_head->flags |= FD_DEFRAGMENTED;
432 fd_head->reassembled_in=pinfo->fd->num;
434 if (check_col(pinfo->cinfo, COL_INFO))
435 col_append_fstr(pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost, burst_lost);
437 p_t38_packet_conv_info->packet_lost = packet_lost;
438 p_t38_packet_conv_info->burst_lost = burst_lost;
445 /*--- Included file: packet-t38-fn.c ---*/
446 #line 1 "packet-t38-fn.c"
448 const value_string t38_T30_indicator_vals[] = {
452 { 3, "v21-preamble" },
453 { 4, "v27-2400-training" },
454 { 5, "v27-4800-training" },
455 { 6, "v29-7200-training" },
456 { 7, "v29-9600-training" },
457 { 8, "v17-7200-short-training" },
458 { 9, "v17-7200-long-training" },
459 { 10, "v17-9600-short-training" },
460 { 11, "v17-9600-long-training" },
461 { 12, "v17-12000-short-training" },
462 { 13, "v17-12000-long-training" },
463 { 14, "v17-14400-short-training" },
464 { 15, "v17-14400-long-training" },
467 { 18, "v34-cntl-channel-1200" },
468 { 19, "v34-pri-channel" },
469 { 20, "v34-CC-retrain" },
470 { 21, "v33-12000-training" },
471 { 22, "v33-14400-training" },
477 dissect_t38_T30_indicator(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
478 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
479 16, &T30ind_value, TRUE, 7, NULL);
482 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
483 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
484 val_to_str(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
489 t38_info->t30ind_value = T30ind_value;
495 const value_string t38_T30_data_vals[] = {
506 { 10, "v34-pri-rate" },
507 { 11, "v34-CC-1200" },
508 { 12, "v34-pri-ch" },
516 dissect_t38_T30_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
517 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
518 9, &Data_value, TRUE, 6, NULL);
521 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
522 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
523 val_to_str(Data_value,t38_T30_data_vals,"<unknown>"));
529 t38_info->data_value = Data_value;
535 static const value_string t38_Type_of_msg_vals[] = {
536 { 0, "t30-indicator" },
541 static const per_choice_t Type_of_msg_choice[] = {
542 { 0, &hf_t38_t30_indicator , ASN1_NO_EXTENSIONS , dissect_t38_T30_indicator },
543 { 1, &hf_t38_t30_data , ASN1_NO_EXTENSIONS , dissect_t38_T30_data },
548 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_) {
549 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
550 ett_t38_Type_of_msg, Type_of_msg_choice,
556 t38_info->type_msg = Type_of_msg_value;
562 static const value_string t38_T_field_type_vals[] = {
564 { 1, "hdlc-sig-end" },
565 { 2, "hdlc-fcs-OK" },
566 { 3, "hdlc-fcs-BAD" },
567 { 4, "hdlc-fcs-OK-sig-end" },
568 { 5, "hdlc-fcs-BAD-sig-end" },
569 { 6, "t4-non-ecm-data" },
570 { 7, "t4-non-ecm-sig-end" },
573 { 10, "ci-message" },
580 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_) {
581 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
582 8, &Data_Field_field_type_value, (use_pre_corrigendum_asn1_specification)?FALSE:TRUE, (use_pre_corrigendum_asn1_specification)?0:4, NULL);
585 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
586 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
587 val_to_str(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
590 /* We only reassmeble packets in the Primary part and in the first two Items. */
591 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
592 /* using the current ressaemble functions. */
593 /* TODO: reassemble all the Items in one frame */
594 if (primary_part && (Data_Field_item_num<2)) {
595 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*/
596 fragment_data *frag_msg = NULL;
597 tvbuff_t* new_tvb = NULL;
598 gboolean save_fragmented = actx->pinfo->fragmented;
600 actx->pinfo->fragmented = TRUE;
602 /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
603 if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
604 frag_msg = fragment_add_seq(tvb, offset, actx->pinfo,
605 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
606 data_fragment_table, /* list of message fragments */
607 seq_number + Data_Field_item_num - (guint32)p_t38_packet_conv_info->reass_start_seqnum, /* fragment sequence number */
609 0, /* fragment length */
610 FALSE); /* More fragments */
611 if ( Data_Field_field_type_value == 7 ) {
612 /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
613 * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
614 * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
615 * and get some stat, like packet lost and burst number of packet lost
618 force_reassemble_seq(actx->pinfo,
619 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
620 data_fragment_table /* list of message fragments */
623 if (check_col(actx->pinfo->cinfo, COL_INFO))
624 col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
626 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
630 if (p_t38_packet_conv_info->packet_lost) {
631 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);
633 g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
636 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
637 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
639 /* Now reset fragmentation information in pinfo */
640 actx->pinfo->fragmented = save_fragmented;
642 t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
643 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 */
646 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
647 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
649 /* Now reset fragmentation information in pinfo */
650 actx->pinfo->fragmented = save_fragmented;
651 actx->pinfo->private_data = t38_info;
653 if (new_tvb) call_dissector((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree);
657 proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset),
658 "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
660 if (check_col(actx->pinfo->cinfo, COL_INFO)){
661 col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
663 actx->pinfo->fragmented = save_fragmented;
667 /* reset the reassemble ID and the start seq number if it is not HDLC data */
668 if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
669 p_t38_conv_info->reass_ID = 0;
670 p_t38_conv_info->reass_start_seqnum = -1;
672 t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
681 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_) {
683 tvbuff_t *value_tvb = NULL;
686 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
687 1, 65535, FALSE, &value_tvb);
689 value_len = tvb_length(value_tvb);
694 if (check_col(actx->pinfo->cinfo, COL_INFO) && primary_part){
696 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
697 tvb_bytes_to_str(value_tvb,0,value_len));
700 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
701 tvb_bytes_to_str(value_tvb,0,7));
705 /* We only reassmeble packets in the Primary part and in the first two Items. */
706 /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
707 /* using the current ressaemble functions. */
708 /* TODO: reassemble all the Items in one frame */
709 if (primary_part && (Data_Field_item_num<2)) {
710 tvbuff_t* new_tvb = NULL;
711 fragment_data *frag_msg = NULL;
713 /* HDLC Data or t4-non-ecm-data */
714 if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
715 gboolean save_fragmented = actx->pinfo->fragmented;
717 actx->pinfo->fragmented = TRUE;
719 /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
720 if (p_t38_packet_conv && p_t38_conv && (p_t38_packet_conv_info->reass_ID == 0)) {
721 /* we use the first fragment's frame_number as fragment ID because the protocol doesn't provide it */
722 p_t38_conv_info->reass_ID = actx->pinfo->fd->num;
723 p_t38_conv_info->reass_start_seqnum = seq_number;
724 p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->fd->rel_ts);
725 p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
726 p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
727 p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
730 frag_msg = fragment_add_seq(value_tvb, 0, actx->pinfo,
731 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
732 data_fragment_table, /* list of message fragments */
733 seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum, /* fragment sequence number */
734 value_len, /* fragment length */
735 TRUE); /* More fragments */
737 new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
738 "Reassembled Message", frag_msg, &data_frag_items, NULL, tree);
740 if (!frag_msg) { /* Not last packet of reassembled */
741 if (Data_Field_field_type_value == 0) {
742 if (check_col(actx->pinfo->cinfo, COL_INFO))
743 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (HDLC fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
745 if (check_col(actx->pinfo->cinfo, COL_INFO))
746 col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
750 /* Now reset fragmentation information in pinfo */
751 actx->pinfo->fragmented = save_fragmented;
759 static const per_sequence_t Data_Field_item_sequence[] = {
760 { &hf_t38_field_type , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_field_type },
761 { &hf_t38_field_data , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_T_field_data },
766 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_) {
767 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
768 ett_t38_Data_Field_item, Data_Field_item_sequence);
771 if (primary_part) Data_Field_item_num++;
777 static const per_sequence_t Data_Field_sequence_of[1] = {
778 { &hf_t38_Data_Field_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Data_Field_item },
782 dissect_t38_Data_Field(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
783 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
784 ett_t38_Data_Field, Data_Field_sequence_of);
790 static const per_sequence_t IFPPacket_sequence[] = {
791 { &hf_t38_type_of_msg , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_Type_of_msg },
792 { &hf_t38_data_field , ASN1_NO_EXTENSIONS , ASN1_OPTIONAL , dissect_t38_Data_Field },
797 dissect_t38_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
798 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
799 ett_t38_IFPPacket, IFPPacket_sequence);
807 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_) {
808 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
809 0U, 65535U, &seq_number, FALSE);
814 t38_info->seq_num = seq_number;
816 if (check_col(actx->pinfo->cinfo, COL_INFO)){
817 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
826 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_) {
830 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
833 /* if is a valid t38 packet, add to tap */
834 if (p_t38_packet_conv && (!actx->pinfo->in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum))
835 tap_queue_packet(t38_tap, actx->pinfo, t38_info);
837 if (p_t38_conv) p_t38_conv_info->last_seqnum = (gint32) seq_number;
845 dissect_t38_OpenType_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
846 offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket);
852 static const per_sequence_t T_secondary_ifp_packets_sequence_of[1] = {
853 { &hf_t38_secondary_ifp_packets_item, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OpenType_IFPPacket },
857 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_) {
858 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
859 ett_t38_T_secondary_ifp_packets, T_secondary_ifp_packets_sequence_of);
867 dissect_t38_INTEGER(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
868 offset = dissect_per_integer(tvb, offset, actx, tree, hf_index, NULL);
876 dissect_t38_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
877 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
878 NO_BOUND, NO_BOUND, FALSE, NULL);
884 static const per_sequence_t T_fec_data_sequence_of[1] = {
885 { &hf_t38_fec_data_item , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_OCTET_STRING },
889 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_) {
890 offset = dissect_per_sequence_of(tvb, offset, actx, tree, hf_index,
891 ett_t38_T_fec_data, T_fec_data_sequence_of);
897 static const per_sequence_t T_fec_info_sequence[] = {
898 { &hf_t38_fec_npackets , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_INTEGER },
899 { &hf_t38_fec_data , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_fec_data },
904 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_) {
905 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
906 ett_t38_T_fec_info, T_fec_info_sequence);
912 static const value_string t38_T_error_recovery_vals[] = {
913 { 0, "secondary-ifp-packets" },
918 static const per_choice_t T_error_recovery_choice[] = {
919 { 0, &hf_t38_secondary_ifp_packets, ASN1_NO_EXTENSIONS , dissect_t38_T_secondary_ifp_packets },
920 { 1, &hf_t38_fec_info , ASN1_NO_EXTENSIONS , dissect_t38_T_fec_info },
925 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_) {
927 primary_part = FALSE;
929 offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
930 ett_t38_T_error_recovery, T_error_recovery_choice,
940 static const per_sequence_t UDPTLPacket_sequence[] = {
941 { &hf_t38_seq_number , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_seq_number },
942 { &hf_t38_primary_ifp_packet, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_primary_ifp_packet },
943 { &hf_t38_error_recovery , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t38_T_error_recovery },
948 dissect_t38_UDPTLPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
950 /* Initialize to something else than data type */
951 Data_Field_field_type_value = 1;
953 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
954 ett_t38_UDPTLPacket, UDPTLPacket_sequence);
961 static int dissect_IFPPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
964 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
965 offset = dissect_t38_IFPPacket(tvb, offset, &asn1_ctx, tree, hf_t38_IFPPacket_PDU);
966 offset += 7; offset >>= 3;
969 static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
972 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
973 offset = dissect_t38_UDPTLPacket(tvb, offset, &asn1_ctx, tree, hf_t38_UDPTLPacket_PDU);
974 offset += 7; offset >>= 3;
979 /*--- End of included file: packet-t38-fn.c ---*/
980 #line 400 "packet-t38-template.c"
982 /* initialize the tap t38_info and the conversation */
984 init_t38_info_conv(packet_info *pinfo)
988 if (t38_info_current==MAX_T38_MESSAGES_IN_PACKET) {
991 t38_info = &t38_info_arr[t38_info_current];
993 t38_info->seq_num = 0;
994 t38_info->type_msg = 0;
995 t38_info->data_value = 0;
996 t38_info->t30ind_value =0;
997 t38_info->setup_frame_number = 0;
998 t38_info->Data_Field_field_type_value = 0;
999 t38_info->desc[0] = '\0';
1000 t38_info->desc_comment[0] = '\0';
1001 t38_info->time_first_t4_data = 0;
1002 t38_info->frame_num_first_t4_data = 0;
1006 p_t38_packet_conv hold the conversation info in each of the packets.
1007 p_t38_conv hold the conversation info used to reassemble the HDLC packets, and also the Setup info (e.g SDP)
1008 If we already have p_t38_packet_conv in the packet, it means we already reassembled the HDLC packets, so we don't
1009 need to use p_t38_conv
1011 p_t38_packet_conv = NULL;
1014 /* Use existing packet info if available */
1015 p_t38_packet_conv = p_get_proto_data(pinfo->fd, proto_t38);
1018 /* find the conversation used for Reassemble and Setup Info */
1019 p_conv = find_conversation(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
1021 pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
1023 /* create a conv if it doen't exist */
1025 p_conv = conversation_new(pinfo->fd->num, &pinfo->net_src, &pinfo->net_dst,
1026 pinfo->ptype, pinfo->srcport, pinfo->destport, NO_ADDR_B | NO_PORT_B);
1029 conversation_set_dissector(p_conv, t38_udp_handle);
1032 if (!p_t38_packet_conv) {
1033 p_t38_conv = conversation_get_proto_data(p_conv, proto_t38);
1035 /* create the conversation if it doen't exist */
1037 p_t38_conv = se_alloc(sizeof(t38_conv));
1038 p_t38_conv->setup_method[0] = '\0';
1039 p_t38_conv->setup_frame_number = 0;
1041 p_t38_conv->src_t38_info.reass_ID = 0;
1042 p_t38_conv->src_t38_info.reass_start_seqnum = -1;
1043 p_t38_conv->src_t38_info.reass_data_type = 0;
1044 p_t38_conv->src_t38_info.last_seqnum = -1;
1045 p_t38_conv->src_t38_info.packet_lost = 0;
1046 p_t38_conv->src_t38_info.burst_lost = 0;
1047 p_t38_conv->src_t38_info.time_first_t4_data = 0;
1049 p_t38_conv->dst_t38_info.reass_ID = 0;
1050 p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
1051 p_t38_conv->dst_t38_info.reass_data_type = 0;
1052 p_t38_conv->dst_t38_info.last_seqnum = -1;
1053 p_t38_conv->dst_t38_info.packet_lost = 0;
1054 p_t38_conv->dst_t38_info.burst_lost = 0;
1055 p_t38_conv->dst_t38_info.time_first_t4_data = 0;
1057 conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
1060 /* copy the t38 conversation info to the packet t38 conversation */
1061 p_t38_packet_conv = se_alloc(sizeof(t38_conv));
1062 strncpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);
1063 p_t38_packet_conv->setup_method[MAX_T38_SETUP_METHOD_SIZE] = '\0';
1064 p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number;
1066 memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info));
1067 memcpy(&(p_t38_packet_conv->dst_t38_info), &(p_t38_conv->dst_t38_info), sizeof(t38_conv_info));
1069 p_add_proto_data(pinfo->fd, proto_t38, p_t38_packet_conv);
1072 if (ADDRESSES_EQUAL(&p_conv->key_ptr->addr1, &pinfo->net_src)) {
1073 p_t38_conv_info = &(p_t38_conv->src_t38_info);
1074 p_t38_packet_conv_info = &(p_t38_packet_conv->src_t38_info);
1076 p_t38_conv_info = &(p_t38_conv->dst_t38_info);
1077 p_t38_packet_conv_info = &(p_t38_packet_conv->dst_t38_info);
1080 /* update t38_info */
1081 t38_info->setup_frame_number = p_t38_packet_conv->setup_frame_number;
1084 /* Entry point for dissection */
1086 dissect_t38_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1094 * XXX - heuristic to check for misidentified packets.
1096 if (dissect_possible_rtpv2_packets_as_rtp){
1097 octet1 = tvb_get_guint8(tvb, offset);
1098 if (RTP_VERSION(octet1) == 2){
1099 call_dissector(rtp_handle,tvb,pinfo,tree);
1104 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
1105 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1107 if (check_col(pinfo->cinfo, COL_INFO)){
1108 col_clear(pinfo->cinfo, COL_INFO);
1111 primary_part = TRUE;
1113 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1114 Data_Field_item_num = 0;
1116 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1117 tr=proto_item_add_subtree(it, ett_t38);
1119 /* init tap and conv info */
1120 init_t38_info_conv(pinfo);
1122 /* Show Conversation setup info if exists*/
1123 if (global_t38_show_setup_info) {
1124 show_setup_info(tvb, tr, p_t38_packet_conv);
1127 if (check_col(pinfo->cinfo, COL_INFO)){
1128 col_append_str(pinfo->cinfo, COL_INFO, "UDP: UDPTLPacket ");
1131 offset = dissect_UDPTLPacket_PDU(tvb, pinfo, tr);
1133 if (tvb_length_remaining(tvb,offset)>0){
1135 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1136 "[MALFORMED PACKET or wrong preference settings]");
1138 if (check_col(pinfo->cinfo, COL_INFO)){
1139 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1145 dissect_t38_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1151 guint16 ifp_packet_number=1;
1153 if (check_col(pinfo->cinfo, COL_PROTOCOL)){
1154 col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.38");
1156 if (check_col(pinfo->cinfo, COL_INFO)){
1157 col_clear(pinfo->cinfo, COL_INFO);
1160 primary_part = TRUE;
1162 /* This indicate the item number in the primary part of the T38 message, it is used for the reassemble of T30 packets */
1163 Data_Field_item_num = 0;
1165 it=proto_tree_add_protocol_format(tree, proto_t38, tvb, 0, -1, "ITU-T Recommendation T.38");
1166 tr=proto_item_add_subtree(it, ett_t38);
1168 /* init tap and conv info */
1169 init_t38_info_conv(pinfo);
1171 /* Show Conversation setup info if exists*/
1172 if (global_t38_show_setup_info) {
1173 show_setup_info(tvb, tr, p_t38_packet_conv);
1176 if (check_col(pinfo->cinfo, COL_INFO)){
1177 col_append_str(pinfo->cinfo, COL_INFO, "TCP: IFPPacket");
1180 while(tvb_length_remaining(tvb,offset)>0)
1182 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
1183 offset += dissect_IFPPacket_PDU(next_tvb, pinfo, tr);
1184 ifp_packet_number++;
1186 if(tvb_length_remaining(tvb,offset)>0){
1187 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1189 proto_tree_add_text(tr, tvb, offset, tvb_reported_length_remaining(tvb, offset),
1190 "[MALFORMED PACKET or wrong preference settings]");
1192 if (check_col(pinfo->cinfo, COL_INFO)){
1193 col_append_str(pinfo->cinfo, COL_INFO, " [Malformed?]");
1198 if (check_col(pinfo->cinfo, COL_INFO)){
1199 col_append_fstr(pinfo->cinfo, COL_INFO, " IFPPacket#%u",ifp_packet_number);
1208 dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1210 primary_part = TRUE;
1212 if(t38_tpkt_usage == T38_TPKT_ALWAYS){
1213 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1215 else if((t38_tpkt_usage == T38_TPKT_NEVER) || (is_tpkt(tvb,1) == -1)){
1216 dissect_t38_tcp_pdu(tvb, pinfo, tree);
1219 dissect_tpkt_encap(tvb,pinfo,tree,t38_tpkt_reassembly,t38_tcp_pdu_handle);
1224 dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1226 if(pinfo->ipproto == IP_PROTO_TCP)
1228 dissect_t38_tcp(tvb, pinfo, tree);
1230 else if(pinfo->ipproto == IP_PROTO_UDP)
1232 dissect_t38_udp(tvb, pinfo, tree);
1236 /* Look for conversation info and display any setup info found */
1238 show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conv)
1240 proto_tree *t38_setup_tree;
1243 if (!p_t38_conv || p_t38_conv->setup_frame_number == 0) {
1244 /* there is no Setup info */
1248 ti = proto_tree_add_string_format(tree, hf_t38_setup, tvb, 0, 0,
1250 "Stream setup by %s (frame %u)",
1251 p_t38_conv->setup_method,
1252 p_t38_conv->setup_frame_number);
1253 PROTO_ITEM_SET_GENERATED(ti);
1254 t38_setup_tree = proto_item_add_subtree(ti, ett_t38_setup);
1257 /* Add details into subtree */
1258 proto_item* item = proto_tree_add_uint(t38_setup_tree, hf_t38_setup_frame,
1259 tvb, 0, 0, p_t38_conv->setup_frame_number);
1260 PROTO_ITEM_SET_GENERATED(item);
1261 item = proto_tree_add_string(t38_setup_tree, hf_t38_setup_method,
1262 tvb, 0, 0, p_t38_conv->setup_method);
1263 PROTO_ITEM_SET_GENERATED(item);
1269 /* Wireshark Protocol Registration */
1271 proto_register_t38(void)
1273 static hf_register_info hf[] =
1276 /*--- Included file: packet-t38-hfarr.c ---*/
1277 #line 1 "packet-t38-hfarr.c"
1278 { &hf_t38_IFPPacket_PDU,
1279 { "IFPPacket", "t38.IFPPacket",
1280 FT_NONE, BASE_NONE, NULL, 0,
1281 "t38.IFPPacket", HFILL }},
1282 { &hf_t38_UDPTLPacket_PDU,
1283 { "UDPTLPacket", "t38.UDPTLPacket",
1284 FT_NONE, BASE_NONE, NULL, 0,
1285 "t38.UDPTLPacket", HFILL }},
1286 { &hf_t38_type_of_msg,
1287 { "type-of-msg", "t38.type_of_msg",
1288 FT_UINT32, BASE_DEC, VALS(t38_Type_of_msg_vals), 0,
1289 "t38.Type_of_msg", HFILL }},
1290 { &hf_t38_data_field,
1291 { "data-field", "t38.data_field",
1292 FT_UINT32, BASE_DEC, NULL, 0,
1293 "t38.Data_Field", HFILL }},
1294 { &hf_t38_t30_indicator,
1295 { "t30-indicator", "t38.t30_indicator",
1296 FT_UINT32, BASE_DEC, VALS(t38_T30_indicator_vals), 0,
1297 "t38.T30_indicator", HFILL }},
1299 { "t30-data", "t38.t30_data",
1300 FT_UINT32, BASE_DEC, VALS(t38_T30_data_vals), 0,
1301 "t38.T30_data", HFILL }},
1302 { &hf_t38_Data_Field_item,
1303 { "Item", "t38.Data_Field_item",
1304 FT_NONE, BASE_NONE, NULL, 0,
1305 "t38.Data_Field_item", HFILL }},
1306 { &hf_t38_field_type,
1307 { "field-type", "t38.field_type",
1308 FT_UINT32, BASE_DEC, VALS(t38_T_field_type_vals), 0,
1309 "t38.T_field_type", HFILL }},
1310 { &hf_t38_field_data,
1311 { "field-data", "t38.field_data",
1312 FT_BYTES, BASE_HEX, NULL, 0,
1313 "t38.T_field_data", HFILL }},
1314 { &hf_t38_seq_number,
1315 { "seq-number", "t38.seq_number",
1316 FT_UINT32, BASE_DEC, NULL, 0,
1317 "t38.T_seq_number", HFILL }},
1318 { &hf_t38_primary_ifp_packet,
1319 { "primary-ifp-packet", "t38.primary_ifp_packet",
1320 FT_NONE, BASE_NONE, NULL, 0,
1321 "t38.T_primary_ifp_packet", HFILL }},
1322 { &hf_t38_error_recovery,
1323 { "error-recovery", "t38.error_recovery",
1324 FT_UINT32, BASE_DEC, VALS(t38_T_error_recovery_vals), 0,
1325 "t38.T_error_recovery", HFILL }},
1326 { &hf_t38_secondary_ifp_packets,
1327 { "secondary-ifp-packets", "t38.secondary_ifp_packets",
1328 FT_UINT32, BASE_DEC, NULL, 0,
1329 "t38.T_secondary_ifp_packets", HFILL }},
1330 { &hf_t38_secondary_ifp_packets_item,
1331 { "Item", "t38.secondary_ifp_packets_item",
1332 FT_NONE, BASE_NONE, NULL, 0,
1333 "t38.OpenType_IFPPacket", HFILL }},
1335 { "fec-info", "t38.fec_info",
1336 FT_NONE, BASE_NONE, NULL, 0,
1337 "t38.T_fec_info", HFILL }},
1338 { &hf_t38_fec_npackets,
1339 { "fec-npackets", "t38.fec_npackets",
1340 FT_INT32, BASE_DEC, NULL, 0,
1341 "t38.INTEGER", HFILL }},
1343 { "fec-data", "t38.fec_data",
1344 FT_UINT32, BASE_DEC, NULL, 0,
1345 "t38.T_fec_data", HFILL }},
1346 { &hf_t38_fec_data_item,
1347 { "Item", "t38.fec_data_item",
1348 FT_BYTES, BASE_HEX, NULL, 0,
1349 "t38.OCTET_STRING", HFILL }},
1351 /*--- End of included file: packet-t38-hfarr.c ---*/
1352 #line 695 "packet-t38-template.c"
1354 { "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
1355 NULL, 0x0, "Stream setup, method and frame number", HFILL }},
1356 { &hf_t38_setup_frame,
1357 { "Stream frame", "t38.setup-frame", FT_FRAMENUM, BASE_NONE,
1358 NULL, 0x0, "Frame that set up this stream", HFILL }},
1359 { &hf_t38_setup_method,
1360 { "Stream Method", "t38.setup-method", FT_STRING, BASE_NONE,
1361 NULL, 0x0, "Method used to set up this stream", HFILL }},
1362 {&hf_data_fragments,
1363 {"Message fragments", "data.fragments",
1364 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1366 {"Message fragment", "data.fragment",
1367 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1368 {&hf_data_fragment_overlap,
1369 {"Message fragment overlap", "data.fragment.overlap",
1370 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1371 {&hf_data_fragment_overlap_conflicts,
1372 {"Message fragment overlapping with conflicting data",
1373 "data.fragment.overlap.conflicts",
1374 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1375 {&hf_data_fragment_multiple_tails,
1376 {"Message has multiple tail fragments",
1377 "data.fragment.multiple_tails",
1378 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1379 {&hf_data_fragment_too_long_fragment,
1380 {"Message fragment too long", "data.fragment.too_long_fragment",
1381 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1382 {&hf_data_fragment_error,
1383 {"Message defragmentation error", "data.fragment.error",
1384 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1385 {&hf_data_reassembled_in,
1386 {"Reassembled in", "data.reassembled.in",
1387 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
1390 static gint *ett[] =
1394 /*--- Included file: packet-t38-ettarr.c ---*/
1395 #line 1 "packet-t38-ettarr.c"
1397 &ett_t38_Type_of_msg,
1398 &ett_t38_Data_Field,
1399 &ett_t38_Data_Field_item,
1400 &ett_t38_UDPTLPacket,
1401 &ett_t38_T_error_recovery,
1402 &ett_t38_T_secondary_ifp_packets,
1403 &ett_t38_T_fec_info,
1404 &ett_t38_T_fec_data,
1406 /*--- End of included file: packet-t38-ettarr.c ---*/
1407 #line 736 "packet-t38-template.c"
1413 module_t *t38_module;
1415 proto_t38 = proto_register_protocol("T.38", "T.38", "t38");
1416 proto_register_field_array(proto_t38, hf, array_length(hf));
1417 proto_register_subtree_array(ett, array_length(ett));
1418 register_dissector("t38", dissect_t38, proto_t38);
1420 /* Init reassemble tables for HDLC */
1421 register_init_routine(t38_defragment_init);
1423 t38_tap = register_tap("t38");
1425 t38_module = prefs_register_protocol(proto_t38, proto_reg_handoff_t38);
1426 prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
1427 "Use the Pre-Corrigendum ASN.1 specification",
1428 "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
1429 "ASN.1 specification (1998).",
1430 &use_pre_corrigendum_asn1_specification);
1431 prefs_register_bool_preference(t38_module, "dissect_possible_rtpv2_packets_as_rtp",
1432 "Dissect possible RTP version 2 packets with RTP dissector",
1433 "Whether a UDP packet that looks like RTP version 2 packet will "
1434 "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
1435 "packets with sequence number higher than 32767 may be dissected as RTP.",
1436 &dissect_possible_rtpv2_packets_as_rtp);
1437 prefs_register_uint_preference(t38_module, "tcp.port",
1439 "Set the TCP port for T.38 messages",
1440 10, &global_t38_tcp_port);
1441 prefs_register_uint_preference(t38_module, "udp.port",
1443 "Set the UDP port for T.38 messages",
1444 10, &global_t38_udp_port);
1445 prefs_register_bool_preference(t38_module, "reassembly",
1446 "Reassemble T.38 PDUs over TPKT over TCP",
1447 "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments "
1448 "when TPKT is used over TCP. "
1449 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
1450 &t38_tpkt_reassembly);
1451 prefs_register_enum_preference(t38_module, "tpkt_usage",
1452 "TPKT used over TCP",
1453 "Whether T.38 is used with TPKT for TCP",
1454 (gint *)&t38_tpkt_usage,t38_tpkt_options,FALSE);
1456 prefs_register_bool_preference(t38_module, "show_setup_info",
1457 "Show stream setup information",
1458 "Where available, show which protocol and frame caused "
1459 "this T.38 stream to be created",
1460 &global_t38_show_setup_info);
1465 proto_reg_handoff_t38(void)
1467 static int t38_prefs_initialized = FALSE;
1469 if (!t38_prefs_initialized) {
1470 t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
1471 t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
1472 t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
1473 t38_prefs_initialized = TRUE;
1476 dissector_delete("tcp.port", tcp_port, t38_tcp_handle);
1477 dissector_delete("udp.port", udp_port, t38_udp_handle);
1479 tcp_port = global_t38_tcp_port;
1480 udp_port = global_t38_udp_port;
1482 dissector_add("tcp.port", tcp_port, t38_tcp_handle);
1483 dissector_add("udp.port", udp_port, t38_udp_handle);
1485 rtp_handle = find_dissector("rtp");
1486 t30_hdlc_handle = find_dissector("t30.hdlc");
1487 data_handle = find_dissector("data");