MSWSP: use GuidPropertySet_find_guid() in parse_CFullPropSpec()
[wireshark-wip.git] / asn1 / t38 / t38.cnf
blob67585a1697ebc9837fbf5a873e8cbd8c7849227e
1 # t38.cnf
2 # T.38 conformation file
3 # 2007  Tomas Kukosa
5 # $Id$
7 #.EXPORTS ONLY_VALS WS_DLL
8 Type-of-msg/t30-indicator
9 Type-of-msg/t30-data
10 #.END
12 #.TYPE_RENAME
13 Type-of-msg/t30-indicator  T30_indicator
14 Type-of-msg/t30-data       T30_data
15 #.END
17 #.PDU_NEW
18 IFPPacket
19 UDPTLPacket
20 #.END
22 #.FN_PARS Type-of-msg  VAL_PTR=&Type_of_msg_value
23 #.FN_FTR Type-of-msg
24   /* info for tap */
25   if (primary_part)
26     t38_info->type_msg = Type_of_msg_value;
27 #.END
29 #.FN_PARS Type-of-msg/t30-indicator  VAL_PTR=&T30ind_value
30 #.FN_FTR Type-of-msg/t30-indicator
31     if (primary_part){
32         col_append_fstr(actx->pinfo->cinfo, COL_INFO, " t30ind: %s",
33          val_to_str(T30ind_value,t38_T30_indicator_vals,"<unknown>"));
34     }
36     /* info for tap */
37     if (primary_part)
38         t38_info->t30ind_value = T30ind_value;
39 #.END
41 #.FN_PARS Type-of-msg/t30-data  VAL_PTR=&Data_value
42 #.FN_FTR Type-of-msg/t30-data
43     if (primary_part){
44         col_append_fstr(actx->pinfo->cinfo, COL_INFO, " data:%s:",
45          val_to_str(Data_value,t38_T30_data_vals,"<unknown>"));
46     }
49     /* info for tap */
50     if (primary_part)
51         t38_info->data_value = Data_value;
52 #.END
54 #.FN_FTR Data-Field/_item
55     if (primary_part) Data_Field_item_num++;
56 #.END
58 #.FN_PARS Data-Field/_item/field-type
59 EXT=(use_pre_corrigendum_asn1_specification)?FALSE:TRUE
60 EXT_NUM=(use_pre_corrigendum_asn1_specification)?0:4
61 VAL_PTR=&Data_Field_field_type_value
62 #.FN_FTR Data-Field/_item/field-type
63     if (primary_part){
64         col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s",
65          val_to_str(Data_Field_field_type_value,t38_T_field_type_vals,"<unknown>"));
66     }
68     /* We only reassmeble packets in the Primary part and in the first two Items.                       */
69     /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy    */
70     /* using the current ressaemble functions.                                                          */
71     /* TODO: reassemble all the Items in one frame */
72     if (primary_part && (Data_Field_item_num<2)) {
73         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*/
74             fragment_head *frag_msg = NULL;
75             tvbuff_t* new_tvb = NULL;
76             gboolean save_fragmented = actx->pinfo->fragmented;
78             actx->pinfo->fragmented = TRUE;
80             /* if reass_start_seqnum=-1 it means we have received the end of the fragmente, without received any fragment data */
81             if (p_t38_packet_conv_info->reass_start_seqnum != -1) {
82                 frag_msg = fragment_add_seq(&data_reassembly_table, /* reassembly table */
83                     tvb, offset, actx->pinfo,
84                     p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
85                     NULL,
86                     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 */
87                     /*0,*/
88                     0, /* fragment length */
89                     FALSE, /* More fragments */
90                     0);
91                 if ( Data_Field_field_type_value == 7 ) {
92                     /* if there was packet lost or other errors during the defrag then frag_msg is NULL. This could also means
93                      * there are out of order packets (e.g, got the tail frame t4-non-ecm-sig-end before the last fragment),
94                      * but we will assume there was packet lost instead, which is more usual. So, we are going to reassemble the packet
95                      * and get some stat, like packet lost and burst number of packet lost
96                     */
97                     if (!frag_msg) {
98                         force_reassemble_seq(&data_reassembly_table, /* reassembly table */
99                             actx->pinfo,
100                             p_t38_packet_conv_info->reass_ID /* ID for fragments belonging together */
101                         );
102                     } else {
103                         col_append_str(actx->pinfo->cinfo, COL_INFO, " (t4-data Reassembled: No packet lost)");
105                         g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
106                     }
109                     if (p_t38_packet_conv_info->packet_lost) {
110                         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);
111                     } else {
112                         g_snprintf(t38_info->desc_comment, MAX_T38_DESC, "No packet lost");
113                     }
115                     process_reassembled_data(tvb, offset, actx->pinfo,
116                                 "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
118                     /* Now reset fragmentation information in pinfo */
119                     actx->pinfo->fragmented = save_fragmented;
121                     t38_info->time_first_t4_data = p_t38_packet_conv_info->time_first_t4_data;
122                     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 */
124                 } else {
125                     new_tvb = process_reassembled_data(tvb, offset, actx->pinfo,
126                                 "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
128                     /* Now reset fragmentation information in pinfo */
129                     actx->pinfo->fragmented = save_fragmented;
131                     if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info);
132                 }
133             } else {
134                 if(tree){
135                     proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset),
136                         "[RECEIVED END OF FRAGMENT W/OUT ANY FRAGMENT DATA]");
137                 }
138                 col_append_str(actx->pinfo->cinfo, COL_INFO, " [Malformed?]");
139                 actx->pinfo->fragmented = save_fragmented;
140             }
141         }
143         /* reset the reassemble ID and the start seq number if it is not HDLC data */
144         if ( p_t38_conv && ( ((Data_Field_field_type_value >0) && (Data_Field_field_type_value <6)) || (Data_Field_field_type_value == 7) ) ){
145             p_t38_conv_info->reass_ID = 0;
146             p_t38_conv_info->reass_start_seqnum = -1;
147             p_t38_conv_info->additional_hdlc_data_field_counter = 0;
148             p_t38_conv_info->seqnum_prev_data_field = -1;
149         }
150         t38_info->Data_Field_field_type_value = Data_Field_field_type_value;
151     }
152 #.END
154 #.FN_BODY Data-Field/_item/field-data  VAL_PTR=&value_tvb
155     tvbuff_t *value_tvb = NULL;
156     guint32 value_len;
158 %(DEFAULT_BODY)s
159     value_len = tvb_length(value_tvb);
161 #.FN_FTR Data-Field/_item/field-data
162     if (primary_part){
163         if(value_len < 8){
164             col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]",
165                tvb_bytes_to_str(value_tvb,0,value_len));
166         }
167         else {
168             col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s...]",
169                tvb_bytes_to_str(value_tvb,0,7));
170         }
171     }
173     /* We only reassmeble packets in the Primary part and in the first two Items.                       */
174     /* There maybe be t38 packets with more than two Items, but reassemble those packets is not easy    */
175     /* using the current ressaemble functions.                                                          */
176     /* TODO: reassemble all the Items in one frame */
177     if (primary_part && (Data_Field_item_num<2)) {
178         fragment_head *frag_msg = NULL;
180         /* HDLC Data or t4-non-ecm-data */
181         if (Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6) { /* 0=HDLC Data or 6=t4-non-ecm-data*/
182             gboolean save_fragmented = actx->pinfo->fragmented;
184             actx->pinfo->fragmented = TRUE;
186             /* if we have not reassembled this packet and it is the first fragment, reset the reassemble ID and the start seq number*/
187             if (p_t38_packet_conv && p_t38_conv && (p_t38_packet_conv_info->reass_ID == 0)) {
188                 /* we use the first fragment's frame_number as fragment ID because the protocol doesn't provide it */
189                     p_t38_conv_info->reass_ID = actx->pinfo->fd->num;
190                     p_t38_conv_info->reass_start_seqnum = seq_number;
191                     p_t38_conv_info->time_first_t4_data = nstime_to_sec(&actx->pinfo->rel_ts);
192                     p_t38_conv_info->additional_hdlc_data_field_counter = 0;
193                     p_t38_packet_conv_info->reass_ID = p_t38_conv_info->reass_ID;
194                     p_t38_packet_conv_info->reass_start_seqnum = p_t38_conv_info->reass_start_seqnum;
195                     p_t38_packet_conv_info->seqnum_prev_data_field = p_t38_conv_info->seqnum_prev_data_field;
196                     p_t38_packet_conv_info->additional_hdlc_data_field_counter = p_t38_conv_info->additional_hdlc_data_field_counter;
197                     p_t38_packet_conv_info->time_first_t4_data = p_t38_conv_info->time_first_t4_data;
198             }
199             if (seq_number == (guint32)p_t38_packet_conv_info->seqnum_prev_data_field){
200                    p_t38_packet_conv_info->additional_hdlc_data_field_counter ++;
201                    if(p_t38_conv){
202                      p_t38_conv_info->additional_hdlc_data_field_counter =  p_t38_packet_conv_info->additional_hdlc_data_field_counter;
203                    }
204             }
205             frag_msg = fragment_add_seq(&data_reassembly_table,
206                 value_tvb, 0,
207                 actx->pinfo,
208                 p_t38_packet_conv_info->reass_ID, /* ID for fragments belonging together */
209                 NULL,
210                 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 */
211                 value_len, /* fragment length */
212                 TRUE, /* More fragments */
213                 0);
214             p_t38_packet_conv_info->seqnum_prev_data_field = (gint32)seq_number;
215             process_reassembled_data(tvb, offset, actx->pinfo,
216                         "Reassembled T38", frag_msg, &data_frag_items, NULL, tree);
218             if (!frag_msg) { /* Not last packet of reassembled */
219                 if (Data_Field_field_type_value == 0) {
220                     col_append_fstr(actx->pinfo->cinfo, COL_INFO," (HDLC fragment %u)",
221                                                                      seq_number + (guint32)p_t38_packet_conv_info->additional_hdlc_data_field_counter
222                                                                        - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
223                 } else {
224                     col_append_fstr(actx->pinfo->cinfo, COL_INFO," (t4-data fragment %u)", seq_number - (guint32)p_t38_packet_conv_info->reass_start_seqnum);
225                 }
226             }
228             /* Now reset fragmentation information in pinfo */
229             actx->pinfo->fragmented = save_fragmented;
230         }
231     }
232 #.END
235 #.FN_HDR UDPTLPacket
236     /* Initialize to something else than data type */
237     Data_Field_field_type_value = 1;
238 #.END
240 #.FN_PARS UDPTLPacket/seq-number  VAL_PTR=&seq_number
241 #.FN_FTR UDPTLPacket/seq-number
242     /* info for tap */
243     if (primary_part)
244         t38_info->seq_num = seq_number;
246     col_append_fstr(actx->pinfo->cinfo, COL_INFO, "Seq=%05u ",seq_number);
247 #.END
249 #.FN_HDR UDPTLPacket/primary-ifp-packet
250     primary_part = TRUE;
251 #.FN_FTR UDPTLPacket/primary-ifp-packet
252     /* if is a valid t38 packet, add to tap */
253     if (p_t38_packet_conv && (!actx->pinfo->flags.in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum))
254         tap_queue_packet(t38_tap, actx->pinfo, t38_info);
256     if (p_t38_conv) p_t38_conv_info->last_seqnum = (gint32) seq_number;
257 #.END
259 #.FN_HDR UDPTLPacket/error-recovery
260     primary_part = FALSE;
261 #.FN_FTR UDPTLPacket/error-recovery
262     primary_part = TRUE;
263 #.END