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 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef __TVBUFF_INT_H__
25 #define __TVBUFF_INT_H__
31 void (*tvb_free)(struct tvbuff *tvb);
32 guint (*tvb_offset)(const struct tvbuff *tvb, guint counter);
33 const guint8 *(*tvb_get_ptr)(struct tvbuff *tvb, guint abs_offset, guint abs_length);
34 void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, guint offset, guint length);
36 gint (*tvb_find_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle);
37 gint (*tvb_ws_mempbrk_pattern_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle);
39 tvbuff_t *(*tvb_clone)(tvbuff_t *tvb, guint abs_offset, guint abs_length);
45 #define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
48 /* Doubly linked list pointers */
52 const struct tvb_ops *ops;
55 struct tvbuff *ds_tvb; /**< data source top-level tvbuff */
57 /** We're either a TVBUFF_REAL_DATA or a
58 * TVBUFF_SUBSET that has a backing buffer that
59 * has real_data != NULL, or a TVBUFF_COMPOSITE
60 * which has flattened its data due to a call
63 const guint8 *real_data;
65 /** Length of virtual buffer (and/or real_data). */
68 /** Reported length. */
69 guint reported_length;
71 /* Offset from beginning of first TVBUFF_REAL. */
75 WS_DLL_PUBLIC tvbuff_t *tvb_new(const struct tvb_ops *ops);
77 tvbuff_t *tvb_new_proxy(tvbuff_t *backing);
79 void tvb_add_to_chain(tvbuff_t *parent, tvbuff_t *child);
81 guint tvb_offset_from_real_beginning_counter(const tvbuff_t *tvb, const guint counter);
83 void tvb_check_offset_length(const tvbuff_t *tvb, const gint offset, gint const length_val, guint *offset_ptr, guint *length_ptr);