summaryrefslogtreecommitdiff
path: root/ui/text_import.c
AgeCommit message (Collapse)AuthorFilesLines
2017-04-17Check for localtime() failing.Guy Harris1-2/+12
It "shouldn't happen", but at least this squelches a Coverity complaint, CID 1398224. Change-Id: I9555f71a50574e9386a3c96d52143d838f7f121f Reviewed-on: https://code.wireshark.org/review/21160 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22More checks for localtime() and gmtime() returning NULL.Guy Harris1-0/+1
And some comments in the case where we're converting the result of time() - if your machine's idea of time predates January 1, 1970, 00:00:00 UTC, it'll crash on Windows, but that's not a case where a *file* can cause the problem due either to a bad file time stamp or bad time stamps in the file. Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498 Reviewed-on: https://code.wireshark.org/review/18369 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-13Qt: Multi line import from hex dump without offsetsStig Bjørlykke1-0/+6
Fix importing hex dump without offsets with multiple lines. Change-Id: I7a7339e375b3125688f5b5d29f493704c7b9944a Reviewed-on: https://code.wireshark.org/review/15868 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-06-12Qt: Add import from hex dump without offsetsStig Bjørlykke1-1/+9
Added support for importing from hex dump without offsets. This will create one packet with all hex values found in the file. Change-Id: I0414441721078befeb59aa6a87b9412646cfcf5c Reviewed-on: https://code.wireshark.org/review/15743 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-03Make the Flex scanners and YACC parser in libraries reentrant.Guy Harris1-3/+17
master-branch libpcap now generates a reentrant Flex scanner and Bison/Berkeley YACC parser for capture filter expressions, so it requires versions of Flex and Bison/Berkeley YACC that support that. We might as well do the same. For libwiretap, it means we could actually have multiple K12 text or Ascend/Lucent text files open at the same time. For libwireshark, it might not be as useful, as we only read configuration files at startup (which should only happen once, in one thread) or on demand (in which case, if we ever support multiple threads running libwireshark, we'd need a mutex to ensure that only one file reads it), but it's still the right thing to do. We also require a version of Flex that can write out a header file, so we change the runlex script to generate the header file ourselves. This means we require a version of Flex new enough to support --header-file. Clean up some other stuff encountered in the process. Change-Id: Id23078c6acea549a52fc687779bb55d715b55c16 Reviewed-on: https://code.wireshark.org/review/14719 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-27Pull the invocation of the Lex scanner into common code.Guy Harris1-9/+6
Instead of text_import_setup() and text_import_cleanup() routines, and the actual scanner invocation being done in the dialog box, have a text_import() routine that does all the work. Change-Id: Ifd8a999618dbb411d613e6596484e4c2e013431d Reviewed-on: https://code.wireshark.org/review/14647 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-13text_import: Argument with 'nonnull' attribute passed null found by Clang ↵Alexis La Goutte1-0/+4
Analyzer Change-Id: Ie070aa0f58cca156661ddd5689596e29ad56b128 Reviewed-on: https://code.wireshark.org/review/12412 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-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>
2014-12-18Handle "I can't map this for that file format" better.Guy Harris1-1/+13
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-11-19[pedantic] Replace usage of 'long' and 'long long'Bill Meier1-1/+1
Change-Id: I78fc82c1a83eb04d78a11fc76710c92dfc916208 Reviewed-on: https://code.wireshark.org/review/5395 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-17Remove unnecessary includes of <ctype.h>.Guy Harris1-1/+0
Change-Id: I8eacec5fa8d57b10d40a3627197461dae89c6cb2 Reviewed-on: https://code.wireshark.org/review/4768 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-29Fix Argument with 'nonnull' attribute passed null found by ClangAlexis La Goutte1-0/+5
Change-Id: I719d8adeb4bc6dbd1e34fe56f7cf68e4c6286dc9 Reviewed-on: https://code.wireshark.org/review/3246 Reviewed-by: Evan Huus <eapache@gmail.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-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris1-0/+1
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-09Revert "Refactor Wiretap"Guy Harris1-1/+1
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-1/+1
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-5/+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-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>
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-09-02Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-1/+1
svn path=/trunk/; revision=51682
2013-04-05Match the new text2pcap max packet import size of 65KiB-1 from r48738.Chris Maynard1-2/+2
svn path=/trunk/; revision=48750
2013-04-05Don't forget to move the trailing '\0'.Michael Tüxen1-1/+2
svn path=/trunk/; revision=48746
2013-04-02Add support for the initial direction indication. Irene will hookMichael Tüxen1-6/+37
it up to the GUI soon. svn path=/trunk/; revision=48696
2012-12-26Fix a bunch of warnings.Guy Harris1-45/+45
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
2012-12-05Fix numerous instances of a variable/parameter name "shadowing" a library ↵Bill Meier1-1/+2
function name; (At least some (gcc ?) compilers give a "shadow" warning for these). svn path=/trunk/; revision=46402
2012-10-24Fix indent and add Modelines info for new common ui source file(s)Alexis La Goutte1-106/+119
svn path=/trunk/; revision=45763
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-1/+1
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
2012-09-20Have File->import write pcapng files.Anders Broman1-0/+6
svn path=/trunk/; revision=45025
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45016
2012-09-14Create a common libui using CMake similar to what we do with Autotools.Gerald Combs1-0/+976
Move the GTK+ text import code to the common UI directory. Create wtap_encap_requires_phdr() from code in file_import_dlg.c. svn path=/trunk/; revision=44904