Commit Graph

100 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
Guy Harris 847257a27d Make a never-changed table const.
svn path=/trunk/; revision=51002
2013-07-29 07:30:34 +00:00
Guy Harris 7f7733579c Don't cast away constness.
svn path=/trunk/; revision=50853
2013-07-23 23:25:04 +00:00
Guy Harris f13ba97806 Fix some pointer-signedness (well, signedness of what the pointer points
to) warnings.

svn path=/trunk/; revision=50104
2013-06-21 02:59:54 +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
Guy Harris e6e5aa7fa4 wth->priv is always set in the open routine; no need to check that it's
non-null.

svn path=/trunk/; revision=49338
2013-05-16 18:30:24 +00:00
Guy Harris d9d8174f12 Pull all the post-processing for a parsed line into a common routine,
used in both the seek and seek_read routines.

(And, yes, the time stamp *is* supposed to be filled in by seek_read
routines.)

Pull some now-used-only-once routines into the new routine.

svn path=/trunk/; revision=49335
2013-05-16 18:27:27 +00:00
Anders Broman 85973068cc From beroset:
remove C++ incompatibilities

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

svn path=/trunk/; revision=48038
2013-03-03 17:14:19 +00:00
Martin Mathieson cf15301cbf Add support for reading/writing 'sprint' lines from test scripts.
svn path=/trunk/; revision=47686
2013-02-15 23:43:30 +00:00
Guy Harris 41e6e0f7e6 Always check the return value of read_new_line().
svn path=/trunk/; revision=46821
2012-12-28 09:10:18 +00:00
Guy Harris 5996b49c53 Squelch implicit 64-bit-to-32-bit conversion warnings.
svn path=/trunk/; revision=46650
2012-12-21 03:32:16 +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
Martin Mathieson 5809e2cfdf Some improvements after looking at profile of large reordercap run.
- speed up writing timestamp by avoiding g_snprintf()
- avoid call to strstr()
- don't use g_snprintf() for writing a liternal string
- avoid atio() for single-digit strings
- avoid some strcmp() calls where the release number at the end wasn't
  important

svn path=/trunk/; revision=45091
2012-09-24 10:29:19 +00:00
Martin Mathieson 32ed74e83d Shouldn't set the time in seek_read() after all. At least the pcap
support doesn't.

svn path=/trunk/; revision=45022
2012-09-20 10:21:04 +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
Martin Mathieson a59117bd87 Fix a couple of dumping issues seen while working on 'reorder'.
svn path=/trunk/; revision=45003
2012-09-19 09:24:11 +00:00
Martin Mathieson d2b7806d3f Avoid some calls to strlen() by remembering return value from
g_strlcpy().

svn path=/trunk/; revision=44608
2012-08-21 17:19:05 +00:00
Martin Mathieson d29d88e687 Ignore '\r' which will be found at the end of a line when a windows host
writes a log.

Also re-line-up args under function definitions.

svn path=/trunk/; revision=44444
2012-08-11 15:19:25 +00:00
Martin Mathieson 7901962209 Fix another uninitialised bug (the same bug in _read() I fixed
yesterday, also in _seek_read()).  Spotted by running 'valgrind-wireshark.sh -2'.

svn path=/trunk/; revision=44043
2012-07-26 13:59:20 +00:00
Martin Mathieson ca8d59f834 Initialize a byte to avoid more valgrind warnings.
svn path=/trunk/; revision=44019
2012-07-25 22:56:08 +00:00
Martin Mathieson 2f3a057bca Don't write one payload byte too many. Spotted by valgrind!
svn path=/trunk/; revision=44016
2012-07-25 21:53:39 +00:00
Martin Mathieson e7b8e93e27 memcpy() is quite a bit faster than g_strlcpy()!
svn path=/trunk/; revision=43675
2012-07-11 20:53:24 +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 2bc42dc547 Try to squelch warnings
svn path=/trunk/; revision=42998
2012-06-02 14:13:14 +00:00
Gerald Combs bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +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
Martin Mathieson 722c68ec90 Fix a typo (just clearing my client out before I start doing diffs).
svn path=/trunk/; revision=42077
2012-04-15 01:38:12 +00:00
Martin Mathieson f0798dabd1 Set up table to help with ascii-hex -> hex conversion in advance to
avoid testing static for every conversion.

svn path=/trunk/; revision=41900
2012-04-03 01:49:27 +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
Bill Meier 727046dc35 Tighten up format string used for date/time parse;
Use 'static' in function definitions to match function declarations;
Do minor reformatting.

svn path=/trunk/; revision=40305
2011-12-27 18:54:32 +00:00
Martin Mathieson c5cfc416a1 Skip extra info if present (IP with LTE PDCP threading info).
svn path=/trunk/; revision=38983
2011-09-13 12:14:24 +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
Martin Mathieson fe28dc854a Speed up (slightly) reading of long text lines.
svn path=/trunk/; revision=37989
2011-07-12 10:49:22 +00:00
Martin Mathieson ece553d8d0 Change the way we scan past characters before the direction indicator.
svn path=/trunk/; revision=37940
2011-07-08 16:08: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
Martin Mathieson f558138026 Avoid having large buffers on the stack (as noted in VS Code Analyzer warnings).
svn path=/trunk/; revision=36202
2011-03-16 22:53:41 +00:00
Gerald Combs 8af7080001 Fix errors found by the Visual C++ analyzer.
svn path=/trunk/; revision=35954
2011-02-16 00:44:12 +00:00
Martin Mathieson 7a0f12239c Support FP_R8 over ATM, plus a couple of other tidying-ups.
svn path=/trunk/; revision=35373
2011-01-05 14:36:48 +00:00
Guy Harris e81797342e Make it a bit clearer what's going on - ASCII '0' has the decimal value
48, and that's converting '0'-'9' to 0-9.

svn path=/trunk/; revision=34326
2010-10-02 08:04:15 +00:00
Martin Mathieson b3f57106d4 It makes (slightly) more sense for comments to be "sent" by the context than "received".
svn path=/trunk/; revision=33552
2010-07-16 13:52:18 +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
Stig Bjørlykke 7d26a109cd Removed an unused assignment.
svn path=/trunk/; revision=30892
2009-11-09 14:24:02 +00:00
Guy Harris ce6bcff318 Note in comments that the dct2000_file_externals_t structure is used for
more than just dumping, indicate what stuff is used for dumping, and
note that it probably shouldn't be used for that (one should not have to
have a Catapult 2000 input file in order to write a Catapult 2000 output
file).

svn path=/trunk/; revision=30719
2009-10-26 19:20:50 +00:00
Martin Mathieson 5c33e9f525 Try to fix win64 buildbot. Both fgets() and gzgets() take an int for the length.
svn path=/trunk/; revision=30709
2009-10-26 13:38:23 +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
Guy Harris 524d9c2b8b Global variables considered harmful - we don't want to rule out two
threads reading from two different wtap_t's in different threads.

file_externals_table considered unnecessary - a wtap_t has a member
specifically intended to point to private data.

Clean up indentation.

svn path=/trunk/; revision=30707
2009-10-26 09:36:53 +00:00
Martin Mathieson 64e4ee759d Formatting changes only.
svn path=/trunk/; revision=30704
2009-10-26 07:57:38 +00:00
Anders Broman d52f502b66 Fix:
Error: Found prohibited APIs in catapult_dct2000.c: sprintf,strcpy

svn path=/trunk/; revision=30701
2009-10-26 05:50:05 +00:00
Martin Mathieson 6dfb4d1f71 Add support for showing/filtering/resaving logged LTE strings.
svn path=/trunk/; revision=30700
2009-10-26 00:04:27 +00:00