Commit Graph

87 Commits

Author SHA1 Message Date
Guy Harris 0ccf418724 Add a "get_addr_name()" routine that takes an "address *" and attempts
to resolve it to a name.

Fix up some const-pointer-to-non-const-pointer, and
function-pointer-to-void-*, conversions.

Fix some comments.

svn path=/trunk/; revision=12863
2004-12-30 02:10:24 +00:00
Guy Harris f23f4ecf04 Use _WIN32 rather than WIN32 to determine if we're compiling on Win32;
according to Gisle Vanem, WIN32 isn't a built-in in MSVC, but _WIN32 is.

svn path=/trunk/; revision=11972
2004-09-11 23:03:36 +00:00
Guy Harris fe3b7d73ed Move the base-64 routines to "epan/base64.c".
svn path=/trunk/; revision=11960
2004-09-10 23:16:00 +00:00
Guy Harris ac982aa7a5 Move the stuff to handle ASCII <-> EBCDIC conversions to
"epan/charsets.c"; other character set translation code should perhaps
go there as well.

svn path=/trunk/; revision=11958
2004-09-10 22:59:37 +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
Jörg Mayer 021f72021e Fix automagically generated filters in case of remote login via IPv6.
This fix was picked from the source rpm of Suse 9.1.

svn path=/trunk/; revision=11234
2004-06-25 07:00:54 +00:00
Guy Harris 4934457275 Fix the other place where we construct temporary path names to use
G_DIR_SEPARATOR and G_DIR_SEPARATOR_S, to get rid of one more
horse-frightening pathname.

svn path=/trunk/; revision=10955
2004-05-22 07:50:15 +00:00
Olivier Biot 4ee7c7faf6 As noted by Thomas Anders, the Heimdal libroken library has a base64_decode()
function with a different signature than the one defined in util.c/util.h.
For this reason, we need to rename our base64_decode() routine.

The routine is now called epan_base64_decode().

svn path=/trunk/; revision=10840
2004-05-10 22:20:24 +00:00
Gerald Combs 6687b152f1 Don't automatically set a capture filter if DISPLAY or REMOTEHOST are
"localhost" or "127.0.0.1".

svn path=/trunk/; revision=10365
2004-03-12 17:23:56 +00:00
Guy Harris 6d2f9e38dd Use G_DIR_SEPARATOR_S rather than "/" as the pathname separator when
constructing the pathname of a temporary file, so as not to frighten the
horses when they see an error message for a temporary capture file.

svn path=/trunk/; revision=10002
2004-02-07 04:25:16 +00:00
Guy Harris b97626862e Rename DISSECTOR_HELPER_{SRC,OBJECTS} to
DISSECTOR_SUPPORT_{SRC,OBJECTS}.

Add some additional files, required by dissectors, to those lists.

Extract the stuff to get version information strings for libraries and
the OS, which is *not* needed by dissectors, from "util.c", which
contains routines that *are* needed by dissectors, and put it into a
separate file.

Make "dftest" link only with the dissector support stuff, not with all
of the Ethereal common files.

svn path=/trunk/; revision=9645
2004-01-11 22:17:43 +00:00
Ulf Lamping 3b77bfee59 removed some MSVC warnings (moved pcap.h before glib.h)
svn path=/trunk/; revision=9393
2003-12-21 12:19:39 +00:00
Gilbert Ramirez 55a6251e7c From Olivier Biot
New "matches" operater in display filter language. Uses PCRE.

If a "matches" operator is found in a dfilter
while libpcre has not been used to build the binary, then an
exception is thrown after using dfilter_fail() to set an apporporiate
error message.

svn path=/trunk/; revision=9182
2003-12-06 16:35:20 +00:00
Gerald Combs 4306925479 Don't automatically fill in a capture filter if CLIENTNAME is set to
"Console".

svn path=/trunk/; revision=9130
2003-12-01 20:27:09 +00:00
Gerald Combs fee0d98c18 Check the environment variables SSH_CONNECTION, SSH_CLIENT, REMOTEHOST,
DISPLAY, and CLIENTNAME (in that order).  If any of them are set, create
a capture filter that excludes their traffic and set it as the default.
The longer filters should be efficient without being overly long; they
may need some tweaking.

svn path=/trunk/; revision=8994
2003-11-18 04:16:28 +00:00
Gerald Combs 031db8b9c8 From Gisle Vanem:
* Added a new function get_file_in_temp() to
  epan/filesystem.c. This because of asn1.dll plugin which
  had code to write to a log-file "c:\temp\ethereal.log". I feel
  this patch makes this safer; I don't even have a c:\temp dir.

* Patched packet-asn1.c to use get_file_in_temp().

* Added some #undef to packet-snmp.c to silence gcc.

* Changed "%u" -> "%lu" formats in util.c

Rename get_file_in_temp() to get_tempfile_path() to match other function
names.

svn path=/trunk/; revision=8859
2003-11-02 23:12:35 +00:00
Guy Harris 4c858d1ae7 Include <windows.h> so that OSVERSIONINFO and the like are defined on
Windows.

svn path=/trunk/; revision=8841
2003-10-31 07:57:22 +00:00
Guy Harris 8e51328bc2 Get the version number of the libpcap/WinPcap with which we're running
with "pcap_lib_version()", if available.

svn path=/trunk/; revision=8656
2003-10-10 06:05:48 +00:00
Guy Harris 8649fcf232 From Gisle Vanem: MingW declares "rint()" in <math.h> and defines it in
a library, and declares "mode_t" in <sys/types.h>.

svn path=/trunk/; revision=8185
2003-08-18 18:41:25 +00:00
Guy Harris 48b1ab757e From smhuang [AT] pcs.csie.nctu.edu.tw: fix a "g_string_append()" call.
svn path=/trunk/; revision=8014
2003-07-11 06:46:00 +00:00
Guy Harris 7ca62c9ece Fixes to get it to compile on Win32.
svn path=/trunk/; revision=7878
2003-06-13 22:22:48 +00:00
Guy Harris 626b7e21ea On Win32, say "without WinPcap" rather than "without libpcap" (although
it's unlikely that somebody would build without WinPcap - they'd
currently have to manually tweak config.h.win32; we can do the same
trick there that we do with ADNS).

svn path=/trunk/; revision=7877
2003-06-13 20:40:31 +00:00
Guy Harris 31d4df4a8f Do run-time word-wrapping on the "Compiled with" message, rather than
wiring the line boundaries in.

On Win32, say "with WinPcap" rather than "with libpcap", and report both
on whether we were compiled with WinPcap and whether we were able to
load WinPcap.

svn path=/trunk/; revision=7876
2003-06-13 20:03:50 +00:00
Guy Harris 896eee275d Put in a missing comma.
svn path=/trunk/; revision=7869
2003-06-13 03:43:44 +00:00
Gerald Combs 34f3a83862 Add ADNS to the "Compiled with" list. Wrap at the SNMP library part since
the line was getting long.

svn path=/trunk/; revision=7747
2003-05-26 22:55:43 +00:00
Tim Potter d3913cfdb1 Move the base64_decode() function somewhere where other dissectors can
use it.

svn path=/trunk/; revision=7723
2003-05-23 05:25:19 +00:00
Guy Harris ab84d8be6e Change the version messages to put the "compiled with" stuff on a
separate line, and to put the "running with" info on a separate line
from that, to make the output narrower.

svn path=/trunk/; revision=7344
2003-03-12 00:07:46 +00:00
Guy Harris 4d46ba0a27 If we have <windows.h>, we need to include it to declare OSVERSIONINFO.
Fix some typos.

Put the build number after the "szCSDVersion" value; on NT, that makes
it show up as "Windows {NT x.y,2000,XP,etc.} Service Pack N, build N",
and on OT, it might make it show up as "Windows {95,98,Me} X, build N",
where "X" might be "A" or "B" or something such as that.  (We might want
to omit the space before "szCSDVersion" on Windows OT - I think the
"right" name might be something like "Windows 95B", but I'm not sure.)

svn path=/trunk/; revision=7324
2003-03-08 11:15:49 +00:00
Guy Harris 170b5028e9 Put the code to get version numbers of various libraries with which
Ethereal/Tethereal was linked into a common routine, and use that in
both Ethereal and Tethereal.

Add to that routine code to get OS version information.

svn path=/trunk/; revision=7320
2003-03-08 07:00:48 +00:00
Jörg Mayer 7c4176d868 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=6117
2002-08-28 21:04:11 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Gilbert Ramirez e937593bb8 More static-ization. In util.c, I commented out the ASCII-to-EBCDIC
functions, until that time that we need them.

svn path=/trunk/; revision=5130
2002-04-08 20:23:55 +00:00
Guy Harris 40b22f317b Wrap calls to "pcap_datalink()" in a routine that attempts to compensate
for AIX 5.x's non-standard libpcap, where "pcap_datalink()" doesn't
return DLT_ values, it returns RFC 1573 ifType values.

Put that wrapper, and the routine to get the interface list, in a
separate file, for packet-capture utility routines, so not everybody who
includes "util.h" needs to include <pcap.h>.

Fix up the Wiretap hack for dealing with said incompatibility to use the
correct ifType value for Token Ring.

svn path=/trunk/; revision=4184
2001-11-09 07:44:51 +00:00
Gilbert Ramirez 6de396c4a8 Fix the rest of the signed/unsigned comparison warnings.
svn path=/trunk/; revision=4088
2001-10-26 18:28:17 +00:00
Guy Harris 9d601c6799 On Windows, use the directory in which the binary resides as the
directory in which global data files are stored.  If an installed binary
is being run, that's the correct directory for them; if a build-tree
binary is being run, the "manuf" file will be there, and you can put
other data files there as well, if necessary.

Do the same with plugins, except that, if there's no
"plugins\\{version}" subdirectory of that directory, fall back on the
default installation directory, so you at least have a place where you
can put plugins for use by build-tree binaries.  (Should we, instead,
have the Windows build procedure create a subdirectory of the "plugins"
source directory, with the plugin version number as its name, and copy
the plugins there, so you'd use the build-tree plugin binaries?)

Move "test_for_directory()" out of "util.c" and into
"epan/filesystem.c", with the other file system access portability
wrappers and convenience routines.  Fix "util.h" not to declare it - or
other routines moved to "epan/filesystem.c" a while ago.

svn path=/trunk/; revision=3858
2001-08-21 06:39:18 +00:00
Guy Harris 65dc469326 "get_home_dir()", in "epan/filesystem.c", uses
"find_last_pathname_separator()" on Win32; move the other pathname
manipulation routines from "util.c" into "epan/filesystem.c".

Remove from "util.h" the declarations of routines not defined in
"util.c", and put them into "epan/filesystem.h" if they're not already
there.

Adjust #includes to make the above work.

svn path=/trunk/; revision=3241
2001-04-02 09:53:46 +00:00
Guy Harris 5a4106db5c Throw in a cast to squelch a complaint from Visual C++ 6.0.
svn path=/trunk/; revision=3157
2001-03-22 06:14:27 +00:00
Guy Harris 00fcdc0900 There's no need for a member of a "capture_file" structure holding a
compiled capture filter program, so remove it, and remove the include of
<pcap.h> from "file.h"; instead, have local "struct bpf_program"
structures where needed, and have those files that need stuff from
<pcap.h> include it.

This cleans stuff up a bit, and should eliminate a pile of compile
warnings with Visual C++ due to <pcap.h> and some GTK+/GLib header file
(or files they include) both defining "inline".

svn path=/trunk/; revision=2954
2001-01-28 23:56:29 +00:00
Guy Harris 2536d27ed3 On Linux, try to open the "any" device and, if we can open it, add it to
the end of the list of interfaces on which you can capture.

svn path=/trunk/; revision=2774
2000-12-23 19:50:36 +00:00
Guy Harris faf70584f2 Fix it to build on Windows.
svn path=/trunk/; revision=2488
2000-10-11 07:35:02 +00:00
Gilbert Ramirez 9d9850f209 More EPAN-related code movements. Get rid of usage of #include "globals.h"
and #include "util.h" from epan code. Move get_home_dir() into epan/filesystem.c
as it's used by plugins.c.

svn path=/trunk/; revision=2461
2000-09-28 03:16:29 +00:00
Guy Harris d0caa40dec libpcap unconditionally includes <net/if.h> on UNIX systems, as that is,
as far as I know, the only way to get IFF_UP, IFF_LOOPBACK, "struct
ifreq", and "struct ifconf" defined, and those are required in order to
get, via SIOCGIFCONF, the interface list, and to exclude interfaces that
aren't up and handle loopback interfaces differently from other
interfaces.

If we're on UNIX and have libpcap, we should do the same; that way, if
the system doesn't have <net/if.h> installed, the compile will fail with
an "I can't find <net/if.h>" error, rather than the configure indicating
that <net/if.h> can't be found, causing "util.c" not to include it,
causing it to fail with complaints about IFF_UP, IFF_LOOPBACK, and
various structures not being defined - the former tells you the root
cause, the latter doesn't.

svn path=/trunk/; revision=2442
2000-09-17 03:20:05 +00:00
Guy Harris 332d5715e8 Compute and display negative relative and delta time stamps correctly,
just in case time goes backwards (yes, it sometimes does happen in
captures).

svn path=/trunk/; revision=2407
2000-09-10 06:44:39 +00:00
Guy Harris a708cd140f Always use "g_free()" to free "ifc.ifc_buf"; it's set to a value
allocated by "g_malloc()", and one should always use "g_free()" to free
stuff allocated with "g_malloc()" (using "free()" works if GLib isn't
compiled with any special memory allocator debugging/profiling options,
but doesn't work if it is compiled with those options).

svn path=/trunk/; revision=2393
2000-09-07 09:57:39 +00:00
Uwe Girlich 3ab7bc9761 The interface list will now be get into an dynamic growing buffer and not
the (too big) buffer for 1024 network cards.
The code comes directly after the ideas in Steven's book (UNIX network
programming).

svn path=/trunk/; revision=2385
2000-08-31 11:12:19 +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
Guy Harris 3d20d56999 Add a routine to check whether a file is a directory or not.
To test whether a file the user selected to be opened from the file
selection box is really a directory (so that we can point the file
selection box at it, rather than trying to open the directory as a
capture file, which wouldn't work), use the routine in question.

To make the GTK+ file selection box start out in the last directory from
which we opened a file, use "gtk_file_selection_complete()", rather than
"chdir()"ing to that directory.

Those changes keep us from "chdir()"ing all over the place; that way, if
Ethereal dumps core, the core dump shows up in the directory from which
it was run, rather than in the directory from which you last opened or
into which you last saved a file.

svn path=/trunk/; revision=2190
2000-07-31 04:53:40 +00:00
Guy Harris f6b5d7b8b5 Paul Welchinski's changes to, on Win32 systems:
properly handle ASCII vs. Unicode in the list of interfaces;

	initialize Winsock before starting a capture, so that the code
	in the Win32 libpcap to get the IP address and netmask by
	translating the host name to an IP address works.

svn path=/trunk/; revision=1737
2000-03-21 06:52:13 +00:00
Guy Harris 71ff1d98f1 On Windows, when getting the user's home directory, don't look at the
HOME environment variable; instead, look at HOMEDRIVE and HOMEPATH.

svn path=/trunk/; revision=1718
2000-03-14 08:26:19 +00:00