forked from osmocom/wireshark
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:
parent
b1719dd68f
commit
d4499eb9a7
|
@ -36,6 +36,30 @@
|
||||||
|
|
||||||
|
|
||||||
static int expert_tap = -1;
|
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
|
void
|
||||||
|
@ -44,8 +68,11 @@ expert_init(void)
|
||||||
if(expert_tap == -1) {
|
if(expert_tap == -1) {
|
||||||
expert_tap = register_tap("expert");
|
expert_tap = register_tap("expert");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
highest_severity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
expert_cleanup(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
|
/* set's the PI_ flags to a protocol item
|
||||||
* (and it's parent items till the toplevel) */
|
* (and it's parent items till the toplevel) */
|
||||||
static void
|
static void
|
||||||
|
@ -81,6 +115,10 @@ packet_info *pinfo, proto_item *pi, int group, int severity, const char *format,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(severity > highest_severity) {
|
||||||
|
highest_severity = severity;
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX - use currently nonexistant se_vsnprintf instead */
|
/* XXX - use currently nonexistant se_vsnprintf instead */
|
||||||
ret = g_vsnprintf(formatted, sizeof(formatted), format, ap);
|
ret = g_vsnprintf(formatted, sizeof(formatted), format, ap);
|
||||||
if ((ret == -1) || (ret >= sizeof(formatted)))
|
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->severity = severity;
|
||||||
ei->protocol = ep_strdup(pinfo->current_proto);
|
ei->protocol = ep_strdup(pinfo->current_proto);
|
||||||
ei->summary = ep_strdup(formatted);
|
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 we have a proto_item (not a faked item), set expert attributes to it */
|
||||||
if(pi != NULL && pi->finfo != NULL) {
|
if(pi != NULL && pi->finfo != NULL) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "gnuc_format_check.h"
|
#include "gnuc_format_check.h"
|
||||||
#include <epan/proto.h>
|
#include <epan/proto.h>
|
||||||
|
#include "value_string.h"
|
||||||
|
|
||||||
|
|
||||||
/** only for internal and display use */
|
/** only for internal and display use */
|
||||||
|
@ -41,6 +42,8 @@ typedef struct expert_info_s {
|
||||||
proto_item *pitem;
|
proto_item *pitem;
|
||||||
} expert_info_t;
|
} expert_info_t;
|
||||||
|
|
||||||
|
WS_VAR_IMPORT const value_string expert_severity_vals[];
|
||||||
|
WS_VAR_IMPORT const value_string expert_group_vals[];
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
expert_init(void);
|
expert_init(void);
|
||||||
|
@ -48,6 +51,9 @@ expert_init(void);
|
||||||
extern void
|
extern void
|
||||||
expert_cleanup(void);
|
expert_cleanup(void);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
expert_get_highest_severity(void);
|
||||||
|
|
||||||
/** Add an expert info.
|
/** Add an expert info.
|
||||||
|
|
||||||
@param pinfo packet info of the currently processed packet
|
@param pinfo packet info of the currently processed packet
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
; libwireshark.def
|
; libwireshark.def
|
||||||
; $Id$
|
; $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
|
EXPORTS
|
||||||
abs_time_to_str
|
abs_time_to_str
|
||||||
address_to_str
|
address_to_str
|
||||||
|
@ -262,6 +269,9 @@ except_throwd
|
||||||
except_throwf
|
except_throwf
|
||||||
except_unhandled_catcher
|
except_unhandled_catcher
|
||||||
expert_add_info_format
|
expert_add_info_format
|
||||||
|
expert_get_highest_severity
|
||||||
|
expert_group_vals DATA
|
||||||
|
expert_severity_vals DATA
|
||||||
FacilityReason_vals DATA
|
FacilityReason_vals DATA
|
||||||
fc_fc4_val DATA
|
fc_fc4_val DATA
|
||||||
file_open_error_message
|
file_open_error_message
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
|
|
||||||
#include <epan/reassemble.h>
|
#include <epan/reassemble.h>
|
||||||
#include <epan/stream.h>
|
#include <epan/stream.h>
|
||||||
|
#include <epan/expert.h>
|
||||||
|
|
||||||
static gint proto_malformed = -1;
|
static gint proto_malformed = -1;
|
||||||
static dissector_handle_t frame_handle = NULL;
|
static dissector_handle_t frame_handle = NULL;
|
||||||
|
@ -148,8 +149,11 @@ init_dissection(void)
|
||||||
data structures that "reassemble_init()" frees. */
|
data structures that "reassemble_init()" frees. */
|
||||||
reassemble_init();
|
reassemble_init();
|
||||||
|
|
||||||
/* Initialise the stream-handling tables */
|
/* Initialize the stream-handling tables */
|
||||||
stream_init();
|
stream_init();
|
||||||
|
|
||||||
|
/* Initialize the expert infos */
|
||||||
|
expert_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -96,20 +96,6 @@ gpointer userdata)
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
#if (GTK_MAJOR_VERSION < 2)
|
||||||
|
|
||||||
typedef struct column_arrows {
|
typedef struct column_arrows {
|
||||||
|
|
|
@ -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[] = {
|
static const value_string expert_severity_om_vals[] = {
|
||||||
{ PI_ERROR, "Errors only" },
|
{ PI_ERROR, "Errors only" },
|
||||||
{ PI_WARN, "Error+Warn" },
|
{ PI_WARN, "Error+Warn" },
|
||||||
|
@ -79,18 +71,6 @@ static const value_string expert_severity_om_vals[] = {
|
||||||
{ 0, NULL }
|
{ 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 {
|
typedef struct expert_tapdata_s {
|
||||||
GtkWidget *win;
|
GtkWidget *win;
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
|
|
Loading…
Reference in New Issue