diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2006-08-31 22:56:38 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2006-08-31 22:56:38 +0000 |
commit | d4499eb9a7a19865af8ca214f70e605004e21ec7 (patch) | |
tree | a22d751bd4fc4161d1ddd6894fc4b6031140000b | |
parent | b1719dd68f41de467407706a697ef653715e8430 (diff) | |
download | wireshark-d4499eb9a7a19865af8ca214f70e605004e21ec7.tar.gz wireshark-d4499eb9a7a19865af8ca214f70e605004e21ec7.tar.bz2 wireshark-d4499eb9a7a19865af8ca214f70e605004e21ec7.zip |
move value_strings from expert_dialogs into expert.c to remove duplicates
keep the highest severity level of the current file (experimental)
svn path=/trunk/; revision=19104
-rw-r--r-- | epan/expert.c | 40 | ||||
-rw-r--r-- | epan/expert.h | 6 | ||||
-rw-r--r-- | epan/libwireshark.def | 10 | ||||
-rw-r--r-- | epan/packet.c | 6 | ||||
-rw-r--r-- | gtk/expert_comp_table.c | 14 | ||||
-rw-r--r-- | gtk/expert_dlg.c | 20 |
6 files changed, 60 insertions, 36 deletions
diff --git a/epan/expert.c b/epan/expert.c index edc27b37c2..037331bf38 100644 --- a/epan/expert.c +++ b/epan/expert.c @@ -36,6 +36,30 @@ static int expert_tap = -1; +static int highest_severity = 0; + + +const value_string expert_group_vals[] = { + { PI_CHECKSUM, "Checksum" }, + { PI_SEQUENCE, "Sequence" }, + { PI_RESPONSE_CODE, "Response" }, + { PI_REQUEST_CODE, "Request" }, + { PI_UNDECODED, "Undecoded" }, + { PI_MALFORMED, "Malformed" }, + { PI_REASSEMBLE, "Reassemble" }, +/* { PI_SECURITY, "Security" },*/ + { 0, NULL } +}; + +const value_string expert_severity_vals[] = { + { PI_ERROR, "Error" }, + { PI_WARN, "Warn" }, + { PI_NOTE, "Note" }, + { PI_CHAT, "Chat" }, + { 0, "Ok" }, + { 0, NULL } +}; + void @@ -44,8 +68,11 @@ expert_init(void) if(expert_tap == -1) { expert_tap = register_tap("expert"); } + + highest_severity = 0; } + void expert_cleanup(void) { @@ -53,6 +80,13 @@ expert_cleanup(void) } +int +expert_get_highest_severity(void) +{ + return highest_severity; +} + + /* set's the PI_ flags to a protocol item * (and it's parent items till the toplevel) */ static void @@ -81,6 +115,10 @@ packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, return; } + if(severity > highest_severity) { + highest_severity = severity; + } + /* XXX - use currently nonexistant se_vsnprintf instead */ ret = g_vsnprintf(formatted, sizeof(formatted), format, ap); if ((ret == -1) || (ret >= sizeof(formatted))) @@ -92,7 +130,7 @@ packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, ei->severity = severity; ei->protocol = ep_strdup(pinfo->current_proto); ei->summary = ep_strdup(formatted); - ei->pitem = NULL; + ei->pitem = NULL; /* if we have a proto_item (not a faked item), set expert attributes to it */ if(pi != NULL && pi->finfo != NULL) { diff --git a/epan/expert.h b/epan/expert.h index e1f3ea80f2..75d4333690 100644 --- a/epan/expert.h +++ b/epan/expert.h @@ -29,6 +29,7 @@ #include "gnuc_format_check.h" #include <epan/proto.h> +#include "value_string.h" /** only for internal and display use */ @@ -41,6 +42,8 @@ typedef struct expert_info_s { proto_item *pitem; } expert_info_t; +WS_VAR_IMPORT const value_string expert_severity_vals[]; +WS_VAR_IMPORT const value_string expert_group_vals[]; extern void expert_init(void); @@ -48,6 +51,9 @@ expert_init(void); extern void expert_cleanup(void); +extern int +expert_get_highest_severity(void); + /** Add an expert info. @param pinfo packet info of the currently processed packet diff --git a/epan/libwireshark.def b/epan/libwireshark.def index cc15f4e386..f309e5d02c 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -1,6 +1,13 @@ ; libwireshark.def ; $Id$ +; Add symbols that should be exported out of libwireshark.dll, +; e.g. when used inside the GUI. +; +; DATA symbols must be declared WS_VAR_IMPORT in the header file! +; +; NOTE: TABS DON'T WORK IN THIS FILE, USE SPACES INSTEAD!!! +; EXPORTS abs_time_to_str address_to_str @@ -262,6 +269,9 @@ except_throwd except_throwf except_unhandled_catcher expert_add_info_format +expert_get_highest_severity +expert_group_vals DATA +expert_severity_vals DATA FacilityReason_vals DATA fc_fc4_val DATA file_open_error_message diff --git a/epan/packet.c b/epan/packet.c index 22afd47c56..8fd1f0bfcd 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -55,6 +55,7 @@ #include <epan/reassemble.h> #include <epan/stream.h> +#include <epan/expert.h> static gint proto_malformed = -1; static dissector_handle_t frame_handle = NULL; @@ -148,8 +149,11 @@ init_dissection(void) data structures that "reassemble_init()" frees. */ reassemble_init(); - /* Initialise the stream-handling tables */ + /* Initialize the stream-handling tables */ stream_init(); + + /* Initialize the expert infos */ + expert_init(); } void diff --git a/gtk/expert_comp_table.c b/gtk/expert_comp_table.c index 2d32103dd1..65eb05f660 100644 --- a/gtk/expert_comp_table.c +++ b/gtk/expert_comp_table.c @@ -96,20 +96,6 @@ gpointer userdata) } #endif -/* XXX - move this to a common header file */ -static const value_string expert_group_vals[] = { - { PI_CHECKSUM, "Checksum" }, - { PI_SEQUENCE, "Sequence" }, - { PI_RESPONSE_CODE, "Response" }, - { PI_REQUEST_CODE, "Request" }, - { PI_UNDECODED, "Undecoded" }, - { PI_MALFORMED, "Malformed" }, - { PI_REASSEMBLE, "Reassemble" }, -/* { PI_SECURITY, "Security" },*/ - { 0, NULL } -}; - - #if (GTK_MAJOR_VERSION < 2) typedef struct column_arrows { diff --git a/gtk/expert_dlg.c b/gtk/expert_dlg.c index 3fca66afc0..4c6a716003 100644 --- a/gtk/expert_dlg.c +++ b/gtk/expert_dlg.c @@ -63,14 +63,6 @@ -static const value_string expert_severity_vals[] = { - { PI_ERROR, "Error" }, - { PI_WARN, "Warn" }, - { PI_NOTE, "Note" }, - { PI_CHAT, "Chat" }, - { 0, NULL } -}; - static const value_string expert_severity_om_vals[] = { { PI_ERROR, "Errors only" }, { PI_WARN, "Error+Warn" }, @@ -79,18 +71,6 @@ static const value_string expert_severity_om_vals[] = { { 0, NULL } }; -static const value_string expert_group_vals[] = { - { PI_CHECKSUM, "Checksum" }, - { PI_SEQUENCE, "Sequence" }, - { PI_RESPONSE_CODE, "Response" }, - { PI_REQUEST_CODE, "Request" }, - { PI_UNDECODED, "Undecoded" }, - { PI_MALFORMED, "Malformed" }, - { PI_REASSEMBLE, "Reassemble" }, -/* { PI_SECURITY, "Security" },*/ - { 0, NULL } -}; - typedef struct expert_tapdata_s { GtkWidget *win; GtkWidget *scrolled_window; |