e038008374704d04d26bf969118227b8e9a46927
[obnox/wireshark/wip.git] / asn1 / q932 / packet-q932-ros-template.c
1 /* packet-q932-ros.c
2  * Routines for Q.932 packet dissection
3  * 2007  Tomas Kukosa
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <string.h>
31
32 #include <epan/packet.h>
33 #include <epan/prefs.h>
34 #include <epan/strutil.h>
35 #include <epan/emem.h>
36 #include <epan/asn1.h>
37
38 #include "packet-ber.h"
39 #include "packet-q932-ros.h"
40
41 #define PNAME  "Q.932 Operations Service Element"
42 #define PSNAME "Q932.ROS"
43 #define PFNAME "q932.ros"
44
45 /* Initialize the protocol and registered fields */
46 int proto_rose = -1;
47 #include "packet-q932-ros-hf.c" 
48
49 /* Initialize the subtree pointers */
50 #include "packet-q932-ros-ett.c" 
51
52 /* Preferences */
53
54 /* Subdissectors */
55 static dissector_handle_t data_handle = NULL; 
56
57 /* Gloabl variables */
58 static rose_context *rose_ctx;
59
60 static gint32 code_choice;
61 static guint32 code_local;
62 static const gchar *code_global;
63 static guint32 problem_val;
64 static gchar problem_str[64];
65 static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb;
66
67
68 #include "packet-q932-ros-fn.c" 
69
70 /*--- dissect_rose_apdu -----------------------------------------------------*/
71 int dissect_rose_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rose_context *rctx) {
72   if (rctx)
73     rose_ctx = rctx;
74   return dissect_RoseAPDU_PDU(tvb, pinfo, tree);
75 }
76
77 /*--- proto_register_rose ---------------------------------------------------*/
78 void proto_register_rose(void) {
79
80   /* List of fields */
81   static hf_register_info hf[] = {
82 #include "packet-q932-ros-hfarr.c" 
83   };
84
85   /* List of subtrees */
86   static gint *ett[] = {
87 #include "packet-q932-ros-ettarr.c" 
88   };
89
90   /* Register protocol and dissector */
91   proto_rose = proto_register_protocol(PNAME, PSNAME, PFNAME);
92   proto_set_cant_toggle(proto_rose);
93
94   /* Register fields and subtrees */
95   proto_register_field_array(proto_rose, hf, array_length(hf));
96   proto_register_subtree_array(ett, array_length(ett));
97
98 }
99
100 /*--- proto_reg_handoff_rose ------------------------------------------------*/
101 void proto_reg_handoff_rose(void) {
102   data_handle = find_dissector("data");
103 }
104
105 /*---------------------------------------------------------------------------*/