/* packet-mtp3.c
* Routines for Message Transfer Part Level 3 dissection
- * Copyright 2001, Michael Tuexen <Michael.Tuexen@icn.siemens.de>
- * Updated for ANSI support by Jeff Morriss <jeff.morriss[AT]ulticom.com>
*
- * $Id: packet-mtp3.c,v 1.14 2003/01/28 23:56:39 guy Exp $
+ * 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 <tuexen [AT] fh-muenster.de>
+ * Updated for ANSI and Chinese ITU support by Jeff Morriss <jeff.morriss[AT]ulticom.com>
+ *
+ * $Id: packet-mtp3.c,v 1.22 2003/09/06 00:03:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
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;
#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
#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)" },
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;
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:
label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
label = tvb_get_letohl(tvb, ITU_ROUTING_LABEL_OFFSET);
- sls = tvb_get_guint8(tvb, ITU_ROUTING_LABEL_OFFSET);
+ sls = tvb_get_guint8(tvb, ITU_SLS_OFFSET);
proto_tree_add_uint(label_tree, hf_mtp3_itu_dpc, tvb,
ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH,
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);
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);
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;
}
}
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;
}
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_set_str(pinfo->cinfo, COL_INFO, "DATA ");
+
if (!dissector_try_port(mtp3_sio_dissector_table, service_indicator,
- payload_tvb, pinfo, tree)) {
+ payload_tvb, pinfo, tree))
call_dissector(data_handle, payload_tvb, pinfo, tree);
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_str(pinfo->cinfo, COL_INFO, "DATA ");
- }
}
/* Code to actually dissect the packets */
proto_item *mtp3_item = NULL;
proto_tree *mtp3_tree = NULL;
- /* Make entries in Protocol column and Info column on summary display */
+ /* Make entries in Protocol column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3");
+ switch(mtp3_standard) {
+ case ITU_STANDARD:
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Int. ITU)");
+ break;
+ case ANSI_STANDARD:
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (ANSI)");
+ break;
+ case CHINESE_ITU_STANDARD:
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Chin. ITU)");
+ break;
+ };
if (tree) {
/* create display subtree for the protocol */
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;
{ "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,
{ "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,
{ &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 }}
};
};
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 }
};