| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
epan.h
Go to the documentation of this file.
1
10#ifndef __EPAN_H__
11#define __EPAN_H__
12
13#include <wsutil/feature_list.h>
14#include <epan/tvbuff.h>
15#include <epan/prefs.h>
16#include <epan/frame_data.h>
17#include <epan/register.h>
18#include <wiretap/wtap_opttypes.h>
19
20#ifdef __cplusplus
21 extern "C" {
22#endif /* __cplusplus */
23
31 extern bool wireshark_abort_on_dissector_bug;
32
40 extern bool wireshark_abort_on_too_many_items;
41
48WS_DLL_PUBLIC void ws_dissector_bug(const char *format, ...)
49 G_GNUC_PRINTF(1,2);
50
57#define ws_dissector_oops(_fmt, ...) ws_dissector_bug("OOPS: " _fmt, __VA_ARGS__)
58
65 typedef struct epan_dissect epan_dissect_t;
66
67 struct epan_dfilter;
68 struct epan_column_info;
69
76 struct packet_provider_data;
77
84 struct packet_provider_funcs {
92 const nstime_t *(*get_frame_ts)(struct packet_provider_data *prov, uint32_t frame_num);
93
100 const nstime_t *(*get_start_ts)(struct packet_provider_data *prov);
101
108 const nstime_t *(*get_end_ts)(struct packet_provider_data *prov);
109
118 const char *(*get_interface_name)(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
119
128 const char *(*get_interface_description)(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
129
137 wtap_block_t (*get_modified_block)(struct packet_provider_data *prov, const frame_data *fd);
138
147 int32_t (*get_process_id)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
148
157 const char *(*get_process_name)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
158
168 const uint8_t *(*get_process_uuid)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number, size_t *uuid_size);
169};
170
178/*
179 Ref 1
180 Epan
181 Enhanced Packet ANalyzer, aka the packet analyzing engine. Source code can be found in the epan directory.
182
183 Protocol-Tree - Keep data of the capture file protocol information.
184
185 Dissectors - The various protocol dissectors in epan/dissectors.
186
187 Plugins - Some of the protocol dissectors are implemented as plugins. Source code can be found at plugins.
188
189 Display-Filters - the display filter engine at epan/dfilter
190
191*/
192
196 typedef struct {
197 const char* env_var_prefix;
198 const char** col_fmt;
199 int num_cols;
200 bool supports_packets;
201 register_entity_func register_func;
202 register_entity_func handoff_func;
203 struct _tap_reg const* tap_reg_listeners;
204} epan_app_data_t;
205
217WS_DLL_PUBLIC
218 bool epan_init(register_cb cb, void *client_data, bool load_plugins, epan_app_data_t* app_data);
219
225WS_DLL_PUBLIC
226 e_prefs *epan_load_settings(void);
227
234WS_DLL_PUBLIC
235 void epan_cleanup(void);
236
237
245 typedef struct {
249 void (*init)(void);
250
254 void (*post_init)(void);
255
259 void (*dissect_init)(epan_dissect_t *);
260
264 void (*dissect_cleanup)(epan_dissect_t *);
265
269 void (*cleanup)(void);
270
277 void (*register_all_protocols)(register_cb cb, void *user_data);
278
285 void (*register_all_handoffs)(register_cb cb, void *user_data);
286
290 void (*register_all_tap_listeners)(void);
291} epan_plugin;
292
305WS_DLL_PUBLIC void epan_register_plugin(const epan_plugin *plugin);
306
315WS_DLL_PUBLIC int epan_plugins_supported(void);
316
324 void epan_conversation_init(void);
325
326
327 typedef struct epan_session epan_t;
338 typedef struct epan_session epan_t;
339
353WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider_data *prov,
354 const struct packet_provider_funcs *funcs);
355
368WS_DLL_PUBLIC wtap_block_t epan_get_modified_block(const epan_t *session, const frame_data *fd);
369
385WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, uint32_t interface_id, unsigned section_number);
386
401WS_DLL_PUBLIC const char *epan_get_interface_description(const epan_t *session, uint32_t interface_id, unsigned section_number);
402
419WS_DLL_PUBLIC int32_t epan_get_process_id(const epan_t *session, uint32_t process_info_id, unsigned section_number);
420
437WS_DLL_PUBLIC const char *epan_get_process_name(const epan_t *session, uint32_t process_info_id, unsigned section_number);
438
456WS_DLL_PUBLIC const uint8_t *epan_get_process_uuid(const epan_t *session, uint32_t process_info_id, unsigned section_number, size_t *uuid_size);
457
470 const nstime_t *epan_get_frame_ts(const epan_t *session, uint32_t frame_num);
471
482 const nstime_t *epan_get_start_ts(const epan_t *session);
483
493WS_DLL_PUBLIC void epan_free(epan_t *session);
494
505WS_DLL_PUBLIC const char* epan_get_version(void);
506
520WS_DLL_PUBLIC void epan_get_version_number(int *major, int *minor, int *micro);
521
530WS_DLL_PUBLIC const char* epan_get_environment_prefix(void);
531
540 bool epan_supports_packets(void);
541
556WS_DLL_PUBLIC
557 void epan_set_always_visible(bool force);
558
567WS_DLL_PUBLIC
568 void
569 epan_dissect_init(epan_dissect_t *edt, epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
570
583WS_DLL_PUBLIC
584 epan_dissect_t*
585 epan_dissect_new(epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
586
596WS_DLL_PUBLIC
597 void
598 epan_dissect_reset(epan_dissect_t *edt);
599
606WS_DLL_PUBLIC
607 void
608 epan_dissect_fake_protocols(epan_dissect_t *edt, const bool fake_protocols);
609
623WS_DLL_PUBLIC
624 void
625 epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
626 wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo);
627
644WS_DLL_PUBLIC
645 void
646 epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
647 wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo);
648
664WS_DLL_PUBLIC
665 void
666 epan_dissect_file_run(epan_dissect_t *edt, wtap_rec *rec,
667 frame_data *fd, struct epan_column_info *cinfo);
668
685WS_DLL_PUBLIC
686 void
687 epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec,
688 frame_data *fd, struct epan_column_info *cinfo);
689
706WS_DLL_PUBLIC
707 void
708 epan_dissect_prime_with_dfilter(epan_dissect_t *edt, const struct epan_dfilter *dfcode);
709
723WS_DLL_PUBLIC
724 void
725 epan_dissect_prime_with_dfilter_print(epan_dissect_t *edt, const struct epan_dfilter *dfcode);
726
740WS_DLL_PUBLIC
741 void
742 epan_dissect_prime_with_hfid(epan_dissect_t *edt, int hfid);
743
757WS_DLL_PUBLIC
758 void
759 epan_dissect_prime_with_hfid_array(epan_dissect_t *edt, GArray *hfids);
760
773WS_DLL_PUBLIC
774 void
775 epan_dissect_fill_in_columns(epan_dissect_t *edt, const bool fill_col_exprs, const bool fill_fd_colums);
776
792WS_DLL_PUBLIC
793 bool
794 epan_dissect_packet_contains_field(epan_dissect_t* edt,
795 const char *field_name);
796
810WS_DLL_PUBLIC
811 void
812 epan_dissect_cleanup(epan_dissect_t* edt);
813
824WS_DLL_PUBLIC
825 void
826 epan_dissect_free(epan_dissect_t* edt);
827
845 const char *
846 epan_custom_set(epan_dissect_t *edt, GSList *ids, int occurrence, bool display_details,
847 char *result, char *expr, const int size);
848
854WS_DLL_PUBLIC
855 void
856 epan_gather_compile_info(feature_list l);
857
863WS_DLL_PUBLIC
864 void
865 epan_gather_runtime_info(feature_list l);
866
867#ifdef __cplusplus
868}
869#endif /* __cplusplus */
870
871#endif /* __EPAN_H__ */
epan_dissect_init
WS_DLL_PUBLIC void epan_dissect_init(epan_dissect_t *edt, epan_t *session, const bool create_proto_tree, const bool proto_tree_visible)
Initialize an existing single packet dissection.
Definition epan.c:656
epan_dissect_fake_protocols
WS_DLL_PUBLIC void epan_dissect_fake_protocols(epan_dissect_t *edt, const bool fake_protocols)
Indicate whether protocols should be faked during dissection.
Definition epan.c:727
epan_get_process_id
WS_DLL_PUBLIC int32_t epan_get_process_id(const epan_t *session, uint32_t process_info_id, unsigned section_number)
Retrieve the process ID associated with a given process info record.
Definition epan.c:588
epan_init
WS_DLL_PUBLIC bool epan_init(register_cb cb, void *client_data, bool load_plugins, epan_app_data_t *app_data)
Initialize the entire epan module.
Definition epan.c:272
epan_conversation_init
void epan_conversation_init(void)
Initialize the table of conversations.
Definition epan.c:635
epan_dissect_file_run
WS_DLL_PUBLIC void epan_dissect_file_run(epan_dissect_t *edt, wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo)
Run a dissection of file-based packet data.
Definition epan.c:764
wireshark_abort_on_dissector_bug
bool wireshark_abort_on_dissector_bug
Controls whether Wireshark should abort on a dissector bug.
Definition epan.c:123
epan_gather_compile_info
WS_DLL_PUBLIC void epan_gather_compile_info(feature_list l)
Get compile-time information for libraries used by libwireshark.
Definition epan.c:897
epan_dissect_cleanup
WS_DLL_PUBLIC void epan_dissect_cleanup(epan_dissect_t *edt)
Release resources associated with a packet dissection context.
Definition epan.c:791
epan_get_process_name
WS_DLL_PUBLIC const char * epan_get_process_name(const epan_t *session, uint32_t process_info_id, unsigned section_number)
Retrieve the name of a process associated with a given process info record.
Definition epan.c:606
epan_new
WS_DLL_PUBLIC epan_t * epan_new(struct packet_provider_data *prov, const struct packet_provider_funcs *funcs)
Create a new epan dissection session.
Definition epan.c:515
epan_get_interface_description
WS_DLL_PUBLIC const char * epan_get_interface_description(const epan_t *session, uint32_t interface_id, unsigned section_number)
Retrieve the description of a network interface.
Definition epan.c:548
epan_load_settings
WS_DLL_PUBLIC e_prefs * epan_load_settings(void)
Load all settings from the current profile that affect epan.
Definition epan.c:414
epan_free
WS_DLL_PUBLIC void epan_free(epan_t *session)
Free an epan dissection session.
Definition epan.c:624
epan_dissect_prime_with_hfid
WS_DLL_PUBLIC void epan_dissect_prime_with_hfid(epan_dissect_t *edt, int hfid)
Prime a dissection context's protocol tree with a specific field or protocol.
Definition epan.c:840
epan_dissect_reset
WS_DLL_PUBLIC void epan_dissect_reset(epan_dissect_t *edt)
Reset a dissection context for reuse.
Definition epan.c:685
epan_plugins_supported
WS_DLL_PUBLIC int epan_plugins_supported(void)
Check plugin support status for libwireshark components.
Definition epan.c:255
epan_cleanup
WS_DLL_PUBLIC void epan_cleanup(void)
Clean up the entire epan module.
Definition epan.c:433
epan_dissect_free
WS_DLL_PUBLIC void epan_dissect_free(epan_dissect_t *edt)
Free a single packet dissection context.
Definition epan.c:821
epan_dissect_fill_in_columns
WS_DLL_PUBLIC void epan_dissect_fill_in_columns(epan_dissect_t *edt, const bool fill_col_exprs, const bool fill_fd_colums)
Populate packet list columns with dissection output.
Definition epan.c:868
epan_get_version_number
WS_DLL_PUBLIC void epan_get_version_number(int *major, int *minor, int *micro)
Retrieve the version number of the epan library.
Definition epan.c:153
epan_get_modified_block
WS_DLL_PUBLIC wtap_block_t epan_get_modified_block(const epan_t *session, const frame_data *fd)
Retrieve a modified capture block associated with a specific frame.
Definition epan.c:530
epan_get_environment_prefix
WS_DLL_PUBLIC const char * epan_get_environment_prefix(void)
Retrieve the environment prefix string used by epan.
Definition epan.c:164
ws_dissector_bug
WS_DLL_PUBLIC void ws_dissector_bug(const char *format,...) G_GNUC_PRINTF(1
Report a dissector bug (and optionally abort).
epan_supports_packets
bool epan_supports_packets(void)
TEMPORARY HACK to indicate whether epan supports packet dissection.
Definition epan.c:169
epan_dissect_packet_contains_field
WS_DLL_PUBLIC bool epan_dissect_packet_contains_field(epan_dissect_t *edt, const char *field_name)
Check whether a dissected packet contains a specific named field.
Definition epan.c:875
epan_get_frame_ts
const nstime_t * epan_get_frame_ts(const epan_t *session, uint32_t frame_num)
Retrieve the timestamp of a specific frame.
Definition epan.c:557
epan_dissect_prime_with_dfilter
WS_DLL_PUBLIC void epan_dissect_prime_with_dfilter(epan_dissect_t *edt, const struct epan_dfilter *dfcode)
Prime a dissection context's protocol tree using a display filter.
epan_get_process_uuid
WS_DLL_PUBLIC const uint8_t * epan_get_process_uuid(const epan_t *session, uint32_t process_info_id, unsigned section_number, size_t *uuid_size)
Retrieve the UUID of a process associated with a given process info record.
Definition epan.c:615
epan_get_start_ts
const nstime_t * epan_get_start_ts(const epan_t *session)
Retrieve the start timestamp of the capture session.
Definition epan.c:572
epan_dissect_run
WS_DLL_PUBLIC void epan_dissect_run(epan_dissect_t *edt, int file_type_subtype, wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo)
Run a single packet dissection.
Definition epan.c:734
epan_gather_runtime_info
WS_DLL_PUBLIC void epan_gather_runtime_info(feature_list l)
Get runtime information for libraries used by libwireshark.
Definition epan.c:1006
epan_dissect_prime_with_hfid_array
WS_DLL_PUBLIC void epan_dissect_prime_with_hfid_array(epan_dissect_t *edt, GArray *hfids)
Prime a dissection context's protocol tree with a set of fields or protocols.
Definition epan.c:846
epan_get_version
WS_DLL_PUBLIC const char * epan_get_version(void)
Retrieve the epan library's version as a string.
Definition epan.c:148
epan_dissect_new
WS_DLL_PUBLIC epan_dissect_t * epan_dissect_new(epan_t *session, const bool create_proto_tree, const bool proto_tree_visible)
Create a new single packet dissection.
Definition epan.c:716
epan_dissect_prime_with_dfilter_print
WS_DLL_PUBLIC void epan_dissect_prime_with_dfilter_print(epan_dissect_t *edt, const struct epan_dfilter *dfcode)
Prime a dissection context's protocol tree using a display filter, marking fields for print output.
wireshark_abort_on_too_many_items
bool wireshark_abort_on_too_many_items
Controls whether Wireshark should abort when too many items are added to a tree.
Definition epan.c:124
epan_dissect_file_run_with_taps
WS_DLL_PUBLIC void epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo)
Run a dissection of file-based packet data and invoke tap listeners.
Definition epan.c:778
epan_set_always_visible
WS_DLL_PUBLIC void epan_set_always_visible(bool force)
Set or unset the tree to always be visible when epan_dissect_init() is called.
Definition epan.c:647
epan_dissect_run_with_taps
WS_DLL_PUBLIC void epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype, wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo)
Run a single packet dissection and invoke tap listeners.
Definition epan.c:751
epan_custom_set
const char * epan_custom_set(epan_dissect_t *edt, GSList *ids, int occurrence, bool display_details, char *result, char *expr, const int size)
Set the value of a custom column based on specified fields and expression.
Definition epan.c:858
epan_register_plugin
WS_DLL_PUBLIC void epan_register_plugin(const epan_plugin *plugin)
Register an epan plugin with the dissection engine.
epan_get_interface_name
WS_DLL_PUBLIC const char * epan_get_interface_name(const epan_t *session, uint32_t interface_id, unsigned section_number)
Retrieve the name of a network interface.
Definition epan.c:539
feature_list.h
feature_list
GList ** feature_list
Semi-opaque handle to a list of features or dependencies.
Definition feature_list.h:33
frame_data.h
prefs.h
register.h
_e_prefs
Definition prefs.h:174
_plugin
Definition plugins.c:29
_tap_reg
Definition tap.h:82
epan_app_data_t
Information about the application that wants to use epan.
Definition epan.h:196
epan_app_data_t::register_func
register_entity_func register_func
Definition epan.h:201
epan_app_data_t::num_cols
int num_cols
Definition epan.h:199
epan_app_data_t::env_var_prefix
const char * env_var_prefix
Definition epan.h:197
epan_app_data_t::tap_reg_listeners
struct _tap_reg const * tap_reg_listeners
Definition epan.h:203
epan_app_data_t::col_fmt
const char ** col_fmt
Definition epan.h:198
epan_app_data_t::handoff_func
register_entity_func handoff_func
Definition epan.h:202
epan_app_data_t::supports_packets
bool supports_packets
Definition epan.h:200
epan_column_info
Definition column-info.h:62
epan_dfilter
Definition dfilter-int.h:35
epan_dissect
Definition epan_dissect.h:28
epan_plugin
Plugin interface for EPAN modules.
Definition epan.h:245
epan_session
Definition epan.c:509
nstime_t
Definition nstime.h:26
packet_provider_data
Definition cfile.h:58
packet_provider_funcs
Structure containing pointers to functions supplied by the user of libwireshark.
Definition epan.h:84
packet_provider_funcs::get_modified_block
wtap_block_t(* get_modified_block)(struct packet_provider_data *prov, const frame_data *fd)
Get a modified WTAP block for a given frame.
Definition epan.h:137
packet_provider_funcs::get_process_id
int32_t(* get_process_id)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number)
Get the process ID associated with a packet.
Definition epan.h:147
wtap_block
Definition wtap_opttypes.h:272
wtap_rec
Definition wtap.h:1512
tvbuff.h
wtap_opttypes.h