| 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, unsigned start, unsigned length);
140
154WS_DLL_PUBLIC proto_item*
155 proto_tree_add_expert_remaining(proto_tree* tree, packet_info* pinfo, expert_field* eiindex,
156 tvbuff_t* tvb, unsigned start);
157
173WS_DLL_PUBLIC proto_item *
174 proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *eiindex,
175 tvbuff_t *tvb, unsigned start, unsigned length, const char *format, ...) G_GNUC_PRINTF(7, 8);
176
194WS_DLL_PUBLIC proto_item*
195 proto_tree_add_expert_format_remaining(proto_tree* tree, packet_info* pinfo, expert_field* eiindex,
196 tvbuff_t* tvb, unsigned start, const char* format, ...) G_GNUC_PRINTF(6, 7);
197
198/*
199 * Register that a protocol has expert info.
200 */
201WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
202
206 void expert_deregister_expertinfo (const char *abbrev);
207
211 void expert_deregister_protocol (expert_module_t *module);
212
216 void expert_free_deregistered_expertinfos (void);
217
223WS_DLL_PUBLIC const char* expert_get_summary(expert_field *eiindex);
224
229WS_DLL_PUBLIC void
230 expert_register_field_array(expert_module_t *module, ei_register_info *ei, const int num_records);
231
232#define EXPERT_CHECKSUM_DISABLED -2
233#define EXPERT_CHECKSUM_UNKNOWN -1
234#define EXPERT_CHECKSUM_GOOD 0
235#define EXPERT_CHECKSUM_BAD 1
236
237WS_DLL_PUBLIC const value_string expert_group_vals[];
238
239WS_DLL_PUBLIC const value_string expert_severity_vals[];
240
241WS_DLL_PUBLIC const value_string expert_checksum_vals[];
242
243#ifdef __cplusplus
244}
245#endif /* __cplusplus */
246
247#endif /* __EXPERT_H__ */
248
249/*
250 * Editor modelines - https://www.wireshark.org/tools/modelines.html
251 *
252 * Local variables:
253 * c-basic-offset: 8
254 * tab-width: 8
255 * indent-tabs-mode: t
256 * End:
257 *
258 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
259 * :indentSize=8:tabSize=8:noTabs=false:
260 */
expert_info_t
struct expert_info_s expert_info_t
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:444
expert_add_info
WS_DLL_PUBLIC proto_item * expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *eiindex)
Definition expert.c:682
expert_deregister_expertinfo
void expert_deregister_expertinfo(const char *abbrev)
Definition expert.c:342
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, unsigned start, unsigned length, const char *format,...)
Definition expert.c:776
proto_tree_add_expert
WS_DLL_PUBLIC proto_item * proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, unsigned start, unsigned length)
Definition expert.c:762
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_free_deregistered_expertinfos
void expert_free_deregistered_expertinfos(void)
Definition expert.c:367
proto_tree_add_expert_format_remaining
WS_DLL_PUBLIC proto_item * proto_tree_add_expert_format_remaining(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, unsigned start, const char *format,...)
Definition expert.c:808
expert_deregister_protocol
void expert_deregister_protocol(expert_module_t *module)
Definition expert.c:354
expert_get_summary
WS_DLL_PUBLIC const char * expert_get_summary(expert_field *eiindex)
Definition expert.c:500
proto_tree_add_expert_remaining
WS_DLL_PUBLIC proto_item * proto_tree_add_expert_remaining(proto_tree *tree, packet_info *pinfo, expert_field *eiindex, tvbuff_t *tvb, unsigned start)
Definition expert.c:769
packet_info.h
proto.h
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:905
_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:801
tvbuff
Definition tvbuff-int.h:36
value_string.h