Minor cleanup mostly related to proto_reg_handoff
[obnox/wireshark/wip.git] / asn1 / rrc / packet-rrc-template.c
1 /* packet-rrc.c
2  * Routines for Universal Mobile Telecommunications System (UMTS);
3  * Radio Resource Control (RRC) protocol specification
4  * (3GPP TS 25.331 version 6.7.0 Release 6) packet dissection
5  * Copyright 2006, Anders Broman <anders.broman@ericsson.com>
6  *
7  * $Id$
8  *
9  * Wireshark - Network traffic analyzer
10  * By Gerald Combs <gerald@wireshark.org>
11  * Copyright 1998 Gerald Combs
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  *
27  * Ref: 3GPP TS 25.423 version 6.7.0 Release 6
28  */
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <glib.h>
35 #include <epan/packet.h>
36 #include <epan/conversation.h>
37 #include <epan/asn1.h>
38
39 #include <stdio.h>
40 #include <string.h>
41
42 #include "packet-ber.h"
43 #include "packet-per.h"
44
45 #ifdef _MSC_VER
46 /* disable: "warning C4049: compiler limit : terminating line number emission" */
47 #pragma warning(disable:4049)
48 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
49 #pragma warning(disable:4146)
50 #endif
51
52 #define PNAME  "Radio Resource Control (RRC) protocol"
53 #define PSNAME "RRC"
54 #define PFNAME "rrc"
55
56 static dissector_handle_t gsm_a_dtap_handle;
57
58 /* Include constants */
59 #include "packet-rrc-val.h"
60
61 /* Initialize the protocol and registered fields */
62 static int proto_rrc = -1;
63
64 #include "packet-rrc-hf.c"
65
66 /* Initialize the subtree pointers */
67 static int ett_rrc = -1;
68
69 #include "packet-rrc-ett.c"
70
71 /* Global variables */
72 static proto_tree *top_tree;
73
74 #include "packet-rrc-fn.c"
75
76 /* 
77 TODO: Remove the dummy function when these functions are taken into use
78
79  These functions are not referenced from the ASN1 specifications
80  as this generates a lot of unsued code warings from GCC this dummy function
81  is introduced to reduce the number of warnings until the proper use is discovered
82  */
83
84 static void
85 dissect_rrc_dymmy_remove_unused_code_warnings(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_){
86
87         /* Dummy code to keep GCC happy */
88         switch(hf_index){
89                 case 0:
90                         dissect_rrc_UE_RadioAccessCapabilityInfo( tvb, offset, actx , tree, hf_index);
91                         dissect_rrc_UL_PhysChCapabilityFDD_r6( tvb, offset, actx , tree, hf_index);
92                         dissect_rrc_UE_Positioning_GANSS_Data( tvb, offset, actx , tree, hf_index);
93                         dissect_rrc_ToTargetRNC_Container( tvb, offset, actx , tree, hf_index);
94                         dissect_rrc_TargetRNC_ToSourceRNC_Container( tvb, offset, actx , tree, hf_index);
95                         break;
96                 default:
97                         break;
98         }
99 }
100
101 static void
102 dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
103 {
104         /* FIX ME Currently don't know the 'starting point' of this protocol
105          * exported DL-DCCH-Message is the entry point.
106          */
107         proto_item      *rrc_item = NULL;
108         proto_tree      *rrc_tree = NULL;
109
110         top_tree = tree;
111
112         /* make entry in the Protocol column on summary display */
113         if (check_col(pinfo->cinfo, COL_PROTOCOL))
114                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRC");
115
116         /* create the rrc protocol tree */
117         rrc_item = proto_tree_add_item(tree, proto_rrc, tvb, 0, -1, FALSE);
118         rrc_tree = proto_item_add_subtree(rrc_item, ett_rrc);
119
120 }
121 /*--- proto_register_rrc -------------------------------------------*/
122 void proto_register_rrc(void) {
123
124   /* List of fields */
125   static hf_register_info hf[] = {
126
127 #include "packet-rrc-hfarr.c"
128   };
129
130   /* List of subtrees */
131   static gint *ett[] = {
132                   &ett_rrc,
133 #include "packet-rrc-ettarr.c"
134   };
135
136
137   /* Register protocol */
138   proto_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME);
139   /* Register fields and subtrees */
140   proto_register_field_array(proto_rrc, hf, array_length(hf));
141   proto_register_subtree_array(ett, array_length(ett));
142
143   register_dissector("rrc", dissect_rrc, proto_rrc);
144
145 #include "packet-rrc-dis-reg.c"
146
147 }
148
149
150 /*--- proto_reg_handoff_rrc ---------------------------------------*/
151 void
152 proto_reg_handoff_rrc(void)
153 {
154
155         gsm_a_dtap_handle = find_dissector("gsm_a_dtap");
156
157 }
158
159