Commit Graph

317 Commits

Author SHA1 Message Date
Luke Mewburn 8421af3256 Rename nettrace3gpp324423 to 3gpp32423
Use "3gpp32423" instead of "nettrace3gpp324423":
- There were too many "4"s in the previous name ("324423" vs "32423").
- "nettrace" isn't an official name, per 3GPP TS 32 423
- It's shorter.

Change-Id: Ic981d0351a3014fb79702955ebef7b13f6ce4a2e
Reviewed-on: https://code.wireshark.org/review/9863
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-04 11:37:46 +00:00
Luke Mewburn 000ce64172 nettrace3gpp324423: fix name consistency
Improve consistency when referring to 3GPP TS 32.423:
- The standard name is "3GPP TS 32.423" (with "TS", and "." separator).
- Fix typo in number series ("32" not "34").
- The standard refers to "Trace", not "Nettrace".

Change-Id: If9994b9c6de69b6e1bdfc6679fbaabe698971949
Reviewed-on: https://code.wireshark.org/review/9795
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-27 06:31:57 +00:00
Pascal Quantin e963cbf08c editcap: keep timestamp resolution when converting a nseclibpcap file to pcapng
As reported on https://ask.wireshark.org/questions/43483/why-does-editcap-write-out-nseclibpcap-correctly-with-nanosecond-timestamps-but-not-with-pcapng

Change-Id: I81ec6dd6bdc6008297141ca8e210f4fb989cd3d6
Reviewed-on: https://code.wireshark.org/review/9111
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25 16:07:24 +00:00
Gerald Combs 1e3be59fbe WildPackets → Savvius.
Change-Id: I2494c2b1dcc9e324535b3f659b51b44059c478bd
Reviewed-on: https://code.wireshark.org/review/8304
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-06 16:48:03 +00:00
AndersBroman 2d8b4a233e Add the abillity to read 3GPP trace records with format accoding to
TS 32 423(XML)

Change-Id: I37895ec35797089a32c7d1695e735046d6aa979e
Reviewed-on: https://code.wireshark.org/review/8237
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-30 10:52:01 +00:00
anilkumar911 62a70e8a0b Support for new netscaler 3.5 trace format.
Change-Id: Ica74f3f9239a96486967cf248feb4313bc390734
Reviewed-on: https://code.wireshark.org/review/7751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-13 14:27:46 +00:00
Guy Harris 99ff8baed6 Use file extensions even more as a heuristic.
If a file type has a list of "typical" extensions, and a file has an
extension that is *not* one of those extensions, the file is unlikely to
be of that type.

For files that have extensions, after we try the heuristics that have a
list of "typical" extensions that includes the file's extension, try the
heuristics that have no such list, and after that try the heuristics
that have such a list but where the list *doesn't* include the file's
extension.

This fixes, for example, some cases where non-PacketLogger files were
getting identified as PacketLogger files.

Change-Id: I2d8c3b983ed6ccd692beb888668f77eb9b5f437b
Reviewed-on: https://code.wireshark.org/review/7315
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-22 19:25:07 +00:00
Dario Lombardo bd911096bd Added JSON native file support.
libjsmn has also been moved from epan/ to wsutil/ to make it visible from wiretap.

Change-Id: I59abb3419acb1baa83194b38152d3651ed5c123c
Bug: 10878
Reviewed-on: https://code.wireshark.org/review/6716
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-17 11:08:51 +00:00
Martin Mathieson a190c936d7 Remove unnecessary includes from wiretap folder
Change-Id: I10d3057801673bc1c8ea78f144215869cc4b1851
Reviewed-on: https://code.wireshark.org/review/6217
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-01-03 21:06:36 +00:00
Bill Meier 454fd6e9eb Add "Editor modelines"; Adjust whitespace as needed.
Change-Id: Ic5a5acb0f36d3aa144edbfb1ae71097b18426db4
Reviewed-on: https://code.wireshark.org/review/6216
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-02 00:49:09 +00:00
Guy Harris 0885d29451 Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-on: https://code.wireshark.org/review/5830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 04:04:19 +00:00
Guy Harris 51522b3372 Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out
in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along
with an err_info string.

Report (and free) that err_info string in cases where
WTAP_ERR_UNWRITABLE_REC_DATA is returned.

Clean up some other error reporting cases, and flag with an XXX some
cases where we aren't reporting errors at all, while we're at it.

Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3
Reviewed-on: https://code.wireshark.org/review/5823
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:03:26 +00:00
Guy Harris ddcc2aee3d Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442
Reviewed-on: https://code.wireshark.org/review/5798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:31:49 +00:00
Guy Harris 6c7af1db58 Change some names to make them the same in multiple lists.
Change-Id: I20ca39f69052b4134147577ae5be74c05b4d5e48
Reviewed-on: https://code.wireshark.org/review/5543
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-30 19:28:16 +00:00
Guy Harris 6ebb50c67e Get rid of a trailing blank.
Change-Id: I7963f05a78ec764a21d388fcdba618ffbcf935e4
Reviewed-on: https://code.wireshark.org/review/4930
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-25 22:41:19 +00:00
Guy Harris f36bbffc3b Update a comment.
Change-Id: I55002477a416710592a482725af68cdf2511e063
Reviewed-on: https://code.wireshark.org/review/4929
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-25 22:39:58 +00:00
Guy Harris fa6e907711 Initial version of support for Colasoft Capsa files.
The time stamp origin is not correct.  Capsa's absolute time stamp for
the sample captures from their Web site would be helpful.

Change-Id: I365daf7b42240e33f54df76939254f41ed57a9b2
Reviewed-on: https://code.wireshark.org/review/4671
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-14 06:45:35 +00:00
Guy Harris ffa377b22f Use names more like the other names in open_info.
For open_info, use names based on the names in other lists.

Also, in comments, indicate what the three count 'em three tables are
used for, and clean up the type/subtype table.

Change-Id: I7a763119e790d5970f87dff05284f465eebfb7e7
Reviewed-on: https://code.wireshark.org/review/4599
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-10 20:20:29 +00:00
Guy Harris 45e462985d Use an enum for the open-routine return value, as per Evan Huus's suggestion.
Clean up some things we ran across while making those changes.

Change-Id: Ic0d8943d36e6e120d7af0a6148fad98015d1e83e
Reviewed-on: https://code.wireshark.org/review/4581
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-09 23:45:30 +00:00
Guy Harris a566f617d8 No need for WTAP_ERR_CANT_READ.
Unlike the standard I/O routines, the code we introduced that supports
fast random seeking on gzipped files will always supply some specific
error code for read errors, so we don't need WTAP_ERR_CANT_READ.

Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard
I/O routines for that.  Set errno to WTAP_ERR_CANT_WRITE before calling
fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails
without setting errno.

Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63
Reviewed-on: https://code.wireshark.org/review/4540
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07 23:19:56 +00:00
Guy Harris 54b733ce9a Make the time stamp resolution per-packet.
Pcap-ng files don't have a per-file time stamp resolution, they have a
per-interface time stamp resolution.  Add new time stamp resolution
types of "unknown" and "per-packet", add the time stamp resolution to
struct wtap_pkthdr, have the libwiretap core initialize it to the
per-file time stamp resolution, and have pcap-ng do the same thing with
the resolution that it does with the packet encapsulation.

Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which
means "use the packet's resolution to determine how many significant
digits to display".  Rename all the WTAP_FILE_TSPREC_XXX values to
WTAP_TSPREC_XXX, as they're also used for per-packet values.

Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69
Reviewed-on: https://code.wireshark.org/review/4349
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28 18:38:18 +00:00
Guy Harris ec5915a6d7 Make style more consistent.
Change-Id: I4ba40504d8cc308f7c13b465fcfaa9ff5eeebcf2
Reviewed-on: https://code.wireshark.org/review/4252
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-22 18:54:08 +00:00
Guy Harris 72805be9ed Consistently use tab indentation.
(If somebody wants to convert the entire file to 4-space indentation, go
ahead.)

Change-Id: I1e3829289ac67db79eea2eb16e6a4ba40c449a8d
Reviewed-on: https://code.wireshark.org/review/4250
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-22 18:50:32 +00:00
Michal Labedzki 56a09d24dc Try to fix some buildbot warnings
Most interesting are:
 warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]
 warning: ISO C forbids zero-size array [-Wpedantic]
 warning: ISO C90 doesn't support unnamed structs/unions [-Wpedantic]
 warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual
 warning: initializer element is not computable at load time [enabled by default]

Change-Id: I5573c6bdca856a304877d9bef643f8c0fa93cdaf
Reviewed-on: https://code.wireshark.org/review/3174
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-09-22 10:52:03 +00:00
Jeff Morriss e483772d3f Fix up formatting (bring function names over to column 0).
Change-Id: I054f3ec13fd5907c8f1e0546292777a5596fc029
Reviewed-on: https://code.wireshark.org/review/4232
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-09-22 01:37:14 +00:00
Guy Harris b8293f95ad If we don't find a NetScaler signature, don't report an error.
It's *NOT* an error; it's just a file that isn't a NetScaler file.
Otherwise, we report errors on files that should just be passed on to
other open routines.

Also, NetScaler files are *NOT* text files, and we should *NOT* use
".txt" as the suffix.

Change-Id: If001abbbbc3de3ea27439a44a47ce1d6071d38ae
Reviewed-on: https://code.wireshark.org/review/3678
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-18 00:32:59 +00:00
Michał Orynicz 1a02ca0150 Add support for android logcat text files
Wireshark already supports reading and writing logcat
logs saved in binary files. Binary format, although
better, is used less often than saving those logs to
text files.

This patch extends wireshark's support for android logcat
logs to reading and writing logcat logs in text files.

Features:
* support for tag, brief, process, thread, time, threadtime
  and long formats
* saving in original format
* it's generally awesome

Change-Id: I013d6ac2da876d9a2b39b740219eb398d03830f6
Reviewed-on: https://code.wireshark.org/review/1802
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-06 06:46:50 +00:00
Guy Harris 0734ac385f Rename buffer_ routines to ws_buffer_ to avoid name collisions.
In particular, epan/wslua/lrexlib.c has its own buffer_ routines,
causing some linker warnings on some platforms, as reported in bug
10332.

(Not to be backported to 1.12, as that would change the API and ABI of
libwsutil and libwiretap.  We should also make the buffer_ routines in
epan/wslua/lrexlib.c static, which should also address this problem, but
the name change avoids other potential namespace collisions.)

Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28
Reviewed-on: https://code.wireshark.org/review/3351
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02 11:01:29 +00:00
Peter Wu 0492921adc Replace lseek/fstat by ws_lseek64/ws_fstat64
lseek returns an off_t type which is system-dependent. Use ws_lseek64 in
favor of lseek as that supports 64-bit quanities.

Use ws_fstat64 instead of stat to support 64-bit file sizes on Windows.
For the majority of the changes, this makes no difference as they do not
apply to Windows ("ifndef _WIN32"; availability of st_blksize).

There are no other users of "struct stat" besides the portability code
in wsutil. Forbid the use of fstat and lseek in checkAPIs.

Change-Id: I17b930ab9543f21a9d3100f3795d250c9b9ae459
Reviewed-on: https://code.wireshark.org/review/3198
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-25 21:26:01 +00:00
Guy Harris d4dab16a3f Only one buffer.c, please.
Otherwise, if you link with both libwiretap and libfiletap, it's
anybody's guess which one you get.  That means you're wasting memory
with two copies of its routines if they're identical, and means
surprising behavior if they're not (which showed up when I was debugging
a double-free crash - fixing libwiretap's buffer_free() didn't fix the
problem, because Wireshark happened to be calling libfiletap' unfixed
buffer_free()).

There's nothing *tap-specific about Buffers, anyway, so it really
belongs in wsutil.

Change-Id: I91537e46917e91277981f8f3365a2c0873152870
Reviewed-on: https://code.wireshark.org/review/3066
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-15 23:43:32 +00:00
AndersBroman f5476e90a0 Explicitly declare/cast 'unsigned <variable>' as 'unsigned int <variable>'
Applying part of Bug 7825

Change-Id: I460b5c61b04d793ccc27c25debbd5e8f08bc6974
Reviewed-on: https://code.wireshark.org/review/2280
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-16 22:03:12 +00:00
Michal Labedzki c6d175ef67 Guarantee that open routines are initialized
Open routines need to be initialized before try to open
capture or add/remove routine.

Change-Id: Ic3b88eef947ebd4a3dd2edf8120bb6bd8aec0765
Reviewed-on: https://code.wireshark.org/review/1874
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-04 00:48:59 +00:00
Peter Wu cea149aa89 wiretap: fix regression, missing initialization
wtap_dump_open() allocates an empty wtap_dumper struct such that
interface_data is not initialized. Fix this by adding the member back.

Regression from 3aee917058 ("wiretap:
remove unused code, drop number_of_interfaces").

Bug: 10113
Change-Id: Ia6259bf50b25d5e7aa837b0fb7396b07d5d3c72c
Reviewed-on: https://code.wireshark.org/review/1672
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-17 17:22:37 +00:00
Peter Wu 3aee917058 wiretap: remove unused code, drop number_of_interfaces
While investigating an ASAN issue (fixed in
commit dcdd076ab0), I got greatly confused
by three different types having the same "interface_data" field name:

 * pcapng_t *pn stores an array of interface_data_t objects.
 * wtap *wth stores an array of wtapng_if_descr_t objects.
 * pcapng_dump_t should store an array of interface_data_t objects.

pcapng_dump_t and friends are unused since
commit c7f1a431d2, so drop it.

To fix the confusion, rename the interface_data_t type to
interface_info_t type and use the local variable "iface_info"
everywhere. Rename interface_data of pcapng_t to "interfaces" and
add a comment what this exactly means (interfaces listed in the capture
file).

Drop the number_of_interfaces field for interfaces as the array
length is already available from GArray. Now interface_data is always
initialized for wth (which also gets copied to idb).

s/int/guint/g and replace cast at some places.

There are no regressions for the in-tree test suite.

Change-Id: I2d5985c9f1e43f8230dbb4a73bd1e243c4858170
Reviewed-on: https://code.wireshark.org/review/1656
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-17 12:41:50 +00:00
Guy Harris a1b1c8bed5 Revert "Refactor Wiretap"
This reverts commit 1abeb277f5.

This isn't building, and looks as if it requires significant work to fix.

Change-Id: I622b1bb243e353e874883a302ab419532b7601f2
Reviewed-on: https://code.wireshark.org/review/1568
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09 05:21:01 +00:00
Michael Mann 1abeb277f5 Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality.

The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes.

bug:9607
Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-on: https://code.wireshark.org/review/1485
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-09 03:04:39 +00:00
Michael Mann 078daeb27f Populate heuristic extension list during initialization and not during each call to heuristic_uses_extension.
Change-Id: I7e484de65c49060793a91cc11cb211effa2006db
Reviewed-on: https://code.wireshark.org/review/1494
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-08 00:31:29 +00:00
Martin Kaiser c9440cb8df use the WTAP_TYPE_AUTO define to make things clearer
Change-Id: I1dd51d1452333826c153b6bb861262a6166af3c5
Reviewed-on: https://code.wireshark.org/review/754
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-20 19:32:28 +00:00
Martin Kaiser f655132913 the entries for file types with magic numbers are
0...heuristic_open_routine_idx-1

at the moment, we loop over all entries of the open_info_arr

Change-Id: Iabca32521a066d994b1c840b7514faa983375f0c
Reviewed-on: https://code.wireshark.org/review/748
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-20 08:40:08 +00:00
Martin Kaiser 4a51f624bf use the correct end index when we loop over the open_info_arr
until recently, we always had a 0,0,0,... entry at the end of the array
that's gone now - which makes sense for people who register wiretap
plugins...

Change-Id: Id47dc4917481ffa8560e17b8740c2f9716bb8df1
Reviewed-on: https://code.wireshark.org/review/747
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-20 08:39:00 +00:00
Hadriel Kaplan c8a98f37ec Fix lua file testsuite not working and weak heuristic readers not being registered
The testsuite for Lua file reader/writer uses the acme_file.lua script to
generate a pcapng file from an Acme sipmsg.log file. It then compares the
tshark verbose output of this new pcapng file to a sip.pcapng file in
the test/captures directory that was previously made. Unfortunately, the
acme_file.lua script generates a timestamp based on local system timezone,
rather than UTC, so the testsuite fails if not run in the EST timezone where
the sip.pcapng file was originally made. This has now been fixed.

Also, trying to register new weak heuristic readers fails because the GArray
is terminated with a NULL-based row without Glib knowing about that. So this
commit changes it to let Glib handle the NULL-terminated row, so that appending
takes it into account automatically.

Change-Id: I037ce1cfbda03585b3a1e159df78ff8ebb41fc32
Reviewed-on: https://code.wireshark.org/review/741
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-19 17:02:40 +00:00
Michal Labedzki a68e3a410c Wiretap: Add support for Android Logcat
Now Androit Logcat (Logger) binary logs are supported.
Try "adb logcat -Bf /sdcard/log.logcat; adb pull /sdcard/log.logcat".
Also there is possibility to save logs to text format like by "adb".

Change-Id: If7bfc53d3fbd549a0978d1dbf96f3fff671fd601
Reviewed-on: https://code.wireshark.org/review/235
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 17:01:09 +00:00
Michael Mann 04d9501306 Add capture file reader/writer support for Lua so scripts can implement new capture file formats.
This enables a Lua script to implement a brand new capture file format reader/writer, so that for example one could write a script to read from vendor-specific "logs" of packets, and show them as normal packets in wireshark.

Change-Id: Id394edfffa94529f39789844c382b7ab6cc2d814
Reviewed-on: https://code.wireshark.org/review/431
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 05:04:54 +00:00
Guy Harris 4342323c08 Support to version 3.0 of netscaler packet wire format.
From shekhar.chandra@citrix.com.  See bug 9280.

Change-Id: If3abbc653bb1f127b151976d4183af4c4f1e71eb
Reviewed-on: https://code.wireshark.org/review/658
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-16 03:04:13 +00:00
Hadriel Kaplan 041f844d72 Add command-line arg for input file format for tshark/wireshark
Now that we have the ability to choose input file format type
in the GUI, we might as well have it in the command-line too.
Plus it would help me in test-stuies if we had a commandline.
So I've added a '-X read_format:Foo' for this.  Using just
'-X read_format:', or with a bad name, will make it print out
the full list (in tshark); just like the '-F' does for output
file formats.

Note: I am *not* putting in code for Win32 GUI,
because I can't compile that and I wouldn't have even
done the GTK one if I could compile Qt originally. (I don't think we need
to add any more features to GTK or Win32, just Qt from now on,
right?)

Change-Id: I2fe6481d186f63bd2303b9e591edf397a2e14b64
Reviewed-on: https://code.wireshark.org/review/493
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-05 18:38:05 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Michal Labedzki 579e7e19ce Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.

On the other side now it is possible to open capture file
as file format to be dissected.

Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-on: https://code.wireshark.org/review/16
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-25 17:43:13 +00:00
Anders Broman 05f7044bc7 Make internal functions static
svn path=/trunk/; revision=54686
2014-01-10 07:01:15 +00:00
Guy Harris 5946c5236b For file formats that don't have magic numbers, so they're recognized by
heuristics, but do have a file extension that files of that format are
likely to have, use the extension of the file we're opening, if it has
one, as a hint for which heuristics to try first.

svn path=/trunk/; revision=54495
2013-12-30 06:43:19 +00:00
Guy Harris afa9f611d7 And another one.
svn path=/trunk/; revision=54018
2013-12-13 03:13:40 +00:00
Guy Harris 70e8da2d8c Add some more file types misidentified as VWR files.
svn path=/trunk/; revision=54017
2013-12-13 03:12:42 +00:00
Guy Harris c34050d629 The IxVeriWave heuristic now gets more false positives (after, I
suspect, the change to handle VWR files with no packets); shuffle it
after all the types we've seen misidentified as VWR files.

svn path=/trunk/; revision=54012
2013-12-13 02:38:11 +00:00
Bill Meier 5a0809c718 (Trivial) whitespace cleanup (mostly trailing whitespace).
svn path=/trunk/; revision=53172
2013-11-08 17:17:57 +00:00
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 bf4e84aba6 For open dialogs, offer a list of sets of extensions, not of file types;
.cap, for example, doesn't refer to a particular file type - a whole
bunch of file types use .cap.

Also offer, in addition to "All Files", "All Capture Files", which
matches all the extensions we know about.

svn path=/trunk/; revision=53156
2013-11-08 01:08:42 +00:00
Bill Meier 6697d30b72 Revert SVN #52914;
OSX-10.6-x64 buildbot still givs an error
(At least we now know which line of code gives the error).

svn path=/trunk/; revision=52915
2013-10-28 04:07:52 +00:00
Bill Meier 2c3ec284db From Shekhar Chandra: support for version 3.0 of netscaler packet wire format.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9280

(Revised patch: let's see if this version compiles w/o error
                on all the buildbots)


svn path=/trunk/; revision=52914
2013-10-28 03:16:31 +00:00
Bill Meier 2197f291e5 Revert SVN #52665.
Compilation fails on (only the ?) OSX-10.6-x64 buildbot with error:

netscaler.c: In function 'nstrace_read_v30':
netscaler.c:1295: warning: implicit conversion shortens 64-bit value into a 32-bit value

(Life is too short for me to dig multiple levels deep into a set of macros to try to see which
 actual line of code is causing the problem.  Maybe the patch submitter can identify the problem).


svn path=/trunk/; revision=52666
2013-10-18 04:31:08 +00:00
Bill Meier c50b988807 From Shekhar Chandra: support for version 3.0 of netscaler packet wire format.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9280

From me: fix indentation(tabs->spaces) and trailing whitespace.


svn path=/trunk/; revision=52665
2013-10-18 03:36:04 +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 b862ff08fd Make sure we initialize the array of file type extensions before we use
it.

svn path=/trunk/; revision=51553
2013-08-27 22:10:35 +00:00
Guy Harris a505518e01 Have a separate list of extension sets to use in the Open dialog;
include only extensions used mostly by capture files (i.e., not ".txt"
or ".xml"), and list each extension set only once (it's silly to have,
for example, separate entries for NetMon, Shomiti Surveyor, and
NetScaler with ".cap" when you get all those types no matter which entry
you choose).

svn path=/trunk/; revision=51547
2013-08-27 20:46:47 +00:00
Guy Harris 32e1523bb2 For the Windows Open dialog for capture files, get rid of the "(*.*)" in
the "All Files" entry (the current UI guidelines from Microsoft say to
do so, and that's what Paint does, at least), and add an "All Capture
Files" entry with all the file extensions for the file types we support
(it'll pick up all text files, but there's not much we can do about
that, and it won't pick up files with *no* extension or weird
extensions, such as you might get from UN*X systems or from WinDump
commands, but at least it'll filter out some other crud).

Fix what appear to be memory leaks; that should be backported unless
I've missed something and they aren't leaks.

Fix an out-of-date comment, and add an additional comment.

svn path=/trunk/; revision=51481
2013-08-23 00:06:26 +00:00
Guy Harris d6e80b453e From Stephen Donnelly <stephen.donnelly@emulex.com>:
Move the check for vwr files *after* the check for ERF files, as it
sometimes thinks ERF files are VWR files.

svn path=/trunk/; revision=51467
2013-08-22 03:43:39 +00:00
Guy Harris 0c550e9090 Back out the previous change, so I can check it in again with the
*correct* checkin message.  Sigh....

svn path=/trunk/; revision=51466
2013-08-22 03:42:15 +00:00
Guy Harris a4609262b0 Copy over r51462 from trunk:
------------------------------------------------------------------------
  r51462 | guy | 2013-08-21 20:21:47 -0700 (Wed, 21 Aug 2013) | 8 lines

  What was I thinking?  ".caz" is used for compressed *Windows* Sniffer
  files (which are just gzipped uncompressed Windows Sniffer files, albeit
  with the checksum computed differently in some fashion, or perhaps just
  being computed incorrectly), not compressed *DOS* Sniffer files (which
  use their own form of compression, which doesn't compress the entire
  file, just most of it, and which use the same extensions as uncompressed
  DOS Sniffer files).

svn path=/trunk/; revision=51465
2013-08-22 03:40:30 +00:00
Guy Harris 7a1fdcec89 What was I thinking? ".caz" is used for compressed *Windows* Sniffer
files (which are just gzipped uncompressed Windows Sniffer files, albeit
with the checksum computed differently in some fashion, or perhaps just
being computed incorrectly), not compressed *DOS* Sniffer files (which
use their own form of compression, which doesn't compress the entire
file, just most of it, and which use the same extensions as uncompressed
DOS Sniffer files).

svn path=/trunk/; revision=51462
2013-08-22 03:21:47 +00:00
Evan Huus 0b796e53cf From Linas Vepstas via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8962
Enhancement: Add STANAG 4607 file format

svn path=/trunk/; revision=50996
2013-07-28 23:41:18 +00:00
Guy Harris a4ad9e9f74 If a core Wireshark developer repeatedly can't remember that the
argument to the -F flag for pcap format is "libpcap", not "pcap", we
have a problem.  Make it "pcap", and add a backwards-compatibility hack
to support using "libpcap" as well.

Update the man pages to refer to it as pcap as well, and fix the
capitalization of "WinPcap" (see http://www.winpcap.org) while we're at
it.

Also, refer to http://www.tcpdump.org/linktypes.html for the list of
link-layer header types for pcap and pcap-ng.

svn path=/trunk/; revision=50989
2013-07-28 21:12:07 +00:00
Pascal Quantin ba4cb4bad7 From Weston Schmidt via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8689:
csids wiretap heuristic overriding mp2t

svn path=/trunk/; revision=49334
2013-05-16 18:27:03 +00:00
Guy Harris c5d1d8d80e From Anthony Coddington: don't check for MPEG-2 Transport before
checking for ERF.

From me: note some heuristic checkers that are in the "magic number" set.

#BACKPORT 1.8

svn path=/trunk/; revision=48724
2013-04-04 04:35:09 +00:00
Guy Harris d517ab3698 In the Lua dumper code, don't bother checking whether the encapsulation
is supported before trying to open for writing - the attempt to open for
writing will do the check for you.  Instead, check for specific errors
if the attempt to open for writing fails, and use somewhat more specific
error messages for certain error codes.  (We should perhaps check for
even more error codes in those cases.)

That gets rid of all external calls to wtap_dump_can_write_encap(), so
remove it from wtap.h and make it static.

svn path=/trunk/; revision=48691
2013-04-01 21:39:28 +00:00
Guy Harris b1ecd8d217 Add a wtap_dump_can_write() routine that indicates whether Wiretap
supports writing files with a given set of encapsulations and comment
types.  Use it, rather than asking for a list of file formats that
support the given set of encapsulation and comment types and checking
whether we got back such a list, or duplicating its logic.

Having file.c use it means that nobody's using
wtap_dump_can_write_encaps() any more; get rid of it.  Instead, have a
private routine that checks whether a given file format supports a given
set of encapsulations *and* comment types, and use that internally.

svn path=/trunk/; revision=48690
2013-04-01 21:17:50 +00:00
Guy Harris 82a602d697 Define a collection of bits for different types of capture file comments.
For each capture file type, have a bitset of comment types supported by
that capture file type.

Add a Wiretap routine that, for a given file type, returns the bitset of
comment types it supports.

Have wtap_get_savable_file_types() take a bitset of comment types that
need to be supported by the file types it returns.

Replace cf_has_comments() with a routine that returns a bitset of
capture file comment types in the capture file.

Use those routines in the capture file dialogs; don't wire in the notion
that pcap-NG supports all comment types and no other file formats
support any comment types.  (That's currently true, but we don't want to
wire that in as being forever true.)

svn path=/trunk/; revision=48689
2013-04-01 20:36:42 +00:00
Martin Kaiser 7a2bdedff6 wiretap support for the CAM Inspector file format
svn path=/trunk/; revision=48647
2013-03-30 09:56:57 +00:00
Evan Huus 202680971d Wiretap file open routines should not free wth->priv on error, since that
leads to a double-free in wtap_close. Fix all the instances I found via
manual code review, and add a brief comment to the list of open routines in
file_access.c

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

svn path=/trunk/; revision=48552
2013-03-25 22:04:15 +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 4cf12b41be Revert "Fix MSVC build errors related to symbol visibility"
This reverts commit r47952.
The problem was different from what I originally thought, thus
the commit was obsolete.

svn path=/trunk/; revision=47954
2013-02-28 22:17:06 +00:00
Balint Reczey ccc76ff07f Fix MSVC build errors related to symbol visibility
svn path=/trunk/; revision=47952
2013-02-28 21:11:32 +00:00
Guy Harris 1825519526 On I/O errors when opening a file, use wtap_close() to clean up, to make
sure we clean up everything.

svn path=/trunk/; revision=46773
2012-12-26 11:59:47 +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
Gerald Combs c91c1df500 Use seasonal allocation for name resolution. This effectively scrubs our
resolution information between capture files so that we don't leak host
entries from one file to another (e.g. embarassing-host-name.example.com
from file1.pcapng into a name resolution block in file2.pcapng).

host_name_lookup_cleanup and host_name_lookup_init must now be called
after each call to se_free_all. As a result we now end up reading our
various name resolution files much more than we should.

svn path=/trunk/; revision=45511
2012-10-12 21:37:02 +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
Anders Broman 056c44a13e Create (fake)interface information when loading a libpcap file it might be needed when wrinting the file if the format is converted to pcapng.
Should we do this for other file formats as well?

A pcapng file with per packet encapsulation will need an IDB per encapsulation as the EPB does not have a linktype indicator only a interface index.

svn path=/trunk/; revision=44281
2012-08-06 11:53:26 +00:00
Guy Harris 633de5c7d1 Add a routine that, given a set of packet encapsulation types, returns
the per-file encapsulation type needed to write out a set of packets
with all those encapsulation types.  If there's only one such
encapsulation type, that's the type, otherwise WTAP_ENCAP_PER_PACKET is
needed.  Use that in wtap_dump_can_write_encaps().

Also use it in cf_save_packets() and cf_export_specified_packets(), so
that we can write out files with WTAP_ENCAP_PER_PACKET as the file
encapsulation type and only one actual per-packet encapsulation type in
some cases where that failed before.  This fixes the case that showed up
in bug 7505, although there are other cases where we *could* write out a
capture in a given file format but won't be able to do so; fixing those
will take more work.

#BACKPORT

(Note: this adds a routine to libwiretap, so, when backported, the
*minor* version of the library should be increased.  Code that worked
with the version of the library prior to this change will continue to
work, so there's no need to change the *major* version of the library.)

svn path=/trunk/; revision=43847
2012-07-20 04:00:29 +00:00
Guy Harris 447bc256c1 AARGH. There are two lumps of (almost-)identical code to handle
interface information when opening an output file, one of which I fixed
in my previous checkin and the other of which I didn't notice.  Shuffle
code around a little bit so that the lumps are identical and then put
them into a common routine (*with* the fix in question).

#BACKPORT

svn path=/trunk/; revision=43655
2012-07-11 03:50:28 +00:00
Guy Harris d419e7e30c Set the time units per second correctly if, in wtap_dump_open_ng(),
we're making a fake interface description (it should match the time
stamp resolution).  The dump code for pcap-NG now requires the time
units per second value, as it needs to correctly compute the time stamp
value to write out in an EPB.

svn path=/trunk/; revision=43652
2012-07-10 19:59:39 +00:00
Guy Harris 9fcbc2377f The names "etherpeek" and "airopeek" are a bit misleading, as the
"etherpeek.c" file format is used by AiroPeek and the "airopeek9.c" file
format is used by EtherPeek.

Instead, use the names that WildPackets apparently uses for those
formats - "classic" and "tagged".

svn path=/trunk/; revision=43630
2012-07-09 23:07:28 +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 fc2d1024de Forgot to use wtap_dump_can_write_encaps()'s final name.
svn path=/trunk/; revision=43317
2012-06-17 16:53:31 +00:00
Guy Harris 2bd813507a Export a wtap_dump_can_write_encaps() routine from Wiretap; it takes a
file type and a GArray of encapsulation types and returns TRUE if a
capture with all those encapsulation types can be written to a file in
that file type and FALSE otherwise.  Use it where appropriate.

svn path=/trunk/; revision=43315
2012-06-17 16:44:09 +00:00
Guy Harris c63aa61658 Have wtap_get_savable_file_types() take an array of encapsulations and
only return file types that could handle a single file with all those
encapsulations - this means that

	1) if there's more then one encapsulation, the file format has
to handle per-packet encapsulation;

	2) just because a file format handles per-packet encapsulation,
that doesn't mean that it can handle the *particular* encapsulations
being handed to it.

This fixes some cases where we were claiming that a file could be saved
in a format that doesn't actually support it (e.g., ISDN files being
reported as savable in pcap-NG format - there's no LINKTYPE_ value for
ISDN including B and D channels).

svn path=/trunk/; revision=43300
2012-06-17 01:32:50 +00:00
Guy Harris e51c05a836 TShark doesn't need wtap_fdreopen(), as it doesn't do saves and thus
doesn't do safe saves, so wtap_fdreopen() always needs to reopen the
random file descriptor.

At the point where a safe save is done, the sequential read is done, so
the sequential stream is closed; there's no need to reopen it.

(The former fourth argument to wtap_fdreopen() wasn't an indication of
whether the file was compressed, it was an indicationof whether the
random stream should be reopened.)

svn path=/trunk/; revision=42977
2012-06-01 16:55:10 +00:00
Guy Harris b8646937d4 Move wtap_fdreopen() to file_access.c for now, as it requires many of
the same #includes.

svn path=/trunk/; revision=42963
2012-06-01 08:45:39 +00:00
Guy Harris 129c881fcf Sigh. There appears to be no way to get Windows to allow us to rename a
file that we ourselves have open.  In the "safe save" code path for
capture files, on Windows temporarily close the file descriptors for the
currently-open capture before doing the rename and then, if the rename
failed, reopen them, leaving the rest of the wtap and capture_file
structures intact.

Rename filed_open() to file_fdopen(), to make its name match what it
does a bit better (it's an fdopen()-style routine, i.e. do the
equivalent of an open with an already-open file descriptor rather than a
pathname, in the file_wrappers.c set of routines).

Remove the file_ routines from the .def file for Wiretap - they should
only be called by code inside Wiretap.

Closing a descriptor open for input has no reason to fail (closing a
descriptor open for *writing* could fail if the file is on a server and
dirty pages are pushed asynchronously to the server and synchronously on
a close), so just have file_close() return void.

svn path=/trunk/; revision=42961
2012-06-01 08:05:12 +00:00
Guy Harris e6a57c8e93 In Windows, in the Save As and Export Selected Packets dialog, append
the default extension for the file type iff

	the file type we're using has a list of extensions;

	the file has no extension or it has one but it's not one of the
	ones in the list.

*Don't* expect a file extension to be at most 5 characters plus the dot
- the extension for pcap-ng, our default capture file type, is "pcapng",
and that's 6 characters!

svn path=/trunk/; revision=42800
2012-05-23 03:05:17 +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 4021d7c5ea Add ".dmp" as a suffix for pcap files of various flavors. Add ".ntar"
as a suffix for pcap-ng files.

svn path=/trunk/; revision=42330
2012-04-29 02:49:17 +00:00
Guy Harris 28175cbf9a Put pcapng_open() right after libpcap_open(); pcap and pcap-ng are our
native file formats, so try them first.

Move eyesdn_open() to the section for open routines for file formats
that have a magic number - EyeSDN traces all start with "EyeSDN".

svn path=/trunk/; revision=42250
2012-04-26 03:21:29 +00:00
Anders Broman 102991bf0f Handle wtap_dump_fdopen() as wtap_dump_open() eg call
wtap_dump_fdopen_ng() and add a dummy IDB to be able to write pcapng files.
Solves https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6969
mergecap: Can't open or create <FILENAME>: Internal error.

We might want to add a SHB comment from mergecap giving the merged filenames or something like that, Merging of pcapng files
is a different issue, idealy we should probably start using several SHB:s in that case.

svn path=/trunk/; revision=42230
2012-04-25 12:33:23 +00:00
Martin Mathieson 45252c84e3 Patch for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5048
From Tom Cook and Tom Alexander.

1. A VWR encapsulation that reads VeriWave capture files (*.vwr)
generated from
WaveTest test hardware
2. Dissectors that display the VeriWave tap headers (both 802.11 and
Ethernet)
3. A dissector for the WaveAgent protocol.  The WaveAgent dissector is
heuristic and parses the WaveAgent packet (a UDP payload).

The WaveAgent dissector has been Fuzz tested.

The VWR ENCAP and dissectors have been used extensively by VeriWave
customers in a special version of WireSark compiled by VeriWave.

svn path=/trunk/; revision=42155
2012-04-20 12:08:31 +00:00
Guy Harris 477185a387 If we see a 5View time-stamped header with a bad key, make sure we
return the right error code and information string.

InfoVista bought Accellent Group, and, at least according to the
InfoVista Web site, it's "5View", not "5Views".

svn path=/trunk/; revision=42119
2012-04-18 02:48:23 +00:00
Jeff Morriss 603b4d4348 Don't free idb_inf in wtap_dump_open_ng(): free it in the callers. This fixes the double-free editcap crashes that the buildbot's been seeing lately.
svn path=/trunk/; revision=41542
2012-03-14 01:08:09 +00:00
Anders Broman bb611755e9 Add data structure to hold information from ISB:s
svn path=/trunk/; revision=41522
2012-03-13 08:36:52 +00:00
Anders Broman 1b25b08a0f From Martin Kaiser: correct sorting for wiretap's file type list
svn path=/trunk/; revision=41387
2012-03-07 08:03:42 +00:00
Anders Broman 971cb84877 if_filter isn't a string per se,The first byte of the Option Data keeps a code of the filter used
svn path=/trunk/; revision=41339
2012-03-04 19:01:14 +00:00
Guy Harris 0475f29216 The additional_file_extensions member of struct file_type_info need not
and should not contain the extension in the default_file_extension
member - that's why the name starts with "additional".

svn path=/trunk/; revision=41293
2012-03-02 10:09:23 +00:00
Anders Broman e82ad19e58 From Weston Schmidt: Add mpeg-ts capture file format support. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6894
svn path=/trunk/; revision=41286
2012-03-02 06:02:28 +00:00
Michael Tüxen 2764d9977b Use wtap_dump_open_ng() in tshark.
svn path=/trunk/; revision=41123
2012-02-21 17:19:45 +00:00
Michael Tüxen 660a348df1 When saving a file and the are no IDBs, create a default one.
This seems right, but doesn't make the buildbots happy, because
a read pcap file is reported a per packet encaps...

svn path=/trunk/; revision=41121
2012-02-21 16:51:23 +00:00
Michael Tüxen 7d7c5ca02d Don't dereference idb_inf in wtap_dump_open_ng() when
you provide NULL when you call it via wtap_dump_open.

This does not make the buildbots happy, but at least
tshark doesn't crash anymore.

svn path=/trunk/; revision=41111
2012-02-21 15:21:01 +00:00
Anders Broman 89758cdec8 From Jose Pedro Oliveira fix a typo
svn path=/trunk/; revision=41091
2012-02-20 22:40:17 +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
Guy Harris c8854a7a5f Add a routine to Wiretap that takes a file type value and an
encapsulation value and returns a GArray containing all the file types
that could be used to save a file of that file type and that
encapsulation value (which could be WTAP_ENCAP_PER_PACKET), with the
input file type first if that can be used and pcap or pcap-ng first if
not and if one of them can be used, and with pcap and pcap-ng clustered
together if they're among the file types that can be used.

Use that routine for the GTK+ file save dialog.

svn path=/trunk/; revision=40685
2012-01-24 04:33:23 +00:00
Guy Harris 3b1f82d063 In the table of capture file types, have:
a field that gives the default extension for the file type,
	*without* a leading "." (i.e., just the extension, not the "."
	that separates it from the rest of the file name), which is NULL
	if there are no known extensions;

	a field that gives a semicolon-separated list of *other*
	extensions, without "*." or ".", which is NULL if there are no
	known extensions or there are no known extensions other than the
	default.

Rename wtap_file_extension_default_string() to
wtap_default_file_extension() (matches the name of the field).

svn path=/trunk/; revision=40678
2012-01-23 23:17:03 +00:00
Guy Harris bb98263aa4 Have wtap_file_extension_default_string() return the extension in the
sense of "what follows the last . in the file name", i.e. not including
the ".".

svn path=/trunk/; revision=40674
2012-01-23 21:57:45 +00:00
Guy Harris ef2bf47e32 Add default extension names for all file types for which we have
extensions at all.

For file types that are plain text and that don't already have
extensions, add "txt" as the extension.

svn path=/trunk/; revision=40657
2012-01-23 02:38:56 +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 97ad2f8177 "*.*" as a pattern for a given file type is pointless, as it doesn't
select only files of that type; you might as well use "All Files (*.*)"
for that.

The default suffix is a suffix, not a pattern, so it shouldn't be
"*.{something}".

We only use the patterns on Windows, where file names are
case-insensitive, so there's no point in capital letters in suffixes.

svn path=/trunk/; revision=40621
2012-01-21 03:55:40 +00:00
Guy Harris e3712a53da Get rid of an unused file type. If somebody wants it in the official
Wireshark distribution, give us code to read it.  If somebody wants it
in their private version of Wireshark, they can manage that themselves. 
(We should support plugins for file types at some point; I think we
already have support for Lua file readers.)

svn path=/trunk/; revision=40620
2012-01-21 03:52:19 +00:00
Guy Harris 2db032c5d5 NetMon 1.x format does *not* support per-packet encapsulation.
svn path=/trunk/; revision=40495
2012-01-14 10:31:25 +00:00
Guy Harris eb5c7d64a4 Get rid of unused WTAP_FILE_WTAP file type.
Move pcap-NG right after standard pcap in the list of file types, so
that it shows up early in the list of output file types in the "Save
As..." dialog box (if, that is, it's supported; if not, neither is pcap,
as they use the same link-layer header type values).

svn path=/trunk/; revision=40493
2012-01-14 09:12:05 +00:00
Guy Harris e9ae3a0fd6 Initial support for .aps files from Aethra Telecommunications' PC108
software.  More work is needed:

	we don't know where the capture start time is yet;

	we aren't handling the "stop capture" record;

	we don't know where the ISDN channel is;

	there might be non-ISDN file formats;

but this at least is easier than trying to text2pcap hex dumps from that
software into pcap files.

svn path=/trunk/; revision=39588
2011-10-26 02:18:55 +00:00
Bill Meier 59e64cff77 From Robert Bullen: Fix for: Two minor bugs in Wiretap library:
First bug: The Network Instruments Observer file format abbreviation is
incorrect. It is "niobserverv" instead of "niobserver", which is probably a
vestige from 1.4 when the abbreviation was "niobserverv9".

Second bug: The packet header magic number field is correctly swapped the first
time when reading the entire packet header. It is incorrectly swapped yet again
when reporting an invalid value. Both swaps use GUINT_FROM_LE, which is a no-op
on little-endian platforms. But the error message that is displayed to users of
big-endian platforms will contain a byte-reversed value.

svn path=/trunk/; revision=39392
2011-10-12 18:04:58 +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 141a830b9f From Andrew Kampjes via bug 6260:
Added support for saving ERF files.

From me:
Use crc routines from libwsutil.

svn path=/trunk/; revision=38826
2011-08-31 20:50:15 +00:00
Gerald Combs 8d88f3a790 Make pcap-ng the default. Add a compile-time option to prefer pcap-ng or
pcap.  Add a "-P" capture option which tries to use pcap instead of
pcap-ng ("-P" seemed to be the best option but we may want to use a
different letter).

Update the documentation and release notes.

svn path=/trunk/; revision=37696
2011-06-17 17:52:31 +00:00
Jakub Zawadzki c54afc05e7 Fix capinfo: ** ERROR **: Unknown capture file type 61
svn path=/trunk/; revision=37643
2011-06-10 07:16:10 +00:00
Jakub Zawadzki a723874490 - Replace jpeg_jfif decoder, with more generic mime_file (no more 64KB limit!).
- Add new dissector packet-mime-encap which understands mime_file fragmentation.

svn path=/trunk/; revision=37636
2011-06-09 21:21:06 +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 42ba70cf9c If a gzipped file's name ends in .caz, don't check the CRC - it's
probably a compressed file from the Windows Sniffer, and they don't
bother setting the CRC.

svn path=/trunk/; revision=37024
2011-05-09 03:48:41 +00:00
Guy Harris c0dc916adc From Tom Brezinski - fix for bug 5869:
This patch incorporates the following fixes from the patch attached to
bug 5671 with changes as noted below:

1.) Files where the packet header and packet data are noncontiguous are
handled improperly, resulting in read misalignment and ultimately the
error message, "Observer: bad record: Invalid magic number 0xXXXXXXXX."
This bug is caused by not obeying the packet_entry_header.offset_to_frame
field.

2.) Daylight savings time is not properly accounted for in files using
local time encoding.

3.) As of Observer/GigaStor v13.10 (bug 5671 incorrectly stated v14),
timestamps in the file format changed from local time encoding to GMT
encoding.  Wiretap has been changed to support reading both formats. 
Patch submitted with bug 5671 added a separate file type to allow
writing local format.  This patch does not add the separate file type
and always writes GMT.

4.) The wtap_dumper.bytes_dumped field is not being properly incremented
as data is written to files.

This patch also incorporates the following additional enhancements /
fixes not in bug 5671:

1.) Support for reading BFR files which contain Fibre Channel captures. 
Test file Fibre_Channel_Capture.bfr attached.

2.) Support for modified file header used in upcoming v15.  New header
file format takes an unused byte from the version string to allow for a
larger offset to the first packet to be specified.  Test file
V15_Lrg_Hdr_Test.bfr is attached, it is also a fuzz test as the number
of TLV items given in the header is less then the actual.

3.) It was found that if the number of TLV items given in the header was
larger then present it would fail to open the file.  Test file
V9_Num_TLVs_Too_Big.bfr is attached.

svn path=/trunk/; revision=36970
2011-05-03 05:26:10 +00:00
Guy Harris 3edd2b5b0d In a dump_open routine, you don't need to seek to the beginning of the
file before doing any writes - it starts out at the beginning of the
file.  This means that you *can* write a Network Instruments capture
file to a pipe, or write it out in compressed form, now that its
dump_open routine no longer seeks.

NetXRay format and K12 binary format, however, *do* require a seek when
writing them.

svn path=/trunk/; revision=36776
2011-04-21 18:33:20 +00:00
Guy Harris c93f8694e3 Sigh. The "data" element of a GArray is, alas, a "gchar *", not a "void
*", and some compilers complain when you cast that pointer to something
requiring stricter alignment.  Maybe the intent is to nudge you into
thinking about whether the pointer really is properly aligned, but....

svn path=/trunk/; revision=36739
2011-04-20 18:04:43 +00:00
Guy Harris 7fa71ab07e Check for _setmode() failing, Just In Case. Squelches some MSVC static
analyzer warnings.

Return an actual error if we're failing because we're trying to write to
the standard output in compressed mode.

svn path=/trunk/; revision=36636
2011-04-14 02:53:18 +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 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 b184c69559 Don't use the zlib I/O routines for writing compressed files, either;
this frees us from worrying about zlib large file issues on the write
side, and also lets us clean up a few other things.

svn path=/trunk/; revision=36563
2011-04-11 21:33:22 +00:00
Guy Harris a6fc7f14c4 To fill in a ws_statb64, you must use ws_fstat64.
Declare ws_stdio_stat64, as that's its new name.

svn path=/trunk/; revision=36549
2011-04-10 22:04:14 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +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 f73c579d55 From Jakub Zawadzki:
file-wrappers.[ch] is used only for reading files, and mode is always
"rb".

Attached patch removes 'mode' argument from file_open() & filed_open().

svn path=/trunk/; revision=36493
2011-04-06 07:09:56 +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
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 9ca092db13 Return a string (even though abort is called first) to pacify gcc.
svn path=/trunk/; revision=35724
2011-01-31 16:38:40 +00:00
Bill Meier 7f0107220d Fix various instances of "unreachable code".
svn path=/trunk/; revision=35713
2011-01-30 23:27:57 +00:00
Bill Meier c587b61e2d Fix a typo in a comment
svn path=/trunk/; revision=34586
2010-10-20 15:14:56 +00:00