summaryrefslogtreecommitdiff
path: root/epan/epan.c
blob: 2dd19ac811b85b6140aa3e6caf896a64dc65da79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <glib.h>
#include <epan.h>

#include "plugins.h"
#include "conversation.h"
#include "dfilter.h"
#include "except.h"
#include "packet.h"
#include "proto.h"
#include "tvbuff.h"

void
epan_init(void)
{
	except_init();
	tvbuff_init();
	packet_init();
	proto_init();
	dfilter_init();
#ifdef HAVE_PLUGINS
	init_plugins();
#endif
}

void
epan_cleanup(void)
{
	dfilter_cleanup();
	proto_cleanup();
	packet_cleanup();
	tvbuff_cleanup();
	except_deinit();
}


void
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);
}