diff options
author | Michael Mann <mmann78@netscape.net> | 2013-10-29 21:12:50 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-10-29 21:12:50 +0000 |
commit | bd683d5ee1b24ea1bc5c08fe6ccacf71698faa50 (patch) | |
tree | ab5a8603fb7df23da1efb601c98b80e5a7d92252 | |
parent | 773359cf5fd4d719149dadcb06ebbac047872a0b (diff) | |
download | wireshark-bd683d5ee1b24ea1bc5c08fe6ccacf71698faa50.tar.gz |
Pass T.38 data to subdissectors directly instead of using pinfo->private_data.
svn path=/trunk/; revision=52964
-rw-r--r-- | asn1/t38/t38.cnf | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-t30.c | 45 | ||||
-rw-r--r-- | epan/dissectors/packet-t38.c | 19 |
3 files changed, 33 insertions, 34 deletions
diff --git a/asn1/t38/t38.cnf b/asn1/t38/t38.cnf index 73db8b94de..67585a1697 100644 --- a/asn1/t38/t38.cnf +++ b/asn1/t38/t38.cnf @@ -127,9 +127,8 @@ VAL_PTR=&Data_Field_field_type_value /* Now reset fragmentation information in pinfo */ actx->pinfo->fragmented = save_fragmented; - actx->pinfo->private_data = t38_info; - if (new_tvb) call_dissector((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree); + if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info); } } else { if(tree){ diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index dc050f0e47..d68f65e4c8 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -505,7 +505,7 @@ t30_get_string_numbers(tvbuff_t *tvb, int offset, int len) } static void -dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) +dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, t38_packet_info* t38) { gchar *str_num=NULL; @@ -516,8 +516,8 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num ); - if (pinfo->private_data) - g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, "Num: %s", str_num); + if (t38) + g_snprintf(t38->desc, MAX_T38_DESC, "Num: %s", str_num); } else { proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), @@ -528,7 +528,7 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot } static void -dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) +dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, t38_packet_info* t38) { guint8 octet; @@ -545,8 +545,8 @@ dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, col_append_fstr(pinfo->cinfo, COL_INFO, " - Frame num:%d", reverse_byte(octet)); - if (pinfo->private_data) - g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, "Frm num: %d", reverse_byte(octet)); + if (t38) + g_snprintf(t38->desc, MAX_T38_DESC, "Frm num: %d", reverse_byte(octet)); proto_tree_add_item(tree, hf_t30_t4_data, tvb, offset, len-1, ENC_NA); } @@ -569,7 +569,7 @@ dissect_t30_non_standard_cap(tvbuff_t *tvb, int offset, packet_info *pinfo, int } static void -dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) +dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, t38_packet_info* t38) { guint8 octet, page_count, block_count, frame_count; @@ -600,8 +600,8 @@ dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, i col_append_fstr(pinfo->cinfo, COL_INFO, " - PC:%d BC:%d FC:%d", page_count, block_count, frame_count); - if (pinfo->private_data) - g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, + if (t38) + g_snprintf(t38->desc, MAX_T38_DESC, "PC:%d BC:%d FC:%d", page_count, block_count, frame_count); } @@ -648,7 +648,7 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, } static void -dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, gboolean dis_dtc) +dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, gboolean dis_dtc, t38_packet_info* t38) { guint8 octet; @@ -680,8 +680,8 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot col_append_fstr(pinfo->cinfo, COL_INFO, " - DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_vals, "<unknown>")); - if (pinfo->private_data) - g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, + if (t38) + g_snprintf(t38->desc, MAX_T38_DESC, "DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_vals, "<unknown>")); } @@ -691,8 +691,8 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot col_append_fstr(pinfo->cinfo, COL_INFO, " - DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_dcs_vals, "<unknown>")); - if (pinfo->private_data) - g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, + if (t38) + g_snprintf(t38->desc, MAX_T38_DESC, "DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_dcs_vals, "<unknown>")); } @@ -916,7 +916,7 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot } static int -dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { int offset = 0; proto_item *it; @@ -926,6 +926,7 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data guint8 octet; guint32 frag_len; proto_item *item; + t38_packet_info* t38 = (t38_packet_info*)data; if (tvb_reported_length_remaining(tvb, offset) < 3) { proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, @@ -959,8 +960,8 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data tr_fif = proto_item_add_subtree(it_fcf, ett_t30_fif); frag_len = tvb_length_remaining(tvb, offset); - if (pinfo->private_data) - ((t38_packet_info*)pinfo->private_data)->t30_Facsimile_Control = octet; + if (t38) + t38->t30_Facsimile_Control = octet; col_append_fstr(pinfo->cinfo, COL_INFO, " %s - %s", @@ -974,10 +975,10 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data switch (octet & 0x7F) { case T30_FC_DIS: case T30_FC_DTC: - dissect_t30_dis_dtc(tvb, offset, pinfo, frag_len, tr_fif, TRUE); + dissect_t30_dis_dtc(tvb, offset, pinfo, frag_len, tr_fif, TRUE, t38); break; case T30_FC_DCS: - dissect_t30_dis_dtc(tvb, offset, pinfo, frag_len, tr_fif, FALSE); + dissect_t30_dis_dtc(tvb, offset, pinfo, frag_len, tr_fif, FALSE, t38); break; case T30_FC_CSI: case T30_FC_CIG: @@ -987,7 +988,7 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data case T30_FC_SUB: case T30_FC_SID: case T30_FC_PSA: - dissect_t30_numbers(tvb, offset, pinfo, frag_len, tr_fif); + dissect_t30_numbers(tvb, offset, pinfo, frag_len, tr_fif, t38); break; case T30_FC_NSF: case T30_FC_NSC: @@ -995,10 +996,10 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data dissect_t30_non_standard_cap(tvb, offset, pinfo, frag_len, tr_fif); break; case T30_FC_FCD: - dissect_t30_facsimile_coded_data(tvb, offset, pinfo, frag_len, tr_fif); + dissect_t30_facsimile_coded_data(tvb, offset, pinfo, frag_len, tr_fif, t38); break; case T30_FC_PPS: - dissect_t30_partial_page_signal(tvb, offset, pinfo, frag_len, tr_fif); + dissect_t30_partial_page_signal(tvb, offset, pinfo, frag_len, tr_fif, t38); break; case T30_FC_PPR: dissect_t30_partial_page_request(tvb, offset, pinfo, frag_len, tr_fif); diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c index 8937b17ff9..d6eebc7c88 100644 --- a/epan/dissectors/packet-t38.c +++ b/epan/dissectors/packet-t38.c @@ -643,9 +643,8 @@ dissect_t38_T_field_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ /* Now reset fragmentation information in pinfo */ actx->pinfo->fragmented = save_fragmented; - actx->pinfo->private_data = t38_info; - if (new_tvb) call_dissector((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree); + if (new_tvb) call_dissector_with_data((t30_hdlc_handle) ? t30_hdlc_handle : data_handle, new_tvb, actx->pinfo, tree, t38_info); } } else { if(tree){ @@ -674,7 +673,7 @@ dissect_t38_T_field_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int 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_) { -#line 156 "../../asn1/t38/t38.cnf" +#line 155 "../../asn1/t38/t38.cnf" tvbuff_t *value_tvb = NULL; guint32 value_len; @@ -685,7 +684,7 @@ dissect_t38_T_field_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ -#line 163 "../../asn1/t38/t38.cnf" +#line 162 "../../asn1/t38/t38.cnf" if (primary_part){ if(value_len < 8){ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[%s]", @@ -813,7 +812,7 @@ dissect_t38_T_seq_number(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 65535U, &seq_number, FALSE); -#line 243 "../../asn1/t38/t38.cnf" +#line 242 "../../asn1/t38/t38.cnf" /* info for tap */ if (primary_part) t38_info->seq_num = seq_number; @@ -827,12 +826,12 @@ dissect_t38_T_seq_number(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int 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_) { -#line 251 "../../asn1/t38/t38.cnf" +#line 250 "../../asn1/t38/t38.cnf" primary_part = TRUE; offset = dissect_per_open_type(tvb, offset, actx, tree, hf_index, dissect_t38_IFPPacket); -#line 253 "../../asn1/t38/t38.cnf" +#line 252 "../../asn1/t38/t38.cnf" /* if is a valid t38 packet, add to tap */ if (p_t38_packet_conv && (!actx->pinfo->flags.in_error_pkt) && ((gint32) seq_number != p_t38_packet_conv_info->last_seqnum)) tap_queue_packet(t38_tap, actx->pinfo, t38_info); @@ -926,14 +925,14 @@ static const per_choice_t T_error_recovery_choice[] = { static int 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_) { -#line 261 "../../asn1/t38/t38.cnf" +#line 260 "../../asn1/t38/t38.cnf" primary_part = FALSE; offset = dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_t38_T_error_recovery, T_error_recovery_choice, NULL); -#line 263 "../../asn1/t38/t38.cnf" +#line 262 "../../asn1/t38/t38.cnf" primary_part = TRUE; return offset; @@ -949,7 +948,7 @@ static const per_sequence_t UDPTLPacket_sequence[] = { static int dissect_t38_UDPTLPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 237 "../../asn1/t38/t38.cnf" +#line 236 "../../asn1/t38/t38.cnf" /* Initialize to something else than data type */ Data_Field_field_type_value = 1; |