If we implement new style dissectors, register them as such.
[obnox/wireshark/wip.git] / asn1 / h283 / packet-h283-template.c
1 /* packet-h283.c
2  * Routines for H.283 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 <glib.h>
31 #include <epan/packet.h>
32 #include <epan/prefs.h>
33 #include <epan/conversation.h>
34 #include <epan/oids.h>
35 #include <epan/asn1.h>
36
37 #include <stdio.h>
38 #include <string.h>
39
40 #include "packet-per.h"
41
42 #define PNAME  "H.283 Logical Channel Transport"
43 #define PSNAME "LCT"
44 #define PFNAME "lct"
45
46 /* Initialize the protocol and registered fields */
47 int proto_h283 = -1;
48 #include "packet-h283-hf.c"
49
50 /* Initialize the subtree pointers */
51 static int ett_h283 = -1;
52 #include "packet-h283-ett.c"
53
54 /* Dissectors */
55 static dissector_handle_t h283_udp_handle = NULL; 
56
57 /* Subdissectors */
58 static dissector_handle_t rdc_pdu_handle = NULL; 
59 static dissector_handle_t rdc_device_list_handle = NULL; 
60 static dissector_handle_t data_handle = NULL; 
61
62 static gboolean info_is_set;
63
64 #include "packet-h283-fn.c"
65
66 static int
67 dissect_h283_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
68 {
69   proto_item  *ti = NULL;
70   proto_tree  *h283_tree = NULL;
71
72   if (check_col(pinfo->cinfo, COL_PROTOCOL))
73     col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
74
75   info_is_set = FALSE;
76
77   ti = proto_tree_add_item(tree, proto_h283, tvb, 0, -1, FALSE);
78   h283_tree = proto_item_add_subtree(ti, ett_h283);
79
80   return dissect_LCTPDU_PDU(tvb, pinfo, h283_tree);
81 }
82
83 /*--- proto_register_h283 ----------------------------------------------*/
84 void proto_register_h283(void) {
85
86   /* List of fields */
87   static hf_register_info hf[] = {
88 #include "packet-h283-hfarr.c"
89   };
90
91   /* List of subtrees */
92   static gint *ett[] = {
93     &ett_h283,
94 #include "packet-h283-ettarr.c"
95   };
96
97   /* Register protocol */
98   proto_h283 = proto_register_protocol(PNAME, PSNAME, PFNAME);
99
100   /* Register fields and subtrees */
101   proto_register_field_array(proto_h283, hf, array_length(hf));
102   proto_register_subtree_array(ett, array_length(ett));
103
104   new_register_dissector(PFNAME, dissect_h283_udp, proto_h283);
105   h283_udp_handle = find_dissector(PFNAME);
106
107 }
108
109 /*--- proto_reg_handoff_h283 -------------------------------------------*/
110 void proto_reg_handoff_h283(void) 
111 {
112
113   dissector_add_handle("udp.port", h283_udp_handle); 
114
115   rdc_pdu_handle = find_dissector("rdc");
116   rdc_device_list_handle = find_dissector("rdc.device_list");
117   data_handle = find_dissector("data");
118 }
119