Commit Graph

2697 Commits

Author SHA1 Message Date
Guy Harris ee1b884ee9 Tvbuffify the STP dissector, have it register itself and have the LLC
dissector call it through a handle, and make it static.

Give "dissect_data()" an "offset" argument, so dissectors can use it to
dissect part of the packet without having to cook up a new tvbuff.

Go back to using "dissect_data()" to dissect the data in an IPP request.

svn path=/trunk/; revision=2651
2000-11-16 07:35:43 +00:00
Guy Harris 77ad89b12d Add a mechanism by which a dissector can be registered by name, another
dissector can get a "handle" for that dissector by name and then call
that dissector through the handle.

This allows dissectors that can't be called through a port table or a
heuristic table to be called from other dissectors without directly
referring to the dissector function - dynamically-loaded modules, under
Windows, cannot directly call functions in the main program, and
non-plugin dissectors are in the main program and thus cannot be called
from plugin dissectors unless either

	1) a pointer to the dissector is put in the Big Transfer Vector

or

	2) some other mechanism for getting a pointer to the dissector
	   is provided.

This mechanism could also support registering old-style dissectors and
calling them from new-style dissectors without the new-style dissector
having to do the argument translation itself (I didn't add support for
registering old-style dissectors because I'd prefer to have people
tvbuffify their code if they have to register a dissector...).

It could also, in the future, perhaps support

	disabling of protocols;

	setting "pinfo->current_proto";

inside "call_dissector()" - and inside "{old_}dissector_try_port()" and
"{old_"dissector_try_heuristic()" - allowing a pile of stuff that
currently has to be done in every dissector be done by common code.
(I have some ideas about how to do this, by

	having "proto_register_protocol()" take an abbreviation - of the
	sort that would be put in, for example, "pinfo->current_proto" -
	as an argument;

	having the calls to register dissectors take an index returned
	by "proto_register_protocol()" as an argument.

The abbreviation could be used elsewhere as well, e.g. in the "Decoding"
tab of the "Edit->Protocols" dialog box, and in a GUI for constructing
protocol filters.  Watch this space.)

Make "dissect_sdp()" the first client of this mechanism; it's now static
to "packet-sdp.c", and all dissectors that call it - including the MGCP
plugin - now call it through a dissector handle fetched by
"find_dissector()".  (Next step - see if Ethereal can now compile on
Windows as a result of this.)

svn path=/trunk/; revision=2647
2000-11-15 07:07:52 +00:00
Guy Harris e8bebbd727 "plugin_api.c" needs to include <glib.h>, to define G_HAVE_GINT64 on
platforms that have "gint64".

Fix plugin-table lines for "dissector_delete()", "dissect_data()",
"prefs_register_module()", and "prefs_register_uint_preference()".

The MGCP dissector uses routines from GLib, so when building it as a DLL
for Windows, it has to be linked with "glib-XXX.lib".

svn path=/trunk/; revision=2643
2000-11-14 10:38:15 +00:00
Guy Harris b830fb6a5f Add "dissector_delete()", "proto_item_get_len()",
"proto_item_set_len()", "proto_item_set_text()", and the preference
routines expected to be used by dissectors to the table of function
pointers handed to dissectors on platforms where dynamically-loaded
modules can't access symbols from the main program.

svn path=/trunk/; revision=2638
2000-11-13 10:13:26 +00:00
Guy Harris ead1cadaf3 Add the tvbuff routines expected to be used by dissectors to the table
of function pointers handed to dissectors on platforms where
dynamically-loaded modules can't access symbols from the main program.

svn path=/trunk/; revision=2635
2000-11-13 08:00:12 +00:00
Guy Harris 5694059e97 Add a Makefile.nmake for the MGCP plugin, and update
"plugins/Makefile.nmake" to build that plugin.

Add to the table of routines callable from plugins
"old_dissector_add()", "old_dissect_data()", and
"proto_is_protocol_enabled()", so that the Gryphon dissector can build
on Windows.

Move the includes of "plugins/plugin_api.h" and "moduleinfo.h" before
all the other includes, except for "config.h", in "plugin-mgcp.c", to
match what the Gryphon dissector does; "plugins_api.h" must be included
before any of the routines whose names it #defines in order for the
plugin to build on Windows.  (It still doesn't build on Windows, as
still more routines need to be added to the table of routines callable
from plugins, but tomorrow is another day.  Making libethereal a DLL may
obviate the need for that table, *if* all the routines called from a
plugin are in libethereal, as I think routines in a DLL, even a
run-time-loaded DLL, can call routines from another DLL as long as those
routines are exported from the other DLL.)

svn path=/trunk/; revision=2622
2000-11-12 11:08:46 +00:00
Guy Harris e340939fea Yet Another .cvsignore file.
svn path=/trunk/; revision=2596
2000-11-10 06:53:14 +00:00
Guy Harris 07eb30403d Tvbuffify the SAP and SDP dissectors.
Add "tvb_find_line_end_unquoted()" for the benefit of the SDP dissector;
get rid of "find_line_end_unquoted()" as nobody uses it any more.

Add "tvb_pbrk_guint8()" for the benefit of
"tvb_find_line_end_unquoted()"; it searches for any of a number of
characters, unlike "tvb_find_guint8()" which searches for only one.

svn path=/trunk/; revision=2595
2000-11-10 06:50:37 +00:00
Guy Harris 9eb37f04e7 MGCP updates from Ed Warnicke.
svn path=/trunk/; revision=2594
2000-11-10 04:58:29 +00:00
Gilbert Ramirez 2cb9d54620 Add MGCP dissector plugin from Ed Warnicke <hagbard@physics.rutgers.edu>.
svn path=/trunk/; revision=2588
2000-11-09 10:04:48 +00:00
Guy Harris 82917a0672 "plugin_reg_handoff()" is a symbol in the plugin that Ethereal has to
access, so it must be declared with DLLEXPORT so that it's exported on
Windows.

svn path=/trunk/; revision=2572
2000-11-06 08:44:05 +00:00
Guy Harris 543ce8680a New-style plugins don't require a "desc" variable.
svn path=/trunk/; revision=2566
2000-11-05 09:09:29 +00:00
Guy Harris 1964cfddf6 Allow plugins to have, instead of "protocol" and "filter_string"
variables and a "dissector" routine, a "plugin_reg_handoff()" routine,
which will act just like the "reg_handoff()" routine of a non-plugin
dissector, registering the dissector with handoff tables.

This lets them plug into both TCP and UDP, or plug into protocols other
than TCP or UDP.

Those new-style plugin are enabled and disabled using the standard
"Edit->Protocols" mechanism (and thus should use
"OLD_CHECK_DISPLAY_AS_DATA()" or "CHECK_DISPLAY_AS_DATA()"); they don't
show up in the list of plugins, aren't enabled or disabled from that
list, and, as they don't have a filter, can't have the filter changed
from that list - instead, they should register preferences for port
numbers and the like if they should be configurable to use different
ports.

Make the Gryphon protocol a new-style plugin.

svn path=/trunk/; revision=2565
2000-11-05 09:05:00 +00:00
Guy Harris b2929352b6 Updates from Steve Limkemann.
svn path=/trunk/; revision=2545
2000-11-01 00:16:18 +00:00
Guy Harris faf70584f2 Fix it to build on Windows.
svn path=/trunk/; revision=2488
2000-10-11 07:35:02 +00:00
Graham Bloice 0ae9cce784 Updated to ignore Win32 detritus
svn path=/trunk/; revision=2430
2000-09-13 22:03:52 +00:00
Laurent Deniel f395740875 Modify the Gryphon plugin code in order to avoid an abort when the
plugin is enabled -> disabled -> re-enabled due to the fact that
the protocol registration is performed at each plugin_init() call
(and there is no protocol cleanup like with dfilter_cleanup).

Now we use the proto_xxx static variable to check if it is the first
activation or not (in this case, the proto_register_xxx routines are
not called.

svn path=/trunk/; revision=2290
2000-08-18 13:47:59 +00:00
Laurent Deniel 6a480953a9 Miscellaneous code cleaning
- add <stdarg.h> or <varargs.h> in snprintf.h
  and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes

- remove the check of multiple inclusions in source (.c)  code
  (there is a bit loss of _cpp_ performance, but I prefer the gain of
   code reading and maintenance; and nowadays, disk caches and VM are
   correctly optimized ;-).

- protect all (well almost) header files against multiple inclusions

- add header (i.e. GPL license) in some include files

- reorganize a bit the way header files are included:

  First:
  #include <system_include_files>
  #include <external_package_include_files (e.g. gtk, glib etc.)>
  Then
  #include "ethereal_include_files"

  with the correct HAVE_XXX or NEED_XXX protections.

- add some HAVE_XXX checks before including some system header files

- add the same HAVE_XXX in wiretap as in ethereal

Please forgive me, if I break something (I've only compiled and regression
tested on Linux).

svn path=/trunk/; revision=2254
2000-08-11 13:37:21 +00:00
Gilbert Ramirez 5a5f56ffbf Fix plugin function table so that plugins work on Win32.
svn path=/trunk/; revision=2034
2000-05-31 18:32:15 +00:00
Guy Harris 283ce59938 Add routines for adding items to a protocol tree that take arguments of
a particular type, rather than taking a varargs list, along the lines of
the "proto_tree_add_XXX_format()" routines.

Replace most calls to "proto_tree_add_item()" and
"proto_tree_add_item_hidden()" with calls to those routines.

Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to
"proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and
add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()"
routines that don't take the item to be added as an argument - instead,
they fetch the argument from the packet whose tvbuff was handed to them,
from the offset handed to them.

svn path=/trunk/; revision=2031
2000-05-31 05:09:07 +00:00
Olivier Abad b977b382b3 Changed my mail address to oabad@cybercable.fr (dhis.net is too
unreliable).

svn path=/trunk/; revision=2019
2000-05-28 17:04:47 +00:00
Guy Harris 192a2e45fa Use "rm -f", not "rm", to remove "plugin_api.obj", so that if
"plugin_api.obj" doesn't exist, it just drives on rather than giving an
error.

svn path=/trunk/; revision=1990
2000-05-20 20:52:27 +00:00
Gilbert Ramirez 292e38e2c6 Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.

dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.

The FDDI dissector is converted to use tvbuff's.

svn path=/trunk/; revision=1939
2000-05-11 08:18:09 +00:00
Guy Harris 6bbfd97bde Add routines to:
register lists of "heuristic" dissectors, which are handed a
	frame that may or may contain a payload for the protocol they
	dissect, and that return FALSE if it's not or dissect the packet
	and return TRUE if it is;

	add a dissector to such a list;

	go through such a list, calling each dissector until either a
	dissector returns TRUE, in which case the routine returns TRUE,
	or it runs out of entries in the list, in which case the routine
	returns FALSE.

Have lists of heuristic dissectors for TCP and for COTP when used with
the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger
dissectors to the first list and the Sinec H1 dissector to the second
list.

Make the dissector name argument to "dissector_add()" and
"dissector_delete()" a "const char *" rarther than just a "char *".

Add "heur_dissector_add()", the routine to add a heuristic dissector to
a list of heuristic dissectors, to the set of routines we can export to
plugins through a table on platforms where dynamically-loaded code can't
call stuff in the main program, and initialize the element in the table
in question for "dissector_add()" (which we'd forgotten to do).

svn path=/trunk/; revision=1909
2000-05-05 09:32:36 +00:00
Guy Harris 3c9a310b6d Graham Bloice's changes to, on Win32 using Microsoft's "nmake":
build "register.c" in the top-level Makefile;

	set path in "config.nmake" to include the Cygwin directory for
	tools - those tools are needed to build "register.c";

	remove constructed source files, and some additional object
	files, when doing "nmake clean".

svn path=/trunk/; revision=1896
2000-04-29 07:35:07 +00:00
Gilbert Ramirez ed237c129d Build tethereal and editcap on Win32.
Add RCS ID tags to Makefile.nmake's.

svn path=/trunk/; revision=1836
2000-04-12 21:52:11 +00:00
Guy Harris 22ec050ed8 Add "dissector_add()" to the list of routines exported to plugins via
the Big Function Pointer Table.

svn path=/trunk/; revision=1797
2000-04-04 21:46:29 +00:00
Guy Harris 9a564888ab Add "clean" rules in subdirectories, and run subdirectory "nmake -f
Makefile.nmake clean" when "nmake -f Makefile.nmake clean" is done in
the top-level directory, so that "nmake -f Makefile.nmake clean" cleans
everything up.

svn path=/trunk/; revision=1792
2000-04-04 08:25:35 +00:00
Guy Harris eedea6fcd4 Give all the Ethereal APIs available to plugins their own function
pointers, and call the APIs by calling through the function pointers -
the old technique of using wrappers didn't work, as the underlying
function they all called no longer exists.

svn path=/trunk/; revision=1724
2000-03-15 19:09:52 +00:00
Guy Harris ff24cd97c0 Rename the local variable "pi" to "ti" in several places - "pi" is also
the name of the global variable containing packet information, and, on
platforms where dynamically-loaded code can't access global variables
and functions in the main program, we #define "pi" in plugins to be
"(*p_pi)", which causes problems even if a plugin with a local variable
named "pi" *isn't* accessing the global "pi".

svn path=/trunk/; revision=1723
2000-03-15 18:38:58 +00:00
Gilbert Ramirez f6e92a9e93 Break proto_tree_add_item_format() into multiple functions:
proto_tree_add_protocol_format()
	proto_tree_add_uint_format()
	proto_tree_add_ipxnet_format()
	proto_tree_add_ipv4_format()
	proto_tree_add_ipv6_format()
	proto_tree_add_bytes_format()
	proto_tree_add_string_format()
	proto_tree_add_ether_format()
	proto_tree_add_time_format()
	proto_tree_add_double_format()
	proto_tree_add_boolean_format()
If using GCC 2.x, we can check the print-format against the variable args
passed in. Regardless of compiler, we can now check at run-time that the
field type passed into the function corresponds to what that function
expects (FT_UINT, FT_BOOLEAN, etc.)

Note that proto_tree_add_protocol_format() does not require a value field,
since the value of a protocol is always NULL. It's more intuitive w/o the
vestigial argument.

Fixed a proto_tree_add_item_format-related bug in packet-isis-hello.c
Fixed a variable usage bug in packet-v120.c. (ett_* was used instead of hf_*)

Checked in Guy's fix for the function declearation for proto_tree_add_text()
and proto_tree_add_notext().

svn path=/trunk/; revision=1713
2000-03-12 04:48:32 +00:00
Gilbert Ramirez a3256bd288 Add config.nmake and two Makefile.nmake's to the list of deliverables.
svn path=/trunk/; revision=1690
2000-03-03 12:01:22 +00:00
Gilbert Ramirez ddfa11e870 Create a header file for every packet-*.c file. Prune the packet.h file.
This change allows you to add a new packet-*.c file and not cause a
recompilation of everything that #include's packet.h

Add the plugin_api.[ch] files ot the plugins/Makefile.am packaging list.

Add #define YY_NO_UNPUT 1 to the lex source so that the yyunput symbol
is not defined, squelching a compiler complaint when compiling the generated
C file.

svn path=/trunk/; revision=1637
2000-02-15 21:06:58 +00:00
Guy Harris 6860dae553 "proto_add_item_subtree()" returns a value; its wrapper should return
the value that the real function returns.

svn path=/trunk/; revision=1627
2000-02-12 11:24:24 +00:00
Gerald Combs 92512bb4a0 Sean Walmsley <sean.p.walmsley@Hydro.ON.CA> caught a typo in Makefile.am.
svn path=/trunk/; revision=1615
2000-02-10 22:54:50 +00:00
Gilbert Ramirez f0fdcecac6 Initialize *p_pi solely to get rid of compiler warning.
svn path=/trunk/; revision=1613
2000-02-09 19:32:28 +00:00
Gilbert Ramirez f9a8a11ef5 Integrate Ed Meaney's <emeaney@altiga.com> changes for using libpcap
from WinDump with Ethereal. We now have packet capturing on Win32. :)

svn path=/trunk/; revision=1612
2000-02-09 19:18:42 +00:00
Gilbert Ramirez 41f0a2c5e6 Update Makefiles for win32. Move local configuration to config.nmake,
have top-level Makefile.nmake call Makefile.nmake's in subdirectories.
Build plugins, and build generated source (lex, yacc). The only thing we
can't build is register.c; I need to re-work the top-level Makefile.nmake
because it lists object files, not C files, which make-reg-dotc needs.

svn path=/trunk/; revision=1608
2000-02-09 00:41:57 +00:00
Gilbert Ramirez 07a7268c83 Change "unsigned gint64" to "guint64", and add GPL header to plugin_api.[ch]
svn path=/trunk/; revision=1606
2000-02-07 17:23:53 +00:00
Gilbert Ramirez c4fa7c87df Code changes, but not Makefile changes, for enabling plugins for Win32.
svn path=/trunk/; revision=1605
2000-02-07 17:08:27 +00:00
Gilbert Ramirez 69edc78327 I finally got autoconf, automake, and the plugins to behave together.
The distro is buildable finally. I had to change "plugins/gryphon" from
a separately configured (i.e., "./configure") package to a member of
the main ethereal autoconf package so that PLUGIN_DIR could be passed
to plugins/gryphon/Makefile.am. In doing so, I had to get rid of
plugins/gryphon/config.h which had PACKAGE and VERSION #defined, the latter
of which was actually used in packet-gryphon.c. So I moved those two
#defines into a new file, plugins/gryphon/moduleinfo.h.

svn path=/trunk/; revision=1438
2000-01-08 19:37:11 +00:00
Guy Harris d6c6aecdba Add a "break;" statement to a "default:" clause - the AIX C compiler
apparently doesn't like it when a case label is the last line in a
"switch()" statement.

Fix a spelling error.

svn path=/trunk/; revision=1408
2000-01-01 21:21:20 +00:00
Guy Harris 59eb4c8a1a Filter out a few more things.
Don't filter out some things that *are* in CVS.

svn path=/trunk/; revision=1403
1999-12-31 00:22:27 +00:00
Guy Harris d1ded6c1c2 Filter out a few more things.
svn path=/trunk/; revision=1402
1999-12-31 00:18:55 +00:00
Gerald Combs 335f0b4647 Add support for "--with-plugindir=<plugin install dir>" to configure.
Make the default plugindir $(libdir)/ethereal/plugins/0.8.  Ethereal now
looks for plugins in the following directories:
  /usr/lib/ethereal/plugins/0.8
  /usr/local/lib/ethereal/plugins/0.8
  $plugindir (if different from above)
  $HOME/.ethereal/plugins

svn path=/trunk/; revision=1382
1999-12-28 04:40:24 +00:00
Gerald Combs 45babe7bb5 Integrate libtool/libltdl with the plugin code. Add libtool and libltdl
to the distribution.

svn path=/trunk/; revision=1379
1999-12-26 22:38:07 +00:00
Gilbert Ramirez b906ce0a17 Add Dearborn Group Technology's Gryphon dissector as our first
shipped plugin.

svn path=/trunk/; revision=1341
1999-12-15 06:53:36 +00:00