From Tomas Kukosa:
[obnox/wireshark/wip.git] / plugins / plugin_api_list.c
1 /* plugin_api_list.c
2  * Used to generate various included files for plugin API
3  *
4  * $Id: plugin_api_list.c,v 1.7 2003/09/24 18:35:08 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <epan/packet.h>
30 #include <epan/conversation.h>
31 #include "prefs.h"
32 #include "reassemble.h"
33 #include "packet-giop.h"
34 #include "packet-per.h"
35 #include "packet-tpkt.h"
36 #include "packet-tcp.h"
37 #include "tap.h"
38 #include "asn1.h"
39 #include "epan/except.h"
40
41 gint check_col(column_info*, gint);
42 void col_clear(column_info*, gint);
43 void col_add_fstr(column_info*, gint, const gchar*, ...);
44 void col_append_fstr(column_info*, gint, const gchar*, ...);
45 void col_prepend_fstr(column_info*, gint, const gchar*, ...);
46 void col_add_str(column_info*, gint, const gchar*);
47 void col_append_str(column_info*, gint, const gchar*);
48 void col_set_str(column_info*, gint, gchar*);
49
50 void register_init_routine(void (*func)(void));
51 void register_postseq_cleanup_routine(void (*func)(void));
52
53 gchar* match_strval(guint32, const value_string*);
54 gchar* val_to_str(guint32, const value_string *, const char *);
55
56 conversation_t *conversation_new(address *, address *,
57     port_type, guint32, guint32, guint);
58 conversation_t *find_conversation(address *, address *,
59     port_type, guint32, guint32, guint);
60 void conversation_set_dissector(conversation_t *,
61     dissector_handle_t);
62
63 int proto_register_protocol(char*, char*, char*);
64 void proto_register_field_array(int, hf_register_info*, int);
65 void proto_register_subtree_array(int**, int);
66
67 void dissector_add(const char *, guint32, dissector_handle_t);
68 void dissector_delete(const char *, guint32,
69     dissector_handle_t);
70 void dissector_add_handle(const char *,
71     dissector_handle_t);
72
73 void heur_dissector_add(const char *, heur_dissector_t, int);
74
75 void register_dissector(const char *, dissector_t, int);
76 dissector_handle_t find_dissector(const char *);
77 dissector_handle_t create_dissector_handle(dissector_t dissector,
78     int proto);
79 int call_dissector(dissector_handle_t, tvbuff_t *,
80     packet_info *, proto_tree *);
81
82 void tcp_dissect_pdus(tvbuff_t *, packet_info *, proto_tree *,
83     gboolean, guint, guint (*)(tvbuff_t *, int),
84     void (*)(tvbuff_t *, packet_info *, proto_tree *));
85
86 gboolean proto_is_protocol_enabled(int);
87
88 int proto_item_get_len(proto_item*);
89 void proto_item_set_len(proto_item*, gint);
90 void proto_item_set_text(proto_item*, const char*, ...);
91 void proto_item_append_text(proto_item*, const char*, ...);
92 proto_tree* proto_item_add_subtree(proto_item*, gint);
93 proto_item* proto_tree_add_item(proto_tree*, int, tvbuff_t*, gint, gint, gboolean);
94 proto_item* proto_tree_add_item_hidden(proto_tree*, int, tvbuff_t*, gint, gint, gboolean);
95 proto_item* proto_tree_add_protocol_format(proto_tree*, int, tvbuff_t*, gint, gint, const char*, ...);
96
97 proto_item* proto_tree_add_bytes(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
98 proto_item* proto_tree_add_bytes_hidden(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
99 proto_item* proto_tree_add_bytes_format(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*, const char*, ...);
100
101 proto_item* proto_tree_add_time(proto_tree*, int, tvbuff_t*, gint, gint, nstime_t*);
102 proto_item* proto_tree_add_time_hidden(proto_tree*, int, tvbuff_t*, gint, gint, nstime_t*);
103 proto_item* proto_tree_add_time_format(proto_tree*, int, tvbuff_t*, gint, gint, nstime_t*, const char*, ...);
104
105 proto_item* proto_tree_add_ipxnet(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
106 proto_item* proto_tree_add_ipxnet_hidden(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
107 proto_item* proto_tree_add_ipxnet_format(proto_tree*, int, tvbuff_t*, gint, gint, guint32, const char*, ...);
108
109 proto_item* proto_tree_add_ipv4(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
110 proto_item* proto_tree_add_ipv4_hidden(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
111 proto_item* proto_tree_add_ipv4_format(proto_tree*, int, tvbuff_t*, gint, gint, guint32, const char*, ...);
112
113 proto_item* proto_tree_add_ipv6(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
114 proto_item* proto_tree_add_ipv6_hidden(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
115 proto_item* proto_tree_add_ipv6_format(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*, const char*, ...);
116
117 proto_item* proto_tree_add_ether(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
118 proto_item* proto_tree_add_ether_hidden(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*);
119 proto_item* proto_tree_add_ether_format(proto_tree*, int, tvbuff_t*, gint, gint, const guint8*, const char*, ...);
120
121 proto_item* proto_tree_add_string(proto_tree*, int, tvbuff_t*, gint, gint, const char*);
122 proto_item* proto_tree_add_string_hidden(proto_tree*, int, tvbuff_t*, gint, gint, const char*);
123 proto_item* proto_tree_add_string_format(proto_tree*, int, tvbuff_t*, gint, gint, const char*, const char*, ...);
124
125 proto_item* proto_tree_add_boolean(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
126 proto_item* proto_tree_add_boolean_hidden(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
127 proto_item* proto_tree_add_boolean_format(proto_tree*, int, tvbuff_t*, gint, gint, guint32, const char*, ...);
128
129 proto_item* proto_tree_add_double(proto_tree*, int, tvbuff_t*, gint, gint, double);
130 proto_item* proto_tree_add_double_hidden(proto_tree*, int, tvbuff_t*, gint, gint, double);
131 proto_item* proto_tree_add_double_format(proto_tree*, int, tvbuff_t*, gint, gint, double, const char*, ...);
132
133 proto_item* proto_tree_add_uint(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
134 proto_item* proto_tree_add_uint_hidden(proto_tree*, int, tvbuff_t*, gint, gint, guint32);
135 proto_item* proto_tree_add_uint_format(proto_tree*, int, tvbuff_t*, gint, gint, guint32, const char*, ...);
136
137 proto_item* proto_tree_add_int(proto_tree*, int, tvbuff_t*, gint, gint, gint32);
138 proto_item* proto_tree_add_int_hidden(proto_tree*, int, tvbuff_t*, gint, gint, gint32);
139 proto_item* proto_tree_add_int_format(proto_tree*, int, tvbuff_t*, gint, gint, gint32, const char*, ...);
140
141 proto_item* proto_tree_add_text(proto_tree*, tvbuff_t*, gint, gint, const char*, ...);
142
143 tvbuff_t* tvb_new_subset(tvbuff_t*, gint, gint, gint);
144
145 void tvb_set_free_cb(tvbuff_t*, tvbuff_free_cb_t);
146 void tvb_set_child_real_data_tvbuff(tvbuff_t*, tvbuff_t*);
147 tvbuff_t* tvb_new_real_data(const guint8*, guint, gint);
148
149 guint tvb_length(tvbuff_t*);
150 gint tvb_length_remaining(tvbuff_t*, gint);
151 gboolean tvb_bytes_exist(tvbuff_t*, gint, gint);
152 gboolean tvb_offset_exists(tvbuff_t*, gint);
153 guint tvb_reported_length(tvbuff_t*);
154 gint tvb_reported_length_remaining(tvbuff_t*, gint);
155
156 guint8 tvb_get_guint8(tvbuff_t*, gint);
157
158 guint16 tvb_get_ntohs(tvbuff_t*, gint);
159 guint32 tvb_get_ntoh24(tvbuff_t*, gint);
160 guint32 tvb_get_ntohl(tvbuff_t*, gint);
161
162 guint16 tvb_get_letohs(tvbuff_t*, gint);
163 guint32 tvb_get_letoh24(tvbuff_t*, gint);
164 guint32 tvb_get_letohl(tvbuff_t*, gint);
165
166 guint8* tvb_memcpy(tvbuff_t*, guint8* target, gint, gint);
167 guint8* tvb_memdup(tvbuff_t*, gint, gint);
168
169 const guint8* tvb_get_ptr(tvbuff_t*, gint, gint);
170
171 gint tvb_find_guint8(tvbuff_t*, gint, gint, guint8);
172 gint tvb_pbrk_guint8(tvbuff_t *, gint, gint, guint8 *);
173
174 gint tvb_strnlen(tvbuff_t*, gint, guint);
175
176 guint8 * tvb_format_text(tvbuff_t*, gint, gint);
177
178 gint tvb_get_nstringz(tvbuff_t*, gint, guint, guint8*);
179 gint tvb_get_nstringz0(tvbuff_t*, gint, guint, guint8*);
180
181 gint tvb_find_line_end(tvbuff_t*, gint, int, gint *, gboolean);
182 gint tvb_find_line_end_unquoted(tvbuff_t*, gint, int, gint *);
183
184 gint tvb_strneql(tvbuff_t*, gint, const guint8 *, gint);
185 gint tvb_strncaseeql(tvbuff_t*, gint, const guint8 *, gint);
186
187 gchar *tvb_bytes_to_str(tvbuff_t*, gint, gint len);
188
189 struct pref_module *prefs_register_protocol(int,
190     void (*)(void));
191 void prefs_register_uint_preference(struct pref_module *,
192     const char *, const char *, const char *, guint, guint *);
193 void prefs_register_bool_preference(struct pref_module *,
194     const char *, const char *, const char *, gboolean *);
195 void prefs_register_enum_preference(struct pref_module *,
196     const char *, const char *, const char *, gint *, const enum_val_t *,
197     gboolean);
198 void prefs_register_string_preference(struct pref_module *,
199     const char *, const char *, const char *, char**);
200
201 void register_giop_user(giop_sub_dissector_t *, gchar *, int);
202 gboolean is_big_endian(MessageHeader *);
203 guint32 get_CDR_encap_info(tvbuff_t *, proto_tree *, gint *,
204                 gboolean, guint32, gboolean *, guint32 *);
205 void get_CDR_any(tvbuff_t *, proto_tree *, gint *,
206                 gboolean, int, MessageHeader *);
207 gboolean get_CDR_boolean(tvbuff_t *, int *);
208 guint8 get_CDR_char(tvbuff_t *, int *);
209 gdouble get_CDR_double(tvbuff_t *, int *, gboolean, int);
210 guint32 get_CDR_enum(tvbuff_t *, int *, gboolean, int);
211 void get_CDR_fixed(tvbuff_t *, gchar **, gint *, guint32,
212                 gint32);
213 gfloat get_CDR_float(tvbuff_t *, int *, gboolean, int);
214 void get_CDR_interface(tvbuff_t *, packet_info *, proto_tree *,
215                 int *, gboolean, int);
216 gint32 get_CDR_long(tvbuff_t *, int *, gboolean, int);
217 void get_CDR_object(tvbuff_t *, packet_info *, proto_tree *,
218                 int *, gboolean, int);
219 guint8 get_CDR_octet(tvbuff_t *, int *);
220 void get_CDR_octet_seq(tvbuff_t *, gchar **, int *, guint32);
221 gint16 get_CDR_short(tvbuff_t *, int *, gboolean, int);
222 guint32 get_CDR_string(tvbuff_t *, gchar **, int *, gboolean,
223                 int);
224 guint32 get_CDR_typeCode(tvbuff_t *, proto_tree *, gint *,
225         gboolean, int, MessageHeader *);
226 guint32 get_CDR_ulong(tvbuff_t *, int *, gboolean, int);
227 guint16 get_CDR_ushort(tvbuff_t *, int *, gboolean, int);
228 gint get_CDR_wchar(tvbuff_t *, gchar **, int *,
229                 MessageHeader *);
230 guint32 get_CDR_wstring(tvbuff_t *, gchar **, int *, gboolean,
231                 int, MessageHeader *);
232
233 int is_tpkt(tvbuff_t *, int);
234 void dissect_tpkt_encap(tvbuff_t *, packet_info *,
235     proto_tree *, gboolean, dissector_handle_t);
236
237 void set_actual_length(tvbuff_t *, guint);
238
239 const char *decode_boolean_bitfield(guint32, guint32, int,
240     const char *, const char *);
241 const char *decode_numeric_bitfield(guint32, guint32, int,
242     const char *);
243 const char *decode_enumerated_bitfield(guint32, guint32, int,
244     const value_string *, const char *);
245
246 dissector_table_t register_dissector_table(const char *, char *, ftenum_t ,int );
247 void except_throw(long, long, const char *);
248 gboolean dissector_try_port(dissector_table_t, guint32, tvbuff_t *, packet_info *, proto_tree *);
249
250 void conversation_add_proto_data(conversation_t *, int, void *);
251 void *conversation_get_proto_data(conversation_t *, int);
252 void conversation_delete_proto_data(conversation_t *, int);
253 void p_add_proto_data(frame_data *, int, void *);
254 void *p_get_proto_data(frame_data *, int);
255
256 gchar*  ip_to_str(const guint8 *);
257 char*   ip6_to_str(const struct e_in6_addr *);
258 gchar*  time_secs_to_str(guint32);
259 gchar*  time_msecs_to_str(guint32);
260 gchar*  abs_time_to_str(nstime_t*);
261
262 int proto_get_id_by_filter_name(gchar* filter_name);
263 char *proto_get_protocol_name(int n);
264 char *proto_get_protocol_short_name(int proto_id);
265 char *proto_get_protocol_filter_name(int proto_id);
266
267 void prefs_register_obsolete_preference(module_t *, const char *);
268
269 void add_new_data_source(packet_info *, tvbuff_t *, char *);
270
271 void fragment_table_init(GHashTable **);
272 void reassembled_table_init(GHashTable **);
273 fragment_data *fragment_add(tvbuff_t *, int, packet_info *, guint32,
274                         GHashTable *, guint32, guint32, gboolean);
275 fragment_data *fragment_add_seq(tvbuff_t *, int, packet_info *, guint32,
276                         GHashTable *, guint32, guint32, gboolean);
277 fragment_data *fragment_add_seq_check(tvbuff_t *, int, packet_info *, guint32 id,
278                         GHashTable *, GHashTable *, guint32, guint32, gboolean);
279 fragment_data *fragment_add_seq_next(tvbuff_t *, int, packet_info *, guint32,
280                         GHashTable *, GHashTable *, guint32, gboolean);
281 fragment_data *fragment_get(packet_info *, guint32, GHashTable *);
282 void fragment_set_tot_len(packet_info *, guint32, GHashTable *, guint32);
283 guint32 fragment_get_tot_len(packet_info *, guint32, GHashTable *);
284 void fragment_set_partial_reassembly(packet_info *, guint32, GHashTable *);
285 unsigned char *fragment_delete(packet_info *, guint32, GHashTable *);
286 gboolean show_fragment_tree(fragment_data *, const fragment_items *, proto_tree *, packet_info *, tvbuff_t *);
287 gboolean show_fragment_seq_tree(fragment_data *, const fragment_items *, proto_tree *, packet_info *, tvbuff_t *);
288
289 int register_tap(char *);
290 void tap_queue_packet(int, packet_info *, void *);
291
292 void asn1_open(ASN1_SCK *, tvbuff_t *, int );
293 void asn1_close(ASN1_SCK *, int *);
294 int asn1_octet_decode(ASN1_SCK *, guchar *);
295 int asn1_tag_decode(ASN1_SCK *, guint *);
296 int asn1_id_decode(ASN1_SCK *, guint *, guint *, guint *);
297 int asn1_length_decode(ASN1_SCK *, gboolean *, guint *);
298 int asn1_header_decode(ASN1_SCK *, guint *, guint *, guint *,
299                         gboolean *, guint *);
300 int asn1_eoc(ASN1_SCK *, int );
301 int asn1_eoc_decode(ASN1_SCK *, int );
302 int asn1_null_decode(ASN1_SCK *, int );
303 int asn1_bool_decode(ASN1_SCK *, int , gboolean *);
304 int asn1_int32_value_decode(ASN1_SCK *, int , gint32 *);
305 int asn1_int32_decode(ASN1_SCK *, gint32 *, guint *);
306 int asn1_uint32_value_decode(ASN1_SCK *, int , guint *);
307 int asn1_uint32_decode(ASN1_SCK *, guint32 *, guint *);
308 int asn1_bits_decode(ASN1_SCK *, int , guchar **,
309                              guint *, guchar *);
310 int asn1_string_value_decode(ASN1_SCK *, int ,
311                         guchar **);
312 int asn1_string_decode(ASN1_SCK *, guchar **, guint *,
313                         guint *, guint );
314 int asn1_octet_string_decode(ASN1_SCK *, guchar **, guint *,
315                         guint *);
316 int asn1_subid_decode(ASN1_SCK *, subid_t *);
317 int asn1_oid_value_decode(ASN1_SCK *, int , subid_t **,
318                         guint *);
319 int asn1_oid_decode( ASN1_SCK *, subid_t **, guint *, guint *);
320 int asn1_sequence_decode( ASN1_SCK *, guint *, guint *);
321
322 char *asn1_err_to_str(int );
323
324 void proto_item_set_end(proto_item*, tvbuff_t *, gint);
325
326 proto_item* proto_tree_add_none_format(proto_tree*, int, tvbuff_t*, gint, gint, const char*, ...);
327
328 int except_init(void);
329 void except_deinit(void);
330 void except_rethrow(except_t *);
331 void except_throwd(long, long, const char *, void *);
332 void except_throwf(long, long, const char *, ...);
333 void (*except_unhandled_catcher(void (*)(except_t *)))(except_t *);
334 void *except_take_data(except_t *);
335 void except_set_allocator(void *(*)(size_t), void (*)(void *));
336 void *except_alloc(size_t);
337 void except_free(void *);
338 struct except_stacknode *except_pop(void);
339 void except_setup_try(struct except_stacknode *, struct except_catch *, const except_id_t [], size_t);
340
341 void col_set_fence(column_info*, gint);
342
343 guint8 *tvb_get_string(tvbuff_t *, gint, gint);
344 guint8 *tvb_get_stringz(tvbuff_t *, gint, gint *);
345
346 dissector_table_t find_dissector_table(const char *);
347 dissector_handle_t dissector_get_port_handle(dissector_table_t, guint32);
348 char *dissector_handle_get_short_name(dissector_handle_t);
349 int dissector_handle_get_protocol_index(dissector_handle_t);
350 void new_register_dissector(const char *, new_dissector_t, int); 
351 dissector_handle_t new_create_dissector_handle(new_dissector_t, int);
352
353 void register_giop_user_module(giop_sub_dissector_t *sub, gchar *name, gchar *module, int sub_proto);
354
355 guint32 dissect_per_GeneralString(tvbuff_t*, guint32, packet_info*, proto_tree*, int);
356 guint32 dissect_per_sequence_of(tvbuff_t*, guint32, packet_info*, proto_tree*, int, gint, int (*)(tvbuff_t*, int, packet_info*, proto_tree*));
357 guint32 dissect_per_IA5String(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int);
358 guint32 dissect_per_NumericString(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int);
359 guint32 dissect_per_PrintableString(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int);
360 guint32 dissect_per_BMPString(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int);
361 guint32 dissect_per_constrained_sequence_of(tvbuff_t*, guint32, packet_info*, proto_tree*, int, gint, int (*)(tvbuff_t*, int, packet_info*, proto_tree*), int, int);
362 guint32 dissect_per_constrained_set_of(tvbuff_t*, guint32, packet_info*, proto_tree *parent_tree, int, gint, int (*)(tvbuff_t*, int, packet_info*, proto_tree*), int, int);
363 guint32 dissect_per_set_of(tvbuff_t*, guint32, packet_info*, proto_tree *parent_tree, int, gint, int (*)(tvbuff_t*, int, packet_info*, proto_tree*));
364 guint32 dissect_per_object_identifier(tvbuff_t*, guint32, packet_info*, proto_tree*, int, char*);
365 guint32 dissect_per_boolean(tvbuff_t*, guint32, packet_info *pinfo, proto_tree*, int, gboolean*, proto_item**);
366 guint32 dissect_per_integer(tvbuff_t*, guint32, packet_info*, proto_tree*, int, gint32*, proto_item**);
367 guint32 dissect_per_constrained_integer(tvbuff_t*, guint32, packet_info*, proto_tree*, int, guint32, guint32, guint32*, proto_item**, gboolean);
368 guint32 dissect_per_choice(tvbuff_t*, guint32, packet_info*, proto_tree*, int, gint, per_choice_t*, char*, guint32*);
369 guint32 dissect_per_sequence(tvbuff_t*, guint32, packet_info*, proto_tree *parent_tree, int, gint, per_sequence_t*);
370 guint32 dissect_per_octet_string(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int, guint32*, guint32*);
371 guint32 dissect_per_restricted_character_string(tvbuff_t*, guint32, packet_info*, proto_tree*, int, int, int, char*, int);
372
373 void dissector_add_string(const char*, gchar*, dissector_handle_t);
374 void dissector_delete_string(const char*, const gchar*, dissector_handle_t);
375 void dissector_change_string(const char*, gchar *, dissector_handle_t);
376 void dissector_reset_string(const char*, const gchar*);
377 gboolean dissector_try_string(dissector_table_t, const gchar*, tvbuff_t*, packet_info*, proto_tree*);
378 dissector_handle_t dissector_get_string_handle(dissector_table_t, const gchar*);