aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.h
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2004-05-01 15:15:08 +0000
committerUlf Lamping <ulf.lamping@web.de>2004-05-01 15:15:08 +0000
commitd9118dc089e7d842bc5c288238e1b100c799fb63 (patch)
tree9a1acdf9d2c216571cbfd181a679af12cab5d99d /epan/proto.h
parent4cf12f590ec0c5ffca4f6af9ffb99c59ec52a005 (diff)
add PROTO_ITEM_SET_HIDDEN() and PROTO_ITEM_SET_GENERATED(),
this sets flags for later rendering of the field data svn path=/trunk/; revision=10752
Diffstat (limited to 'epan/proto.h')
-rw-r--r--epan/proto.h88
1 files changed, 62 insertions, 26 deletions
diff --git a/epan/proto.h b/epan/proto.h
index 10e12005ad..ccb8c4176c 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -1,7 +1,7 @@
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.58 2004/04/30 06:56:15 ulfl Exp $
+ * $Id: proto.h,v 1.59 2004/05/01 15:15:08 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -52,7 +52,7 @@ struct _value_string;
/* ... and similarly, */
#define TFS(x) (const struct true_false_string*)(x)
-struct _protocol;
+extern struct _protocol;
typedef struct _protocol protocol_t;
@@ -64,6 +64,7 @@ typedef struct _protocol protocol_t;
} \
}
+/* values for header_field_info.display */
enum {
BASE_NONE,
BASE_DEC,
@@ -110,18 +111,29 @@ typedef struct _item_label_t {
char representation[ITEM_LABEL_LENGTH];
} item_label_t;
+
+
/* Contains the field information for the proto_item. */
typedef struct field_info {
- header_field_info *hfinfo;
+ header_field_info *hfinfo;
gint start;
gint length;
gint tree_type; /* ETT_* */
- item_label_t *rep; /* string for GUI tree */
- int visible;
+ item_label_t *rep; /* string for GUI tree */
+ int flags;
tvbuff_t *ds_tvb; /* data source tvbuff */
fvalue_t value;
} field_info;
+
+#define FI_HIDDEN 0x0001
+#define FI_GENERATED 0x0002
+
+#define FI_GET_FLAG(fi, flag) (fi->flags & flag)
+#define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag)
+
+
+
/* One of these exists for the entire protocol tree. Each proto_node
* in the protocol tree points to the same copy. */
typedef struct {
@@ -142,6 +154,15 @@ typedef struct _proto_node {
typedef proto_node proto_tree;
typedef proto_node proto_item;
+
+/* indicate that this field should not be shown by Ethereal (used for filtering only) */
+#define PROTO_ITEM_IS_HIDDEN(proto_item) FI_GET_FLAG(proto_item->finfo, FI_HIDDEN)
+#define PROTO_ITEM_SET_HIDDEN(proto_item) FI_SET_FLAG(proto_item->finfo, FI_HIDDEN)
+/* indicate that this field is generated by Ethereal (and not inside the packet data) */
+#define PROTO_ITEM_IS_GENERATED(proto_item) FI_GET_FLAG(proto_item->finfo, FI_GENERATED)
+#define PROTO_ITEM_SET_GENERATED(proto_item) FI_SET_FLAG(proto_item->finfo, FI_GENERATED)
+
+
typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
extern void proto_tree_children_foreach(proto_tree *tree,
@@ -160,6 +181,20 @@ extern void proto_init(const char *plugin_dir,
/* Frees memory used by proto routines. Called at program shutdown */
extern void proto_cleanup(void);
+
+
+/* Create a subtree under an existing item; returns tree pointer */
+extern proto_tree* proto_item_add_subtree(proto_item *ti, gint idx);
+
+/* Get a subtree under an item; returns tree pointer */
+extern proto_tree* proto_item_get_subtree(proto_item *ti);
+
+/* Get a parent item; returns item pointer */
+extern proto_item* proto_item_get_parent(proto_item *ti);
+
+/* Get Nth generation parent item; returns item pointer */
+extern proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
+
/* Set text of proto_item after having already been created. */
#if __GNUC__ >= 2
extern void proto_item_set_text(proto_item *ti, const char *format, ...)
@@ -192,39 +227,26 @@ extern void proto_item_set_end(proto_item *pi, tvbuff_t *tvb, gint end);
* to add a variable-length field (e.g., FT_NSTRING_UINT8) */
extern int proto_item_get_len(proto_item *ti);
+
+
/* Creates new proto_tree root */
extern proto_tree* proto_tree_create_root(void);
-/* Mark a field/protocol ID as "interesting". */
-extern void
-proto_tree_prime_hfid(proto_tree *tree, int hfid);
-
/* Clear memory for entry proto_tree. Clears proto_tree struct also. */
extern void proto_tree_free(proto_tree *tree);
-/* Create a subtree under an existing item; returns tree pointer */
-extern proto_tree* proto_item_add_subtree(proto_item *ti, gint idx);
-
-/* Get a subtree under an item; returns tree pointer */
-extern proto_tree* proto_item_get_subtree(proto_item *ti);
-
-/* Get a parent item; returns item pointer */
-extern proto_item* proto_item_get_parent(proto_item *ti);
+extern void
+proto_tree_set_visible(proto_tree *tree, gboolean visible);
-/* Get Nth generation parent item; returns item pointer */
-extern proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
+/* Mark a field/protocol ID as "interesting". */
+extern void
+proto_tree_prime_hfid(proto_tree *tree, int hfid);
/* Get a parent item of subtree; returns item pointer */
extern proto_item* proto_tree_get_parent(proto_tree *tree);
-extern int
-proto_register_protocol(char *name, char *short_name, char *filter_name);
-extern void
-proto_register_field_array(int parent, hf_register_info *hf, int num_records);
-extern void
-proto_register_subtree_array(gint **indices, int num_indices);
/* Add an item to a proto_tree, using the text label registered to that item;
the item is extracted from the tvbuff handed to it. */
@@ -531,11 +553,20 @@ extern proto_item *
proto_tree_add_debug_text(proto_tree *tree, const char *format, ...);
#endif
+
extern void
proto_item_fill_label(field_info *fi, gchar *label_str);
+
+
+extern int
+proto_register_protocol(char *name, char *short_name, char *filter_name);
+
extern void
-proto_tree_set_visible(proto_tree *tree, gboolean visible);
+proto_register_field_array(int parent, hf_register_info *hf, int num_records);
+
+extern void
+proto_register_subtree_array(gint **indices, int num_indices);
/* Returns number of items (protocols or header fields) registered. */
extern int proto_registrar_n(void);
@@ -625,6 +656,8 @@ extern void proto_registrar_dump_protocols(void);
/* Dumps a glossary of the protocol and field registrations to STDOUT */
extern void proto_registrar_dump_fields(void);
+
+
/* Points to the first element of an array of Booleans, indexed by
a subtree item type; that array element is TRUE if subtrees of
an item of that type are to be expanded. */
@@ -641,6 +674,9 @@ extern int num_tree_types;
extern int
hfinfo_bitwidth(header_field_info *hfinfo);
+
+
+
#include "epan.h"
/*