1 /* packet-mtp3.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 #ifndef __PACKET_MTP3_H__
10 #define __PACKET_MTP3_H__
11 
12 #include "ws_symbol_export.h"
13 
14 typedef enum {
15   ITU_STANDARD  = 1,
16   ANSI_STANDARD = 2,
17   CHINESE_ITU_STANDARD = 3,
18   JAPAN_STANDARD = 4
19 } Standard_Type;
20 #define HEURISTIC_FAILED_STANDARD 0xffff
21 
22 extern gint mtp3_standard;
23 extern gboolean mtp3_heuristic_standard;
24 
25 WS_DLL_PUBLIC const value_string mtp3_standard_vals[];
26 
27 typedef enum {
28   MTP3_ADDR_FMT_DEC	= 1,
29   MTP3_ADDR_FMT_HEX	= 2,
30   MTP3_ADDR_FMT_NI_DEC	= 3,
31   MTP3_ADDR_FMT_NI_HEX	= 4,
32   MTP3_ADDR_FMT_DASHED	= 5
33 } mtp3_net_addr_fmt_e;
34 
35 typedef struct _mtp3_addr_pc_t {
36   Standard_Type		type;
37   guint32		pc;
38   guint8		ni;
39 } mtp3_addr_pc_t;
40 
41 typedef struct _mtp3_tap_rec_t {
42   mtp3_addr_pc_t	addr_opc;
43   mtp3_addr_pc_t	addr_dpc;
44   guint8		mtp3_si_code;
45   guint16		size;
46 } mtp3_tap_rec_t;
47 
48 #define ITU_PC_LENGTH     2
49 #define ITU_PC_MASK       0x3FFF
50 
51 #define ANSI_PC_LENGTH    3
52 #define ANSI_NCM_LENGTH   1
53 #define ANSI_NETWORK_OFFSET 2
54 #define ANSI_CLUSTER_OFFSET 1
55 #define ANSI_MEMBER_OFFSET 0
56 #define ANSI_PC_MASK      0xFFFFFF
57 #define ANSI_NETWORK_MASK 0xFF0000
58 #define ANSI_CLUSTER_MASK 0x00FF00
59 #define ANSI_MEMBER_MASK  0x0000FF
60 #define ANSI_PC_STRING_LENGTH 16
61 
62 #define JAPAN_PC_LENGTH   2
63 #define JAPAN_PC_MASK     0xffff
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif /* __cplusplus */
68 
69 extern gchar*   mtp3_pc_to_str(const guint32 pc);
70 extern gboolean mtp3_pc_structured(void);
71 extern guint32  mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p);
72 extern int mtp3_addr_len(void);
73 
74 #ifdef __PROTO_H__
75 /* epan/to_str.c includes this file, but it does not include proto.h so
76  * it doesn't know about things like proto_tree.  This function is not
77  * needed by to_str.c, so just don't prototype it there (or anywhere
78  * without proto.h).
79  */
80 extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset,
81 				  proto_tree *tree, gint ett_pc,
82 				  int hf_pc_string, int hf_pc_network,
83 				  int hf_pc_cluster, int hf_pc_member,
84 				  int hf_dpc, int hf_pc);
85 #endif
86 
87 /*
88  * the following allows TAP code access to the messages
89  * without having to duplicate it. With MSVC and a
90  * libwireshark.dll, we need a special declaration.
91  */
92 WS_DLL_PUBLIC const value_string mtp3_service_indicator_code_short_vals[];
93 
94 #define MTP_SI_SNM	0x0
95 #define MTP_SI_MTN	0x1
96 #define MTP_SI_MTNS	0x2
97 #define MTP_SI_SCCP	0x3
98 #define MTP_SI_TUP	0x4
99 #define MTP_SI_ISUP	0x5
100 #define MTP_SI_DUP_CC	0x6
101 #define MTP_SI_DUP_FAC	0x7
102 #define MTP_SI_MTP_TEST	0x8
103 #define MTP_SI_ISUP_B	0x9
104 #define MTP_SI_ISUP_S	0xa
105 #define MTP_SI_AAL2	0xc
106 #define MTP_SI_BICC	0xd
107 #define MTP_SI_GCP	0xe
108 
109 /*
110  * I only want to gather stats for non-spare SI codes
111  */
112 #define	MTP3_NUM_SI_CODE	9
113 
114 #define MTP3_NI_INT0 0x0
115 #define MTP3_NI_INT1 0x1
116 #define MTP3_NI_NAT0 0x2
117 #define MTP3_NI_NAT1 0x3
118 WS_DLL_PUBLIC const value_string mtp3_network_indicator_vals[];
119 
120 #ifdef __cplusplus
121 }
122 #endif /* __cplusplus */
123 
124 #endif /* __PACKET_MTP3_H__ */
125