3 * Wireshark Protocol Analyzer Library
5 * Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #endif /* __cplusplus */
30 #include <epan/tvbuff.h>
31 #include <epan/frame_data.h>
33 #include "ws_symbol_export.h"
35 typedef struct epan_dissect epan_dissect_t;
38 struct epan_column_info;
41 @mainpage Wireshark EPAN the packet analyzing engine. Source code can be found in the epan directory
52 Ethereal Packet ANalyzer (XXX - is this correct?) the packet analyzing engine. Source code can be found in the epan directory.
54 Protocol-Tree - Keep data of the capture file protocol information.
56 Dissectors - The various protocol dissectors in epan/dissectors.
58 Plugins - Some of the protocol dissectors are implemented as plugins. Source code can be found at plugins.
60 Display-Filters - the display filter engine at epan/dfilter
64 Ref2 for further edits - delete when done
67 This document describes the data structures and the functions exported by the CACE Technologies AirPcap library.
68 The AirPcap library provides low-level access to the AirPcap driver including advanced capabilities such as channel setting,
69 link type control and WEP configuration.<br>
70 This manual includes the following sections:
72 \note throughout this documentation, \e device refers to a physical USB AirPcap device, while \e adapter is an open API
73 instance. Most of the AirPcap API operations are adapter-specific but some of them, like setting the channel, are
74 per-device and will be reflected on all the open adapters. These functions will have "Device" in their name, e.g.
75 AirpcapSetDeviceChannel().
84 * Register all the plugin types that are part of libwireshark.
86 * Must be called before init_plugins(), which must be called before
87 * any registration routines are called, i.e. before epan_init().
89 * Must be called only once in a program.
91 WS_DLL_PUBLIC void epan_register_plugin_types(void);
94 * Init the whole epan module.
96 * Must be called only once in a program.
98 * Returns TRUE on success, FALSE on failure.
101 gboolean epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
102 void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
103 register_cb cb, void *client_data);
105 /** cleanup the whole epan module, this is used to be called only once in a program */
107 void epan_cleanup(void);
110 * Initialize the table of conversations. Conversations are identified by
111 * their endpoints; they are used for protocols such as IP, TCP, and UDP,
112 * where packets contain endpoint information but don't contain a single
113 * value indicating to which flow the packet belongs.
115 void epan_conversation_init(void);
116 void epan_conversation_cleanup(void);
119 * Initialize the table of circuits. Circuits are identified by a
120 * circuit ID; they are used for protocols where packets *do* contain
121 * a circuit ID value indicating to which flow the packet belongs.
123 * We might want to make a superclass for both endpoint-specified
124 * conversations and circuit ID-specified circuits, so we can attach
125 * information either to a circuit or a conversation with common
128 void epan_circuit_init(void);
129 void epan_circuit_cleanup(void);
131 /** A client will create one epan_t for an entire dissection session.
132 * A single epan_t will be used to analyze the entire sequence of packets,
133 * sequentially, in a single session. A session corresponds to a single
134 * packet trace file. The reaons epan_t exists is that some packets in
135 * some protocols cannot be decoded without knowledge of previous packets.
136 * This inter-packet "state" is stored in the epan_t.
138 typedef struct epan_session epan_t;
140 WS_DLL_PUBLIC epan_t *epan_new(void);
142 WS_DLL_PUBLIC const char *epan_get_user_comment(const epan_t *session, const frame_data *fd);
144 WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, guint32 interface_id);
146 const nstime_t *epan_get_frame_ts(const epan_t *session, guint32 frame_num);
148 WS_DLL_PUBLIC void epan_free(epan_t *session);
150 WS_DLL_PUBLIC const gchar*
151 epan_get_version(void);
154 * Set/unset the tree to always be visible when epan_dissect_init() is called.
155 * This state change sticks until cleared, rather than being done per function call.
156 * This is currently used when Lua scripts request all fields be generated.
157 * By default it only becomes visible if epan_dissect_init() makes it so, usually
158 * only when a packet is selected.
159 * Setting this overrides that so it's always visible, although it will still not be
160 * created if create_proto_tree is false in the call to epan_dissect_init().
161 * Clearing this reverts the decision to epan_dissect_init() and proto_tree_visible.
163 void epan_set_always_visible(gboolean force);
165 /** initialize an existing single packet dissection */
168 epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
170 /** get a new single packet dissection
171 * should be freed using epan_dissect_free() after packet dissection completed
175 epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
179 epan_dissect_reset(epan_dissect_t *edt);
181 /** Indicate whether we should fake protocols or not */
184 epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols);
186 /** run a single packet dissection */
189 epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
190 struct wtap_pkthdr *phdr, tvbuff_t *tvb, frame_data *fd,
191 struct epan_column_info *cinfo);
195 epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
196 struct wtap_pkthdr *phdr, tvbuff_t *tvb, frame_data *fd,
197 struct epan_column_info *cinfo);
199 /** run a single file packet dissection */
202 epan_dissect_file_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
203 tvbuff_t *tvb, frame_data *fd, struct epan_column_info *cinfo);
207 epan_dissect_file_run_with_taps(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
208 tvbuff_t *tvb, frame_data *fd, struct epan_column_info *cinfo);
210 /** Prime an epan_dissect_t's proto_tree using the fields/protocols used in a dfilter. */
213 epan_dissect_prime_dfilter(epan_dissect_t *edt, const struct epan_dfilter *dfcode);
215 /** Prime an epan_dissect_t's proto_tree with a field/protocol specified by its hfid */
218 epan_dissect_prime_hfid(epan_dissect_t *edt, int hfid);
220 /** fill the dissect run output into the packet list columns */
223 epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
225 /** Check whether a dissected packet contains a given named field */
228 epan_dissect_packet_contains_field(epan_dissect_t* edt,
229 const char *field_name);
231 /** releases resources attached to the packet dissection. DOES NOT free the actual pointer */
234 epan_dissect_cleanup(epan_dissect_t* edt);
236 /** free a single packet dissection */
239 epan_dissect_free(epan_dissect_t* edt);
241 /** Sets custom column */
243 epan_custom_set(epan_dissect_t *edt, GSList *ids, gint occurrence,
244 gchar *result, gchar *expr, const int size);
247 * Get compile-time information for libraries used by libwireshark.
251 epan_get_compiled_version_info(GString *str);
254 * Get runtime information for libraries used by libwireshark.
258 epan_get_runtime_version_info(GString *str);
262 #endif /* __cplusplus */
264 #endif /* __EPAN_H__ */