Commit Graph

12 Commits

Author SHA1 Message Date
Guy Harris ea9409cb04 Finish tvbuffifying the X11 dissector - instead of having it be an
old-style dissector that does a "tvb_create_from_top()" and then calls
new-style-dissector subroutines, just use tvbuffs throughout.

Turn "tvb" from a global variable into an argument (as we no longer
create that tvbuff).

svn path=/trunk/; revision=2666
2000-11-19 02:48:24 +00:00
Laurent Deniel cc36f0b931 Add the "Edit:Protocols..." feature which currently only implements
the following:

It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.

Disabling a protocol could be interesting:

- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)

Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)

I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).

Two functions are added in proto.c :

gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);

and two MACROs which can be used in dissectors:

OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)

See also the XXX in proto_dlg.c and proto.c around the new functions.

svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
Guy Harris 56b989e0ad Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.

Have the code that calls those dissectors translate the arguments as
necessary.  (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation.  Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)

This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so.  It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.

Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.

Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_".  Update the
dissectors that use those routines appropriately.

Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".

svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
Guy Harris 6bf61848b7 Add braces to squelch a warning from GCC 2.8.1 on Solaris 7/x86.
svn path=/trunk/; revision=2076
2000-06-17 03:05:02 +00:00
Guy Harris 72ad5b91d6 Fix typos in some printf formats - "+%d", not "%+d"
svn path=/trunk/; revision=2069
2000-06-15 04:09:22 +00:00
Gilbert Ramirez 0ab8dd8cbd Convert IPX-and-friend dissectors in packet-ipx.c to use
tvbuffs.

In doing so, I realied that my recommendation for using
tvb_new_subset(pi.compat_top_tvb, -1, -1) was incorrect, because
some dissectors (ethernet!) change pi.len and pi.cap_len. So, I have
to take those two variables into account instead of using -1 and -1.

So, I provide a macro called tvb_create_from_top(offset), where
offset is the name of your offset variable. It is a wrapper around
tvb_new_subset().

I converted the lines that followed my suggestion to use
tvb_create_from_top().

In proto.c I added
proto_tree_add_debug_text(proto_tree*, const char*, ...)
It's much like proto_tree_add_text(), except that it takes no offset
or length; it's soley for temporarily putting debug text into the
proto_tree while debugging a dissector. In making sure that its
use is temporary, the funciton also prints the debug string to stdout
to remind the programmer that the debug code needs to be removed
before shipping the code.

svn path=/trunk/; revision=2068
2000-06-15 03:49:00 +00:00
Guy Harris 9a52ba3506 When building under Win32, "boolean" appears to be defined in a fashion
that causes "packet-x11.c" to fail to compile due to it defining its own
function named "boolean", so we rename the "packet-x11.c" "boolean()"
function to "add_boolean()".

svn path=/trunk/; revision=2066
2000-06-14 07:16:07 +00:00
Guy Harris 9dd3dda4c9 In "stringCopy()", make the character temporary unsigned, so that it
doesn't get sign-extended before being handed to "isgraph()".

svn path=/trunk/; revision=2065
2000-06-14 00:24:39 +00:00
Gilbert Ramirez 835e8bea10 Initialize 'int next_offset' to 0 instead of NULL.
svn path=/trunk/; revision=2063
2000-06-12 19:19:54 +00:00
Guy Harris 5a957e006a Don't include <X11/Xlib.h> to get AllPlanes defined; that causes the
build to fail on Win32 systems.  It's defined (at least in the X11R6 on
my FreeBSD 3.4 system) as "((unsigned long)~0L)", which presumably means
"set all the bits" - which means "set all 32 bits" in the "value_string"
table where it appears, as the value member of an entry in such a table
is a "guint32", so just use 0xFFFFFFFF.

Get rid of other unneeded #includes as well.

svn path=/trunk/; revision=2061
2000-06-12 09:32:06 +00:00
Guy Harris 22f6f8b468 Partial tvbuffification of the X11 dissector; we construct a tvbuff from
the top-level "compatibility" tvbuff, so that we don't blow up if we get
short frames *or* misinterpret data due to, for example, trying to treat
the initial client->server message in a connection as an X11 request, or
interpreting the middle of a multi-frame request (e.g., a big PutImage)
as if it contained requests.  (I have a capture file on which the
non-tvbuffified code crashed.)

Attempt to dissect requests until we reach the end of the frame, even if
that would take us past the end of the captured data in the frame before
we reach the end of the frame; the tvbuff code will throw an exception
if we go past the end of the captured data, which means it'll put a
"Short frame" indication into the protocol tree, which is what we want
(the frame *is* short, because the capture length was too short).

Define functions taking no arguments with a "(void)" argument list, so
that the compiler knows that they must not be passed any arguments.

svn path=/trunk/; revision=2059
2000-06-12 08:28:13 +00:00
Guy Harris 515f6811c0 Christophe Tronche's X11 dissector.
svn path=/trunk/; revision=2057
2000-06-12 02:30:35 +00:00