aboutsummaryrefslogtreecommitdiffstats
path: root/reordercap.c
AgeCommit message (Collapse)AuthorFilesLines
2015-12-12Remove -Wwrite-strings compiler flagJoão Valverde1-4/+2
The "-Wwrite-strings" flag produces nuisance warnings. These warnings are not useful, they're impossible to fix in a sane way and therefore are being handled with casts of static strings to (char *). This just moves the warning to [-Wcast-qual] and a compiler pragma is in turn required (and used) to squelch that warning. Remove the Wwrite-strings warning. Let that responsibility fall on the programmer (as is done by casting). Change-Id: I5a44dfd9decd6d80797a521a3373593074962fb5 Reviewed-on: https://code.wireshark.org/review/12162 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-17Misc minor issues caught by cppcheckEvan Huus1-1/+1
All trivial (unused variables, duplicate `break`s, etc). Change-Id: Idbfffae4f6c0b0119a90ae5849de2ed7a1180c9b Reviewed-on: https://code.wireshark.org/review/11886 Petri-Dish: Evan Huus <eapache@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-11-11Update user guide for development releasePascal Quantin1-1/+1
Change-Id: I9b4c5ab2e98ad6daa618bcda20b53a23467e16e0 Reviewed-on: https://code.wireshark.org/review/11734 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-11-10Skip only the actual file descriptor close when writing to stdout.Guy Harris1-2/+2
Have a "this is stdout" flag for a wtap_dumper, and have "open the standard output for dumping" routines that set that flag. When closing a wtap_dumper, do most of the work regardless of whether we're writing to the standard output or not (so that everything gets written out) and only skip the closing of the underlying file descriptor. Change-Id: I9f7e4d142b3bd598055d806b7ded1cb4c378de8e Reviewed-on: https://code.wireshark.org/review/11673 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Treat "-" as "standard input" in the CLI, not in libwiretap.Guy Harris1-3/+9
That's a UI convention, and the GUI shouldn't honor that convention - a user might get confused if they try to save to "-" and end up with nothing (and with a ton of crap in a log file if programs launched from the GUI end up with their standard output and error logged). While we're at it, make randcap report write and close errors. Change-Id: I9c450f0ca0320ce4c36d13d209b56d72edb43012 Reviewed-on: https://code.wireshark.org/review/11666 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-4/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-28editcap/reordercap: rename time to frame_time.Dario Lombardo1-6/+6
According to checkAPI. Change-Id: Iddad6253fc4711ed7870eccadb91d94e5fecd24d Reviewed-on: https://code.wireshark.org/review/10672 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: Michael Mann <mmann78@netscape.net>
2015-08-18Pcapng: clean up Section Header Block handlingHadriel Kaplan1-4/+4
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258 Reviewed-on: https://code.wireshark.org/review/9726 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-06Pcapng: support Name Resolution Block optionsHadriel Kaplan1-3/+10
Make pcapng decode options in an NRB during read, and store the comment option, and write it back out as well. Also make it handle plugin handlers for unknown options in received NRB(s). Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f Reviewed-on: https://code.wireshark.org/review/9723 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-20Suppress a bunch of cast-qual warnings.Gerald Combs1-1/+4
Squelch warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] similar to g630f54f. Change strtod to g_ascii_strtod to squelch a checkAPIs error. Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e Reviewed-on: https://code.wireshark.org/review/7269 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-31Do the full string in get_{compiled,runtime}_version_info().Guy Harris1-6/+4
Have them start the string with "Compiled" or "Running on", and return the string when done. Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810 Reviewed-on: https://code.wireshark.org/review/6155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Move the version_info.c stuff to wsutil/ws_version_info.c.Guy Harris1-2/+0
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde Reviewed-on: https://code.wireshark.org/review/6153 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25Only include <wsutil/os_version_info.h> if we need it.Guy Harris1-1/+0
Change-Id: Idee0e7205969ac2e7b33c4748a1463a0bfffe0a6 Reviewed-on: https://code.wireshark.org/review/6051 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25Check for getopt_long(), not getopt().Guy Harris1-1/+1
We support three types of platforms: 1) UN*Xes that have both getopt() and getopt_long(); 2) UN*Xes that have getopt() but not getopt_long(); 3) Windows, which has neither. Checking for getopt_long() lets us distinguish between 1) and 2) and build getopt_long() for them. Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45 Reviewed-on: https://code.wireshark.org/review/6045 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-24Move twelve show_version() functions from the varoius programs andStephen Fisher1-16/+1
Wireshark UI files into a single one in wsutil. Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad Reviewed-on: https://code.wireshark.org/review/6026 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-18Make sure err_info is always set, and print it iff it's non-null.Guy Harris1-26/+7
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b Reviewed-on: https://code.wireshark.org/review/5830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.Guy Harris1-6/+0
Check for them *only* on opening for writing and writes. Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067 Reviewed-on: https://code.wireshark.org/review/5827 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Handle "I can't map this for that file format" better.Guy Harris1-3/+17
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-17Rename WTAP_ERR_UNSUPPORTED_ENCAP to WTAP_ERR_UNWRITABLE_ENCAP.Guy Harris1-3/+3
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: Icc5c9cff43be6c073f0467607555fa7138c5d074 Reviewed-on: https://code.wireshark.org/review/5797 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-01Add a Buffer to wtap_pkthdr to hold file-type-specific packet metadata.Guy Harris1-11/+12
For example, this can be used for pcap-ng options not mapped to file-type-independent metadata values. Change-Id: I398b324c62c1cc1cc61eb5e9631de00481b4aadc Reviewed-on: https://code.wireshark.org/review/5549 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-28Get rid of unnecessary include of <wsutil/strnatcmp.h>.Guy Harris1-1/+0
Change-Id: I60d5630478ccc185b9eed8066a902c6599421fad Reviewed-on: https://code.wireshark.org/review/4977 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-24Modify includes of config.h so that out-of-tree builds, i.e. CMakeGraham Bloice1-1/+1
don't pick up the in-tree copy. Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71 Reviewed-on: https://code.wireshark.org/review/3798 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-05Fix whitespace/indentation to match editor modelines.Bill Meier1-1/+1
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca Reviewed-on: https://code.wireshark.org/review/3452 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-02Rename buffer_ routines to ws_buffer_ to avoid name collisions.Guy Harris1-3/+3
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-07-03Make --help and --version information a bit more uniform.Guy Harris1-24/+76
Have --version print the version number, the copyright information, the "compiled with" information, the "running on/with" information, and the compiler information. Have --help print the version number, a one-line summary of what the program does, a reference to http://www.wireshark.org for more information, a Usage: line, and a list of command-line options. This means programs doing that don't need to include version.h; that's left up to get_ws_vcs_version_info() to do. Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb Reviewed-on: https://code.wireshark.org/review/2794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03More getopt_long, to add --help and --version support.Guy Harris1-1/+10
Change-Id: I946067b972a70154f02ab561bc0fd029a7a5abc4 Reviewed-on: https://code.wireshark.org/review/2791 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21Add command-line argument to request the version to a number of the utilities.Jeff Morriss1-8/+21
In some cases "-v" was already used so "-V" is the option. Note that the version information in these utilities is much shorter than what is presented by the big programs. As requested by https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5804 Bug: 5804 Change-Id: I35db35a4eace2797afd895f9be7322ef39928480 Reviewed-on: https://code.wireshark.org/review/2489 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-04Guarantee that open routines are initializedMichal Labedzki1-2/+0
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-05-23More handling of missing time stamps.Guy Harris1-22/+9
Make nstime_cmp() handle "unset" time stamps (they're equal to other "unset" time stamps, and less than all other time stamps), use it in reordercap, and "unset" the time stamp if it's absent. Also, nstime_cmp() does not modify its argument, so make it const. Change-Id: I016dab5fefaf4696e78cbd8c6dd3395808e54369 Reviewed-on: https://code.wireshark.org/review/1769 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris1-16/+13
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Allow wtap_read() and wtap_seek_read() to return non-packet records.Guy Harris1-13/+16
This is the first step towards implementing the mechanisms requestd in bug 8590; currently, we don't return any records other than packet records from libwiretap, and just ignore non-packet records in the rest of Wireshark, but this at least gets the ball rolling. Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574 Reviewed-on: https://code.wireshark.org/review/1736 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09Revert "Refactor Wiretap"Guy Harris1-8/+8
This reverts commit 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a. 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-09Refactor WiretapMichael Mann1-8/+8
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-03-27Fix bug9931 'Encapsulated ethernet packets sometimes show invalid FCS'Hadriel Kaplan1-0/+2
This fixes part-1 of bug9931: the uninitialized use of a wtap_pkthdr struct. The second part of the bug deals with dissectors calling the Ethernet dissector for ecnapsulated Ethernet packets but using the wrong dissector handle to do so. That's unrelated to the issue this commit addresses, so I'm splitting them up. Change-Id: I87be7b736f82dd74d8c261062f88143372b5344c Reviewed-on: https://code.wireshark.org/review/848 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'Hadriel Kaplan1-0/+2
There's a relatively new feature in 1.11.3 to select a specific file format reader, instead of relying on magics or heuristics. If you select a file reader and open a file, open it, and then click the reload-file button or go to View->Reload or press the ctrl-R keymap, the file is reloaded but using the magic/heuristics again instead of the file format reader you previously chose. Likewise, the Lua relaod() function has the same issue (which is how I found this problem). I have tested this change by hand, using a Lua script, but I didn't add it to the testsuite because I need another change for my test script to work correctly. (an enhancement rather than a bug fix, which I'll submit separately) Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01 Reviewed-on: https://code.wireshark.org/review/764 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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-02-25Wireshark: Add option to choose format type of capture fileMichal Labedzki1-1/+3
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-07Replace "svn" with "git" all over the place.Gerald Combs1-4/+4
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate. Rename "svnversion.h" to "version.h" as Evan suggested. Update some URLs. In make-version.pl, make sure we don't set an improper upstream branch name. Use the number of commits + short hash from `git describe` for package names by default. Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96 Reviewed-on: https://code.wireshark.org/review/139 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-01-15Fun and games with const.Guy Harris1-2/+2
svn path=/trunk/; revision=54817
2014-01-02No seek-read routines use the length argument, so eliminate it fromGuy Harris1-6/+3
wtap_seek_read(). svn path=/trunk/; revision=54570
2013-12-31Add -h option (with output to stdout and exit status 0).Bill Meier1-15/+40
Add editor modelines. svn path=/trunk/; revision=54514
2013-11-09Replace wtap_nstime with nstime_t, remove wtap_nstime_to_sec.Jakub Zawadzki1-6/+6
After r50154 nstime_t is inside wsutil/ so wiretap don't need it's own copy. svn path=/trunk/; revision=53184
2013-11-08The "file types" we have are actually combinations of types andGuy Harris1-2/+2
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-07-26Give more detailed diagnostics for errors.Guy Harris1-11/+48
Actually *check* for errors when reading. svn path=/trunk/; revision=50934
2013-07-26Send error messages to the standard error, and include the program nameGuy Harris1-4/+8
in the error message. svn path=/trunk/; revision=50928
2013-06-19Preserve summary information when reordering a filePascal Quantin1-1/+11
svn path=/trunk/; revision=50054
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-4/+7
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-03-20 From beroset:Bill Meier1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438
2012-10-17Fill some phdr values also when doing random readJakub Zawadzki1-2/+0
svn path=/trunk/; revision=45619
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-13/+7
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601