Commit Graph

74 Commits

Author SHA1 Message Date
Jörg Mayer 48be4e530d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6116
2002-08-28 20:41:00 +00:00
Guy Harris 6e56c25c9d From Ulf Lamping: add a new FT_FLOAT type, for single-precision
floating-point numbers, and display all the significant digits for both
single-precision and double-precision floating-point numbers in the
protocol tree, not just what "%g" does (6 digits).

Put in comments explaining how the length of filter strings is computed,
and fix some of the computations.

svn path=/trunk/; revision=6081
2002-08-24 19:45:28 +00:00
Guy Harris 14cff7ceba From Vassilii Khachaturov: put protocol blurbs into tables generated
with the "-G fields" flag.

In the scripts to process that output, handle FT_UINT64, FT_INT64, and
FT_UINT_STRING.

svn path=/trunk/; revision=6012
2002-08-18 19:08:30 +00:00
Jörg Mayer 3105ee542f Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c
and inet_ntop.c for now (can't estimate the consequences).

svn path=/trunk/; revision=5928
2002-08-02 21:29:45 +00:00
Guy Harris 5adb2d031d From Joerg Mayer: fix a typo in a comment.
svn path=/trunk/; revision=5707
2002-06-19 19:21:15 +00:00
Guy Harris e390d7e0cc Make the "-G" flag take an argument. If no arugment is specified, or if
the argument is "fields", dump out a table of the fields, as we
currently do; if the argument is "protocols", dump out a table of the
protocols.

svn path=/trunk/; revision=5462
2002-05-14 10:15:12 +00:00
Gilbert Ramirez 41cc7f0707 Merge the work in Novell_NCP_branch into the mainline code.
A little work still needs to be done on the new NCP dissector -- make
some of the COL_INFO texts more useful, handle a Unicode issue, and
modify some of the cases that use "request conditions".
But the NCP dissector as it stands is very usable now.

Note: I didn't merge in the PROTO_LENGTH_UNTIL_END macro... I wanted
to think about the various possible macros and review an email conversation
I had with Guy on the subject.

svn path=/trunk/; revision=5432
2002-05-09 23:50:34 +00:00
Guy Harris 30f02bc99c Move the code to build the balanced tree of fields into "proto_init()",
move the code from "dfilter_lookup_token()" into
"proto_registrar_get_byname()", and get rid of "dfilter_lookup_token()"
and have its callers call "proto_registrar_get_byname()" instead.

svn path=/trunk/; revision=5287
2002-04-29 07:55:32 +00:00
Guy Harris dd9f02255d Note in a comment that the display filter code has its own mechanism for
looking up filter fields by name.

svn path=/trunk/; revision=5281
2002-04-28 23:39:58 +00:00
Guy Harris 4fb36a6b1d Use "format_text()" when setting the display representation of string
values, so that non-printable characters are shown as escapes.

svn path=/trunk/; revision=5280
2002-04-28 22:21:09 +00:00
Guy Harris 5984e4ba95 Clean up white space.
Fix the display filter expression generated for protocol tree items
without named fields attached to them; the length defaults to 1 if not
specified in a range expression, so the length should be specified.

svn path=/trunk/; revision=5208
2002-04-20 08:07:56 +00:00
Guy Harris a056c5052d proto_registrar_get_nth(hfinfo->id) == hfinfo, so use the latter rather
than the former.

svn path=/trunk/; revision=5203
2002-04-19 10:03:52 +00:00
Guy Harris 50155a975d From Phil Williams: support for looking up fields by name.
Clean up some white space, and one non-extern declaration in
"epan/proto.h".

svn path=/trunk/; revision=5201
2002-04-18 20:19:10 +00:00
Guy Harris ec005ccd0b Catch attempts to register ett_ values after the array of "tree is
expanded" flags has been allocated.

svn path=/trunk/; revision=5197
2002-04-18 00:50:45 +00:00
Guy Harris 3cf1b5ffa5 Before putting an item into a protocol tree, make sure the item above
it, if it's going to be displayed (i.e., if it's not the root node), has
had an ett_ value associated with it.

svn path=/trunk/; revision=5098
2002-04-04 20:23:50 +00:00
Guy Harris 5de2533f2d Start assigning ett_ values at 0, rather than 1; get rid of the reserved
ETT_NONE entry.

Initialize the "tree_type" field of a "field_info" structure to -1,
meaning "this has not been given a subtree".  Add checks before using
that field that it's in range.  That way, you have to create a subtree
before putting protocol tree items under another item.

We allocate the "tree_is_expanded" array when we've registered all
dissectors; there's no need to allocate it while we're registering
dissectors and, in fact, doing so means we leak memory (the memory for
the version we allocated while registering dissectors).

svn path=/trunk/; revision=5068
2002-04-01 02:00:53 +00:00
Guy Harris 165a8253b2 Allow "proto_item_append_text()" to an item that doesn't have a
representation string - set the representation string to the default
representation.  This lets you append to an item that's been added with
"proto_tree_add_XXX" calls that don't explicitly format the
representation string.

svn path=/trunk/; revision=4973
2002-03-19 08:42:16 +00:00
Gilbert Ramirez 6aad6e40b8 tvb_get_nstringz() needs to terminate a string with a NUL if the
end of the tvbuff is reached before the maximum_length passed by the
caller is reached and before a terminating NUL is found. In this case,
tvb_get_nstringz() returns a -1, but if the string is not artificially
terminated with a NUL by tvb_get_nstringz(), the
caller has no idea where the string should end because 1) the
return value "-1" gives the impression that the string ends
at the end of the buffer but 2) the string does
not end at the end of the buffer, but somewhere in the middle, due
to the packet being shorter than expected.

tvb_get_nstringz() and tvb_get_nstringz0() were both modified.

The FT_STRINGZ case in proto_tree_add_item() is made simpler.

During regression testing, when investigating a regression that I later
corrected, I discovered that strings added through proto_tree_add_item
(FT_STRING, FT_STRINGZ, and FT_UINT_STRING) leaked memory due to double
allocation of the string. The proto_tree_add_string*() functions do
not leak memory, since they only copy the string once. The memory
leak was fixed by adding another argument to the static function
proto_tree_set_string() to let the string ftype code know to g_strdup()
the string or not.

svn path=/trunk/; revision=4891
2002-03-06 19:17:06 +00:00
Guy Harris 52fb615708 From Joerg Mayer: get rid of "-Wno-unused" flag in some configure
scripts, and check in changes to add _U_ to some unused arguments (some
other should perhaps be used, so we leave the _U_ out so that the
warnings serve as a reminder to check those).

svn path=/trunk/; revision=4848
2002-03-02 20:51:46 +00:00
Gilbert Ramirez 2e6ded0440 Remove unused variables, structure definitions, and functions.
From Joerg Mayer.

svn path=/trunk/; revision=4827
2002-02-27 18:54:33 +00:00
Guy Harris cbf5c537c4 From Joerg Mayer: remove unused variables and declarations of
non-existent functions.

Remove the "filetype" argument from the "can_write_encap" functions for
particular capture file types - the argument value is implicit, in that
the routine being called is the routine for that particular file type.

svn path=/trunk/; revision=4823
2002-02-27 08:57:25 +00:00
Guy Harris 8166da40d5 Have "alloc_field_info()" take a pointer to the field length as an
argument, so if the length was supplied as -1, it can set it to the
length of data remaining in the tvbuff, so that its callers can use that
length when getting the value for the field, rather than leaving the
length in the "field_info" structure as -1.

svn path=/trunk/; revision=4752
2002-02-18 22:26:29 +00:00
Guy Harris 6a21dc7e44 Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a
list of data sources associated with them.

Use the tvbuff pointer to determine which data source is the data source
for a given field; this means we don't have to worry about multiple data
sources with the same name - the only thing the name does is label the
notebook tab for the display of the data source, and label the hex dump
of the data source in print/Tethereal output.

Clean up a bunch of things discovered in the process of doing the above.

svn path=/trunk/; revision=4749
2002-02-18 01:08:44 +00:00
Gilbert Ramirez bd4a9c13eb Provide tvb_ensure_length_remaining(), which is like
tvb_length_remaining() except that it throws BoundsError if 'offset'
is out-of-bounds.

Allow a length argument of -1 for FT_STRING and FT_BYTES fields
in proto_tree_add_item().

Change some dissectors to either use -1 for the length argument in
calls to proto_tree_add_item(), or call tvb_ensure_length_remaining()
instead of tvb_length_remaining(), or to check the return-value
of tvb_length_remaining(). Changes to more dissectors are necessary,
but will follow later.

svn path=/trunk/; revision=4656
2002-02-01 04:34:17 +00:00
Guy Harris 92915713d3 Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff".  This can be used if

	1) the item covers the entire packet or the remaining payload in
	   the packet

or

	2) the item's length won't be known until it's dissected, and
	   will be then set with "proto_item_set_len()" - if an
	   exception is thrown in the dissection, it means the item ran
	   *past* the end of the tvbuff, so saying it runs to the end of
	   the tvbuff is reasonable.

Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).

In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).

Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.

Fix some indentation.

svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
Guy Harris e35851244c Clean up white space.
svn path=/trunk/; revision=4492
2002-01-07 01:05:33 +00:00
Gilbert Ramirez 791f5774d0 Provide for per-protocol-tree data in the proto_tree code.
Put a hash-table of "interesting" fields in the per-proto-tree data.
The dfilter code records which fields/protocols are "interesting" (by which
I mean, their value or existence is checked). Thus, the proto_tree routines
can create special arrays of field_info*'s that are ready for the dfilter
engine to use during a filter operation.

Also store the "proto_tree_is_visible" boolean, renamed "visible", in
the per-proto-tree data.

Move epan_dissect_t to its own header file to make #include dependencies
easier to handle.

Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t*
as an argument.

epan_dissect_new() needs to be followed by epan_dissect_run() for the
dissection to actually take place. Between those two calls,
epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to
prime the empty proto_tree with the "intersesting" fields from the dfilter_t.

svn path=/trunk/; revision=4422
2001-12-18 19:09:08 +00:00
Gilbert Ramirez f1b64de80e Dfilter code finds field under *any* parent's subtree, not just
the parent under which the field was registered.

This is the *unoptimized* version, to give developers something
to use while the optimized version is being created.

svn path=/trunk/; revision=4351
2001-12-07 03:39:26 +00:00
Guy Harris bced8711f6 Make "dissector_add()", "dissector_delete()", and "dissector_change()"
take a dissector handle as an argument, rather than a pointer to a
dissector function and a protocol ID.  Associate dissector handles with
dissector table entries.

svn path=/trunk/; revision=4308
2001-12-03 04:00:26 +00:00
Ed Warnicke b7420272e7 Moved int-64bit.{c,h} into epan/
svn path=/trunk/; revision=4248
2001-11-22 03:07:07 +00:00
Guy Harris ecaca4b768 Fix an earlier typo of mine.
svn path=/trunk/; revision=4238
2001-11-21 01:01:17 +00:00
Guy Harris 8550cfcc6f Allow the tvbuff pointer to various "proto_tree_add" routines to be null
if (and only if) the length of the item being added is 0 (so that it has
no data backing it).

This means the data stream name pointer for the item in question is
null; make sure we handle that.

Use that for some "uses the value from the matching request" fields in
the SMB Pipe protocol.

svn path=/trunk/; revision=4231
2001-11-20 09:07:34 +00:00
Guy Harris 4a5538085f Get rid of NullTVB, the "compat_top_tvb" member of the "packet_info"
structure, the check for a null tvbuff pointer in "alloc_field_info()",
and the "tvb_create_from_top()" macro; they're no longer needed, as
there's no non-tvbuffified dissector code remaining.

svn path=/trunk/; revision=4205
2001-11-15 10:58:51 +00:00
Guy Harris f2676ba1c9 Tvbuffification of Negotiate Protocol, from Ronnie Sahlberg.
Fix up Info column to put "Request" or "Response" *after* the name of
the request.

Give the Negotiate Protocol request its full name.

svn path=/trunk/; revision=4139
2001-11-03 11:42:50 +00:00
Guy Harris 66c2940031 When freeing the "gpa_hfinfo" pointer array, free the array itself, as
well as the structure containing it.

svn path=/trunk/; revision=4131
2001-11-03 01:19:59 +00:00
Guy Harris 5511e79593 Add support for 64-bit signed integers in "int-64bit.[ch]", add an
FT_INT64 type, and make the Diameter dissector use it.

Handle the 64-bit integer types in the display filter semantics checks.

svn path=/trunk/; revision=4125
2001-11-02 10:09:51 +00:00
Guy Harris d82c74d757 From Ronnie Sahlberg: FT_UINT64 support, code to handle 64-bit integers
without requiring compiler support for them, and updates to the
Diameter, L2TP, NFS, and NLM dissectors to use it and to the ONC RPC
dissector to allow ONC RPC subdissectors to use it.

svn path=/trunk/; revision=4099
2001-10-29 21:13:13 +00:00
Gilbert Ramirez 038da8730a Fix some signed/unsigned comparison warnings. In the case of tvbuff.h,
there were 2 functions which accepted 'maxlength' == -1, but the function
prototypes had maxlength as a guint --- fixed.

svn path=/trunk/; revision=4087
2001-10-26 17:29:12 +00:00
Guy Harris 6f54015711 When putting protocols into the list of protocols, do a case-insensitive
sort.

Give iSCSI the short name "iSCSI" rather than "ISCSI".

svn path=/trunk/; revision=4067
2001-10-23 05:40:36 +00:00
Guy Harris 1d42c94b05 Make the resolution for time values be nanoseconds rather than
microseconds.

Fix some "signed vs. unsigned" comparison warnings.

svn path=/trunk/; revision=3934
2001-09-14 07:10:13 +00:00
Guy Harris fbe8da33f5 Add a "proto_item_append_text()" routine, which is like
"proto_item_set_text()" except that it appends the result of the
formatting to the item's current text, rather than replacing the item's
current text.  Use it in the DNS dissector.

svn path=/trunk/; revision=3880
2001-08-29 00:51:10 +00:00
Guy Harris aa4cd01b9b Get rid of "proto_tree_add_notext()" - if you create a subtree using it,
but, before you set the text, you throw an exception while putting stuff
under the subtree, you end up with an absolutely blank protocol tree
item, which is really gross.  Instead of calling
"proto_tree_add_notext()", call "proto_tree_add_text()" with at least a
minimal label - yes, it does mean you do some work that will probably be
unnecessary, but, absent a scheme to arrange to do that work if it *is*
necessary (e.g., catching exceptions), the alternative is an ugly
protocol tree display.

svn path=/trunk/; revision=3879
2001-08-28 08:28:19 +00:00
Guy Harris 74262f37de Patch from Lee Berger to properly skip past the length in FT_UINT_STRING
data objects if the length isn't 1.

svn path=/trunk/; revision=3821
2001-08-04 19:57:30 +00:00
Guy Harris d451acb66c Add a "time_secs_to_str_buf()" routine, which takes seconds and
fractions-of-a-second (the units of which are either milliseconds or
microseconds, specified by a Boolean argument), and formats it into a
"DD days, HH hours, MM minutes, SS seconds" using a buffer supplied to
it.  Have "time_secs_to_str()" and "time_msecs_to_str()" both use it.
Also, have it correctly handle the case of SS being > 0 but < 1 (which
"time_msecs_to_str()" didn't do).

Rename "rel_time_to_str()" to "rel_time_to_secs_str()", and add a
"rel_time_to_str()" routine that takes a "struct timeval" and hands its
seconds and microseconds values to "time_secs_to_str_buf()".  Use
"rel_time_to_secs_str()" to format FT_RELATIVE_TIME values for now; we
might want to use "rel_time_to_str()" for them, though, or make it an
option (either a user option, or a per-field option, using the field
that also holds BASE_ values).

svn path=/trunk/; revision=3806
2001-08-01 08:27:00 +00:00
Guy Harris f7b50ca754 From Joerg Mayer:
* gcc 3.0 warning fixes:
  - text2pcap.c: The number of characters to scan should probably not be 0
  - wiretap/csids.c: using preincrement on a variable used on both
    sides of an assignment might be undefined by the C99(?) standard
 * turn on additional warnings for epan and wiretap too
  - epan/configure.in
  - wiretap/configure.in
 * Fix some warnings (missing includes, signed/unsigned, missing
    initializers) found by turning on the warnings
  - all other files :-)

svn path=/trunk/; revision=3709
2001-07-13 00:55:58 +00:00
Guy Harris 2851b7ef76 Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.

If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.

Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.

"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.

"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".

Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".

Before pushing a new field-description message onto the statusbar, pop
the old one off.

Get rid of an unused variable (set, but not used).

svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
Guy Harris 6200054304 Add support for "Match Selected" on FT_ABSOLUTE_TIME and
FT_RELATIVE_TIME fields.

svn path=/trunk/; revision=3488
2001-05-31 07:15:23 +00:00
Guy Harris a0dfbbbee5 When generating a filter expression to match a protocol tree line not
corresponding to a named field, by matching stuff at a particular offset
in the frame, don't treat a length of 1 byte specially - the syntax for
a one-byte byte string is the same as for longer byte strings, with no
leading "0x" allowed.

Clean up white space.

svn path=/trunk/; revision=3406
2001-05-09 01:22:46 +00:00
Guy Harris 3d2a6831d0 If "proto_item_set_len()" is passed a null pointer as its first
argument, have it just return; this allows dissectors that don't
explicitly check for a null protocol-tree argument to pass the
protocol-tree argument to "proto_tree_add_XXX()" routines - which means
they'll get a null pointer back if the protocol-tree argument is null
because we're not constructing a protocol tree - and then later use
"proto_item_set_len()" without having to check for a null
protocol-tree-item pointer.

svn path=/trunk/; revision=3402
2001-05-07 21:06:59 +00:00
Guy Harris ae84ef77de When registering numeric fields, check that a base other than BASE_NONE
was specified.

This should obviate the need to handle BASE_NONE specially in the
formatting routines, so revert to the previous version.

svn path=/trunk/; revision=3359
2001-04-23 01:19:39 +00:00