2 * Routines for Message Transfer Part Level 3 dissection
4 * It is (hopefully) compliant to:
7 * GF 001-9001 (Chinese ITU variant)
9 * Copyright 2001, Michael Tuexen <tuexen [AT] fh-muenster.de>
10 * Updated for ANSI and Chinese ITU support by Jeff Morriss <jeff.morriss[AT]ulticom.com>
12 * $Id: packet-mtp3.c,v 1.31 2004/07/03 12:58:41 tuexen Exp $
14 * Ethereal - Network traffic analyzer
15 * By Gerald Combs <gerald@ethereal.com>
16 * Copyright 1998 Gerald Combs
18 * Copied from README.developer
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 #ifdef NEED_SNPRINTF_H
46 #include <epan/packet.h>
50 /* Initialize the protocol and registered fields */
51 static int proto_mtp3 = -1;
53 static int mtp3_tap = -1;
55 static module_t *mtp3_module;
57 static int hf_mtp3_service_indicator = -1;
58 static int hf_mtp3_network_indicator = -1;
59 static int hf_mtp3_itu_spare = -1;
60 static int hf_mtp3_ansi_priority = -1;
61 static int hf_mtp3_itu_opc = -1;
62 static int hf_mtp3_24bit_opc = -1;
63 static int hf_mtp3_ansi_opc = -1;
64 static int hf_mtp3_chinese_opc = -1;
65 static int hf_mtp3_opc_network = -1;
66 static int hf_mtp3_opc_cluster = -1;
67 static int hf_mtp3_opc_member = -1;
68 static int hf_mtp3_itu_dpc = -1;
69 static int hf_mtp3_24bit_dpc = -1;
70 static int hf_mtp3_ansi_dpc = -1;
71 static int hf_mtp3_chinese_dpc = -1;
72 static int hf_mtp3_dpc_network = -1;
73 static int hf_mtp3_dpc_cluster = -1;
74 static int hf_mtp3_dpc_member = -1;
75 static int hf_mtp3_itu_sls = -1;
76 static int hf_mtp3_ansi_5_bit_sls = -1;
77 static int hf_mtp3_ansi_8_bit_sls = -1;
78 static int hf_mtp3_chinese_itu_sls = -1;
80 /* Initialize the subtree pointers */
81 static gint ett_mtp3 = -1;
82 static gint ett_mtp3_sio = -1;
83 static gint ett_mtp3_label = -1;
84 static gint ett_mtp3_label_dpc = -1;
85 static gint ett_mtp3_label_opc = -1;
87 static dissector_table_t mtp3_sio_dissector_table;
90 ITU_PC_STRUCTURE_NONE = 1,
91 ITU_PC_STRUCTURE_3_8_3 = 2,
92 ITU_PC_STRUCTURE_4_3_4_3 = 3
93 } ITU_PC_Structure_Type;
95 ITU_PC_Structure_Type itu_pc_structure = ITU_PC_STRUCTURE_NONE;
97 #include <packet-mtp3.h>
98 Standard_Type mtp3_standard = ITU_STANDARD;
100 static gboolean mtp3_use_ansi_5_bit_sls = FALSE;
101 static mtp3_net_addr_fmt_e mtp3_net_addr_fmt = MTP3_NET_ADDR_FMT_DASHED;
102 static mtp3_addr_pc_t mtp3_addr_dpc, mtp3_addr_opc;
106 #define ITU_ROUTING_LABEL_LENGTH 4
107 #define ITU_HEADER_LENGTH (SIO_LENGTH + ITU_ROUTING_LABEL_LENGTH)
108 #define ITU_SLS_LENGTH 1
111 #define ITU_SLS_OFFSET (SIO_OFFSET + ITU_HEADER_LENGTH - ITU_SLS_LENGTH)
112 #define ITU_ROUTING_LABEL_OFFSET (SIO_OFFSET + SIO_LENGTH)
113 #define ITU_MTP_PAYLOAD_OFFSET (SIO_OFFSET + ITU_HEADER_LENGTH)
115 #define ANSI_SLS_LENGTH 1
116 #define ANSI_ROUTING_LABEL_LENGTH (ANSI_PC_LENGTH + ANSI_PC_LENGTH + ANSI_SLS_LENGTH)
117 #define ANSI_HEADER_LENGTH (SIO_LENGTH + ANSI_ROUTING_LABEL_LENGTH)
119 #define ANSI_ROUTING_LABEL_OFFSET (SIO_OFFSET + SIO_LENGTH)
120 #define ANSI_DPC_OFFSET ANSI_ROUTING_LABEL_OFFSET
121 #define ANSI_OPC_OFFSET (ANSI_DPC_OFFSET + ANSI_PC_LENGTH)
122 #define ANSI_SLS_OFFSET (ANSI_OPC_OFFSET + ANSI_PC_LENGTH)
123 #define ANSI_MTP_PAYLOAD_OFFSET (SIO_OFFSET + ANSI_HEADER_LENGTH)
125 #define SERVICE_INDICATOR_MASK 0x0F
126 #define SPARE_MASK 0x30
127 #define ANSI_PRIORITY_MASK SPARE_MASK
128 #define NETWORK_INDICATOR_MASK 0xC0
129 #define ITU_DPC_MASK 0x00003FFF
130 #define ITU_OPC_MASK 0x0FFFC000
131 #define ITU_SLS_MASK 0xF0000000
133 #define ANSI_NETWORK_MASK 0x0000FF
134 #define ANSI_CLUSTER_MASK 0x00FF00
135 #define ANSI_MEMBER_MASK 0xFF0000
136 #define ANSI_5BIT_SLS_MASK 0x1F
137 #define ANSI_8BIT_SLS_MASK 0xFF
138 #define CHINESE_ITU_SLS_MASK 0xF
140 static const value_string mtp3_service_indicator_code_vals[] = {
141 { 0x0, "Signalling Network Management Message (SNM)" },
142 { 0x1, "Maintenance Regular Message (MTN)" },
143 { 0x2, "Maintenance Special Message (MTNS)" },
147 { 0x6, "DUP (call and circuit related messages)" },
148 { 0x7, "DUP (facility registration and cancellation message)" },
149 { 0x8, "MTP testing user part" },
160 const value_string mtp3_service_indicator_code_short_vals[] = {
168 { 0x7, "DUP (FAC/CANC)" },
173 static const value_string network_indicator_vals[] = {
174 { 0x0, "International network" },
175 { 0x1, "Spare (for international use only)" },
176 { 0x2, "National network" },
177 { 0x3, "Reserved for national use" },
181 static dissector_handle_t data_handle;
185 * helper routine to format a point code in structured form
189 mtp3_pc_to_str_buf(const guint32 pc, gchar *buf)
191 switch (mtp3_standard)
194 switch (itu_pc_structure) {
195 case ITU_PC_STRUCTURE_NONE:
196 sprintf(buf, "%u", pc);
198 case ITU_PC_STRUCTURE_3_8_3:
199 /* this format is used in international ITU networks */
200 sprintf(buf, "%u-%u-%u", (pc & 0x3800)>>11, (pc & 0x7f8) >> 3, (pc & 0x07) >> 0);
202 case ITU_PC_STRUCTURE_4_3_4_3:
203 /* this format is used in some national ITU networks, the German one for example. */
204 sprintf(buf, "%u-%u-%u-%u", (pc & 0x3c00) >>10, (pc & 0x0380) >> 7, (pc & 0x0078) >> 3, (pc & 0x0007) >> 0);
207 g_assert_not_reached();
211 case CHINESE_ITU_STANDARD:
212 sprintf(buf, "%u-%u-%u", (pc & ANSI_NETWORK_MASK), (pc & ANSI_CLUSTER_MASK) >> 8, (pc & ANSI_MEMBER_MASK) >> 16);
215 g_assert_not_reached();
219 #define MAX_STRUCTURED_PC_LENGTH 20
222 mtp3_pc_to_str(const guint32 pc)
224 static gchar str[MAX_STRUCTURED_PC_LENGTH];
226 mtp3_pc_to_str_buf(pc, str);
231 mtp3_pc_structured(void)
233 if ((mtp3_standard == ITU_STANDARD) && (itu_pc_structure == ITU_PC_STRUCTURE_NONE))
240 * helper routine to format address to string
244 mtp3_addr_to_str_buf(
248 mtp3_addr_pc_t *addr_pc_p = (mtp3_addr_pc_t *) data;
250 switch (mtp3_net_addr_fmt)
252 case MTP3_NET_ADDR_FMT_DEC:
253 switch (addr_pc_p->type)
256 sprintf(buf, "%u", addr_pc_p->pc & ITU_PC_MASK);
259 /* assuming 24-bit */
260 sprintf(buf, "%u", addr_pc_p->pc & ANSI_PC_MASK);
265 case MTP3_NET_ADDR_FMT_HEX:
266 switch (addr_pc_p->type)
269 sprintf(buf, "%x", addr_pc_p->pc & ITU_PC_MASK);
272 /* assuming 24-bit */
273 sprintf(buf, "%x", addr_pc_p->pc & ANSI_PC_MASK);
278 case MTP3_NET_ADDR_FMT_NI_DEC:
279 switch (addr_pc_p->type)
282 sprintf(buf, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK);
285 /* assuming 24-bit */
286 sprintf(buf, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK);
291 case MTP3_NET_ADDR_FMT_NI_HEX:
292 switch (addr_pc_p->type)
295 sprintf(buf, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK);
298 /* assuming 24-bit */
299 sprintf(buf, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK);
307 case MTP3_NET_ADDR_FMT_DASHED:
308 mtp3_pc_to_str_buf(addr_pc_p->pc, buf);
314 dissect_mtp3_sio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree)
317 proto_item *sio_item;
318 proto_tree *sio_tree;
320 sio_item = proto_tree_add_text(mtp3_tree, tvb, SIO_OFFSET, SIO_LENGTH, "Service information octet");
321 sio_tree = proto_item_add_subtree(sio_item, ett_mtp3_sio);
323 sio = tvb_get_guint8(tvb, SIO_OFFSET);
324 proto_tree_add_uint(sio_tree, hf_mtp3_network_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio);
326 mtp3_addr_opc.ni = (sio & NETWORK_INDICATOR_MASK) >> 6;
327 mtp3_addr_dpc.ni = (sio & NETWORK_INDICATOR_MASK) >> 6;
329 switch(mtp3_standard){
331 proto_tree_add_uint(sio_tree, hf_mtp3_ansi_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio);
334 case CHINESE_ITU_STANDARD:
335 proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio);
339 proto_tree_add_uint(sio_tree, hf_mtp3_service_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio);
341 /* Store the SI so that subidissectors know what SI this msg is */
342 pinfo->private_data = (void *)(sio & SERVICE_INDICATOR_MASK);
346 dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree)
348 guint32 label, dpc = 0, opc = 0;
349 proto_item *label_item, *label_dpc_item, *label_opc_item;
350 proto_tree *label_tree, *label_dpc_tree, *label_opc_tree;
355 switch (mtp3_standard) {
357 label_item = proto_tree_add_text(mtp3_tree, tvb, ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, "Routing label");
358 label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
360 label = tvb_get_letohl(tvb, ITU_ROUTING_LABEL_OFFSET);
362 opc = (label & ITU_OPC_MASK) >> 14;
363 dpc = label & ITU_DPC_MASK;
365 label_dpc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_dpc, tvb, ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
366 if (mtp3_pc_structured())
367 proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc));
369 label_opc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_opc, tvb, ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
370 if (mtp3_pc_structured())
371 proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc));
373 proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ITU_ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
377 case CHINESE_ITU_STANDARD:
378 if (mtp3_standard == ANSI_STANDARD)
380 hf_dpc_string = &hf_mtp3_ansi_dpc;
381 hf_opc_string = &hf_mtp3_ansi_opc;
382 } else /* CHINESE_ITU_STANDARD */ {
383 hf_dpc_string = &hf_mtp3_chinese_dpc;
384 hf_opc_string = &hf_mtp3_chinese_opc;
387 /* Create the Routing Label Tree */
388 label_item = proto_tree_add_text(mtp3_tree, tvb, ANSI_ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, "Routing label");
389 label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
391 /* create the DPC tree */
392 dpc = tvb_get_ntoh24(tvb, ANSI_DPC_OFFSET);
393 label_dpc_item = proto_tree_add_string_format(label_tree, *hf_dpc_string, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, mtp3_pc_to_str(dpc), "DPC (%s) (%u)", mtp3_pc_to_str(dpc), dpc);
394 label_dpc_tree = proto_item_add_subtree(label_dpc_item, ett_mtp3_label_dpc);
396 proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_member, tvb, ANSI_DPC_OFFSET + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, dpc);
397 proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_cluster, tvb, ANSI_DPC_OFFSET + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, dpc);
398 proto_tree_add_uint(label_dpc_tree, hf_mtp3_dpc_network, tvb, ANSI_DPC_OFFSET + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, dpc);
400 /* add full integer values of DPC as hidden for filtering purposes */
401 proto_tree_add_uint_hidden(label_dpc_tree, hf_mtp3_24bit_dpc, tvb, ANSI_DPC_OFFSET, ANSI_PC_LENGTH, dpc);
403 /* create the OPC tree */
404 opc = tvb_get_ntoh24(tvb, ANSI_OPC_OFFSET);
405 label_opc_item = proto_tree_add_string_format(label_tree, *hf_opc_string, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, mtp3_pc_to_str(opc), "OPC (%s) (%u)", mtp3_pc_to_str(opc), opc);
406 label_opc_tree = proto_item_add_subtree(label_opc_item, ett_mtp3_label_opc);
408 proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_member, tvb, ANSI_OPC_OFFSET + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, opc);
409 proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_cluster, tvb, ANSI_OPC_OFFSET + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, opc);
410 proto_tree_add_uint(label_opc_tree, hf_mtp3_opc_network, tvb, ANSI_OPC_OFFSET + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, opc);
412 /* add full integer values of OPC as hidden for filtering purposes */
413 proto_tree_add_uint_hidden(label_opc_tree, hf_mtp3_24bit_opc, tvb, ANSI_OPC_OFFSET, ANSI_PC_LENGTH, opc);
416 if (mtp3_standard == ANSI_STANDARD)
418 if (mtp3_use_ansi_5_bit_sls)
419 proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE);
421 proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, ANSI_SLS_OFFSET, ANSI_SLS_LENGTH, TRUE);
422 } else /* CHINESE_ITU_STANDARD */ {
423 proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, ANSI_SLS_OFFSET, ITU_SLS_LENGTH, FALSE);
428 mtp3_addr_opc.type = mtp3_standard;
429 mtp3_addr_opc.pc = opc;
430 SET_ADDRESS(&pinfo->net_src, AT_SS7PC, sizeof(mtp3_addr_opc), (guint8 *) &mtp3_addr_opc);
432 mtp3_addr_dpc.type = mtp3_standard;
433 mtp3_addr_dpc.pc = dpc;
434 SET_ADDRESS(&pinfo->net_dst, AT_SS7PC, sizeof(mtp3_addr_dpc), (guint8 *) &mtp3_addr_dpc);
438 dissect_mtp3_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
441 guint8 service_indicator;
442 tvbuff_t *payload_tvb = NULL;
444 sio = tvb_get_guint8(tvb, SIO_OFFSET);
445 service_indicator = sio & SERVICE_INDICATOR_MASK;
447 switch (mtp3_standard) {
449 payload_tvb = tvb_new_subset(tvb, ITU_MTP_PAYLOAD_OFFSET, -1, -1);
452 case CHINESE_ITU_STANDARD:
453 payload_tvb = tvb_new_subset(tvb, ANSI_MTP_PAYLOAD_OFFSET, -1, -1);
457 if (check_col(pinfo->cinfo, COL_INFO))
458 col_set_str(pinfo->cinfo, COL_INFO, "DATA ");
460 if (!dissector_try_port(mtp3_sio_dissector_table, service_indicator, payload_tvb, pinfo, tree))
461 call_dissector(data_handle, payload_tvb, pinfo, tree);
464 /* Code to actually dissect the packets */
466 dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
468 mtp3_tap_rec_t tap_rec;
470 /* Set up structures needed to add the protocol subtree and manage it */
471 proto_item *mtp3_item = NULL;
472 proto_tree *mtp3_tree = NULL;
474 /* Make entries in Protocol column on summary display */
475 if (check_col(pinfo->cinfo, COL_PROTOCOL))
476 switch(mtp3_standard) {
478 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Int. ITU)");
481 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (ANSI)");
483 case CHINESE_ITU_STANDARD:
484 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Chin. ITU)");
489 /* create display subtree for the protocol */
490 switch (mtp3_standard) {
492 mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, ITU_HEADER_LENGTH, TRUE);
495 case CHINESE_ITU_STANDARD:
496 mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, ANSI_HEADER_LENGTH, TRUE);
499 mtp3_tree = proto_item_add_subtree(mtp3_item, ett_mtp3);
503 memset(&mtp3_addr_opc, 0, sizeof(mtp3_addr_opc));
504 memset(&mtp3_addr_dpc, 0, sizeof(mtp3_addr_dpc));
506 /* Dissect the packet (even if !tree so can call sub-dissectors and update
507 * the source and destination address columns) */
508 dissect_mtp3_sio(tvb, pinfo, mtp3_tree);
509 dissect_mtp3_routing_label(tvb, pinfo, mtp3_tree);
511 tap_rec.addr_opc = mtp3_addr_opc;
512 tap_rec.addr_dpc = mtp3_addr_dpc;
513 tap_rec.si_code = (tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK);
514 tap_rec.size = tvb_length(tvb);
516 tap_queue_packet(mtp3_tap, pinfo, &tap_rec);
518 dissect_mtp3_payload(tvb, pinfo, tree);
522 proto_register_mtp3(void)
525 /* Setup list of header fields See Section 1.6.1 for details*/
526 static hf_register_info hf[] = {
527 { &hf_mtp3_service_indicator,
528 { "Service indicator", "mtp3.service_indicator",
529 FT_UINT8, BASE_HEX, VALS(mtp3_service_indicator_code_vals), SERVICE_INDICATOR_MASK,
531 { &hf_mtp3_network_indicator,
532 { "Network indicator", "mtp3.network_indicator",
533 FT_UINT8, BASE_HEX, VALS(network_indicator_vals), NETWORK_INDICATOR_MASK,
535 { &hf_mtp3_itu_spare,
536 { "Spare", "mtp3.spare",
537 FT_UINT8, BASE_HEX, NULL, SPARE_MASK,
539 { &hf_mtp3_ansi_priority,
540 { "Priority", "mtp3.priority",
541 FT_UINT8, BASE_HEX, NULL, ANSI_PRIORITY_MASK,
545 FT_UINT32, BASE_DEC, NULL, ITU_OPC_MASK,
547 { &hf_mtp3_24bit_opc,
549 FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK,
552 { "DPC", "mtp3.ansi_opc",
553 FT_STRING, BASE_NONE, NULL, 0x0,
555 { &hf_mtp3_chinese_opc,
556 { "DPC", "mtp3.chinese_opc",
557 FT_STRING, BASE_NONE, NULL, 0x0,
559 { &hf_mtp3_opc_network,
560 { "OPC Network", "mtp3.opc.network",
561 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
563 { &hf_mtp3_opc_cluster,
564 { "OPC Cluster", "mtp3.opc.cluster",
565 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
567 { &hf_mtp3_opc_member,
568 { "OPC Member", "mtp3.opc.member",
569 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
573 FT_UINT32, BASE_DEC, NULL, ITU_DPC_MASK,
575 { &hf_mtp3_24bit_dpc,
577 FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK,
580 { "DPC", "mtp3.ansi_dpc",
581 FT_STRING, BASE_NONE, NULL, 0x0,
583 { &hf_mtp3_chinese_dpc,
584 { "DPC", "mtp3.chinese_dpc",
585 FT_STRING, BASE_NONE, NULL, 0x0,
587 { &hf_mtp3_dpc_network,
588 { "DPC Network", "mtp3.dpc.network",
589 FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK,
591 { &hf_mtp3_dpc_cluster,
592 { "DPC Cluster", "mtp3.dpc.cluster",
593 FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK,
595 { &hf_mtp3_dpc_member,
596 { "DPC Member", "mtp3.dpc.member",
597 FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK,
600 { "Signalling Link Selector", "mtp3.sls",
601 FT_UINT32, BASE_DEC, NULL, ITU_SLS_MASK,
603 { &hf_mtp3_ansi_5_bit_sls,
604 { "Signalling Link Selector", "mtp3.sls",
605 FT_UINT8, BASE_DEC, NULL, ANSI_5BIT_SLS_MASK,
607 { &hf_mtp3_ansi_8_bit_sls,
608 { "Signalling Link Selector", "mtp3.sls",
609 FT_UINT8, BASE_DEC, NULL, ANSI_8BIT_SLS_MASK,
611 { &hf_mtp3_chinese_itu_sls,
612 { "Signalling Link Selector", "mtp3.sls",
613 FT_UINT8, BASE_DEC, NULL, CHINESE_ITU_SLS_MASK,
617 /* Setup protocol subtree array */
618 static gint *ett[] = {
626 static enum_val_t mtp3_options[] = {
627 { "itu", "ITU", ITU_STANDARD },
628 { "ansi", "ANSI", ANSI_STANDARD },
629 { "chinese-itu", "Chinese ITU", CHINESE_ITU_STANDARD },
633 static enum_val_t mtp3_net_addr_fmt_str_e[] = {
634 { "decimal", "Decimal", MTP3_NET_ADDR_FMT_DEC },
635 { "hexadecimal", "Hexadecimal", MTP3_NET_ADDR_FMT_HEX },
636 { "ni-decimal", "NI-Decimal", MTP3_NET_ADDR_FMT_NI_DEC },
637 { "ni-hexadecimal", "NI-Hexadecimal", MTP3_NET_ADDR_FMT_NI_HEX },
638 { "dashed", "Dashed", MTP3_NET_ADDR_FMT_DASHED },
642 static enum_val_t itu_pc_structures[] = {
643 { "unstructured", "Unstructured", ITU_PC_STRUCTURE_NONE},
644 { "3-8-3", "3-8-3", ITU_PC_STRUCTURE_3_8_3 },
645 { "4-3-4-3", "4-3-4-3", ITU_PC_STRUCTURE_4_3_4_3 },
649 /* Register the protocol name and description */
650 proto_mtp3 = proto_register_protocol("Message Transfer Part Level 3",
652 register_dissector("mtp3", dissect_mtp3, proto_mtp3);
654 /* Required function calls to register the header fields and subtrees used */
655 proto_register_field_array(proto_mtp3, hf, array_length(hf));
656 proto_register_subtree_array(ett, array_length(ett));
658 mtp3_sio_dissector_table = register_dissector_table("mtp3.service_indicator",
659 "MTP3 Service indicator",
662 mtp3_tap = register_tap("mtp3");
664 mtp3_module = prefs_register_protocol(proto_mtp3, NULL);
666 prefs_register_enum_preference(mtp3_module, "standard", "MTP3 standard",
667 "The SS7 standard used in MTP3 packets",
668 (gint *)&mtp3_standard, mtp3_options, FALSE);
670 prefs_register_enum_preference(mtp3_module, "itu_pc_structure", "ITU Pointcode structure",
671 "The structure of the pointcodes in ITU networks",
672 (gint *)&itu_pc_structure, itu_pc_structures, FALSE);
674 prefs_register_bool_preference(mtp3_module, "ansi_5_bit_sls",
675 "Use 5-bit SLS (ANSI only)",
676 "Use 5-bit (instead of 8-bit) SLS in ANSI MTP3 packets",
677 &mtp3_use_ansi_5_bit_sls);
679 prefs_register_enum_preference(mtp3_module, "net_addr_format", "Network Address Format",
680 "Format for point code in the network address columns",
681 (gint *)&mtp3_net_addr_fmt, mtp3_net_addr_fmt_str_e, FALSE);
685 proto_reg_handoff_mtp3(void)
687 dissector_handle_t mtp3_handle;
689 mtp3_handle = create_dissector_handle(dissect_mtp3, proto_mtp3);
691 dissector_add("wtap_encap", WTAP_ENCAP_MTP3, mtp3_handle);
693 data_handle = find_dissector("data");