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"
56 #include <wslua/wslua.h>
64 #include <ares_version.h>
72 epan_get_version(void) {
77 epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
78 void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
81 void (*report_failure_fcn_p)(const char *, va_list),
82 void (*report_open_failure_fcn_p)(const char *, int, gboolean),
83 void (*report_read_failure_fcn_p)(const char *, int),
84 void (*report_write_failure_fcn_p)(const char *, int))
86 init_report_err(report_failure_fcn_p, report_open_failure_fcn_p,
87 report_read_failure_fcn_p, report_write_failure_fcn_p);
89 /* initialize memory allocation subsystem */
92 /* initialize the GUID to name mapping table */
98 #elif defined(HAVE_LIBGCRYPT)
99 gcry_check_version(NULL);
104 proto_init(register_all_protocols_func, register_all_handoffs_func,
108 final_registration_all_protocols();
109 host_name_lookup_init();
123 cleanup_dissection();
128 oid_resolv_cleanup();
130 #ifdef HAVE_LIBGNUTLS
131 gnutls_global_deinit();
134 host_name_lookup_cleanup();
138 epan_conversation_init(void)
144 epan_conversation_cleanup(void)
146 conversation_cleanup();
150 epan_circuit_init(void)
156 epan_circuit_cleanup(void)
162 epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible)
166 if (create_proto_tree) {
167 edt->tree = proto_tree_create_root();
168 proto_tree_set_visible(edt->tree, proto_tree_visible);
178 epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible)
182 edt = g_new0(epan_dissect_t, 1);
184 return epan_dissect_init(edt, create_proto_tree, proto_tree_visible);
188 epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
191 proto_tree_set_fake_protocols(edt->tree, fake_protocols);
195 epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
196 const guint8* data, frame_data *fd, column_info *cinfo)
198 /* free all memory allocated during previous packet */
201 dissect_packet(edt, pseudo_header, data, fd, cinfo);
205 epan_dissect_cleanup(epan_dissect_t* edt)
209 /* Free the data sources list. */
210 free_data_sources(&edt->pi);
212 /* Free all tvb's created from this tvb, unless dissector
213 * wanted to store the pointer (in which case, the dissector
214 * would have incremented the usage count on that tvbuff_t*) */
215 tvb_free_chain(edt->tvb);
218 proto_tree_free(edt->tree);
223 epan_dissect_free(epan_dissect_t* edt)
225 epan_dissect_cleanup(edt);
230 epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
232 dfilter_prime_proto_tree(dfcode, edt->tree);
235 /* ----------------------- */
237 epan_custom_set(epan_dissect_t *edt, int field_id,
239 gchar *expr, const int size )
241 return proto_custom_set(edt->tree, field_id, result, expr, size);
245 epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
247 col_custom_set_edt(edt, edt->pi.cinfo);
248 col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);
252 * Get compile-time information for libraries used by libwireshark.
255 epan_get_compiled_version_info(GString *str)
258 g_string_append(str, ", ");
260 g_string_append(str, "with libpcre ");
263 g_string_append_printf(str, "%u.%u", PCRE_MAJOR, PCRE_MINOR);
264 #else /* PCRE_MINOR */
265 g_string_append_printf(str, "%u", PCRE_MAJOR);
266 #endif /* PCRE_MINOR */
267 #else /* PCRE_MAJOR */
268 g_string_append(str, "(version unknown)");
269 #endif /* PCRE_MAJOR */
270 #else /* HAVE_LIBPCRE */
271 g_string_append(str, "without libpcre");
272 #endif /* HAVE_LIBPCRE */
275 g_string_append(str, ", ");
277 g_string_append(str, "with SMI " SMI_VERSION_STRING);
278 #else /* no SNMP library */
279 g_string_append(str, "without SMI");
283 g_string_append(str, ", ");
285 g_string_append(str, "with c-ares " ARES_VERSION_STR);
287 g_string_append(str, "without c-ares");
289 /* ADNS - only add if no c-ares */
290 g_string_append(str, ", ");
292 g_string_append(str, "with ADNS");
294 g_string_append(str, "without ADNS");
295 #endif /* HAVE_GNU_ADNS */
296 #endif /* HAVE_C_ARES */
299 g_string_append(str, ", ");
301 g_string_append(str, "with ");
302 g_string_append(str, LUA_VERSION);
304 g_string_append(str, "without Lua");
305 #endif /* HAVE_LUA_5_1 */
307 g_string_append(str, ", ");
309 g_string_append(str, "with Python");
311 g_string_append(str, " " PY_VERSION);
312 #endif /* PY_VERSION */
314 g_string_append(str, "without Python");
315 #endif /* HAVE_PYTHON */
318 g_string_append(str, ", ");
319 #ifdef HAVE_LIBGNUTLS
320 g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
322 g_string_append(str, "without GnuTLS");
323 #endif /* HAVE_LIBGNUTLS */
326 g_string_append(str, ", ");
327 #ifdef HAVE_LIBGCRYPT
328 g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
330 g_string_append(str, "without Gcrypt");
331 #endif /* HAVE_LIBGCRYPT */
334 /* XXX - I don't see how to get the version number, at least for KfW */
335 g_string_append(str, ", ");
337 #ifdef HAVE_MIT_KERBEROS
338 g_string_append(str, "with MIT Kerberos");
340 /* HAVE_HEIMDAL_KERBEROS */
341 g_string_append(str, "with Heimdal Kerberos");
344 g_string_append(str, "without Kerberos");
345 #endif /* HAVE_KERBEROS */
348 g_string_append(str, ", ");
350 g_string_append(str, "with GeoIP");
352 g_string_append(str, "without GeoIP");
353 #endif /* HAVE_GEOIP */
358 * Get runtime information for libraries used by libwireshark.
361 epan_get_runtime_version_info(GString *str)
364 #ifdef HAVE_LIBGNUTLS
365 g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL));
366 #endif /* HAVE_LIBGNUTLS */
369 #ifdef HAVE_LIBGCRYPT
370 g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL));
371 #endif /* HAVE_LIBGCRYPT */