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
This commit is contained in:
Ulf Lamping 2006-08-31 22:56:38 +00:00
parent b1719dd68f
commit d4499eb9a7
6 changed files with 60 additions and 36 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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;