HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-sscf-nni.c
blob03d4ef7b956ca2252391b82875e83ced2292a021
1 /* packet-sscf-nni.c
2 * Routines for SSCF-NNI (Q.2140) frame disassembly
3 * Jeff Morriss <jeff.morriss.ws [AT] gmail.com>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998
11 * Copied from packet-sscop.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "config.h"
30 #include <glib.h>
31 #include <epan/packet.h>
33 static int proto_sscf = -1;
35 static gint ett_sscf = -1;
37 static dissector_handle_t mtp3_handle;
39 #define SSCF_PDU_LENGTH 4
40 #define SSCF_STATUS_OFFSET 3
41 #define SSCF_STATUS_LENGTH 1
42 #define SSCF_SPARE_OFFSET 0
43 #define SSCF_SPARE_LENGTH 3
45 static int hf_status = -1;
46 static int hf_spare = -1;
48 #define SSCF_STATUS_OOS 0x01
49 #define SSCF_STATUS_PO 0x02
50 #define SSCF_STATUS_IS 0x03
51 #define SSCF_STATUS_NORMAL 0x04
52 #define SSCF_STATUS_EMERGENCY 0x05
53 #define SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL 0x7
54 #define SSCF_STATUS_MANAGEMENT_INITIATED 0x08
55 #define SSCF_STATUS_PROTOCOL_ERROR 0x09
56 #define SSCF_STATUS_PROVING_NOT_SUCCESSFUL 0x0a
58 static const value_string sscf_status_vals[] = {
59 { SSCF_STATUS_OOS, "Out of Service" },
60 { SSCF_STATUS_PO, "Processor Outage" },
61 { SSCF_STATUS_IS, "In Service" },
62 { SSCF_STATUS_NORMAL, "Normal" },
63 { SSCF_STATUS_EMERGENCY, "Emergency" },
64 { SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL, "Alignment Not Successful" },
65 { SSCF_STATUS_MANAGEMENT_INITIATED, "Management Initiated" },
66 { SSCF_STATUS_PROTOCOL_ERROR, "Protocol Error" },
67 { SSCF_STATUS_PROVING_NOT_SUCCESSFUL, "Proving Not Successful" },
68 { 0, NULL }
71 static void
72 dissect_sscf_nni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
74 guint reported_length;
75 proto_item *sscf_item = NULL;
76 proto_tree *sscf_tree = NULL;
77 guint8 sscf_status;
79 reported_length = tvb_reported_length(tvb); /* frame length */
81 if (tree) {
82 sscf_item = proto_tree_add_item(tree, proto_sscf, tvb, 0, -1, ENC_NA);
83 sscf_tree = proto_item_add_subtree(sscf_item, ett_sscf);
86 if (reported_length > SSCF_PDU_LENGTH)
88 call_dissector(mtp3_handle, tvb, pinfo, tree);
90 } else {
92 sscf_status = tvb_get_guint8(tvb, SSCF_STATUS_OFFSET);
94 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SSCF-NNI");
95 col_add_fstr(pinfo->cinfo, COL_INFO, "STATUS (%s) ",
96 val_to_str_const(sscf_status, sscf_status_vals, "Unknown"));
99 proto_tree_add_item(sscf_tree, hf_status, tvb, SSCF_STATUS_OFFSET,
100 SSCF_STATUS_LENGTH, ENC_BIG_ENDIAN);
101 proto_tree_add_item(sscf_tree, hf_spare, tvb, SSCF_SPARE_OFFSET,
102 SSCF_SPARE_LENGTH, ENC_BIG_ENDIAN);
107 void
108 proto_register_sscf(void)
110 static hf_register_info hf[] =
111 { { &hf_status, { "Status", "sscf-nni.status", FT_UINT8, BASE_HEX,
112 VALS(sscf_status_vals), 0x0, NULL, HFILL} },
113 { &hf_spare, { "Spare", "sscf-nni.spare", FT_UINT24, BASE_HEX,
114 NULL, 0x0, NULL, HFILL} }
117 static gint *ett[] = {
118 &ett_sscf,
121 proto_sscf = proto_register_protocol("SSCF-NNI", "SSCF-NNI", "sscf-nni");
123 proto_register_field_array(proto_sscf, hf, array_length(hf));
124 proto_register_subtree_array(ett, array_length(ett));
126 register_dissector("sscf-nni", dissect_sscf_nni, proto_sscf);
130 void
131 proto_reg_handoff_sscf(void)
133 mtp3_handle = find_dissector("mtp3");