Wireshark  4.3.0
The Wireshark network protocol analyzer
expert.h
Go to the documentation of this file.
1 
14 #ifndef __EXPERT_H__
15 #define __EXPERT_H__
16 
17 #include <epan/proto.h>
18 #include <epan/packet_info.h>
19 #include "value_string.h"
20 #include "ws_symbol_export.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25 
27 typedef struct expert_info_s {
28  guint32 packet_num;
29  int group;
30  int severity;
31  int hf_index; /* hf_index of the expert item. Might be -1. */
32  const gchar *protocol;
33  gchar *summary;
34  proto_item *pitem;
36 
37 /* Expert Info and Display hf data */
38 typedef struct expert_field
39 {
40  int ei;
41  int hf;
42 } expert_field;
43 
44 #define EI_INIT_EI -1
45 #define EI_INIT_HF -1
46 #define EI_INIT {EI_INIT_EI, EI_INIT_HF}
47 
48 typedef struct expert_field_info {
49  /* ---------- set by dissector --------- */
50  const char *name;
51  int group;
52  int severity;
53  const gchar *summary;
54 
55  /* ------- set by register routines (prefilled by EXPFILL macro, see below) ------ */
56  int id;
57  const gchar *protocol;
58  int orig_severity; /* Matches severity when registered, used to restore original severity
59  * if UAT severity entry is removed */
60  hf_register_info hf_info;
61 
63 
64 #define EXPFILL 0, NULL, 0, \
65  {0, {NULL, NULL, FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}}
66 
67 typedef struct ei_register_info {
71 
72 typedef struct expert_module expert_module_t;
73 
74 #define PRE_ALLOC_EXPERT_FIELDS_MEM 5000
75 
76 /* "proto_expert" is exported from libwireshark.dll.
77  * Thus we need a special declaration.
78  */
79 WS_DLL_PUBLIC int proto_expert;
80 
81 extern void
82 expert_init(void);
83 
84 extern void
85 expert_packet_init(void);
86 
87 extern void
88 expert_cleanup(void);
89 
90 extern void
91 expert_packet_cleanup(void);
92 
93 WS_DLL_PUBLIC int
94 expert_get_highest_severity(void);
95 
96 WS_DLL_PUBLIC void
97 expert_update_comment_count(guint64 count);
98 
107 WS_DLL_PUBLIC proto_item *
108 expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex);
109 
120 WS_DLL_PUBLIC proto_item *
122  const char *format, ...) G_GNUC_PRINTF(4, 5);
123 
136 WS_DLL_PUBLIC proto_item *
138  tvbuff_t *tvb, gint start, gint length);
139 
156 WS_DLL_PUBLIC proto_item *
158  tvbuff_t *tvb, gint start, gint length, const char *format, ...) G_GNUC_PRINTF(7, 8);
159 
160 /*
161  * Register that a protocol has expert info.
162  */
163 WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
164 
168 void expert_deregister_expertinfo (const char *abbrev);
169 
174 
179 
185 WS_DLL_PUBLIC const gchar* expert_get_summary(expert_field *eiindex);
186 
191 WS_DLL_PUBLIC void
192 expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records);
193 
194 #define EXPERT_CHECKSUM_DISABLED -2
195 #define EXPERT_CHECKSUM_UNKNOWN -1
196 #define EXPERT_CHECKSUM_GOOD 0
197 #define EXPERT_CHECKSUM_BAD 1
198 
199 WS_DLL_PUBLIC const value_string expert_group_vals[];
200 
201 WS_DLL_PUBLIC const value_string expert_severity_vals[];
202 
203 WS_DLL_PUBLIC const value_string expert_checksum_vals[];
204 
205 #ifdef __cplusplus
206 }
207 #endif /* __cplusplus */
208 
209 #endif /* __EXPERT_H__ */
210 
211 /*
212  * Editor modelines - https://www.wireshark.org/tools/modelines.html
213  *
214  * Local variables:
215  * c-basic-offset: 8
216  * tab-width: 8
217  * indent-tabs-mode: t
218  * End:
219  *
220  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
221  * :indentSize=8:tabSize=8:noTabs=false:
222  */
struct expert_info_s expert_info_t
WS_DLL_PUBLIC proto_item * expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex, const char *format,...) G_GNUC_PRINTF(4
WS_DLL_PUBLIC void expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records)
Definition: expert.c:431
WS_DLL_PUBLIC proto_item WS_DLL_PUBLIC proto_item * proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, gint start, gint length)
Definition: expert.c:713
void expert_deregister_expertinfo(const char *abbrev)
Definition: expert.c:335
WS_DLL_PUBLIC proto_item * proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, gint start, gint length, const char *format,...) G_GNUC_PRINTF(7
void expert_free_deregistered_expertinfos(void)
Definition: expert.c:358
WS_DLL_PUBLIC const gchar * expert_get_summary(expert_field *eiindex)
Definition: expert.c:486
void expert_deregister_protocol(expert_module_t *module)
Definition: expert.c:345
WS_DLL_PUBLIC proto_item * expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex)
Definition: expert.c:657
Definition: packet_info.h:44
Definition: proto.h:904
Definition: value_string.h:26
Definition: expert.h:67
expert_field_info eiinfo
Definition: expert.h:69
expert_field * ids
Definition: expert.h:68
Definition: expert.h:48
Definition: expert.h:39
Definition: expert.h:27
Definition: expert.c:48
Definition: proto.h:805
Definition: tvbuff-int.h:35