Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ptvcursor.h
Go to the documentation of this file.
1
12#pragma once
13#include <epan/packet.h>
14#include "ws_symbol_export.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#define SUBTREE_UNDEFINED_LENGTH -1
21
22typedef struct ptvcursor ptvcursor_t;
23
35WS_DLL_PUBLIC
37ptvcursor_new(wmem_allocator_t *scope, proto_tree* tree, tvbuff_t* tvb, unsigned offset);
38
51WS_DLL_PUBLIC
53ptvcursor_add(ptvcursor_t* ptvc, int hf, int length, const unsigned encoding);
54
68WS_DLL_PUBLIC
70ptvcursor_add_ret_uint(ptvcursor_t* ptvc, int hf, unsigned length, const unsigned encoding, uint32_t *retval);
71
85WS_DLL_PUBLIC
87ptvcursor_add_ret_int(ptvcursor_t* ptvc, int hf, unsigned length, const unsigned encoding, int32_t *retval);
88
103WS_DLL_PUBLIC
105ptvcursor_add_ret_string(ptvcursor_t* ptvc, int hf, int length, const unsigned encoding, wmem_allocator_t *scope, const uint8_t **retval);
106
120WS_DLL_PUBLIC
122ptvcursor_add_ret_boolean(ptvcursor_t* ptvc, int hf, unsigned length, const unsigned encoding, bool *retval);
123
135WS_DLL_PUBLIC
137ptvcursor_add_no_advance(ptvcursor_t* ptvc, int hf, int length, const unsigned encoding);
138
146WS_DLL_PUBLIC
147void
148ptvcursor_advance(ptvcursor_t* ptvc, unsigned length);
149
157WS_DLL_PUBLIC
158void
160
167WS_DLL_PUBLIC
170
177WS_DLL_PUBLIC
178unsigned
180
187WS_DLL_PUBLIC
190
197WS_DLL_PUBLIC
198void
200
208WS_DLL_PUBLIC
210ptvcursor_push_subtree(ptvcursor_t* ptvc, proto_item* it, int ett_subtree);
211
220WS_DLL_PUBLIC
221void
223
224/* Add an item to the tree and create a subtree
225 * If the length is unknown, length may be defined as SUBTREE_UNDEFINED_LENGTH.
226 * In this case, when the subtree will be closed, the parent item length will
227 * be equal to the advancement of the cursor since the creation of the subtree.
228 */
229WS_DLL_PUBLIC
231ptvcursor_add_with_subtree(ptvcursor_t* ptvc, int hfindex, int length,
232 const unsigned encoding, int ett_subtree);
233
248WS_DLL_PUBLIC
251 int ett_subtree, const char* format, ...)
252 G_GNUC_PRINTF(4, 5);
253
264WS_DLL_PUBLIC
266ptvcursor_set_subtree(ptvcursor_t* ptvc, proto_item* it, int ett_subtree);
267
268#ifdef __cplusplus
269}
270#endif
WS_DLL_PUBLIC proto_item * ptvcursor_add(ptvcursor_t *ptvc, int hf, int length, const unsigned encoding)
Adds data from tvbuff to proto_tree and increments offset.
Definition proto.c:4398
WS_DLL_PUBLIC proto_item * ptvcursor_add_ret_boolean(ptvcursor_t *ptvc, int hf, unsigned length, const unsigned encoding, bool *retval)
Adds a boolean value to the protocol tree and returns it.
Definition proto.c:3637
WS_DLL_PUBLIC tvbuff_t * ptvcursor_tvbuff(ptvcursor_t *ptvc)
Retrieves the tvbuff associated with the protocol tree cursor.
Definition proto.c:1322
WS_DLL_PUBLIC proto_tree * ptvcursor_tree(ptvcursor_t *ptvc)
Returns the current proto_tree associated with the ptvcursor.
Definition proto.c:1335
WS_DLL_PUBLIC proto_tree * ptvcursor_set_subtree(ptvcursor_t *ptvc, proto_item *it, int ett_subtree)
Sets a new subtree for the protocol tree cursor.
Definition proto.c:1397
WS_DLL_PUBLIC proto_item * ptvcursor_add_ret_int(ptvcursor_t *ptvc, int hf, unsigned length, const unsigned encoding, int32_t *retval)
Adds an integer value to the protocol tree and returns it.
Definition proto.c:3527
WS_DLL_PUBLIC void ptvcursor_advance(ptvcursor_t *ptvc, unsigned length)
Advances the ptvcursor's offset within its tvbuff without adding anything to the proto_tree.
Definition proto.c:4785
WS_DLL_PUBLIC proto_tree * ptvcursor_add_text_with_subtree(ptvcursor_t *ptvc, int length, int ett_subtree, const char *format,...)
Adds text with a subtree to the cursor.
Definition proto.c:1436
WS_DLL_PUBLIC proto_item * ptvcursor_add_no_advance(ptvcursor_t *ptvc, int hf, int length, const unsigned encoding)
Adds a new item to the protocol tree without advancing the cursor.
Definition proto.c:4771
WS_DLL_PUBLIC void ptvcursor_pop_subtree(ptvcursor_t *ptvc)
Pops a subtree from the protocol tree cursor.
Definition proto.c:1366
WS_DLL_PUBLIC ptvcursor_t * ptvcursor_new(wmem_allocator_t *scope, proto_tree *tree, tvbuff_t *tvb, unsigned offset)
Creates a new protocol tree cursor.
Definition proto.c:1296
WS_DLL_PUBLIC unsigned ptvcursor_current_offset(ptvcursor_t *ptvc)
Returns the current offset in the protocol tree cursor.
Definition proto.c:1329
WS_DLL_PUBLIC proto_item * ptvcursor_add_ret_uint(ptvcursor_t *ptvc, int hf, unsigned length, const unsigned encoding, uint32_t *retval)
Adds a uint32_t value to the protocol tree and returns it.
Definition proto.c:3470
WS_DLL_PUBLIC proto_tree * ptvcursor_push_subtree(ptvcursor_t *ptvc, proto_item *it, int ett_subtree)
Pushes a subtree onto the tree stack of the cursor.
Definition proto.c:1351
WS_DLL_PUBLIC proto_item * ptvcursor_add_ret_string(ptvcursor_t *ptvc, int hf, int length, const unsigned encoding, wmem_allocator_t *scope, const uint8_t **retval)
Adds a string to the protocol tree and returns the proto_item* and the retrieved string value.
Definition proto.c:3586
WS_DLL_PUBLIC void ptvcursor_free(ptvcursor_t *ptvc)
Frees a ptvcursor_t structure.
Definition proto.c:1314
WS_DLL_PUBLIC void ptvcursor_set_tree(ptvcursor_t *ptvc, proto_tree *tree)
Sets a new proto_tree* for the ptvcursor_t.
Definition proto.c:1344
Definition proto.h:902
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Definition proto.c:70
Definition tvbuff-int.h:33