Commit Graph

169 Commits

Author SHA1 Message Date
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Jim Young 81ad4cd3bd capinfos: Add -K option and report capture comments last
This patch adds a capinfos -K option to suppess printing of capture
comments.  This patch also changes when capture comments are printed
relative to the other enabled infos. Because capture comments are
freeform we will now defer their printing until all but the interface
detail infos are printed.

Change-Id: Ibb3df040c09e4c67d714c561869c00e08b83d6ed
Reviewed-on: https://code.wireshark.org/review/20643
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-23 11:53:28 +00:00
Jim Young 66dc0aecab capinfos: Remove obsolete message from print_usage() report.
Commit 6b84ddee83 made libcrypt a
mandatory dependency. Remove overlooked help message claiming
that hashing support is not present.

Change-Id: I908dbbf4d37253fe01513988a42f074322344c0f
Reviewed-on: https://code.wireshark.org/review/20644
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-20 05:04:37 +00:00
Jim Young b157a5d80c capinfos: Ensure empty columns are written in -T reports.
When using capinfo's -T report insure that proper placeholders are written
to the records if any of the optional pcapng SHB block values are missing
so as to maintain column alignment with the header record.

Augment the comments about the potential silliness regarding the dumping
of pcapng comments in capinfos -T reports.

Change-Id: I43df4aeed2235f7ed9c67519c249361ab00680f1
Reviewed-on: https://code.wireshark.org/review/20613
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-19 16:24:49 +00:00
Dario Lombardo 53fb7e41b1 capinfos: use single exit point.
Change-Id: Ib1b556c07ec3e1f788c48038ed6bb0ae6af5cb7d
Reviewed-on: https://code.wireshark.org/review/20196
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-26 18:42:00 +00:00
Dario Lombardo 6d79055ba6 wsutil: remove leaks from filesystem and plugins code.
Change-Id: Iac2805c0130bd2ba6cdb3c9dd997050274d58d99
Reviewed-on: https://code.wireshark.org/review/20020
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 13:45:14 +00:00
Dario Lombardo 7c0c580c4b wiretap: add cleanup routine.
The cleanup routine has been added to exit section of the applications.
Those which required a exit restyle have been patched as well.

Change-Id: I3a8787f0718ac7fef00dc58176869c7510fda7b1
Reviewed-on: https://code.wireshark.org/review/19949
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-14 10:22:20 +00:00
Peter Wu 6b84ddee83 Make Libgcrypt a mandatory dependency
Removed all guards for HAVE_LIBGCRYPT, change autotools and CMake to
error out if it is not available. Update release notes, developer
documentation and README with the new status. Clarify relation with
GnuTLS in macosx-setup.sh. Install Libgcrypt via brew script.

Motivation for this change is that many dissectors depend on Libgcrypt
and having it optional increases the maintenance burden (there have been
several compile issues in the past due to the optional status).
Furthermore, wsutil has crypto code that can be replaced by Libgcrypt.

Change-Id: Idf0021b8c4cd5db70b8766f7dcc2a8b3acbf042f
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20030
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-13 18:35:47 +00:00
Dario Lombardo ebd3dc6907 Fix exit code for non-existent file.
The patched command line utilities have been aligned to tshark
behavior.

Change-Id: I0cb764b37792e882e182681124341893b3958c59
Reviewed-on: https://code.wireshark.org/review/19580
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-08 08:10:59 +00:00
Guy Harris 037c64aa34 Clean up initialization code for programs.
Make the init_progfile_dir() call unconditionally, even if plugins
aren't supported, as that doesn't necessarily mean nobody uses the
directory containing the executable.

Report the error the same way in all programs, and free the error string
after we're finished with it.

Make the error - and the comment before the code - reflect what
init_progfile_dir() is actually doing (the goal is to get the full
pathname of the directory *containing* the executable; that's generally
done by getting the pathname of the executable and stripping off the
name of the executable, but that's won't necessarily always be the
case).  Also note for TShark that we won't be able to capture traffic,
just as we do for Wireshark (if we don't have the pathname of the
program file, we don't have a pathname to use to find dumpcap).

Have the plugin scanner just fail silently if we weren't able to get the
plugin directory path, so we don't have to worry about calling it if
init_progfile_dir() fails.

Clean up white space while we're at it.

Change-Id: I8e580c719aab6fbf74a764bf6629962394fff7c8
Reviewed-on: https://code.wireshark.org/review/19076
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-05 04:27:49 +00:00
Guy Harris ab07f8e0f8 Have a routine to do all the work of initializing libwiretap.
Have programs that use libwiretap call that routine rather than
separately calling some or all of init_open_routines(),
wtap_register_plugin_types(), and wtap_opttypes_initialize().

Also don't have routines internal to libwiretap call those.  Yes, this
means doing some initialization work when it isn't necessary, but
scattering on-demand calls throughout the code is a great way to forget
to make those calls.

Change-Id: I5828e1c5591c9d94fbb3eb0a0e54591e8fc61710
Reviewed-on: https://code.wireshark.org/review/19069
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-04 21:42:44 +00:00
Guy Harris aeb112fde8 Do GArray bounds checking.
Make sure we aren't going past the end of the array of per-interface
packet counts.

Change-Id: I6e19a5d375ebcc2193c37dc42c8f49836a5fd2c7
Reviewed-on: https://code.wireshark.org/review/17924
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-25 18:22:30 +00:00
Peter Wu 4b05159dfe capinfos: fix memleaks
Change-Id: Ib3145bb13d2a72c16f9c219fa19321e44958a30e
Reviewed-on: https://code.wireshark.org/review/17622
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-10 13:00:13 +00:00
Guy Harris 2a38dc74ed Have scan_plugins() take an argument specify what to do on load failures.
That's a less gross hack to suppress load failures due to not having
libwiretap than providing a no-op failure-message routine, as it at
least allows other code using a failure-message routine, such as
cmdarg_err() and routines that call it, to be used.

We really should put libwiretap and libwireshark plugins into separate
subdirectories of the plugin directories, and avoid even looking at
libwireshark plugins in programs that don't use libwireshark.

Change-Id: I0a6ec01ecb4e718ed36233cfaf638a317f839a73
Reviewed-on: https://code.wireshark.org/review/17506
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-05 23:27:02 +00:00
Guy Harris 3beab65515 No need to check for string option values being null.
A string option, if present, always has a value; it might be a null
*string*, but you won't get a null pointer (if the option isn't present,
it simply isn't present).

Fix some comments while we're at it.

Change-Id: I9c1420f56998a7d04de5c5cc2e92631b181f303a
Reviewed-on: https://code.wireshark.org/review/16564
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-21 00:28:18 +00:00
Guy Harris 1f8999bb96 Redo the block options APIs.
A block can have zero or more instances of a given option.  We
distinguish between "one instance only" options, where a block can have
zero or one instance, and "multiple instances allowed" options, where a
block can have zero or more instances.

For "one instance only" options:

	"add" routines add an instance if there isn't one already
	and fail if there is;

	"set" routines add an instance if there isn't one already
	and change the value of the existing instance if there is one;

	"set nth" routines fail;

	"get" routines return the value of the instance if there is one
	and fail if there isn't;

	"get nth" routines fail.

For "multiple instances allowed" options:

	"add" routines add an instance;

	"set" routines fail;

	"set nth" routines set the value of the nth instance if there is
	one and fail otherwise;

	"get" routines fail;

	"get nth" routines get the value if the nth instance if there is
	one and fail otherwise.

Rename "optionblock" to just "block"; it describes the contents of a
block, including both mandatory items and options.

Add some support for NRB options, including IPv4 and IPv6 option types.

Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e
Reviewed-on: https://code.wireshark.org/review/16444
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-14 23:02:39 +00:00
Guy Harris e53a1adf49 Always count packets per encapsulation.
Currently, for pcapng files, if all of the IDBs we've seen *so far* are
the same, we report it as the file's encapsulation type; however, we may
see IDBs of a different type in the future, so don't check for
per-packet encapsulation before counting packets of the encapsulation
type.

Change-Id: I617ddcf2963aa16e7ba58855b3e5bf326ab7dc32
Reviewed-on: https://code.wireshark.org/review/15808
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-10 07:41:04 +00:00
Guy Harris 1438d28768 Set the size of the packet counts array when we create it.
g_array_sized_new() sets the amount of *space allocated for* the array,
but doesn't actually set its *length*.

Change-Id: Ia7deab34c758c88910dfb0e246a6903301e68029
Reviewed-on: https://code.wireshark.org/review/15806
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-10 07:32:10 +00:00
Guy Harris 3ba7798cb1 Set cf_info.num_interfaces before using it.
Change-Id: I6ba5932f339ea6296dd91a6800721b11bcd4956a
Reviewed-on: https://code.wireshark.org/review/15804
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-10 07:00:21 +00:00
Guy Harris 4233e9a680 Don't assume all IDBs are available aftre we open the file.
IDBs can occur anywhere in the file, so if we see an interface ID bigger
than the number of IDBs we've see, re-fetch the interface information,
update the IDB count, and grow the packet count array as necessary.

Get the information strings for interfaces after reading the entire
file; we don't need them until then.

Change-Id: Ib6096e481e321de485710d14eadf7b5232bf0be7
Reviewed-on: https://code.wireshark.org/review/15797
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-10 03:33:07 +00:00
Guy Harris 078ab458a6 Use the locale's decimal separator for times as seconds and fraction.
We use it when printing *other* seconds-and-fraction values, as we're
just using %f, so we should use it consistently.  If you don't want
commas as decimal separators, you presumably don't want them anywhere;
if you want to standardize the way numbers are shown, set the locale to
the C locale.

This addresses one of the two problems mentioned in bug 12500; there may
be other places in the Wireshark suite where we should use the locale's
decimal separator in times.

Change-Id: I41f1c44d12ebf0f46ff678c977a955d09831b0cf
Ping-Bug: 12500
Reviewed-on: https://code.wireshark.org/review/15787
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-09 01:13:29 +00:00
Guy Harris ea4f41fb5a Check whether cf_info->shb is null before using it.
Fixes CID 1362571.

Change-Id: I8cb930bade47653d172f8c2057e3bfc446f4e9af
Reviewed-on: https://code.wireshark.org/review/15781
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-08 18:13:26 +00:00
Guy Harris f9be95c4c8 Add a routine to get an array of all instances of a string option.
Use it for OPT_COMMENT in the SHB, as there may be ore than one instance
of OPT_COMMENT in an SHB.

Also, use wtap_optionblock_get_option_string for OPT_SHB_HARDWARE,
OPT_SHB_OS, and OPT_SHB_USERAPPL; they're specified as "only one
instance allowed".

Change-Id: I23ad87e41e40b7ae1155e96c0523a6f8caad5204
Reviewed-on: https://code.wireshark.org/review/15750
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-06 01:04:55 +00:00
Guy Harris adee685089 Directly use wtap_opttypes calls to fetch SHB options.
Don't put them in the summary structure; the summary routines should
calculate summary statistics, not dig up every bit of information that
*could* appear in a summary.

Instead, have the GUI code call wtap_file_get_shb() to get the SHB
information and call wtap_optionblock_get_option_string() to fetch the
option values.

Move the option code definitions into wtap_opttypes.h, as they're used
by the API.

Change-Id: Icef11f5fb30fdc3df1bb0208aae9ed0aebaf0182
Reviewed-on: https://code.wireshark.org/review/15748
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-06 00:22:21 +00:00
Guy Harris 6f31a04278 More use of wtap_optionblock_foreach_option().
Change-Id: I5c0eb9f399e00580d8fc25c5e164b7b67353655f
Reviewed-on: https://code.wireshark.org/review/15602
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-28 19:35:26 +00:00
Guy Harris da8a6691e3 Use wtap_optionblock_foreach_option() to get the SHB options.
That way, we're not assuming that there's one, and only one, of each of
those options.

That also lets us not have to modify the options to replace linefeeds
with spaces - we just make a copy of the option string, do the
replacement, print the modified copy, and free the copy.

Change-Id: I6c51a0a5e70ac01b03b3657a8e2aef39fefcafa6
Reviewed-on: https://code.wireshark.org/review/15601
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-28 19:18:21 +00:00
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-on: https://code.wireshark.org/review/15505
Reviewed-by: Anthony Coddington <anthony.coddington@endace.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
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
Reviewed-on: https://code.wireshark.org/review/15451
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
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-on: https://code.wireshark.org/review/15328
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
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
Reviewed-on: https://code.wireshark.org/review/15002
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-21 18:59:56 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317
Reviewed-on: https://code.wireshark.org/review/14749
Petri-Dish: João Valverde <j@v6e.pt>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-04 23:05:31 +00:00
João Valverde f95976eefc Move zlib version check to wsutil
Change-Id: I0950f61e90af5bb21c0017204de0c0b509616e5c
Reviewed-on: https://code.wireshark.org/review/14747
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
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
      [-Werror,-Wused-but-marked-unused]
        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-on: https://code.wireshark.org/review/14666
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
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-on: https://code.wireshark.org/review/14636
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-26 16:19:34 +00:00
Michael Mann 08d49ff2e0 Making wiretap option blocks more generic.
This was inspired by https://code.wireshark.org/review/9729/, 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
Reviewed-on: https://code.wireshark.org/review/13667
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-23 00:39:38 +00:00
Guy Harris 71c603b2fc Clean up more includes of wtap.h.
Change-Id: Ie53b64f7e5b39a50dffb62fc0b886da71e0a3bd2
Reviewed-on: https://code.wireshark.org/review/13066
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-06 00:25:19 +00:00
João Valverde fbf2e3cf8f Make init_progfile_dir() take a function pointer [-Wpedantic]
Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98
Reviewed-on: https://code.wireshark.org/review/12557
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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
Reviewed-on: https://code.wireshark.org/review/12162
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-12 16:21:19 +00:00
Pascal Quantin fb3d38225e Update user guide for development release
Change-Id: I9b4c5ab2e98ad6daa618bcda20b53a23467e16e0
Reviewed-on: https://code.wireshark.org/review/11734
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
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
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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-on: https://code.wireshark.org/review/10220
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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
Reviewed-on: https://code.wireshark.org/review/10073
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-19 04:26:24 +00:00
Hadriel Kaplan e25562badd Pcapng: clean up Section Header Block handling
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258
Reviewed-on: https://code.wireshark.org/review/9726
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-on: https://code.wireshark.org/review/9840
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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
format.

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-on: https://code.wireshark.org/review/7442
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-28 09:15:10 +00:00
Guy Harris 65303efe4d Remove some unneeded includes of <sys/time.h>.
Change-Id: I9e4e6efa9f8c7dbff7627f8d5fc3278ab383618d
Reviewed-on: https://code.wireshark.org/review/7441
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-28 04:59:08 +00:00
Gerald Combs 95382c3afb Suppress a bunch of cast-qual warnings.
Squelch

    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-on: https://code.wireshark.org/review/7269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
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-on: https://code.wireshark.org/review/7270
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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-on: https://code.wireshark.org/review/6197
Reviewed-by: Guy Harris <guy@alum.mit.edu>
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-on: https://code.wireshark.org/review/6155
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 06:29:11 +00:00