Commit Graph

285 Commits

Author SHA1 Message Date
Guy Harris 9e6487f247 Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in
TShark and Wireshark as well.

Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7
Reviewed-on: https://code.wireshark.org/review/2841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-04 07:25:26 +00:00
Guy Harris 1692c520ef Include "capture-pcap-util.h" even if we don't have libpcap.
The routines to get libpcap version information just say "no pcap here"
if we don't have it, so they're called regardless of whether we were
compiled with it.

Change-Id: I4e58cce83f7c0e36aa6ef9b40ec7075732402f3b
Reviewed-on: https://code.wireshark.org/review/2800
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 09:16:39 +00:00
Guy Harris a4304de1cc Add long-option support.
That way, --help and --version, as well as -h and -v, work.

Change-Id: I095e0dcef9f6181d6fbe6337f9f33e80bc44f11a
Reviewed-on: https://code.wireshark.org/review/2790
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 02:33:52 +00:00
Guy Harris 6b3391c60a Regularize the help output of programs.
Only print to the standard output, and only give the version
information, if a "print help" command-line option is specified.
Otherwise, leave out the version information, and print to the standard
error.

Leave out the copyright information; it's extra cruft, and

	http://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html

doesn't say anything about it (and bash, at least, doesn't print it).

Change-Id: Ic5029ccf96e096453f3bd38383cc2dd355542e8a
Reviewed-on: https://code.wireshark.org/review/2789
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 02:29:54 +00:00
Guy Harris 66c342ed59 Regularize the first line of version output.
For Wireshark, say "Wireshark", not "wireshark".

For other programs, put "(Wireshark)" after the program name, as per

	http://www.gnu.org/prep/standards/html_node/_002d_002dversion.html

("If the program is a subsidiary part of a larger package, mention the
package name in parentheses, like this").

Change-Id: I68558f64cfa6ee4423e42f3d6b120633ef1b2716
Reviewed-on: https://code.wireshark.org/review/2788
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 02:03:35 +00:00
Guy Harris df5833723c Move capture_ui_utils.[ch] to libui.
Change-Id: Id0f3d4d60a1acc7aa64fd3737b8f16df5bca4e5a
Reviewed-on: https://code.wireshark.org/review/2708
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 01:36:56 +00:00
Guy Harris fe42762f23 Move some more stuff into wsutil.
Move the routines to parse numerical command-line arguments there.

Make cmdarg_err() and cmdarg_err_cont() routines in wsutil that just
call routines specified by a call to cmdarg_err_init(), and have
programs supply the appropriate routines to it.

Change-Id: Ic24fc758c0e647f4ff49eb91673529bcb9587b01
Reviewed-on: https://code.wireshark.org/review/2704
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-29 23:03:24 +00:00
Guy Harris c46329c27b Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree
checked out from Wireshark's version control system, returns a string
that includes both the Wireshark version number and an indication of
what particular VCS version was checked out, and just returns
Wireshark's version number for other builds.

Use that routine rather than manually gluing VERSION and the Git version
number together.

("vcs", not "git", just in case we do something bizarre or mercurial
some day. :-))

Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d
Reviewed-on: https://code.wireshark.org/review/2529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22 01:06:25 +00:00
Guy Harris 43443af0ac Move get_copyright_info() to wsutil.
Change-Id: I75c1c747cd2b4a9845c659636582d54b2caecf1a
Reviewed-on: https://code.wireshark.org/review/2510
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21 17:33:05 +00:00
Guy Harris 318cf8a678 Add support for dissecting non-packet records.
Add a dissector table indexed by the file type, and, for the
file-type-specific records, have the frame dissector skip the usual
pseudo-header processing, as the pseudo-header has a file-type-specific
record subtype in it, and call the dissector for that file type's
records.

Change-Id: Ibe97cf6340ffb0dabc08f355891bc346391b91f9
Reviewed-on: https://code.wireshark.org/review/1782
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-25 00:05:07 +00:00
Guy Harris a1b1c8bed5 Revert "Refactor Wiretap"
This reverts commit 1abeb277f5.

This isn't building, and looks as if it requires significant work to fix.

Change-Id: I622b1bb243e353e874883a302ab419532b7601f2
Reviewed-on: https://code.wireshark.org/review/1568
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09 05:21:01 +00:00
Michael Mann 1abeb277f5 Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality.

The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes.

bug:9607
Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-on: https://code.wireshark.org/review/1485
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-09 03:04:39 +00:00
Guy Harris cb16dff992 Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it.  Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.

Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.

Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 22:27:22 +00:00
Hadriel Kaplan d1873dbcc8 Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'
There's a relatively new feature in 1.11.3 to select a specific file format
reader, instead of relying on magics or heuristics. If you select a file
reader and open a file, open it, and then click the reload-file button or go
to View->Reload or press the ctrl-R keymap, the file is reloaded but using the
magic/heuristics again instead of the file format reader you previously chose.
Likewise, the Lua relaod() function has the same issue (which is how I found
this problem).

I have tested this change by hand, using a Lua script, but I didn't add it
to the testsuite because I need another change for my test script to work
correctly. (an enhancement rather than a bug fix, which I'll submit separately)

Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01
Reviewed-on: https://code.wireshark.org/review/764
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21 17:51:45 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Gerald Combs f966980937 Replace "svn" with "git" all over the place.
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate.
Rename "svnversion.h" to "version.h" as Evan suggested. Update some
URLs. In make-version.pl, make sure we don't set an improper upstream
branch name. Use the number of commits + short hash from `git describe`
for package names by default.

Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96
Reviewed-on: https://code.wireshark.org/review/139
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-07 23:03:03 +00:00
Michael Mann 7ec4582b4f Add FT_SYSTEM_ID type and convert the dissectors that use print_system_id with FT_BYTES to now use FT_SYSTEM_ID type.
svn path=/trunk/; revision=54383
2013-12-23 15:18:48 +00:00
Jakub Zawadzki c67d38cf15 Rename base_display_* to field_display
This is preparation to support ->display for FT_STRING values.

svn path=/trunk/; revision=53820
2013-12-07 10:41:42 +00:00
Guy Harris 125a17f8e5 Initialize the error-reporting routines before scanning for plugins, as
the code to scan for them uses those routines.

This means epan_init() no longer takes those routines as arguments -
which is just as well, given that the mechanism in question is no longer
part of libwireshark, but is part of libwsutil.

This should fix bug 9508.

svn path=/trunk/; revision=53796
2013-12-05 09:30:22 +00:00
Guy Harris 0cc1545d05 Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins.  Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.

In particular applications, only process the relevant plugin types.

Add a Makefile.common to the codecs directory.

svn path=/trunk/; revision=53710
2013-12-02 08:30:29 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Jakub Zawadzki 12d1509aa1 Move struct _ftype_t + callback typedefs + free macro to ftypes-int.h
svn path=/trunk/; revision=53223
2013-11-10 13:14:09 +00:00
Guy Harris 853da2eb9b The "file types" we have are actually combinations of types and
subtypes, e.g. Network Monitor version 1 and Network Monitor version 2
are separate "file types", even though they both come from Network
Monitor.

Rename various functions, #defines, and variables appropriately.

svn path=/trunk/; revision=53166
2013-11-08 09:53:01 +00:00
Guy Harris 2a088c1d53 Add support for displaying dates as year and day-of-year (1-origin).
In the process, fix various man page descriptions of the -t flag,
and add support for UTC absolute times in the iousers and iostat TShark
taps.

svn path=/trunk/; revision=53114
2013-11-06 20:39:09 +00:00
Bill Meier 8c220a6f7f Fix (using '#if 0') a few more [-Wunused-const-variable] warnings
svn path=/trunk/; revision=52799
2013-10-23 16:59:34 +00:00
Jakub Zawadzki 52e1697533 wireshark: use epan_dissect_reset(), rawshark: fix missing epan_dissect_cleanup()
svn path=/trunk/; revision=52711
2013-10-20 13:22:48 +00:00
Jakub Zawadzki 215902b9b3 rawshark: use epan_dissect_reset()
svn path=/trunk/; revision=52708
2013-10-20 12:34:42 +00:00
Michael Mann ee208c8dcc Add support for RELATIVE-OID ASN.1 type. Bug 9192 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192)
From Ed Beroset.

svn path=/trunk/; revision=52393
2013-10-06 02:31:10 +00:00
Evan Huus c1dd5d3882 Replace some val_to_str calls with the equivalent val_to_str_const calls (and
implement rval_to_str_const to do this). The format-strings didn't have any
parameter specifiers in them, so they were clearly never used (or they would
have blown up) but still a bug.

This is one of the first steps towards converting val_to_str and friends to
wmem. I'm honestly not sure what the best approach is for the API in this case:
the vast majority of usage is within dissectors, so just hard-coding packet
scope (the way they currently hard-code ep_ scope) doesn't look terrible, but
there are *some* uses in taps and other places that will need to be converted to
something else if we go that route. Adding a wmem_pool parameter just for the
uncommon case seems a bit like overkill, though perhaps it is the right thing to
do.

svn path=/trunk/; revision=52264
2013-09-29 12:44:50 +00:00
Gerald Combs a4a6af3c5a Initialize our wtap_pkthdr struct so that we don't try to dereference an
invalid opt_comment pointer down the line.

svn path=/trunk/; revision=51493
2013-08-23 18:42:51 +00:00
Gerald Combs c431ae3d81 Make sure we call epan_free() before epan_cleanup() similar to r51342.
svn path=/trunk/; revision=51491
2013-08-23 17:10:32 +00:00
Alexis La Goutte 9033f210c9 Fix (-W)documentation error found by Clang
rawshark.c:889:11: error: parameter 'fd' not found in the function declaration
      [-Werror,-Wdocumentation]
 * @param fd [IN] A POSIX file descriptor.  Because that's _exactly_ the sort
          ^~
rawshark.c:889:11: note: did you mean 'pd'?
 * @param fd [IN] A POSIX file descriptor.  Because that's _exactly_ the sort
          ^~
          pd

svn path=/trunk/; revision=51280
2013-08-10 21:31:43 +00:00
Guy Harris ea72be8607 Speak of the "-d encap:" value as a linktype, rather than a DLT; if a
name is specified, it currently must be a DLT_ name rather than a
LINKTYPE_ name, as we use libpcap to do the mapping and it currently has
no API to map LINKTYPE_ names to values, but if a number is specified,
it could either be a LINKTYPE_ name or a DLT_ name if the two are
different, and we want to encourage the use of LINKTYPE_ values.

Note that in comments.

svn path=/trunk/; revision=51204
2013-08-08 04:29:08 +00:00
Jakub Zawadzki 08eb36b5af Remove fdata->opt_comment, add pkt_comment to pinfo
Original (read from file) comments can be accessed by pkthdr->opt_comment
Keep user comments in seperated BST, add new method for epan session to get it.

svn path=/trunk/; revision=51090
2013-08-01 20:59:38 +00:00
Evan Huus 5ede3bcde0 Follow-up to r50935: add support for 64-bit value strings in more places that
need it, I think this is all of them.

svn path=/trunk/; revision=50941
2013-07-26 23:51:00 +00:00
Guy Harris d8022e7c5e Make some routines not used outside rawshark.c static.
svn path=/trunk/; revision=50859
2013-07-24 00:09:16 +00:00
Jakub Zawadzki 7ec1a78fe8 Abuse epan_t more: add callback to get interface name.
svn path=/trunk/; revision=50794
2013-07-22 19:38:38 +00:00
Jakub Zawadzki c702e92121 Replace relative timestamp with reference frame number. Saves 16B per frame.
svn path=/trunk/; revision=50772
2013-07-21 23:07:33 +00:00
Jakub Zawadzki 5d52e16734 Add helper function to epan_session which can be used to get absolute timestamp of given frame.
Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number.

This patch reduce size of frame_data by 8B (amd64)
This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13)

svn path=/trunk/; revision=50765
2013-07-21 20:48:30 +00:00
Jakub Zawadzki 28e9dcc4a9 Some work on multi file dissection
- make init_dissection/cleanup_dissection private for libwireshark
- implement epan_new(), epan_free()
- pass epan_t to epan_dissect*

svn path=/trunk/; revision=50761
2013-07-21 18:38:03 +00:00
Jeff Morriss 4dcc156cf3 Move the print modules into epan.
svn path=/trunk/; revision=50526
2013-07-12 03:50:50 +00:00
Jeff Morriss 16206348d9 Move disabled_protos.{h,c} into epan.
svn path=/trunk/; revision=50521
2013-07-12 01:40:06 +00:00
Jakub Zawadzki ce81449ed9 packet dissection now takes pointer to tvb instead of guint8 data
implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497
2013-07-11 05:47:02 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Evan Huus 32799db42c Fix the leaking of packet comments, i.e. the rest of
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7530

The frame_data_cleanup function was ambiguous; it was being used for two
different purposes, and did neither of them quite properly. Split it instead
into frame_data_reset and frame_data_destroy, and call the correct one depending
on why we were originally calling frame_data_cleanup.

svn path=/trunk/; revision=48324
2013-03-15 18:04:50 +00:00
Gerald Combs bd4cffae58 When any of our executables start on Windows create or open a "Wireshark
is running" mutex. Have the NSIS installer check for this mutex and ask
the user to close Wireshark if it's found. While not perfect this makes
the WinSparkle update process much less annoying.

svn path=/trunk/; revision=47758
2013-02-20 01:19:42 +00:00
Guy Harris 05825b02cd Add some routines to wsutil to, at least on some platforms, add
information to crash dumps and the like.  (Currently, we only handle OS
X's CrashReporter, but we should do this on other platforms where this
information can be added and would be helpful.)

White space tweaks.

svn path=/trunk/; revision=47104
2013-01-15 21:54:41 +00:00
Guy Harris 6cb00759cc Squelch some Windows-only warnings - the third argument to _read() is
int, not size_t.

svn path=/trunk/; revision=46787
2012-12-26 13:49:04 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Michael Tüxen a1cca8c54a rawshark does not use any routine from pcapio.c. So remove header.
svn path=/trunk/; revision=46635
2012-12-20 14:50:24 +00:00
Jakub Zawadzki 77368c3668 Introduce epan_dissect_run_with_taps() which run dissection with taps.
unexport tap_queue_init, tap_push_tapped_queue

svn path=/trunk/; revision=45670
2012-10-20 19:27:24 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Jakub Zawadzki 72ca9d0e61 Store pointers to previously displayed and captured packet, not nstime_t deltas.
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure.

Part of bug 5821: Reduce per-packet memory requirements.

svn path=/trunk/; revision=45071
2012-09-23 16:25:28 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Evan Huus 1ccee24ec5 Fix uninitialized variable as caught by cppcheck.
svn path=/trunk/; revision=44699
2012-08-29 22:53:21 +00:00
Anders Broman c19583b72c From Michael Mann:
Generic preferences implementation - Printing and Name Resolution.

svn path=/trunk/; revision=43579
2012-07-06 04:48:36 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman 3814106d7e From Michael Mann:
generic preferences implementation

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7402

svn path=/trunk/; revision=43484
2012-06-25 21:05:36 +00:00
Chris Maynard e40c7ab1dc Be sure to specify FORMAT_MESSAGE_IGNORE_INSERTS in the dwFlags arg to all FormatMessage() calls where FORMAT_MESSAGE_FROM_SYSTEM is also specified. (Ref: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/28/6564257.aspx)
svn path=/trunk/; revision=43172
2012-06-09 03:41:23 +00:00
Guy Harris 4a9b825c49 Change the "user_saved" member of a capture_file structure to
"unsaved_changes", and have it be TRUE iff changes have been made to the
file since it was read - *not* if it's a temporary file from a live
capture.

Check the "is_tempfile" member, and the "unsaved_changes" member, when
appropriate.

Just have a set_toolbar_for_capture_file() routine that updates the
"save", "close", and "reload" toolbar as appropriate, given a
capture_file structure - absorb the function of
set_toolbar_for_unsaved_capture_file() into it.

svn path=/trunk/; revision=42721
2012-05-20 08:56:06 +00:00
Anders Broman fc41d4ad51 From Evan Huus:
Duplicate and misplaced 'break' statements.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7106

svn path=/trunk/; revision=42091
2012-04-16 08:39:34 +00:00
Jakub Zawadzki 23494db817 Add missing const attribute to some char *
Fix some "assignment discards qualifiers from pointer target type", etc

svn path=/trunk/; revision=41996
2012-04-09 18:44:10 +00:00
Jörg Mayer 35508464b2 Start moving files to ui/ and ui/cli/
svn path=/trunk/; revision=41047
2012-02-17 12:30:27 +00:00
Guy Harris 7e531049a0 Swallow cant_load_winpcap_err() up into capture-wpcap.c, so that
anything that uses WinPcap can use that message text in its error
messages.

svn path=/trunk/; revision=40335
2011-12-29 23:09:42 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +00:00
Chris Maynard e23a651ed0 Minor formatting changes to the rawshark -h output.
svn path=/trunk/; revision=39165
2011-09-27 17:18:25 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Jeff Morriss bf95c7b5e4 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
2011-08-09 21:02:10 +00:00
Anders Broman 2f05cf4dcf From Michael Mann:
Added ability to display UTC time or UTC time with date.  I liked having the
difference between UTC and local time, not just setting local=UTC.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2629

svn path=/trunk/; revision=37898
2011-07-04 21:43:34 +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
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Jakub Zawadzki 22fdafebfc Add missing code to handle fields with an extended value_string (BASE_EXT_STRING)
svn path=/trunk/; revision=36749
2011-04-21 09:50:12 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
by the gunzipping code.  Have it also supply a err_info string, and
report it.  Have file_error() supply an err_info string.

Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to
suggest a decompression error - into the rawshark and tshark errors,
along the lines of what other programs print.

Fix a case in the Netscaler code where we weren't fetching the error
code on a read failure.

svn path=/trunk/; revision=36748
2011-04-21 09:41:52 +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
Gerald Combs 3bc1fc3802 On Windows, convert all of our command-line arguments from UTF-16 to
UTF-8 where we don't already do so. In Wireshark use g_utf16_to_utf8
instead of utf_16to8. This should fix bug 5520.

svn path=/trunk/; revision=35411
2011-01-06 23:28:58 +00:00
Jaap Keuter 8d6a5fba46 Avoid the need for cf_mark_frame stubs.
svn path=/trunk/; revision=35248
2010-12-22 23:09:31 +00:00
Stig Bjørlykke 2cedc69849 Fixed "Compiled with" information in the About box.
svn path=/trunk/; revision=34601
2010-10-21 07:13:43 +00:00
Gerald Combs 1cd0689882 Revision 27919 added the ability to feed a libpcap-formatted file to
rawshark but broke the ability to feed it live packets with a
pcap_pkthdr prefix on some 64-bit architectures.

Add a "-p" flag which lets us explicitly handle file-based or
memory-based packet record headers.

svn path=/trunk/; revision=34522
2010-10-15 16:05:06 +00:00
Bill Meier c78221d4ce Rename g_resolv_flags --> gbl_resolv_flags; Also: cleanup some whitespace & indentation.
svn path=/trunk/; revision=34487
2010-10-12 13:15:08 +00:00
Gerald Combs a87bdf9660 Turn on ASLR via /DYNAMICBASE and DEP via SetProcessDEPPolicy().
svn path=/trunk/; revision=34137
2010-09-16 19:20:06 +00:00
Guy Harris cc3540b0fb Move the code to get version information for libraries used by
libwireshark into libwireshark, and call it only in programs linked with
libwireshark.  That way, programs that don't link with libwireshark
don't have to link with libgcrypt or libgnutls solely so that they can
say that they're linked with a particular version of libgcrypt or
libgnutls.

Don't link dumpcap with libgcrypt or libgnutls any more.

svn path=/trunk/; revision=33531
2010-07-15 02:07:16 +00:00
Guy Harris 7d45ac7dd5 Get rid of no-longer-used variable.
svn path=/trunk/; revision=33511
2010-07-14 02:12:55 +00:00
Jeff Morriss 47e2d75820 Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
2010-05-28 20:19:55 +00:00
Stig Bjørlykke 1bcecb4bcd Set default seconds type in rawshark and dftest.
svn path=/trunk/; revision=32709
2010-05-07 06:35:17 +00:00
Bill Meier 6680513f4d Let's not use tabs with tab-width=4; Convert tabs to spaces (with indent=4).
Also: use consistent indentation & remove any trailing blanks.

svn path=/trunk/; revision=32588
2010-04-28 16:23:53 +00:00
Guy Harris 25d49313cc "capture-pcap-util.h" include <pcap.h>, and <pcap.h>, for better or
worse, has no include-once guards; include it only once.

svn path=/trunk/; revision=32110
2010-03-04 07:19:43 +00:00
Guy Harris 13152548f6 Squelch compiler warnings.
Add a break statement where it appears to have been missing.

svn path=/trunk/; revision=32041
2010-02-27 23:14:50 +00:00
Guy Harris c85899e946 Move the declarations of wtap_pcap_encap_to_wtap_encap() and
wtap_wtap_encap_to_pcap_encap() to wiretap/pcap-encap.h.  Include it
where it's needed; don't include other Wiretap headers where they're not
needed.

Include pcapng.h in pcapng.c, to declare the functions defined in
pcapng.c.  Add some casts to squelch some warnings, and add to a comment
to indicate one of the problems.

svn path=/trunk/; revision=31960
2010-02-23 03:50:42 +00:00
Guy Harris add4e4dfbd Squelch some warnings.
svn path=/trunk/; revision=31959
2010-02-23 03:23:46 +00:00
Bill Meier e4d6610bd5 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
2010-01-29 16:09:25 +00:00
Guy Harris 8e236e55de For fields of type FT_ABSOLUTE_TIME, have the "display" value be one of
ABSOLUTE_TIME_LOCAL or ABSOLUTE_TIME_UTC, indicating whether to display
the date/time in local time or UTC. (int)ABSOLUTE_TIME_LOCAL ==
(int)BASE_NONE, so there's no source or binary compatiblity issue,
although we might want to eliminate BASE_NONE at some point and have the
BASE_ values used with integral types start at 0, so that you can't
specify BASE_NONE for an integral field.

svn path=/trunk/; revision=31319
2009-12-19 03:17:44 +00:00
Stig Bjørlykke 7197b85fd6 Removed an unused assignment.
svn path=/trunk/; revision=30915
2009-11-10 09:09:25 +00:00
Stig Bjørlykke 98024a007f Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_H
Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision.

svn path=/trunk/; revision=30370
2009-10-06 16:01:18 +00:00
Kovarththanan Rajaratnam 0ee2b7754d Rename init_cap_file() to cap_file_init()
svn path=/trunk/; revision=30073
2009-09-22 16:53:11 +00:00
Kovarththanan Rajaratnam 1e8d9b4937 Make frame_data_set_after_dissect() callers do the necessary checks instead
svn path=/trunk/; revision=30068
2009-09-22 14:50:43 +00:00
Kovarththanan Rajaratnam 14d2f617c2 Refactor frame_data_init() into frame_data_set_before_dissect() and frame_data_set_after_dissect().
svn path=/trunk/; revision=30066
2009-09-22 14:23:20 +00:00
Kovarththanan Rajaratnam c3647b4e3b Move 'Delta timestamp to previous captured frame' calculation inside add_packet_to_packet_list(). This is done in order to streamline add_packet_to_packet_list() with frame_data_init(). Hopefully we can switch to frame_data_init() soon
svn path=/trunk/; revision=30052
2009-09-21 19:30:06 +00:00
Kovarththanan Rajaratnam 46b7430557 Move frame_data_init() declaration to frame_data.h
svn path=/trunk/; revision=30033
2009-09-21 11:26:23 +00:00
Kovarththanan Rajaratnam 8791df65e1 Fix return type for frame_data_init()
svn path=/trunk/; revision=30024
2009-09-20 19:01:23 +00:00
Kovarththanan Rajaratnam 2e282e7567 Introduce frame_data_cleanup() and start using it
svn path=/trunk/; revision=30023
2009-09-20 18:18:29 +00:00
Kovarththanan Rajaratnam 92a1cdd4a4 Use frame_data_init() instead of the locally defined fill_in_fdata(), which will be removed as part of this change
svn path=/trunk/; revision=30022
2009-09-20 18:02:22 +00:00
Kovarththanan Rajaratnam 6691a701e3 Move verbose banner output to show_version() and tighten scope of some variables
svn path=/trunk/; revision=30020
2009-09-20 17:45:17 +00:00
Kovarththanan Rajaratnam b90a11bee3 Make tshark and rawshark use build_column_format_array() instead of duplicating the code
svn path=/trunk/; revision=29803
2009-09-08 17:29:57 +00:00
Kovarththanan Rajaratnam a65d590002 Store the packet encapsulation type as gint8. Saves 3 bytes per packet
svn path=/trunk/; revision=29767
2009-09-07 13:54:46 +00:00
Kovarththanan Rajaratnam 0e5cef61be Split a bunch of init routines into init() and cleanup(). This allows us to free memory properly on shutdown.
This is an initial step. There's still some work to do.

svn path=/trunk/; revision=29754
2009-09-06 18:25:23 +00:00
Kovarththanan Rajaratnam 80a6d3fbcf Introduce epan_dissect_init()/epan_dissect_cleanup(). These are used to initialise/cleanup stack allocated 'edt' structures. This should speed up dissection since we avoid some malloc traffic.
svn path=/trunk/; revision=29404
2009-08-13 19:42:46 +00:00
Guy Harris cf91fdf16b Have tap listeners specify whether the "packet" routine requires
a protocol tree;

	the column values.

This includes stats-tree listeners.

Have the routines to build the packet list, and to retap packets, honor
those requirements.  This means that cf_retap_packets() no longer needs
an argument to specify whether to construct the column values or not, so
get rid of that argument.

This also means that there's no need for a tap to have a fake filter
to ensure that the protocol tree will be built, so don't set up a fake
"frame" filter.

While we're at it, clean up some cases where "no filter" was represented
as a null string rather than a null pointer.

Have a routine to return an indication of the number of tap listeners
with filters; use that rather than the global num_tap_filters.

Clean up some indentation and some gboolean vs. gint items.

svn path=/trunk/; revision=28645
2009-06-05 22:42:47 +00:00
Bill Meier fa920e48ed Minor cleanup of "-h" output text.
svn path=/trunk/; revision=28334
2009-05-12 16:06:14 +00:00
Gerald Combs e648060f0f Fix the last(?) of the Win64 compilation problems.
svn path=/trunk/; revision=28065
2009-04-16 04:05:39 +00:00
Gerald Combs 4400c3393e Rawshark fixes from Duncan Salerno.
svn path=/trunk/; revision=27919
2009-03-31 23:38:31 +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
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 ee908a7abd #include <epan/conversation.h> not req'd ...
svn path=/trunk/; revision=27392
2009-02-07 16:01:26 +00:00
Guy Harris 48ea0b2fc7 Fix error reporting - just use fprintf(stderr, ...), give the path name
of the pipe to be opened in the messages.

Check whether strtol() succeeds.

Map DLT_ values to a WTAP_ENCAP_ value regardless of whether it comes
from linktype_name_to_val() or strtol().

Clean up indentation.

svn path=/trunk/; revision=27075
2008-12-21 23:37:29 +00:00
Guy Harris 44f8cae6ab If we don't have any of the pcap_datalink_XXX_to_YYY routines,
substitute our own (I wrote them all, so I can steal them from the
BSD-licensed libpcap if I want :-)).  This means that
linktype_name_to_val() and linktype_val_to_name() are always available,
and we don't need to #ifdef use of them.

Use pcap_datalink_val_to_description() to get the description for a
particular DLT_ value, rather than mapping the DLT_ value to a
WTAP_ENCAP_ value and getting the description for the latter.

svn path=/trunk/; revision=27074
2008-12-21 23:22:12 +00:00
Jaap Keuter 7f36dc44ce Fix for bug 2823:
Do not pass automatic variable back into caller space.

svn path=/trunk/; revision=26425
2008-10-13 06:54:19 +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
Bill Meier 224b638586 #include <emem.h> not req'd
svn path=/trunk/; revision=26093
2008-08-26 02:38:57 +00:00
Gerald Combs 2f5f9ae606 Remove dead code found in Coverity CID 271.
svn path=/trunk/; revision=25831
2008-07-25 18:51:44 +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
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
Anders Broman 3d39efc2c3 Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25248
2008-05-07 05:26:40 +00:00
Sake Blok f17067c174 Make tshark and rawshark behave similar to wireshark when "frame.time_delta_displayed" is
used within a display filter.

(the usefullness of "frame.time_delta_displayed" in a display filter is very limited
 since it bites it's own tail. Still, wireshark and tshark should at least show the
 same behaviour)


svn path=/trunk/; revision=24708
2008-03-21 06:11:45 +00:00
Jeff Morriss 70a53138b3 From Peter Fuller: free pref_str in set_link_type() if preferences aren't set. From me: call get_credential_inf() at startup.
svn path=/trunk/; revision=24656
2008-03-16 15:29:13 +00:00
Stephen Fisher 56226b49b8 Custom column updates:
- Change apply / prepare / ... as filter to use the field's value, which
   is now stored in fdata as well as cinfo.  Now we don't have to reprocess
   the entire packet list when using these features.  This also prevents
   the use of these features from overwriting custom column information.
   (custom columns can now be used in apply / prepare ... as filter)
 - Break col_expr and col_expr_val out into a struct that is included not only
   in cinfo, but now also fdata.
 - Have col_custom_set_fstr() quote FT_STRING & FT_STRINGZ when storing the
   col_expr_val value (for filter creation).


svn path=/trunk/; revision=24511
2008-03-01 05:16:45 +00:00
Bill Meier 01704fde45 g_strncasecmp --> g_ascii_strncasecmp
svn path=/trunk/; revision=24443
2008-02-23 17:06:57 +00:00
Gerald Combs 022a248f4c Convert any supplied encapsulation from libpcap to wiretap so that DLTs other
than Ethernet work.

svn path=/trunk/; revision=24403
2008-02-20 18:02:03 +00:00
Bill Meier 2f9f8d7df8 Fix some some properties
svn path=/trunk/; revision=24380
2008-02-18 21:01:11 +00:00
Stig Bjørlykke 17504c44ad Add a missing default case to avoid a warning.
svn path=/trunk/; revision=24367
2008-02-17 00:04:49 +00:00
Guy Harris f10febad71 Now that we're no longer linking with capture_info.c, etc., we don't
need a bunch of dummy routines.

svn path=/trunk/; revision=24344
2008-02-16 02:31:31 +00:00
Gerald Combs 7706f9e17e Fix compilation on non-Windows systems.
svn path=/trunk/; revision=24340
2008-02-16 01:00:01 +00:00
Gerald Combs 98bacb3556 Add rawshark, a utility that, when given raw pcap-formatted packets and
a list of fields, prints the field values found in each packet.

Packet data can be specified as a libpcap DLT, e.g. "EN10MB" or an upper-layer protocol, e.g. "http".

svn path=/trunk/; revision=24339
2008-02-15 23:20:32 +00:00