diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-11-24 02:59:49 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-11-24 02:59:49 +0000 |
commit | b0993663a1855aaa857ab35aba03abfb02979c5b (patch) | |
tree | 4354db46ed0207c9d6bcfe135189d5d09b0ce9e6 /epan/dissectors | |
parent | eb0a24bbad890574f6690ed83520e46536a0ce64 (diff) |
From Jeff Morriss: SSCOP over UDP and SSCF-NNI support.
svn path=/trunk/; revision=12585
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3mg.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-sscf-nni.c | 148 | ||||
-rw-r--r-- | epan/dissectors/packet-sscop.c | 108 |
5 files changed, 247 insertions, 20 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 024d261b33..2fb3ca8e21 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -471,6 +471,7 @@ DISSECTOR_SRC = \ packet-socks.c \ packet-spnego.c \ packet-spray.c \ + packet-sscf-nni.c \ packet-srvloc.c \ packet-sscop.c \ packet-ssh.c \ diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 29fea877d4..865aab288d 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -147,8 +147,8 @@ static const value_string mtp3_service_indicator_code_vals[] = { { 0x6, "DUP (call and circuit related messages)" }, { 0x7, "DUP (facility registration and cancellation message)" }, { 0x8, "MTP testing user part" }, - { 0x9, "Spare" }, - { 0xa, "Spare" }, + { 0x9, "Broadband ISUP" }, + { 0xa, "Satellite ISUP" }, { 0xb, "Spare" }, { 0xc, "Spare" }, { 0xd, "Spare" }, @@ -167,6 +167,8 @@ const value_string mtp3_service_indicator_code_short_vals[] = { { 0x6, "DUP (CC)" }, { 0x7, "DUP (FAC/CANC)" }, { 0x8, "MTP Test" }, + { 0x9, "ISUP-b" }, + { 0xa, "ISUP-s" }, { 0, NULL } }; diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c index 0d1d4b55b4..5eab60dd42 100644 --- a/epan/dissectors/packet-mtp3mg.c +++ b/epan/dissectors/packet-mtp3mg.c @@ -325,8 +325,8 @@ static const value_string service_indicator_code_vals[] = { { 0x6, "DUP (call and circuit related messages)" }, { 0x7, "DUP (facility registration and cancellation message)" }, { 0x8, "MTP testing user part" }, - { 0x9, "Spare" }, - { 0xa, "Spare" }, + { 0x9, "ISUP-b" }, + { 0xa, "ISUP-s" }, { 0xb, "Spare" }, { 0xc, "Spare" }, { 0xd, "Spare" }, diff --git a/epan/dissectors/packet-sscf-nni.c b/epan/dissectors/packet-sscf-nni.c new file mode 100644 index 0000000000..cf9abf7ede --- /dev/null +++ b/epan/dissectors/packet-sscf-nni.c @@ -0,0 +1,148 @@ +/* packet-sscf-nni.c + * Routines for SSCF-NNI (Q.2140) frame disassembly + * Jeff Morriss <jeff.morriss[AT]ulticom.com> + * + * $Id:$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 + * + * Copied from packet-sscop.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> +#include <glib.h> +#include <string.h> +#include <epan/packet.h> + +static int proto_sscf = -1; + +static gint ett_sscf = -1; + +static dissector_handle_t mtp3_handle; +static dissector_handle_t data_handle; + +#define SSCF_PDU_LENGTH 4 +#define SSCF_STATUS_OFFSET 3 +#define SSCF_STATUS_LENGTH 1 +#define SSCF_SPARE_OFFSET 0 +#define SSCF_SPARE_LENGTH 3 + +static int hf_status = -1; +static int hf_spare = -1; + +#define SSCF_STATUS_OOS 0x01 +#define SSCF_STATUS_PO 0x02 +#define SSCF_STATUS_IS 0x03 +#define SSCF_STATUS_NORMAL 0x04 +#define SSCF_STATUS_EMERGENCY 0x05 +#define SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL 0x7 +#define SSCF_STATUS_MANAGEMENT_INITIATED 0x08 +#define SSCF_STATUS_PROTOCOL_ERROR 0x09 +#define SSCF_STATUS_PROVING_NOT_SUCCESSFUL 0x0a + +static const value_string sscf_status_vals[] = { + { SSCF_STATUS_OOS, "Out of Service" }, + { SSCF_STATUS_PO, "Processor Outage" }, + { SSCF_STATUS_IS, "In Service" }, + { SSCF_STATUS_NORMAL, "Normal" }, + { SSCF_STATUS_EMERGENCY, "Emergency" }, + { SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL, "Alignment Not Successful" }, + { SSCF_STATUS_MANAGEMENT_INITIATED, "Management Initiated" }, + { SSCF_STATUS_PROTOCOL_ERROR, "Protocol Error" }, + { SSCF_STATUS_PROVING_NOT_SUCCESSFUL, "Proving Not Successful" }, + { 0, NULL } +}; + +static void +dissect_sscf_nni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint reported_length; + proto_item *sscf_item = NULL; + proto_tree *sscf_tree = NULL; + guint8 sscf_status; + + reported_length = tvb_reported_length(tvb); /* frame length */ + + if (tree) { + sscf_item = proto_tree_add_item(tree, proto_sscf, tvb, 0, -1, FALSE); + sscf_tree = proto_item_add_subtree(sscf_item, ett_sscf); + } + + if (reported_length > SSCF_PDU_LENGTH) + { + call_dissector(mtp3_handle, tvb, pinfo, tree); + + } else { + + sscf_status = tvb_get_guint8(tvb, SSCF_STATUS_OFFSET); + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "SSCF-NNI"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_fstr(pinfo->cinfo, COL_INFO, "STATUS (%s) ", + val_to_str(sscf_status, sscf_status_vals, "Unknown")); + + + proto_tree_add_item(sscf_tree, hf_status, tvb, SSCF_STATUS_OFFSET, + SSCF_STATUS_LENGTH, FALSE); + proto_tree_add_item(sscf_tree, hf_spare, tvb, SSCF_SPARE_OFFSET, + SSCF_SPARE_LENGTH, FALSE); + } + +} + +void +proto_register_sscf(void) +{ + static hf_register_info hf[] = + { { &hf_status, { "Status", "sscf-nni.status", FT_UINT8, BASE_HEX, + VALS(sscf_status_vals), 0x0, "", HFILL} }, + { &hf_spare, { "Spare", "sscf-nni.spare", FT_UINT24, BASE_HEX, + NULL, 0x0, "", HFILL} } + }; + + static gint *ett[] = { + &ett_sscf, + }; + + proto_sscf = proto_register_protocol("SSCF-NNI", "SSCF-NNI", "sscf-nni"); + + proto_register_field_array(proto_sscf, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + register_dissector("sscf-nni", dissect_sscf_nni, proto_sscf); + +} + +void +proto_reg_handoff_sscf(void) +{ + static dissector_handle_t sscf_handle; + + + sscf_handle = create_dissector_handle(dissect_sscf_nni, proto_sscf); + + mtp3_handle = find_dissector("mtp3"); + data_handle = find_dissector("data"); + +} diff --git a/epan/dissectors/packet-sscop.c b/epan/dissectors/packet-sscop.c index ae048ecf36..7fe7bfe99d 100644 --- a/epan/dissectors/packet-sscop.c +++ b/epan/dissectors/packet-sscop.c @@ -32,6 +32,7 @@ #include <glib.h> #include <string.h> #include <epan/packet.h> +#include <prefs.h> static int proto_sscop = -1; @@ -39,6 +40,30 @@ static gint ett_sscop = -1; static dissector_handle_t q2931_handle; static dissector_handle_t data_handle; +static dissector_handle_t sscf_nni_handle; + +static module_t *sscop_module; + +static range_t *global_udp_port_range; +static range_t *udp_port_range; + +static dissector_handle_t sscop_handle; + +typedef enum { + DATA_DISSECTOR = 1, + Q2931_DISSECTOR = 2, + SSCF_NNI_DISSECTOR = 3 +} Dissector_Option; + + +static enum_val_t sscop_payload_dissector_options[] = { + { "data", "Data (no further dissection)", DATA_DISSECTOR }, + { "Q.2931", "Q.2931", Q2931_DISSECTOR }, + { "SSCF-NNI", "SSCF-NNI (MTP3-b)", SSCF_NNI_DISSECTOR }, + { NULL, NULL, 0 } +}; + +static guint sscop_payload_dissector = Q2931_DISSECTOR; /* * See @@ -289,10 +314,6 @@ dissect_sscop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ reported_length -= (pdu_len + pad_len); - /* - * XXX - if more than just Q.2931 uses SSCOP, we need to tell - * SSCOP what dissector to use here. - */ if (reported_length != 0) { /* * We know that we have all of the payload, because we know we have @@ -302,14 +323,62 @@ dissect_sscop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ next_tvb = tvb_new_subset(tvb, 0, reported_length, reported_length); if (pdu_type == SSCOP_SD) - call_dissector(q2931_handle, next_tvb, pinfo, tree); - else - call_dissector(data_handle,next_tvb, pinfo, tree); + { + if (sscop_payload_dissector == Q2931_DISSECTOR) + call_dissector(q2931_handle, next_tvb, pinfo, tree); + else if (sscop_payload_dissector == DATA_DISSECTOR) + call_dissector(data_handle, next_tvb, pinfo, tree); + else if (sscop_payload_dissector == SSCF_NNI_DISSECTOR) + call_dissector(sscf_nni_handle, next_tvb, pinfo, tree); + + } else + call_dissector(data_handle, next_tvb, pinfo, tree); } break; } } +static void range_delete_callback(guint32 port) +{ + if (port) { + dissector_delete("udp.port", port, sscop_handle); + } +} + +static void range_add_callback(guint32 port) +{ + if (port) { + dissector_add("udp.port", port, sscop_handle); + } +} +void +proto_reg_handoff_sscop(void) +{ + static int prefs_initialized = FALSE; + + if (!prefs_initialized) { + + sscop_handle = create_dissector_handle(dissect_sscop, proto_sscop); + + q2931_handle = find_dissector("q2931"); + data_handle = find_dissector("data"); + sscf_nni_handle = find_dissector("sscf-nni"); + + prefs_initialized = TRUE; + + } else { + + range_foreach(udp_port_range, range_delete_callback); + + } + + g_free(udp_port_range); + udp_port_range = range_copy(global_udp_port_range); + + range_foreach(udp_port_range, range_add_callback); + +} + void proto_register_sscop(void) { @@ -319,14 +388,21 @@ proto_register_sscop(void) proto_sscop = proto_register_protocol("SSCOP", "SSCOP", "sscop"); proto_register_subtree_array(ett, array_length(ett)); register_dissector("sscop", dissect_sscop, proto_sscop); -} -void -proto_reg_handoff_sscop(void) -{ - /* - * Get handle for the Q.2931 dissector. - */ - q2931_handle = find_dissector("q2931"); - data_handle = find_dissector("data"); + sscop_module = prefs_register_protocol(proto_sscop, proto_reg_handoff_sscop); + + global_udp_port_range = range_empty(); + udp_port_range = range_empty(); + + prefs_register_range_preference(sscop_module, "udp.ports", + "SSCOP UDP port range", + "Set the UDP port for SSCOP messages encapsulated in UDP (0 to disable)", + &global_udp_port_range, MAX_UDP_PORT); + + prefs_register_enum_preference(sscop_module, "payload", + "SSCOP payload protocol", + "SSCOP payload (dissector to call on SSCOP payload)", + (gint *)&sscop_payload_dissector, + sscop_payload_dissector_options, FALSE); } + |