Commit Graph

75 Commits

Author SHA1 Message Date
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
Guy Harris b2408ca1a3 Squelch warnings - none of those strings will be so long that the
difference between an int and a gsize/size_t matters.

svn path=/trunk/; revision=27637
2009-03-07 05:11:15 +00:00
Martin Mathieson 887b68c64e Some context names now do include '-', so allow it.
svn path=/trunk/; revision=27562
2009-02-27 11:18:15 +00:00
Martin Mathieson 89c72aba05 Fix a bug where a space character wasn't being written back to save files.
svn path=/trunk/; revision=27198
2009-01-08 16:29:15 +00:00
Martin Mathieson fb430597b7 Allow really long lines.
svn path=/trunk/; revision=26429
2008-10-13 16:24:42 +00:00
Martin Mathieson c6dc7911df Fix subtle bugs introduced by recent change to safer APIs.
I was counting the length without the terminating NULL, and didn't want one to be written to the string and copied into the file.








svn path=/trunk/; revision=25383
2008-05-27 10:24:25 +00:00
Martin Mathieson ec60070b2c Enable FP R7 support.
This commit adds a header file needed by my PDCP dissector.
(not yet ready to be added).

svn path=/trunk/; revision=25326
2008-05-20 10:08:28 +00:00
Martin Mathieson 723f40845e Use g_strlcpy() rather than strcpy(), strncpy().
svn path=/trunk/; revision=25256
2008-05-08 09:17:04 +00:00
Martin Mathieson 2f5189f014 Allocate size of data pointed to (64 bits) rather than size of pointer to data...
svn path=/trunk/; revision=24765
2008-04-04 04:44:59 +00:00
Stig Bjørlykke 47d744b59d More rewrite of prohibited APIs (sprintf, strcpy, strcat).
svn path=/trunk/; revision=24258
2008-02-03 15:38:20 +00:00
Martin Mathieson 6823dd10fa Some comments and formatting.
svn path=/trunk/; revision=23473
2007-11-16 22:56:56 +00:00
Bill Meier 90160079c0 Fix whitespace of newly added lines to match rest of file
svn path=/trunk/; revision=22965
2007-09-25 20:34:06 +00:00
Bill Meier 151a51d956 Add error checking for fwrites; replacement for one of patches provided in bug #1864
svn path=/trunk/; revision=22964
2007-09-25 19:59:50 +00:00
Martin Mathieson 0a5437dc33 Add "igmp" -> "ip" mapping.
svn path=/trunk/; revision=22430
2007-07-31 13:53:45 +00:00
Martin Mathieson 2cf2fed06a More space needed for wimax frames.
svn path=/trunk/; revision=22395
2007-07-24 15:15:02 +00:00
Guy Harris 90ab61d9f7 Fix another cast of the argument to a ctype.h macro.
svn path=/trunk/; revision=22305
2007-07-14 00:29:03 +00:00
Guy Harris 3ccd39aec7 Fix more ctype.h calls - casting to "int" suppresses the warning, but
doesn't fix the problem, as the sign extension is still done; you have
to cast to "guchar".

svn path=/trunk/; revision=22304
2007-07-13 23:20:02 +00:00
Guy Harris 7e95109118 "isdigit()" doesn't need to be cast to "int".
Its argument, however, needs to be cast to "guchar", so that if the
high-order bit is set, it doesn't get sign-extended.

svn path=/trunk/; revision=22303
2007-07-13 23:18:04 +00:00
Martin Mathieson c4ebb075e7 Worked out properly the silly way aal header is encoded!
svn path=/trunk/; revision=22300
2007-07-13 15:51:34 +00:00
Martin Mathieson 1d477c802c - Map gre -> IP
- Change a value string value to help an easily-frightened colleague

svn path=/trunk/; revision=22224
2007-06-29 16:16:57 +00:00
Martin Mathieson 1b8fccbc9d Don't create & leak a hash table during unsuccessful open()
svn path=/trunk/; revision=22150
2007-06-21 17:30:13 +00:00
Martin Mathieson 2d6388599a Work with isdn_l2.
svn path=/trunk/; revision=21986
2007-05-29 14:38:40 +00:00
Guy Harris 267a2cbf02 Print a gint64 the right way.
svn path=/trunk/; revision=21976
2007-05-29 06:16:24 +00:00
Sebastien Tandel 76729e5d0f From David Howells :
Fix compilation failures when building wireshark-0.99.6-SVN-21916 on an
x86_64-unknown-linux-gnu target with gcc version 4.1.2 20070403 (Red Hat
4.1.2-8).

The failures fall into two categories:
  (1) Casts between pointers and 32-bit integers without an intermediary cast
via 'long' or 'unsigned long'.  This results in a compiler warning complaining
about casts between a pointer and an integer of a different size.
  (2) Passing values to "%lld" or similar printf-style format options that the
compiler thinks are a different size.  Such values need to be cast to 'long
long' or 'unsigned long long'.

svn path=/trunk/; revision=21975
2007-05-29 02:43:18 +00:00
Jörg Mayer b7755fb4e4 Fix some (incorrect but unforseeable)
"might be used uninitialized" warnings.

svn path=/trunk/; revision=21862
2007-05-21 16:16:18 +00:00
Martin Mathieson 47a9c22ad4 mipv6 -> ip
svn path=/trunk/; revision=21741
2007-05-10 15:29:38 +00:00