diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-04-10 18:52:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-04-10 18:52:15 +0000 |
commit | 1bba417d590e19e6f46cf706a59756e311d1ab08 (patch) | |
tree | 94c87351ed21d885c2ad4315084b22c482ee5bb0 /packet-mtp3.c | |
parent | 237fd1277763517bdc6fce25c2b11c0cfd047968 (diff) |
From Jeff Morriss: add support for the Chinese ITU variant of SS7.
svn path=/trunk/; revision=7438
Diffstat (limited to 'packet-mtp3.c')
-rw-r--r-- | packet-mtp3.c | 76 |
1 files changed, 61 insertions, 15 deletions
diff --git a/packet-mtp3.c b/packet-mtp3.c index 5edf6cfacd..4380738ea2 100644 --- a/packet-mtp3.c +++ b/packet-mtp3.c @@ -1,9 +1,15 @@ /* packet-mtp3.c * Routines for Message Transfer Part Level 3 dissection + * + * It is (hopefully) compliant to: + * ANSI T1.111.4-1996 + * ITU-T Q.704 7/1996 + * GF 001-9001 (Chinese ITU variant) + * * Copyright 2001, Michael Tuexen <Michael.Tuexen@icn.siemens.de> - * Updated for ANSI support by Jeff Morriss <jeff.morriss[AT]ulticom.com> + * Updated for ANSI and Chinese ITU support by Jeff Morriss <jeff.morriss[AT]ulticom.com> * - * $Id: packet-mtp3.c,v 1.14 2003/01/28 23:56:39 guy Exp $ + * $Id: packet-mtp3.c,v 1.15 2003/04/10 18:52:09 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -49,17 +55,20 @@ static int hf_mtp3_itu_spare = -1; static int hf_mtp3_ansi_priority = -1; static int hf_mtp3_itu_opc = -1; static int hf_mtp3_ansi_opc = -1; +static int hf_mtp3_chinese_opc = -1; static int hf_mtp3_opc_network = -1; static int hf_mtp3_opc_cluster = -1; static int hf_mtp3_opc_member = -1; static int hf_mtp3_itu_dpc = -1; static int hf_mtp3_ansi_dpc = -1; +static int hf_mtp3_chinese_dpc = -1; static int hf_mtp3_dpc_network = -1; static int hf_mtp3_dpc_cluster = -1; static int hf_mtp3_dpc_member = -1; static int hf_mtp3_itu_sls = -1; static int hf_mtp3_ansi_5_bit_sls = -1; static int hf_mtp3_ansi_8_bit_sls = -1; +static int hf_mtp3_chinese_itu_sls = -1; /* Initialize the subtree pointers */ static gint ett_mtp3 = -1; @@ -73,7 +82,7 @@ static dissector_table_t mtp3_sio_dissector_table; #include <packet-mtp3.h> Standard_Type mtp3_standard = ITU_STANDARD; -gboolean mtp3_use_ansi_5_bit_sls = FALSE; +static gboolean mtp3_use_ansi_5_bit_sls = FALSE; #define SIO_LENGTH 1 @@ -109,6 +118,7 @@ gboolean mtp3_use_ansi_5_bit_sls = FALSE; #define ANSI_MEMBER_MASK 0xFF0000 #define ANSI_5BIT_SLS_MASK 0x1F #define ANSI_8BIT_SLS_MASK 0xFF +#define CHINESE_ITU_SLS_MASK 0xF static const value_string service_indicator_code_vals[] = { { 0x0, "Signalling Network Management Message (SNM)" }, @@ -161,6 +171,7 @@ dissect_mtp3_sio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree) SIO_LENGTH, sio); break; case ITU_STANDARD: + case CHINESE_ITU_STANDARD: proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio); break; @@ -181,6 +192,9 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, proto_tree *mtp3_tree) proto_item *label_item, *label_dpc_item, *label_opc_item; proto_tree *label_tree, *label_dpc_tree, *label_opc_tree; char pc[ANSI_PC_STRING_LENGTH]; + int *hf_dpc_string; + int *hf_opc_string; + switch (mtp3_standard) { case ITU_STANDARD: @@ -202,27 +216,29 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, proto_tree *mtp3_tree) break; case ANSI_STANDARD: + case CHINESE_ITU_STANDARD: + if (mtp3_standard == ANSI_STANDARD) + { + hf_dpc_string = &hf_mtp3_ansi_dpc; + hf_opc_string = &hf_mtp3_ansi_opc; + } else /* CHINESE_ITU_STANDARD */ { + hf_dpc_string = &hf_mtp3_chinese_dpc; + hf_opc_string = &hf_mtp3_chinese_opc; + } + /* Create the Routing Label Tree */ label_item = proto_tree_add_text(mtp3_tree, tvb, ANSI_ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, "Routing label"); label_tree = proto_item_add_subtree(label_item, ett_mtp3_label); - /* SLS */ - if (mtp3_use_ansi_5_bit_sls) - proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, - ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE); - else - proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, - ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE); - /* create the DPC tree */ dpc = tvb_get_ntoh24(tvb, ANSI_DPC_OFFSET); snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK), ((dpc & ANSI_CLUSTER_MASK) >> 8), ((dpc & ANSI_MEMBER_MASK) >> 16)); - label_dpc_item = proto_tree_add_string_format(label_tree, hf_mtp3_ansi_dpc, + label_dpc_item = proto_tree_add_string_format(label_tree, *hf_dpc_string, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, pc, "DPC (%s)", pc); @@ -244,7 +260,7 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, proto_tree *mtp3_tree) snprintf(pc, sizeof(pc), "%d-%d-%d", (opc & ANSI_NETWORK_MASK), ((opc & ANSI_CLUSTER_MASK) >> 8), ((opc & ANSI_MEMBER_MASK) >> 16)); - label_opc_item = proto_tree_add_string_format(label_tree, hf_mtp3_ansi_opc, + label_opc_item = proto_tree_add_string_format(label_tree, *hf_opc_string, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, pc, "OPC (%s)", pc); @@ -260,6 +276,21 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, proto_tree *mtp3_tree) proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_network,tvb, ANSI_OPC_OFFSET + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, opc); + + /* SLS */ + if (mtp3_standard == ANSI_STANDARD) + { + if (mtp3_use_ansi_5_bit_sls) + proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, + ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE); + else + proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, + ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE); + } else /* CHINESE_ITU_STANDARD */ { + proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, + ANSI_SLS_OFFSET, ITU_SLS_LENGTH, FALSE); + } + break; } } @@ -279,6 +310,7 @@ dissect_mtp3_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) payload_tvb = tvb_new_subset(tvb, ITU_MTP_PAYLOAD_OFFSET, -1, -1); break; case ANSI_STANDARD: + case CHINESE_ITU_STANDARD: payload_tvb = tvb_new_subset(tvb, ANSI_MTP_PAYLOAD_OFFSET, -1, -1); break; } @@ -312,6 +344,7 @@ dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ITU_HEADER_LENGTH, TRUE); break; case ANSI_STANDARD: + case CHINESE_ITU_STANDARD: mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, ANSI_HEADER_LENGTH, TRUE); break; @@ -357,6 +390,10 @@ proto_register_mtp3(void) { "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_opc_network, { "OPC Network", "mtp3.opc.network", FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK, @@ -377,6 +414,10 @@ proto_register_mtp3(void) { "DPC", "mtp3.ansi_dpc", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, + { &hf_mtp3_chinese_dpc, + { "DPC", "mtp3.chinese_dpc", + FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, { &hf_mtp3_dpc_network, { "DPC Network", "mtp3.dpc.network", FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK, @@ -400,6 +441,10 @@ proto_register_mtp3(void) { &hf_mtp3_ansi_8_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, ANSI_8BIT_SLS_MASK, + "", HFILL }}, + { &hf_mtp3_chinese_itu_sls, + { "Signalling Link Selector", "mtp3.sls", + FT_UINT8, BASE_DEC, NULL, CHINESE_ITU_SLS_MASK, "", HFILL }} }; @@ -413,8 +458,9 @@ proto_register_mtp3(void) }; static enum_val_t mtp3_options[] = { - { "ITU", ITU_STANDARD }, - { "ANSI", ANSI_STANDARD }, + { "ITU", ITU_STANDARD }, + { "ANSI", ANSI_STANDARD }, + { "Chinese ITU", CHINESE_ITU_STANDARD }, { NULL, 0 } }; |