From 28e9dcc4a9261a61b16dfd9a2051205289beb926 Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Sun, 21 Jul 2013 18:38:03 +0000 Subject: Some work on multi file dissection - make init_dissection/cleanup_dissection private for libwireshark - implement epan_new(), epan_free() - pass epan_t to epan_dissect* svn path=/trunk/; revision=50761 --- epan/epan.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'epan/epan.c') diff --git a/epan/epan.c b/epan/epan.c index 023d580436..6382f79703 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -40,6 +40,7 @@ #include "epan_dissect.h" #include "wsutil/report_err.h" +#include "epan-int.h" #include "conversation.h" #include "circuit.h" #include "except.h" @@ -134,6 +135,26 @@ epan_cleanup(void) wmem_cleanup(); } +epan_t * +epan_new(void) +{ + epan_t *session = g_slice_new(epan_t); + + /* XXX, it should take session as param */ + init_dissection(); + + return session; +} + +void +epan_free(epan_t *session) +{ + /* XXX, it should take session as param */ + cleanup_dissection(); + + g_slice_free(epan_t, session); +} + void epan_conversation_init(void) { @@ -159,10 +180,11 @@ epan_circuit_cleanup(void) } epan_dissect_t* -epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible) +epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible) { g_assert(edt); + edt->session = session; edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE); if (create_proto_tree) { @@ -179,13 +201,13 @@ epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const g } epan_dissect_t* -epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible) +epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible) { epan_dissect_t *edt; edt = g_new0(epan_dissect_t, 1); - return epan_dissect_init(edt, create_proto_tree, proto_tree_visible); + return epan_dissect_init(edt, session, create_proto_tree, proto_tree_visible); } void -- cgit v1.2.3