Commit Graph

127 Commits

Author SHA1 Message Date
Bill Meier 4a1b069d3f Fix a gcc -Wshadow warning.
svn path=/trunk/; revision=32737
2010-05-10 16:51:09 +00:00
Guy Harris 547b9e48a2 The default capture buffer size is, in fact, *nominally* 1MB; however,
libpcap/WinPcap and the capture mechanism atop which they run might
either silently limit the buffer size to a smaller value or raise it to
a higher value - that's the part that's platform-dependent.

svn path=/trunk/; revision=32718
2010-05-08 00:39:07 +00:00
Guy Harris 077ff72ac1 As with the list of data link types, so with the list of interfaces; move
the code to print the machine-readable format into dumpcap, and have the
code in capture_opts.c just print the human-readable format.

svn path=/trunk/; revision=32714
2010-05-07 19:24:32 +00:00
Guy Harris 13bf4a0c55 Add routines vfprintf_stderr() and fprintf_stderr() to print to the
standard error and, in Wireshark on Windows, create a console if
necessary.  Have the cmdarg_err routines use them.

Use *fprintf_stderr() to print the output of -L, rather than using
cmdarg_err_cont(), so that we don't get extra newlines in the output (it
should look similar to the output of tcpdump).

svn path=/trunk/; revision=32711
2010-05-07 08:40:02 +00:00
Guy Harris cc05b9250d For TShark and Wireshark, get the list of link-layer types for an
interface by running dumpcap, so that if you need privileges to open an
interface, and dumpcap has those privileges, neither TShark nor
Wireshark need them.

svn path=/trunk/; revision=32710
2010-05-07 08:06:25 +00:00
Guy Harris 6ace737ae4 Add monitor mode support to TShark.
svn path=/trunk/; revision=32704
2010-05-07 01:46:38 +00:00
Guy Harris 4c5b8c5277 Instead, say that the default is platform-dependent.
svn path=/trunk/; revision=32701
2010-05-07 00:28:42 +00:00
Guy Harris 96f67d9517 Now that we support -B on various UN*X platforms as well as Windows, we
can no longer state what the default is (it's platform-dependent).

svn path=/trunk/; revision=32700
2010-05-07 00:16:52 +00:00
Gerald Combs 570a693a09 Set the timestamp seconds type to TS_SECONDS_DEFAULT at startup so we
don't abort.

svn path=/trunk/; revision=32697
2010-05-06 23:51:37 +00:00
Guy Harris 7dbbb8c572 Just check for pcap_create(); it first appeared in libpcap 1.0.0, and
pcap_set_buffer_size() did as well, so there aren't any libpcap releases
with pcap_create() but not pcap_set_buffer_size().

Only do one check for pcap_create.

svn path=/trunk/; revision=32695
2010-05-06 23:33:41 +00:00
Anders Broman f9981411f1 Checking in Stigs changes from
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475
BUT not activating the check for 
pcap_create()
pcap_set_buffer_size()
This should make it possible to build with support for setting the buffersize if not capturing 802.11 traffic.

The code for handling the 'B' option should be OK in any case.

svn path=/trunk/; revision=32688
2010-05-06 18:34:30 +00:00
Stig Bjørlykke 54101a8630 Moved command line option for seconds type to -u.
Added this option to tshark.

svn path=/trunk/; revision=32685
2010-05-06 12:31:24 +00:00
Jeff Morriss a61489c3a5 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2742 :
If the user specifies -V or -x, turn on print_packet_info (-S) so they actually
get some output in case we're also writing to a file.

svn path=/trunk/; revision=32486
2010-04-16 00:54:00 +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
Bill Meier e4d6610bd5 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
2010-01-29 16: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 29c7430fb6 Free capture filename on shutdown
svn path=/trunk/; revision=30165
2009-09-26 06:41:20 +00:00
Kovarththanan Rajaratnam 4c3ad6faa9 (Cosmetic) Reorder so that the failure message output handler appear in succession
svn path=/trunk/; revision=30162
2009-09-26 04:52:34 +00:00
Kovarththanan Rajaratnam cf8e2654b4 Remove unused 'offset' parameter
svn path=/trunk/; revision=30078
2009-09-22 20:02:51 +00:00
Kovarththanan Rajaratnam 760eb47fc1 Add initial support for "two pass analysis" in tshark. This allows tshark to arrive at the same protocol tree as the Wireshark GUI. Before this change tshark only supported a single scan over the file. This effectively means that packets cannot use data that are gathered from frames that appear after the current frame. By scanning twice we give the dissector the opportunity to make forward references.
svn path=/trunk/; revision=30076
2009-09-22 19:28:00 +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 e44cb94beb Always initialise fdata even when we don't dissect (we access some of fdatas variables)
svn path=/trunk/; revision=30070
2009-09-22 15:22:53 +00:00
Kovarththanan Rajaratnam a9a1866acf Simply some logic inside process_packet()
svn path=/trunk/; revision=30069
2009-09-22 15:06:52 +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 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 e56f27dc99 Introduce frame_data_init() and get rid of fill_in_fdata() in tshark.c
svn path=/trunk/; revision=30021
2009-09-20 17:51:16 +00:00
Kovarththanan Rajaratnam a896743c6f Make cf_mark_frame() an empty stub in tshark.c. We only need it to satisfy a linker dependency. Add a comment in tap-rtp-common.c indicating that is is wrong to refer to cf_mark_frame() which is only applicable for the GTK UI backend.
svn path=/trunk/; revision=30019
2009-09-20 16:48:52 +00:00
Kovarththanan Rajaratnam 66f528e9e4 Remove unused cf_unmark_frame() function
svn path=/trunk/; revision=30018
2009-09-20 16:30:12 +00:00
Kovarththanan Rajaratnam a7081629f0 Move verbose banner output to show_version() and tighten scope of some variables
svn path=/trunk/; revision=30017
2009-09-20 16:16:15 +00:00
Kovarththanan Rajaratnam de23d92163 Add an option to col_fill_in() to allow us to disable column expression processing. This is rarely needed. It's only needed when the user right clicks on the packet list view to generate a display filter.
svn path=/trunk/; revision=29806
2009-09-08 19:00:54 +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 6b34dad7f2 Note that the new behavior matches what Wireshark does.
svn path=/trunk/; revision=29333
2009-08-08 01:23:15 +00:00
Bill Meier 2a6163ec32 tshark: console_log_level preference now controls which log msgs are sent to stderr;
Note: This is a behavior change: 
      Given the default value for the console_log_level preference
       tshark will now show ERROR, CRITICAL and WARNING level log messages.
      Prior to this change tshark was hardwired to show only
       ERROR and CRITICAL level messages.
      Time will tell whether this change results in too much noise
       in tshark output.

svn path=/trunk/; revision=29328
2009-08-07 21:22:54 +00:00
Anders Broman cb771536df From Kovarththanan Rajaratnam:
Only fill in frame_data vals when needed.

svn path=/trunk/; revision=29203
2009-07-27 08:33:26 +00:00
Anders Broman ded297677f From Kovarththanan Rajaratnam:
Precompile custom columns filters.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3767

svn path=/trunk/; revision=29174
2009-07-23 05:48:39 +00:00
Guy Harris a3fda98056 Clarify that "-w" specifies a *pcap-format* file to be written to.
svn path=/trunk/; revision=29029
2009-07-08 19:19:06 +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
Guy Harris c73ab7dff7 Change the signature of init_progfile_dir() so the casting of the
function pointer (to main) to an argument to dladdr() is done in
init_progfile_dir() rather than its callers.

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

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

svn path=/trunk/; revision=27812
2009-03-22 00:42:33 +00:00
Stig Bjørlykke 0258be0b05 From Jakub Zawadzki:
More remove checking for NULL before g_free().

svn path=/trunk/; revision=27728
2009-03-15 18:08:46 +00:00
Bill Meier 5cb9fe859b For tshark -b -S -w: close files after reading them; fixes bug #3172;
Also: Do a bit of cleanup on related code.

svn path=/trunk/; revision=27458
2009-02-15 22:03:17 +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