diff options
author | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-09-14 10:51:44 +0000 |
---|---|---|
committer | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-09-14 10:51:44 +0000 |
commit | 3f7ba6886272742d4845827d3efdf6075cfce413 (patch) | |
tree | b197f9b0cad8af7239969d57a19e10eeb46212d6 /epan | |
parent | d8c46156b6aab1f7dcb208a1ecd93fa3ab2c77f1 (diff) |
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
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-mtp3.c | 84 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3.h | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3mg.c | 90 | ||||
-rw-r--r-- | epan/dissectors/packet-sccp.c | 42 | ||||
-rw-r--r-- | epan/dissectors/packet-sccpmg.c | 36 |
5 files changed, 117 insertions, 156 deletions
diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index e188a48f6a..0a46270e7e 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -156,9 +156,6 @@ static mtp3_addr_pc_t mtp3_addr_dpc, mtp3_addr_opc; #define ITU_OPC_MASK 0x0FFFC000 #define ITU_SLS_MASK 0xF0000000 -#define ANSI_NETWORK_MASK 0x0000FF -#define ANSI_CLUSTER_MASK 0x00FF00 -#define ANSI_MEMBER_MASK 0xFF0000 #define ANSI_5BIT_SLS_MASK 0x1F #define ANSI_8BIT_SLS_MASK 0xFF #define CHINESE_ITU_SLS_MASK 0xF @@ -245,7 +242,7 @@ mtp3_pc_to_str_buf(const guint32 pc, gchar *buf, int buf_len) break; case ANSI_STANDARD: case CHINESE_ITU_STANDARD: - g_snprintf(buf, buf_len, "%u-%u-%u", (pc & ANSI_NETWORK_MASK), (pc & ANSI_CLUSTER_MASK) >> 8, (pc & ANSI_MEMBER_MASK) >> 16); + g_snprintf(buf, buf_len, "%u-%u-%u", (pc & ANSI_NETWORK_MASK) >> 16, (pc & ANSI_CLUSTER_MASK) >> 8, (pc & ANSI_MEMBER_MASK)); break; case JAPAN_STANDARD: switch (japan_pc_structure) { @@ -397,6 +394,46 @@ guint32 mtp3_pc_hash(const guint8* data) { return pc; } +/* Common function for dissecting 3-byte (ANSI or China) PCs. */ +void +dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, proto_tree *tree, gint ett_pc, int hf_pc_string, int hf_pc_network, + int hf_pc_cluster, int hf_pc_member, int hf_dpc, int hf_pc) +{ + guint32 pc; + proto_item *pc_item; + proto_tree *pc_tree; + char pc_string[MAX_STRUCTURED_PC_LENGTH]; + + pc = tvb_get_letoh24(tvb, offset); + mtp3_pc_to_str_buf(pc, pc_string, sizeof(pc_string)); + + pc_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + + /* Add alternate formats of the PC + * NOTE: each of these formats is shown to the user, + * so I think that using hidden fields in this case is OK. + */ + g_snprintf(pc_string, sizeof(pc_string), "%u", pc); + proto_item_append_text(pc_item, " (%s)", pc_string); + proto_tree_add_string_hidden(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + g_snprintf(pc_string, sizeof(pc_string), "0x%x", pc); + proto_item_append_text(pc_item, " (%s)", pc_string); + proto_tree_add_string_hidden(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + + pc_tree = proto_item_add_subtree(pc_item, ett_pc); + + proto_tree_add_uint(pc_tree, hf_pc_network, tvb, offset + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, pc); + proto_tree_add_uint(pc_tree, hf_pc_cluster, tvb, offset + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, pc); + proto_tree_add_uint(pc_tree, hf_pc_member, tvb, offset + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, pc); + + /* add full integer values of DPC as hidden for filtering purposes */ + if (hf_dpc) + proto_tree_add_uint_hidden(pc_tree, hf_dpc, tvb, offset, ANSI_PC_LENGTH, pc); + if (hf_pc) + proto_tree_add_uint_hidden(pc_tree, hf_pc, tvb, offset, ANSI_PC_LENGTH, pc); + +} + static void dissect_mtp3_sio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree) { @@ -435,7 +472,7 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_t { guint32 label, dpc = 0, opc = 0; proto_item *label_item, *label_dpc_item, *label_opc_item; - proto_tree *label_tree, *label_dpc_tree, *label_opc_tree; + proto_tree *label_tree; int *hf_dpc_string; int *hf_opc_string; @@ -479,31 +516,18 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_t label_item = proto_tree_add_text(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, "Routing label"); label_tree = proto_item_add_subtree(label_item, ett_mtp3_label); - /* create the DPC tree */ - dpc = tvb_get_ntoh24(tvb, ANSI_DPC_OFFSET); - label_dpc_item = proto_tree_add_string_format(label_tree, *hf_dpc_string, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, mtp3_pc_to_str(dpc), "DPC (%s) (%u)", mtp3_pc_to_str(dpc), dpc); - label_dpc_tree = proto_item_add_subtree(label_dpc_item, ett_mtp3_label_dpc); - - proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_member, tvb, ANSI_DPC_OFFSET + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, dpc); - proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_cluster, tvb, ANSI_DPC_OFFSET + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, dpc); - proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_network, tvb, ANSI_DPC_OFFSET + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, dpc); - - /* add full integer values of DPC as hidden for filtering purposes */ - proto_tree_add_uint_hidden(label_dpc_tree, hf_mtp3_24bit_dpc, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, dpc); - proto_tree_add_uint_hidden(label_dpc_tree, hf_mtp3_24bit_pc, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, dpc); - - /* create the OPC tree */ - opc = tvb_get_ntoh24(tvb, ANSI_OPC_OFFSET); - label_opc_item = proto_tree_add_string_format(label_tree, *hf_opc_string, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, mtp3_pc_to_str(opc), "OPC (%s) (%u)", mtp3_pc_to_str(opc), opc); - label_opc_tree = proto_item_add_subtree(label_opc_item, ett_mtp3_label_opc); - proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_member, tvb, ANSI_OPC_OFFSET + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, opc); - proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_cluster, tvb, ANSI_OPC_OFFSET + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, opc); - proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_network, tvb, ANSI_OPC_OFFSET + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, opc); + /* create and fill the DPC tree */ + dissect_mtp3_3byte_pc(tvb, ANSI_DPC_OFFSET, label_tree, ett_mtp3_label_dpc, *hf_dpc_string, hf_mtp3_dpc_network, + hf_mtp3_dpc_cluster, hf_mtp3_dpc_member, hf_mtp3_24bit_dpc, hf_mtp3_24bit_pc); + /* Store dpc for mtp3_addr below */ + dpc = tvb_get_letoh24(tvb, ANSI_DPC_OFFSET); - /* add full integer values of OPC as hidden for filtering purposes */ - proto_tree_add_uint_hidden(label_opc_tree, hf_mtp3_24bit_opc, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, opc); - proto_tree_add_uint_hidden(label_opc_tree, hf_mtp3_24bit_pc, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, opc); + /* create and fill the OPC tree */ + dissect_mtp3_3byte_pc(tvb, ANSI_OPC_OFFSET, label_tree, ett_mtp3_label_opc, *hf_opc_string, hf_mtp3_opc_network, + hf_mtp3_opc_cluster, hf_mtp3_opc_member, hf_mtp3_24bit_opc, hf_mtp3_24bit_pc); + /* Store opc for mtp3_addr below */ + opc = tvb_get_letoh24(tvb, ANSI_OPC_OFFSET); /* SLS */ if (mtp3_standard == ANSI_STANDARD) { @@ -666,8 +690,8 @@ proto_register_mtp3(void) { &hf_mtp3_itu_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }}, { &hf_mtp3_24bit_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK, "", HFILL }}, { &hf_mtp3_24bit_opc, { "OPC", "mtp3.opc", FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK, "", HFILL }}, - { &hf_mtp3_ansi_opc, { "DPC", "mtp3.ansi_opc", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, - { &hf_mtp3_chinese_opc, { "DPC", "mtp3.chinese_opc", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, + { &hf_mtp3_ansi_opc, { "OPC", "mtp3.ansi_opc", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, + { &hf_mtp3_chinese_opc, { "OPC", "mtp3.chinese_opc", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, { &hf_mtp3_opc_network, { "OPC Network", "mtp3.opc.network", FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK, "", HFILL }}, { &hf_mtp3_opc_cluster, { "OPC Cluster", "mtp3.opc.cluster", FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK, "", HFILL }}, { &hf_mtp3_opc_member, { "OPC Member", "mtp3.opc.member", FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK, "", HFILL }}, diff --git a/epan/dissectors/packet-mtp3.h b/epan/dissectors/packet-mtp3.h index 90aaeddbd9..c990e63529 100644 --- a/epan/dissectors/packet-mtp3.h +++ b/epan/dissectors/packet-mtp3.h @@ -56,13 +56,13 @@ typedef struct _mtp3_tap_rec_t { #define ANSI_PC_LENGTH 3 #define ANSI_NCM_LENGTH 1 -#define ANSI_MEMBER_OFFSET 0 -#define ANSI_CLUSTER_OFFSET 1 #define ANSI_NETWORK_OFFSET 2 +#define ANSI_CLUSTER_OFFSET 1 +#define ANSI_MEMBER_OFFSET 0 #define ANSI_PC_MASK 0xFFFFFF -#define ANSI_NETWORK_MASK 0x0000FF +#define ANSI_NETWORK_MASK 0xFF0000 #define ANSI_CLUSTER_MASK 0x00FF00 -#define ANSI_MEMBER_MASK 0xFF0000 +#define ANSI_MEMBER_MASK 0x0000FF #define ANSI_PC_STRING_LENGTH 16 #define JAPAN_PC_LENGTH 2 @@ -74,6 +74,19 @@ extern gchar* mtp3_pc_to_str(const guint32 pc); extern gboolean mtp3_pc_structured(void); extern guint32 mtp3_pc_hash(const guint8* data); +#ifdef __PROTO_H__ +/* epan/to_str.c includes this file, but it does not include proto.h so + * it doesn't know about things like proto_tree. This function is not + * needed by to_str.c, so just don't prototype it there (or anywhere + * without proto.h). + */ +extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, + proto_tree *tree, gint ett_pc, + int hf_pc, int hf_pc_network, + int hf_pc_cluster, int hf_pc_member, + int hf_dpc, int pc); +#endif + /* * the following allows TAP code access to the messages * without having to duplicate it. With MSVC and a diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c index e30e60b47a..86e449b431 100644 --- a/epan/dissectors/packet-mtp3mg.c +++ b/epan/dissectors/packet-mtp3mg.c @@ -548,38 +548,6 @@ dissect_mtp3mg_ecm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } static void -dissect_mtp3mg_3byte_pc(tvbuff_t *tvb, proto_tree *tree, gint *ett_pc, - int *hf_pc, int *hf_pc_member, int *hf_pc_cluster, - int *hf_pc_network) -{ - guint32 apc; - proto_item *apc_item; - proto_tree *apc_tree; - char pc[ANSI_PC_STRING_LENGTH]; - - apc = tvb_get_ntoh24(tvb, 0); - - g_snprintf(pc, sizeof(pc), "%d-%d-%d", - (apc & ANSI_NETWORK_MASK), - ((apc & ANSI_CLUSTER_MASK) >> 8), - ((apc & ANSI_MEMBER_MASK) >> 16)); - - apc_item = proto_tree_add_string_format(tree, *hf_pc, tvb, 0, - ANSI_PC_LENGTH, pc, - "Affected PC (%s)", pc); - - apc_tree = proto_item_add_subtree(apc_item, *ett_pc); - - proto_tree_add_uint(apc_tree, *hf_pc_member, tvb, - ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, apc); - proto_tree_add_uint(apc_tree, *hf_pc_cluster, tvb, - ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, apc); - proto_tree_add_uint(apc_tree, *hf_pc_network, tvb, - ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, apc); - -} - -static void dissect_mtp3mg_fcm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 h1) { @@ -653,11 +621,10 @@ dissect_mtp3mg_fcm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hf_apc_string = &hf_mtp3mg_tfc_chinese_apc; } - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_fcm_apc, - hf_apc_string, - &hf_mtp3mg_tfc_apc_member, - &hf_mtp3mg_tfc_apc_cluster, - &hf_mtp3mg_tfc_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_fcm_apc, + *hf_apc_string, hf_mtp3mg_tfc_apc_network, + hf_mtp3mg_tfc_apc_cluster, + hf_mtp3mg_tfc_apc_member, 0, 0); proto_tree_add_item(tree, hf_mtp3mg_tfc_ansi_status, tvb, ANSI_TFC_STATUS_OFFSET, ANSI_TFC_STATUS_LENGTH, @@ -691,11 +658,11 @@ dissect_mtp3mg_tfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case TFM_H1_TCA: if (mtp3_standard == ANSI_STANDARD) { - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_tfm_apc, - &hf_mtp3mg_tfm_ansi_apc, - &hf_mtp3mg_tfm_apc_member, - &hf_mtp3mg_tfm_apc_cluster, - &hf_mtp3mg_tfm_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_tfm_apc, + hf_mtp3mg_tfm_ansi_apc, + hf_mtp3mg_tfm_apc_network, + hf_mtp3mg_tfm_apc_cluster, + hf_mtp3mg_tfm_apc_member, 0, 0); } else if (mtp3_standard == JAPAN_STANDARD) { guint8 count, i; @@ -744,11 +711,11 @@ dissect_mtp3mg_tfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } else if (mtp3_standard == CHINESE_ITU_STANDARD) - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_tfm_apc, - &hf_mtp3mg_tfm_chinese_apc, - &hf_mtp3mg_tfm_apc_member, - &hf_mtp3mg_tfm_apc_cluster, - &hf_mtp3mg_tfm_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_tfm_apc, + hf_mtp3mg_tfm_chinese_apc, + hf_mtp3mg_tfm_apc_network, + hf_mtp3mg_tfm_apc_cluster, + hf_mtp3mg_tfm_apc_member, 0, 0); } break; @@ -775,11 +742,11 @@ dissect_mtp3mg_rsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case RSM_H1_RCR: if (mtp3_standard == ANSI_STANDARD) { - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_rsm_apc, - &hf_mtp3mg_rsm_ansi_apc, - &hf_mtp3mg_rsm_apc_member, - &hf_mtp3mg_rsm_apc_cluster, - &hf_mtp3mg_rsm_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_rsm_apc, + hf_mtp3mg_rsm_ansi_apc, + hf_mtp3mg_rsm_apc_network, + hf_mtp3mg_rsm_apc_cluster, + hf_mtp3mg_rsm_apc_member, 0, 0); } else if (mtp3_standard == JAPAN_STANDARD) { if (h1 == RSM_H1_RST) @@ -831,11 +798,11 @@ dissect_mtp3mg_rsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } else /* CHINESE_ITU_STANDARD */ - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_rsm_apc, - &hf_mtp3mg_rsm_chinese_apc, - &hf_mtp3mg_rsm_apc_member, - &hf_mtp3mg_rsm_apc_cluster, - &hf_mtp3mg_rsm_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_rsm_apc, + hf_mtp3mg_rsm_chinese_apc, + hf_mtp3mg_rsm_apc_network, + hf_mtp3mg_rsm_apc_cluster, + hf_mtp3mg_rsm_apc_member, 0, 0); } else dissect_mtp3mg_unknown_message(tvb, tree); } @@ -957,11 +924,10 @@ dissect_mtp3mg_ufc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, else /* CHINESE_ITU_STANDARD */ hf_apc = &hf_mtp3mg_upu_chinese_apc; - dissect_mtp3mg_3byte_pc(tvb, tree, &ett_mtp3mg_upu_apc, - hf_apc, - &hf_mtp3mg_rsm_apc_member, - &hf_mtp3mg_rsm_apc_cluster, - &hf_mtp3mg_rsm_apc_network); + dissect_mtp3_3byte_pc(tvb, 0, tree, ett_mtp3mg_upu_apc, *hf_apc, + hf_mtp3mg_rsm_apc_network, + hf_mtp3mg_rsm_apc_cluster, + hf_mtp3mg_rsm_apc_member, 0, 0); proto_tree_add_item(tree, hf_mtp3mg_upu_user, tvb, ANSI_UPU_USER_OFFSET, UPU_USER_LENGTH, TRUE); 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(): diff --git a/epan/dissectors/packet-sccpmg.c b/epan/dissectors/packet-sccpmg.c index ed9d7aaab0..4a75b07bce 100644 --- a/epan/dissectors/packet-sccpmg.c +++ b/epan/dissectors/packet-sccpmg.c @@ -150,11 +150,7 @@ dissect_sccpmg_affected_ssn(tvbuff_t *tvb, proto_tree *sccpmg_tree) static void dissect_sccpmg_affected_pc(tvbuff_t *tvb, proto_tree *sccpmg_tree) { - proto_item *pc_item = 0; - proto_tree *pc_tree = 0; - guint32 dpc; guint8 offset = SCCPMG_AFFECTED_PC_OFFSET; - char pc[ANSI_PC_STRING_LENGTH]; if (mtp3_standard == ITU_STANDARD) { proto_tree_add_item(sccpmg_tree, hf_sccpmg_affected_itu_pc, tvb, @@ -172,30 +168,14 @@ dissect_sccpmg_affected_pc(tvbuff_t *tvb, proto_tree *sccpmg_tree) hf_affected_pc = &hf_sccpmg_affected_chinese_pc; } - /* create the DPC tree; modified from that in packet-sccp.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)); - - pc_item = proto_tree_add_string_format(sccpmg_tree, - *hf_affected_pc, - tvb, offset, - ANSI_PC_LENGTH, pc, - "PC (%s)", pc); - - pc_tree = proto_item_add_subtree(pc_item, - ett_sccpmg_affected_pc); - - proto_tree_add_uint(pc_tree, hf_sccpmg_affected_pc_member, tvb, - offset, ANSI_NCM_LENGTH, dpc); - offset += ANSI_NCM_LENGTH; - proto_tree_add_uint(pc_tree, hf_sccpmg_affected_pc_cluster, tvb, - offset, ANSI_NCM_LENGTH, dpc); - offset += ANSI_NCM_LENGTH; - proto_tree_add_uint(pc_tree, hf_sccpmg_affected_pc_network, - tvb, offset, ANSI_NCM_LENGTH, dpc); + /* create and fill the PC tree */ + dissect_mtp3_3byte_pc(tvb, offset, sccpmg_tree, + ett_sccpmg_affected_pc, *hf_affected_pc, + hf_sccpmg_affected_pc_network, + hf_sccpmg_affected_pc_cluster, + hf_sccpmg_affected_pc_member, 0, 0); + + offset += ANSI_PC_LENGTH; } } |