Commit Graph

121 Commits

Author SHA1 Message Date
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
Anders Broman 20108d7950 Get rid of struct addrinfo, use the hastables for name resolution instead.
svn path=/trunk/; revision=52176
2013-09-22 19:40:02 +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
Anders Broman 05a8c94ddf From beroset:
implemented wtap_dump_file_seek() and _tell()

implemented the previously declared but unimplemented wtap_dump_file_seek() and wtap_dump_file_tell() functions and used them in the seven files that had previously used a plain ftell or fseek and added error checking as appropriate.  I also added a new error WTAP_ERR_CANT_SEEK_COMPRESSED and put it next to WTAP_ERR_CANT_SEEK causing renumbering of two of the existing error codes.

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

svn path=/trunk/; revision=48348
2013-03-17 09:20:13 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Balint Reczey aa659985a5 Export libwiretap symbols using WS_DLL_PUBLIC define
TODO: hide flex-generated functions

svn path=/trunk/; revision=47948
2013-02-28 19:35:59 +00:00
Guy Harris 9f5431f1d9 Wrap lines a little differently.
svn path=/trunk/; revision=45654
2012-10-18 23:18:23 +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 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
Guy Harris 33bb54a945 file_seek() used to be a wrapper around fseek() or gzseek(), both of
which could use lseek() and were thus expensive due to system call
overhead.  To avoid making a system call for every packet on a
sequential read, we maintained a data_offset field in the wtap structure
for sequential reads.

It's now a routine that just returns information from the FILE_T data
structure, so it's cheap.  Use it, rather than maintaining the data_offset
field.

Readers for some file formats need to maintain file offset themselves;
have them do so in their private data structures.

svn path=/trunk/; revision=42423
2012-05-04 16:56:18 +00:00
Guy Harris c7575ff095 Put the pseudo-header information for Veriwave packets into the buffer
in little-endian byte order, as that's what the dissector expects.  Add
a pletohl() macro for that purpose.

Fix comments (the Veriwave code is *not* writing data to a file!) and
clean up indentation.

svn path=/trunk/; revision=42255
2012-04-26 08:45:48 +00:00
Guy Harris 81209da65b Fix some indentation errors from the previous change.
svn path=/trunk/; revision=42118
2012-04-18 00:54:11 +00:00
Guy Harris e3053e0105 Get rid of tabs, so we don't have to worry about 4-space vs. 8-space tabs.
svn path=/trunk/; revision=42117
2012-04-18 00:51:18 +00:00
Anders Broman c7f1a431d2 Handle reading and writing of multiple IDB:s, write IDB options and use correct lengt for strings, handle more than 100 char comment
svn path=/trunk/; revision=41082
2012-02-20 20:15:51 +00:00
Anders Broman 0b6b3937ab Make it possible to get inforamtion from the read SHB to the one to write out.
svn path=/trunk/; revision=41032
2012-02-15 19:44:16 +00:00
Anders Broman 1bc9a08e41 White space changes.
svn path=/trunk/; revision=41015
2012-02-13 17:34:56 +00:00
Anders Broman 8aea738cda Add the abillity to read and write option comments unedited.
This is POC we may want to have more efficient use of the frame data
structure etc. But this allows for work to be done on the GUI to actually add comments.

svn path=/trunk/; revision=40969
2012-02-11 12:34:39 +00:00
Anders Broman 7be6e75c13 Add pcapng variables to wtap_pkthdr.
svn path=/trunk/; revision=40947
2012-02-09 22:24:00 +00:00
Guy Harris e4a193fe5e Replace wtap_file_extensions_string() with a routine that returns a
GSList of extensions for a file type, including extensions for the
compressed versions of those file types that we can read.

svn path=/trunk/; revision=40623
2012-01-21 08:59:21 +00:00
Guy Harris e4658ced93 Rename pletonll() to reflect what it actually does, namely convert a
host-byte-order 64-bit integral quantity to little-endian byte order.

svn path=/trunk/; revision=39900
2011-11-17 09:24:15 +00:00
Guy Harris 31f61b75b2 A new macro needed by the WTAP_ENCAP_PER_PACKET support for writing
NetMon files.

svn path=/trunk/; revision=39899
2011-11-17 09:04:54 +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
Guy Harris e9fc1b72aa Use guint8 rather than guchar for raw octets and pointers to arrays of
same.

Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for
ATM (by looking at the VPI, VCI, and packet data, and guessing) and
Ethernet (setting the FCS length appropriately).  Use it for both pcap
and pcap-ng files.

svn path=/trunk/; revision=38840
2011-09-01 09:43:10 +00:00
Guy Harris 06256dfe5b The only place where we care about zlib is file_wrappers.c; include
<zlib.h> there, rather than wtap-int.h.  That obviates the need to
include config.h earlier in ascend_scanner.l; revert the previous
change, so we don't require a version of Flex that supports %top.

svn path=/trunk/; revision=37640
2011-06-09 22:46:00 +00:00
Balint Reczey 311f9acfd5 Fix wiretap headers to allow error-free ABI dumping.
svn path=/trunk/; revision=37543
2011-06-04 21:20:57 +00:00
Chris Maynard 63b50fe2ee Declare the snapshot_length as unsigned.
svn path=/trunk/; revision=37479
2011-05-31 15:27:48 +00:00
Guy Harris 3de2b1be74 Get rid of the fd member of a wth structure; the FILE_T's in that
structure include a file descriptor.  Add a wtap_fstat() for the file
readers that use file times to generate time stamps (we really need a
way to say "this file has no time stamps" or "this file has only
relative time stamps).

svn path=/trunk/; revision=37026
2011-05-09 08:12:26 +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 b28ee8b331 From Jakub Zawadzki: speed up random access to gzipped files, as per the
zran.c example in the zlib source.

This means that problems in the file's contents might not be reported
when a packet is read, as long as there's no problem in the contents of
the file up to the last bit of compressed data for the packet; we now
check for errors after finishing the sequential read of the file, at
least in some programs, so that shouldn't be an issue (the other
programs need to be changed to do so as well).  This is necessary in
order to be able to read all the packets we saw in the sequential pass;
it also lets us get a few more packets from truncated files in some
cases.

svn path=/trunk/; revision=36577
2011-04-12 02:40:14 +00:00
Guy Harris f27f61ac9e Move the definition of the structure pointed to by a FILE_T into
wiretap/file_wrappers.c; nothing outside of file_wrappers.c needs to
know what it looks like, it just passes around pointers to it.

svn path=/trunk/; revision=36538
2011-04-10 16:53:32 +00:00
Guy Harris de938dddce Just make the fh member of a wtap_dumper_t a void * for now, and, in all
calls that use it, cast it to whatever it's supposed to be.  Making it a
gzFile means you can't use any stdio macros that reach inside the
structure; making it a FILE *, as it used to be, amounts to trying to
use a FILE * as a void * if we're writing a compressed file out.

svn path=/trunk/; revision=36521
2011-04-08 17:42:20 +00:00
Guy Harris ab261a3281 From Jakub Zawadzki:
Steal file_wrappers functions from zlib v2.

svn path=/trunk/; revision=36513
2011-04-08 00:28:37 +00:00
Guy Harris 4c93827e34 From Jakub Zawadzki:
file_read(buf, bsize, count, file) macro is compilant with fread
function and takes elements count+ size of each element, however to make
it compilant with gzread() it always returns number of bytes.

In wiretap file_read() this is not really used, file_read is called
either with bsize set to 1 or count to 1.

Attached patch remove bsize argument from macro.

svn path=/trunk/; revision=36491
2011-04-06 06:51:19 +00:00
Gerald Combs fcf51fc73b Add initial pcapng name resolution record support. Wireshark has read
support; TShark has read+write support. Additionally TShark can read a
"hosts" file and write those records to a capture file.

This uses "struct addrinfo" in many places and probably won't compile on
some platforms.

svn path=/trunk/; revision=36318
2011-03-24 22:47:57 +00:00
Guy Harris ae3049a04f Move the seekback stuff out of esc_read() to the one place where it's
done.

Use the wtap_dump_file_ routines to write out capture files, and check
for errors.

Use the phton macros, when available, to translate to big-endian byte
order.  Add a new phton24() macro.

Clean up indentation.

svn path=/trunk/; revision=33114
2010-06-06 19:37:49 +00:00
Guy Harris 1bf478fdef Rename wtap_dump_file_write_all() to wtap_dump_file_write(), and have
everybody use it; the places using the old wtap_dump_file_write() were
using it in the same way the old wtap_dump_file_write_all() did.

That also lets us get rid of wtap_dump_file_ferror().

Also, have the new wtap_dump_file_write() check for errors from
gzwrite() and fwrite() differently - the former returns 0 on error, the
latter can return a short write on error.

svn path=/trunk/; revision=33113
2010-06-06 19:14:32 +00:00
Guy Harris 21a210b777 From Chris Maynard:
Support PPP-over-USB.

	Don't remove the USB pseudo-header from the packet data for
	Linux USB packets, just byte-swap it if necessary and have the
	USB dissector fetch the pseudo-header from the raw packet data.

	Update USB language ID values.

svn path=/trunk/; revision=32534
2010-04-21 20:51:22 +00:00
Guy Harris 17392a865a Move the definitions of all the private data structures out of
wtap-int.h, and change the unions of pointers to those private data
structures into just void *'s.

Have the generic wtap close routine free up the private data, rather
than the type-specific close routine, just as the wtap_dumper close
routine does for its private data.  Get rid of close routines that don't
do anything any more.

svn path=/trunk/; revision=32015
2010-02-26 07:59:54 +00:00
Guy Harris 756bf60020 Move the definition of the private data structure from wtap-int.h to the
iSeries capture processor.  Parse the start date into year/month/day at
the time we see it, rather than for every packet; that means we don't
need to allocate a buffer to hold the date as a string (a buffer which
we weren't ever freeing).

svn path=/trunk/; revision=31981
2010-02-24 08:39:19 +00:00
Guy Harris dde6d97f63 Define the private data structures for some particular capture file
types in the modules for those capture file types, not in wtap-int.h, so
wtap-int.h doesn't have to change when the code to handle that
particular capture type changes, or a new capture file type is added.
(Ultimately, we should do this for all the private data structures.)

svn path=/trunk/; revision=31974
2010-02-24 07:21:17 +00:00
Martin Mathieson bb78c91111 Get rid of capture.catapult_dct2000, move start time of capture into file_externals instead.
Thanks Guy for helping to simplify this file!

svn path=/trunk/; revision=30708
2009-10-26 12:17:11 +00:00
Michael Tüxen a41d93603c Add support for writing pcapng files with multiple
encapsulations.
This fixes a bug reported by Sake during the
Sharkfest 09. Thanks for providing a
Netscreen tracefile with multiple link layer
types.
This patch will be included in Wireshark 1.2.1
and higher.

svn path=/trunk/; revision=28862
2009-06-27 15:20:44 +00:00
Michael Tüxen 98a4696773 Fix for bug 3539: Address as signess issue for fcs_len.
Bugfix scheduled for 1.2.1.

svn path=/trunk/; revision=28768
2009-06-18 18:43:36 +00:00
Stig Bjørlykke c9b492a422 From Ravi Kondamuru via bug 3457:
Add support to read citrix netscaler capture file format.

From me:
- Renamed packet-ns.c to packet-nstrace.c
- Rewrote to not use "goto" in netscaler.c
- Moved dissecting of coreid

svn path=/trunk/; revision=28564
2009-06-01 17:23:38 +00:00
Gerald Combs 3c6b6dc1a3 From Kovarththanan Rajaratnam via bug 2680:
Currently Wireshark doesn't support saving
WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR files as btsnoop files.

svn path=/trunk/; revision=28442
2009-05-22 00:05:19 +00:00
Michael Tüxen cd369fcbf8 Use a dynamic glib array instead of a static C array for
storing the interface specific data.

svn path=/trunk/; revision=28264
2009-05-03 17:43:41 +00:00
Michael Tüxen 3b23d3dbd5 Whitespace change.
svn path=/trunk/; revision=28252
2009-05-02 18:24:44 +00:00
Gerald Combs cc739fecb0 P64 fixes.
svn path=/trunk/; revision=27683
2009-03-09 21:18:55 +00:00
Bill Meier 8afa208ffb Windows build: #include winsock2.h only when needed.
#include winsock2.h pulls in about 90 distinct .h files
and about 140 total .h files. 
Currently winsock2.h is (mostly unnecessarily) included
for each dissector via packet.h/wtap.h.
This patch removes #include winsock2.h from wtap.h and 
then includes winsock2.h (or windows.h) in the 
few specific places required. 
With this patch, my Windows Wireshark build takes 
about 30% less time.


svn path=/trunk/; revision=26535
2008-10-24 00:42:09 +00:00
Guy Harris c1e833bdef Do the time calculations with 64-bit integers, rather than in floating
point, so we don't have issues with numbers not being exactly
representable; that makes it less likely that the change described below
will change a time stamp if it's not fixing the time stamp (i.e., if
time_day is 0).

The Sniffer manual "Expert Sniffer(R) Network Analyzer Operations,
Release 5.50" says that a frame2_rec has a time stamp with an 8-bit
time_high field and an 8-bit time_day field.  Interpreting the time
stamp that way fixes the time stamps in at least some captures; see, for
example, bug 2251.

Fix/update some comments (for example, the Sniffer documentation is no
longer at that URL).

svn path=/trunk/; revision=24296
2008-02-10 18:29:05 +00:00