aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/t38/t38.cnf
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/asn1/t38/t38.cnf')
-rw-r--r--epan/dissectors/asn1/t38/t38.cnf261
1 files changed, 261 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/t38/t38.cnf b/epan/dissectors/asn1/t38/t38.cnf
new file mode 100644
index 0000000000..db61672b71
--- /dev/null
+++ b/epan/dissectors/asn1/t38/t38.cnf
@@ -0,0 +1,261 @@
+# t38.cnf
+# T.38 conformation file
+# 2007 Tomas Kukosa
+
+#.EXPORTS ONLY_VALS WS_DLL
+Type-of-msg/t30-indicator
+Type-of-msg/t30-data
+#.END
+
+#.TYPE_RENAME
+Type-of-msg/t30-indicator T30_indicator
+Type-of-msg/t30-data T30_data
+#.END
+
+#.PDU
+IFPPacket
+UDPTLPacket
+#.END
+
+#.FN_PARS Type-of-msg VAL_PTR=&Type_of_msg_value
+#.FN_FTR Type-of-msg
+ /* info for tap */
+ if (primary_part)
+ t38_info->type_msg = Type_of_msg_value;
+#.END
+
+#.FN_PARS Type-of-msg/t30-indicator VAL_PTR=&T30ind_value
+#.FN_FTR Type-of-msg/t30-indicator
+ if (primary_part){
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
+ val_to_str(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
+ }
+
+ /* info for tap */
+ if (primary_part)
+ t38_info->t30ind_value = T30ind_value;
+#.END
+
+#.FN_PARS Type-of-msg/t30-data VAL_PTR=&Data_value
+#.FN_FTR Type-of-msg/t30-data
+ if (primary_part){
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
+ val_to_str(Data_value,t38_T30_data_vals,"<unknown>"));
+ }
+
+
+ /* info for tap */
+ if (primary_part)
+ t38_info->data_value = Data_value;
+#.END
+
+#.FN_FTR Data-Field/_item
+ if (primary_part) Data_Field_item_num++;
+#.END
+
+#.FN_PARS Data-Field/_item/field-type
+EXT=(use_pre_corrigendum_asn1_specification)?FALSE:TRUE
+EXT_NUM=(use_pre_corrigendum_asn1_specification)?0:4
+VAL_PTR=&Data_Field_field_type_value
+#.FN_FTR Data-Field/_item/field-type
+ if (primary_part){
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
+ val_to_str(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
+ }
+
+ /* We only reassmeble packets in the Primary part and in the first two Items. */
+ /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
+ /* using the current ressaemble functions. */
+ /* TODO: reassemble all the Items in one frame */
+ if (primary_part && (Data_Field_item_num<2)) {
+ 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*/
+ fragment_head *frag_msg = NULL;
+ tvbuff_t* new_tvb = NULL;
+ gboolean save_fragmented = actx->pinfo->fragmented;
+
+ actx->pinfo->fragmented = TRUE;
+
+ /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
+ if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
+ frag_msg = fragment_add_seq(&data_reassembly_table, /* reassembly table */
+ tvb, offset, actx->pinfo,
+ p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
+ NULL,
+ seq_number + Data_Field_item_num - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */
+ /*0,*/
+ 0, /* fragment length */
+ FALSE, /* More fragments */
+ 0);
+ if ( Data_Field_field_type_value == 7 ) {
+ /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
+ * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
+ * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
+ * and get some stat, like packet lost and burst number of packet lost
+ */
+ if (!frag_msg) {
+ force_reassemble_seq(&data_reassembly_table, /* reassembly table */
+ actx->pinfo,
+ p_t38_packet_conv_info->reass_ID /* ID for fragments belonging together */
+ );
+ } else {
+ col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
+
+ g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
+ }
+
+
+ if (p_t38_packet_conv_info->packet_lost) {
+ 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);
+ } else {
+ g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
+ }
+
+ process_reassembled_data(tvb, offset, actx->pinfo,
+ "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
+
+ /* Now reset fragmentation information in pinfo */
+ actx->pinfo->fragmented = save_fragmented;
+
+ t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
+ 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 */
+
+ } else {
+ new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
+ "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
+
+ /* Now reset fragmentation information in pinfo */
+ actx->pinfo->fragmented = save_fragmented;
+
+ if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info);
+ }
+ } else {
+ proto_tree_add_expert_format(tree, actx->pinfo, &ei_t38_malformed, tvb, offset, tvb_reported_length_remaining(tvb, offset),
+ "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
+ col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
+ actx->pinfo->fragmented = save_fragmented;
+ }
+ }
+
+ /* reset the reassemble ID and the start seq number if it is not HDLC data */
+ if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
+ p_t38_conv_info->reass_ID = 0;
+ p_t38_conv_info->reass_start_seqnum = -1;
+ p_t38_conv_info->additional_hdlc_data_field_counter = 0;
+ p_t38_conv_info->seqnum_prev_data_field = -1;
+ }
+ t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
+ }
+#.END
+
+#.FN_BODY Data-Field/_item/field-data VAL_PTR=&value_tvb
+ tvbuff_t *value_tvb = NULL;
+ guint32 value_len;
+
+%(DEFAULT_BODY)s
+ value_len = tvb_reported_length(value_tvb);
+
+#.FN_FTR Data-Field/_item/field-data
+ if (primary_part){
+ if(value_len < 8){
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
+ tvb_bytes_to_str(wmem_packet_scope(), value_tvb,0,value_len));
+ }
+ else {
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
+ tvb_bytes_to_str(wmem_packet_scope(), value_tvb,0,7));
+ }
+ }
+
+ /* We only reassmeble packets in the Primary part and in the first two Items. */
+ /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy */
+ /* using the current ressaemble functions. */
+ /* TODO: reassemble all the Items in one frame */
+ if (primary_part && (Data_Field_item_num<2)) {
+ fragment_head *frag_msg = NULL;
+
+ /* HDLC Data or t4-non-ecm-data */
+ if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
+ gboolean save_fragmented = actx->pinfo->fragmented;
+
+ actx->pinfo->fragmented = TRUE;
+
+ /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
+ if (p_t38_packet_conv && p_t38_conv && (p_t38_packet_conv_info->reass_ID == 0)) {
+ /* we use the first fragment's frame_number as fragment ID because the protocol doesn't provide it */
+ p_t38_conv_info->reass_ID = actx->pinfo->num;
+ p_t38_conv_info->reass_start_seqnum = seq_number;
+ p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->rel_ts);
+ p_t38_conv_info->additional_hdlc_data_field_counter = 0;
+ p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
+ p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
+ p_t38_packet_conv_info->seqnum_prev_data_field = p_t38_conv_info->seqnum_prev_data_field;
+ p_t38_packet_conv_info->additional_hdlc_data_field_counter = p_t38_conv_info->additional_hdlc_data_field_counter;
+ p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
+ }
+ if (seq_number == (guint32)p_t38_packet_conv_info->seqnum_prev_data_field){
+ p_t38_packet_conv_info->additional_hdlc_data_field_counter ++;
+ if(p_t38_conv){
+ p_t38_conv_info->additional_hdlc_data_field_counter = p_t38_packet_conv_info->additional_hdlc_data_field_counter;
+ }
+ }
+ frag_msg = fragment_add_seq(&data_reassembly_table,
+ value_tvb, 0,
+ actx->pinfo,
+ p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
+ NULL,
+ seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter, /* fragment sequence number */
+ value_len, /* fragment length */
+ TRUE, /* More fragments */
+ 0);
+ p_t38_packet_conv_info->seqnum_prev_data_field = (gint32)seq_number;
+ process_reassembled_data(tvb, offset, actx->pinfo,
+ "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
+
+ if (!frag_msg) { /* Not last packet of reassembled */
+ if (Data_Field_field_type_value == 0) {
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO," (HDLC fragment %u)",
+ seq_number + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter
+ - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
+ } else {
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
+ }
+ }
+
+ /* Now reset fragmentation information in pinfo */
+ actx->pinfo->fragmented = save_fragmented;
+ }
+ }
+#.END
+
+
+#.FN_HDR UDPTLPacket
+ /* Initialize to something else than data type */
+ Data_Field_field_type_value = 1;
+#.END
+
+#.FN_PARS UDPTLPacket/seq-number VAL_PTR=&seq_number
+#.FN_FTR UDPTLPacket/seq-number
+ /* info for tap */
+ if (primary_part)
+ t38_info->seq_num = seq_number;
+
+ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
+#.END
+
+#.FN_HDR UDPTLPacket/primary-ifp-packet
+ primary_part = TRUE;
+#.FN_FTR UDPTLPacket/primary-ifp-packet
+ /* if is a valid t38 packet, add to tap */
+ /* Note that t4-non-ecm-sig-end without first_t4_data is not valid */
+ if (p_t38_packet_conv && (!actx->pinfo->flags.in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum) &&
+ !(t38_info->type_msg == 1 && t38_info->Data_Field_field_type_value == 7 && t38_info->frame_num_first_t4_data == 0))
+ tap_queue_packet(t38_tap, actx->pinfo, t38_info);
+
+ if (p_t38_conv) p_t38_conv_info->last_seqnum = (gint32) seq_number;
+#.END
+
+#.FN_HDR UDPTLPacket/error-recovery
+ primary_part = FALSE;
+#.FN_FTR UDPTLPacket/error-recovery
+ primary_part = TRUE;
+#.END