Commit Graph

125 Commits

Author SHA1 Message Date
Guy Harris 2929c93ea2 When reporting "sorry, *this* packet can't be written to a file of that
type" when writing out a capture file (i.e., writing a
per-packet-encapsulation capture to a file type that supports it but
doesn't support one of the packet's encapsulations), report the packet
number and, when doing this in a merge operation, report the file from
which it came.

When reporting "sorry, that file can't be written to a file of that
type, period", show the file type rather than the input file link-layer
type that causes the problem.  (We could show both.  We could be
*really* ambitious and iterate through all possible file types and show
the ones that will or at least might work....)

file_write_error_message() is documented as handling only UNIX-style
errnos, and libwireshark should be usable without libwiretap, so leave
it up to its callers to handle Wiretap errors such as
WTAP_ERR_SHORT_WRITE.

Clean up indentation.

svn path=/trunk/; revision=39949
2011-11-19 20:18:01 +00:00
Stig Bjørlykke e0c689dc03 Check for NULL pointer in file_exists().
svn path=/trunk/; revision=39318
2011-10-09 09:54:48 +00:00
Bill Meier 16f162eb5d Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

Convert '4 space tabs' to spaces;

svn path=/trunk/; revision=39078
2011-09-21 17:14:14 +00:00
Guy Harris da2d6c8d77 If we're running from the build directory, check the WIRESHARK_SRC_DIR
environment variable, and, if it's set, use it rather than the build
directory as the data file directory.  This is to handle
out-of-source-tree builds.

svn path=/trunk/; revision=38832
2011-09-01 02:35:46 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +00:00
Jeff Morriss 5a2a122942 Don't put a 65536 byte variable on the stack: instead, malloc/free it.
Coverity 760-761.

svn path=/trunk/; revision=36404
2011-03-29 21:39:15 +00:00
Stig Bjørlykke 03941b54ed Fixed second parameter to create_persconffile_profile.
svn path=/trunk/; revision=36291
2011-03-23 14:58:34 +00:00
Stig Bjørlykke 714c8c52b9 Ensure we create the "Default" personal configuration files directory before
creating a new profile.  This fixes a bug when trying to create a new profile
from a newly installed wireshark with no saved preferences.

svn path=/trunk/; revision=36290
2011-03-23 14:52:39 +00:00
Stig Bjørlykke d188988e83 Added functionality for handling global profiles.
Global profiles can be installed in a "profiles" directory in the
Global configuration directory, and a global profile will be copied
to the users profiles on first time usage.

svn path=/trunk/; revision=36077
2011-02-26 17:23:24 +00:00
Bill Meier 7f0107220d Fix various instances of "unreachable code".
svn path=/trunk/; revision=35713
2011-01-30 23:27:57 +00:00
Jeff Morriss ad47f04c94 Move getenv_utf8() to wsutil.
svn path=/trunk/; revision=35148
2010-12-07 20:24:57 +00:00
Gerald Combs 05c7f620e8 Use g_path_get_dirname in init_progfile_dir on Windows. Leave the
non-Windows code alone since it needs to check for a libtool-ized path.

svn path=/trunk/; revision=35012
2010-11-22 21:05:55 +00:00
Stig Bjørlykke 98f6aa9311 Add a new right-click popup menu for the statusbar profiles for easy functions
to create new, copy, delete and rename configuration profiles.

svn path=/trunk/; revision=34312
2010-10-01 16:29:37 +00:00
Gerald Combs 607b228df6 Add ws_load_library and ws_module_open, which respectively call
LoadLibrary and g_module_open only for the program directory and system
directory on Windows. Use them to replace a bunch of LoadLibrary and
g_module_open calls. Use the extension ".dll" for all the DLLs that we
load. Add comments about DLL loading in Python.

svn path=/trunk/; revision=33924
2010-08-25 20:30:59 +00:00
Anders Broman 26274eb701 From Cal Turney:
Remember folder of capture selected from Welcome screen file dialog.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5038

svn path=/trunk/; revision=33758
2010-08-10 11:36:18 +00:00
Guy Harris d4cc16d4a1 Handle WTAP_ERR_SHORT_WRITE in file_write_error_message().
In eo_save_entry(), don't assume you can write the entire object in a
single write call - if the object is big enough (which would require a
64-bit address space), and you're not lucky enough to be running on
UN*X (which means LP64, so size_t and ssize_t are big enough for the
entire object), you can't.

svn path=/trunk/; revision=33231
2010-06-16 01:30:29 +00:00
Guy Harris ba5564f32e Squelch some compiler warnings, clean up indentation, clean up a
comment.

svn path=/trunk/; revision=32076
2010-03-02 00:06:20 +00:00
Stig Bjørlykke 2ab6b0f8eb Small rewrite for glib < 2.14 to make it work more than once.
svn path=/trunk/; revision=31340
2009-12-21 17:39:37 +00:00
Stig Bjørlykke 1925a4f5eb Make copy_persconffile_profile work with glib < 2.14.
svn path=/trunk/; revision=31339
2009-12-21 17:28:47 +00:00
Stig Bjørlykke fe793ed781 Added Copy Profile functionality.
svn path=/trunk/; revision=31335
2009-12-21 12:32:31 +00:00
Stig Bjørlykke 3a5c9ec3b2 Load lua scripts in the plugins directory, both global and personal.
List loaded lua scripts in Help->About->Plugins.

svn path=/trunk/; revision=30675
2009-10-23 17:52:18 +00:00
Kovarththanan Rajaratnam 94ff940129 GetModuleFileName expects the size of the passed buffer to be expressed in TCHAR. We currently pass the size expressed in bytes. In other words, we incorrectly state that the buffer is twice as big as it really is.
svn path=/trunk/; revision=30344
2009-10-05 18:38:50 +00:00
Stig Bjørlykke fffe2fdf23 Fixed a typo in a comment.
svn path=/trunk/; revision=28566
2009-06-01 17:28:20 +00:00
Sebastien Tandel 52cc5fb1e8 python binding for wireshark (first commit)
* ability to write dissectors with python for wireshark.
        documentation (http://wiki.wireshark.org/Python)


svn path=/trunk/; revision=28529
2009-05-29 21:10:40 +00:00
Guy Harris 2f6fe511f3 Sigh.
dladdr() in GNU libc isn't available (<dlfcn.h> doesn't define Dl_info)
unless _GNU_SOURCE is defined.

In addition, it's not guaranteed to return anything more useful than
argv[0]; just in case that changes at some point in the future, however,
we still use it, we just run it through the same machinery that we run
argv[0] through.  (On Mac OS X, for example, the path of the executable
is handed to the run-time linker by the kernel, so it *is* useful
there.)

svn path=/trunk/; revision=27821
2009-03-22 18:06:06 +00:00
Guy Harris c73ab7dff7 Change the signature of init_progfile_dir() so the casting of the
function pointer (to main) to an argument to dladdr() is done in
init_progfile_dir() rather than its callers.

svn path=/trunk/; revision=27814
2009-03-22 06:53:17 +00:00
Guy Harris 6f059e8cb7 In Solaris, the second argument to dladdr() is just a void *, not a
const void *.

svn path=/trunk/; revision=27813
2009-03-22 06:38:02 +00:00
Guy Harris 7c6e2155cc Attempt to use dladdr() to get the pathname of the executable image if
it's available and works.

svn path=/trunk/; revision=27812
2009-03-22 00:42:33 +00:00
Stig Bjørlykke 62f60df6b4 From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.

svn path=/trunk/; revision=27718
2009-03-13 22:06:48 +00:00
Guy Harris ace4af44fc Add a routine to report write errors to the list of failure-reporting
routines handled by epan/report_err.c.

Move copy_binary_file() in file.c to epan/filesystem.c, and rename it to
copy_file_binary_mode() (to clarify that it *can* copy text files;
arguably, *all* files are "binary" unless you're on, say, an IBM 1401
:-)).  Have it use the report_err.c routines, so it works in
console-mode programs.

Clean up some comments while we're at it.

svn path=/trunk/; revision=27456
2009-02-15 21:47:57 +00:00
Bill Meier b82ef98f4b Fix some indentation
svn path=/trunk/; revision=27280
2009-01-20 21:43:49 +00:00
Guy Harris d3f84a1af3 Umm, no. g_strdup() != g_strdup_printf(); the first argument to the
*former* should always be a format string, but the *only* argument to
the latter is a string to duplicate.

svn path=/trunk/; revision=27066
2008-12-20 00:12:54 +00:00
Gerald Combs 3bb0df12f5 From babi: Fix three overflows (bugs 3150 and 3151).
From me: Use a #define for the RTP analysis field name lengths.

svn path=/trunk/; revision=27064
2008-12-20 00:07:21 +00:00
Stig Bjørlykke 58e2d7a0d6 Fix some "format not a string literal and no format arguments" warnings.
svn path=/trunk/; revision=26649
2008-10-31 15:47:47 +00:00
Gerald Combs 09bf9e6946 ETH -> WS updates.
svn path=/trunk/; revision=26570
2008-10-27 04:47:57 +00:00
Bill Meier afd857957a Fix a few Emacs "file variables" to have "safe" values.
That is: indent-tabs-mode: tabs --> indent-tabs-mode: t
Also: fix a typo: set-tabs-mode --> indent-tabs-mode

svn path=/trunk/; revision=26113
2008-09-02 11:17:03 +00:00
Jeff Morriss 83f9ecf96f Move privileges.c and unicode-utils.c from epan to wsutil (so things like
capinfos and dumpcap don't need to depend on libwireshark nor directly pull
in those modules).  Because capinfos and editcap were only being linked with
privileges.c if we had plugins, this allows those programs to be linked when
someone is compiling --without-plugins.

svn path=/trunk/; revision=25640
2008-06-30 17:16:29 +00:00
Guy Harris 256552f6a3 Rename an argument to avoid collisions with a global variable name, as
noted by John Smith.

Fix indentation.

svn path=/trunk/; revision=25547
2008-06-23 20:31:21 +00:00
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
2008-05-22 15:46:27 +00:00
Stephen Fisher 726a1caaf1 - Remove GLIB1 code
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION
- Remove ws_strsplit files because we no longer need to borrow GLIB2's
  g_strsplit code for the no longer supported GLIB1 builds


svn path=/trunk/; revision=24829
2008-04-07 05:22:54 +00:00
Gerald Combs 46bcad885a Check in the OS X packaging patch from bug 2341, since I've had
confirmation that the OS X package works on at least one system
other than my laptop.

svn path=/trunk/; revision=24640
2008-03-15 18:31:52 +00:00
Jeff Morriss 9fdc3e961d get_datafile_path() and get_persconffile_path() return malloc'd memory. Note that in the comments.
svn path=/trunk/; revision=24476
2008-02-26 18:58:12 +00:00
Stig Bjørlykke b715bd28d2 Ups, fix a typo from last checkin.
svn path=/trunk/; revision=24259
2008-02-03 15:49:22 +00:00
Stig Bjørlykke 47d744b59d More rewrite of prohibited APIs (sprintf, strcpy, strcat).
svn path=/trunk/; revision=24258
2008-02-03 15:38:20 +00:00
Stig Bjørlykke 45572b611c Do not change profile if directory creation failed, and change to default
profile if existing profile was deleted.

svn path=/trunk/; revision=24208
2008-01-27 14:45:31 +00:00
Stig Bjørlykke 6a31f43f8b Always return a valid profile name from get_profile_name().
svn path=/trunk/; revision=24175
2008-01-24 17:06:22 +00:00
Jeff Morriss fdfaebccd1 Include dirent.h if we have it (to fix glib-1 compile: it needed DIR).
svn path=/trunk/; revision=24100
2008-01-15 19:39:31 +00:00
Stig Bjørlykke a2d1e9005d This patch adds support for configuration profiles, which can be used to
configure and use more than one set of preferences and configuration files.

This can be found in the "Configuration Profiles..." menu item from the Edit
menu, or by pressing Shift-Ctrl-A.  It's also possible to start wireshark
and tshark with a named profile by using the "-C ProfileName" option.
A new status pane in the main window will show the current profile.

The configuration files currently stored in the Profiles are:
- Preferences
- Capture Filters
- Display Filters
- Coloring Rules
- Disabled Protocols
- User Accessible Tables

The recent data are by design not added to the profile.

Planned future enhancements:
- make a more convenient function to switch between profiles
- add a "clone profile" button to copy an existing profile
- make the profiles list active and accept return as OK
- save users "Decode as" in the profile
- make new, clone and deletion of profiles more secure
- make some of the recent values available in the profile

This patch also fixes:
- setting default status pane sizes
- a bug setting status pane for packets when not having main lower pane.

svn path=/trunk/; revision=24089
2008-01-14 16:40:23 +00:00