diff options
Diffstat (limited to 'epan/proto.h')
-rw-r--r-- | epan/proto.h | 135 |
1 files changed, 88 insertions, 47 deletions
diff --git a/epan/proto.h b/epan/proto.h index 609046208b..4fd393d786 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -834,53 +834,6 @@ typedef proto_node proto_item; /* add more, see https://wiki.wireshark.org/Development/ExpertInfo */ - -/** 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(PITEM_FINFO(proto_item), 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) \ - do { \ - if (proto_item) \ - FI_SET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \ - } while(0) -/** mark this protocol field to be visible from the protocol tree display */ -#define PROTO_ITEM_SET_VISIBLE(proto_item) \ - do { \ - if (proto_item) \ - FI_RESET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \ - } while(0) - -/** is this protocol field generated by Wireshark (and not read from the packet data)? */ -#define PROTO_ITEM_IS_GENERATED(proto_item) \ - ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED) : 0) -/** mark this protocol field as generated by Wireshark (and not read from the packet data) */ -#define PROTO_ITEM_SET_GENERATED(proto_item) \ - do { \ - if (proto_item) \ - FI_SET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED); \ - } while(0) -/** is this protocol field actually a URL? */ -#define PROTO_ITEM_IS_URL(proto_item) \ - ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_URL) : 0) -/** mark this protocol field as a URL */ -#define PROTO_ITEM_SET_URL(proto_item) \ - do { \ - if (proto_item) \ - FI_SET_FLAG(PITEM_FINFO(proto_item), FI_URL); \ - } while(0) - -typedef void (*proto_tree_foreach_func)(proto_node *, gpointer); -typedef gboolean (*proto_tree_traverse_func)(proto_node *, gpointer); - -extern gboolean proto_tree_traverse_post_order(proto_tree *tree, - proto_tree_traverse_func func, gpointer data); - -WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree, - proto_tree_foreach_func func, gpointer data); - /** Retrieve the field_info from a proto_node */ #define PNODE_FINFO(proto_node) ((proto_node)->finfo) @@ -896,6 +849,94 @@ WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree, /** Retrieve the wmem_allocator_t from a proto_node */ #define PNODE_POOL(proto_node) ((proto_node)->tree_data->pinfo->pool) +/** Is this protocol field hidden from the protocol tree display? Used for filtering only. + * @deprecated HIDING PROTOCOL FIELDS IS DEPRECATED. IT'S CONSIDERED TO BE BAD GUI DESIGN! + * @param ti The item to check. May be NULL. + * @return TRUE if the item is hidden, FALSE otherwise. + */ +static inline gboolean proto_item_is_hidden(proto_item *ti) { + if (ti) { + return FI_GET_FLAG(PITEM_FINFO(ti), FI_HIDDEN); + } + return FALSE; +} +#define PROTO_ITEM_IS_HIDDEN(ti) proto_item_is_hidden((ti)) + +/** Mark this protocol field to be hidden from the protocol tree display. Used for filtering only. + * @deprecated HIDING PROTOCOL FIELDS IS DEPRECATED. IT'S CONSIDERED TO BE BAD GUI DESIGN! + * @param ti The item to hide. May be NULL. + */ +static inline void proto_item_set_hidden(proto_item *ti) { + if (ti) { + FI_SET_FLAG(PITEM_FINFO(ti), FI_HIDDEN); + } +} +#define PROTO_ITEM_SET_HIDDEN(ti) proto_item_set_hidden((ti)) + +/** Mark this protocol field to be visible from the protocol tree display. + * @param ti The item to hide. May be NULL. + */ +static inline void proto_item_set_visible(proto_item *ti) { + if (ti) { + FI_RESET_FLAG(PITEM_FINFO(ti), FI_HIDDEN); + } +} +#define PROTO_ITEM_SET_VISIBLE(ti) proto_item_set_visible((ti)) + +/** Is this protocol field generated by Wireshark (and not read from the packet data)? + * @param ti The item to check. May be NULL. + * @return TRUE if the item is generated, FALSE otherwise. + */ +static inline gboolean proto_item_is_generated(proto_item *ti) { + if (ti) { + return FI_GET_FLAG(PITEM_FINFO(ti), FI_GENERATED); + } + return FALSE; +} +#define PROTO_ITEM_IS_GENERATED(ti) proto_item_is_generated((ti)) + +/** Mark this protocol field as generated by Wireshark (and not read from the packet data). + * @param ti The item to mark as generated. May be NULL. + */ +static inline void proto_item_set_generated(proto_item *ti) { + if (ti) { + FI_SET_FLAG(PITEM_FINFO(ti), FI_GENERATED); + } +} +#define PROTO_ITEM_SET_GENERATED(ti) proto_item_set_generated((ti)) + +/** Is this protocol field actually a URL? + * @brief proto_item_is_url + * @param ti The item to check. May be NULL. + * @return TRUE if the item is a URL, FALSE otherwise. + */ +static inline gboolean proto_item_is_url(proto_item *ti) { + if (ti) { + return FI_GET_FLAG(PITEM_FINFO(ti), FI_URL); + } + return FALSE; +} +#define PROTO_ITEM_IS_URL(ti) proto_item_is_url((ti)) + +/** Mark this protocol field as a URL +* @param ti The item to mark as a URL. May be NULL. + */ +static inline void proto_item_set_url(proto_item *ti) { + if (ti) { + FI_SET_FLAG(PITEM_FINFO(ti), FI_URL); + } +} +#define PROTO_ITEM_SET_URL(ti) proto_item_set_url((ti)) + +typedef void (*proto_tree_foreach_func)(proto_node *, gpointer); +typedef gboolean (*proto_tree_traverse_func)(proto_node *, gpointer); + +extern gboolean proto_tree_traverse_post_order(proto_tree *tree, + proto_tree_traverse_func func, gpointer data); + +WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree, + proto_tree_foreach_func func, gpointer data); + #ifdef HAVE_PLUGINS typedef struct { void (*register_protoinfo)(void); /* routine to call to register protocol information */ |