summaryrefslogtreecommitdiff
path: root/tools/checkAPIs.pl
AgeCommit message (Collapse)AuthorFilesLines
2014-06-03Add a few more ad-hoc validations of the hf[] FIELDCONVERT field.Bill Meier1-2/+16
Change-Id: Icd817a950331a2e7416a28c3d4a5a004d297e6f9 Reviewed-on: https://code.wireshark.org/review/1845 Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-05-07Error out if someone passes the address of a pointer to a *_string to VALS() ↵Jeff Morriss1-0/+8
or RVALS(). Change-Id: I85021b1cba151c16bf0a2d30169cf3dec77780f5 Reviewed-on: https://code.wireshark.org/review/1540 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25Support out-of-source checkapiStig Bjørlykke1-0/+6
Always call $(top_srcdir)/tools/checkAPIs.pl with -sourcedir=$(srcdir) from Makefile.am to allow out-of-source 'make checkapi'. Change-Id: I60d7e0079984a8ededdacf4517a0738486fa7973 Reviewed-on: https://code.wireshark.org/review/1294 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-19Don't se_ allocate strings when mapping addresses to column strings.Guy Harris1-1/+0
This should significantly reduce memory usage, without increasing the CPU time required to process a capture file in TShark or Wireshark. As a result, se_address_to_str() is no longer used; eliminate it. Fixes bug #9949. Change-Id: I65a112a426c82cc73a957b81384c765c3d14f2c3 Reviewed-on: https://code.wireshark.org/review/1213 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-14Add tvb_get and proto_tree_add for string-encoded timestampsHadriel Kaplan1-1/+1
This commit adds tvb_get_string_time and proto_tree_add_time_item routines for getting nstime fields from the tvb when they are encoded in ASCII string form. The proto_tree_add_time_item routine is also usable for normal big/little-endian encoded time_t, and has the advantage of retrieving the value even if there's no proto tree. It also exposes the routines to Lua, both so that a Lua script can take advantage of this, but also so I can write a testsuite to test the functions. Change-Id: I955da10f68f2680e3da3a5be5ad8fdce7ed6808c Reviewed-on: https://code.wireshark.org/review/1084 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14Fix Bug 9951: 'git commit hook isn't calling checkAPIs.pl with arguments for ↵Hadriel Kaplan1-0/+14
the dissectors' I recently made a change to packet-rtp.c and inappropriately included g_error() in it, which the builbots caught during their run of checkAPIs.pl. But checkAPIs.pl is supposed to catch such things for us before we submit, by being invoked in the git pre-commit hook. Apparently though, buildbots call checkAPIs.pl with extra arguments for different cases... and for packet dissectors it calls it with a '-g abort' argument, which is how it caught the g_error. So the "bug" is that the pre-commit hook should invoke checAPIs.pl with that argument too, for epan/dissectors/packet-*.c files. Change-Id: Ie8f9dcc55f2248918208dea85a04f67e6bf9829a Reviewed-on: https://code.wireshark.org/review/953 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-02Revert Remove check and inverse code to display a error if there is a $Id$Alexis La Goutte1-1/+4
Change-Id: I7061ad312df5079924c927ca95a8fa111c756012 Reviewed-on: https://code.wireshark.org/review/498 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-01Fix checkApis perl script false positive proto_tree_add with ENC_*Hadriel Kaplan1-1/+2
In epan/proto.c in function proto_tree_add_split_bits_crumb, the proto_tree_add_text function is called with one of its arguments using ENC_BIG_ENDIAN, but it's not an argument for proto_tree_add_text itself but instead a function being called inside it. checkAPIs.pl tries to avoid this in check_proto_tree_add_XXX_encoding, by removing parenthesis arguments, but in this acse there are newlines between the arguments, causing the regex to not catch them. This commit fixes the regex. Change-Id: I70ef79d5436ba2ec04ffdc3d9939c7aa2cdf6a1f Reviewed-on: https://code.wireshark.org/review/902 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-13Fix value_string checks in checkAPIs.pl.Gerald Combs1-2/+2
Some strings contain semicolons, which meant g36db2df was terminating our REs too early. Try terminating them with '}' followed by ';'. Change-Id: I97f63351ef35c91e3123d9abd47576d47fea4b2b Reviewed-on: https://code.wireshark.org/review/638 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-03-13Add a check for newlines in value_strings.Gerald Combs1-81/+118
Update checkAPIs.pl to look for newlines in value_strings and enum_val_t's. We now have to perform the check before we strip quoted strings. Hopefully that won't cause a problem. Rename the check since we do more than check for NULL termination. Add modelines. Fixes bug 9878. Change-Id: I39dd910db60c7028ea4bdb58e8cfdb239c094748 Reviewed-on: https://code.wireshark.org/review/628 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-26More tvbuff API deprecation, comment expansion, and documentation updates.Guy Harris1-0/+1
Do with tvb_get_stringz() what was done with tvb_get_string(). Redo the comments for the string get routines to try to give more detail in a fashion that's a bit less hard to read. Warn, in comments, of the problems with using tvb_get_string()/tvb_get_stringz() (i.e., if your strings are non-ASCII, all bytes with the 8th bit set are going be replaced by the Unicode REPLACEMENT CHARACTER, and displayed as such). Warn, in a comment, of the problems with tvb_get_const_stringz() (i.e., it gives you raw bytes, rather than guaranteed-to-be-valid UTF-8). Update documentation and release notes appropriately. Change-Id: Ibd3efb92a203861f507ce71bc8d04d19d9d38a93 Reviewed-on: https://code.wireshark.org/review/327 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-22TVB API deprecations and cleanupEvan Huus1-6/+15
- rename tvb_length and similar to tvb_captured_length and similar; leave #defines in place for backwards-compat, but mark them clearly as deprecated in code comments and in checkAPI - remove tvb_get_string as C code and just leave a #define in place for backwards-compat; mark it clearly as deprecated in code comment and checkAPI - update READMEs and sample dissector for all of the above - while in the neighbourhood, make checkAPI skip (and warn) for missing files instead of bailing on the whole check, so subsequent files still get checked Change-Id: I32fc437896ca86ca73e9b49d5f50400adf8ec5ad Reviewed-on: https://code.wireshark.org/review/311 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-13Don't complain if files don't have $Id$ in them.Jeff Morriss1-7/+0
$Id$ is pretty useless in git so don't enforce it in our source code. Change-Id: Ie8b1b9627aabbca72c9c1dd93a9a76901e6967eb Reviewed-on: https://code.wireshark.org/review/203 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2013-12-18Some proto_tree_add_xxx functions have a '_' in the function name so make ↵Michael Mann1-1/+1
sure they get counted in the proto_tree_add_text percentage. Makes a few dissectors look a little better. svn path=/trunk/; revision=54236
2013-11-23Implement address_to_str which is like ep_address_to_str and se_address_to_strEvan Huus1-1/+3
except it takes a wmem scope instead. Add the two emem equivalents to checkAPI as (weakly) deprecated. svn path=/trunk/; revision=53528
2013-10-06Allow a "more complex" algorithm to finding proto_tree_add_text overuse. ↵Michael Mann1-2/+17
Disabled by default, but used when I want to go on an add filterability spree. convert_proto_tree_add_text.pl makes these easier to fix, so why not be pickier about the percentages that dissectors use. svn path=/trunk/; revision=52392
2013-09-16Don't print a warning about missing svn id when the argument is notJörg Mayer1-1/+4
a file. Warn about the "wrong" filetype and continue svn path=/trunk/; revision=52105
2013-09-15Tweak mq macro and checkAPI to avoid false positives - "garbage"Evan Huus1-1/+1
(like a #define) at the beginning of a line before a value_string no longer matches so a #define that includes the beginning of a value_string doesn't confuse the script. svn path=/trunk/; revision=52089
2013-09-15Add help optionJörg Mayer1-16/+29
List options one by one svn path=/trunk/; revision=52068
2013-09-15http://url is NOT a c++ style commentJörg Mayer1-1/+1
svn path=/trunk/; revision=52061
2013-09-13OK, all the Makefiles use -build since r41943, so add that option back for now.Chris Maynard1-1/+3
svn path=/trunk/; revision=52016
2013-09-13Update the comments to match the current usage.Chris Maynard1-1/+4
svn path=/trunk/; revision=52015
2013-09-13Rename --build to --check-addtext/--nocheck-addtext for clarity.Chris Maynard1-9/+15
Add --check-addtext/--nocheck-addtext, --check-hf/--nocheck-hf and --debug to the usage output and format the usage output a little better. svn path=/trunk/; revision=52006
2013-09-05Make checkAPI notify (warnings only, for now) about deprecated emem functions.Evan Huus1-1/+61
svn path=/trunk/; revision=51782
2013-07-05Make checkAPIs.pl a little more discerning when looking for too many ↵Michael Mann1-2/+5
proto_tree_add_text()s. I believe the intent was to ignore "small" dissectors that didn't have enough fields to qualify, but the previous logic ignored dissectors that were (almost) all proto_tree_add_text and no proto_tree_add_xxx. I'm flexible on the definition of "small" (20 "fields"), but I think checkAPIs should flag the "all proto_tree_add_text" dissectors. svn path=/trunk/; revision=50385
2013-03-16flag up a warning if someone includes gcrypt.h instead of wsutil/wsgcrypt.hMartin Kaiser1-0/+24
svn path=/trunk/; revision=48340
2013-02-02Tweaks:Bill Meier1-6/+97
- Remove comments from the input string before checking hf[] entries; - Remove code under '#if 0' before doing API checks. svn path=/trunk/; revision=47447
2012-12-18Don't do proto_tree_add_ether(..., tvb_get_ptr(...)), just use ↵Jeff Morriss1-0/+1
proto_tree_add_item(). svn path=/trunk/; revision=46598
2012-12-02Add SET_ADDRESS and SET_ADDRESS_HF to the list of APIs we (may--if we ↵Jeff Morriss1-1/+3
uncomment the code) check for being called with tvb_get_ptr(). svn path=/trunk/; revision=46326
2012-11-29As requested by Anders on -dev: check enum_val_t's for NULL termination.Jeff Morriss1-0/+34
Also check that they are all const. svn path=/trunk/; revision=46294
2012-09-19Remove #defines that provided backward source compatibilityJörg Mayer1-7/+0
for deprecated dissector add/remmove/... functions. svn path=/trunk/; revision=45000
2012-09-10Use non-capturing grouping when grouping just for alternatives;Bill Meier1-6/+6
Also: improve error message slightly in the case of a missing NULL termination. svn path=/trunk/; revision=44826
2012-09-10string_strings and range_strings must also be {0, NULL} terminated.Jeff Morriss1-40/+42
Also, remove some tabs. svn path=/trunk/; revision=44824
2012-07-23r43756 said that _snwprintf is banned. Make it so.Jeff Morriss1-1/+2
svn path=/trunk/; revision=43939
2012-07-19Add a local errorCount variable to functions that use it, have themGuy Harris1-2/+7
return it, and use the return value. svn path=/trunk/; revision=43818
2012-07-19Yup, that did it. Make use of ENC_ values in non-item proto_tree_addGuy Harris1-1/+3
calls an error. Fix one case where we weren't counting an error (unregistered ett variables). svn path=/trunk/; revision=43817
2012-07-03As suggested by Jakub in ↵Jeff Morriss1-0/+39
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7429#c4 : Add checks for calls to proto_tree_add_XXX (where XXX != item and a few other functions) with an encoding (ENC_*) argument. Also add a comment to checkAddTextCalls() about why 3 loops are used. svn path=/trunk/; revision=43563
2012-06-28Update FSF address - part II.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=43538
2012-06-11Prohibit strtod() (as per r 43212).Jeff Morriss1-69/+70
Replace tabs with spaces (for consistency). svn path=/trunk/; revision=43213
2012-06-03Add more depricated functionsAnders Broman1-0/+3
svn path=/trunk/; revision=43040
2012-05-31Look only for calls to strlen() within an snprintf() call (not for any fileJeff Morriss1-5/+21
that has the string "strlen" somewhere after a call to snprintf()). svn path=/trunk/; revision=42950
2012-05-31If we're feeding the output of strlen to an snprintf-style functionGerald Combs1-1/+5
there's a good chance we're doing something wrong. svn path=/trunk/; revision=42947
2012-05-24Followup to r42823: check for RVALS used without BASE_RANGE_STRING.Jeff Morriss1-12/+16
Also: identify problematic fields by hf_variable_name instead of name or abbreviation (the variable name is sure to be unique). svn path=/trunk/; revision=42826
2012-04-04Add a "-build" argument to checkAPIs.pl. Use that argument when buildingJeff Morriss1-2/+6
from makefiles (and thus from the buildbot). The intention is to be able to tell when a human is running the tool so we can provide more code-review guidance. As a starter, enable the "too many proto_tree_add_text() calls" check when a human is running the tool. svn path=/trunk/; revision=41943
2012-03-07Revise and enable test for hf[] FT_BOOLEAN fields with a non-zero bit mask ↵Bill Meier1-8/+9
and with BASE_... in the 'display' field. svn path=/trunk/; revision=41399
2012-03-06Add test for correct usage of hf[] FT_BOOLEAN 'display' field;Bill Meier1-0/+8
(Commented out until all the incorrect usages in Wireshark have been fixed). svn path=/trunk/; revision=41380
2012-03-06Prohibit using anything other than FT_BOOLEANs with true_false_strings.Jeff Morriss1-0/+8
Prohibit using FT_BOOLEANS with value_strings. svn path=/trunk/; revision=41364
2012-02-24g_fprintf() & g_vfprintf() should not be used....Bill Meier1-0/+4
svn path=/trunk/; revision=41181
2012-02-08As suggested by Joerg on the -dev list yesterday: count up the number ofJeff Morriss1-1/+39
proto_tree_add_text() calls and compare that to the number of proto_tree_add_<something else>() calls and complain if more than 50% of the calls are add_text()'s. proto_tree_add_text() calls whose returned proto_item is used are not counted as hanging a subtree off a text item is an appropriate use for text items. I chose 50% because even at that level there are many dissectors with "too many" proto_tree_add_text()'s. The function to do all of this is commented out for now for the same reason plus the fact that it's pretty slow. svn path=/trunk/; revision=40930
2012-01-19Update list of deprecated GLib fcns;Bill Meier1-61/+85
Add comment about Wireshark build defines G_DISABLE_DEPRECATED. svn path=/trunk/; revision=40584