Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
expert.h
1 /* expert.h
2  * Collecting of Expert information.
3  *
4  * For further info, see: https://wiki.wireshark.org/Development/ExpertInfo
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 #ifndef __EXPERT_H__
14 #define __EXPERT_H__
15 
16 #include <epan/packet_info.h>
17 #include <epan/proto.h>
18 #include "value_string.h"
19 #include "ws_symbol_export.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
26 typedef struct expert_info_s {
27  guint32 packet_num;
28  int group;
29  int severity;
30  int hf_index; /* hf_index of the expert item. Might be -1. */
31  const gchar *protocol;
32  gchar *summary;
33  proto_item *pitem;
35 
36 /* Expert Info and Display hf data */
37 typedef struct expert_field
38 {
39  int ei;
40  int hf;
41 } expert_field;
42 
43 #define EI_INIT_EI -1
44 #define EI_INIT_HF -1
45 #define EI_INIT {EI_INIT_EI, EI_INIT_HF}
46 
47 typedef struct expert_field_info {
48  /* ---------- set by dissector --------- */
49  const char *name;
50  int group;
51  int severity;
52  const gchar *summary;
53 
54  /* ------- set by register routines (prefilled by EXPFILL macro, see below) ------ */
55  int id;
56  const gchar *protocol;
57  int orig_severity; /* Matches severity when registered, used to restore original severity
58  * if UAT severity entry is removed */
59  hf_register_info hf_info;
60 
62 
63 #define EXPFILL 0, NULL, 0, \
64  {0, {NULL, NULL, FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}}
65 
66 typedef struct ei_register_info {
70 
71 typedef struct expert_module expert_module_t;
72 
73 #define PRE_ALLOC_EXPERT_FIELDS_MEM 5000
74 
75 /* "proto_expert" is exported from libwireshark.dll.
76  * Thus we need a special declaration.
77  */
78 WS_DLL_PUBLIC int proto_expert;
79 
80 extern void
81 expert_init(void);
82 
83 extern void
84 expert_packet_init(void);
85 
86 extern void
87 expert_cleanup(void);
88 
89 extern void
90 expert_packet_cleanup(void);
91 
92 WS_DLL_PUBLIC int
93 expert_get_highest_severity(void);
94 
95 WS_DLL_PUBLIC void
96 expert_update_comment_count(guint64 count);
97 
105 WS_DLL_PUBLIC void
106 expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex);
107 
117 WS_DLL_PUBLIC void
118 expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex,
119  const char *format, ...) G_GNUC_PRINTF(4, 5);
120 
133 WS_DLL_PUBLIC proto_item *
134 proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
135  tvbuff_t *tvb, gint start, gint length);
136 
153 WS_DLL_PUBLIC proto_item *
154 proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
155  tvbuff_t *tvb, gint start, gint length, const char *format, ...) G_GNUC_PRINTF(7, 8);
156 
157 /*
158  * Register that a protocol has expert info.
159  */
160 WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
161 
165 void expert_deregister_expertinfo (const char *abbrev);
166 
170 void expert_deregister_protocol (expert_module_t *module);
171 
175 void expert_free_deregistered_expertinfos (void);
176 
182 WS_DLL_PUBLIC const gchar* expert_get_summary(expert_field *eiindex);
183 
188 WS_DLL_PUBLIC void
189 expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records);
190 
191 #define EXPERT_CHECKSUM_DISABLED -2
192 #define EXPERT_CHECKSUM_UNKNOWN -1
193 #define EXPERT_CHECKSUM_GOOD 0
194 #define EXPERT_CHECKSUM_BAD 1
195 
196 WS_DLL_PUBLIC const value_string expert_group_vals[];
197 
198 WS_DLL_PUBLIC const value_string expert_severity_vals[];
199 
200 WS_DLL_PUBLIC const value_string expert_checksum_vals[];
201 
202 #ifdef __cplusplus
203 }
204 #endif /* __cplusplus */
205 
206 #endif /* __EXPERT_H__ */
207 
208 /*
209  * Editor modelines - https://www.wireshark.org/tools/modelines.html
210  *
211  * Local variables:
212  * c-basic-offset: 8
213  * tab-width: 8
214  * indent-tabs-mode: t
215  * End:
216  *
217  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
218  * :indentSize=8:tabSize=8:noTabs=false:
219  */
Definition: packet_info.h:44
Definition: proto.h:658
Definition: tvbuff-int.h:35
expert_field * ids
Definition: expert.h:67
Definition: expert.c:44
expert_field_info eiinfo
Definition: expert.h:68
Definition: expert.h:66
Definition: expert.h:47
Definition: expert.h:26
Definition: expert.h:37
Definition: value_string.h:24
Definition: proto.h:759