Commit Graph

327 Commits

Author SHA1 Message Date
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 b5e698553e Report the interface when an open or an attempt to set the link-layer
header type fails, as we might be capturing on more than one interface.

Report the failing interface name in single quotes in some places where
we weren't doing so, for stylistic consistency.

svn path=/trunk/; revision=53593
2013-11-26 03:13:16 +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 ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +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
Chris Maynard 62b66aca7c Display the frame number on the packet summary line if it's one of the configured columns. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9317
#BACKPORT(1.10,1.8)

svn path=/trunk/; revision=52838
2013-10-25 12:51:16 +00:00
Jakub Zawadzki fe937ac3ad tshark: use epan_dissect_reset()
svn path=/trunk/; revision=52709
2013-10-20 12:35:55 +00:00
Chris Maynard 63e4539229 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9272
Add tshark -G column-formats report and document the missing ftypes, heuristic-decodes and plugins reports.

From me: Sort the reports.  Add modelines to epan/column.c.  Minor whitespace changes.

svn path=/trunk/; revision=52627
2013-10-15 18:27:35 +00:00
Jakub Zawadzki 6bb579ea87 Micro-optimize print_columns(): replace g_snprintf() & g_strlcat() with memcpy().
svn path=/trunk/; revision=52625
2013-10-15 18:20:59 +00:00
Jeff Morriss bcf51e8131 Fix the core dump reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9258 :
After calling wtap_close(), set the wth to NULL so we don't try to close it
again later. (The core only happens when tshark isn't keeping up with dumpcap's
file rotation.)

Wireshark still has a problem but it's a different one.

svn path=/trunk/; revision=52493
2013-10-10 14:53:19 +00:00
Michael Mann ba3e8e070a Make column "filter name" prefixed with _ws. to be the same as other "*shark application filters" created in r52462.
svn path=/trunk/; revision=52474
2013-10-09 19:43:02 +00:00
Evan Huus 8eb0bfdc5b Fix one small memory leak.
svn path=/trunk/; revision=51747
2013-09-04 12:01:09 +00:00
Evan Huus 5c851858d9 Fully deprecate read filter (-R) without two-pass (-2). It does exactly the same
thing as the display filter (-Y) in that case except with more confusing
semantics.

This also lets us fix -c in the single-pass case to unconditionally count
packets. This isn't the old behaviour (which counted them only if they passed
the read filter) but is more consistent with two-pass mode where they are
counted even if they pass the display filter, since they are counted on the
first pass and the display filter is applied on the second pass.

Anyone who wants to use -c to limit packet count conditionally on them passing a
filter should use it in tandem with -2 and -R: the read filter is applied on the
first pass before the count.

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

svn path=/trunk/; revision=51556
2013-08-28 00:56:19 +00:00
Anders Broman 71f7093cf3 Output a warning about kernel BPF JIT compiler beeing activated.
svn path=/trunk/; revision=51488
2013-08-23 05:25:30 +00:00
Evan Huus 7e59f1fce6 Move a brace outside an #ifdef, it was confusing vim's folding.
svn path=/trunk/; revision=51461
2013-08-22 02:29:32 +00:00
Evan Huus 2161550470 Don't look at packet or byte limits during the second pass of two-pass analysis.
The limits are enforced during the first pass, and frames that get dropped from
the first pass for this reason aren't available to the second pass at all, so
checking again is redundant.

svn path=/trunk/; revision=51460
2013-08-22 02:19:22 +00:00
Guy Harris da7c920853 I guess Solaris's getopt_long() "struct option" declaration doesn't have
enough cowbell^wconst; throw in a comment to squelch warnings.

svn path=/trunk/; revision=51351
2013-08-14 01:21:13 +00:00
Evan Huus d8f00e22e1 As suggested in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033
Make epan_free a no-op if the pointer is NULL. This fixes 99% of the cases
causing problems for wmem_leave_file_scope() - remove that XXX comment and add
back the assertion.

Remove the cleanup_dissection call from epan_cleanup, it doesn't make sense
there. init_dissection is only called from epan_new, so cleanup_dissection
should only be called from epan_free.

Add one missing epan_free call to tshark revealed by the above changes.

svn path=/trunk/; revision=51342
2013-08-13 22:41:34 +00:00
Guy Harris 5c0baee2a9 Don't print the packet counter when capturing if we're also printing
packet information to a terminal (which we assume is the same terminal
as the one to which the packet counts are being printed), as they get in
the way of each other.

Don't print it if we're sending the standard error to a terminal, or if
-q is specified, either.

Put all the setting of print_packet_counts together; it looks as if the
default value of print_packet_counts may have been changed to TRUE and
the code to handle -q wasn't changed to set it to FALSE if -q was
specified rather than setting it to TRUE if it wasn't specified.

svn path=/trunk/; revision=51227
2013-08-09 00:24:31 +00:00
Guy Harris d017443979 Now that we're using getopt_long(), and have some options available only
as long options, and thus identified with numbers rather than option
letters as the return value of getopt_long(), we now have to include
capture_opts.h even if we're *not* building with libpcap, to provide
#defines for those numbers.

svn path=/trunk/; revision=51115
2013-08-02 07:07:35 +00:00
Martin Kaiser 6ae3372687 fix buildbot error on OSX-10.6-x64
include capture_opts.h

svn path=/trunk/; revision=51099
2013-08-01 22:21:53 +00:00
Martin Kaiser 24c88b8007 pass --capture-comment from tshark to dumpcap
handle error cases in tshark

svn path=/trunk/; revision=51094
2013-08-01 21:09:19 +00:00
Martin Kaiser 5863aaa51b add --capture-comment to tshark's print_usage() function
make it clear that a capture comment can only be added when we
create a new file

svn path=/trunk/; revision=51091
2013-08-01 21:04:28 +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
Martin Kaiser 6c5e16185d add --capture-comment to tshark
make sure that getopt() does not permute tshark's argv[] array

svn path=/trunk/; revision=51089
2013-08-01 20:57:47 +00:00
Martin Kaiser 7cdd97b089 use getopt_long() in tshark
svn path=/trunk/; revision=51087
2013-08-01 20:45:59 +00:00
Martin Kaiser 0cbe856098 simplify argument checking for tshark
if a capture file is read, do all corresponding checks in one place

svn path=/trunk/; revision=51086
2013-08-01 20:44:50 +00:00
Guy Harris 9e77cc4bf3 Make some functions not used outside tshark.c static.
svn path=/trunk/; revision=50858
2013-07-23 23:48:51 +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
Jeff Morriss 36d3734dcb From Jim Young via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8906 :
This patch augments Wireshark's and tshark's augument usage reports (-? and
-t?) and the Wireshark and tshark man pages to list all available timestamp
options available for the -t option.

svn path=/trunk/; revision=50445
2013-07-08 16:25:13 +00:00
Evan Huus 56db3a238e Fix the last remnant of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8160
Correctly calculate delta-displayed time when using two-pass dissection with a
display filter.

svn path=/trunk/; revision=50397
2013-07-06 02:49:57 +00:00
Luis Ontanon 0bdc0efc46 get main_window_update out of the way... pass an update_cb to the capture_sync stuff
... as per the XXX comment removed from tshark.c this was a mess to keep the linker
happy... I couldn't!

I did this without even understanding whether calling main_window_update was realy
necessary in most cases. I guess nothing or more specific update cbs would be best.


svn path=/trunk/; revision=50188
2013-06-27 17:10:50 +00:00
Guy Harris 8c9edf1280 Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.

This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.

svn path=/trunk/; revision=49949
2013-06-16 00:20:00 +00:00
Chris Maynard fd1746412b Allow tshark to read a pcap file and either save it as a new pcap file or for packets to be read from the original pcap file, possibly filtered, then sent to stdout and piped to either tshark or wireshark, which can then read those filtered packets from stdin. Patch submitted by me in bug 2868, although it doesn't actually fix that bug.
#BACKPORT(1.10)

svn path=/trunk/; revision=49780
2013-06-05 03:07:57 +00:00
Jeff Morriss 7dddfb1784 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8714 :
If we're not doing dissection (in 2-pass mode) then don't try to mark frames
as depended upon: in that case epan has not been initialized so we shouldn't
be looking in the edt (and anyway without dissection there won't be any
dependent frames).

(I'm not convinced there's any reason to run 2-pass mode without dissection,
however...)

svn path=/trunk/; revision=49554
2013-05-24 15:28:04 +00:00
Guy Harris f334c4a0c8 No capture options if no libpcap.
svn path=/trunk/; revision=49519
2013-05-22 19:21:31 +00:00
Guy Harris 9ac21fd6cc AAAAAArgh. The capture_input_new_XXX routines are called from
capture_sync.c, not from capture.c, so they should be declared in
capture_sync.h, so callers that use the capture_sync.c stuff but not the
capture.c stuff - such as TShark - get the declarations and get their
implementations compared with the signatures that they should have.

Doing so points out that some of them in TShark *don't*, so fix that.

svn path=/trunk/; revision=49517
2013-05-22 19:14:52 +00:00
Guy Harris 90e2456849 Another Win32-only fix.
svn path=/trunk/; revision=49501
2013-05-22 08:59:13 +00:00
Guy Harris 8596d17d7f Pull the capture-session state information out of capture_opts and put
it into a separate capture_session structure.  capture_opts should
contain only user-specified option information (and stuff directly
derived from it, such as the "capturing from a pipe" flag).

svn path=/trunk/; revision=49493
2013-05-22 07:44:28 +00:00
Guy Harris 1ca63098ac Rename capture_opts_trim_iface() to
capture_opts_default_iface_if_necessary(), to reflect what it actually
does.

svn path=/trunk/; revision=49491
2013-05-22 04:49:31 +00:00
Guy Harris 39779a7bee Send the output of the -D and -L options to the standard output rather
than the standard error.

In Wireshark on Windows, create a console before doing so and destroy it
before exiting.  Don't do that in TShark or dumpcap, as those are
console-mode programs on Windows.

This should fix bug 8609 and still allow "wireshark -D" and "wireshark
-L" to work when the standard output isn't redirected.

svn path=/trunk/; revision=49025
2013-04-25 05:47:11 +00:00
Chris Maynard 4ac2441d7c Coalesce "-G fields2" and "-G fields3" into "-G fields", as discussed on -dev.
See: http://www.wireshark.org/lists/wireshark-dev/201304/msg00015.html

svn path=/trunk/; revision=48753
2013-04-05 21:58:43 +00:00
Evan Huus 2fba8c0f9d Update -2, -R and -Y to behave consistently as per the concensus reached on
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8223

Mention the new -Y flag and associated changes in the release notes.

svn path=/trunk/; revision=48654
2013-03-30 15:38:03 +00:00