33b2c8c1bdfc8d456135eccd4e7ca3719f63442b
[jlayton/wireshark.git] / epan / dissectors / packet-mtp3.h
1 /* packet-mtp3.h
2  *
3  * $Id$
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 #ifndef __PACKET_MTP3_H_
24 #define __PACKET_MTP3_H_
25
26 typedef enum {
27   ITU_STANDARD  = 1,
28   ANSI_STANDARD = 2,
29   CHINESE_ITU_STANDARD = 3,
30   JAPAN_STANDARD = 4
31 } Standard_Type;
32 #define HEURISTIC_FAILED_STANDARD 0xffff
33
34 extern gint mtp3_standard;
35 extern gboolean mtp3_heuristic_standard;
36
37 WS_VAR_IMPORT const value_string mtp3_standard_vals[];
38
39 typedef enum {
40   MTP3_ADDR_FMT_DEC     = 1,
41   MTP3_ADDR_FMT_HEX     = 2,
42   MTP3_ADDR_FMT_NI_DEC  = 3,
43   MTP3_ADDR_FMT_NI_HEX  = 4,
44   MTP3_ADDR_FMT_DASHED  = 5
45 } mtp3_net_addr_fmt_e;
46
47 typedef struct _mtp3_addr_pc_t {
48   Standard_Type         type;
49   guint32               pc;
50   guint8                ni;
51 } mtp3_addr_pc_t;
52
53 typedef struct _mtp3_tap_rec_t {
54   mtp3_addr_pc_t        addr_opc;
55   mtp3_addr_pc_t        addr_dpc;
56   guint8                si_code;
57   guint16               size;
58 } mtp3_tap_rec_t;
59
60 #define ITU_PC_LENGTH     2
61 #define ITU_PC_MASK       0x3FFF
62
63 #define ANSI_PC_LENGTH    3
64 #define ANSI_NCM_LENGTH   1
65 #define ANSI_NETWORK_OFFSET 2
66 #define ANSI_CLUSTER_OFFSET 1
67 #define ANSI_MEMBER_OFFSET 0
68 #define ANSI_PC_MASK      0xFFFFFF
69 #define ANSI_NETWORK_MASK 0xFF0000
70 #define ANSI_CLUSTER_MASK 0x00FF00
71 #define ANSI_MEMBER_MASK  0x0000FF
72 #define ANSI_PC_STRING_LENGTH 16
73
74 #define JAPAN_PC_LENGTH   2
75 #define JAPAN_PC_MASK     0xffff
76
77 extern void     mtp3_addr_to_str_buf(const mtp3_addr_pc_t *addr_pc_p, gchar *buf, int buf_len);
78 extern void     mtp3_pc_to_str_buf(const guint32 pc, gchar *buf, int buf_len);
79 extern gchar*   mtp3_pc_to_str(const guint32 pc);
80 extern gboolean mtp3_pc_structured(void);
81 extern guint32  mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p);
82
83 #ifdef __PROTO_H__
84 /* epan/to_str.c includes this file, but it does not include proto.h so
85  * it doesn't know about things like proto_tree.  This function is not
86  * needed by to_str.c, so just don't prototype it there (or anywhere
87  * without proto.h).
88  */
89 extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset,
90                                   proto_tree *tree, gint ett_pc,
91                                   int hf_pc, int hf_pc_network,
92                                   int hf_pc_cluster, int hf_pc_member,
93                                   int hf_dpc, int pc);
94 #endif
95
96 /*
97  * the following allows TAP code access to the messages
98  * without having to duplicate it. With MSVC and a
99  * libwireshark.dll, we need a special declaration.
100  */
101 WS_VAR_IMPORT const value_string mtp3_service_indicator_code_short_vals[];
102
103 #define MTP_SI_SNM      0x0
104 #define MTP_SI_MTN      0x1
105 #define MTP_SI_MTNS     0x2
106 #define MTP_SI_SCCP     0x3
107 #define MTP_SI_TUP      0x4
108 #define MTP_SI_ISUP     0x5
109 #define MTP_SI_DUP_CC   0x6
110 #define MTP_SI_DUP_FAC  0x7
111 #define MTP_SI_MTP_TEST 0x8
112 #define MTP_SI_ISUP_B   0x9
113 #define MTP_SI_ISUP_S   0xa
114 #define MTP_SI_AAL2     0xc
115 #define MTP_SI_BICC     0xd
116 #define MTP_SI_GCP      0xe
117
118 /*
119  * I only want to gather stats for non-spare SI codes
120  */
121 #define MTP3_NUM_SI_CODE        9
122
123 #define MTP3_NI_INT0 0x0
124 #define MTP3_NI_INT1 0x1
125 #define MTP3_NI_NAT0 0x2
126 #define MTP3_NI_NAT1 0x3
127 WS_VAR_IMPORT const value_string mtp3_network_indicator_vals[];
128
129 #endif