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
28extern bool wireshark_abort_on_too_many_items;
29
36WS_DLL_PUBLIC void ws_dissector_bug(const char *format, ...)
37 G_GNUC_PRINTF(1,2);
38
45#define ws_dissector_oops(_fmt, ...) ws_dissector_bug("OOPS: " _fmt, __VA_ARGS__)
46
54
55struct epan_dfilter;
56struct epan_column_info;
57
65
73 const nstime_t *(*get_frame_ts)(struct packet_provider_data *prov, uint32_t frame_num);
74 const nstime_t *(*get_start_ts)(struct packet_provider_data *prov);
75 const nstime_t *(*get_end_ts)(struct packet_provider_data *prov);
76 const char *(*get_interface_name)(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
77 const char *(*get_interface_description)(struct packet_provider_data *prov, uint32_t interface_id, unsigned section_number);
78 wtap_block_t (*get_modified_block)(struct packet_provider_data *prov, const frame_data *fd);
79 int32_t(*get_process_id)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
80 const char *(*get_process_name)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number);
81 const uint8_t *(*get_process_uuid)(struct packet_provider_data *prov, uint32_t process_info_id, unsigned section_number, size_t *uuid_size);
82};
83
91/*
92Ref 1
93Epan
94Enhanced Packet ANalyzer, aka the packet analyzing engine. Source code can be found in the epan directory.
95
96Protocol-Tree - Keep data of the capture file protocol information.
97
98Dissectors - The various protocol dissectors in epan/dissectors.
99
100Plugins - Some of the protocol dissectors are implemented as plugins. Source code can be found at plugins.
101
102Display-Filters - the display filter engine at epan/dfilter
103
104*/
105
117WS_DLL_PUBLIC
118bool epan_init(register_cb cb, void *client_data, bool load_plugins);
119
125WS_DLL_PUBLIC
127
134WS_DLL_PUBLIC
135void epan_cleanup(void);
136
137
138typedef struct {
139 void (*init)(void); /* Called before proto_init() */
140 void (*post_init)(void); /* Called at the end of epan_init() */
141 void (*dissect_init)(epan_dissect_t *);
142 void (*dissect_cleanup)(epan_dissect_t *);
143 void (*cleanup)(void);
144 void (*register_all_protocols)(register_cb, void *);
145 void (*register_all_handoffs)(register_cb, void *);
146 void (*register_all_tap_listeners)(void);
148
161WS_DLL_PUBLIC void epan_register_plugin(const epan_plugin *plugin);
162
171WS_DLL_PUBLIC int epan_plugins_supported(void);
172
180void epan_conversation_init(void);
181
182
183typedef struct epan_session epan_t;
194typedef struct epan_session epan_t;
195
209WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider_data *prov,
210 const struct packet_provider_funcs *funcs);
211
224WS_DLL_PUBLIC wtap_block_t epan_get_modified_block(const epan_t *session, const frame_data *fd);
225
241WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, uint32_t interface_id, unsigned section_number);
242
257WS_DLL_PUBLIC const char *epan_get_interface_description(const epan_t *session, uint32_t interface_id, unsigned section_number);
258
275WS_DLL_PUBLIC int32_t epan_get_process_id(const epan_t *session, uint32_t process_info_id, unsigned section_number);
276
293WS_DLL_PUBLIC const char *epan_get_process_name(const epan_t *session, uint32_t process_info_id, unsigned section_number);
294
312WS_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);
313
326const nstime_t *epan_get_frame_ts(const epan_t *session, uint32_t frame_num);
327
338const nstime_t *epan_get_start_ts(const epan_t *session);
339
349WS_DLL_PUBLIC void epan_free(epan_t *session);
350
361WS_DLL_PUBLIC const char* epan_get_version(void);
362
376WS_DLL_PUBLIC void epan_get_version_number(int *major, int *minor, int *micro);
377
392WS_DLL_PUBLIC
393void epan_set_always_visible(bool force);
394
403WS_DLL_PUBLIC
404void
405epan_dissect_init(epan_dissect_t *edt, epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
406
419WS_DLL_PUBLIC
421epan_dissect_new(epan_t *session, const bool create_proto_tree, const bool proto_tree_visible);
422
432WS_DLL_PUBLIC
433void
435
442WS_DLL_PUBLIC
443void
444epan_dissect_fake_protocols(epan_dissect_t *edt, const bool fake_protocols);
445
459WS_DLL_PUBLIC
460void
461epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
462 wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo);
463
480WS_DLL_PUBLIC
481void
482epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
483 wtap_rec *rec, frame_data *fd, struct epan_column_info *cinfo);
484
500WS_DLL_PUBLIC
501void
503 frame_data *fd, struct epan_column_info *cinfo);
504
521WS_DLL_PUBLIC
522void
524 frame_data *fd, struct epan_column_info *cinfo);
525
542WS_DLL_PUBLIC
543void
545
559WS_DLL_PUBLIC
560void
562
576WS_DLL_PUBLIC
577void
579
593WS_DLL_PUBLIC
594void
596
609WS_DLL_PUBLIC
610void
611epan_dissect_fill_in_columns(epan_dissect_t *edt, const bool fill_col_exprs, const bool fill_fd_colums);
612
628WS_DLL_PUBLIC
629bool
631 const char *field_name);
632
646WS_DLL_PUBLIC
647void
649
660WS_DLL_PUBLIC
661void
663
681const char *
682epan_custom_set(epan_dissect_t *edt, GSList *ids, int occurrence, bool display_details,
683 char *result, char *expr, const int size);
684
690WS_DLL_PUBLIC
691void
693
699WS_DLL_PUBLIC
700void
702
703#ifdef __cplusplus
704}
705#endif /* __cplusplus */
706
707#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:626
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:697
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:558
void epan_conversation_init(void)
Initialize the table of conversations.
Definition epan.c:605
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:734
bool wireshark_abort_on_dissector_bug
Definition epan.c:119
WS_DLL_PUBLIC void epan_gather_compile_info(feature_list l)
Get compile-time information for libraries used by libwireshark.
Definition epan.c:867
WS_DLL_PUBLIC void epan_dissect_cleanup(epan_dissect_t *edt)
Release resources associated with a packet dissection context.
Definition epan.c:761
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:576
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:485
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:518
WS_DLL_PUBLIC e_prefs * epan_load_settings(void)
Load all settings from the current profile that affect epan.
Definition epan.c:386
WS_DLL_PUBLIC void epan_free(epan_t *session)
Free an epan dissection session.
Definition epan.c:594
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:810
WS_DLL_PUBLIC void epan_dissect_reset(epan_dissect_t *edt)
Reset a dissection context for reuse.
Definition epan.c:655
WS_DLL_PUBLIC bool epan_init(register_cb cb, void *client_data, bool load_plugins)
Initialize the entire epan module.
Definition epan.c:257
WS_DLL_PUBLIC int epan_plugins_supported(void)
Check plugin support status for libwireshark components.
Definition epan.c:240
WS_DLL_PUBLIC void epan_cleanup(void)
Clean up the entire epan module.
Definition epan.c:405
WS_DLL_PUBLIC void epan_dissect_free(epan_dissect_t *edt)
Free a single packet dissection context.
Definition epan.c:791
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:838
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:149
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:500
WS_DLL_PUBLIC void ws_dissector_bug(const char *format,...) G_GNUC_PRINTF(1
Report a dissector bug (and optionally abort).
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:845
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:527
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:585
const nstime_t * epan_get_start_ts(const epan_t *session)
Retrieve the start timestamp of the capture session.
Definition epan.c:542
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:704
WS_DLL_PUBLIC void epan_gather_runtime_info(feature_list l)
Get runtime information for libraries used by libwireshark.
Definition epan.c:976
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:816
WS_DLL_PUBLIC const char * epan_get_version(void)
Retrieve the epan library's version as a string.
Definition epan.c:144
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:686
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.
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:748
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:617
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:721
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:828
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:509
GList ** feature_list
Semi-opaque handle to a list of features or dependencies.
Definition feature_list.h:33
void register_all_protocols(register_cb cb, void *client_data)
Definition register.c:65
Definition prefs.h:174
Definition plugins.c:29
Definition column-info.h:62
Definition dfilter-int.h:35
Definition epan_dissect.h:28
Definition epan.h:138
Definition epan.c:479
Definition nstime.h:26
Definition cfile.h:58
Structure containing pointers to functions supplied by the user of libwireshark.
Definition epan.h:72
Definition wtap_opttypes.h:272
Definition wtap.h:1442