aboutsummaryrefslogtreecommitdiffstats
path: root/epan/epan.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-10-06 10:11:40 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-10-06 10:11:40 +0000
commite69b5278aaddce2af02174afe0515adceb841973 (patch)
tree8cb476c958c815d3d73d4ac79ffeb15df28484d8 /epan/epan.c
parente735d485aee9d56723dea97fae3064cf4bdd7e9a (diff)
Implement epan_dissect_new() and epan_dissect_free(). These are the
"top-level" dissectors that libepan-users call, instead of dissect_packet(). The epan_dissect_t holds the tvbuff after dissection so that the tvbuff's memory is not cleared until after the proto_tree is freed. (I might stuff the proto_tree into the epan_dissect_t, too). What remains of dissect_packet() in packet.c handles the tvbuff initialiation. The real meat of dissect_packet() is now in dissect_frame(), in packet-frame.c This means that "packet.c" is no longer a dissector, os it is no longer passed to make-reg-dotc. Once dissect_fddi() gets two wrapper functions (dissect_fddi_swapped() and dissect_fddi_nonswapped()), the a dissector handoff routine could be used instead of the switch statement in dissect_frame(). I'd register a field like "wtap.encap" svn path=/trunk/; revision=2478
Diffstat (limited to 'epan/epan.c')
-rw-r--r--epan/epan.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/epan/epan.c b/epan/epan.c
index a3734c7cbb..2dd19ac811 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -10,6 +10,7 @@
#include "conversation.h"
#include "dfilter.h"
#include "except.h"
+#include "packet.h"
#include "proto.h"
#include "tvbuff.h"
@@ -18,6 +19,7 @@ epan_init(void)
{
except_init();
tvbuff_init();
+ packet_init();
proto_init();
dfilter_init();
#ifdef HAVE_PLUGINS
@@ -30,6 +32,7 @@ epan_cleanup(void)
{
dfilter_cleanup();
proto_cleanup();
+ packet_cleanup();
tvbuff_cleanup();
except_deinit();
}
@@ -40,3 +43,35 @@ epan_conversation_init(void)
{
conversation_init();
}
+
+
+struct epan_dissect {
+
+ tvbuff_t *tvb;
+ proto_tree *tree;
+};
+
+epan_dissect_t*
+epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_tree *tree)
+{
+ epan_dissect_t *edt;
+
+ edt = g_new(epan_dissect_t, 1);
+
+ /* XXX - init tree */
+ dissect_packet(&edt->tvb, pseudo_header, data, fd, tree);
+
+ return edt;
+}
+
+
+void
+epan_dissect_free(epan_dissect_t* edt)
+{
+ /* Free all tvb's created from this tvb, unless dissector
+ * wanted to store the pointer (in which case, the dissector
+ * would have incremented the usage count on that tvbuff_t*) */
+ tvb_free_chain(edt->tvb);
+
+ g_free(edt);
+}