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>
19
20#ifdef __cplusplus
21extern "C" {
22#endif /* __cplusplus */
23
32
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
66
67struct epan_dfilter;
68struct epan_column_info;
69
77
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/*
179Ref 1
180Epan
181Enhanced Packet ANalyzer, aka the packet analyzing engine. Source code can be found in the epan directory.
182
183Protocol-Tree - Keep data of the capture file protocol information.
184
185Dissectors - The various protocol dissectors in epan/dissectors.
186
187Plugins - Some of the protocol dissectors are implemented as plugins. Source code can be found at plugins.
188
189Display-Filters - the display filter engine at epan/dfilter
190
191*/
192
196typedef struct {
197 const char* env_var_prefix;
198 const char** col_fmt;
201 register_entity_func register_func;
202 register_entity_func handoff_func;
205
217WS_DLL_PUBLIC
218bool epan_init(register_cb cb, void *client_data, bool load_plugins, epan_app_data_t* app_data);
219
225WS_DLL_PUBLIC
227
234WS_DLL_PUBLIC
235void epan_cleanup(void);
236
237
245typedef 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);
292
305WS_DLL_PUBLIC void epan_register_plugin(const epan_plugin *plugin);
306
315WS_DLL_PUBLIC int epan_plugins_supported(void);
316
324void epan_conversation_init(void);
325
326
327typedef struct epan_session epan_t;
338typedef 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
470const nstime_t *epan_get_frame_ts(const epan_t *session, uint32_t frame_num);
471
482const 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
540bool epan_supports_packets(void);
541
556WS_DLL_PUBLIC
557void epan_set_always_visible(bool force);
558
567WS_DLL_PUBLIC
568void
569epan_dissect_init(epan_dissect_t *edt, epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
570
583WS_DLL_PUBLIC
585epan_dissect_new(epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
586
596WS_DLL_PUBLIC
597void
599
606WS_DLL_PUBLIC
607void
608epan_dissect_fake_protocols(epan_dissect_t *edt, const bool fake_protocols);
609
623WS_DLL_PUBLIC
624void
625epan_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
645void
646epan_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
665void
667 frame_data *fd, struct epan_column_info *cinfo);
668
685WS_DLL_PUBLIC
686void
688 frame_data *fd, struct epan_column_info *cinfo);
689
706WS_DLL_PUBLIC
707void
709
723WS_DLL_PUBLIC
724void
726
740WS_DLL_PUBLIC
741void
743
757WS_DLL_PUBLIC
758void
760
773WS_DLL_PUBLIC
774void
775epan_dissect_fill_in_columns(epan_dissect_t *edt, const bool fill_col_exprs, const bool fill_fd_colums);
776
792WS_DLL_PUBLIC
793bool
795 const char *field_name);
796
810WS_DLL_PUBLIC
811void
813
824WS_DLL_PUBLIC
825void
827
845const char *
846epan_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
855void
857
863WS_DLL_PUBLIC
864void
866
867#ifdef __cplusplus
868}
869#endif /* __cplusplus */
870
871#endif /* __EPAN_H__ */
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
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
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
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
void epan_conversation_init(void)
Initialize the table of conversations.
Definition epan.c:635
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
bool wireshark_abort_on_dissector_bug
Controls whether Wireshark should abort on a dissector bug.
Definition epan.c:123
WS_DLL_PUBLIC void epan_gather_compile_info(feature_list l)
Get compile-time information for libraries used by libwireshark.
Definition epan.c:897
WS_DLL_PUBLIC void epan_dissect_cleanup(epan_dissect_t *edt)
Release resources associated with a packet dissection context.
Definition epan.c:791
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
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
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
WS_DLL_PUBLIC e_prefs * epan_load_settings(void)
Load all settings from the current profile that affect epan.
Definition epan.c:414
WS_DLL_PUBLIC void epan_free(epan_t *session)
Free an epan dissection session.
Definition epan.c:624
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
WS_DLL_PUBLIC void epan_dissect_reset(epan_dissect_t *edt)
Reset a dissection context for reuse.
Definition epan.c:685
WS_DLL_PUBLIC int epan_plugins_supported(void)
Check plugin support status for libwireshark components.
Definition epan.c:255
WS_DLL_PUBLIC void epan_cleanup(void)
Clean up the entire epan module.
Definition epan.c:433
WS_DLL_PUBLIC void epan_dissect_free(epan_dissect_t *edt)
Free a single packet dissection context.
Definition epan.c:821
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
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
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
WS_DLL_PUBLIC const char * epan_get_environment_prefix(void)
Retrieve the environment prefix string used by epan.
Definition epan.c:164
WS_DLL_PUBLIC void ws_dissector_bug(const char *format,...) G_GNUC_PRINTF(1
Report a dissector bug (and optionally abort).
bool epan_supports_packets(void)
TEMPORARY HACK to indicate whether epan supports packet dissection.
Definition epan.c:169
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
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
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.
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
const nstime_t * epan_get_start_ts(const epan_t *session)
Retrieve the start timestamp of the capture session.
Definition epan.c:572
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
WS_DLL_PUBLIC void epan_gather_runtime_info(feature_list l)
Get runtime information for libraries used by libwireshark.
Definition epan.c:1006
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
WS_DLL_PUBLIC const char * epan_get_version(void)
Retrieve the epan library's version as a string.
Definition epan.c:148
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
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.
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
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
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
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
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
WS_DLL_PUBLIC void epan_register_plugin(const epan_plugin *plugin)
Register an epan plugin with the dissection engine.
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
GList ** feature_list
Semi-opaque handle to a list of features or dependencies.
Definition feature_list.h:33
Definition prefs.h:174
Definition plugins.c:29
Definition tap.h:82
Information about the application that wants to use epan.
Definition epan.h:196
register_entity_func register_func
Definition epan.h:201
int num_cols
Definition epan.h:199
const char * env_var_prefix
Definition epan.h:197
struct _tap_reg const * tap_reg_listeners
Definition epan.h:203
const char ** col_fmt
Definition epan.h:198
register_entity_func handoff_func
Definition epan.h:202
bool supports_packets
Definition epan.h:200
Definition column-info.h:62
Definition dfilter-int.h:35
Definition epan_dissect.h:28
Plugin interface for EPAN modules.
Definition epan.h:245
Definition epan.c:509
Definition nstime.h:26
Definition cfile.h:58
Structure containing pointers to functions supplied by the user of libwireshark.
Definition epan.h:84
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
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
Definition wtap_opttypes.h:272
Definition wtap.h:1512