aboutsummaryrefslogtreecommitdiffstats
path: root/epan/expert.h
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-05-24 17:59:36 +0000
committerMichael Mann <mmann78@netscape.net>2013-05-24 17:59:36 +0000
commit0d1a4b2920fc8638b8b83883ca8b88c06bcbe1dc (patch)
treee7de5f30a5a81847aa8ae3709aea5bc8a3ce9275 /epan/expert.h
parentecd30738130578f3963c5943e6c9bd5b860da796 (diff)
Add expert info configuration framework. Bug 2412 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2412).
Expert info "fields" can now be registered/addressed by name. Right now, the basic framework allows expert info fields to become "display filters". However more could be done, like user preferences overriding default severity level, speeding up expert info dialog load time by not needing to redissect a file, etc. Long term goal is to have all expert_info filterable and have the functionality of expert_add_info_format() include the "registered index". expert_add_info_format_text() is the workaround until all current calls to expert_add_info_format() have been updated with either expert_add_info() or expert_add_info_format_text(). Then the remaining expert_add_info_format_text() will be renamed to expert_add_info_format(). svn path=/trunk/; revision=49559
Diffstat (limited to 'epan/expert.h')
-rw-r--r--epan/expert.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/epan/expert.h b/epan/expert.h
index 66a9b92a0a..86676a1450 100644
--- a/epan/expert.h
+++ b/epan/expert.h
@@ -46,6 +46,39 @@ typedef struct expert_info_s {
proto_item *pitem;
} expert_info_t;
+/* Expert Info and Display hf data */
+typedef struct expert_field
+{
+ int ei;
+ int hf;
+} expert_field;
+
+#define EI_INIT {-1, -1}
+
+typedef struct expert_field_info {
+ /* ---------- set by dissector --------- */
+ const char *name;
+ int group;
+ int severity;
+ const gchar *summary;
+
+ /* ------- set by register routines (prefilled by EXPFILL macro, see below) ------ */
+ int id;
+ const gchar *protocol;
+ hf_register_info hf_info;
+
+} expert_field_info;
+
+#define EXPFILL 0, NULL, \
+ {0, {"Expert Info", NULL, FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}}
+
+typedef struct ei_register_info {
+ expert_field *ids; /**< written to by register() function */
+ expert_field_info eiinfo; /**< the field info to be registered */
+} ei_register_info;
+
+typedef struct expert_module expert_module_t;
+
static const value_string expert_group_vals[] = {
{ PI_CHECKSUM, "Checksum" },
{ PI_SEQUENCE, "Sequence" },
@@ -71,6 +104,8 @@ static const value_string expert_severity_vals[] = {
{ 0, NULL }
};
+#define PRE_ALLOC_EXPERT_FIELDS_MEM 5000
+
/* "proto_expert" is exported from libwireshark.dll.
* Thus we need a special declaration.
*/
@@ -80,12 +115,28 @@ extern void
expert_init(void);
extern void
+expert_packet_init(void);
+
+extern void
expert_cleanup(void);
+extern void
+expert_packet_cleanup(void);
+
WS_DLL_PUBLIC int
expert_get_highest_severity(void);
/** Add an expert info.
+ Add an expert info tree to a protocol item using registered expert info item
+ @param pinfo Packet info of the currently processed packet. May be NULL if
+ pi is supplied
+ @param pi Current protocol item (or NULL)
+ @param eiindex The registered expert info item
+ */
+WS_DLL_PUBLIC void
+expert_add_info(packet_info *pinfo, proto_item *pi, expert_field* eiindex);
+
+/** Add an expert info.
Add an expert info tree to a protocol item, with classification and message.
@param pinfo Packet info of the currently processed packet. May be NULL if
pi is supplied
@@ -99,6 +150,32 @@ expert_add_info_format(packet_info *pinfo, proto_item *pi, int group,
int severity, const char *format, ...)
G_GNUC_PRINTF(5, 6);
+/** Add an expert info.
+ Add an expert info tree to a protocol item, using registered expert info item,
+ but with a formatted message.
+ @param pinfo Packet info of the currently processed packet. May be NULL if
+ pi is supplied
+ @param pi Current protocol item (or NULL)
+ @param eiindex The registered expert info item
+ @param format Printf-style format string for additional arguments
+ */
+WS_DLL_PUBLIC void
+expert_add_info_format_text(packet_info *pinfo, proto_item *pi, expert_field* eiindex,
+ const char *format, ...) G_GNUC_PRINTF(5, 6);
+
+/*
+ * Register that a protocol has expert info.
+ */
+WS_DLL_PUBLIC expert_module_t *expert_register_protocol(int id);
+
+/** Register a expert field array.
+ @param module the protocol handle from expert_register_protocol()
+ @param ei the ei_register_info array
+ @param num_records the number of records in exp */
+WS_DLL_PUBLIC void
+expert_register_field_array(expert_module_t* module, ei_register_info *ei, const int num_records);
+
+
/** Add an expert info about not dissected "item"
Add an expert info tree to a not dissected protocol item.
@param tvb The tvb associated with the item.