diff options
author | Sebastien Tandel <sebastien@tandel.be> | 2007-03-30 00:21:39 +0000 |
---|---|---|
committer | Sebastien Tandel <sebastien@tandel.be> | 2007-03-30 00:21:39 +0000 |
commit | 0ca67aef30d49bf0d68dd375756d22404b6e98bd (patch) | |
tree | 87635b3a5b6c5609311e00933bf7c0b64ae66b72 /epan/ptvcursor.h | |
parent | c76ee5bc80713d7481c3c11b6a8adfe9b50e919b (diff) | |
download | wireshark-0ca67aef30d49bf0d68dd375756d22404b6e98bd.tar.gz wireshark-0ca67aef30d49bf0d68dd375756d22404b6e98bd.tar.bz2 wireshark-0ca67aef30d49bf0d68dd375756d22404b6e98bd.zip |
- new ptvcursor subtrees management functions :
* ptvcursor_push_subtree(), ptvcursor_pop_subtree() for pushing/popping
subtrees. Multiple levels of subtrees (256 max.), allocation per 8 levels.
* Two new functions creating an item in the tree and pushing a subtree at the
same time. These two functions accept an undefined length
(SUBTREE_UNDEFINED_LENGTH). The length of the item is set at the next pop.
1) ptvcursor_add_with_subtree
2) ptvcursor_add_text_with_subtree
- get rid of potential memory leaks with g_new in ptvcursor_new().
- Documentation of the new ptvcursor functions in README.developer
svn path=/trunk/; revision=21276
Diffstat (limited to 'epan/ptvcursor.h')
-rw-r--r-- | epan/ptvcursor.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/epan/ptvcursor.h b/epan/ptvcursor.h index 8c14e4c21c..9080a8b5be 100644 --- a/epan/ptvcursor.h +++ b/epan/ptvcursor.h @@ -34,6 +34,8 @@ #include <glib.h> #include <epan/packet.h> +#define SUBTREE_UNDEFINED_LENGTH -1 + typedef struct ptvcursor ptvcursor_t; /* Allocates an initializes a ptvcursor_t with 3 variables: @@ -77,4 +79,32 @@ ptvcursor_tree(ptvcursor_t* ptvc); void ptvcursor_set_tree(ptvcursor_t* ptvc, proto_tree *tree); +/* push a subtree in the tree stack of the cursor */ +proto_tree* +ptvcursor_push_subtree(ptvcursor_t *ptvc, proto_item *it, gint ett_subtree); + +/* pop a subtree in the tree stack of the cursor */ +void ptvcursor_pop_subtree(ptvcursor_t *ptvc); + +/* Add an item to the tree and create a subtree + * If the length is unknown, length may be defined as SUBTREE_UNDEFINED_LENGTH. + * In this case, when the subtree will be closed, the parent item length will + * be equal to the advancement of the cursor since the creation of the subtree. + */ +proto_tree* ptvcursor_add_with_subtree(ptvcursor_t * ptvc, int hfindex, gint length, +gboolean little_endian, gint ett_subtree); + +/* Add a text node to the tree and create a subtree + * If the length is unknown, length may be defined as SUBTREE_UNDEFINED_LENGTH. + * In this case, when the subtree will be closed, the item length will be equal + * to the advancement of the cursor since the creation of the subtree. + */ +proto_tree * ptvcursor_add_text_with_subtree(ptvcursor_t * ptvc, gint length, + gint ett_subtree, const char *format, ...); + +/* Creates a subtree and adds it to the cursor as the working tree but does not + * save the old working tree */ +proto_tree* +ptvcursor_set_subtree(ptvcursor_t *ptvc, proto_item *it, gint ett_subtree); + #endif /* __PTVCURSOR_H__ */ |