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.
29 #include <Python.h> /* to get the Python version number (PY_VERSION) */
34 #endif /* HAVE_LIBGCRYPT */
37 #include <gnutls/gnutls.h>
38 #endif /* HAVE_LIBGNUTLS */
42 #include "epan_dissect.h"
43 #include "report_err.h"
45 #include "conversation.h"
50 #include "column-utils.h"
52 #include "addr_resolv.h"
59 #include <wslua/wslua.h>
67 #include <ares_version.h>
75 epan_get_version(void) {
80 epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
81 void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
84 void (*report_failure_fcn_p)(const char *, va_list),
85 void (*report_open_failure_fcn_p)(const char *, int, gboolean),
86 void (*report_read_failure_fcn_p)(const char *, int),
87 void (*report_write_failure_fcn_p)(const char *, int))
89 init_report_err(report_failure_fcn_p, report_open_failure_fcn_p,
90 report_read_failure_fcn_p, report_write_failure_fcn_p);
92 /* initialize memory allocation subsystem */
95 /* initialize the GUID to name mapping table */
100 gnutls_global_init();
101 #elif defined(HAVE_LIBGCRYPT)
102 gcry_check_version(NULL);
106 proto_init(register_all_protocols_func, register_all_handoffs_func,
110 final_registration_all_protocols();
111 host_name_lookup_init();
114 wslua_init(cb, client_data);
125 cleanup_dissection();
130 oid_resolv_cleanup();
131 #ifdef HAVE_LIBGNUTLS
132 gnutls_global_deinit();
135 host_name_lookup_cleanup();
139 epan_conversation_init(void)
145 epan_conversation_cleanup(void)
147 conversation_cleanup();
151 epan_circuit_init(void)
157 epan_circuit_cleanup(void)
163 epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible)
167 if (create_proto_tree) {
168 edt->tree = proto_tree_create_root();
169 proto_tree_set_visible(edt->tree, proto_tree_visible);
175 edt->pi.dependent_frames = NULL;
181 epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible)
185 edt = g_new0(epan_dissect_t, 1);
187 return epan_dissect_init(edt, create_proto_tree, proto_tree_visible);
191 epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
194 proto_tree_set_fake_protocols(edt->tree, fake_protocols);
198 epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
199 const guint8* data, frame_data *fd, column_info *cinfo)
201 /* free all memory allocated during previous packet */
204 dissect_packet(edt, pseudo_header, data, fd, cinfo);
208 epan_dissect_cleanup(epan_dissect_t* edt)
212 /* Free the data sources list. */
213 free_data_sources(&edt->pi);
215 /* Free all tvb's chained from this tvb */
216 tvb_free_chain(edt->tvb);
219 proto_tree_free(edt->tree);
224 epan_dissect_free(epan_dissect_t* edt)
226 epan_dissect_cleanup(edt);
231 epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
233 dfilter_prime_proto_tree(dfcode, edt->tree);
236 /* ----------------------- */
238 epan_custom_set(epan_dissect_t *edt, int field_id,
241 gchar *expr, const int size )
243 return proto_custom_set(edt->tree, field_id, occurrence, result, expr, size);
247 epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
249 col_custom_set_edt(edt, edt->pi.cinfo);
250 col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);
254 * Get compile-time information for libraries used by libwireshark.
257 epan_get_compiled_version_info(GString *str)
260 g_string_append(str, ", ");
262 g_string_append(str, "with SMI " SMI_VERSION_STRING);
263 #else /* no SNMP library */
264 g_string_append(str, "without SMI");
268 g_string_append(str, ", ");
270 g_string_append(str, "with c-ares " ARES_VERSION_STR);
272 g_string_append(str, "without c-ares");
274 /* ADNS - only add if no c-ares */
275 g_string_append(str, ", ");
277 g_string_append(str, "with ADNS");
279 g_string_append(str, "without ADNS");
280 #endif /* HAVE_GNU_ADNS */
281 #endif /* HAVE_C_ARES */
284 g_string_append(str, ", ");
286 g_string_append(str, "with ");
287 g_string_append(str, LUA_VERSION);
289 g_string_append(str, "without Lua");
290 #endif /* HAVE_LUA_5_1 */
292 g_string_append(str, ", ");
294 g_string_append(str, "with Python");
296 g_string_append(str, " " PY_VERSION);
297 #endif /* PY_VERSION */
299 g_string_append(str, "without Python");
300 #endif /* HAVE_PYTHON */
303 g_string_append(str, ", ");
304 #ifdef HAVE_LIBGNUTLS
305 g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
307 g_string_append(str, "without GnuTLS");
308 #endif /* HAVE_LIBGNUTLS */
311 g_string_append(str, ", ");
312 #ifdef HAVE_LIBGCRYPT
313 g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
315 g_string_append(str, "without Gcrypt");
316 #endif /* HAVE_LIBGCRYPT */
319 /* XXX - I don't see how to get the version number, at least for KfW */
320 g_string_append(str, ", ");
322 #ifdef HAVE_MIT_KERBEROS
323 g_string_append(str, "with MIT Kerberos");
325 /* HAVE_HEIMDAL_KERBEROS */
326 g_string_append(str, "with Heimdal Kerberos");
329 g_string_append(str, "without Kerberos");
330 #endif /* HAVE_KERBEROS */
333 g_string_append(str, ", ");
335 g_string_append(str, "with GeoIP");
337 g_string_append(str, "without GeoIP");
338 #endif /* HAVE_GEOIP */
343 * Get runtime information for libraries used by libwireshark.
346 epan_get_runtime_version_info(GString *str
347 #if !defined(HAVE_LIBGNUTLS) && !defined(HAVE_LIBGCRYPT)
353 #ifdef HAVE_LIBGNUTLS
354 g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL));
355 #endif /* HAVE_LIBGNUTLS */
358 #ifdef HAVE_LIBGCRYPT
359 g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL));
360 #endif /* HAVE_LIBGCRYPT */