Commit Graph

62 Commits

Author SHA1 Message Date
Guy Harris b8b899fc36 From Bill Parker: fix typo.
svn path=/trunk/; revision=45457
2012-10-10 21:09:10 +00:00
Guy Harris 8c2916b5bb From Bill Parker: check for ws_fopen() failing.
From me: instead of logging the error with a macro that requires dbg_out
to be set, and giving up, set dbg_out to stderr, log the message (which
now notes that logging will be done to the standard error), and drive
on.

Part of fix for bug 7824.

svn path=/trunk/; revision=45454
2012-10-10 19:33:49 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +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
Anders Broman cd7c20c9d9 Try to squelch warnings
svn path=/trunk/; revision=43000
2012-06-02 15:32:34 +00:00
Anders Broman 2bc42dc547 Try to squelch warnings
svn path=/trunk/; revision=42998
2012-06-02 14:13:14 +00:00
Guy Harris c7ee2fb1e3 Clean up indentation.
svn path=/trunk/; revision=42427
2012-05-04 21:18:01 +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 f3c2e6087e More double-free fixes - destroy_k12_file_data() frees its argument, so
calling g_free() on that argument after calling destroy_k12_file_data()
is always an error.

svn path=/trunk/; revision=42067
2012-04-14 17:20:22 +00:00
Anders Broman f4c5e276c5 From From Evan Huus: Potential double-free while importing k12xx *.rf5 files https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7084
svn path=/trunk/; revision=42062
2012-04-14 07:53:22 +00:00
Guy Harris b6ff142f60 Add a presence flag field to the packet information structure filled in
by Wiretap, to indicate whether certain fields in that structure
actually have data in them.

Use the "time stamp present" flag to omit showing time stamp information
for packets (and "packets") that don't have time stamps; don't bother
working very hard to "fake" a time stamp for data files.

Use the "interface ID present" flag to omit the interface ID for packets
that don't have an interface ID.

We don't use the "captured length, separate from packet length, present"
flag to omit the captured length; that flag might be present but equal
to the packet length, and if you want to know if a packet was cut short
by a snapshot length, comparing the values would be the way to do that.

More work is needed to have wiretap/pcapng.c properly report the flags,
e.g. reporting no time stamp being present for a Simple Packet Block.

svn path=/trunk/; revision=41185
2012-02-25 23:24:34 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +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 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
Chris Maynard 7f06b2e217 Wrap actual_len inside #ifdef DEBUG_K12 to avoid gcc 4.6.0 warning reported by
Kaul: http://www.wireshark.org/lists/wireshark-dev/201104/msg00170.html

svn path=/trunk/; revision=36710
2011-04-18 20:03:32 +00:00
Guy Harris 2b8ebd389b "This file format can't be written to a pipe" and "this file format
can't be saved in compress form" are both equivalent to "this file file
format requires seeking when writing it".  Change the "can compress"
Boolean in the file format table to "writing requires seeking", give all
the entries the proper value, and do the checks for attempting to write
a file format to a pipe or write it in compressed format to common code.

This means we don't need to pass the "can't seek" flag to the dump open
routines.

svn path=/trunk/; revision=36575
2011-04-12 00:44:44 +00:00
Guy Harris 7fa6d929cf From Jakub Zawadzki: fix the type of an argument.
svn path=/trunk/; revision=36492
2011-04-06 06:59:19 +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
Guy Harris d63741d566 Add some information based on a Tektronix manual whose name popped up in
an email I found when looking for some other stuff and which I then
found with a Google search.

svn path=/trunk/; revision=35898
2011-02-10 18:27:39 +00:00
Guy Harris f5bfa67b11 Set the error code and additional information string in more cases.
svn path=/trunk/; revision=35809
2011-02-04 09:45:39 +00:00
Guy Harris 194cfe2d2f Don't use fwrite directly when writing a dump file; call it through
wtap_dump_file_write().  Replace various wrappers around fwrite() with
wtap_dump_file_write(), or at least make the wrappers call
wtap_dump_file_write().

svn path=/trunk/; revision=33116
2010-06-06 22:19:30 +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 5c224bdd74 Signed vs. unsigned fix.
svn path=/trunk/; revision=28119
2009-04-22 03:49:45 +00:00
Guy Harris ad33ca6c2f Clean up some 64-bit issues.
svn path=/trunk/; revision=28117
2009-04-22 03:07:37 +00:00
Gerald Combs db3e983b04 Add a check to make sure we don't try to allocate a huge buffer. If
we get an improper buffer length, throw an error instead of
aborting. Clean up the debugging code.

svn path=/trunk/; revision=27918
2009-03-31 22:51:59 +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
Gerald Combs cc739fecb0 P64 fixes.
svn path=/trunk/; revision=27683
2009-03-09 21:18:55 +00:00
Bill Meier df62772320 Change a a remaining eth_fopen to ws_fopen (used only under an #if debug).
svn path=/trunk/; revision=27659
2009-03-08 16:28:20 +00:00
Guy Harris 9d1b5335ac g_ascii_strdown() and g_ascii_strup(), unlike g_strdown() and g_strup(),
do *not* modify the string handed to them - they g_mallocate a new
string and return it.

Create routines that *do* ASCII-only case mapping in place, and use them
instead.

Clean up indentation.

svn path=/trunk/; revision=26131
2008-09-03 19:14:52 +00:00
Luis Ontanon 42c3239a1a luis.ontanon@gmail.com => luis@ontanon.org
svn path=/trunk/; revision=25937
2008-08-05 21:03:46 +00:00
Stig Bjørlykke cb91244d0b Fixed some "shadowed variables", as pointed out by John Smith.
svn path=/trunk/; revision=25539
2008-06-23 20:06:20 +00:00
Martin Mathieson 7e40100fb3 From Anders: Checkapi enabled for wiretap and more functions converted.
svn path=/trunk/; revision=25257
2008-05-08 09:37:11 +00:00
Jeff Morriss 75849c12f1 s/%ll/%" G_GINT64_MODIFIER "/g
svn path=/trunk/; revision=24181
2008-01-24 21:57:13 +00:00
Sake Blok 6bec9d3d9e From tmiller@hcjbtech.org : Spelling error on GDS DB protocol dissector: "Buffer lenght:"
(recursively grepped through the source and corrected all occurences, even 
the ones just in comments)



svn path=/trunk/; revision=23211
2007-10-16 23:42:33 +00:00
Jeff Morriss 853e791444 Change more fopen() to eth_fopen() to finish fixing bug 1827:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1827

Update README.developer to tell developers not to use fopen() and friends
directly.

svn path=/trunk/; revision=23206
2007-10-16 15:43:18 +00:00
Bill Meier f4e9824c46 Add error checking for fwrites; replacement for the 2nd of the patches provided in bug #1864
svn path=/trunk/; revision=23015
2007-09-28 17:22:03 +00:00
Luis Ontanon d24ceffe73 Fix coverity bug 244, [WS Bug 1649]
svn path=/trunk/; revision=22091
2007-06-13 19:05:03 +00:00
Guy Harris 5713f53652 Explicitly mark new_k12_file_data() as taking no arguments - in C89, at
least, "int foo()" defines or declares an old-style function, not one
with no arguments.

svn path=/trunk/; revision=21488
2007-04-21 22:57:22 +00:00
Luis Ontanon 36e6827984 There are odd packet records in k15 generated files where the interface record does not match any given one.
I noticed that these records have the first byte changed so When a lookup fails mask the byte and lookup again.


svn path=/trunk/; revision=21303
2007-04-02 22:17:15 +00:00
Ulf Lamping f953c1b000 fix another warning
svn path=/trunk/; revision=21079
2007-03-21 02:47:53 +00:00
Ulf Lamping 77ec324774 set compiler option "treat warnings as errors" - to prevent new warnings for wiretap
remove all compiler warnings:
a) prevent wrong malloc/free definitions by lex/yacc generated files
b) add int/time_t casts - MSVC2005 is more "sensitive" about this than MSVC6

svn path=/trunk/; revision=21078
2007-03-21 01:32:50 +00:00
Luis Ontanon ebf1dd00ce rename a variable.
svn path=/trunk/; revision=21045
2007-03-17 17:55:19 +00:00
Luis Ontanon 5e2ebee66a K15 final:
add another interface record type with the very same arch than the "old" one.

now I can read all the K15 files I got.

svn path=/trunk/; revision=21044
2007-03-17 17:40:21 +00:00
Luis Ontanon 55d05abf5e K15 phase 1
be able to read files with records larger than 0x2000 bytes

this fixes http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=532

svn path=/trunk/; revision=21043
2007-03-17 14:56:04 +00:00
Luis Ontanon 9be42ac4dc Major cleanup of debug code and whitespace changes.
svn path=/trunk/; revision=21013
2007-03-10 02:04:57 +00:00
Luis Ontanon 7432291121 From: Kriang Lerdsuwanakij
In the attached patch, the K12 wiretap now saves the content of record
after captured packet data. The K12 dissector then could extract them and provide
useful information to properly dissect FP frames (user plane of UTRAN Iub
interface).



svn path=/trunk/; revision=20749
2007-02-08 17:35:03 +00:00
Luis Ontanon a84df38651 from:
Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 	

I discovered that Wireshark K12xx detects the type of input (E1 timeslot or ATM)
based on the extra information. My previous patch to enable Wireshark to open
K12xx files with no extra information (extra_len equals 0 in SRCDEST record)
failed to give later dissectors the input type.

Attached is the patch to correct this for ATM PVC. It adds VPI/VCI/CID information
for display in the dissected tree (in k12_open function). k12_read and k12_seek_read
are also made more robust. These are reverse engineered based on hexeditor
and constants found in tektronix configuration file. Please apply the patch.


svn path=/trunk/; revision=20705
2007-02-04 02:13:12 +00:00
Luis Ontanon 6a2d87516a from Kriang Lerdsuwanakij
I found out the reason Wireshark refuses to read some .rf file I have.
Those files have zero extra_len in SRCDEST header structure. See the
attached file for example. It was created by selecting some frames from
a larger .rf5 file (within Tektronix's own reader) and save as a
separate file.


svn path=/trunk/; revision=20579
2007-01-28 01:24:20 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Ulf Lamping c3187174bf replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32).
to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place.

deleted related things from config.h.win32

As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon.

svn path=/trunk/; revision=16403
2005-11-06 22:43:25 +00:00