Commit Graph

24 Commits

Author SHA1 Message Date
Moshe Kaplan 1c3a9af869 Add files with WS_DLL_PUBLIC to Doxygen
Add @file markers for most files that
contain functions exported with
WS_DLL_PUBLIC so that Doxygen will
generate documentation for them.
2021-11-29 21:27:45 +00:00
Guy Harris 0a130c5756 Handle subset tvbuffs where the length goes past the end of the parent.
Add a "contained length" to tvbuffs.  For non-subset tvbuffs, that's the
same as the reported length.  For a subset tvbuff, that's the amount of
the reported data that was actually present in the "contained data" of
the parent tvbuff.

This is unaffected by the *captured* length of any tvbuff; that differs
from the contained length only if the capture was cut short by a
snapshot length.

If a reference is within the reported data, but not within the contained
data, a ContainedBoundsError exception is thrown.  This exception
represents a protocol error, rather than a reference past the captured
data in the packet; we treat it as such.

Change-Id: Ide87f81238eaeb89b3093f54a87bf7f715485af5
Reviewed-on: https://code.wireshark.org/review/27039
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-20 03:18:47 +00:00
Guy Harris d5dc4677ed Update some comments.
We no longer have TVBUFF_ values corresponding to different types of
tvbuff; we have, instead, a set of method pointers for the different
types.  Refer to the types by name, rather than by TVBUFF_ value.

Expand the description of some fields in the tvbuff structure.

Change-Id: I38b5281df247ddd66b4e39abfc129053a012d241
Reviewed-on: https://code.wireshark.org/review/27036
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-20 02:58:36 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Guy Harris bfb4327291 Remove tvb_ from the names of wsutil mempbrk routines.
Routines that don't take a tvbuff as an argument shouldn't have tvb_ in
the name.

Change-Id: I3550256551e30b3f329cbbfca71ef27c727d29c0
Reviewed-on: https://code.wireshark.org/review/7302
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-21 20:39:25 +00:00
Hadriel Kaplan a837570d02 Combine SSE and pre-compiled patterns for faster pbrk
This combines the SSE4.2 instructions usage, with pre-compiled
pattern searching usage, for a faster pbrk search method.

Testing against large files of HTTP and SIP, there is about
a 5% performance improvement by using pre-"compiled" patterns
for guint8_pbrk() instead of passing it the search string and
having it build the match array every time.
Similar to regular expressions, "compiling" the pattern match array
in advance only once and using the "compiled" patterns for
the searches is faster than compiling it every time.

Change-Id: Ifcbc14a6c93f32d15663a10d974bacdca5119a8e
Ping-Bug: 10798
Reviewed-on: https://code.wireshark.org/review/6990
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-11 09:14:50 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Evan Huus 9fd46c37a8 - no need for a doubly-linked list of TVBs, single is simpler
- 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
2013-09-07 18:20:52 +00:00
Jakub Zawadzki b67492bbc0 Cleanup tvb
- make tvb_ops->tvb_size a gsize field, not function call
- remove not needed forward declaration / forward line

svn path=/trunk/; revision=51141
2013-08-04 22:02:42 +00:00
Jakub Zawadzki a2a20ed62a Move tvbuff composite structure to their own file.
svn path=/trunk/; revision=51072
2013-07-31 20:01:53 +00:00
Jakub Zawadzki c766e78cfa Rewrite reassemble API to use TVBs instead of raw data.
(it seems to be working for TCP ^^)

svn path=/trunk/; revision=50580
2013-07-14 14:42:05 +00:00
Jakub Zawadzki 2131f22508 Rewrite packet-mime-encap to use composite tvbs + cloning
svn path=/trunk/; revision=50571
2013-07-14 08:41:04 +00:00
Jakub Zawadzki b3e0623e5c Fix tvbtest linking, move private structures to tvbuff_subset
svn path=/trunk/; revision=50570
2013-07-14 07:59:42 +00:00
Jakub Zawadzki 0d85b75305 Move tvb real and subset implementations to seperate files.
svn path=/trunk/; revision=50569
2013-07-14 07:42:19 +00:00
Jakub Zawadzki ef93945811 Add support for cloning TVBs, move tvb_new() prototype to wtap-int.h
svn path=/trunk/; revision=50558
2013-07-13 17:53:33 +00:00
Jakub Zawadzki 338f1c9654 tvbuff: remove ->tvb_init() from ops
->tvb_init() knows nothing about new tvb and can only do some kind of bzero()
it's much better if we initialize object after tvb_new() [which anyway must be done]

+ try to fix OSX build.

svn path=/trunk/; revision=50490
2013-07-10 19:25:49 +00:00
Jakub Zawadzki d7175365ab tvbuff: allow tvb-implementations using their own structure (it's fine as long as first member of struct is tvbuff)
Move some stuff outside tvbuff struct.

svn path=/trunk/; revision=50489
2013-07-10 19:08:02 +00:00
Jakub Zawadzki b4d8a3727f Fix previous commit. Devel env with -w in CFLAGS is not so good idea...
svn path=/trunk/; revision=50487
2013-07-10 18:25:24 +00:00
Jakub Zawadzki f3ed13c22e tvbuff: replace type with operation vtable
It's begin of work to allow adding new tvbuff types (think: wtap_tvbuff, base64_tvbuff).

svn path=/trunk/; revision=50486
2013-07-10 18:14:15 +00:00
Guy Harris 0efcd0632b When we're dissecting the beginning of a fragmented packet that we
haven't reassembled, we're probably moving sequentially through the
packet, which means that we'll run past the end of the fragment rather
than past the end of what would have been the reassembled packet had we
reassembled it.

I.e., there's little reason to care whether we're past the end of the
fragment but not past the end of the packet, or whether we're past the
end of the packet; in either case, we're past the end of the fragment,
and if somebody wants to know whether the packet is malformed by
stopping short of certain fields, they should enable reassembly.

So we get rid of the explicit fragment length in tvbuffs and, instead,
have a "this is a fragment" flag; if that flag is set, we throw
FragmentBoundsError rather than ReportedBoundsError if we run past the
end of the reported data.

(This also means we could flag the tvbuff even if we don't know how
large the reassembled packet will be, e.g. when doing IP reassembly.)

Replace tvb_new_subset_length_fragment() with tvb_new_subset_length()
and a new "set the "this is a fragment flag"" routine.

svn path=/trunk/; revision=48940
2013-04-20 02:53:57 +00:00
Guy Harris c0c15029ed Add to tvbuffs a "fragment length" field; if the tvbuff represents the
first fragment of a non-reassembled packet, and we know the length the
packet would have if it were reassembled, this field holds the length of
the fragment, and the "reported length" field shows the length the
packet would have if it were reassembled, so going past the end of the
fragment but staying within the length of the reassembled packet can be
reported as "dissection would have worked if the packet had been
reassembled" rather than "the packet is too short, so it was probably
malformed".

Add a FragmentBoundsError exception, thrown in the "dissection would
have worked if the packet had been reassembled" case.

Add a new tvb_new_subset_length_fragment() routine to create a new
subset tvb with specified fragment and reported lengths.  Use it in the
CLNP dissector.

Add some more sanity checks in the CLNP dissector.

svn path=/trunk/; revision=48917
2013-04-18 19:22:24 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Bill Meier 14309d2c72 A simplified version of tvbuffs:
- Essentially no changes from current dissector de facto tvbuff usage;
- Do away with 'usage_counts' and with 'used_in' GSLists;
- Manage tvb chains via a simple doubly linked list.
- API changes:
  a. tvb_increment_usage_count() and tvb_decrement_usage_count() no
     longer exist;
  b. tvb_free_chain() can only be called for the 'top-level' (initial)
     tvb of a chain) or for a tvb not in a chain.
  c. tvb_free() now just calls tvb_free_chain() [should have no impact
     on existing  dissectors].

svn path=/trunk/; revision=40264
2011-12-21 17:39:02 +00:00
Jeff Morriss f3f9f2697f Make TVBs opaque for most users.
Convert TVB_RAW_OFFSET() and TVB_GET_DS_TVB() into functions.

svn path=/trunk/; revision=37422
2011-05-27 03:06:50 +00:00