| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
expert.h
Go to the documentation of this file.
1
13#pragma once
14#include <epan/proto.h>
15#include <epan/packet_info.h>
16#include <wsutil/value_string.h>
17#include "ws_symbol_export.h"
18
19#ifdef __cplusplus
20 extern "C" {
21#endif /* __cplusplus */
22
26 typedef struct expert_info_s {
27 uint32_t packet_num;
28 int group;
29 int severity;
30 int hf_index;
31 const char* protocol;
32 char* summary;
33 proto_item* pitem;
34} expert_info_t;
35
36
40 typedef struct expert_field
41{
42 int ei;
43 int hf;
44} expert_field;
45
46#define EI_INIT_EI 0
47#define EI_INIT_HF 0
48#define EI_INIT {EI_INIT_EI, EI_INIT_HF}
49
53 typedef struct expert_field_info {
54 /* ---------- set by dissector --------- */
55 const char* name;
56 int group;
57 int severity;
58 const char* summary;
59
60 /* ------- set by register routines (prefilled by EXPFILL macro) ------ */
61 int id;
62 const char* protocol;
63 int orig_severity;
64 struct expert_field_info* same_name_next;
65 hf_register_info hf_info;
66} expert_field_info;
67
71#define EXPFILL 0, NULL, 0, NULL, \
72 {0, {NULL, NULL, FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}}
73
77 typedef struct ei_register_info {
78 expert_field* ids;
79 expert_field_info eiinfo;
80} ei_register_info;
81
82 typedef struct expert_module expert_module_t;
83
84#define PRE_ALLOC_EXPERT_FIELDS_MEM 5000
85
86/* "proto_expert" is exported from libwireshark.dll.
87 * Thus we need a special declaration.
88 */
89WS_DLL_PUBLIC int proto_expert;
90
96 extern void
97 expert_init(void);
98
104 extern void
105 expert_packet_init(void);
106
110 extern void
111 expert_cleanup(void);
112
119 extern void
120 expert_packet_cleanup(void);
121
127WS_DLL_PUBLIC int
128 expert_get_highest_severity(void);
129
135WS_DLL_PUBLIC void
136 expert_update_comment_count(uint64_t count);
137
148WS_DLL_PUBLIC proto_item *
149 expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex);
150
161WS_DLL_PUBLIC proto_item *
162 expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex,
163 const char *format, ...) G_GNUC_PRINTF(4, 5);
164
177WS_DLL_PUBLIC proto_item *
178proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
179 tvbuff_t *tvb, unsigned start, unsigned length);
180
195
196WS_DLL_PUBLIC proto_item*
197proto_tree_add_expert_remaining(proto_tree* tree, packet_info* pinfo, expert_field* eiindex,
198 tvbuff_t* tvb, unsigned start);
199
219WS_DLL_PUBLIC proto_item *
220proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
221 tvbuff_t *tvb, unsigned start, unsigned length, const char *format, ...) G_GNUC_PRINTF(7, 8);
222
240WS_DLL_PUBLIC proto_item*
241proto_tree_add_expert_format_remaining(proto_tree* tree, packet_info* pinfo, expert_field* eiindex,
242 tvbuff_t* tvb, unsigned start, const char* format, ...) G_GNUC_PRINTF(6, 7);
243
249WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
250
255 void expert_deregister_expertinfo (const char *abbrev);
256
261 void expert_deregister_protocol (expert_module_t *module);
262
266 void expert_free_deregistered_expertinfos (void);
267
276WS_DLL_PUBLIC const char* expert_get_summary(expert_field *eiindex);
277
284WS_DLL_PUBLIC void
285expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records);
286
287#define EXPERT_CHECKSUM_DISABLED -2
288#define EXPERT_CHECKSUM_UNKNOWN -1
289#define EXPERT_CHECKSUM_GOOD 0
290#define EXPERT_CHECKSUM_BAD 1
291
292WS_DLL_PUBLIC const value_string expert_group_vals[];
293
294WS_DLL_PUBLIC const value_string expert_severity_vals[];
295
296WS_DLL_PUBLIC const value_string expert_checksum_vals[];
297
298#ifdef __cplusplus
299}
300#endif /* __cplusplus */
301
302/*
303 * Editor modelines - https://www.wireshark.org/tools/modelines.html
304 *
305 * Local variables:
306 * c-basic-offset: 8
307 * tab-width: 8
308 * indent-tabs-mode: t
309 * End:
310 *
311 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
312 * :indentSize=8:tabSize=8:noTabs=false:
313 */
expert_info_t
struct expert_info_s expert_info_t
Holds expert info data for a single packet event; used internally and for display purposes only.
expert_init
void expert_init(void)
Initializes expert system.
Definition expert.c:269
expert_update_comment_count
WS_DLL_PUBLIC void expert_update_comment_count(uint64_t count)
Update the expert info comment count.
Definition expert.c:320
expert_add_info
WS_DLL_PUBLIC proto_item * expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex)
Add an expert info.
Definition expert.c:682
expert_packet_cleanup
void expert_packet_cleanup(void)
Cleans up resources used by expert processing.
Definition expert.c:280
expert_add_info_format
WS_DLL_PUBLIC proto_item * expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex, const char *format,...)
Definition expert.c:690
expert_get_highest_severity
WS_DLL_PUBLIC int expert_get_highest_severity(void)
Get the highest severity of expert information.
Definition expert.c:314
expert_packet_init
void expert_packet_init(void)
Initializes the expert system for each packet.
Definition expert.c:195
expert_cleanup
void expert_cleanup(void)
Cleans up resources used by expert processing.
Definition expert.c:285
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
proto_item
proto_node proto_item
Definition proto.h:927
packet_info.h
proto.h
ei_register_info
Bundles an expert_field handle with its expert_field_info for use in bulk registration.
Definition expert.h:77
ei_register_info::eiinfo
expert_field_info eiinfo
Definition expert.h:79
ei_register_info::ids
expert_field * ids
Definition expert.h:78
expert_field_info
Describes a registered expert info field, including dissector-supplied metadata and registration stat...
Definition expert.h:53
expert_field_info::group
int group
Definition expert.h:56
expert_field_info::hf_info
hf_register_info hf_info
Definition expert.h:65
expert_field_info::protocol
const char * protocol
Definition expert.h:62
expert_field_info::name
const char * name
Definition expert.h:55
expert_field_info::orig_severity
int orig_severity
Definition expert.h:63
expert_field_info::id
int id
Definition expert.h:61
expert_field_info::severity
int severity
Definition expert.h:57
expert_field_info::same_name_next
struct expert_field_info * same_name_next
Definition expert.h:64
expert_field_info::summary
const char * summary
Definition expert.h:58
expert_field
Pairs an expert info index with its associated header field index for registration and display.
Definition expert.h:41
expert_field::hf
int hf
Definition expert.h:43
expert_field::ei
int ei
Definition expert.h:42
expert_info_s
Holds expert info data for a single packet event; used internally and for display purposes only.
Definition expert.h:26
expert_info_s::pitem
proto_item * pitem
Definition expert.h:33
expert_info_s::protocol
const char * protocol
Definition expert.h:31
expert_info_s::severity
int severity
Definition expert.h:29
expert_info_s::hf_index
int hf_index
Definition expert.h:30
expert_info_s::summary
char * summary
Definition expert.h:32
expert_info_s::group
int group
Definition expert.h:28
expert_info_s::packet_num
uint32_t packet_num
Definition expert.h:27
expert_module
Definition expert.c:48
hf_register_info
Definition proto.h:809
value_string.h
value_string
struct _value_string value_string
Mapping between a 32-bit integer value and its string representation.