Commit Graph

143 Commits (1095ba3034fe4831f27283a7a2b051ccdb4105d8)

Author SHA1 Message Date
Michael Mann 81d65ccec6 Add wtap_optionblock_set_option_string_format
Also add a length parameter to wtap_optionblock_set_option_string

Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee
Reviewed-by: Anthony Coddington <>
Reviewed-by: Michael Mann <>
2016-05-22 23:39:14 +00:00
Michael Mann dcd833e348 Use a native Section Header block for capinfo.
This is intended to aid possible future efforts with generic
block handling.

Change-Id: Iff915a8d0d8ed20ef89c20e0cf7967a3416318c3
Petri-Dish: Michael Mann <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Michael Mann <>
2016-05-16 20:40:46 +00:00
Martin Kaiser 49362062e3 capinfos: wsgcrypt.h checks internally if we HAVE_LIBGCRYPT
we can #include <wsutils/wsgcrypt.h> without doing the check ourselves

Change-Id: Id0cee25e10c150105636574e683c39b81eb07ebf
Reviewed-by: Martin Kaiser <>
2016-05-10 06:28:04 +00:00
João Valverde 3db13a7fc9 Link version code statically again
This allows keeping the code-sharing with the static linking.

This "fixes" a hypothetical ABI mismatch with wsutil and avoids pulling more
external dependencies to wsutil than strictly necessary.

A nice side-effect is that libwsutil no longer depends on version.h.

Follow up to f95976eefc.

Change-Id: I8f0d6a557ab3f7ce6f0e2c269124c89f29d6ad23
Petri-Dish: João Valverde <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: João Valverde <>
2016-04-21 18:59:56 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317
Petri-Dish: João Valverde <>
Petri-Dish: Gerald Combs <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: João Valverde <>
2016-04-04 23:05:31 +00:00
João Valverde f95976eefc Move zlib version check to wsutil
Change-Id: I0950f61e90af5bb21c0017204de0c0b509616e5c
Petri-Dish: João Valverde <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Michael Mann <>
2016-04-03 02:58:04 +00:00
Joerg Mayer c0e48778b7 Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
        proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
Added manual change id because file-jpeg.c forced the use of commit -n

Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Reviewed-by: Jörg Mayer <>
2016-03-28 11:43:56 +00:00
Daniël van Eeden a0b1354583 Fix compile errors when compiling w/o zlib
Change-Id: I443cd0d4a143e456e11b5939891312a0501770a0
Reviewed-by: Jaap Keuter <>
Petri-Dish: Jaap Keuter <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Michael Mann <>
2016-03-26 16:19:34 +00:00
Michael Mann 08d49ff2e0 Making wiretap option blocks more generic.
This was inspired by, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom".  It should be easier to add "custom" options in this design. Some, but not all blocks have been converted.
Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks.

Also what could be added/refactored is registering block behavior.

Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a
Petri-Dish: Michael Mann <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Michael Mann <>
2016-02-23 00:39:38 +00:00
Guy Harris 71c603b2fc Clean up more includes of wtap.h.
Change-Id: Ie53b64f7e5b39a50dffb62fc0b886da71e0a3bd2
Reviewed-by: Guy Harris <>
2016-01-06 00:25:19 +00:00
João Valverde fbf2e3cf8f Make init_progfile_dir() take a function pointer [-Wpedantic]
Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98
Petri-Dish: Alexis La Goutte <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Guy Harris <>
2015-12-14 23:52:28 +00:00
João Valverde 2aab706c5a Remove -Wwrite-strings compiler flag
The "-Wwrite-strings" flag produces nuisance warnings. These warnings are
not useful, they're impossible to fix in a sane way and therefore are being
handled with casts of static strings to (char *).

This just moves the warning to [-Wcast-qual] and a compiler pragma is
in turn required (and used) to squelch that warning.

Remove the Wwrite-strings warning. Let that responsibility fall on the
programmer (as is done by casting).

Change-Id: I5a44dfd9decd6d80797a521a3373593074962fb5
Petri-Dish: Alexis La Goutte <>
Reviewed-by: Alexis La Goutte <>
Reviewed-by: Michael Mann <>
2015-12-12 16:21:19 +00:00
Pascal Quantin fb3d38225e Update user guide for development release
Change-Id: I9b4c5ab2e98ad6daa618bcda20b53a23467e16e0
Reviewed-by: Pascal Quantin <>
2015-11-11 17:31:31 +00:00
Guy Harris 0162e54075 Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".

Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).

Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Petri-Dish: Guy Harris <>
Reviewed-by: Guy Harris <>
2015-11-07 21:52:23 +00:00
Guy Harris 5ed7a401bb Don't assume we have interface information.
Not all capture file formats provide interface information.  Check
whether we have it, and don't fail if we don't have any.

(Note that the current version of the pcapng specification in the Git
repository does not require that there be at least one IDB in a file,
only that there must be an IDB for each interface to which other blocks
in a file refers.)

Change-Id: Ia796f639ed3a8cb21e1dbe9b2bc6b4b66c7be479
Reviewed-by: Guy Harris <>
2015-08-23 23:15:00 +00:00
Hadriel Kaplan d64ad1de91 capinfos: add more info about file and interfaces
Add more information about the capture file, and about the interface
descriptions in it. Also remove long-unused g_options code.

Change-Id: I93cbd70fc7b09ec1b8b2fd6c85bb885c7f749543
Petri-Dish: Hadriel Kaplan <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Anders Broman <>
2015-08-19 04:26:24 +00:00
Hadriel Kaplan e25562badd Pcapng: clean up Section Header Block handling
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258
Reviewed-by: Hadriel Kaplan <>
Petri-Dish: Hadriel Kaplan <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Anders Broman <>
2015-08-18 05:52:45 +00:00
Guy Harris c8fec28f2c Print times with the resolution from the capture file.
Print the first packet and last packet time stamps with the resolution
supplied for them, and print the difference between them with the higher
of those two resolutions.

Change-Id: I111fbbf91b5957e63dca650b85f182c5f103c5fd
Reviewed-by: Guy Harris <>
2015-07-31 22:39:42 +00:00
Guy Harris 5892d3c42f Don't use ctime().
The API checks warn about it being deprecated - that doesn't seem to
cause a problem with the buildbot, but does result in failures from the
Petri dish.  Format the first and last packet time in an ISO 8601-style

Call them "First packet time" and "Last packet time", rather than "Start
time" and "End time", as they're not necessarily the times when the
capture started or ended.

(Both make the output a bit more like the Statistics -> Summary window.)

Change-Id: Ibf02999851f49c7951c6f6152c70efa271414bd9
Reviewed-by: Guy Harris <>
2015-02-28 09:15:10 +00:00
Guy Harris 65303efe4d Remove some unneeded includes of <sys/time.h>.
Change-Id: I9e4e6efa9f8c7dbff7627f8d5fc3278ab383618d
Petri-Dish: Guy Harris <>
Reviewed-by: Guy Harris <>
2015-02-28 04:59:08 +00:00
Gerald Combs 95382c3afb Suppress a bunch of cast-qual warnings.

    warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

similar to g630f54f.

Change strtod to g_ascii_strtod to squelch a checkAPIs error.

Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e
Reviewed-by: Gerald Combs <>
2015-02-20 04:04:15 +00:00
Guy Harris 9423a13b2d Just have init_progfile_dir() take a void pointer.
dladdr() takes a void * as a code pointer; have init_progfile_dir() do
so, and do the casting in the calls.  We don't care about the signature
of the function whose address we're passing, we just want to pass a
pointer to *something* in the main program.

Change-Id: I9372620a97b0eb53c2bb3c0c41a238b4408f3709
Reviewed-by: Guy Harris <>
2015-02-20 00:24:08 +00:00
Guy Harris 114e7735b9 Call setlocale() before getting version information.
That way, the setlocale() call used to get the current locale will get
the right answer.

Change-Id: Ib43e16a9d98d08e5ddaff81fd3235f5b64d7b95b
Reviewed-by: Guy Harris <>
2015-01-01 00:47:17 +00:00
Guy Harris 27be466c9b Do the full string in get_{compiled,runtime}_version_info().
Have them start the string with "Compiled" or "Running on", and return
the string when done.

Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810
Reviewed-by: Guy Harris <>
2014-12-31 06:29:11 +00:00
Guy Harris c1f30471ca Move the version_info.c stuff to wsutil/ws_version_info.c.
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde
Reviewed-by: Guy Harris <>
2014-12-31 03:41:02 +00:00
Guy Harris e08eba9b9e Only include <wsutil/os_version_info.h> if we need it.
Change-Id: Idee0e7205969ac2e7b33c4748a1463a0bfffe0a6
Reviewed-by: Guy Harris <>
2014-12-25 21:03:45 +00:00
Guy Harris 20503c7047 Check for getopt_long(), not getopt().
We support three types of platforms:

	1) UN*Xes that have both getopt() and getopt_long();

	2) UN*Xes that have getopt() but not getopt_long();

	3) Windows, which has neither.

Checking for getopt_long() lets us distinguish between 1) and 2) and
build getopt_long() for them.

Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45
Reviewed-by: Guy Harris <>
2014-12-25 01:11:10 +00:00
Stephen Fisher 2d8ec49ffa Move twelve show_version() functions from the varoius programs and
Wireshark UI files into a single one in wsutil.

Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad
Reviewed-by: Stephen Fisher <>
2014-12-24 16:51:45 +00:00
Guy Harris 0885d29451 Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-by: Guy Harris <>
2014-12-18 04:04:19 +00:00
Guy Harris 6011a047d3 WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.
Check for them *only* on opening for writing and writes.

Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067
Reviewed-by: Guy Harris <>
2014-12-18 00:41:43 +00:00
Guy Harris 51522b3372 Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out
in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along
with an err_info string.

Report (and free) that err_info string in cases where

Clean up some other error reporting cases, and flag with an XXX some
cases where we aren't reporting errors at all, while we're at it.

Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3
Reviewed-by: Guy Harris <>
2014-12-18 00:03:26 +00:00
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: Icc5c9cff43be6c073f0467607555fa7138c5d074
Reviewed-by: Guy Harris <>
2014-12-17 06:41:45 +00:00
Guy Harris b56d4d0187 Clean up the "unknown per-packet encapsulation" message.
Report the file name, report the frame number as unsigned (which it is),
and make it look more like other error messages.

Change-Id: Ia5281da1c94d55c745da8a8b20dafdb74dd13f92
Reviewed-by: Guy Harris <>
2014-12-17 06:08:31 +00:00
Guy Harris be7f053984 Report (and free) err_info for WTAP_ERR_DECOMPRESS.
Change-Id: I61ecc58be4b0688c43df0b0f006fb899bdc1721c
Reviewed-by: Guy Harris <>
2014-09-20 20:19:36 +00:00
Guy Harris cda5c16667 Clean up capinfos output.
Make sure there's always a space between a number and "[TGMK]bytes",
"[TGMK]bits", and "[TGMK]packets".

Change-Id: I710385303e451e9aea6fc9bbea562f59ca0d22c9
Reviewed-by: Guy Harris <>
2014-08-24 08:57:13 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Petri-Dish: Graham Bloice <>
Tested-by: Petri Dish Buildbot <>
Reviewed-by: Roland Knall <>
Reviewed-by: Graham Bloice <>
2014-08-24 08:04:08 +00:00
Bill Meier f3dd7fe1eb Fix whitespace/indentation to match editor modelines.
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca
Reviewed-by: Bill Meier <>
2014-08-05 20:42:21 +00:00
Guy Harris b4ce352539 Make --help and --version information a bit more uniform.
Have --version print the version number, the copyright information, the
"compiled with" information, the "running on/with" information, and the
compiler information.

Have --help print the version number, a one-line summary of what the
program does, a reference to for more
information, a Usage: line, and a list of command-line options.

This means programs doing that don't need to include version.h; that's
left up to get_ws_vcs_version_info() to do.

Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb
Reviewed-by: Guy Harris <>
2014-07-03 08:46:01 +00:00
Guy Harris 8afe331369 More getopt_long, to add --help and --version support.
Change-Id: I946067b972a70154f02ab561bc0fd029a7a5abc4
Reviewed-by: Guy Harris <>
2014-07-03 04:51:20 +00:00
Bill Meier 60ffafdb7c Fix compile error when building w/o GNUTLS
Specifically: <wsutil/file_util.h> is aleays needed (for create_app_running_mutex())

Change-Id: I78e5a767f62bc2af67b6407539742dc245259f56
Reviewed-by: Bill Meier <>
2014-06-29 17:50:55 +00:00
Jeff Morriss 3773a7561c Add command-line argument to request the version to a number of the utilities.
In some cases "-v" was already used so "-V" is the option.
Note that the version information in these utilities is much shorter than what
is presented by the big programs.

As requested by

Bug: 5804
Change-Id: I35db35a4eace2797afd895f9be7322ef39928480
Reviewed-by: Guy Harris <>
2014-06-21 01:05:02 +00:00
Guy Harris 6db77b000f Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific

Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.

Rename some routines to indicate that they handle more than just

We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug

Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-by: Guy Harris <>
2014-05-24 18:31:25 +00:00
Guy Harris a344c9736e Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c.

A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes.  That is in-progress.

Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6
Reviewed-by: Guy Harris <>
2014-05-23 10:50:10 +00:00
Guy Harris c0c480d08c Allow wtap_read() and wtap_seek_read() to return non-packet records.
This is the first step towards implementing the mechanisms requestd in
bug 8590; currently, we don't return any records other than packet
records from libwiretap, and just ignore non-packet records in the rest
of Wireshark, but this at least gets the ball rolling.

Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574
Reviewed-by: Guy Harris <>
2014-05-23 03:02:32 +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-by: Guy Harris <>
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.

Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-by: Michael Mann <>
2014-05-09 03:04:39 +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-by: Anders Broman <>
2014-03-04 14:27:33 +00:00
Michal Labedzki 579e7e19ce Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.

On the other side now it is possible to open capture file
as file format to be dissected.

Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-by: Michal Labedzki <>
Reviewed-by: Hadriel Kaplan <>
Reviewed-by: Evan Huus <>
Tested-by: Evan Huus <>
2014-02-25 17:43:13 +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 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-by: Gerald Combs <>
2014-02-07 23:03:03 +00:00
Alexis La Goutte c6022b3b85 Drop support of Visual Studio 2005
* Remove _MSC_VER < 1500 check
* Cleanup config.nmake


svn path=/trunk/; revision=54965
2014-01-26 12:56:32 +00:00