5 * Wireshark Protocol Analyzer Library
7 * Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #endif /* HAVE_LIBGCRYPT */
33 #include <gnutls/gnutls.h>
34 #endif /* HAVE_LIBGNUTLS */
39 #include "epan_dissect.h"
40 #include "report_err.h"
42 #include "conversation.h"
47 #include "column-utils.h"
49 #include "addr_resolv.h"
55 int wslua_init(void*);
63 epan_get_version(void) {
68 epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
69 void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
72 void (*report_failure_fcn_p)(const char *, va_list),
73 void (*report_open_failure_fcn_p)(const char *, int, gboolean),
74 void (*report_read_failure_fcn_p)(const char *, int),
75 void (*report_write_failure_fcn_p)(const char *, int))
77 init_report_err(report_failure_fcn_p, report_open_failure_fcn_p,
78 report_read_failure_fcn_p, report_write_failure_fcn_p);
80 /* initialize memory allocation subsystem */
83 /* initialize the GUID to name mapping table */
89 #elif defined(HAVE_LIBGCRYPT)
90 gcry_check_version(NULL);
95 proto_init(register_all_protocols_func, register_all_handoffs_func,
99 final_registration_all_protocols();
100 host_name_lookup_init();
114 cleanup_dissection();
119 oid_resolv_cleanup();
121 #ifdef HAVE_LIBGNUTLS
122 gnutls_global_deinit();
125 host_name_lookup_cleanup();
129 epan_conversation_init(void)
135 epan_conversation_cleanup(void)
137 conversation_cleanup();
141 epan_circuit_init(void)
147 epan_circuit_cleanup(void)
153 epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible)
157 if (create_proto_tree) {
158 edt->tree = proto_tree_create_root();
159 proto_tree_set_visible(edt->tree, proto_tree_visible);
169 epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible)
173 edt = g_new(epan_dissect_t, 1);
175 return epan_dissect_init(edt, create_proto_tree, proto_tree_visible);
179 epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
182 proto_tree_set_fake_protocols(edt->tree, fake_protocols);
186 epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
187 const guint8* data, frame_data *fd, column_info *cinfo)
189 /* free all memory allocated during previous packet */
192 dissect_packet(edt, pseudo_header, data, fd, cinfo);
196 epan_dissect_cleanup(epan_dissect_t* edt)
200 /* Free the data sources list. */
201 free_data_sources(&edt->pi);
203 /* Free all tvb's created from this tvb, unless dissector
204 * wanted to store the pointer (in which case, the dissector
205 * would have incremented the usage count on that tvbuff_t*) */
206 tvb_free_chain(edt->tvb);
209 proto_tree_free(edt->tree);
214 epan_dissect_free(epan_dissect_t* edt)
216 epan_dissect_cleanup(edt);
221 epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
223 dfilter_prime_proto_tree(dfcode, edt->tree);
226 /* ----------------------- */
228 epan_custom_set(epan_dissect_t *edt, int field_id,
230 gchar *expr, const int size )
232 return proto_custom_set(edt->tree, field_id, result, expr, size);
236 epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
238 col_custom_set_edt(edt, edt->pi.cinfo);
239 col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);