Commit Graph

89 Commits

Author SHA1 Message Date
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
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Anders Broman cd7c20c9d9 Try to squelch warnings
svn path=/trunk/; revision=43000
2012-06-02 15:32:34 +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 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
Alexis La Goutte 50fe66d265 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40908
2012-02-06 22:19:07 +00:00
Guy Harris 6224e81b9f wth->phdr.pkt_encap isn't set on a seek-and-read; pass the encapsulation
directly to k12text_set_pseudo_header(), so that it's passed the right
encapsulation for seek-and-read as well as for read.  Fixes the
"malformed frames when reading some K12 text files" problem for which
we're using bug 6735.

svn path=/trunk/; revision=40508
2012-01-14 20:58:41 +00:00
Guy Harris 37ffde4018 WTAP_ENCAP_UNKNOWN should never appear as an actual encapsulation type,
and can't be supported as an output encapsulation in any case.

svn path=/trunk/; revision=40492
2012-01-14 09:00:37 +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 7694a8659d Fail if somebody tries to write out a packet with an unsupported
encapsulation.

svn path=/trunk/; revision=39944
2011-11-18 21:39:18 +00:00
Guy Harris 234d0b9614 OK, this should do it.
svn path=/trunk/; revision=39885
2011-11-16 17:13:37 +00:00
Guy Harris 8be474f776 Fix build on Windows.
svn path=/trunk/; revision=39884
2011-11-16 17:12:47 +00:00
Guy Harris 5ceeb22529 Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.

svn path=/trunk/; revision=39882
2011-11-16 16:48:02 +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
Stig Bjørlykke bf28f7247c Mark err as unused in k12text_dump_open().
svn path=/trunk/; revision=36682
2011-04-17 17:49:02 +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
Jeff Morriss 607d944d02 Don't put a 196808 byte variable on the stack: instead, malloc/free it.
Coverity 789-790.

Since we've been keeping track of how many bytes we put in the buffer,
use that value instead of calling strlen() find it again.

Also, some white space/indentation cleanup.

svn path=/trunk/; revision=36397
2011-03-29 14:29:45 +00:00
Guy Harris 4849599a13 Set *err before *err_info - that's how it's done in most other modules.
svn path=/trunk/; revision=35807
2011-02-04 08:10:08 +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
Bill Meier f1d4716d18 Fix gcc -Wshadow warnings ....
svn path=/trunk/; revision=31558
2010-01-18 21:50:50 +00:00
Bill Meier 8e885dd1df Update comment re the use of the flex statement '%option noline'
svn path=/trunk/; revision=27231
2009-01-14 20:50:39 +00:00
Tomas Kukosa 6d5e6889f9 get rid of few signed/unsigned mishmash warnings to have it with MSVC6 compilable
svn path=/trunk/; revision=27195
2009-01-08 13:28:30 +00:00
Bill Meier d7ae2fb2bb Addt'l fix for bug #1937: Fill in frame pseudo_header as req'd.
Also: comment out support for MTP_L2 and SSCOP (encapsulation types
WTAP_ENCAP_MTP2 & WTAP_ENCAP_ATM_PDUS) since I don't know how to
fill in the pseudo_headers required by packet-mtp2 and packet-atm.

svn path=/trunk/; revision=27172
2009-01-06 21:25:11 +00:00
Bill Meier 1e76a31b7a Use encap=WTAP_ENCAP_UNKNOWN if encap can't be determined from the file frame.
(The original code before SVN 27158 was correct).

svn path=/trunk/; revision=27159
2009-01-05 20:05:39 +00:00
Bill Meier 901627bfd8 Rework code somewhat; Fixes bug 1937 & various other issues.
Fixed: 
  Crash when reading a K12text file with one frame;
  Crash after selecting the last frame and then a previous frame
    after file open.
  Select of frame n (>1) immediately after file open incorrectly
    displayed the packet details & data from frame n+1.
  File ! Merge (for K12text files) did not work correctly.

Fixes:
  Essentially: clear all lexer state (look-ahead buffer, etc)
   for every file read. Also: Don't use global for keeping
   track of the current file position.
  Also: Handle *nix-style line endings as well as DOS-style.

svn path=/trunk/; revision=27158
2009-01-05 19:45:58 +00:00
Anders Broman 5d962c8c7d From Neil Piercy:
VC6 Build problem: wiretap/k12text.c includes unistd.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2851

svn path=/trunk/; revision=26161
2008-09-07 13:43:49 +00:00
Guy Harris 3ff150d6d6 wtap_read() and wtap_seek_read(), and thus the functions that it calls,
are expected to return a g_mallocated error string; that's why they fill
in a gchar **, not a const gchar **.  g_strdup() the argument to
KERROR(), so it's g_mallocated.

svn path=/trunk/; revision=25398
2008-05-30 02:34:45 +00:00
Guy Harris e0ea5fe220 Fix the types of k12text_read() and k12text_seek_read() to match what
the types of read and seek_read routines in Wiretap are supposed to be,
and get rid of the casts of pointers to those functions (type problems
should be fixed, not papered over with casts, whenver possible).

svn path=/trunk/; revision=25393
2008-05-29 23:40:12 +00:00
Anders Broman bf75c5fed2 From: Luis Ontanon
Fix errors from checkapi.

svn path=/trunk/; revision=25287
2008-05-13 19:05:03 +00:00
Bill Meier 0d4b874b44 Bug 2493: Fix (Part 2):
To prevent Windows compiler errors when using flex 2.5.35.
 Fixes "missing unistd.h" and yywrap "mismatched parameter" warnings
 [Upcoming Part 3: ignore 'signed /unsigned mismatch' errors]

svn path=/trunk/; revision=25173
2008-04-25 17:40:29 +00:00
Jeff Morriss 309f7503e5 Get rid of C++/C99 style comments--not all compilers support them
svn path=/trunk/; revision=23608
2007-11-26 18:55:17 +00:00
Guy Harris 5be4499ad1 Add a script as a front-end for Flex, to work around various problems,
such as the fact that Flex strips all but the last component of the "-o"
argument, and that it doesn't generate a header file to declare routines
the generated lexical analyzer defines.  Use that script when building
lexical analyzers, and, for each lexical analyzer, include the generated
header file in the generated analyzer.

svn path=/trunk/; revision=22446
2007-08-04 02:13:52 +00:00
Guy Harris 968d363f11 Add comments to various %option items to explain what they're doing.
Move the %options to the beginning if they weren't already there, and
put them in the same order in all files.

Add "prefix=" options to .l files that don't already have them, so we
don't have to pass a "-P" option.

Add "never-interactive" and "noyywrap" options to our lexical analyzers,
to remove extra isatty() checks and to eliminate the need for yywrap()
from the Flex library.

Get rid of %option nostdinit - that's the default.

Add .l.c: rules to Makefile.am files, replacing the rules for specific
.l files.  Have those rules all check that $(LEX) is set.

Update the address for the FSF.

svn path=/trunk/; revision=22424
2007-07-30 20:22:37 +00:00
Guy Harris 4703ca6fc4 Get rid of CR's, and add a newline at the end.
Set svn:keywords and svn:eol-style appropriately.

svn path=/trunk/; revision=21923
2007-05-24 17:02:06 +00:00
Luis Ontanon 131cecd1e8 Add a plugin interface to wiretap.
So far I've done only regression testing (the new functionality and what's in wtap-plugins.c has not yet being tested).

it is a first step in the way to have lua opening files.



svn path=/trunk/; revision=21686
2007-05-04 21:10:55 +00:00
Luis Ontanon bb7e52fcd8 will this finally get rid of the warnigs?
svn path=/trunk/; revision=21666
2007-05-03 18:32:52 +00:00
Luis Ontanon 13b1ebe574 fix warnings
svn path=/trunk/; revision=21653
2007-05-02 21:58:52 +00:00
Luis Ontanon d4fd968d50 add support for the text export format of textronix k1[25]
svn path=/trunk/; revision=21651
2007-05-02 20:09:42 +00:00