2000-05-11 08:18:09 +00:00
|
|
|
/* tvbuff.h
|
|
|
|
*
|
|
|
|
* Testy, Virtual(-izable) Buffer of guint8*'s
|
|
|
|
*
|
|
|
|
* "Testy" -- the buffer gets mad when an attempt is made to access data
|
|
|
|
* beyond the bounds of the buffer. An exception is thrown.
|
|
|
|
*
|
|
|
|
* "Virtual" -- the buffer can have its own data, can use a subset of
|
|
|
|
* the data of a backing tvbuff, or can be a composite of
|
|
|
|
* other tvbuffs.
|
|
|
|
*
|
2002-02-18 01:08:44 +00:00
|
|
|
* $Id: tvbuff.h,v 1.22 2002/02/18 01:08:42 guy Exp $
|
2000-05-11 08:18:09 +00:00
|
|
|
*
|
2001-11-13 23:55:44 +00:00
|
|
|
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
|
2000-05-11 08:18:09 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-05-27 21:34:05 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
2000-05-11 08:18:09 +00:00
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TVBUFF_H__
|
|
|
|
#define __TVBUFF_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include "exceptions.h"
|
|
|
|
|
|
|
|
typedef struct tvbuff tvbuff_t;
|
|
|
|
|
|
|
|
typedef void (*tvbuff_free_cb_t)(void*);
|
|
|
|
|
|
|
|
/* The different types of tvbuff's */
|
|
|
|
typedef enum {
|
|
|
|
TVBUFF_REAL_DATA,
|
|
|
|
TVBUFF_SUBSET,
|
|
|
|
TVBUFF_COMPOSITE
|
|
|
|
} tvbuff_type;
|
|
|
|
|
|
|
|
/* TVBUFF_REAL_DATA contains a guint8* that points to real data.
|
|
|
|
* The data is allocated and contiguous.
|
|
|
|
*
|
|
|
|
* TVBUFF_SUBSET has a backing tvbuff. The TVBUFF_SUBSET is a "window"
|
|
|
|
* through which the program sees only a portion of the backing tvbuff.
|
|
|
|
*
|
|
|
|
* TVBUFF_COMPOSITE combines multiple tvbuffs sequentually to produce
|
|
|
|
* a larger byte array.
|
|
|
|
*
|
|
|
|
* tvbuff's of any type can be used as the backing-tvbuff of a
|
|
|
|
* TVBUFF_SUBSET or as the member of a TVBUFF_COMPOSITE.
|
|
|
|
* TVBUFF_COMPOSITEs can have member-tvbuffs of different types.
|
|
|
|
*
|
|
|
|
* Once a tvbuff is create/initialized/finalized, the tvbuff is read-only.
|
|
|
|
* That is, it cannot point to any other data. A new tvbuff must be created if
|
|
|
|
* you want a tvbuff that points to other data.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* "class" initialization. Called once during execution of program
|
|
|
|
* so that tvbuff.c can initialize its data. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvbuff_init(void);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* "class" cleanup. Called once during execution of program
|
|
|
|
* so that tvbuff.c can clean up its data. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvbuff_cleanup(void);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Returns a pointer to a newly initialized tvbuff. Note that
|
|
|
|
* tvbuff's of types TVBUFF_SUBSET and TVBUFF_COMPOSITE
|
|
|
|
* require further initialization via the appropriate functions */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern tvbuff_t* tvb_new(tvbuff_type);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2000-08-17 17:16:02 +00:00
|
|
|
/* Marks a tvbuff for freeing. The guint8* data of a TVBUFF_REAL_DATA
|
|
|
|
* is *never* freed by the tvbuff routines. The tvbuff itself is actually freed
|
2000-11-14 04:33:34 +00:00
|
|
|
* once its usage count drops to 0.
|
2000-08-17 17:16:02 +00:00
|
|
|
*
|
|
|
|
* Usage counts increment for any time the tvbuff is
|
2000-05-11 08:18:09 +00:00
|
|
|
* used as a member of another tvbuff, i.e., as the backing buffer for
|
|
|
|
* a TVBUFF_SUBSET or as a member of a TVBUFF_COMPOSITE.
|
|
|
|
*
|
2000-08-17 17:16:02 +00:00
|
|
|
* Although you may call tvb_free(), the tvbuff may still be in use
|
|
|
|
* by other tvbuff's (TVBUFF_SUBSET or TVBUFF_COMPOSITE), so it is not
|
|
|
|
* safe, unless you know otherwise, to free your guint8* data. If you
|
|
|
|
* cannot be sure that your TVBUFF_REAL_DATA is not in use by another
|
|
|
|
* tvbuff, register a callback with tvb_set_free_cb(); when your tvbuff
|
|
|
|
* is _really_ freed, then your callback will be called, and at that time
|
|
|
|
* you can free your original data.
|
|
|
|
*
|
2000-05-11 08:18:09 +00:00
|
|
|
* The caller can artificially increment/decrement the usage count
|
|
|
|
* with tvbuff_increment_usage_count()/tvbuff_decrement_usage_count().
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_free(tvbuff_t*);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Free the tvbuff_t and all tvbuff's created from it. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_free_chain(tvbuff_t*);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Both return the new usage count, after the increment or decrement */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint tvb_increment_usage_count(tvbuff_t*, guint count);
|
2000-08-17 17:16:02 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
/* If a decrement causes the usage count to drop to 0, a the tvbuff
|
|
|
|
* is immediately freed. Be sure you know exactly what you're doing
|
|
|
|
* if you decide to use this function, as another tvbuff could
|
|
|
|
* still have a pointer to the just-freed tvbuff, causing corrupted data
|
|
|
|
* or a segfault in the future */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint tvb_decrement_usage_count(tvbuff_t*, guint count);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Set a callback function to call when a tvbuff is actually freed
|
|
|
|
* (once the usage count drops to 0). One argument is passed to
|
2001-05-27 21:34:05 +00:00
|
|
|
* that callback --- a void* that points to the real data.
|
2000-05-11 08:18:09 +00:00
|
|
|
* Obviously, this only applies to a TVBUFF_REAL_DATA tvbuff. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_set_free_cb(tvbuff_t*, tvbuff_free_cb_t);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
|
2000-11-14 04:33:34 +00:00
|
|
|
/* Attach a TVBUFF_REAL_DATA tvbuff to a parent tvbuff. This connection
|
|
|
|
* is used during a tvb_free_chain()... the "child" TVBUFF_REAL_DATA acts
|
|
|
|
* as if is part of the chain-of-creation of the parent tvbuff, although it
|
|
|
|
* isn't. This is useful if you need to take the data from some tvbuff,
|
|
|
|
* run some operation on it, like decryption or decompression, and make a new
|
|
|
|
* tvbuff from it, yet want the new tvbuff to be part of the chain. The reality
|
|
|
|
* is that the new tvbuff *is* part of the "chain of creation", but in a way
|
|
|
|
* that these tvbuff routines is ignorant of. Use this function to make
|
|
|
|
* the tvbuff routines knowledgable of this fact. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child);
|
2000-11-14 04:33:34 +00:00
|
|
|
|
2000-09-13 20:17:23 +00:00
|
|
|
/* Sets parameters for TVBUFF_REAL_DATA. Can throw ReportedBoundsError. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_set_real_data(tvbuff_t*, const guint8* data, guint length,
|
|
|
|
gint reported_length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2000-09-13 20:17:23 +00:00
|
|
|
/* Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
|
2002-02-18 01:08:44 +00:00
|
|
|
gint reported_length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Define the subset of the backing buffer to use.
|
|
|
|
*
|
|
|
|
* 'backing_offset' can be negative, to indicate bytes from
|
|
|
|
* the end of the backing buffer.
|
|
|
|
*
|
|
|
|
* 'backing_length' can be 0, although the usefulness of the buffer would
|
|
|
|
* be rather limited.
|
|
|
|
*
|
|
|
|
* 'backing_length' of -1 means "to the end of the backing buffer"
|
|
|
|
*
|
|
|
|
* Will throw BoundsError if 'backing_offset'/'length'
|
2000-09-13 20:17:23 +00:00
|
|
|
* is beyond the bounds of the backing tvbuff.
|
|
|
|
* Can throw ReportedBoundsError. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_set_subset(tvbuff_t* tvb, tvbuff_t* backing,
|
2000-05-16 04:44:14 +00:00
|
|
|
gint backing_offset, gint backing_length, gint reported_length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2000-09-13 20:17:23 +00:00
|
|
|
/* Combination of tvb_new() and tvb_set_subset()
|
|
|
|
* Can throw ReportedBoundsError. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern tvbuff_t* tvb_new_subset(tvbuff_t* backing,
|
2000-05-16 04:44:14 +00:00
|
|
|
gint backing_offset, gint backing_length, gint reported_length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Both tvb_composite_append and tvb_composite_prepend can throw
|
|
|
|
* BoundsError if member_offset/member_length goes beyond bounds of
|
|
|
|
* the 'member' tvbuff. */
|
|
|
|
|
|
|
|
/* Append to the list of tvbuffs that make up this composite tvbuff */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_composite_append(tvbuff_t* tvb, tvbuff_t* member);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Prepend to the list of tvbuffs that make up this composite tvbuff */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_composite_prepend(tvbuff_t* tvb, tvbuff_t* member);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Helper function that calls tvb_new(TVBUFF_COMPOSITE).
|
|
|
|
* Provided only to maintain symmetry with other constructors */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern tvbuff_t* tvb_new_composite(void);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Mark a composite tvbuff as initialized. No further appends or prepends
|
|
|
|
* occur, data access can finally happen after this finalization. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_composite_finalize(tvbuff_t* tvb);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Get total length of buffer */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint tvb_length(tvbuff_t*);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Computes bytes to end of buffer, from offset (which can be negative,
|
|
|
|
* to indicate bytes from end of buffer). Function returns -1 to
|
|
|
|
* indicate that offset is out of bounds. No exception is thrown. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_length_remaining(tvbuff_t*, gint offset);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2002-02-01 04:34:17 +00:00
|
|
|
/* Same as above, but throws BoundsError if the offset is out of bounds. */
|
|
|
|
extern gint tvb_ensure_length_remaining(tvbuff_t*, gint offset);
|
|
|
|
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
/* Checks (w/o throwing exception) that the bytes referred to by
|
|
|
|
* 'offset'/'length' actually exist in the buffer */
|
|
|
|
extern gboolean tvb_bytes_exist(tvbuff_t*, gint offset, gint length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Checks (w/o throwing exception) that offset exists in buffer */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gboolean tvb_offset_exists(tvbuff_t*, gint offset);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
Add "tvb_reported_length()" to get the "reported length" of a tvbuff
(i.e., the amount of data that was in the packet, even if not all of it
was captured), for use when dissecting packets containing data that
fills the packet (we want the dissector to try to dissect all of it; if
it runs past the end of the captured data, we want it to throw an
exception so that we'll put a "Short Frame" note in the protocol tree).
This means we always want a tvbuff to have a real reported length value,
so we make it an unsigned integer, and don't bother checking it for -1,
as it should never be -1.
If the reported length passed in to "tvb_set_subset()" is -1, set the
reported length to the reported length of the tvbuff of which the new
tvbuff will be a subset minus the offset in that tvbuff of the subset,
so that "-1" means "what's left of the packet after we chop off the
header". This is necessary in order to ensure that all tvbuffs have a
real reported length value.
Have "dissect_packet()" set the reported length of the top-level tvbuff
to the reported length of the frame, so that we start out with a tvbuff
with a real reported length value.
Have "tvb_offset_exists()" return FALSE if the offset is past the end of
the tvbuff.
If the offset passed to it is postitive, have "compute_offset_length()"
check for that it's not more than one byte past the end of the tvbuff -
if it's just past the end, we don't want the check to fail, as we don't
want attempts to create a subset tvbuff containing zero bytes to fail;
that would be done if a captured packet was all header and no payload,
and we'd want the dissector of the payload, not the dissector of the
header, to throw an exception, as the problem isn't with the protocol
for the header, it's with the protocol for the payload.
Convert the ATM dissector, the SSCOP dissector, the Q.2931 dissector,
and the Q.931 dissector to use tvbuffs.
Make the LAPD dissector set up a tvbuff for the Q.931 dissector (it's
not converted yet).
svn path=/trunk/; revision=2023
2000-05-29 08:57:42 +00:00
|
|
|
/* Get reported length of buffer */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint tvb_reported_length(tvbuff_t*);
|
Add "tvb_reported_length()" to get the "reported length" of a tvbuff
(i.e., the amount of data that was in the packet, even if not all of it
was captured), for use when dissecting packets containing data that
fills the packet (we want the dissector to try to dissect all of it; if
it runs past the end of the captured data, we want it to throw an
exception so that we'll put a "Short Frame" note in the protocol tree).
This means we always want a tvbuff to have a real reported length value,
so we make it an unsigned integer, and don't bother checking it for -1,
as it should never be -1.
If the reported length passed in to "tvb_set_subset()" is -1, set the
reported length to the reported length of the tvbuff of which the new
tvbuff will be a subset minus the offset in that tvbuff of the subset,
so that "-1" means "what's left of the packet after we chop off the
header". This is necessary in order to ensure that all tvbuffs have a
real reported length value.
Have "dissect_packet()" set the reported length of the top-level tvbuff
to the reported length of the frame, so that we start out with a tvbuff
with a real reported length value.
Have "tvb_offset_exists()" return FALSE if the offset is past the end of
the tvbuff.
If the offset passed to it is postitive, have "compute_offset_length()"
check for that it's not more than one byte past the end of the tvbuff -
if it's just past the end, we don't want the check to fail, as we don't
want attempts to create a subset tvbuff containing zero bytes to fail;
that would be done if a captured packet was all header and no payload,
and we'd want the dissector of the payload, not the dissector of the
header, to throw an exception, as the problem isn't with the protocol
for the header, it's with the protocol for the payload.
Convert the ATM dissector, the SSCOP dissector, the Q.2931 dissector,
and the Q.931 dissector to use tvbuffs.
Make the LAPD dissector set up a tvbuff for the Q.931 dissector (it's
not converted yet).
svn path=/trunk/; revision=2023
2000-05-29 08:57:42 +00:00
|
|
|
|
2000-12-27 12:48:27 +00:00
|
|
|
/* Computes bytes of reported packet data to end of buffer, from offset
|
|
|
|
* (which can be negative, to indicate bytes from end of buffer). Function
|
|
|
|
* returns -1 to indicate that offset is out of bounds. No exception is
|
|
|
|
* thrown. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_reported_length_remaining(tvbuff_t *tvb, gint offset);
|
2000-12-27 12:48:27 +00:00
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
/* Set the reported length of a tvbuff to a given value; used for protocols
|
|
|
|
whose headers contain an explicit length and where the calling
|
|
|
|
dissector's payload may include padding as well as the packet for
|
|
|
|
this protocol.
|
|
|
|
|
|
|
|
Also adjusts the data length. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern void tvb_set_reported_length(tvbuff_t*, guint);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
2001-11-20 22:46:12 +00:00
|
|
|
/* Returns the offset from the first byte of real data. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_raw_offset(tvbuff_t*);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/************** START OF ACCESSORS ****************/
|
Add "tvb_reported_length()" to get the "reported length" of a tvbuff
(i.e., the amount of data that was in the packet, even if not all of it
was captured), for use when dissecting packets containing data that
fills the packet (we want the dissector to try to dissect all of it; if
it runs past the end of the captured data, we want it to throw an
exception so that we'll put a "Short Frame" note in the protocol tree).
This means we always want a tvbuff to have a real reported length value,
so we make it an unsigned integer, and don't bother checking it for -1,
as it should never be -1.
If the reported length passed in to "tvb_set_subset()" is -1, set the
reported length to the reported length of the tvbuff of which the new
tvbuff will be a subset minus the offset in that tvbuff of the subset,
so that "-1" means "what's left of the packet after we chop off the
header". This is necessary in order to ensure that all tvbuffs have a
real reported length value.
Have "dissect_packet()" set the reported length of the top-level tvbuff
to the reported length of the frame, so that we start out with a tvbuff
with a real reported length value.
Have "tvb_offset_exists()" return FALSE if the offset is past the end of
the tvbuff.
If the offset passed to it is postitive, have "compute_offset_length()"
check for that it's not more than one byte past the end of the tvbuff -
if it's just past the end, we don't want the check to fail, as we don't
want attempts to create a subset tvbuff containing zero bytes to fail;
that would be done if a captured packet was all header and no payload,
and we'd want the dissector of the payload, not the dissector of the
header, to throw an exception, as the problem isn't with the protocol
for the header, it's with the protocol for the payload.
Convert the ATM dissector, the SSCOP dissector, the Q.2931 dissector,
and the Q.931 dissector to use tvbuffs.
Make the LAPD dissector set up a tvbuff for the Q.931 dissector (it's
not converted yet).
svn path=/trunk/; revision=2023
2000-05-29 08:57:42 +00:00
|
|
|
/* All accessors will throw BoundsError or ReportedBoundsError if appropriate */
|
2000-05-11 08:18:09 +00:00
|
|
|
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint8 tvb_get_guint8(tvbuff_t*, gint offset);
|
2000-05-15 04:37:27 +00:00
|
|
|
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint16 tvb_get_ntohs(tvbuff_t*, gint offset);
|
|
|
|
extern guint32 tvb_get_ntoh24(tvbuff_t*, gint offset);
|
|
|
|
extern guint32 tvb_get_ntohl(tvbuff_t*, gint offset);
|
2000-05-15 04:37:27 +00:00
|
|
|
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint16 tvb_get_letohs(tvbuff_t*, gint offset);
|
|
|
|
extern guint32 tvb_get_letoh24(tvbuff_t*, gint offset);
|
|
|
|
extern guint32 tvb_get_letohl(tvbuff_t*, gint offset);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* Returns target for convenience. Does not suffer from possible
|
|
|
|
* expense of tvb_get_ptr(), since this routine is smart enough
|
|
|
|
* to copy data in chunks if the request range actually exists in
|
2000-08-17 17:16:02 +00:00
|
|
|
* different TVBUFF_REAL_DATA tvbuffs. This function assumes that the
|
|
|
|
* target memory is already allocated; it does not allocate or free the
|
|
|
|
* target memory. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint8* tvb_memcpy(tvbuff_t*, guint8* target, gint offset, gint length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* It is the user's responsibility to g_free() the memory allocated by
|
|
|
|
* tvb_memdup(). Calls tvb_memcpy() */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint8* tvb_memdup(tvbuff_t*, gint offset, gint length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
|
|
|
/* WARNING! This function is possibly expensive, temporarily allocating
|
|
|
|
* another copy of the packet data. Furthermore, it's dangerous because once
|
|
|
|
* this pointer is given to the user, there's no guarantee that the user will
|
|
|
|
* honor the 'length' and not overstep the boundaries of the buffer.
|
|
|
|
*
|
2000-08-17 17:16:02 +00:00
|
|
|
* The returned pointer is data that is internal to the tvbuff, so do not
|
|
|
|
* attempt to free it. Don't modify the data, either, because another tvbuff
|
|
|
|
* that might be using this tvbuff may have already copied that portion of
|
|
|
|
* the data (sometimes tvbuff's need to make copies of data, but that's the
|
|
|
|
* internal implementation that you need not worry about). Assume that the
|
|
|
|
* guint8* points to read-only data that the tvbuff manages.
|
|
|
|
*
|
2000-05-11 08:18:09 +00:00
|
|
|
* Return a pointer into our buffer if the data asked for via 'offset'/'length'
|
|
|
|
* is contiguous (which might not be the case for TVBUFF_COMPOSITE). If the
|
|
|
|
* data is not contiguous, a tvb_memdup() is called for the entire buffer
|
|
|
|
* and the pointer to the newly-contiguous data is returned. This dynamically-
|
|
|
|
* allocated memory will be freed when the tvbuff is freed, after the
|
|
|
|
* tvbuff_free_cb_t() is called, if any. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern const guint8* tvb_get_ptr(tvbuff_t*, gint offset, gint length);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2000-11-10 09:15:57 +00:00
|
|
|
/* Find first occurence of any of the needles in tvbuff, starting at offset.
|
|
|
|
* Searches at most maxlength number of bytes; if maxlength is -1, searches
|
|
|
|
* to end of tvbuff.
|
|
|
|
* Returns the offset of the found needle, or -1 if not found.
|
|
|
|
* Will not throw an exception, even if maxlength exceeds boundary of tvbuff;
|
|
|
|
* in that case, -1 will be returned if the boundary is reached before
|
|
|
|
* finding needle. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_find_guint8(tvbuff_t*, gint offset, gint maxlength,
|
|
|
|
guint8 needle);
|
2000-08-30 02:50:18 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
/* Find first occurence of any of the needles in tvbuff, starting at offset.
|
|
|
|
* Searches at most maxlength number of bytes. Returns the offset of the
|
|
|
|
* found needle, or -1 if not found. Will not throw an exception, even if
|
|
|
|
* maxlength exceeds boundary of tvbuff; in that case, -1 will be returned if
|
|
|
|
* the boundary is reached before finding needle. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_pbrk_guint8(tvbuff_t *, gint offset, gint maxlength,
|
|
|
|
guint8 *needles);
|
2000-11-10 06:50:37 +00:00
|
|
|
|
2000-12-25 23:48:16 +00:00
|
|
|
/* Find size of stringz (NUL-terminated string) by looking for terminating
|
|
|
|
* NUL. The size of the string includes the terminating NUL.
|
|
|
|
*
|
|
|
|
* If the NUL isn't found, it throws the appropriate exception.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint tvb_strsize(tvbuff_t *tvb, gint offset);
|
2000-12-25 23:48:16 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
/* Find length of string by looking for end of string ('\0'), up to
|
2000-11-10 09:15:57 +00:00
|
|
|
* 'maxlength' characters'; if 'maxlength' is -1, searches to end
|
|
|
|
* of tvbuff.
|
|
|
|
* Returns -1 if 'maxlength' reached before finding EOS. */
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_strnlen(tvbuff_t*, gint offset, guint maxlength);
|
2000-11-10 09:15:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Format the data in the tvb from offset for size ...
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern guint8 * tvb_format_text(tvbuff_t *tvb, gint offset, gint size);
|
2000-08-30 02:50:18 +00:00
|
|
|
|
|
|
|
/* Looks for a stringz (NUL-terminated string) in tvbuff and copies
|
|
|
|
* no more than maxlength number of bytes, including terminating NUL, to buffer.
|
|
|
|
* Returns length of string (not including terminating NUL), or -1 if the string was
|
|
|
|
* truncated in the buffer due to not having reached the terminating NUL.
|
|
|
|
* In this way, it acts like snprintf().
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint maxlength,
|
|
|
|
guint8* buffer);
|
2000-08-30 02:50:18 +00:00
|
|
|
|
|
|
|
/* Like tvb_get_nstringz(), but never returns -1. The string is guaranteed to
|
|
|
|
* have a terminating NUL. If the string was truncated when copied into buffer,
|
|
|
|
* a NUL is placed at the end of buffer to terminate it.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_get_nstringz0(tvbuff_t *tvb, gint offset, guint maxlength,
|
|
|
|
guint8* buffer);
|
2000-05-11 08:18:09 +00:00
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
/*
|
|
|
|
* Given a tvbuff, an offset into the tvbuff, and a length that starts
|
|
|
|
* at that offset (which may be -1 for "all the way to the end of the
|
|
|
|
* tvbuff"), find the end of the (putative) line that starts at the
|
|
|
|
* specified offset in the tvbuff, going no further than the specified
|
|
|
|
* length.
|
|
|
|
*
|
|
|
|
* Return the offset right past the end of the line as the return value,
|
|
|
|
* and return the offset of the EOL character(s) in "*eol".
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_find_line_end(tvbuff_t *tvb, gint offset, int len, gint *eol);
|
2000-09-07 15:29:40 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
/*
|
|
|
|
* Given a tvbuff, an offset into the tvbuff, and a length that starts
|
|
|
|
* at that offset (which may be -1 for "all the way to the end of the
|
|
|
|
* tvbuff"), find the end of the (putative) line that starts at the
|
|
|
|
* specified offset in the tvbuff, going no further than the specified
|
|
|
|
* length.
|
|
|
|
*
|
|
|
|
* However, treat quoted strings inside the buffer specially - don't
|
|
|
|
* treat newlines in quoted strings as line terminators.
|
|
|
|
*
|
|
|
|
* Return the length of the line (not counting the line terminator at
|
|
|
|
* the end), or the amount of data remaining in the buffer if we don't
|
|
|
|
* find a line terminator.
|
|
|
|
*
|
|
|
|
* Set "*next_offset" to the offset of the character past the line
|
|
|
|
* terminator, or past the end of the buffer if we don't find a line
|
|
|
|
* terminator.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
|
2000-11-10 06:50:37 +00:00
|
|
|
gint *next_offset);
|
|
|
|
|
2001-07-02 07:11:40 +00:00
|
|
|
/*
|
|
|
|
* Call strncmp after checking if enough chars left, returning 0 if
|
|
|
|
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_strneql(tvbuff_t *tvb, gint offset, const guint8 *str,
|
|
|
|
gint size);
|
2000-09-07 15:29:40 +00:00
|
|
|
|
2001-07-02 07:11:40 +00:00
|
|
|
/*
|
|
|
|
* Call strncasecmp after checking if enough chars left, returning 0 if
|
|
|
|
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_strncaseeql(tvbuff_t *tvb, gint offset, const guint8 *str,
|
|
|
|
gint size);
|
2000-11-09 10:56:33 +00:00
|
|
|
|
2001-07-02 07:11:40 +00:00
|
|
|
/*
|
|
|
|
* Call memcmp after checking if enough chars left, returning 0 if
|
|
|
|
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gint tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str,
|
|
|
|
gint size);
|
2001-07-02 07:11:40 +00:00
|
|
|
|
2000-11-13 07:19:37 +00:00
|
|
|
/*
|
|
|
|
* Format a bunch of data from a tvbuff as bytes, returning a pointer
|
|
|
|
* to the string with the formatted data.
|
|
|
|
*/
|
Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.
svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
|
|
|
extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
|
2000-11-13 07:19:37 +00:00
|
|
|
|
2002-02-18 01:08:44 +00:00
|
|
|
extern tvbuff_t *tvb_get_ds_tvb(tvbuff_t *tvb);
|
2001-03-23 14:44:04 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
/************** END OF ACCESSORS ****************/
|
|
|
|
|
|
|
|
#endif /* __TVBUFF_H__ */
|