2 * Routines for Signalling Connection Control Part (SCCP) Management dissection
4 * It is hopefully compliant to:
7 * YDN 038-1997 (Chinese ITU variant)
8 * JT-Q714 and NTT-Q714 (Japan)
10 * Note that NTT Annex E (SCCP Management Procedure (Global Title Status
11 * Management)) is not implemented (yet)
13 * Copyright 2002, Jeff Morriss <jeff.morriss[AT]ulticom.com>
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
46 #include <epan/packet.h>
47 #include "packet-mtp3.h"
51 #define SCCPMG_MESSAGE_TYPE_SSA 0x01
52 #define SCCPMG_MESSAGE_TYPE_SSP 0x02
53 #define SCCPMG_MESSAGE_TYPE_SST 0x03
54 #define SCCPMG_MESSAGE_TYPE_SOR 0x04
55 #define SCCPMG_MESSAGE_TYPE_SOG 0x05
57 #define SCCPMG_MESSAGE_TYPE_SSC 0x06
58 /* Below are ANSI only */
59 #define SCCPMG_MESSAGE_TYPE_SBR 0xfd
60 #define SCCPMG_MESSAGE_TYPE_SNR 0xfe
61 #define SCCPMG_MESSAGE_TYPE_SRT 0xff
63 /* Same as below but with names typed out */
64 static const value_string sccpmg_message_type_values[] = {
65 { SCCPMG_MESSAGE_TYPE_SSA, "SubSystem Allowed" },
66 { SCCPMG_MESSAGE_TYPE_SSP, "SubSystem Prohibited" },
67 { SCCPMG_MESSAGE_TYPE_SST, "Subsystem Status Test" },
68 { SCCPMG_MESSAGE_TYPE_SOR, "Subsystem Out of service Request" },
69 { SCCPMG_MESSAGE_TYPE_SOG, "Subsystem Out of service Grant" },
70 { SCCPMG_MESSAGE_TYPE_SSC, "SubSystem Congested (ITU)" },
71 { SCCPMG_MESSAGE_TYPE_SBR, "Subsystem Backup Routing (ANSI)" },
72 { SCCPMG_MESSAGE_TYPE_SNR, "Subsystem Normal Routing (ANSI)" },
73 { SCCPMG_MESSAGE_TYPE_SRT, "Subsystem Routing status Test (ANSI)" },
76 /* Same as above but in acronym for (for the Info column) */
77 static const value_string sccpmg_message_type_acro_values[] = {
78 { SCCPMG_MESSAGE_TYPE_SSA, "SSA" },
79 { SCCPMG_MESSAGE_TYPE_SSP, "SSP" },
80 { SCCPMG_MESSAGE_TYPE_SST, "SST" },
81 { SCCPMG_MESSAGE_TYPE_SOR, "SOR" },
82 { SCCPMG_MESSAGE_TYPE_SOG, "SOG" },
83 { SCCPMG_MESSAGE_TYPE_SSC, "SSC" },
84 { SCCPMG_MESSAGE_TYPE_SBR, "SBR" },
85 { SCCPMG_MESSAGE_TYPE_SNR, "SNR" },
86 { SCCPMG_MESSAGE_TYPE_SRT, "SRT" },
90 #define SCCPMG_MESSAGE_TYPE_OFFSET 0
91 #define SCCPMG_MESSAGE_TYPE_LENGTH 1
93 #define SCCPMG_AFFECTED_SSN_OFFSET SCCPMG_MESSAGE_TYPE_LENGTH
94 #define SCCPMG_AFFECTED_SSN_LENGTH 1
96 #define SCCPMG_AFFECTED_PC_OFFSET (SCCPMG_AFFECTED_SSN_OFFSET + SCCPMG_AFFECTED_SSN_LENGTH)
97 #define ITU_SCCPMG_AFFECTED_PC_LENGTH 2
98 #define ANSI_SCCPMG_AFFECTED_PC_LENGTH 3
100 #define ITU_SCCPMG_SMI_OFFSET (SCCPMG_AFFECTED_PC_OFFSET + ITU_SCCPMG_AFFECTED_PC_LENGTH)
101 #define ANSI_SCCPMG_SMI_OFFSET (SCCPMG_AFFECTED_PC_OFFSET + ANSI_SCCPMG_AFFECTED_PC_LENGTH)
102 #define SCCPMG_SMI_LENGTH 1
103 #define SCCPMG_SMI_MASK 0x3
105 #define ITU_SCCPMG_CONGESTION_OFFSET (ITU_SCCPMG_SMI_OFFSET + SCCPMG_SMI_LENGTH)
106 #define ITU_SCCPMG_CONGESTION_LENGTH 1
107 #define ITU_SCCPMG_CONGESTION_MASK 0x0f
108 #define CHINESE_ITU_SCCPMG_CONGESTION_OFFSET (ANSI_SCCPMG_SMI_OFFSET + SCCPMG_SMI_LENGTH)
110 #define SCCPMG_SSN_LENGTH 1
112 /* Initialize the protocol and registered fields */
113 static int proto_sccpmg = -1;
114 static int hf_sccpmg_message_type = -1;
115 static int hf_sccpmg_affected_ssn = -1;
116 static int hf_sccpmg_affected_itu_pc = -1;
117 static int hf_sccpmg_affected_japan_pc = -1;
118 static int hf_sccpmg_affected_ansi_pc = -1;
119 static int hf_sccpmg_affected_chinese_pc = -1;
120 static int hf_sccpmg_affected_pc_member = -1;
121 static int hf_sccpmg_affected_pc_cluster = -1;
122 static int hf_sccpmg_affected_pc_network = -1;
123 static int hf_sccpmg_smi = -1;
124 static int hf_sccpmg_congestion_level = -1;
126 /* Initialize the subtree pointers */
127 static gint ett_sccpmg = -1;
128 static gint ett_sccpmg_affected_pc = -1;
131 dissect_sccpmg_unknown_message(tvbuff_t *message_tvb, proto_tree *sccpmg_tree)
133 guint32 message_length;
135 message_length = tvb_length(message_tvb);
137 proto_tree_add_text(sccpmg_tree, message_tvb, 0, message_length,
138 "Unknown message (%u byte%s)", message_length,
139 plurality(message_length, "", "s"));
143 dissect_sccpmg_affected_ssn(tvbuff_t *tvb, proto_tree *sccpmg_tree)
145 proto_tree_add_item(sccpmg_tree, hf_sccpmg_affected_ssn, tvb,
146 SCCPMG_AFFECTED_SSN_OFFSET, SCCPMG_SSN_LENGTH,
151 dissect_sccpmg_affected_pc(tvbuff_t *tvb, proto_tree *sccpmg_tree)
153 guint8 offset = SCCPMG_AFFECTED_PC_OFFSET;
155 if (mtp3_standard == ITU_STANDARD) {
156 proto_tree_add_item(sccpmg_tree, hf_sccpmg_affected_itu_pc, tvb,
157 offset, ITU_PC_LENGTH, TRUE);
158 } else if (mtp3_standard == JAPAN_STANDARD) {
159 proto_tree_add_item(sccpmg_tree, hf_sccpmg_affected_japan_pc,
160 tvb, offset, JAPAN_PC_LENGTH, TRUE);
161 } else /* ANSI_STANDARD and CHINESE_ITU_STANDARD */ {
164 if (mtp3_standard == ANSI_STANDARD)
166 hf_affected_pc = &hf_sccpmg_affected_ansi_pc;
167 } else /* CHINESE_ITU_STANDARD */ {
168 hf_affected_pc = &hf_sccpmg_affected_chinese_pc;
171 /* create and fill the PC tree */
172 dissect_mtp3_3byte_pc(tvb, offset, sccpmg_tree,
173 ett_sccpmg_affected_pc, *hf_affected_pc,
174 hf_sccpmg_affected_pc_network,
175 hf_sccpmg_affected_pc_cluster,
176 hf_sccpmg_affected_pc_member, 0, 0);
178 offset += ANSI_PC_LENGTH;
183 dissect_sccpmg_smi(tvbuff_t *tvb, proto_tree *sccpmg_tree)
187 if (mtp3_standard == ITU_STANDARD || mtp3_standard == JAPAN_STANDARD)
188 offset = ITU_SCCPMG_SMI_OFFSET;
189 else /* ANSI_STANDARD and CHINESE_ITU_STANDARD */
190 offset = ANSI_SCCPMG_SMI_OFFSET;
192 proto_tree_add_item(sccpmg_tree, hf_sccpmg_smi, tvb, offset,
193 SCCPMG_SMI_LENGTH, FALSE);
197 dissect_sccpmg_congestion_level(tvbuff_t *tvb, proto_tree *sccpmg_tree)
201 if (mtp3_standard == CHINESE_ITU_STANDARD)
202 offset = CHINESE_ITU_SCCPMG_CONGESTION_OFFSET;
203 else /* ITU_STANDARD or JAPAN_STANDARD */
204 offset = ITU_SCCPMG_CONGESTION_OFFSET;
206 proto_tree_add_item(sccpmg_tree, hf_sccpmg_congestion_level, tvb,
207 offset, ITU_SCCPMG_CONGESTION_LENGTH, FALSE);
211 dissect_sccpmg_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sccpmg_tree)
216 /* Extract the message type; all other processing is based on this */
217 message_type = tvb_get_guint8(tvb, SCCPMG_MESSAGE_TYPE_OFFSET);
218 offset = SCCPMG_MESSAGE_TYPE_LENGTH;
220 if (check_col(pinfo->cinfo, COL_INFO))
221 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_type, sccpmg_message_type_acro_values, "Unknown"));
224 /* add the message type to the protocol tree */
225 proto_tree_add_uint(sccpmg_tree, hf_sccpmg_message_type, tvb,
226 SCCPMG_MESSAGE_TYPE_OFFSET,
227 SCCPMG_MESSAGE_TYPE_LENGTH, message_type);
230 switch(message_type) {
231 case SCCPMG_MESSAGE_TYPE_SBR:
232 case SCCPMG_MESSAGE_TYPE_SNR:
233 case SCCPMG_MESSAGE_TYPE_SRT:
234 if (mtp3_standard != ANSI_STANDARD)
236 dissect_sccpmg_unknown_message(tvb, sccpmg_tree);
239 /* else fallthrough */
240 case SCCPMG_MESSAGE_TYPE_SSA:
241 case SCCPMG_MESSAGE_TYPE_SSP:
242 case SCCPMG_MESSAGE_TYPE_SST:
243 case SCCPMG_MESSAGE_TYPE_SOR:
244 case SCCPMG_MESSAGE_TYPE_SOG:
245 dissect_sccpmg_affected_ssn(tvb, sccpmg_tree);
246 dissect_sccpmg_affected_pc(tvb, sccpmg_tree);
247 dissect_sccpmg_smi(tvb, sccpmg_tree);
250 case SCCPMG_MESSAGE_TYPE_SSC:
251 if (mtp3_standard != ANSI_STANDARD)
253 dissect_sccpmg_affected_ssn(tvb, sccpmg_tree);
254 dissect_sccpmg_affected_pc(tvb, sccpmg_tree);
255 dissect_sccpmg_smi(tvb, sccpmg_tree);
256 dissect_sccpmg_congestion_level(tvb, sccpmg_tree);
258 /* else fallthrough */
261 dissect_sccpmg_unknown_message(tvb, sccpmg_tree);
266 dissect_sccpmg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
268 proto_item *sccpmg_item;
269 proto_tree *sccpmg_tree = NULL;
271 /* Make entry in the Protocol column on summary display */
272 if (check_col(pinfo->cinfo, COL_PROTOCOL))
273 switch(mtp3_standard) {
275 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCPMG (Int. ITU)");
278 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCPMG (ANSI)");
280 case CHINESE_ITU_STANDARD:
281 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SCCPMG (Chin. ITU)");
285 /* In the interest of speed, if "tree" is NULL, don't do any work not
286 necessary to generate protocol tree items. */
288 /* create the sccpmg protocol tree */
289 sccpmg_item = proto_tree_add_item(tree, proto_sccpmg, tvb, 0,
291 sccpmg_tree = proto_item_add_subtree(sccpmg_item, ett_sccpmg);
294 /* dissect the message */
295 dissect_sccpmg_message(tvb, pinfo, sccpmg_tree);
298 /* Register the protocol with Wireshark */
300 proto_register_sccpmg(void)
302 /* Setup list of header fields */
303 static hf_register_info hf[] = {
304 { &hf_sccpmg_message_type,
305 { "Message Type", "sccpmg.message_type",
306 FT_UINT8, BASE_HEX, VALS(sccpmg_message_type_values), 0x0,
308 { &hf_sccpmg_affected_ssn,
309 { "Affected SubSystem Number", "sccpmg.ssn",
310 FT_UINT8, BASE_DEC, NULL, 0x0,
312 { &hf_sccpmg_affected_itu_pc,
313 { "Affected Point Code", "sccpmg.pc",
314 FT_UINT16, BASE_DEC, NULL, ITU_PC_MASK,
316 { &hf_sccpmg_affected_japan_pc,
317 { "Affected Point Code", "sccpmg.pc",
318 FT_UINT16, BASE_DEC, NULL, 0x0,
320 { &hf_sccpmg_affected_ansi_pc,
321 { "Affected Point Code", "sccpmg.ansi_pc",
322 FT_STRING, BASE_NONE, NULL, 0x0,
324 { &hf_sccpmg_affected_chinese_pc,
325 { "Affected Point Code", "sccpmg.chinese_pc",
326 FT_STRING, BASE_NONE, NULL, 0x0,
328 { &hf_sccpmg_affected_pc_network,
329 { "Affected PC Network", "sccpmg.network",
330 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
332 { &hf_sccpmg_affected_pc_cluster,
333 { "Affected PC Cluster", "sccpmg.cluster",
334 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
336 { &hf_sccpmg_affected_pc_member,
337 { "Affected PC Member", "sccpmg.member",
338 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
341 { "Subsystem Multiplicity Indicator", "sccpmg.smi",
342 FT_UINT8, BASE_DEC, NULL, SCCPMG_SMI_MASK,
344 { &hf_sccpmg_congestion_level,
345 { "SCCP Congestionl Level (ITU)", "sccpmg.congestion",
346 FT_UINT8, BASE_DEC, NULL, ITU_SCCPMG_CONGESTION_MASK,
350 /* Setup protocol subtree array */
351 static gint *ett[] = {
353 &ett_sccpmg_affected_pc
356 /* Register the protocol name and description */
357 proto_sccpmg = proto_register_protocol("Signalling Connection Control Part Management",
360 /* Required function calls to register the header fields and subtrees
362 proto_register_field_array(proto_sccpmg, hf, array_length(hf));
363 proto_register_subtree_array(ett, array_length(ett));
367 proto_reg_handoff_sccpmg(void)
369 dissector_handle_t sccpmg_handle;
371 sccpmg_handle = create_dissector_handle(dissect_sccpmg, proto_sccpmg);
373 /* Register for SCCP SSN=1 messages */
374 dissector_add("sccp.ssn", SCCPMG_SSN, sccpmg_handle);