3 * Structures that most TVB users should not be accessing directly.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __TVBUFF_INT_H__
13 #define __TVBUFF_INT_H__
19 void (*tvb_free)(struct tvbuff *tvb);
20 guint (*tvb_offset)(const struct tvbuff *tvb, guint counter);
21 const guint8 *(*tvb_get_ptr)(struct tvbuff *tvb, guint abs_offset, guint abs_length);
22 void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, guint offset, guint length);
24 gint (*tvb_find_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle);
25 gint (*tvb_ws_mempbrk_pattern_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle);
27 tvbuff_t *(*tvb_clone)(tvbuff_t *tvb, guint abs_offset, guint abs_length);
33 #define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
36 /* Doubly linked list pointers */
40 const struct tvb_ops *ops;
43 struct tvbuff *ds_tvb; /**< data source top-level tvbuff */
45 /** We're either a TVBUFF_REAL_DATA or a
46 * TVBUFF_SUBSET that has a backing buffer that
47 * has real_data != NULL, or a TVBUFF_COMPOSITE
48 * which has flattened its data due to a call
51 const guint8 *real_data;
53 /** Length of virtual buffer (and/or real_data). */
56 /** Reported length. */
57 guint reported_length;
59 /* Offset from beginning of first TVBUFF_REAL. */
63 WS_DLL_PUBLIC tvbuff_t *tvb_new(const struct tvb_ops *ops);
65 tvbuff_t *tvb_new_proxy(tvbuff_t *backing);
67 void tvb_add_to_chain(tvbuff_t *parent, tvbuff_t *child);
69 guint tvb_offset_from_real_beginning_counter(const tvbuff_t *tvb, const guint counter);
71 void tvb_check_offset_length(const tvbuff_t *tvb, const gint offset, gint const length_val, guint *offset_ptr, guint *length_ptr);