Commit Graph

179 Commits

Author SHA1 Message Date
Ulf Lamping d5ae7ee8af proto.c(2941) : warning C4090: 'function' : different 'const' qualifiers
proto.c(2941) : warning C4022: 'g_tree_insert' : pointer mismatch for actual parameter 2

svn path=/trunk/; revision=14782
2005-06-26 11:29:04 +00:00
Guy Harris b67f63560e More constification.
svn path=/trunk/; revision=14740
2005-06-24 02:51:01 +00:00
Gerald Combs dce31be366 When we add an FT_STRINGZ item, throw an exception if the length is
less than -1.  If the length is 0, set the item string to "[Empty]".
This fixes bug 219.


svn path=/trunk/; revision=14634
2005-06-15 15:10:02 +00:00
Ulf Lamping 9784fa242a add new function proto_tree_move_item(), which will move an already existing proto_item inside the tree (but it can't be moved to a different "tree level")
svn path=/trunk/; revision=14524
2005-06-02 18:35:20 +00:00
Ulf Lamping 4984c5e949 show Ethernet and IPX addresses the same way as we do with other fields as well (e.g. IP addresses), first the converted value (e.g. IP address or manufaturer name) and then in brackets the "raw data"
svn path=/trunk/; revision=14523
2005-06-02 18:29:29 +00:00
Ulf Lamping 7c07e00f1d fix #11: add a [truncated] to the label, if the message to display is too long
svn path=/trunk/; revision=14477
2005-05-29 11:23:42 +00:00
Gilbert Ramirez c2454f0260 Add a "-G fields3" report which prints the bitmask of the field, and avoids
printing the blurb twice, like fields2 does.
Add a script, fsanity.py, to check sanity of FT definitions. Right now the
only check is for bitmasks for integer-like fields.

svn path=/trunk/; revision=14454
2005-05-27 15:13:09 +00:00
Ronnie Sahlberg 864245ef6e cket wsp is creating string items and later appending to them and their value at runtime which breaks when the TRY_TO_FAKE_THIS_ITEM() is used.
Add a comment to proto_item_append_string() explaining the "danger" and what needs to be done if one decides to use proto_item_append_string()

Add a small change to WSP so that it will disable this speed optimization so not to trigger a DISSECTOR_BUG in proto_item_append_string()




svn path=/trunk/; revision=14452
2005-05-27 06:00:08 +00:00
Gerald Combs 4a5deae575 In some places we call proto_tree_add_item() with hfindex and length
values that may not be valid (e.g. dissect_ber_octet_string()
in packet-ber.c).  If the length is invalid, get_uint_value() or
get_int_value() will abort.  Change them to throw an exception instead.
This keeps us from having to do a lot of extra work in the dissector.

Fixes bug 182.


svn path=/trunk/; revision=14437
2005-05-26 14:53:39 +00:00
Gerald Combs 985f94ec24 In proto_tree_set_string(), don't set a null fvalue or Ethereal will throw
a hissy fit.  Fixes bug 157.

svn path=/trunk/; revision=14299
2005-05-03 19:33:02 +00:00
Gerald Combs a80ebce3f2 Some dissectors apparently call proto_tree_add_*() with a null tvb.
This makes tvb_ensure_bytes_exist() throw a fit, so just throw an
exception instead.

svn path=/trunk/; revision=14212
2005-04-28 04:03:30 +00:00
Gerald Combs 7323cb267c Back out the previous change, and use tvb_ensure_bytes_exist() instead of
throwing an exception ourselves.

svn path=/trunk/; revision=14209
2005-04-28 03:30:07 +00:00
Gerald Combs 5ec0554c24 In alloc_field_info, throw a ReportedBoundsError if we're passed an
invalid length.

svn path=/trunk/; revision=14203
2005-04-27 16:22:24 +00:00
Ronnie Sahlberg c27c30ba02 Bugfix for proto_item_get_subtree()
Not all proto_item* fields have a subtree associated to it.
If it doesnt have a subtree  fi  will be NULL,
test fi for NULL before trying to dereference it to avoid a coredump.



svn path=/trunk/; revision=14134
2005-04-19 11:59:40 +00:00
Ronnie Sahlberg 2bc81b2a48 Major speed improvement for filtering and dissection.
It should not dump core as far as all my tests are concerned and Menu_Statistics/ProtocolHierStats work

It needs more testing and there might still be cases where it will crash that will need to be fixed  but I feel it will be worth it since it will decrease the time to filter very large capture files dramatically.

Real significant performance boost for very large captures.


(If we cant fix all the problems we can just revert this patch)



svn path=/trunk/; revision=14051
2005-04-11 08:43:51 +00:00
Ronnie Sahlberg df98534657 From Didier:
optimization for COLUMNS to make ethereal faster when filtering

optimization to make the slow find_protocol_by_id() fast.
(idea from Didier, implementation modified by me to be less intrusive)



svn path=/trunk/; revision=14026
2005-04-07 12:00:03 +00:00
Gerald Combs 8b95cd38d5 Don't generate a "dissector bug" warning in cases where a dissector calls
proto_tree_add_*(tree, tvb, offset, 0, ...);

and "offset" is greater than the length remaining in the tvbuff.

svn path=/trunk/; revision=14014
2005-04-04 18:10:42 +00:00
Gerald Combs b2c4af01c2 Remove a g_assert() left over from debugging.
svn path=/trunk/; revision=13971
2005-03-29 19:52:04 +00:00
Gerald Combs 4198c72a69 Fix a compiler warning.
svn path=/trunk/; revision=13969
2005-03-29 16:02:02 +00:00
Gerald Combs 9ead15a6eb README.developer says:
"PROTOABBREV     A name for the protocol for use in filter expressions;
                 it should contain only lower-case letters, digits, and
                 hyphens."

In proto_register_protocol(), generate a warning if PROTOABBREV contains
invalid characters.  Along with the list above, allow underscores and
periods.  Fix up whitespace.

Lower-case PROTOABBREV in several dissectors.

svn path=/trunk/; revision=13967
2005-03-29 14:56:09 +00:00
Ulf Lamping c475807aab bugfix: don't call tvb_length_remaining() if tvb is NULL
but what to do instead?

svn path=/trunk/; revision=13958
2005-03-28 18:08:31 +00:00
Guy Harris 48217e0bee For protocol tree items of type FT_NONE and FT_PROTOCOL, treat negative
length values (other than -1) as very large positive values, and for
values larger than the amount of data remaining in the tvbuff, clip the
value to the length of the tvbuff, so that dissectors don't have to
worry about doing that clipping themselves.

svn path=/trunk/; revision=13913
2005-03-26 03:27:22 +00:00
Ulf Lamping 79daa1e80e use DISSECTOR_ASSERT instead of g_assert
svn path=/trunk/; revision=13871
2005-03-23 00:09:12 +00:00
Ulf Lamping f6dbe26f6c add another REPORT_DISSECTOR_BUG() call, if tfi->tree_type is existing and not in valid range.
Question remains: Is it safe to continue in that case?

svn path=/trunk/; revision=13180
2005-01-26 23:17:00 +00:00
Guy Harris 5e4584e186 Add the source file name and line number to the dissector bug report
(not as useful as for bugs caught in the dissector itself, but still may
be useful).

svn path=/trunk/; revision=13082
2005-01-17 01:11:39 +00:00
Guy Harris df98de72ed Use REPORT_DISSECTOR_BUG() for the "bogus length" error in
"alloc_field_info()", so the error report can include the field with the
problem.  (The file and line number isn't interesting - the bug isn't in
"alloc_field_info()", it's in the dissector that called the routine
calling "alloc_field_info()" - but the field name/abbrevition is
interesting, as it'd help developers identify the place in the dissector
where we're passing in a bogus length.)

svn path=/trunk/; revision=13081
2005-01-17 00:56:56 +00:00
Guy Harris 2bdef3c122 Rename the FieldError exception to DissectorError.
Add a DISSECTOR_ASSERT() macro, which is the usual type of assertion
macro, but throws a DissectorError exception with a message giving the
flien and line number and the failed test as a string.  Use that macro
in "alloc_field_info()".

Report that exception in the Info column and the protocol tree, as well
as logging the exception failure with g_warning().

svn path=/trunk/; revision=13078
2005-01-16 23:30:55 +00:00
Ulf Lamping 1c9781b4ec throw the new FieldError exception, if a dissector tries to add a field with invalid parameters
add a message parameter to the show_exception function

svn path=/trunk/; revision=13074
2005-01-16 16:06:15 +00:00
Ulf Lamping 86bd4b30c5 performance improvement:
In the past: to prevent duplicate protocol names (and alike), each time a new protocol was registered, the list of protocols were iterated and the name compared with each existing name using strcasecmp, which is slow as we have >500 protocols right now.

Now: the protocol name to check against duplicates is first converted into a hashvalue and then only this value is checked and stored in a hashtable. This way the string to check for, has to be converted/compared only a single time!

svn path=/trunk/; revision=13007
2005-01-12 21:31:22 +00:00
Guy Harris cbddfd0793 From Luis Ontanon: if new ett values are registered after the
tree_is_expanded array is initially allocated, grow the array

svn path=/trunk/; revision=12997
2005-01-08 23:43:29 +00:00
Guy Harris 4c45795dab Constify a pointer, so that the array of pointers to ett_ values can be
const, although the pointers can't point to consts (as the values get
filled in as they're registered).

svn path=/trunk/; revision=12981
2005-01-07 12:56:21 +00:00
Guy Harris c1e2dc025b Cast away the constness of the argument to "g_tree_lookup()" - another
GLib function with an unfortunate signature.

svn path=/trunk/; revision=12923
2005-01-02 03:58:08 +00:00
Guy Harris 55465228b2 "proto_registrar_get_byname()" doesn't modify its argument, so make it
"const char *".

svn path=/trunk/; revision=12888
2004-12-31 02:02:19 +00:00
Guy Harris 948d61bae1 Check to make sure we don't give a protocol tree item a negative length.
Clean up indentation.

If we dissect an octet string and then re-dissect it as a particular
type of data, don't use the end offset from the re-dissection as the
offset of the end of the octet string - just use the result of
"dissect_per_octet_string()".

svn path=/trunk/; revision=12406
2004-10-27 10:02:45 +00:00
Guy Harris cc6754d659 Fix a typo.
svn path=/trunk/; revision=12062
2004-09-21 23:15:59 +00:00
Guy Harris 799bc411a1 From Dave Richards: fix a format string.
svn path=/trunk/; revision=11969
2004-09-11 22:36:16 +00:00
Gilbert Ramirez f676f7107b Add a "-G fields2" option which is like "-G fields", but extends the field
records by tw fields: base (for integers), and blurb

Add a "-G values" option which shows value strings and true_false strings for
the fields that have them.

svn path=/trunk/; revision=11954
2004-09-10 15:21:20 +00:00
Guy Harris 8b92640589 To conert a little-endian value to a big-endian value, use
GUINT32_SWAP_LE_BE(), not GUINT32_TO_BE() - the latter converts a
host-byte-order value to big-endian, but the host might be big-endian.

svn path=/trunk/; revision=11945
2004-09-08 19:36:25 +00:00
Ronnie Sahlberg 1141542d06 From Peter Johansson, make proto_tree_add_item() handle IPv4 addresses
stored in little endian format.


svn path=/trunk/; revision=11939
2004-09-08 10:32:53 +00:00
Guy Harris c68f62210f Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bit
integers.

Make FT_INT64 and FT_UINT64 add numerical values, rather than byte-array
values, to the protocol tree, and add routines to add specified 64-bit
integer values to the protocol tree.

Use those routines in the RSVP dissector.

svn path=/trunk/; revision=11796
2004-08-22 00:31:58 +00:00
Guy Harris a6c45e1f0b Add support for FT_FLOAT and FT_DOUBLE in "proto_tree_add_item()"
(untested).

svn path=/trunk/; revision=11646
2004-08-10 21:23:34 +00:00
Guy Harris 3a583aeb59 From Albert Chin: rename resolv.{ch} to addr_resolv.{ch}, so that an
include of <resolv.h> in any system header file gets the system
<resolv.h> (needed for builds on Tru64 with GTK+ 1.2[.x]).

svn path=/trunk/; revision=11615
2004-08-06 19:57:49 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris 50ac581613 "length" is relative to the start of the field, so don't subtract the
start of the field from it.

svn path=/trunk/; revision=11354
2004-07-09 21:52:03 +00:00
Ulf Lamping 97c4ef6cfb bugfix: don't try to print data, if tvb is too short
svn path=/trunk/; revision=11318
2004-07-05 16:42:19 +00:00
Guy Harris 003ecf68bb Instead of using pointer casts in the slab allocator stuff, add a
"SLAB_ITEM_TYPE_DEFINE()" macro to define a union of the type of object
for the slab and a pointer to an object of that union type, and use that
type for items on the slab allocator free lists; that *should* avoid
having the compiler think two pointers to an item being added to or
removed from the free list don't point to the same object just because
they have different types.

svn path=/trunk/; revision=11306
2004-07-04 02:29:43 +00:00
Guy Harris 456c6cab66 Make the "SLAB_ALLOC()" and "SLAB_FREE()" macros take the type of the
object being allocated, rather than the name of the free list, as an
argument (with the name of the free list constructed from the name of
the type), and add macros to define and declare the free list, also
taking the type of the object being allocated.

svn path=/trunk/; revision=11305
2004-07-04 00:28:11 +00:00
Ulf Lamping d9118dc089 add PROTO_ITEM_SET_HIDDEN() and PROTO_ITEM_SET_GENERATED(),
this sets flags for later rendering of the field data

svn path=/trunk/; revision=10752
2004-05-01 15:15:08 +00:00
Guy Harris 044f075c66 From Tomas Kukosa: add APIs to get the parent of a protocol tree item
and the item N levels up from a protocol tree item.

svn path=/trunk/; revision=10486
2004-03-25 23:55:21 +00:00
Guy Harris a6ed2d499a From Tomas Kukosa: BER dissector enhancements and proto.c updates to
support them.

From Ronnie Sahlberg: Kerberos updates with new constants from the
current draft, decryption and dissection of Kerberos blobs, and changes
to work with the changed BER dissector.

svn path=/trunk/; revision=10479
2004-03-25 09:18:03 +00:00