2000-09-27 04:55:05 +00:00
|
|
|
/* epan.h
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark Protocol Analyzer Library
|
2000-09-27 04:55:05 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-12-18 19:09:08 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-12-18 19:09:08 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-12-18 19:09:08 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-09-27 04:55:05 +00:00
|
|
|
*/
|
2014-03-20 12:22:39 +00:00
|
|
|
|
2012-10-18 21:14:43 +00:00
|
|
|
#ifndef __EPAN_H__
|
|
|
|
#define __EPAN_H__
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2000-09-28 03:16:29 +00:00
|
|
|
#include <glib.h>
|
2001-12-18 19:09:08 +00:00
|
|
|
#include "frame_data.h"
|
2007-05-07 17:55:42 +00:00
|
|
|
#include "register.h"
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2013-12-03 22:26:07 +00:00
|
|
|
typedef struct epan_dissect epan_dissect_t;
|
2001-11-21 23:16:26 +00:00
|
|
|
|
2013-12-03 21:31:04 +00:00
|
|
|
struct epan_dfilter;
|
2013-12-22 10:41:27 +00:00
|
|
|
struct epan_column_info;
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2011-09-11 19:09:02 +00:00
|
|
|
/**
|
|
|
|
@mainpage Wireshark EPAN the packet analyzing engine. Source code can be found in the epan directory
|
|
|
|
|
|
|
|
@section Introduction
|
|
|
|
|
|
|
|
XXX
|
|
|
|
|
|
|
|
@b Sections:
|
|
|
|
*/
|
2012-10-18 21:14:43 +00:00
|
|
|
/*
|
2011-09-11 19:09:02 +00:00
|
|
|
Ref 1
|
|
|
|
Epan
|
2012-10-18 21:14:43 +00:00
|
|
|
Ethereal Packet ANalyzer (XXX - is this correct?) the packet analyzing engine. Source code can be found in the epan directory.
|
2011-09-11 19:09:02 +00:00
|
|
|
|
2012-10-18 21:14:43 +00:00
|
|
|
Protocol-Tree - Keep data of the capture file protocol information.
|
2011-09-11 19:09:02 +00:00
|
|
|
|
2012-10-18 21:14:43 +00:00
|
|
|
Dissectors - The various protocol dissectors in epan/dissectors.
|
2011-09-11 19:09:02 +00:00
|
|
|
|
2012-10-18 21:14:43 +00:00
|
|
|
Plugins - Some of the protocol dissectors are implemented as plugins. Source code can be found at plugins.
|
2011-09-11 19:09:02 +00:00
|
|
|
|
|
|
|
Display-Filters - the display filter engine at epan/dfilter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ref2 for further edits - delete when done
|
|
|
|
\section Introduction
|
|
|
|
|
|
|
|
This document describes the data structures and the functions exported by the CACE Technologies AirPcap library.
|
|
|
|
The AirPcap library provides low-level access to the AirPcap driver including advanced capabilities such as channel setting,
|
|
|
|
link type control and WEP configuration.<br>
|
|
|
|
This manual includes the following sections:
|
|
|
|
|
|
|
|
\note throughout this documentation, \e device refers to a physical USB AirPcap device, while \e adapter is an open API
|
|
|
|
instance. Most of the AirPcap API operations are adapter-specific but some of them, like setting the channel, are
|
|
|
|
per-device and will be reflected on all the open adapters. These functions will have "Device" in their name, e.g.
|
|
|
|
AirpcapSetDeviceChannel().
|
|
|
|
|
|
|
|
\b Sections:
|
|
|
|
|
|
|
|
- \ref airpcapfuncs
|
|
|
|
- \ref airpcapdefs
|
|
|
|
- \ref radiotap
|
|
|
|
*/
|
2013-12-02 08:30:29 +00:00
|
|
|
/*
|
|
|
|
* Register all the plugin types that are part of libwireshark.
|
|
|
|
*
|
|
|
|
* Must be called before init_plugins(), which must be called before
|
|
|
|
* any registration routines are called, i.e. before epan_init().
|
|
|
|
*
|
|
|
|
* Must be called only once in a program.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void epan_register_plugin_types(void);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** init the whole epan module, this is used to be called only once in a program */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2008-06-23 20:17:08 +00:00
|
|
|
void epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
|
|
|
|
void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
|
2013-12-05 09:30:22 +00:00
|
|
|
register_cb cb, void *client_data);
|
2009-02-15 21:47:57 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** cleanup the whole epan module, this is used to be called only once in a program */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2000-09-27 04:55:05 +00:00
|
|
|
void epan_cleanup(void);
|
2009-02-15 21:47:57 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/**
|
2009-02-25 10:05:04 +00:00
|
|
|
* Initialize the table of conversations. Conversations are identified by
|
|
|
|
* their endpoints; they are used for protocols such as IP, TCP, and UDP,
|
|
|
|
* where packets contain endpoint information but don't contain a single
|
|
|
|
* value indicating to which flow the packet belongs.
|
|
|
|
*/
|
2000-09-27 04:55:05 +00:00
|
|
|
void epan_conversation_init(void);
|
2009-09-06 18:25:23 +00:00
|
|
|
void epan_conversation_cleanup(void);
|
2009-02-15 21:47:57 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/**
|
2009-02-25 10:05:04 +00:00
|
|
|
* Initialize the table of circuits. Circuits are identified by a
|
|
|
|
* circuit ID; they are used for protocols where packets *do* contain
|
|
|
|
* a circuit ID value indicating to which flow the packet belongs.
|
|
|
|
*
|
|
|
|
* We might want to make a superclass for both endpoint-specified
|
|
|
|
* conversations and circuit ID-specified circuits, so we can attach
|
|
|
|
* information either to a circuit or a conversation with common
|
|
|
|
* code.
|
|
|
|
*/
|
2002-10-22 08:44:33 +00:00
|
|
|
void epan_circuit_init(void);
|
2009-09-06 18:25:23 +00:00
|
|
|
void epan_circuit_cleanup(void);
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** A client will create one epan_t for an entire dissection session.
|
2000-09-27 04:55:05 +00:00
|
|
|
* A single epan_t will be used to analyze the entire sequence of packets,
|
|
|
|
* sequentially, in a single session. A session corresponds to a single
|
2014-03-20 12:22:39 +00:00
|
|
|
* packet trace file. The reaons epan_t exists is that some packets in
|
2000-09-27 04:55:05 +00:00
|
|
|
* some protocols cannot be decoded without knowledge of previous packets.
|
|
|
|
* This inter-packet "state" is stored in the epan_t.
|
|
|
|
*/
|
|
|
|
typedef struct epan_session epan_t;
|
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
WS_DLL_PUBLIC epan_t *epan_new(void);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2014-12-19 13:08:38 +00:00
|
|
|
WS_DLL_PUBLIC const char *epan_get_user_comment(const epan_t *session, const frame_data *fd);
|
2013-08-01 20:59:38 +00:00
|
|
|
|
2015-01-22 11:27:23 +00:00
|
|
|
WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, guint32 interface_id);
|
2013-07-22 19:38:38 +00:00
|
|
|
|
2013-07-21 20:48:30 +00:00
|
|
|
const nstime_t *epan_get_frame_ts(const epan_t *session, guint32 frame_num);
|
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
WS_DLL_PUBLIC void epan_free(epan_t *session);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar*
|
2006-06-13 08:18:50 +00:00
|
|
|
epan_get_version(void);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2014-02-21 06:11:41 +00:00
|
|
|
/**
|
|
|
|
* Set/unset the tree to always be visible when epan_dissect_init() is called.
|
|
|
|
* This state change sticks until cleared, rather than being done per function call.
|
|
|
|
* This is currently used when Lua scripts request all fields be generated.
|
|
|
|
* By default it only becomes visible if epan_dissect_init() makes it so, usually
|
|
|
|
* only when a packet is selected.
|
|
|
|
* Setting this overrides that so it's always visible, although it will still not be
|
|
|
|
* created if create_proto_tree is false in the call to epan_dissect_init().
|
|
|
|
* Clearing this reverts the decision to epan_dissect_init() and proto_tree_visible.
|
|
|
|
*/
|
|
|
|
void epan_set_always_visible(gboolean force);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** initialize an existing single packet dissection */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2009-08-13 19:42:46 +00:00
|
|
|
epan_dissect_t*
|
2013-07-21 18:38:03 +00:00
|
|
|
epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
|
2009-08-13 19:42:46 +00:00
|
|
|
|
2010-09-23 01:14:44 +00:00
|
|
|
/** get a new single packet dissection
|
2010-08-29 10:47:38 +00:00
|
|
|
* should be freed using epan_dissect_free() after packet dissection completed
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-12-18 19:09:08 +00:00
|
|
|
epan_dissect_t*
|
2013-07-21 18:38:03 +00:00
|
|
|
epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2013-10-20 10:21:25 +00:00
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void
|
|
|
|
epan_dissect_reset(epan_dissect_t *edt);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** Indicate whether we should fake protocols or not */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2009-08-11 18:08:03 +00:00
|
|
|
void
|
2010-04-03 18:18:50 +00:00
|
|
|
epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols);
|
2009-08-11 18:08:03 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** run a single packet dissection */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-12-18 19:09:08 +00:00
|
|
|
void
|
2014-05-25 00:04:44 +00:00
|
|
|
epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
|
|
|
|
struct wtap_pkthdr *phdr, tvbuff_t *tvb, frame_data *fd,
|
|
|
|
struct epan_column_info *cinfo);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2012-10-20 19:27:24 +00:00
|
|
|
void
|
2014-05-25 00:04:44 +00:00
|
|
|
epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
|
|
|
|
struct wtap_pkthdr *phdr, tvbuff_t *tvb, frame_data *fd,
|
|
|
|
struct epan_column_info *cinfo);
|
2012-10-20 19:27:24 +00:00
|
|
|
|
2014-01-08 04:35:28 +00:00
|
|
|
/** run a single file packet dissection */
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void
|
|
|
|
epan_dissect_file_run(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
|
|
|
|
tvbuff_t *tvb, frame_data *fd, struct epan_column_info *cinfo);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void
|
|
|
|
epan_dissect_file_run_with_taps(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
|
|
|
|
tvbuff_t *tvb, frame_data *fd, struct epan_column_info *cinfo);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** Prime a proto_tree using the fields/protocols used in a dfilter. */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-12-18 19:09:08 +00:00
|
|
|
void
|
2013-12-03 21:31:04 +00:00
|
|
|
epan_dissect_prime_dfilter(epan_dissect_t *edt, const struct epan_dfilter *dfcode);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** fill the dissect run output into the packet list columns */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2001-12-18 19:09:08 +00:00
|
|
|
void
|
2010-04-03 18:18:50 +00:00
|
|
|
epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2013-05-22 23:02:19 +00:00
|
|
|
/** Check whether a dissected packet contains a given named field */
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean
|
|
|
|
epan_dissect_packet_contains_field(epan_dissect_t* edt,
|
|
|
|
const char *field_name);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** releases resources attached to the packet dissection. DOES NOT free the actual pointer */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2009-08-13 19:42:46 +00:00
|
|
|
void
|
|
|
|
epan_dissect_cleanup(epan_dissect_t* edt);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** free a single packet dissection */
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2000-09-27 04:55:05 +00:00
|
|
|
void
|
2000-10-06 10:11:40 +00:00
|
|
|
epan_dissect_free(epan_dissect_t* edt);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** Sets custom column */
|
2009-08-25 21:10:35 +00:00
|
|
|
const gchar *
|
2014-12-17 10:38:49 +00:00
|
|
|
epan_custom_set(epan_dissect_t *edt, GSList *ids, gint occurrence,
|
2010-09-23 06:00:22 +00:00
|
|
|
gchar *result, gchar *expr, const int size);
|
2010-07-15 02:07:16 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/**
|
2010-07-15 02:07:16 +00:00
|
|
|
* Get compile-time information for libraries used by libwireshark.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2010-07-15 02:07:16 +00:00
|
|
|
void
|
|
|
|
epan_get_compiled_version_info(GString *str);
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/**
|
2010-07-15 02:07:16 +00:00
|
|
|
* Get runtime information for libraries used by libwireshark.
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC
|
2010-07-15 02:07:16 +00:00
|
|
|
void
|
|
|
|
epan_get_runtime_version_info(GString *str);
|
2009-08-25 21:10:35 +00:00
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2012-10-18 21:14:43 +00:00
|
|
|
#endif /* __EPAN_H__ */
|