From 3f7ba6886272742d4845827d3efdf6075cfce413 Mon Sep 17 00:00:00 2001 From: jmayer Date: Thu, 14 Sep 2006 10:51:44 +0000 Subject: Jeff Morriss: Fix for bug 1036 I looked at this today and found that in fact the PC stuff is pretty hosed up in the SS7 dissectors. For example, MTP3 *looks* OK here (DPC is 4-5-6): Routing label DPC (4-5-6) (394500) but 394500 == 0x60504 == 6-5-4. Something's not right. I made a common PC dissector function for all the SS7 dissectors so as to concentrate all this code in one place (something I've been wanting to do for a while anyway) and fixed the reported problem as well as the above problem in the attached patch. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19231 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-sccp.c | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) (limited to 'epan/dissectors/packet-sccp.c') diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index b793c0dcef..c01d314209 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -1043,10 +1043,6 @@ static int dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset, gboolean called) { - guint32 dpc; - proto_item *call_pc_item = 0; - proto_tree *call_pc_tree = 0; - char pc[ANSI_PC_STRING_LENGTH]; int *hf_pc; if (decode_mtp3_standard == ANSI_STANDARD) @@ -1062,34 +1058,16 @@ dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset, hf_pc = &hf_sccp_calling_chinese_pc; } - /* create the DPC tree; modified from that in packet-mtp3.c */ - dpc = tvb_get_ntoh24(tvb, offset); - g_snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK), - ((dpc & ANSI_CLUSTER_MASK) >> 8), - ((dpc & ANSI_MEMBER_MASK) >> 16)); - - call_pc_item = proto_tree_add_string_format(call_tree, *hf_pc, - tvb, offset, ANSI_PC_LENGTH, - pc, "PC (%s)", pc); - - call_pc_tree = proto_item_add_subtree(call_pc_item, - called ? ett_sccp_called_pc - : ett_sccp_calling_pc); - - proto_tree_add_uint(call_pc_tree, called ? hf_sccp_called_pc_member - : hf_sccp_calling_pc_member, - tvb, offset, ANSI_NCM_LENGTH, dpc); - offset += ANSI_NCM_LENGTH; - proto_tree_add_uint(call_pc_tree, called ? hf_sccp_called_pc_cluster - : hf_sccp_calling_pc_cluster, - tvb, offset, ANSI_NCM_LENGTH, dpc); - offset += ANSI_NCM_LENGTH; - proto_tree_add_uint(call_pc_tree, called ? hf_sccp_called_pc_network - : hf_sccp_calling_pc_network, - tvb, offset, ANSI_NCM_LENGTH, dpc); - offset += ANSI_NCM_LENGTH; - - return(offset); + /* create and fill the PC tree */ + dissect_mtp3_3byte_pc(tvb, offset, call_tree, + called ? ett_sccp_called_pc : ett_sccp_calling_pc, + *hf_pc, + called ? hf_sccp_called_pc_network : hf_sccp_calling_pc_network, + called ? hf_sccp_called_pc_cluster : hf_sccp_calling_pc_cluster, + called ? hf_sccp_called_pc_member : hf_sccp_calling_pc_member, + 0, 0); + + return(offset + ANSI_PC_LENGTH); } /* FUNCTION dissect_sccp_called_calling_param(): -- cgit v1.2.3