HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-mtp3.c
blobe835b73590916373393ce8c95ce5be8f41ac07e4
1 /* packet-mtp3.c
2 * Routines for Message Transfer Part Level 3 dissection
4 * It is (hopefully) compliant to:
5 * ANSI T1.111.4-1996
6 * ITU-T Q.704 7/1996
7 * GF 001-9001 (Chinese ITU variant)
8 * JT-Q704 and NTT-Q704 (Japan)
10 * Note that the division of the Japan SLS into the SLC and A/B bit (for
11 * management messages) is not done.
13 * Copyright 2001, Michael Tuexen <tuexen [AT] fh-muenster.de>
14 * Updated for ANSI, Chinese ITU, and Japan support by
15 * Jeff Morriss <jeff.morriss.ws [AT] gmail.com>
17 * $Id$
19 * Wireshark - Network traffic analyzer
20 * By Gerald Combs <gerald@wireshark.org>
21 * Copyright 1998 Gerald Combs
23 * Copied from README.developer
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License
27 * as published by the Free Software Foundation; either version 2
28 * of the License, or (at your option) any later version.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software
37 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
40 #include "config.h"
42 #include <string.h>
43 #include <glib.h>
45 #include <epan/packet.h>
46 #include <epan/tap.h>
47 #include <epan/prefs.h>
48 #include <epan/wmem/wmem.h>
49 #include "packet-q708.h"
50 #include "packet-sccp.h"
51 #include "packet-frame.h"
53 /* Initialize the protocol and registered fields */
54 static int proto_mtp3 = -1;
56 static int mtp3_tap = -1;
58 static module_t *mtp3_module;
60 static int hf_mtp3_service_indicator = -1;
61 static int hf_mtp3_network_indicator = -1;
62 static int hf_mtp3_itu_spare = -1;
63 static int hf_mtp3_itu_priority = -1;
64 static int hf_mtp3_ansi_priority = -1;
65 static int hf_mtp3_itu_pc = -1;
66 static int hf_mtp3_24bit_pc = -1;
67 static int hf_mtp3_itu_opc = -1;
68 static int hf_mtp3_24bit_opc = -1;
69 static int hf_mtp3_ansi_opc = -1;
70 static int hf_mtp3_chinese_opc = -1;
71 static int hf_mtp3_opc_network = -1;
72 static int hf_mtp3_opc_cluster = -1;
73 static int hf_mtp3_opc_member = -1;
74 static int hf_mtp3_itu_dpc = -1;
75 static int hf_mtp3_24bit_dpc = -1;
76 static int hf_mtp3_ansi_dpc = -1;
77 static int hf_mtp3_chinese_dpc = -1;
78 static int hf_mtp3_dpc_network = -1;
79 static int hf_mtp3_dpc_cluster = -1;
80 static int hf_mtp3_dpc_member = -1;
81 static int hf_mtp3_itu_sls = -1;
82 static int hf_mtp3_ansi_5_bit_sls = -1;
83 static int hf_mtp3_ansi_8_bit_sls = -1;
84 static int hf_mtp3_chinese_itu_sls = -1;
85 static int hf_mtp3_japan_dpc = -1;
86 static int hf_mtp3_japan_opc = -1;
87 static int hf_mtp3_japan_pc = -1;
88 static int hf_mtp3_japan_4_bit_sls = -1;
89 static int hf_mtp3_japan_4_bit_sls_spare = -1;
90 static int hf_mtp3_japan_5_bit_sls = -1;
91 static int hf_mtp3_japan_5_bit_sls_spare = -1;
93 /* Initialize the subtree pointers */
94 static gint ett_mtp3 = -1;
95 static gint ett_mtp3_sio = -1;
96 static gint ett_mtp3_label = -1;
97 static gint ett_mtp3_label_dpc = -1;
98 static gint ett_mtp3_label_opc = -1;
100 static dissector_table_t mtp3_sio_dissector_table;
102 typedef enum {
103 ITU_PC_STRUCTURE_NONE = 1,
104 ITU_PC_STRUCTURE_3_8_3 = 2,
105 ITU_PC_STRUCTURE_4_3_4_3 = 3
106 } ITU_PC_Structure_Type;
108 typedef enum {
109 JAPAN_PC_STRUCTURE_NONE = 1,
110 JAPAN_PC_STRUCTURE_7_4_5 = 2,
111 JAPAN_PC_STRUCTURE_3_4_4_5 = 3
112 } JAPAN_PC_Structure_Type;
114 static gint itu_pc_structure = ITU_PC_STRUCTURE_NONE;
115 static gint japan_pc_structure = JAPAN_PC_STRUCTURE_NONE;
117 #include <packet-mtp3.h>
118 gint mtp3_standard = ITU_STANDARD;
119 gboolean mtp3_heuristic_standard = FALSE;
121 static gint pref_mtp3_standard;
123 const value_string mtp3_standard_vals[] = {
124 { ITU_STANDARD, "ITU_STANDARD" },
125 { ANSI_STANDARD, "ANSI_STANDARD" },
126 { CHINESE_ITU_STANDARD, "CHINESE_ITU_STANDARD" },
127 { JAPAN_STANDARD, "JAPAN_STANDARD" },
128 { 0, NULL }
131 static gboolean mtp3_use_ansi_5_bit_sls = FALSE;
132 static gboolean mtp3_use_japan_5_bit_sls = FALSE;
133 static gboolean mtp3_show_itu_priority = FALSE;
134 static gint mtp3_addr_fmt = MTP3_ADDR_FMT_DASHED;
136 #define SIO_LENGTH 1
137 #define SLS_LENGTH 1
138 #define SIO_OFFSET 0
139 #define ROUTING_LABEL_OFFSET (SIO_OFFSET + SIO_LENGTH)
141 #define ITU_ROUTING_LABEL_LENGTH 4
142 #define ITU_HEADER_LENGTH (SIO_LENGTH + ITU_ROUTING_LABEL_LENGTH)
144 #define ITU_SLS_OFFSET (SIO_OFFSET + ITU_HEADER_LENGTH - SLS_LENGTH)
145 #define ITU_MTP_PAYLOAD_OFFSET (SIO_OFFSET + ITU_HEADER_LENGTH)
147 #define ANSI_ROUTING_LABEL_LENGTH (ANSI_PC_LENGTH + ANSI_PC_LENGTH + SLS_LENGTH)
148 #define ANSI_HEADER_LENGTH (SIO_LENGTH + ANSI_ROUTING_LABEL_LENGTH)
150 #define ANSI_DPC_OFFSET ROUTING_LABEL_OFFSET
151 #define ANSI_OPC_OFFSET (ANSI_DPC_OFFSET + ANSI_PC_LENGTH)
152 #define ANSI_SLS_OFFSET (ANSI_OPC_OFFSET + ANSI_PC_LENGTH)
153 #define ANSI_MTP_PAYLOAD_OFFSET (SIO_OFFSET + ANSI_HEADER_LENGTH)
155 #define JAPAN_SLS_SPARE_LENGTH 1
156 #define JAPAN_ROUTING_LABEL_LENGTH (JAPAN_PC_LENGTH + JAPAN_PC_LENGTH + JAPAN_SLS_SPARE_LENGTH)
157 #define JAPAN_HEADER_LENGTH (SIO_LENGTH + JAPAN_ROUTING_LABEL_LENGTH)
159 #define JAPAN_OPC_OFFSET (ROUTING_LABEL_OFFSET + JAPAN_PC_LENGTH)
160 #define JAPAN_SLS_OFFSET (JAPAN_OPC_OFFSET + JAPAN_PC_LENGTH)
161 #define JAPAN_SPARE_OFFSET (ROUTING_LABEL_OFFSET + JAPAN_ROUTING_LABEL_LENGTH)
162 #define JAPAN_MTP_PAYLOAD_OFFSET (SIO_OFFSET + JAPAN_HEADER_LENGTH)
164 #define SERVICE_INDICATOR_MASK 0x0F
165 #define SPARE_MASK 0x30
166 #define ANSI_PRIORITY_MASK SPARE_MASK
167 #define NETWORK_INDICATOR_MASK 0xC0
168 #define ITU_DPC_MASK 0x00003FFF
169 #define ITU_OPC_MASK 0x0FFFC000
170 #define ITU_SLS_MASK 0xF0000000
172 #define ANSI_5BIT_SLS_MASK 0x1F
173 #define ANSI_8BIT_SLS_MASK 0xFF
174 #define CHINESE_ITU_SLS_MASK 0xF
175 #define JAPAN_4_BIT_SLS_MASK 0xF
176 #define JAPAN_4_BIT_SLS_SPARE_MASK 0xF0
177 #define JAPAN_5_BIT_SLS_MASK 0x1F
178 #define JAPAN_5_BIT_SLS_SPARE_MASK 0xE0
180 /* the higher values are taken from the M3UA RFC */
181 static const value_string mtp3_service_indicator_code_vals[] = {
182 { MTP_SI_SNM, "Signalling Network Management Message (SNM)" },
183 { MTP_SI_MTN, "Maintenance Regular Message (MTN)" },
184 { MTP_SI_MTNS, "Maintenance Special Message (MTNS)" },
185 { MTP_SI_SCCP, "SCCP" },
186 { MTP_SI_TUP, "TUP" },
187 { MTP_SI_ISUP, "ISUP" },
188 { MTP_SI_DUP_CC, "DUP (call and circuit related messages)" },
189 { MTP_SI_DUP_FAC, "DUP (facility registration and cancellation message)" },
190 { MTP_SI_MTP_TEST, "MTP testing user part" },
191 { MTP_SI_ISUP_B, "Broadband ISUP" },
192 { MTP_SI_ISUP_S, "Satellite ISUP" },
193 { 0xb, "Spare" },
194 { MTP_SI_AAL2, "AAL type2 Signaling" },
195 { MTP_SI_BICC, "Bearer Independent Call Control (BICC)" },
196 { MTP_SI_GCP, "Gateway Control Protocol" },
197 { 0xf, "Spare" },
198 { 0, NULL }
201 const value_string mtp3_service_indicator_code_short_vals[] = {
202 { MTP_SI_SNM, "SNM" },
203 { MTP_SI_MTN, "MTN" },
204 { MTP_SI_MTNS, "MTNS" },
205 { MTP_SI_SCCP, "SCCP" },
206 { MTP_SI_TUP, "TUP" },
207 { MTP_SI_ISUP, "ISUP" },
208 { MTP_SI_DUP_CC, "DUP (CC)" },
209 { MTP_SI_DUP_FAC, "DUP (FAC/CANC)" },
210 { MTP_SI_MTP_TEST, "MTP Test" },
211 { MTP_SI_ISUP_B, "ISUP-b" },
212 { MTP_SI_ISUP_S, "ISUP-s" },
213 { MTP_SI_AAL2, "AAL type 2" },
214 { MTP_SI_BICC, "BICC" },
215 { MTP_SI_GCP, "GCP" },
216 { 0, NULL }
219 const value_string mtp3_network_indicator_vals[] = {
220 { MTP3_NI_INT0, "International network" },
221 { MTP3_NI_INT1, "Spare (for international use only)" },
222 { MTP3_NI_NAT0, "National network" },
223 { MTP3_NI_NAT1, "Reserved for national use" },
224 { 0, NULL }
227 static dissector_handle_t data_handle;
231 * helper routine to format a point code in structured form
234 void
235 mtp3_pc_to_str_buf(const guint32 pc, gchar *buf, int buf_len)
237 switch (mtp3_standard)
239 case ITU_STANDARD:
240 switch (itu_pc_structure) {
241 case ITU_PC_STRUCTURE_NONE:
242 g_snprintf(buf, buf_len, "%u", pc);
243 break;
244 case ITU_PC_STRUCTURE_3_8_3:
245 /* this format is used in international ITU networks */
246 g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0x3800)>>11, (pc & 0x7f8) >> 3, (pc & 0x07) >> 0);
247 break;
248 case ITU_PC_STRUCTURE_4_3_4_3:
249 /* this format is used in some national ITU networks, the German one for example. */
250 g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0x3c00) >>10, (pc & 0x0380) >> 7, (pc & 0x0078) >> 3, (pc & 0x0007) >> 0);
251 break;
252 default:
253 DISSECTOR_ASSERT_NOT_REACHED();
255 break;
256 case ANSI_STANDARD:
257 case CHINESE_ITU_STANDARD:
258 g_snprintf(buf, buf_len, "%u-%u-%u", (pc & ANSI_NETWORK_MASK) >> 16, (pc & ANSI_CLUSTER_MASK) >> 8, (pc & ANSI_MEMBER_MASK));
259 break;
260 case JAPAN_STANDARD:
261 switch (japan_pc_structure) {
262 case JAPAN_PC_STRUCTURE_NONE:
263 g_snprintf(buf, buf_len, "%u", pc);
264 break;
265 case JAPAN_PC_STRUCTURE_7_4_5:
266 /* This format is specified by NTT */
267 g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0xfe00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f));
268 break;
269 case JAPAN_PC_STRUCTURE_3_4_4_5:
270 /* Where does this format come from? */
271 g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0xe000)>>13, (pc & 0x1e00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f));
272 break;
273 default:
274 DISSECTOR_ASSERT_NOT_REACHED();
276 break;
277 default:
278 DISSECTOR_ASSERT_NOT_REACHED();
282 #define MAX_STRUCTURED_PC_LENGTH 20
284 gchar *
285 mtp3_pc_to_str(const guint32 pc)
287 gchar *str;
289 str=(gchar *)wmem_alloc(wmem_packet_scope(), MAX_STRUCTURED_PC_LENGTH);
290 mtp3_pc_to_str_buf(pc, str, MAX_STRUCTURED_PC_LENGTH);
291 return str;
294 gboolean
295 mtp3_pc_structured(void)
297 if ((mtp3_standard == ITU_STANDARD) && (itu_pc_structure == ITU_PC_STRUCTURE_NONE))
298 return FALSE;
299 else if ((mtp3_standard == JAPAN_STANDARD) && (japan_pc_structure == JAPAN_PC_STRUCTURE_NONE))
300 return FALSE;
301 else
302 return TRUE;
306 * helper routine to format address to string
309 void
310 mtp3_addr_to_str_buf(const mtp3_addr_pc_t *addr_pc_p,
311 gchar *buf, int buf_len)
313 switch (mtp3_addr_fmt)
315 case MTP3_ADDR_FMT_DEC:
316 switch (addr_pc_p->type)
318 case ITU_STANDARD:
319 g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ITU_PC_MASK);
320 break;
321 case JAPAN_STANDARD:
322 g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & JAPAN_PC_MASK);
323 break;
324 default:
325 /* assuming 24-bit */
326 g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ANSI_PC_MASK);
327 break;
329 break;
331 case MTP3_ADDR_FMT_HEX:
332 switch (addr_pc_p->type)
334 case ITU_STANDARD:
335 g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ITU_PC_MASK);
336 break;
337 case JAPAN_STANDARD:
338 g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & JAPAN_PC_MASK);
339 break;
340 default:
341 /* assuming 24-bit */
342 g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ANSI_PC_MASK);
343 break;
345 break;
347 case MTP3_ADDR_FMT_NI_DEC:
348 switch (addr_pc_p->type)
350 case ITU_STANDARD:
351 g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK);
352 break;
353 case JAPAN_STANDARD:
354 g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK);
355 break;
356 default:
357 /* assuming 24-bit */
358 g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK);
359 break;
361 break;
363 case MTP3_ADDR_FMT_NI_HEX:
364 switch (addr_pc_p->type)
366 case ITU_STANDARD:
367 g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK);
368 break;
369 case JAPAN_STANDARD:
370 g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK);
371 break;
372 default:
373 /* assuming 24-bit */
374 g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK);
375 break;
377 break;
379 default:
380 /* FALLTHRU */
382 case MTP3_ADDR_FMT_DASHED:
383 mtp3_pc_to_str_buf(addr_pc_p->pc, buf, buf_len);
384 break;
388 guint32
389 mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p) {
390 guint32 pc;
392 switch (addr_pc_p->type)
394 case ITU_STANDARD:
395 pc = (addr_pc_p->pc & ITU_PC_MASK) | ((addr_pc_p->ni % 4) << 14) ;
396 break;
397 default:
398 /* assuming 24-bit */
399 pc = (addr_pc_p->pc & ANSI_PC_MASK) | ((addr_pc_p->ni) << 24) ;
400 break;
403 return pc;
406 /* Common function for dissecting 3-byte (ANSI or China) PCs. */
407 void
408 dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, proto_tree *tree, gint ett_pc, int hf_pc_string, int hf_pc_network,
409 int hf_pc_cluster, int hf_pc_member, int hf_dpc, int hf_pc)
411 guint32 pc;
412 proto_item *pc_item, *hidden_item;
413 proto_tree *pc_tree;
414 char pc_string[MAX_STRUCTURED_PC_LENGTH];
416 pc = tvb_get_letoh24(tvb, offset);
417 mtp3_pc_to_str_buf(pc, pc_string, sizeof(pc_string));
419 pc_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string);
421 /* Add alternate formats of the PC
422 * NOTE: each of these formats is shown to the user,
423 * so I think that using hidden fields in this case is OK.
425 g_snprintf(pc_string, sizeof(pc_string), "%u", pc);
426 proto_item_append_text(pc_item, " (%s)", pc_string);
427 hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string);
428 PROTO_ITEM_SET_HIDDEN(hidden_item);
429 g_snprintf(pc_string, sizeof(pc_string), "0x%x", pc);
430 proto_item_append_text(pc_item, " (%s)", pc_string);
431 hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string);
432 PROTO_ITEM_SET_HIDDEN(hidden_item);
434 pc_tree = proto_item_add_subtree(pc_item, ett_pc);
436 proto_tree_add_uint(pc_tree, hf_pc_network, tvb, offset + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, pc);
437 proto_tree_add_uint(pc_tree, hf_pc_cluster, tvb, offset + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, pc);
438 proto_tree_add_uint(pc_tree, hf_pc_member, tvb, offset + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, pc);
440 /* add full integer values of DPC as hidden for filtering purposes */
441 if (hf_dpc) {
442 hidden_item = proto_tree_add_uint(pc_tree, hf_dpc, tvb, offset, ANSI_PC_LENGTH, pc);
443 PROTO_ITEM_SET_HIDDEN(hidden_item);
445 if (hf_pc) {
446 hidden_item = proto_tree_add_uint(pc_tree, hf_pc, tvb, offset, ANSI_PC_LENGTH, pc);
447 PROTO_ITEM_SET_HIDDEN(hidden_item);
451 static void
452 dissect_mtp3_sio(tvbuff_t *tvb, proto_tree *mtp3_tree,
453 mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc)
455 guint8 sio;
456 proto_item *sio_item;
457 proto_tree *sio_tree;
459 sio_item = proto_tree_add_text(mtp3_tree, tvb, SIO_OFFSET, SIO_LENGTH, "Service information octet");
460 sio_tree = proto_item_add_subtree(sio_item, ett_mtp3_sio);
462 sio = tvb_get_guint8(tvb, SIO_OFFSET);
463 proto_tree_add_uint(sio_tree, hf_mtp3_network_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio);
465 mtp3_addr_opc->ni = (sio & NETWORK_INDICATOR_MASK) >> 6;
466 mtp3_addr_dpc->ni = (sio & NETWORK_INDICATOR_MASK) >> 6;
468 switch(mtp3_standard){
469 case ANSI_STANDARD:
470 proto_tree_add_uint(sio_tree, hf_mtp3_ansi_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio);
471 break;
472 case ITU_STANDARD:
473 case CHINESE_ITU_STANDARD:
474 if (mtp3_show_itu_priority)
475 proto_tree_add_uint(sio_tree, hf_mtp3_itu_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio);
476 else
477 proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio);
478 break;
479 case JAPAN_STANDARD:
480 /* The Japan variant has priority but it's on the LI which belongs to
481 * layer 2. Not sure what we can do about that...
483 proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio);
484 break;
487 proto_tree_add_uint(sio_tree, hf_mtp3_service_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio);
490 static void
491 dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree,
492 mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc)
494 guint32 label, dpc, opc;
495 proto_item *label_item, *label_dpc_item, *label_opc_item;
496 proto_item *hidden_item;
497 proto_tree *label_tree;
498 proto_tree *pc_subtree;
499 int hf_dpc_string;
500 int hf_opc_string;
503 switch (mtp3_standard) {
504 case ITU_STANDARD:
505 label_item = proto_tree_add_text(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, "Routing label");
506 label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
508 label = tvb_get_letohl(tvb, ROUTING_LABEL_OFFSET);
510 opc = (label & ITU_OPC_MASK) >> 14;
511 dpc = label & ITU_DPC_MASK;
513 hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc);
514 PROTO_ITEM_SET_HIDDEN(hidden_item);
515 hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc);
516 PROTO_ITEM_SET_HIDDEN(hidden_item);
518 label_dpc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_dpc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
519 if (mtp3_pc_structured())
520 proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc));
522 if(mtp3_addr_dpc->ni == MTP3_NI_INT0) {
523 pc_subtree = proto_item_add_subtree(label_dpc_item, ett_mtp3_label_dpc);
524 analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc);
528 label_opc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_opc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
529 if (mtp3_pc_structured())
530 proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc));
532 if(mtp3_addr_opc->ni == MTP3_NI_INT0) {
533 pc_subtree = proto_item_add_subtree(label_opc_item, ett_mtp3_label_opc);
534 analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc);
537 proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);
538 break;
540 case ANSI_STANDARD:
541 case CHINESE_ITU_STANDARD:
542 if (mtp3_standard == ANSI_STANDARD)
544 hf_dpc_string = hf_mtp3_ansi_dpc;
545 hf_opc_string = hf_mtp3_ansi_opc;
546 } else /* CHINESE_ITU_STANDARD */ {
547 hf_dpc_string = hf_mtp3_chinese_dpc;
548 hf_opc_string = hf_mtp3_chinese_opc;
551 /* Create the Routing Label Tree */
552 label_item = proto_tree_add_text(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, "Routing label");
553 label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
556 /* create and fill the DPC tree */
557 dissect_mtp3_3byte_pc(tvb, ANSI_DPC_OFFSET, label_tree, ett_mtp3_label_dpc, hf_dpc_string, hf_mtp3_dpc_network,
558 hf_mtp3_dpc_cluster, hf_mtp3_dpc_member, hf_mtp3_24bit_dpc, hf_mtp3_24bit_pc);
559 /* Store dpc for mtp3_addr below */
560 dpc = tvb_get_letoh24(tvb, ANSI_DPC_OFFSET);
562 /* create and fill the OPC tree */
563 dissect_mtp3_3byte_pc(tvb, ANSI_OPC_OFFSET, label_tree, ett_mtp3_label_opc, hf_opc_string, hf_mtp3_opc_network,
564 hf_mtp3_opc_cluster, hf_mtp3_opc_member, hf_mtp3_24bit_opc, hf_mtp3_24bit_pc);
565 /* Store opc for mtp3_addr below */
566 opc = tvb_get_letoh24(tvb, ANSI_OPC_OFFSET);
568 /* SLS */
569 if (mtp3_standard == ANSI_STANDARD) {
570 if (mtp3_use_ansi_5_bit_sls)
571 proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);
572 else
573 proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);
574 } else /* CHINESE_ITU_STANDARD */ {
575 proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);
577 break;
579 case JAPAN_STANDARD:
580 label_item = proto_tree_add_text(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, JAPAN_ROUTING_LABEL_LENGTH, "Routing label");
581 label_tree = proto_item_add_subtree(label_item, ett_mtp3_label);
583 label_dpc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_dpc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);
584 dpc = tvb_get_letohs(tvb, ROUTING_LABEL_OFFSET);
585 if (mtp3_pc_structured()) {
586 proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc));
589 label_opc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_opc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);
590 opc = tvb_get_letohs(tvb, JAPAN_OPC_OFFSET);
591 if (mtp3_pc_structured()) {
592 proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc));
595 hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);
596 PROTO_ITEM_SET_HIDDEN(hidden_item);
597 hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);
598 PROTO_ITEM_SET_HIDDEN(hidden_item);
600 if (mtp3_use_japan_5_bit_sls) {
601 proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA);
602 proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA);
603 } else {
604 proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA);
605 proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA);
608 break;
609 default:
610 DISSECTOR_ASSERT_NOT_REACHED();
613 mtp3_addr_opc->type = (Standard_Type)mtp3_standard;
614 mtp3_addr_opc->pc = opc;
615 SET_ADDRESS(&pinfo->src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc);
617 mtp3_addr_dpc->type = (Standard_Type)mtp3_standard;
618 mtp3_addr_dpc->pc = dpc;
619 SET_ADDRESS(&pinfo->dst, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_dpc);
622 static void
623 dissect_mtp3_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
625 guint8 sio;
626 guint8 service_indicator;
627 tvbuff_t *payload_tvb = NULL;
629 sio = tvb_get_guint8(tvb, SIO_OFFSET);
630 service_indicator = sio & SERVICE_INDICATOR_MASK;
632 switch (mtp3_standard) {
633 case ITU_STANDARD:
634 payload_tvb = tvb_new_subset_remaining(tvb, ITU_MTP_PAYLOAD_OFFSET);
635 break;
636 case ANSI_STANDARD:
637 case CHINESE_ITU_STANDARD:
638 payload_tvb = tvb_new_subset_remaining(tvb, ANSI_MTP_PAYLOAD_OFFSET);
639 break;
640 case JAPAN_STANDARD:
641 payload_tvb = tvb_new_subset_remaining(tvb, JAPAN_MTP_PAYLOAD_OFFSET);
642 break;
643 default:
644 DISSECTOR_ASSERT_NOT_REACHED();
647 col_set_str(pinfo->cinfo, COL_INFO, "DATA ");
649 if (!dissector_try_uint(mtp3_sio_dissector_table, service_indicator, payload_tvb, pinfo, tree))
650 call_dissector(data_handle, payload_tvb, pinfo, tree);
653 static guint
654 heur_mtp3_standard(tvbuff_t *tvb, packet_info *pinfo, guint8 si)
657 guint32 len;
658 tvbuff_t *payload;
660 len = tvb_length(tvb);
661 switch (si) {
662 case MTP_SI_SCCP:
664 payload = tvb_new_subset(tvb, ITU_HEADER_LENGTH, len-ITU_HEADER_LENGTH, len-ITU_HEADER_LENGTH);
665 if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ITU_STANDARD)) {
666 return ITU_STANDARD;
668 payload = tvb_new_subset(tvb, ANSI_HEADER_LENGTH, len-ANSI_HEADER_LENGTH, len-ANSI_HEADER_LENGTH);
669 if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ANSI_STANDARD)) {
670 return ANSI_STANDARD;
672 payload = tvb_new_subset(tvb, ANSI_HEADER_LENGTH, len-ANSI_HEADER_LENGTH, len-ANSI_HEADER_LENGTH);
673 if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, CHINESE_ITU_STANDARD)) {
674 return CHINESE_ITU_STANDARD;
676 payload = tvb_new_subset(tvb, JAPAN_HEADER_LENGTH, len-JAPAN_HEADER_LENGTH, len-JAPAN_HEADER_LENGTH);
677 if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, JAPAN_STANDARD)) {
678 return JAPAN_STANDARD;
681 return HEURISTIC_FAILED_STANDARD;
684 default:
685 return HEURISTIC_FAILED_STANDARD;
690 static void
691 reset_mtp3_standard(void)
693 mtp3_standard = pref_mtp3_standard;
696 /* Code to actually dissect the packets */
697 static void
698 dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
700 mtp3_tap_rec_t* tap_rec = wmem_new0(wmem_packet_scope(), mtp3_tap_rec_t);
701 gint heuristic_standard;
702 guint8 si;
703 mtp3_addr_pc_t* mtp3_addr_dpc;
704 mtp3_addr_pc_t* mtp3_addr_opc;
706 /* Set up structures needed to add the protocol subtree and manage it */
707 proto_item *mtp3_item = NULL, *gen_item;
708 proto_tree *mtp3_tree = NULL;
710 pref_mtp3_standard = mtp3_standard;
712 mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, 0, ENC_NA);
714 si = tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK;
715 if (mtp3_heuristic_standard) {
716 heuristic_standard = heur_mtp3_standard(tvb, pinfo, si);
717 if (heuristic_standard == HEURISTIC_FAILED_STANDARD) {
718 gen_item = proto_tree_add_text(tree, tvb, 0, 0, "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown"));
719 } else {
720 gen_item = proto_tree_add_text(tree, tvb, 0, 0, "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown"));
721 mtp3_standard = heuristic_standard;
723 /* Register a frame-end routine to ensure mtp3_standard is set
724 * back even if an exception is thrown.
726 register_frame_end_routine(pinfo, reset_mtp3_standard);
728 PROTO_ITEM_SET_GENERATED(gen_item);
731 /* Make entries in Protocol column on summary display */
732 switch(mtp3_standard) {
733 case ITU_STANDARD:
734 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Int. ITU)");
735 proto_item_set_len(mtp3_item, ITU_HEADER_LENGTH);
736 break;
737 case ANSI_STANDARD:
738 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (ANSI)");
739 proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH);
740 break;
741 case CHINESE_ITU_STANDARD:
742 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Chin. ITU)");
743 proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH);
744 break;
745 case JAPAN_STANDARD:
746 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Japan)");
747 proto_item_set_len(mtp3_item, JAPAN_HEADER_LENGTH);
748 break;
751 if (tree) {
752 /* create display subtree for the protocol */
753 mtp3_tree = proto_item_add_subtree(mtp3_item, ett_mtp3);
756 mtp3_addr_opc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t));
757 mtp3_addr_dpc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t));
759 /* Dissect the packet (even if !tree so can call sub-dissectors and update
760 * the source and destination address columns) */
761 dissect_mtp3_sio(tvb, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc);
762 dissect_mtp3_routing_label(tvb, pinfo, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc);
764 memcpy(&(tap_rec->addr_opc), mtp3_addr_opc, sizeof(mtp3_addr_pc_t));
765 memcpy(&(tap_rec->addr_dpc), mtp3_addr_dpc, sizeof(mtp3_addr_pc_t));
767 tap_rec->si_code = (tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK);
768 tap_rec->size = tvb_length(tvb);
770 tap_queue_packet(mtp3_tap, pinfo, tap_rec);
772 dissect_mtp3_payload(tvb, pinfo, tree);
774 mtp3_standard = pref_mtp3_standard;
777 void
778 proto_register_mtp3(void)
781 /* Setup list of header fields See Section 1.6.1 for details*/
782 static hf_register_info hf[] = {
783 { &hf_mtp3_service_indicator, { "Service indicator", "mtp3.service_indicator", FT_UINT8, BASE_HEX, VALS(mtp3_service_indicator_code_vals), SERVICE_INDICATOR_MASK, NULL, HFILL }},
784 { &hf_mtp3_network_indicator, { "Network indicator", "mtp3.network_indicator", FT_UINT8, BASE_HEX, VALS(mtp3_network_indicator_vals), NETWORK_INDICATOR_MASK, NULL, HFILL }},
785 { &hf_mtp3_itu_spare, { "Spare", "mtp3.spare", FT_UINT8, BASE_HEX, NULL, SPARE_MASK, NULL, HFILL }},
786 { &hf_mtp3_itu_priority, { "ITU priority", "mtp3.priority", FT_UINT8, BASE_DEC, NULL, SPARE_MASK, NULL, HFILL }},
787 { &hf_mtp3_ansi_priority, { "ANSI Priority", "mtp3.priority", FT_UINT8, BASE_DEC, NULL, ANSI_PRIORITY_MASK, NULL, HFILL }},
788 { &hf_mtp3_itu_opc, { "OPC", "mtp3.opc", FT_UINT32, BASE_DEC, NULL, ITU_OPC_MASK, NULL, HFILL }},
789 { &hf_mtp3_itu_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
790 { &hf_mtp3_24bit_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK, NULL, HFILL }},
791 { &hf_mtp3_24bit_opc, { "OPC", "mtp3.opc", FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK, NULL, HFILL }},
792 { &hf_mtp3_ansi_opc, { "OPC", "mtp3.ansi_opc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
793 { &hf_mtp3_chinese_opc, { "OPC", "mtp3.chinese_opc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
794 { &hf_mtp3_opc_network, { "OPC Network", "mtp3.opc.network", FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK, NULL, HFILL }},
795 { &hf_mtp3_opc_cluster, { "OPC Cluster", "mtp3.opc.cluster", FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK, NULL, HFILL }},
796 { &hf_mtp3_opc_member, { "OPC Member", "mtp3.opc.member", FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK, NULL, HFILL }},
797 { &hf_mtp3_japan_opc, { "OPC", "mtp3.opc", FT_UINT16, BASE_DEC, NULL, JAPAN_PC_MASK, NULL, HFILL }},
798 { &hf_mtp3_japan_pc, { "PC", "mtp3.pc", FT_UINT16, BASE_DEC, NULL, JAPAN_PC_MASK, NULL, HFILL }},
799 { &hf_mtp3_itu_dpc, { "DPC", "mtp3.dpc", FT_UINT32, BASE_DEC, NULL, ITU_DPC_MASK, NULL, HFILL }},
800 { &hf_mtp3_24bit_dpc, { "DPC", "mtp3.dpc", FT_UINT32, BASE_DEC, NULL, ANSI_PC_MASK, NULL, HFILL }},
801 { &hf_mtp3_ansi_dpc, { "DPC", "mtp3.ansi_dpc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
802 { &hf_mtp3_chinese_dpc, { "DPC", "mtp3.chinese_dpc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
803 { &hf_mtp3_dpc_network, { "DPC Network", "mtp3.dpc.network", FT_UINT24, BASE_DEC, NULL, ANSI_NETWORK_MASK, NULL, HFILL }},
804 { &hf_mtp3_dpc_cluster, { "DPC Cluster", "mtp3.dpc.cluster", FT_UINT24, BASE_DEC, NULL, ANSI_CLUSTER_MASK, NULL, HFILL }},
805 { &hf_mtp3_dpc_member, { "DPC Member", "mtp3.dpc.member", FT_UINT24, BASE_DEC, NULL, ANSI_MEMBER_MASK, NULL, HFILL }},
806 { &hf_mtp3_japan_dpc, { "DPC", "mtp3.dpc", FT_UINT16, BASE_DEC, NULL, JAPAN_PC_MASK, NULL, HFILL }},
807 { &hf_mtp3_itu_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT32, BASE_DEC, NULL, ITU_SLS_MASK, NULL, HFILL }},
808 { &hf_mtp3_japan_4_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, JAPAN_4_BIT_SLS_MASK, NULL, HFILL }},
809 { &hf_mtp3_japan_4_bit_sls_spare, { "SLS Spare", "mtp3.sls_spare", FT_UINT8, BASE_HEX, NULL, JAPAN_4_BIT_SLS_SPARE_MASK, NULL, HFILL }},
810 { &hf_mtp3_japan_5_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, JAPAN_5_BIT_SLS_MASK, NULL, HFILL }},
811 { &hf_mtp3_japan_5_bit_sls_spare, { "SLS Spare", "mtp3.sls_spare", FT_UINT8, BASE_HEX, NULL, JAPAN_5_BIT_SLS_SPARE_MASK, NULL, HFILL }},
812 { &hf_mtp3_ansi_5_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, ANSI_5BIT_SLS_MASK, NULL, HFILL }},
813 { &hf_mtp3_ansi_8_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, ANSI_8BIT_SLS_MASK, NULL, HFILL }},
814 { &hf_mtp3_chinese_itu_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, CHINESE_ITU_SLS_MASK, NULL, HFILL }}
817 /* Setup protocol subtree array */
818 static gint *ett[] = {
819 &ett_mtp3,
820 &ett_mtp3_sio,
821 &ett_mtp3_label,
822 &ett_mtp3_label_dpc,
823 &ett_mtp3_label_opc
826 static const enum_val_t mtp3_options[] = {
827 { "itu", "ITU", ITU_STANDARD },
828 { "ansi", "ANSI", ANSI_STANDARD },
829 { "chinese-itu", "Chinese ITU", CHINESE_ITU_STANDARD },
830 { "japan", "Japan", JAPAN_STANDARD },
831 { NULL, NULL, 0 }
834 static const enum_val_t mtp3_addr_fmt_str_e[] = {
835 { "decimal", "Decimal", MTP3_ADDR_FMT_DEC },
836 { "hexadecimal", "Hexadecimal", MTP3_ADDR_FMT_HEX },
837 { "ni-decimal", "NI-Decimal", MTP3_ADDR_FMT_NI_DEC },
838 { "ni-hexadecimal", "NI-Hexadecimal", MTP3_ADDR_FMT_NI_HEX },
839 { "dashed", "Dashed", MTP3_ADDR_FMT_DASHED },
840 { NULL, NULL, 0 }
843 static const enum_val_t itu_pc_structures[] = {
844 { "unstructured", "Unstructured", ITU_PC_STRUCTURE_NONE},
845 { "3-8-3", "3-8-3", ITU_PC_STRUCTURE_3_8_3 },
846 { "4-3-4-3", "4-3-4-3", ITU_PC_STRUCTURE_4_3_4_3 },
847 { NULL, NULL, 0 }
850 static const enum_val_t japan_pc_structures[] = {
851 { "unstructured", "Unstructured", JAPAN_PC_STRUCTURE_NONE},
852 { "7-4-5", "7-4-5", JAPAN_PC_STRUCTURE_7_4_5 },
853 { "3-4-4-5", "3-4-4-5", JAPAN_PC_STRUCTURE_3_4_4_5 },
854 { NULL, NULL, 0 }
857 /* Register the protocol name and description */
858 proto_mtp3 = proto_register_protocol("Message Transfer Part Level 3",
859 "MTP3", "mtp3");
860 register_dissector("mtp3", dissect_mtp3, proto_mtp3);
862 /* Required function calls to register the header fields and subtrees used */
863 proto_register_field_array(proto_mtp3, hf, array_length(hf));
864 proto_register_subtree_array(ett, array_length(ett));
866 mtp3_sio_dissector_table = register_dissector_table("mtp3.service_indicator",
867 "MTP3 Service indicator",
868 FT_UINT8, BASE_HEX);
870 mtp3_tap = register_tap("mtp3");
872 mtp3_module = prefs_register_protocol(proto_mtp3, NULL);
874 prefs_register_bool_preference(mtp3_module, "heuristic_standard",
875 "Try to determine the MTP3 standard heuristically",
876 "This only works for SCCP traffic for now",
877 &mtp3_heuristic_standard);
879 prefs_register_enum_preference(mtp3_module, "standard", "MTP3 standard",
880 "The SS7 standard used in MTP3 packets",
881 &mtp3_standard, mtp3_options, FALSE);
883 prefs_register_enum_preference(mtp3_module, "itu_pc_structure", "ITU Pointcode structure",
884 "The structure of the pointcodes in ITU networks",
885 &itu_pc_structure, itu_pc_structures, FALSE);
887 prefs_register_enum_preference(mtp3_module, "japan_pc_structure", "Japan Pointcode structure",
888 "The structure of the pointcodes in Japan networks",
889 &japan_pc_structure, japan_pc_structures, FALSE);
891 prefs_register_bool_preference(mtp3_module, "ansi_5_bit_sls",
892 "Use 5-bit SLS (ANSI only)",
893 "Use 5-bit (instead of 8-bit) SLS in ANSI MTP3 packets",
894 &mtp3_use_ansi_5_bit_sls);
896 prefs_register_bool_preference(mtp3_module, "japan_5_bit_sls",
897 "Use 5-bit SLS (Japan only)",
898 "Use 5-bit (instead of 4-bit) SLS in Japan MTP3 packets",
899 &mtp3_use_japan_5_bit_sls);
901 prefs_register_enum_preference(mtp3_module, "addr_format", "Address Format",
902 "Format for point code in the address columns",
903 &mtp3_addr_fmt, mtp3_addr_fmt_str_e, FALSE);
905 prefs_register_bool_preference(mtp3_module, "itu_priority",
906 "Show MSU priority (national option, ITU and China ITU only)",
907 "Decode the spare bits of the SIO as the MSU priority (a national option in ITU)",
908 &mtp3_show_itu_priority);
912 void
913 proto_reg_handoff_mtp3(void)
915 dissector_handle_t mtp3_handle;
917 mtp3_handle = find_dissector("mtp3");
918 dissector_add_uint("wtap_encap", WTAP_ENCAP_MTP3, mtp3_handle);
919 dissector_add_string("tali.opcode", "mtp3", mtp3_handle);
921 data_handle = find_dissector("data");