Move 3 ASN1 dissectors to 'clean' group; move 1 PIDL dissector to 'dirty' group.
[metze/wireshark/wip.git] / epan / dissectors / packet-gmr1_common.h
1 /* packet-gmr1_common.h
2  *
3  * Headers for GMR-1 dissection in wireshark (common stuff).
4  * Copyright (c) 2011 Sylvain Munaut <tnt@246tNt.com>
5  *
6  * References:
7  *  [1] ETSI TS 101 376-4-8 V1.3.1 - GMR-1 04.008
8  *  [2] ETSI TS 101 376-4-8 V2.2.1 - GMPRS-1 04.008
9  *  [3] ETSI TS 101 376-4-8 V3.1.1 - GMR-1 3G 44.008
10  *  [4] ETSI TS 100 940 V7.21.0 - GSM 04.08
11  *  [5] ETSI TS 101 376-4-12 V3.2.1 - GMR-1 3G 44.060
12  *  [6] ETSI TS 101 376-5-6 V1.3.1 - GMR-1 05.008
13  *
14  * $Id$
15  *
16  * Wireshark - Network traffic analyzer
17  * By Gerald Combs <gerald@wireshark.org>
18  * Copyright 1998 Gerald Combs
19  *
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.
24  *
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.
29  *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33  */
34
35 #ifndef __PACKET_GMR1_COMMON_H__
36 #define __PACKET_GMR1_COMMON_H__
37
38 #include "packet-gsm_a_common.h"
39
40
41 /* Protocol descriptor (see [1] 11.2 & [4] 10.2) */
42 typedef enum {
43         GMR1_PD_CC      = 0x03,
44         GMR1_PD_MM      = 0x05,
45         GMR1_PD_RR      = 0x06,
46         GMR1_PD_GMM     = 0x08,
47         GMR1_PD_SM      = 0x0a,
48         GMR1_PD_DTRS    = 0x1e,
49 } gmr1_pd_e;
50
51 #define GMR1_PD_EXT_MSK 0x0f
52 #define GMR1_PD_EXT_VAL 0x0e
53
54 extern const value_string gmr1_pd_vals[];
55 extern const value_string gmr1_pd_short_vals[];
56
57
58 /* Common IEs */
59 enum gmr1_ie_common_idx {
60         GMR1_IE_COM_CM2,                        /* [1] 11.5.1.6 */
61         GMR1_IE_COM_SPARE_NIBBLE,               /* [1] 11.5.1.8 */
62         NUM_GMR1_IE_COMMON /* Terminator */
63 };
64
65 extern int hf_gmr1_skip_ind;
66 extern int hf_gmr1_l3_pd;
67 extern int hf_gmr1_elem_id;
68 extern int hf_gmr1_len;
69
70
71 /* Message & IEs parsing */
72
73 typedef void (*gmr1_msg_func_t)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint offset, gint len);
74
75 #define GMR1_IE_FUNC(fn_name)   \
76         static guint16 \
77         fn_name (tvbuff_t *tvb _U_, proto_tree *tree _U_, packet_info *pinfo _U_, guint32 offset _U_, guint len _U_, gchar *add_string _U_, int string_len _U_)
78
79 #define GMR1_MSG_FUNC(fn_name)  \
80         static void \
81         fn_name (tvbuff_t *tvb _U_, proto_tree *tree _U_, packet_info *pinfo _U_, gint offset, gint len)
82
83 #define GMR1_MSG_FUNC_BEGIN     \
84         gint curr_offset;       \
85         gint curr_len;          \
86         gint consumed;          \
87                                 \
88         curr_offset = offset;   \
89         curr_len = len;         \
90         consumed = 0;
91
92 #define GMR1_MSG_FUNC_END
93
94
95 extern void
96 gmr1_get_msg_params(gmr1_pd_e pd, guint8 oct, const gchar **msg_str,
97                     int *ett_tree, int *hf_idx, gmr1_msg_func_t *msg_func_p);
98
99
100 #endif /* __PACKET_GMR1_COMMON_H__ */