Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
[metze/wireshark/wip.git] / epan / dissectors / packet-dvb-ipdc.c
1 /* packet-dvb-ipdc.c
2  * Routines for ETSI IP Datacast ESG Bootstrap parsing
3  * Copyright 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #include "config.h"
25
26 #include <glib.h>
27
28 #include <epan/packet.h>
29
30 void proto_register_dvb_ipdc(void);
31 void proto_reg_handoff_dvb_ipdc(void);
32
33 /* Initialize the protocol and registered fields */
34 static int proto_ipdc = -1;
35
36 /* static int hf_ipdc_esg_bootstrap_xml = -1; */
37
38 /* Initialize the subtree pointers */
39 static gint ett_ipdc = -1;
40
41
42 enum {
43     DVB_IPDC_SUB_FLUTE,
44     DVB_IPDC_SUB_MAX
45 };
46
47 static dissector_handle_t sub_handles[DVB_IPDC_SUB_MAX];
48
49 #define UDP_PORT_IPDC_ESG_BOOTSTRAP 9214
50
51
52 /* Code to actually dissect the packets */
53 static void
54 dissect_ipdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
55 {
56     tvbuff_t   *next_tvb;
57     proto_tree *esg_tree = NULL;
58
59     col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPDC");
60     col_clear(pinfo->cinfo, COL_INFO);
61
62     /* call into flute */
63     if (tree) {
64         proto_item *ti;
65
66         ti = proto_tree_add_protocol_format(tree, proto_ipdc, tvb, 0, -1,
67                                             "ESG Bootstrap");
68         esg_tree = proto_item_add_subtree(ti, ett_ipdc);
69     }
70
71     next_tvb = tvb_new_subset_remaining(tvb, 0);
72     call_dissector(sub_handles[DVB_IPDC_SUB_FLUTE], next_tvb, pinfo, esg_tree);
73 }
74
75 void
76 proto_register_dvb_ipdc(void)
77 {
78 #if 0
79     static hf_register_info hf[] = {
80         {&hf_ipdc_esg_bootstrap_xml,
81          {"ESG Provider Discovery", "ipdc.bootstrap",
82           FT_STRING, BASE_NONE, NULL, 0x0, "List of ESG Providers", HFILL}}
83     };
84 #endif
85
86     static gint *ett[] = {
87         &ett_ipdc,
88     };
89
90     proto_ipdc = proto_register_protocol("ETSI IPDC Bootstrap",
91                                          "ESG Bootstrap", "dvb_ipdc");
92 #if 0
93     proto_register_field_array(proto_ipdc, hf, array_length(hf));
94 #endif
95     proto_register_subtree_array(ett, array_length(ett));
96
97     register_dissector("dvb_ipdc", dissect_ipdc, proto_ipdc);
98 }
99
100 void
101 proto_reg_handoff_dvb_ipdc(void)
102 {
103     dissector_handle_t ipdc_handle;
104
105     sub_handles[DVB_IPDC_SUB_FLUTE] = find_dissector("alc");
106
107     ipdc_handle = create_dissector_handle(dissect_ipdc, proto_ipdc);
108     dissector_add_uint("udp.port", UDP_PORT_IPDC_ESG_BOOTSTRAP, ipdc_handle);
109 }
110
111 /*
112  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
113  *
114  * Local variables:
115  * c-basic-offset: 4
116  * tab-width: 8
117  * indent-tabs-mode: nil
118  * End:
119  *
120  * vi: set shiftwidth=4 tabstop=8 expandtab:
121  * :indentSize=4:tabSize=8:noTabs=true:
122  */
123