forked from osmocom/wireshark
![Evan Huus](/assets/img/avatar_default.png)
- support merging chains in tvb_add_to_chain - when we have an old reassembled TVB, just merge the chains rather than freeing it (we may still need it as it may already be a data source) - modelines Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9027 #BACKPORT, but it's gonna be messy... svn path=/trunk/; revision=51825
87 lines
2.7 KiB
C
87 lines
2.7 KiB
C
/* tvbuff-int.h
|
|
*
|
|
* Structures that most TVB users should not be accessing directly.
|
|
*
|
|
* $Id$
|
|
*
|
|
* Wireshark - Network traffic analyzer
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
* Copyright 1998 Gerald Combs
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef __TVBUFF_INT_H__
|
|
#define __TVBUFF_INT_H__
|
|
|
|
struct tvbuff;
|
|
|
|
struct tvb_ops {
|
|
gsize tvb_size;
|
|
void (*tvb_free)(struct tvbuff *tvb);
|
|
guint (*tvb_offset)(const struct tvbuff *tvb, guint counter);
|
|
const guint8 *(*tvb_get_ptr)(struct tvbuff *tvb, guint abs_offset, guint abs_length);
|
|
void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, guint offset, guint length);
|
|
|
|
gint (*tvb_find_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle);
|
|
gint (*tvb_pbrk_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, const guint8 *needles, guchar *found_needle);
|
|
|
|
tvbuff_t *(*tvb_clone)(tvbuff_t *tvb, guint abs_offset, guint abs_length);
|
|
};
|
|
|
|
/*
|
|
* Tvbuff flags.
|
|
*/
|
|
#define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
|
|
|
|
struct tvbuff {
|
|
/* Doubly linked list pointers */
|
|
tvbuff_t *next;
|
|
|
|
/* Record-keeping */
|
|
const struct tvb_ops *ops;
|
|
gboolean initialized;
|
|
guint flags;
|
|
struct tvbuff *ds_tvb; /**< data source top-level tvbuff */
|
|
|
|
/** We're either a TVBUFF_REAL_DATA or a
|
|
* TVBUFF_SUBSET that has a backing buffer that
|
|
* has real_data != NULL, or a TVBUFF_COMPOSITE
|
|
* which has flattened its data due to a call
|
|
* to tvb_get_ptr().
|
|
*/
|
|
const guint8 *real_data;
|
|
|
|
/** Length of virtual buffer (and/or real_data). */
|
|
guint length;
|
|
|
|
/** Reported length. */
|
|
guint reported_length;
|
|
|
|
/* Offset from beginning of first TVBUFF_REAL. */
|
|
gint raw_offset;
|
|
};
|
|
|
|
WS_DLL_PUBLIC tvbuff_t *tvb_new(const struct tvb_ops *ops);
|
|
|
|
tvbuff_t *tvb_new_proxy(tvbuff_t *backing);
|
|
|
|
void tvb_add_to_chain(tvbuff_t *parent, tvbuff_t *child);
|
|
|
|
guint tvb_offset_from_real_beginning_counter(const tvbuff_t *tvb, const guint counter);
|
|
|
|
void tvb_check_offset_length(const tvbuff_t *tvb, const gint offset, gint const length_val, guint *offset_ptr, guint *length_ptr);
|
|
#endif
|