| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
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 <wsutil/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 uint32_t packet_num;
29 int group; /* from a bitfield, should probably be unsigned */
30 int severity; /* from a bitfield, should probably be unsigned */
31 int hf_index; /* hf_index of the expert item. Might be -1. */
32 const char *protocol;
33 char *summary;
34 proto_item *pitem;
35} expert_info_t;
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 0
45#define EI_INIT_HF 0
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 char *summary;
54
55 /* ------- set by register routines (prefilled by EXPFILL macro, see below) ------ */
56 int id;
57 const char *protocol;
58 int orig_severity; /* Matches severity when registered, used to restore original severity
59 * if UAT severity entry is removed */
60 struct expert_field_info *same_name_next;
61 hf_register_info hf_info;
62
63} expert_field_info;
64
65#define EXPFILL 0, NULL, 0, NULL, \
66 {0, {NULL, NULL, FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}}
67
68 typedef struct ei_register_info {
69 expert_field *ids;
70 expert_field_info eiinfo;
71} ei_register_info;
72
73 typedef struct expert_module expert_module_t;
74
75#define PRE_ALLOC_EXPERT_FIELDS_MEM 5000
76
77/* "proto_expert" is exported from libwireshark.dll.
78 * Thus we need a special declaration.
79 */
80WS_DLL_PUBLIC int proto_expert;
81
82 extern void
83expert_init(void);
84
85 extern void
86expert_packet_init(void);
87
88 extern void
89expert_cleanup(void);
90
91 extern void
92expert_packet_cleanup(void);
93
94WS_DLL_PUBLIC int
95expert_get_highest_severity(void);
96
97WS_DLL_PUBLIC void
98expert_update_comment_count(uint64_t count);
99
108WS_DLL_PUBLIC proto_item *
109 expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex);
110
121WS_DLL_PUBLIC proto_item *
122 expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *eiindex,
123 const char *format, ...) G_GNUC_PRINTF(4, 5);
124
137WS_DLL_PUBLIC proto_item *
138 proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
139 tvbuff_t *tvb, int start, int length);
140
157WS_DLL_PUBLIC proto_item *
158 proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
159 tvbuff_t *tvb, int start, int length, const char *format, ...) G_GNUC_PRINTF(7, 8);
160
161/*
162 * Register that a protocol has expert info.
163 */
164WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
165
169 void expert_deregister_expertinfo (const char *abbrev);
170
174 void expert_deregister_protocol (expert_module_t *module);
175
179 void expert_free_deregistered_expertinfos (void);
180
186WS_DLL_PUBLIC const char* expert_get_summary(expert_field *eiindex);
187
192WS_DLL_PUBLIC void
193 expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records);
194
195#define EXPERT_CHECKSUM_DISABLED -2
196#define EXPERT_CHECKSUM_UNKNOWN -1
197#define EXPERT_CHECKSUM_GOOD 0
198#define EXPERT_CHECKSUM_BAD 1
199
200WS_DLL_PUBLIC const value_string expert_group_vals[];
201
202WS_DLL_PUBLIC const value_string expert_severity_vals[];
203
204WS_DLL_PUBLIC const value_string expert_checksum_vals[];
205
206#ifdef __cplusplus
207}
208#endif /* __cplusplus */
209
210#endif /* __EXPERT_H__ */
211
212/*
213 * Editor modelines - https://www.wireshark.org/tools/modelines.html
214 *
215 * Local variables:
216 * c-basic-offset: 8
217 * tab-width: 8
218 * indent-tabs-mode: t
219 * End:
220 *
221 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
222 * :indentSize=8:tabSize=8:noTabs=false:
223 */
expert_info_t
struct expert_info_s expert_info_t
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,...) G_GNUC_PRINTF(4
expert_register_field_array
WS_DLL_PUBLIC void expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records)
Definition expert.c:443
expert_add_info
WS_DLL_PUBLIC proto_item * expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex)
Definition expert.c:681
expert_deregister_expertinfo
void expert_deregister_expertinfo(const char *abbrev)
Definition expert.c:341
expert_free_deregistered_expertinfos
void expert_free_deregistered_expertinfos(void)
Definition expert.c:366
proto_tree_add_expert
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, int start, int length)
Definition expert.c:737
expert_deregister_protocol
void expert_deregister_protocol(expert_module_t *module)
Definition expert.c:353
expert_get_summary
WS_DLL_PUBLIC const char * expert_get_summary(expert_field *eiindex)
Definition expert.c:499
proto_tree_add_expert_format
WS_DLL_PUBLIC proto_item * proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, int start, int length, const char *format,...) G_GNUC_PRINTF(7
packet_info.h
proto.h
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:907
_value_string
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
ei_register_info
Definition expert.h:68
ei_register_info::eiinfo
expert_field_info eiinfo
Definition expert.h:70
ei_register_info::ids
expert_field * ids
Definition expert.h:69
expert_field_info
Definition expert.h:48
expert_field_info::same_name_next
struct expert_field_info * same_name_next
Definition expert.h:60
expert_field
Definition expert.h:39
expert_info_s
Definition expert.h:27
expert_module
Definition expert.c:48
hf_register_info
Definition proto.h:803
tvbuff
Definition tvbuff-int.h:35
value_string.h