Make the frame_data_sequence structure opaque, and move some other
[obnox/wireshark/wip.git] / epan / epan.h
1 /* epan.h
2  *
3  * $Id$
4  *
5  * Wireshark Protocol Analyzer Library
6  *
7  * Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
8  *
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.
13  *
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.
18  *
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.
22  */
23
24 #ifndef EPAN_H
25 #define EPAN_H
26
27 #include <glib.h>
28 #include "frame_data.h"
29 #include "column_info.h"
30 #include "register.h"
31
32 typedef struct _epan_dissect_t epan_dissect_t;
33
34 #include "dfilter/dfilter.h"
35
36 /** init the whole epan module, this is used to be called only once in a program */
37 void epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
38                void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
39                register_cb cb,
40                void *client_data,
41                void (*report_failure_fcn_p)(const char *, va_list),
42                void (*report_open_failure_fcn_p)(const char *, int, gboolean),
43                void (*report_read_failure_fcn_p)(const char *, int),
44                void (*report_write_failure_fcn_p)(const char *, int));
45
46 /** cleanup the whole epan module, this is used to be called only once in a program */
47 void epan_cleanup(void);
48
49 /**
50  * Initialize the table of conversations.  Conversations are identified by
51  * their endpoints; they are used for protocols such as IP, TCP, and UDP,
52  * where packets contain endpoint information but don't contain a single
53  * value indicating to which flow the packet belongs.
54  */
55 void epan_conversation_init(void);
56 void epan_conversation_cleanup(void);
57
58 /**
59  * Initialize the table of circuits.  Circuits are identified by a
60  * circuit ID; they are used for protocols where packets *do* contain
61  * a circuit ID value indicating to which flow the packet belongs.
62  *
63  * We might want to make a superclass for both endpoint-specified
64  * conversations and circuit ID-specified circuits, so we can attach
65  * information either to a circuit or a conversation with common
66  * code.
67  */
68 void epan_circuit_init(void);
69 void epan_circuit_cleanup(void);
70
71 /** A client will create one epan_t for an entire dissection session.
72  * A single epan_t will be used to analyze the entire sequence of packets,
73  * sequentially, in a single session. A session corresponds to a single
74  * packet trace file. The reaons epan_t exists is that some packets in
75  * some protocols cannot be decoded without knowledge of previous packets.
76  * This inter-packet "state" is stored in the epan_t.
77  */
78 /* XXX - NOTE: epan_t, epan_new and epan_free are currently unused! */
79 typedef struct epan_session epan_t;
80
81 epan_t*
82 epan_new(void);
83
84 void
85 epan_free(epan_t*);
86
87 extern gchar*
88 epan_get_version(void);
89
90 /** initialize an existing single packet dissection */
91 epan_dissect_t*
92 epan_dissect_init(epan_dissect_t        *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible);
93
94 /** get a new single packet dissection
95  * should be freed using epan_dissect_free() after packet dissection completed
96  */
97 epan_dissect_t*
98 epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible);
99
100 /** Indicate whether we should fake protocols or not */
101 void
102 epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols);
103
104 /** run a single packet dissection */
105 void
106 epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
107         const guint8* data, frame_data *fd, column_info *cinfo);
108
109 /** Prime a proto_tree using the fields/protocols used in a dfilter. */
110 void
111 epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t *dfcode);
112
113 /** fill the dissect run output into the packet list columns */
114 void
115 epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
116
117 /** releases resources attached to the packet dissection. DOES NOT free the actual pointer */
118 void
119 epan_dissect_cleanup(epan_dissect_t* edt);
120
121 /** free a single packet dissection */
122 void
123 epan_dissect_free(epan_dissect_t* edt);
124
125 /** Sets custom column */
126 const gchar *
127 epan_custom_set(epan_dissect_t *edt, int id, gint occurrence,
128                                 gchar *result, gchar *expr, const int size);
129
130 /**
131  * Get compile-time information for libraries used by libwireshark.
132  */
133 void
134 epan_get_compiled_version_info(GString *str);
135
136 /**
137  * Get runtime information for libraries used by libwireshark.
138  */
139 void
140 epan_get_runtime_version_info(GString *str);
141
142 #endif /* EPAN_H */