summaryrefslogtreecommitdiff
path: root/wsutil
AgeCommit message (Collapse)AuthorFilesLines
2016-12-09ui: move filesystem code to wsutil/filesystem.cDario Lombardo2-0/+35
This function can be used by code outside ui (eg. extcap). Ping-Bug: 13218 Change-Id: Ic11f7acebefeaf777692df044ebff9b1bc387aa3 Reviewed-on: https://code.wireshark.org/review/19178 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-05Clean up initialization code for programs.Guy Harris1-2/+7
Make the init_progfile_dir() call unconditionally, even if plugins aren't supported, as that doesn't necessarily mean nobody uses the directory containing the executable. Report the error the same way in all programs, and free the error string after we're finished with it. Make the error - and the comment before the code - reflect what init_progfile_dir() is actually doing (the goal is to get the full pathname of the directory *containing* the executable; that's generally done by getting the pathname of the executable and stripping off the name of the executable, but that's won't necessarily always be the case). Also note for TShark that we won't be able to capture traffic, just as we do for Wireshark (if we don't have the pathname of the program file, we don't have a pathname to use to find dumpcap). Have the plugin scanner just fail silently if we weren't able to get the plugin directory path, so we don't have to worry about calling it if init_progfile_dir() fails. Clean up white space while we're at it. Change-Id: I8e580c719aab6fbf74a764bf6629962394fff7c8 Reviewed-on: https://code.wireshark.org/review/19076 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-05Update a comment to reflect current reality.Guy Harris1-11/+15
Change-Id: Ied84e0363161ebc42c8cf24e7ade4b1b4e536448 Reviewed-on: https://code.wireshark.org/review/19074 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-02Make sure config.h is included before inet_addr.h.Guy Harris1-2/+2
Otherwise, _FILE_OFFSET_BITS might be defined by a header file included by inet_addr.h before it gets defined by config.h. Change-Id: I5987b3f1493b81fd2d427d9792b9606117b255d0 Reviewed-on: https://code.wireshark.org/review/19018 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-15Add more information about UTF 8 in our source code.Gerald Combs1-3/+10
Change-Id: I81d41fdc1aa66dd904160508c4a2e634337b5ba0 Reviewed-on: https://code.wireshark.org/review/18833 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-11-03wsutil: add initializer (found by clang ccc).Dario Lombardo1-1/+1
Warning: wireshark/wsutil/strtoi.c:113:1: warning: The left operand of '<' is a garbage value DEFINE_WS_STRTOI_BITS(32) ^~~~~~~~~~~~~~~~~~~~~~~~~ wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS' if (val < 0) \ ~~~ ^ wireshark/wsutil/strtoi.c:114:1: warning: The left operand of '<' is a garbage value DEFINE_WS_STRTOI_BITS(16) ^~~~~~~~~~~~~~~~~~~~~~~~~ wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS' if (val < 0) \ ~~~ ^ wireshark/wsutil/strtoi.c:115:1: warning: The left operand of '<' is a garbage value DEFINE_WS_STRTOI_BITS(8) ^~~~~~~~~~~~~~~~~~~~~~~~ wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS' if (val < 0) \ ~~~ ^ 3 warnings generated. Change-Id: I9eef0f2c0d4500531655a8b43509205a1f4e0684 Reviewed-on: https://code.wireshark.org/review/18640 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-02Move Base32_encode from packet-fc00.c to wsutil (as ws_base32_decode)Michael Mann4-0/+143
There could be some reuse out of it, so but it with the rest of the general utilities. Change-Id: I404c135b933660a82678510b9ca2701985c5632a Reviewed-on: https://code.wireshark.org/review/18589 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-27wsutil: add check for input pointers to ws_strtoi functions.Dario Lombardo1-0/+14
Change-Id: I7353a3b00392aa606fad04ef76e8b18ffbabbf5e Reviewed-on: https://code.wireshark.org/review/18449 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-22wsutil: add statements for c++ calls.Dario Lombardo1-0/+8
Change-Id: I082eb462b0a6ce77f9ca82c51d79d65516c92b53 Reviewed-on: https://code.wireshark.org/review/18401 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> 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-10-11dumpabi: Fix log paths.Gerald Combs1-1/+1
Make sure the paths we pass to "cat" and "abi-compliance-checker -log-path" match. Change-Id: Ie68b445b9d92d85c0ed1eb508a78c0bcc960d061 Reviewed-on: https://code.wireshark.org/review/18156 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-10-06jsmn(.h): fix warning: '@param' command used in a comment that is not ↵Alexis La Goutte1-3/+3
attached to a function declaration [-Wdocumentation] Change-Id: Ia03fc0d1d0d4af430055f2ae3c66416922b62fd1 Reviewed-on: https://code.wireshark.org/review/18009 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-01wsjsmn(.h): fix no newline at end of file [-Wnewline-eof]Alexis La Goutte1-1/+1
Change-Id: If99fa78b20cdc9d2180652f7e4331fe2f8aacbff Reviewed-on: https://code.wireshark.org/review/18008 Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-09-30wsutil: split libjsmn.Dario Lombardo6-143/+202
The libjsmn was imported into the tree and enhanced with a new function. This change splits it into the "original" libjsmn and an addictional module wsjsmn that contains the new function. This will make easier to port within the tree future versions of the library. Change-Id: I3f1caa91bee462e0767e5e18d0b6a10f0b1cad32 Reviewed-on: https://code.wireshark.org/review/17963 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-30cmake: make WERROR_COMMON_FLAGS a normal stringPeter Wu1-23/+8
Instead of checking for the boolean "FALSE", just set an empty string. This avoids the need to check for WERROR_COMMON_FLAGS before using it. The transformation is the same for all files, remove "if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since we have a string here and not a list). Modelines have been added where missing. Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92 Reviewed-on: https://code.wireshark.org/review/17997 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-23Show memory info on macOS and LinuxStig Bjørlykke1-0/+3
Added support for showing memory information (amount of physical memory) in version information on macOS and Linux. Moved CPU info and memory info right after OS version info. Change-Id: I305d1b7d015d50ed137f2c80b31d698e9315d735 Reviewed-on: https://code.wireshark.org/review/17884 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-09-23dumpcap: Include CPU info as hardware description in SHBStig Bjørlykke4-0/+123
Add CPU info as hardware description in session header block when using pcapng. Use capture_comment from the capture_options structure when using ring buffer. Change-Id: I5e688fc2d6ab61de1f64ad9a8a96e6e39e8cf708 Reviewed-on: https://code.wireshark.org/review/17862 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-09-16Add ws_hexstrtou{bits} and use ws_hexstrtou32 in androiddump.Guy Harris2-44/+82
Make the reply length unsigned - there's no reason for it to be signed. Change-Id: I5f4d1f027eeddee939547c052220efb89800f4b1 Reviewed-on: https://code.wireshark.org/review/17740 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-12Let strtoi with NULL endptr require no invalid charactersPeter Wu3-11/+11
If the caller is not interested in checking its end, then it probably wants a valid number only if the string contains a valid number. Add a shortcut for this. Change-Id: I39701bd445e29fb2606720b18ca3764c74a7255b Reviewed-on: https://code.wireshark.org/review/17658 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-09-08Add get_ routines to get a guint32, and use them.Guy Harris2-1/+39
By analogy to get_natural_int() and get_positive_int(), add routines to get a guint32 and to get a non-zero guint32, doing all the necessary error checks, and use it. Change-Id: I65a9ac8a3d136886df3588806ae7af5bdc7b8cb6 Reviewed-on: https://code.wireshark.org/review/17586 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-07Make the ws_strto* routines more like the strto* routines.Guy Harris3-22/+39
Not all uses of atoi() or various strto* routines in Wireshark expect the string to contain *only* a number, so not all uses should require that the byte after the number be a '\0'. Have the ws_strto* routines take a "pointer a pointer set to point to the character after the number" argument, and have the callers do the appropriate checks of the character after that. This fixes the VMS trace reading code so that it can read those files again. The get_ routines are handed command-line arguments, so they *do* expect the string to contain only a number; have them check to make sure the byte after the number is a '\0'. Change-Id: I46fc1bea7912b9278e385fe38491a0a2ad60d697 Reviewed-on: https://code.wireshark.org/review/17560 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06Always set *cint before returning.Guy Harris1-0/+1
Change-Id: I333aef7d3fe4ad3bf7c2a4d7318766fcbd2e4cd2 Reviewed-on: https://code.wireshark.org/review/17539 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06Suppress another warning if told not to report failures.Guy Harris1-2/+17
That's another failure that can occur if you're trying to load a libwireshark plugin in a program that doesn't use libwireshark if, for example, references to an undefined symbol don't prevent the module from being loaded in the first place. Change-Id: I21629c0094fdca7dfbd88f39b7e6c10fb600b401 Reviewed-on: https://code.wireshark.org/review/17537 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06strtoi(.c): fix extra ';' outside of a function [-Wextra-semi]Alexis La Goutte1-6/+6
Change-Id: I2d92678b2117da732be309c2d430d0c97c7a7eed Reviewed-on: https://code.wireshark.org/review/17528 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-06Use ws_strtoi32() in get_natural_int().Guy Harris1-10/+14
Change-Id: I9a95239de8db18cff0f6c62cb526f3ef0cb29f01 Reviewed-on: https://code.wireshark.org/review/17513 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06Return the maximum or minimum value for ERANGE.Guy Harris1-5/+57
That way, for signed values, the caller knows whether ERANGE means "too large" or "too small"; this is analogous to what the C routines return. Change-Id: Ifc1fc4723733be606487093f8aa77ae2d89d2c40 Reviewed-on: https://code.wireshark.org/review/17512 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06Check for signs in unsigned numbers and fail if we see one.Guy Harris1-0/+7
-1 is not an unsigned number. For that matter, neither is +1; "unsigned" means "without a sign", and they both have signs. ANSI C's strto{whatever} routines - even the ones that supposedly are for "unsigned" values - and the GLib routines modeled after them allow a leading sign, so we have to check ourselves. Change-Id: Ia0584bbf83394185cde88eec48efcdfa316f1c92 Reviewed-on: https://code.wireshark.org/review/17511 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-05Have scan_plugins() take an argument specify what to do on load failures.Guy Harris2-9/+26
That's a less gross hack to suppress load failures due to not having libwiretap than providing a no-op failure-message routine, as it at least allows other code using a failure-message routine, such as cmdarg_err() and routines that call it, to be used. We really should put libwiretap and libwireshark plugins into separate subdirectories of the plugin directories, and avoid even looking at libwireshark plugins in programs that don't use libwireshark. Change-Id: I0a6ec01ecb4e718ed36233cfaf638a317f839a73 Reviewed-on: https://code.wireshark.org/review/17506 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-05wsutil: add string to integer conversion utilities.Dario Lombardo4-0/+188
In the current code many functions have been used for convertion (strtol, atoi, g_ascii_strtoll, etc). Those utilities want to be the only, shared, way to convert integers. Change-Id: I22ba1bf54e144e73a4728612a4437de5a2d339e2 Reviewed-on: https://code.wireshark.org/review/17414 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-08-30time_util: fix -Wshadow issuePeter Wu1-3/+3
time_util.c was already fixed, but the header was missing the change, breaking the build on a very old compiler. Change-Id: I95685c9a3e25dcb7567f2551b92f20c8792a6e47 Reviewed-on: https://code.wireshark.org/review/17384 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-26wsutil: add enumeration of local ip addresses in Windows.Dario Lombardo2-3/+72
Routine used by ssh-based extcaps. Change-Id: I06d8e1e1444cd03a0508dc0c7cb91d340a451c58 Reviewed-on: https://code.wireshark.org/review/17308 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-08-25wsutil: fix indentation of interface.cDario Lombardo1-42/+42
Change-Id: Icf0c0c4ce1e3763eb385de24dc608a120e0f4af2 Reviewed-on: https://code.wireshark.org/review/17307 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-23CMake: Allow setting per target compiler warningsJoão Valverde1-0/+1
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow using different flags per target. Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS and using the COMPILE_OPTIONS property to set them. This change is just setting mechanism and there should be no difference in generated warnings. The check_X_compiler_flag cmake test is changed to test each flag individually. We need a list, not a space separated string, and the aggregate test is not significant. Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25 Reviewed-on: https://code.wireshark.org/review/17150 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-08-07Avoid colliding with the (old) UNIX stime() system call.Guy Harris1-14/+15
Rename "stime" to "sys_time", and, for consistency, do the same with "utime". This failed when I tried a build on an Ubuntu 12.04 LTS machine. Change-Id: Ib955b723506346aa742db0de4d26dc157bcd4fc8 Reviewed-on: https://code.wireshark.org/review/16935 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-30Add string function times to wmem_test.Gerald Combs2-13/+28
The system, GLib, and wmem string functions can perform differently, particularly on Windows. Start adding performance tests to wmem_test so that we can see the differences. With this change applied "wmem_test --verbose" prints out the following on a Windows 7 x64 VM here. wmem_test is linked against GLib 2.4.20. (MINPERF:g_printf_string_upper_bound (via g_snprintf) 1 string: u 327.602 ms s 0 .000 ms) (MINPERF:g_printf_string_upper_bound (via g_snprintf) 5 strings: u 1419.609 ms s 0.000 ms) (MINPERF:g_printf_string_upper_bound (via g_snprintf) mixed args: u 1606.810 ms s 0.000 ms) (MINPERF:_snprintf_s upper bound 1 string: u 124.801 ms s 0.000 ms) (MINPERF:_snprintf_s upper bound 5 strings: u 140.401 ms s 0.000 ms) (MINPERF:_snprintf_s upper bound mixed args: u 124.801 ms s 0.000 ms) (MINPERF:g_strdup_printf 2 strings: u 702.005 ms s 0.156 ms) (MINPERF:g_strconcat 2 strings: u 78.000 ms s 0.000 ms) (MINPERF:g_strdup_printf 5 strings: u 1419.609 ms s 0.156 ms) (MINPERF:g_strconcat 5 strings: u 93.601 ms s 0.156 ms) (MINPERF:wmem_strdup_printf 2 strings: u 343.202 ms s 0.312 ms) (MINPERF:wmem_strconcat 2 strings: u 93.601 ms s 0.468 ms) (MINPERF:wmem_strdup_printf 5 strings: u 327.602 ms s 8.268 ms) (MINPERF:wmem_strconcat 5 strings: u 62.400 ms s 3.432 ms) Change-Id: Id9b23918829db1719d141e7f830b9eba6245a25b Reviewed-on: https://code.wireshark.org/review/14857 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-30Move IPv6 inet definitions to wsutil/inet_ipv6.hJoão Valverde1-1/+64
Change-Id: I880adf7fc1e131639f318cdecf7d8e59262d89fb Reviewed-on: https://code.wireshark.org/review/16784 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-26Cleanup some checkAPI warnings that were missed in previous patches.Michael Mann1-1/+2
Some search/replace of printf, g_warning and GTK APIs were changed to use a ws_ prefix Change-Id: I9beb763a975530a4006d1afbcad079a7d8d4ebf9 Reviewed-on: https://code.wireshark.org/review/16704 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-26Fix some of the checkAPIs.pl warnings for g_warning.Michael Mann1-0/+5
1. Create ws_g_warning for legitimate uses of g_warning 2. Use proto_tree_add_debug_text 3. Comment some out Change-Id: Ida044bf40286b955fdd529c4f9907c8e09b3d7c5 Reviewed-on: https://code.wireshark.org/review/16678 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-25Fix checkAPI.pl warnings about printfMichael Mann3-9/+19
Many of the complaints from checkAPI.pl for use of printf are when its embedded in an #ifdef and checkAPI isn't smart enough to figure that out. The other (non-ifdef) use is dumping internal structures (which is a type of debug functionality) Add a "ws_debug_printf" macro for printf to pacify the warnings. Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd Reviewed-on: https://code.wireshark.org/review/16623 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-23filesystem.c: Don't constify mallocated pointerJoão Valverde1-15/+12
Change-Id: I8991682bda256c5e1c09a303b0243e240b276101 Reviewed-on: https://code.wireshark.org/review/16602 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-22Minimize allocations for frame tvbuffs and Buffers.Gerald Combs1-3/+22
Try to minimize the number of times we allocate memory for Buffers and Buffer data. Change-Id: I738fdc64e571772ef4ba6335d49087277dd7b430 Reviewed-on: https://code.wireshark.org/review/16577 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-21Use Windows CRT string functions in some places.Gerald Combs2-1/+102
Copy wsutil/wsprintf.h from change 16537. Update it to use functions appropriate to Visual C++ >= 2015, < 2015, and everything else. Add notes about specific API issues. Update epan/expert.c to use ws_snprintf, since the VS profiler shows it as a minor hot spot. This reduces load time for a large-ish capture from ~14s to ~12s here. Migrate a previous column-utils change. Change-Id: Id4064b7c06c35fd447b63c73f731afee181df4f9 Reviewed-on: https://code.wireshark.org/review/16483 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-12Add resource usage logging.Gerald Combs2-0/+78
Add log_resource_usage, which prints the current and elapsed user and system times. Add a usage example in packet_list_model.cpp. Change-Id: I747161c754a3731e540821715cc9bb10b3dc821d Reviewed-on: https://code.wireshark.org/review/16383 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-30Remove Makefile.common filesJoão Valverde2-187/+135
Now that nmake build system has been removed they are not needed anymore. Change-Id: I88075f955bb4349185859c1af4be22e53de5850f Reviewed-on: https://code.wireshark.org/review/16050 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-06-25wsutil: Move Win32 helper routines from capchildRoland Knall4-0/+257
Move error handling and argument quoting routines from capchild to wsutil, as those methods will be used by extcap_spawn as well. Change-Id: I2c4515fefd5aecad317fcdaefa721734288f792c Reviewed-on: https://code.wireshark.org/review/16123 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Roland Knall <rknall@gmail.com>
2016-06-22Handle ENAMETOOLONG.Gerald Combs1-0/+8
g_strerror doesn't appear to handle ENAMETOOLONG. Check for it ourselves. Change-Id: Icd113a81e8d95bb3c84c91bb420a1a6a19bf5d40 Reviewed-on: https://code.wireshark.org/review/16041 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-21libcodecs and libwsutil are DLLs, not static librariesPascal Quantin1-1/+1
Change-Id: I4486f35e07c72d4ca35d5649de25d0c9abd2a964 Reviewed-on: https://code.wireshark.org/review/16057 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-21pcap: Add support to "new" Npcap native mode without setting PATHYang Luo1-0/+9
Npcap decided not to add "C:\Windows\System32\Npcap" to system PATH in the installation any more (starting from Npcap 0.07 r14). So this patch needs to be applied, otherwise Wireshark will not find Packet.dll (the error message will only say wpcap.dll is missing, but actually is Packet.dll missing). Change-Id: Ifd8b6e6d8ecf9866cd37c3368b604de210ff8c7b Reviewed-on: https://code.wireshark.org/review/15959 Reviewed-by: Yang Luo <hsluoyz@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-16filesystem: Fix build dir detection when using cmakePeter Wu1-3/+17
Fixes loading of plugins by detecting the build output directory of cmake. This requires a "CMakeCache.txt" file to be present in the parent directory (above run/). Change-Id: I297432cdcd0981646058410f3eadf5f73b5248c8 Reviewed-on: https://code.wireshark.org/review/7453 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16file_util.c: do not search in Npcap installation folder when calling ↵Pascal Quantin1-13/+0
ws_load_library() ws_load_library() is not used to load packet.dll or wpcap.dll (we use ws_module_open() for this). Let's not lose time checking the folder content. Change-Id: Ibd4a71b8b0c5ffc0c4c146eca51ad9f20964515b Reviewed-on: https://code.wireshark.org/review/15938 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>