3 * Structures that most TVB users should not be accessing directly.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __TVBUFF_INT_H__
27 #define __TVBUFF_INT_H__
33 void (*tvb_free
)(struct tvbuff
*tvb
);
34 guint (*tvb_offset
)(const struct tvbuff
*tvb
, guint counter
);
35 const guint8
*(*tvb_get_ptr
)(struct tvbuff
*tvb
, guint abs_offset
, guint abs_length
);
36 void *(*tvb_memcpy
)(struct tvbuff
*tvb
, void *target
, guint offset
, guint length
);
38 gint (*tvb_find_guint8
)(tvbuff_t
*tvb
, guint abs_offset
, guint limit
, guint8 needle
);
39 gint (*tvb_pbrk_guint8
)(tvbuff_t
*tvb
, guint abs_offset
, guint limit
, const guint8
*needles
, guchar
*found_needle
);
41 tvbuff_t
*(*tvb_clone
)(tvbuff_t
*tvb
, guint abs_offset
, guint abs_length
);
47 #define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
50 /* Doubly linked list pointers */
54 const struct tvb_ops
*ops
;
57 struct tvbuff
*ds_tvb
; /**< data source top-level tvbuff */
59 /** We're either a TVBUFF_REAL_DATA or a
60 * TVBUFF_SUBSET that has a backing buffer that
61 * has real_data != NULL, or a TVBUFF_COMPOSITE
62 * which has flattened its data due to a call
65 const guint8
*real_data
;
67 /** Length of virtual buffer (and/or real_data). */
70 /** Reported length. */
71 guint reported_length
;
73 /* Offset from beginning of first TVBUFF_REAL. */
77 WS_DLL_PUBLIC tvbuff_t
*tvb_new(const struct tvb_ops
*ops
);
79 tvbuff_t
*tvb_new_proxy(tvbuff_t
*backing
);
81 void tvb_add_to_chain(tvbuff_t
*parent
, tvbuff_t
*child
);
83 guint
tvb_offset_from_real_beginning_counter(const tvbuff_t
*tvb
, const guint counter
);
85 void tvb_check_offset_length(const tvbuff_t
*tvb
, const gint offset
, gint
const length_val
, guint
*offset_ptr
, guint
*length_ptr
);