HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / tvbuff-int.h
blobfcac4cf48b879592ea41bd3bf46c4dcaa6c1b29b
1 /* tvbuff-int.h
3 * Structures that most TVB users should not be accessing directly.
5 * $Id$
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__
29 struct tvbuff;
31 struct tvb_ops {
32 gsize tvb_size;
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);
45 * Tvbuff flags.
47 #define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
49 struct tvbuff {
50 /* Doubly linked list pointers */
51 tvbuff_t *next;
53 /* Record-keeping */
54 const struct tvb_ops *ops;
55 gboolean initialized;
56 guint flags;
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
63 * to tvb_get_ptr().
65 const guint8 *real_data;
67 /** Length of virtual buffer (and/or real_data). */
68 guint length;
70 /** Reported length. */
71 guint reported_length;
73 /* Offset from beginning of first TVBUFF_REAL. */
74 gint raw_offset;
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);
86 #endif