From 4afd41eededf53c14265a8346d3af1f6574a699a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 18 Mar 2004 09:00:37 +0000 Subject: [PATCH] From Tomas Kukosa: improve the Info column text for reassembled messages; register subdissectors for dissecting Q.931 IEs and make the ISUP dissector call the codeset 0 IE subdissector through a handle. svn path=/trunk/; revision=10400 --- packet-isup.c | 11 +++++++---- packet-q931.c | 50 ++++++++++++++++++++++++++++++++++---------------- packet-q931.h | 5 +---- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/packet-isup.c b/packet-isup.c index 3721ef4b75..ba0866da10 100644 --- a/packet-isup.c +++ b/packet-isup.c @@ -9,7 +9,7 @@ * Modified 2004-01-10 by Anders Broman to add abillity to dissect * Content type application/ISUP RFC 3204 used in SIP-T * - * $Id: packet-isup.c,v 1.54 2004/03/06 10:09:35 guy Exp $ + * $Id: packet-isup.c,v 1.55 2004/03/18 09:00:37 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1374,7 +1374,8 @@ static gint ett_bat_ase_iwfa = -1; -static dissector_handle_t sdp_handle; +static dissector_handle_t sdp_handle = NULL; +static dissector_handle_t q931_ie_handle = NULL; /* ------------------------------------------------------------------ Mapping number to ASCII-character @@ -1881,11 +1882,12 @@ static void dissect_isup_access_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item, packet_info *pinfo) { guint length = tvb_reported_length(parameter_tvb); - gint offset = 0; + proto_tree_add_text(parameter_tree, parameter_tvb, 0, -1, "Access transport parameter field (-> Q.931)"); - dissect_q931_IEs(parameter_tvb, pinfo, NULL, parameter_tree, FALSE, offset); + if (q931_ie_handle) + call_dissector(q931_ie_handle, parameter_tvb, pinfo, parameter_tree); proto_item_set_text(parameter_item, "Access transport (%u byte%s length)", length , plurality(length, "", "s")); @@ -6242,6 +6244,7 @@ proto_reg_handoff_bicc(void) { dissector_handle_t bicc_handle; sdp_handle = find_dissector("sdp"); + q931_ie_handle = find_dissector("q931.ie"); bicc_handle = create_dissector_handle(dissect_bicc, proto_bicc); dissector_add("mtp3.service_indicator", MTP3_BICC_SERVICE_INDICATOR, bicc_handle); diff --git a/packet-q931.c b/packet-q931.c index 22be473ed7..df141304ce 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris * - * $Id: packet-q931.c,v 1.73 2004/03/06 10:11:54 guy Exp $ + * $Id: packet-q931.c,v 1.74 2004/03/18 09:00:37 guy Exp $ * * Modified by Andreas Sikkema for possible use with H.323 * @@ -105,7 +105,7 @@ static const fragment_items q931_frag_items = { &hf_q931_segment_multiple_tails, &hf_q931_segment_too_long_segment, &hf_q931_segment_error, - &hf_q931_reassembled_in, + &hf_q931_reassembled_in, "segments" }; @@ -125,6 +125,10 @@ static gboolean q931_desegment = TRUE; static dissector_handle_t h225_handle; static dissector_handle_t q931_tpkt_pdu_handle; +static void +dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, + proto_tree *q931_tree, gboolean is_tpkt, int offset, int initial_codeset); + /* * Q.931 message types. */ @@ -2393,13 +2397,13 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ if ((message_type != Q931_SEGMENT) || !q931_reassembly || (tvb_reported_length_remaining(tvb, offset) <= 4)) { - dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_tpkt, offset); + dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_tpkt, offset, 0); return; } info_element = tvb_get_guint8(tvb, offset); info_element_len = tvb_get_guint8(tvb, offset + 1); if ((info_element != Q931_IE_SEGMENTED_MESSAGE) || (info_element_len < 2)) { - dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_tpkt, offset); + dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_tpkt, offset, 0); return; } /* Segmented message IE */ @@ -2410,8 +2414,12 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, val_to_str(info_element, q931_info_element_vals[0], "Unknown (0x%02X)")); proto_tree_add_text(ie_tree, tvb, offset + 1, 1, "Length: %u", info_element_len); dissect_q931_segmented_message_ie(tvb, offset + 2, info_element_len, ie_tree); - more_frags = (tvb_get_guint8(tvb, offset + 2) & 0x7F) != 0; + more_frags = (tvb_get_guint8(tvb, offset + 2) & 0x7F) != 0; segmented_message_type = tvb_get_guint8(tvb, offset + 3); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", + val_to_str(segmented_message_type, q931_message_type_vals, "Unknown message type (0x%02X)")); + } offset += 1 + 1 + info_element_len; /* Reassembly */ frag_len = tvb_length_remaining(tvb, offset); @@ -2436,13 +2444,9 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { if (tree) proto_tree_add_uint(q931_tree, hf_q931_reassembled_in, tvb, offset, frag_len, fd_head->reassembled_in); } - } else { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, " [segment]"); - } } - if (next_tvb) - dissect_q931_IEs(next_tvb, pinfo, tree, q931_tree, is_tpkt, 0); + if (next_tvb) + dissect_q931_IEs(next_tvb, pinfo, tree, q931_tree, is_tpkt, 0, 0); } static const value_string q931_codeset_vals[] = { @@ -2454,9 +2458,9 @@ static const value_string q931_codeset_vals[] = { { 0x00, NULL }, }; -void -dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_tree *q931_tree, gboolean is_tpkt, int offset) +static void +dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, + proto_tree *q931_tree, gboolean is_tpkt, int offset, int initial_codeset) { proto_item *ti; proto_tree *ie_tree = NULL; @@ -2468,7 +2472,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, e164_info_t e164_info; e164_info.e164_number_type = NONE; - codeset = locked_codeset = 0; /* start out in codeset 0 */ + codeset = locked_codeset = initial_codeset; non_locking_shift = TRUE; first_segment = FALSE; while (tvb_reported_length_remaining(tvb, offset) > 0) { @@ -2625,7 +2629,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset + 4, info_element_len - 1, info_element_len - 1); call_dissector(h225_handle, h225_tvb, - pinfo, tree); + pinfo, root_tree); } else { /* * No - just show it as "User @@ -2959,6 +2963,18 @@ dissect_q931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_q931_pdu(tvb, pinfo, tree, FALSE); } +static void +dissect_q931_ie_cs0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_q931_IEs(tvb, pinfo, NULL, tree, FALSE, 0, 0); +} + +static void +dissect_q931_ie_cs7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_q931_IEs(tvb, pinfo, NULL, tree, FALSE, 0, 7); +} + static void q931_init(void) { /* Initialize the fragment and reassembly tables */ @@ -3107,6 +3123,8 @@ proto_register_q931(void) register_dissector("q931", dissect_q931, proto_q931); q931_tpkt_pdu_handle = create_dissector_handle(dissect_q931_tpkt_pdu, proto_q931); + register_dissector("q931.ie", dissect_q931_ie_cs0, proto_q931); + register_dissector("q931.ie.cs7", dissect_q931_ie_cs7, proto_q931); /* subdissector code */ codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", FT_UINT8, BASE_HEX); diff --git a/packet-q931.h b/packet-q931.h index 9982af9df8..fb4d345026 100644 --- a/packet-q931.h +++ b/packet-q931.h @@ -3,7 +3,7 @@ * disassembly * Guy Harris * - * $Id: packet-q931.h,v 1.10 2004/01/15 02:23:18 guy Exp $ + * $Id: packet-q931.h,v 1.11 2004/03/18 09:00:37 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -42,9 +42,6 @@ extern void dissect_q931_high_layer_compat_ie(tvbuff_t *, int, int, extern void dissect_q931_user_user_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree); -extern void dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, proto_tree *q931_tree, gboolean is_tpkt, int offset); - extern const value_string q931_cause_location_vals[]; extern const value_string q931_cause_code_vals[];