aboutsummaryrefslogtreecommitdiffstats
path: root/editcap.c
AgeCommit message (Collapse)AuthorFilesLines
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-07-06Clean up handling of missing functions.Guy Harris1-1/+1
With autotools, CMake, and nmake, if we have a function, #define HAVE_{function_name_in_all_caps}, otherwise don't #define it. If we provide our own version of a function in libwsutil, make sure we have a header that declares it, and *ONLY* include that header if HAVE_{function_name_in_all_caps} is *NOT* defined, so that we don't have the system declaration and our declaration colliding. Check for inet_aton, strncasecmp, and strptime with CMake, just as we do with autotools. Simplify the addition of {function_name_in_all_caps}_LO to libwsutil in autotools. Change-Id: Id5be5c73f79f81919a3a865324e400eca7b88889 Reviewed-on: https://code.wireshark.org/review/2903 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03Make --help and --version information a bit more uniform.Guy Harris1-25/+77
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-13/+24
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-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris1-0/+4
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be REC_TYPE_PACKET, for a record containing a packet, or REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific data. Modify code that reads packets to be able to handle non-packet records, even if that just means ignoring them. Rename some routines to indicate that they handle more than just packets. We don't yet have any libwiretap code that supplies records other than REC_TYPE_PACKET or that supporting writing records other than REC_TYPE_PACKET, or any code to support plugins for handling REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug 8590. Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813 Reviewed-on: https://code.wireshark.org/review/1773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23More checks for the presence of a time stamp.Guy Harris1-8/+12
And make sure we have a pointer to the struct wtap_pkthdr for the packet before we check it for a time stamp. Change-Id: I26b205e5467a3a1236e9fd1f7633e86ece5e9040 Reviewed-on: https://code.wireshark.org/review/1762 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Don't assume all packets have time stamps.Guy Harris1-139/+155
Pcap-ng files might have Simple Packet Blocks, which don't have time stamps, and some other file formats might not have time stamps as well. Only check the time stamp if we have one, and don't use "the start time stamp is unset" as an indication that we've just read the first packet, use "the count of packets we've read is 1" as an indication that we've just read the first packet. Change-Id: I097c54867655efb5c343fb880a113b3583736bbd Reviewed-on: https://code.wireshark.org/review/1757 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-289/+287
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-287/+289
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-16/+16
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-16/+16
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-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/+2
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-3/+3
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-26Drop support of Visual Studio 2005Alexis La Goutte1-9/+1
* Remove _MSC_VER < 1500 check * Cleanup config.nmake See http://www.wireshark.org/lists/wireshark-dev/201305/msg00159.html svn path=/trunk/; revision=54965
2014-01-23Given that we allow the 'outfile file' to be stdout, then presumably allBill Meier1-16/+16
text messages (including informational) should go to stderr. svn path=/trunk/; revision=54930
2014-01-23printf(...) --> fprintf(stderr,...) (in a commented out line of code)Bill Meier1-1/+1
svn path=/trunk/; revision=54929
2014-01-22Don't write out packets that have a "captured length" bigger than we'reGuy Harris1-3/+19
willing to read or that's bigger than will fit in the file format; instead, report an error. For the "I can't write a packet of that type in that file type" error, report the file type in question. svn path=/trunk/; revision=54882
2014-01-17From Toralf FörsterMartin Kaiser1-1/+1
fix format strings for signed integers https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9637 svn path=/trunk/; revision=54835
2014-01-03For '-h' option: exit(0) as per convention;Bill Meier1-76/+75
No need to build a constant string on the stack at runtime; Fix a typo; Do some whitespace changes; Change tab-width & etc to 8 in editor modelines. svn path=/trunk/; revision=54581
2013-12-23From Ville Skyttä: Spelling FixesBill Meier1-1/+1
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9591 svn path=/trunk/; revision=54387
2013-12-02Move most of the plugin code from epan to wsutil and remove allGuy Harris1-13/+11
knowledge of particular types of plugins. Instead, let particular types of plugins register with the common plugin code, giving a name and a routine to recognize that type of plugin. In particular applications, only process the relevant plugin types. Add a Makefile.common to the codecs directory. svn path=/trunk/; revision=53710
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-11-15Fix chopping when offset is 0. Fixes ↵Chris Maynard1-8/+8
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9422 svn path=/trunk/; revision=53345
2013-11-09Replace wtap_nstime with nstime_t, remove wtap_nstime_to_sec.Jakub Zawadzki1-2/+2
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-14/+14
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-10-29From Peter WuMartin Kaiser1-9/+14
write editcap debug infos to stderr print some of those messages only in verbose mode https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9342 svn path=/trunk/; revision=52942
2013-09-16Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-1/+1
svn path=/trunk/; revision=52097
2013-09-09Remove a leftover #if 0 block.Chris Maynard1-6/+1
svn path=/trunk/; revision=51888
2013-09-09Fix the "crossed chopping region" problem. Also, move chopping to its own ↵Chris Maynard1-82/+128
function for both clarity and correctness since we need to compute chop offsets and lengths on a per-packet basis whereas previously this was not being done. Lastly, try to improve the documentation a bit concerning chopping and provide another example depicting 2 separate chopping regions. *Maybe* this is clearer? One more example here for posterity: Given the following 75 byte packet, there are 8 different ways to chop the 2 regions marked as 10 and 20 in a single pass: <--------------------------- 75 ----------------------------> +---+-------+-----------+---------------+-------------------+ | 5 | 10 | 15 | 20 | 25 | +---+-------+-----------+---------------+-------------------+ 1) editcap -C 5:10 -C -25:-20 in.pcap out.pcap 2) editcap -C 5:10 -C 50:-20 in.pcap out.pcap 3) editcap -C -70:10 -C -25:-20 in.pcap out.pcap 4) editcap -C -70:10 -C 50:-20 in.pcap out.pcap 5) editcap -C 30:20 -C -60:-10 in.pcap out.pcap 6) editcap -C 30:20 -C 15:-10 in.pcap out.pcap 7) editcap -C -45:20 -C -60:-10 in.pcap out.pcap 8) editcap -C -45:20 -C 15:-10 in.pcap out.pcap svn path=/trunk/; revision=51886
2013-09-09The file was a weird mix of 2 and 4 indent so use a consistent 4-space ↵Chris Maynard1-1226/+1222
indent scheme and add modelines to match. Also, declare a few variables static. (A fix for crossed chopping regions should be coming in the near future ...) svn path=/trunk/; revision=51863
2013-09-09OK, allow either positive or negative offsets no matter if we're chopping ↵Chris Maynard1-30/+37
from the beginning or the end. Given the following example, it's now possible to chop the 10 bytes depicted from the 100 byte packet 4 different ways and achieve the exact same results: <-------- 100 --------> Methods: 1) editcap -C 20:10 in.pcap out.pcap +------+----+---------+ 2) editcap -C -80:10 in.pcap out.pcap | 20 | 10 | 70 | 3) editcap -C -70:-10 in.pcap out.pcap +------+----+---------+ 4) editcap -C 30:-10 in.pcap out.pcap svn path=/trunk/; revision=51854
2013-09-08Specify the optional offset as a positive value, regardless of chopping from ↵Chris Maynard1-6/+8
packet beginning or packet end. I *think* this will be easier syntax to remember. svn path=/trunk/; revision=51848
2013-09-08Allow an optional offset to be specified when chopping bytes from packets.Chris Maynard1-25/+83
svn path=/trunk/; revision=51845
2013-08-01Move a bunch of the crypt modules and pint.h into wsutil.Jeff Morriss1-1/+1
This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
2013-07-16Move strnatcmp.{h,c} from epan into wsutil: there's nothing epan-specificJeff Morriss1-2/+2
there and moving it avoids having to recompile the file for use in editcap and mergecap (which don't link against libwireshark). svn path=/trunk/; revision=50650
2013-07-15Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific ↵Jeff Morriss1-2/+1
there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark). svn path=/trunk/; revision=50598
2013-07-12Allow -C <choplen> to be used more than once so it is now possible to chop ↵Chris Maynard1-26/+37
bytes from both the beginning and end of a packet in a single step. svn path=/trunk/; revision=50536
2013-07-10Add -L option to allow adjustment of original frame length. This change was ↵Chris Maynard1-75/+97
motivated by a question on ask where the user currently has to jump through hoops to accomplish the same thing which can now be done in 1 step via: editcap -T wpan -C 16 -L -F libpcap test.pcap test_wpan.pcap I thought it would be useful enough for others as well. Ref: http://ask.wireshark.org/questions/22689/problems-with-editcap-and-wpan-encapsulation-option svn path=/trunk/; revision=50491
2013-07-10Add strnatcmp by Martin Pool for 'natural order' string comparisons, and ↵Chris Maynard1-2/+10
make use of it in editcap and mergecap for listing encapsulation types. For example: Before: user0 - USER 0 user1 - USER 1 user10 - USER 10 user11 - USER 11 user12 - USER 12 user13 - USER 13 user14 - USER 14 user15 - USER 15 user2 - USER 2 user3 - USER 3 user4 - USER 4 user5 - USER 5 user6 - USER 6 user7 - USER 7 user8 - USER 8 user9 - USER 9 After: user0 - USER 0 user1 - USER 1 user2 - USER 2 user3 - USER 3 user4 - USER 4 user5 - USER 5 user6 - USER 6 user7 - USER 7 user8 - USER 8 user9 - USER 9 user10 - USER 10 user11 - USER 11 user12 - USER 12 user13 - USER 13 user14 - USER 14 user15 - USER 15 svn path=/trunk/; revision=50482
2013-06-25Move a couple of time-related modules into wsutil.Jeff Morriss1-1/+1
A bunch of files didn't really need to include these header files so remove the include line rather than changing it. svn path=/trunk/; revision=50154
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
2013-03-07From Balint:Gerald Combs1-3/+12
[PATCH 1/2] Revert "Try to fix the "LNK4217: locally defined symbol" warnings. This reverts commit r48158. [PATCH 2/2] Employ small hack in editcap to link with a few objects from libwireshark properly From me: Add the ability to reset symbol exports via ws_symbol_export.h's include guard and do so in capinfos.c and editcap.c. We include ws_symbol_export.h in over 200 files so it didn't seem to make sense to remove its include guard entirely. svn path=/trunk/; revision=48170
2013-03-05Use explicit casts.Anders Broman1-2/+2
svn path=/trunk/; revision=48108
2013-02-20When any of our executables start on Windows create or open a "WiresharkGerald Combs1-0/+2
is running" mutex. Have the NSIS installer check for this mutex and ask the user to close Wireshark if it's found. While not perfect this makes the WinSparkle update process much less annoying. svn path=/trunk/; revision=47758
2013-01-14Previous commit put a little too much of the README.developer boilerplate in...Jeff Morriss1-6/+0
svn path=/trunk/; revision=47065
2013-01-14In response to http://ask.wireshark.org/questions/17660/licence-of-editcapJeff Morriss1-2/+28
and as per email response from Richard Sharpe, add GPLv2+ boilerplate header and license. svn path=/trunk/; revision=47063
2013-01-04Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8105 :Pascal Quantin1-1/+1
Allow use of huges values for localtime / ctime / gmtime with MSVC 2008 or later svn path=/trunk/; revision=46930