aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mtp3.h
blob: ea8494d696895cf2def89c43941b65a38787c28c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* packet-mtp3.h
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef __PACKET_MTP3_H__
#define __PACKET_MTP3_H__

#include "ws_symbol_export.h"

typedef enum {
  ITU_STANDARD  = 1,
  ANSI_STANDARD = 2,
  CHINESE_ITU_STANDARD = 3,
  JAPAN_STANDARD = 4
} Standard_Type;
#define HEURISTIC_FAILED_STANDARD 0xffff

extern gint mtp3_standard;
extern gboolean mtp3_heuristic_standard;

WS_DLL_PUBLIC const value_string mtp3_standard_vals[];

typedef enum {
  MTP3_ADDR_FMT_DEC	= 1,
  MTP3_ADDR_FMT_HEX	= 2,
  MTP3_ADDR_FMT_NI_DEC	= 3,
  MTP3_ADDR_FMT_NI_HEX	= 4,
  MTP3_ADDR_FMT_DASHED	= 5
} mtp3_net_addr_fmt_e;

typedef struct _mtp3_addr_pc_t {
  Standard_Type		type;
  guint32		pc;
  guint8		ni;
} mtp3_addr_pc_t;

typedef struct _mtp3_tap_rec_t {
  mtp3_addr_pc_t	addr_opc;
  mtp3_addr_pc_t	addr_dpc;
  guint8		mtp3_si_code;
  guint16		size;
} mtp3_tap_rec_t;

#define ITU_PC_LENGTH     2
#define ITU_PC_MASK       0x3FFF

#define ANSI_PC_LENGTH    3
#define ANSI_NCM_LENGTH   1
#define ANSI_NETWORK_OFFSET 2
#define ANSI_CLUSTER_OFFSET 1
#define ANSI_MEMBER_OFFSET 0
#define ANSI_PC_MASK      0xFFFFFF
#define ANSI_NETWORK_MASK 0xFF0000
#define ANSI_CLUSTER_MASK 0x00FF00
#define ANSI_MEMBER_MASK  0x0000FF
#define ANSI_PC_STRING_LENGTH 16

#define JAPAN_PC_LENGTH   2
#define JAPAN_PC_MASK     0xffff

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

extern gchar*   mtp3_pc_to_str(const guint32 pc);
extern gboolean mtp3_pc_structured(void);
extern guint32  mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p);
extern int mtp3_addr_len(void);

#ifdef __PROTO_H__
/* epan/to_str.c includes this file, but it does not include proto.h so
 * it doesn't know about things like proto_tree.  This function is not
 * needed by to_str.c, so just don't prototype it there (or anywhere
 * without proto.h).
 */
extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset,
				  proto_tree *tree, gint ett_pc,
				  int hf_pc_string, int hf_pc_network,
				  int hf_pc_cluster, int hf_pc_member,
				  int hf_dpc, int hf_pc);
#endif

/*
 * the following allows TAP code access to the messages
 * without having to duplicate it. With MSVC and a
 * libwireshark.dll, we need a special declaration.
 */
WS_DLL_PUBLIC const value_string mtp3_service_indicator_code_short_vals[];

#define MTP_SI_SNM	0x0
#define MTP_SI_MTN	0x1
#define MTP_SI_MTNS	0x2
#define MTP_SI_SCCP	0x3
#define MTP_SI_TUP	0x4
#define MTP_SI_ISUP	0x5
#define MTP_SI_DUP_CC	0x6
#define MTP_SI_DUP_FAC	0x7
#define MTP_SI_MTP_TEST	0x8
#define MTP_SI_ISUP_B	0x9
#define MTP_SI_ISUP_S	0xa
#define MTP_SI_AAL2	0xc
#define MTP_SI_BICC	0xd
#define MTP_SI_GCP	0xe

/*
 * I only want to gather stats for non-spare SI codes
 */
#define	MTP3_NUM_SI_CODE	9

#define MTP3_NI_INT0 0x0
#define MTP3_NI_INT1 0x1
#define MTP3_NI_NAT0 0x2
#define MTP3_NI_NAT1 0x3
WS_DLL_PUBLIC const value_string mtp3_network_indicator_vals[];

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __PACKET_MTP3_H__ */