aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-tcp.c1
-rw-r--r--epan/proto.h35
-rw-r--r--gtk/proto_draw.c39
3 files changed, 70 insertions, 5 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 08ec05dcb1..5cb1a94ea7 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -1414,6 +1414,7 @@ tcp_print_sequence_number_analysis(packet_info *pinfo, tvbuff_t *tvb, proto_tree
if( ta->flags&TCP_A_ZERO_WINDOW ){
flags_item=proto_tree_add_none_format(flags_tree, hf_tcp_analysis_zero_window, tvb, 0, 0, "This is a ZeroWindow segment");
PROTO_ITEM_SET_GENERATED(flags_item);
+ PROTO_ITEM_SET_SEQUENCE_WARNING(flags_item);
if(check_col(pinfo->cinfo, COL_INFO)){
col_prepend_fstr(pinfo->cinfo, COL_INFO, "[TCP ZeroWindow] ");
}
diff --git a/epan/proto.h b/epan/proto.h
index 0ddb2e55cc..4ced956b1b 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -101,6 +101,13 @@ typedef struct _protocol protocol_t;
((void) ((expression) ? (void)0 : \
__DISSECTOR_ASSERT (expression, __FILE__, __LINE__)))
+#if 0
+/* win32: using a debug breakpoint (int 3) can be very handy while debugging,
+ * as the assert handling of GTK/GLib is currently not very helpful */
+#define DISSECTOR_ASSERT(expression) \
+{ if(!(expression)) _asm { int 3}; }
+#endif
+
/** Same as DISSECTOR_ASSERT(), but will throw DissectorError exception
* unconditionally, much like GLIB's g_assert_not_reached works.
*/
@@ -192,9 +199,9 @@ typedef struct field_info {
header_field_info *hfinfo; /**< pointer to registered field information */
gint start; /**< current start of data in field_info.ds_tvb */
gint length; /**< current data length of item in field_info.ds_tvb */
- gint tree_type; /**< ETT_ */
+ gint tree_type; /**< one of ETT_ or -1 */
item_label_t *rep; /**< string for GUI tree */
- int flags; /**< one of FI_HIDDEN, ... */
+ int flags; /**< bitfield like FI_GENERATED, ... */
tvbuff_t *ds_tvb; /**< data source tvbuff */
fvalue_t value;
} field_info;
@@ -202,10 +209,17 @@ typedef struct field_info {
/** The protocol field should not be shown in the tree (it's used for filtering only),
* used in field_info.flags. */
-#define FI_HIDDEN 0x0001
+/* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
+#define FI_HIDDEN 0x0001
/** The protocol field should be displayed as "generated by Ethereal",
* used in field_info.flags. */
-#define FI_GENERATED 0x0002
+#define FI_GENERATED 0x0002
+/** The protocol field has a bad checksum */
+#define FI_CHECKSUM_ERROR 0x0004
+/** The protocol field has an unusual sequence (e.g. TCP window is zero) */
+#define FI_SEQUENCE_WARNING 0x0008
+/** The protocol field has a bad sequence (e.g. TCP segment is lost) */
+#define FI_SEQUENCE_ERROR 0x0010
/** convenience macro to get field_info.flags */
#define FI_GET_FLAG(fi, flag) (fi->flags & flag)
@@ -238,9 +252,11 @@ typedef proto_node proto_item;
/** is this protocol field hidden from the protocol tree display (used for filtering only)? */
+/* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
#define PROTO_ITEM_IS_HIDDEN(proto_item) \
((proto_item) ? FI_GET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0)
/** mark this protocol field to be hidden from the protocol tree display (used for filtering only) */
+/* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
#define PROTO_ITEM_SET_HIDDEN(proto_item) \
((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0)
/** is this protocol field generated by Ethereal (and not read from the packet data)? */
@@ -249,6 +265,15 @@ typedef proto_node proto_item;
/** mark this protocol field as generated by Ethereal (and not read from the packet data) */
#define PROTO_ITEM_SET_GENERATED(proto_item) \
((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_GENERATED) : 0)
+/** mark this protocol field having a bad checksum */
+#define PROTO_ITEM_SET_CHECKSUM_ERROR(proto_item) \
+ ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_CHECKSUM_ERROR) : 0)
+/** mark this protocol field having a sequence warning */
+#define PROTO_ITEM_SET_SEQUENCE_WARNING(proto_item) \
+ ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_SEQUENCE_WARNING) : 0)
+/** mark this protocol field having a sequence error */
+#define PROTO_ITEM_SET_SEQUENCE_ERROR(proto_item) \
+ ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_SEQUENCE_ERROR) : 0)
typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
@@ -360,7 +385,7 @@ extern void proto_tree_free(proto_tree *tree);
/** Set the tree visible or invisible.
Is the parsing being done for a visible proto_tree or an invisible one?
By setting this correctly, the proto_tree creation is sped up by not
- having to call vsnprintf and copy strings around.
+ having to call g_vsnprintf and copy strings around.
@param tree the tree to be set
@param visible ... or not */
extern void
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index bc5632da63..b2fd2340b3 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1613,9 +1613,23 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
gtk_tree_model_get(tree_model, iter, 1, &fi, -1);
+ /* for the various possible attributes, see:
+ * http://developer.gnome.org/doc/API/2.0/gtk/GtkCellRendererText.html
+ *
+ * color definitions can be found at:
+ * http://cvs.gnome.org/viewcvs/gtk+/gdk-pixbuf/io-xpm.c?rev=1.42
+ *
+ * some experiences:
+ * background-gdk: doesn't seem to work (probably the GdkColor must be allocated)
+ * weight/style: doesn't take any effect
+ */
+
/* for each field, we have to reset the renderer attributes */
g_object_set (cell, "foreground-set", FALSE, NULL);
+ g_object_set (cell, "background", "white", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+
g_object_set (cell, "underline", PANGO_UNDERLINE_NONE, NULL);
g_object_set (cell, "underline-set", FALSE, NULL);
@@ -1625,6 +1639,21 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
/*g_object_set (cell, "weight", PANGO_WEIGHT_NORMAL, NULL);
g_object_set (cell, "weight-set", FALSE, NULL);*/
+ if(FI_GET_FLAG(fi, FI_CHECKSUM_ERROR)) {
+ g_object_set (cell, "background", "red", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
+ if(FI_GET_FLAG(fi, FI_SEQUENCE_WARNING)) {
+ g_object_set (cell, "background", "yellow", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
+ if(FI_GET_FLAG(fi, FI_SEQUENCE_ERROR)) {
+ g_object_set (cell, "background", "red", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ }
+
if(FI_GET_FLAG(fi, FI_GENERATED)) {
/* as some fonts don't support italic, don't use this */
/*g_object_set (cell, "style", PANGO_STYLE_ITALIC, NULL);
@@ -1634,6 +1663,13 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_,
g_object_set (cell, "weight-set", TRUE, NULL);*/
}
+ if(fi->hfinfo->type == FT_PROTOCOL) {
+ g_object_set (cell, "background", "gray90", NULL);
+ g_object_set (cell, "background-set", TRUE, NULL);
+ /*g_object_set (cell, "weight", PANGO_WEIGHT_BOLD, NULL);
+ g_object_set (cell, "weight-set", TRUE, NULL);*/
+ }
+
if(fi->hfinfo->type == FT_FRAMENUM) {
g_object_set (cell, "foreground", "blue", NULL);
g_object_set (cell, "foreground-set", TRUE, NULL);
@@ -1899,6 +1935,7 @@ tree_view_select(GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
+/* fill the whole protocol tree with the string values */
void
proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
{
@@ -1937,6 +1974,8 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view)
#endif
}
+
+/* fill a single protocol tree item with the string value */
static void
proto_tree_draw_node(proto_node *node, gpointer data)
{