aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
AgeCommit message (Collapse)AuthorFilesLines
2000-03-21Paul Welchinski's changes to, on Win32 systems:Guy Harris1-14/+35
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-14On Windows, when getting the user's home directory, don't look at theGuy Harris1-18/+56
HOME environment variable; instead, look at HOMEDRIVE and HOMEPATH. svn path=/trunk/; revision=1718
2000-02-22In Tethereal, allow capture filters and read filters either to beGuy Harris1-1/+41
specifies with "-f" and "-R" flags, respectively, or specified with non-flag command-line arguments, as tcpdump and snoop allow. svn path=/trunk/; revision=1663
2000-02-09Integrate Ed Meaney's <emeaney@altiga.com> changes for using libpcapGilbert Ramirez1-1/+29
from WinDump with Ethereal. We now have packet capturing on Win32. :) svn path=/trunk/; revision=1612
2000-01-31Add a semicolon in a win32 block of code.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=1587
2000-01-29Just pass the return value of "getuid()" directly on to "getpwuid()";Guy Harris1-4/+2
don't stuff it into a variable. svn path=/trunk/; revision=1582
2000-01-29Fix #ifndef line whose symbol had been omitted.Guy Harris1-2/+2
svn path=/trunk/; revision=1581
2000-01-29Don't put "get_home_dir()" inside #ifdef HAVE_LIBPCAP/#endif.Guy Harris1-10/+26
On UNIX, if "$HOME" isn't set, try getting the user ID and the password entry for that user ID, and, if that succeeds, get the home directory from the password entry, otherwise use "/tmp". On NT, it may be possible to do something similar (get the user name, and append that to "C:\winnt\profiles\"); I'm not sure whether there's anything that can be done on Windows 9x. svn path=/trunk/; revision=1580
2000-01-29Remove instances of getenv("HOME") and provide a get_home_dir() functionGilbert Ramirez1-1/+30
which provides a default value if "HOME" is not set. svn path=/trunk/; revision=1579
2000-01-26In Win32, treat both '/' and '\' as pathname separators.Guy Harris1-8/+16
svn path=/trunk/; revision=1566
2000-01-25Provide a "get_dirname()" routine, that takes a pathname and returnsGuy Harris1-8/+54
either a pointer to the directory part of the pathname (after stomping on the pathname separator with a '\0', so don't use this on pathnames you plan to use afterwards), or NULL if the pathname contains no directory part, and make it handle Win32 pathnames on Win32 systems. Use it to get the containing directory of the currently open file, so that the "chdir()" stuff we do to cause the "File:Open" dialog box to show you files in the directory in which you last looked works on Win32 systems. svn path=/trunk/; revision=1555
2000-01-25Encapsulate the code to take a pointer to a pathname and return aGuy Harris1-1/+38
pointer to the name of the file to which it refers (i.e., to the last component of the pathname) in a "get_basename()" routine, and have the code in "file.c" call it. svn path=/trunk/; revision=1552
2000-01-16Move the routine to get a list of the network interfaces on the systemGuy Harris1-1/+209
to "util.c", and provide a routine to free that list as well. When picking an interface on which to do a capture (if no "-i" flag was specified), use that routine, and pick the first interface on the list. svn path=/trunk/; revision=1495
2000-01-15Merge in the final code to make Ethereal run on Win32, compiledGilbert Ramirez1-1/+5
with MSVC 6.0 and 'nmake', the make tool that comes with MSVC. It compiles, links, and runs. It doesn't run correctly. There's a problem when reading files. I'm getting short reads. I'm not linking in zlib or libsnmp because it first needs to be debugged. I changed the plugin code to use gmodule instead of libltdl, but the Unix build still links ethereal against libltdl. I'll fix that tonight; sorry about leaving it in such a sad state, but I wanted to check in this code before I left work on a Friday night. Ethereal still works, but the building is less than optimal. svn path=/trunk/; revision=1479
2000-01-10Some initial changes for win32 support, but not all.Gilbert Ramirez1-1/+6
Added lots of #ifdef HAVE_*_H wrappers. Added some #defines in config.h.win32 Check for more headers in configure.in Added prototype for inet_aton() in inet_v6defs.h. Changed "BYTE" token (i.e., #define) in ascend-gramamr.y because it conflicts with a windows definition. Use HEXBYTE instead. svn path=/trunk/; revision=1448
1999-12-09Move the GTK+ implementations of various UI utilities out of "util.c"Guy Harris1-131/+1
into "gtk/ui_util.c", and move the declarations of those UI utilities out of "util.h" into "ui_util.h". (The header file is in the top-level directory, rather than the "gtk" directory, because it declares window-system-independent interfaces to routines with window-system-dependent implementations.) Add to "gtk/ui_util.c" a routine to set the window and icon title. Use that routine to make the title of an Ethereal top-level window be {filename} - Ethereal if there's a capture open, and have "{filename}" be "<capture>" if it's a temporary capture file. svn path=/trunk/; revision=1255
1999-11-22A "character encoding" variable is now set per packet. The existenceGilbert Ramirez1-71/+83
of SNA in a packet changes the character encoding from the default ASCII to EBCDIC. The hex-printing routines in the GUI code and in the printing code convert to EBCDIC if appropriate. svn path=/trunk/; revision=1089
1999-10-19Add ASCII/EBCDIC conversion to TCP Follow window. Also add Close buttonGilbert Ramirez1-1/+101
for ease-of-use with window managers w/o "destroy" buttons (twm). svn path=/trunk/; revision=884
1999-09-24In "try_tempfile()", if the buffer is too short for the temporary fileGuy Harris1-1/+5
name, stuff as much of the name as will fit into the buffer before returning an error, so the error message that gets displayed isn't completely mangled. svn path=/trunk/; revision=716
1999-09-23Fix the calculation of the temporary file name length inGuy Harris1-2/+2
"try_tempfile()" - the first component of the name comes from the "dir" argument, so use its length, not the length of the string in the buffer it should fill in (said buffer may contain garbage, which may not *be* a C string). svn path=/trunk/; revision=705
1999-08-23The Single UNIX Specification doesn't say that "mkstemp()" creates theGuy Harris1-2/+22
temporary file with mode rw-------, so we won't assume that all UNIXes will do so; instead, we set the umask to 0077 to take away all group and other permissions, attempt to create the file, and then put the umask back (puts into "try_tempfile()", called by "create_tempfile()" to create temporary files, the "umask()" calls that Gilbert put into "capture.c" to deal with the same problem). svn path=/trunk/; revision=553
1999-08-18Small change to create_tempfile, initializing static vars.Gilbert Ramirez1-7/+8
svn path=/trunk/; revision=511
1999-08-18Make a "create_tempfile()" routine that constructs the template to beGuy Harris1-1/+87
used by "mkstemp()" into a buffer supplied as an argument, trying several directories for the tempfile, in the same fashion that the BSD (and probably other) "tempnam()" routines do. Have that routine cope with temporary-file directory names that don't end with "/", as "P_tmpdir" doesn't necessarily end with "/" (and doesn't, in GNU "libc" 2.x, at least on Linux); thanks to Gilbert Ramirez for catching this one, and supplying the code to cope with that. Have the code that creates the temporary file for the "Follow TCP Stream" text use it. svn path=/trunk/; revision=507
1999-07-09Added the ability to create a read-only ethereal, i.e., one thatGilbert Ramirez1-2/+2
doesn't link with libpcap, so no packet captures can be made. The "--disable-pcap" option has been added to the configure script. Docs have been updated. And the string buffer size in the simple_dialog() has been doubled so that Johan's e-mail address in the "About" dialogue window doesn't get chopped off. svn path=/trunk/; revision=351
1999-06-12Improve the alert boxes put up for file open/read/write errors. (SomeGuy Harris1-70/+1
influence came from http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-232.html which has a section on dialog box and alert box messages. However, we're largely dealing with technoids, not with The Rest Of Us, so I didn't go as far as one perhaps should.) Unfortunately, it looks like it's a bit more work to arrange that, if you give a bad file name to the "-r" flag, the dialog box pop up only *after* the main window pops up - it has the annoying habit of popping up *before* the main window pops up, and sometimes getting *obscured* by it, when I do that. The removal of the dialog box stuff from "load_cap_file()" was intended to facilitate that work. (It might also be nice if, when an open from the "File/Open" menu item fails, we keep the file selection box open, and give the user a chance to correct typos, choose another file name, etc.) svn path=/trunk/; revision=310
1999-04-06Capturing packets from ethereal now saves the capture in an "anonymous" ↵Gilbert Ramirez1-1/+78
buffer. That is, it's a random name chosen by tempnam(), unknown to the user. If the user decides to save that trace, he then uses File | Save to save it to a file. File | Save As lets him make a copy of his named trace file as well. I also updated my e-mail address in the various credit locations. svn path=/trunk/; revision=242
1999-04-05Get rid of include of <strings.h> from "util.c", as it's not needed, andGuy Harris1-2/+1
change include of <strings.h> in "menu.c" to include <string.h>, the latter being the ANSI standard include file for string functions; that eliminates all use of <strings.h< so get rid of test for its existence in "configure.in" as well. svn path=/trunk/; revision=239
1999-03-31Move the bitfield-decoding routines to "packet.h", along with otherGuy Harris1-86/+1
helper routines for packet dissecting, and away from "util.c", which is now all GUI-related. (Among other things, this makes life more pleasant for Gilbert Ramirez's "tethereal" stuff, although a lot more separation of GUI from other stuff needs to be done to make that - or a "curses"-based variant of Ethereal, or a variant using some other GUI toolkit - work smoothly.) svn path=/trunk/; revision=235
1999-03-23Removed all references to gtk objects from packet*.[ch] files. They nowGilbert Ramirez1-2/+4
reference the protocol tree with struct proto_tree and struct proto_item objects. That way, the packet decoding source code file can be used with non-gtk packet decoders, like a curses-based ethereal, e.g. I also re-arranged some of the information in packet.h to more appropriate places (like other packet-*.[ch] files). svn path=/trunk/; revision=223
1999-01-01Added #include <sys/types.h> for compilation under gtk-1.1.11Gilbert Ramirez1-1/+5
svn path=/trunk/; revision=144
1998-12-29* Added Joerg Mayer's Vines patchGerald Combs1-1/+82
* Added Joerg to the AUTHORS file * Added Guy's bitfield decode patch * Fixed time output svn path=/trunk/; revision=142
1998-12-22Stopped the "TCP Follow" screen from producing an error when usingGilbert Ramirez1-1/+2
wiretap and gtk+-1.1.x. I also added an #include to util.c to keep it from complaining about a lack of a definition of vsnprintf when compiling with gtk+-1.1.x. svn path=/trunk/; revision=136
1998-10-28* Aligned the icon with the top edge of the dialog.Gerald Combs1-9/+9
svn path=/trunk/; revision=74
1998-10-16* Copied in the correct GNU license (I'm such a goober)Gerald Combs1-5/+23
* Hacks to the filter interface (Gerald) * About box (Laurent) * AppleTalk support (Simon) * Mods to the match_strval routine (Gerald) svn path=/trunk/; revision=61
1998-10-13Squelch a number of "-Wall" errors by:Guy Harris1-1/+10
1) renaming "snprintf.h" to "snprintf-imp.h" (it contains stuff used by the "snprintf()" *implementation*, but not stuff it *exports*); 2) creating a new "snprintf.h" to declare "vsnprintf()" and "snprintf()"; 3) removing an unused variable; 4) fixing a call to "add_item_to_tree()" to handle the possibility of "ntohl()" returning a "long" rather than an "int". svn path=/trunk/; revision=47
1998-10-12- Added match_strval function to packet.cGerald Combs1-2/+12
- Separated display and capture filters; rearranged some of the look and feel - Lots of other miscellaneous fixes and updates svn path=/trunk/; revision=38
1998-09-27Merged in a _huge_ patch from Guy Harris. It adds a time stap column,Gerald Combs1-1/+3
generalizes the column printing code, adds a "frame" tree item to the tree view, and fixes a bunch of miscellaneous coding bugs. svn path=/trunk/; revision=31
1998-09-16Added ID tags to the beginning of each source file.Gerald Combs1-0/+2
svn path=/trunk/; revision=7
1998-09-16Initial revisionGerald Combs1-0/+125
svn path=/trunk/; revision=2