Commit Graph

244 Commits

Author SHA1 Message Date
Jeff Morriss be25474c94 Check source files for broken (read: not set to 8) tabstop settings.
Change-Id: I60e77a67189e7446f8c5ffd0add803cca10b4b57
Reviewed-on: https://code.wireshark.org/review/14345
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>
2016-03-05 17:46:00 +00:00
Peter Wu 41e93ead25 checkAPIs: remove false positive in shadow check
" strlen (" would match the shadow regex due to backtracking. Disable
backtracking with the "possessive quantifier".

Change-Id: If5d307fd61f252c41ad6d9b6104d2add1dfa63ae
Reviewed-on: https://code.wireshark.org/review/13157
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-09 20:02:01 +00:00
Alexis La Goutte 3239d02bc9 checkAPIs: Add "system" to possible shadow variable (on OS X)
See I651e76c6d53b0

Change-Id: I8082f22da0d16655104ad8699f08abdaf916a941
Reviewed-on: https://code.wireshark.org/review/13078
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-06 21:41:38 +00:00
Michael Mann 3606f80d9e Officially remove tvb_get_string and tvb_get_stringz.
Almost all replacements were done awhile ago, just put the final nail in the coffin.

Change-Id: I0a708d886da5a500c2a1e2c9ee2736794bdb9411
Reviewed-on: https://code.wireshark.org/review/12206
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-27 05:11:25 +00:00
Stefan Metzmacher 8c48529d3a tools/checkAPIs.pl: improve the hf_ error messages
Change-Id: Ie8132f317f2d1c27af83218c48874941bd3cc5d0
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-on: https://code.wireshark.org/review/11390
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-29 12:29:48 +00:00
Michael Mann e2735ecfdd Remove proto_tree_add_text API.
Its time has finally come.

Technically I just renamed it to proto_tree_add_text_internal and removed the WS_DLL_PUBLIC (so it shouldn't link outside of epan).  It's still (legitimately) used by expert.c otherwise I would have made it static within proto.c (and the rename wouldn't have been necessary).

Change-Id: I9bdf888d5e92bc7b70a3f5461b9297a66d994b80
Reviewed-on: https://code.wireshark.org/review/10594
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-09-21 14:11:43 +00:00
Michael Mann 0af048b7e4 Remove calls of tvb_ensure_length_remaining.
The remaining calls seem to fall into 3 categories:
1. passing it to tvb_find_line_end when -1 (for length) will do.
2. duplicating the checking of tvb_reported_length_remaining, which is already in use near the tvb_ensure_length_remaining call.
3. Those that (probably) need tvb_ensure_capture_length_remaining

Change-Id: I1e77695251e055644bcbbb89f3c181c65d1671ca
Reviewed-on: https://code.wireshark.org/review/10268
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>
2015-08-27 04:34:10 +00:00
Michael Mann 0d61321f69 Correct logic for finding shadow variables.
Change-Id: Ide03c3b92f70d5dad8d0dceca179ea6f3b9e1fd6
Reviewed-on: https://code.wireshark.org/review/10037
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-08-22 12:31:06 +00:00
Alexis La Goutte 1ddf1cfeb0 CheckAPI: Add a shadow variable check
Check if there is index, time or strlen variable

Change-Id: I530a35d6e1cf13f0795b35579ce76ee373ed4b1a
Reviewed-on: https://code.wireshark.org/review/8724
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-23 15:53:38 +00:00
Martin Kaiser 48f7ce79e2 checkAPIs.pl: check how ui class files are included
flag up a warning if a ui class file is included from the current
directory by using #include ""

Visual Studio needs #include <> to make sure that we always pick up
these files from the build directory if we're building with CMake

combine this check with the other check for gcrypt.h so that included
files are checked in one common subroutine

Change-Id: If8420ff5886f8eb2a71aa8fbfe6bc5d2bda607ce
Reviewed-on: https://code.wireshark.org/review/9189
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-27 16:25:41 +00:00
Peter Wu 3f5d183a44 Stop using atof/strtod (fixes column sorting of float types)
atof is locale-dependent. In locales such as Swedish, German and Dutch,
the dot is a thousand separator, resulting in wrong conversions for
floats.

While at it, make the mate dissector also be independent of locale.
Blacklist atof in checkAPIs. Lemon is still using strtod, but that is
not our problem for now.

Bug: 11297
Bug: 8964
Change-Id: I6fe3e45eb1d6d95d41aa4f3af1f81a6204a60c63
Reviewed-on: https://code.wireshark.org/review/9116
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25 15:38:45 +00:00
Evan Huus 95ac3908d8 Remove the last deprecated tvb_length calls
And remove the shims themselves!

Change-Id: I511c06eb21eaf68d1dc36bbb9558408807472f9c
Reviewed-on: https://code.wireshark.org/review/9088
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 17:32:40 +00:00
Pascal Quantin 45872b9f7b checkAPIs.pl: proto_tree_add_bytes_item takes an encoding parameter
Change-Id: Iebe0e2483d9fd1661bf87ea5efaeb4ae14f6e105
Reviewed-on: https://code.wireshark.org/review/9027
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-22 18:41:03 +00:00
Jeff Morriss 741cfe71af Move some checks so they're executed after the comments are removed.
We shouldn't complain if someone says "don't use __func__, it's not portable"
in a comment.

Change-Id: Ib712a00a68c14048eb5d97413a5d5bc0e0812e24
Reviewed-on: https://code.wireshark.org/review/8179
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-04-23 18:54:24 +00:00
Jeff Morriss 97499c1f25 Add VALS_EXT_PTR to decorate pointers to value_string_ext's in hfinfo.
This allows checkAPIs to continue checking the 'convert' field for correctness
when dissectors use value_string_ext_new() to build their value_string_ext's
(without resorting to tricks like getting the address of the dereferenced
pointer).

This will be used to resolve the checkAPIs failure in patch set 3 of
Ia5c96b1f6f1fe3a9521b3d70142889e3881fae5e .

Change-Id: I700d86b9076f077706d34000f5a6aa5c96351f69
Reviewed-on: https://code.wireshark.org/review/8162
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-22 06:08:58 +00:00
AndersBroman b307ffe0f9 Implement proto_tree_add_item_ret_int() and proto_tree_add_item_ret_uint() which
works as proto_tree_add_item(), but also returns the value of (u)ints
of 8,16,24 and 32 bits length in a 32 bit variable. It's based on Hadriels
previous work.

Change-Id: If3b4b8588b63251f1ee9b954a202acde7c02ce86
Reviewed-on: https://code.wireshark.org/review/7230
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-19 16:06:18 +00:00
Gerald Combs f2b35a180f Qt: Add extra related packet indicator types.
Add the ability to set frame number types: none, request, or response.
Use the types to draw different related packet indicators in the packet
list.

Track the conversation in PacketListRecord. Use it to draw dashed lines
for unrelated frames.

Set frame number types for DNS and ICMP.

Instead of drawing a transparent QImage, alpha blend our foreground
color and draw directly in our painter. Blend more toward the foreground
color.

Add FRAMENUM_TYPE to checkAPIs.

Change-Id: I2495945bb436413e05d6ec697184a0b4fd5ad214
Reviewed-on: https://code.wireshark.org/review/7436
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-05 16:45:04 +00:00
Peter Wu c1b672cf23 checkAPIs: match packet-*.[ch], independent of locale
In perl, the \w character group seems to match '-' depending on the
locale. On Linux (with the C or en_US.UTF-8 locale), packet-ssl-utils.c
does not match.

This patch makes the regex match anything except for the path separator.

Change-Id: I27543072295af5f2bd5ea8ab36e5d913bebf7d85
Reviewed-on: https://code.wireshark.org/review/7266
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-21 13:19:38 +00:00
Gerald Combs 3f765b3ef9 Add a CF_FUNC macro for casting BASE_CUSTOM functions.
Add a CF_FUNC macro to match VALS, TFS, etc. This should help us to avoid
the following warning:

    warning: ISO C forbids initialization between function pointer and 'void *' [-Wpedantic]

We could start adding DIAG_OFF+DIAG_ON everywhere but this seems to be
more consistent with the other macros in proto.h. Update each instance
of BASE_CUSTOM to use CF_FUNC.

Adjust a dummy variable name generated by asn2wrs.py that was triggering
an invalid error in checkhf.pl.

Fix an encoding arguement in packet-elasticsearch.c found by
fix-encoding-args.pl.

Change-Id: Id0e75076c2d71736639d486f47b87bab84e07d22
Reviewed-on: https://code.wireshark.org/review/7150
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-18 00:05:38 +00:00
Michael Mann 7ced085550 emem is dead! Long live wmem!
Change-Id: Iddd1200e62bf3200cb1a68408378dd9d47120b77
Reviewed-on: https://code.wireshark.org/review/6939
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-04 06:59:55 +00:00
Guy Harris 59155d1d1c Eliminate ep_strdup(), as it's no longer used.
Also, remove some no-longer-existent functions from checkAPIs.pl.

Change-Id: I2bf11e3ec03a34f9e89d58d560e340d76fd3ddc1
Reviewed-on: https://code.wireshark.org/review/6645
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-19 01:49:24 +00:00
Guy Harris 7940bbc192 Nobody uses se_ allocations, so remove the code for them.
Don't check for se_ routines in checkAPIs; the failure to compile or
link will suffice to catch attempts to use them.

Update comments in another test script to reflect the disappearance of
the session allocator.

Change-Id: If50d953c7130f48b696bc2dd9d327bea2af49bd4
Reviewed-on: https://code.wireshark.org/review/6638
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 21:28:04 +00:00
Michael Mann ef7e8aa065 Remove ep_strndup
Change-Id: Id336dc16f97a0973754993094aa637813c0ca31c
Reviewed-on: https://code.wireshark.org/review/6604
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18 04:14:55 +00:00
Michael Mann b5eb9710db Replace all remaining instances of ep_new with wmem_new and wmem_packet_scope.
Change-Id: I50b2cd0e233554bc58082e96e8d879b40edfc0c1
Reviewed-on: https://code.wireshark.org/review/6595
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-17 23:22:46 +00:00
Evan Huus 3f575120ea Kill more unused emem functions
Change-Id: Ib81410b6d760886f2ae585f44ac58fc135da62c7
Reviewed-on: https://code.wireshark.org/review/6568
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-16 17:36:15 +00:00
Evan Huus 0b271aa867 Remove ep_strbuf code
Thanks to Michael's work, it is now totally unused.

Change-Id: I67b5f7c69535a08f96f449c36c429e2548f4ea11
Reviewed-on: https://code.wireshark.org/review/6505
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-12 17:11:34 +00:00
Evan Huus 3a9869d81a Remove/replace ep_strsplit()
Change-Id: I4a803d83844d937804849b2ad3b067381c9b96d0
Reviewed-on: https://code.wireshark.org/review/6448
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 01:56:08 +00:00
Gerald Combs e3eab8391d checkAPIs: C++ comments are allowed in Windows resource files.
Change-Id: I3885278bf293b1fd7db812ce265734bcdc904c6f
Reviewed-on: https://code.wireshark.org/review/6354
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-06 23:11:17 +00:00
Michael Mann 55de46f317 Replace ep_address_to_str with address_to_str.
Change-Id: I4f1078b20f41800f72a751612703ad0d4c2ae87b
Reviewed-on: https://code.wireshark.org/review/6323
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>
2015-01-06 07:38:18 +00:00
Bill Meier 9e7d69fd86 checkAPIs.pl: Error/warnings output goes to STDERR
Change-Id: Ib6f460147c26c4fbfb9bd0fd8dd0dd12561be9ea
Reviewed-on: https://code.wireshark.org/review/6177
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-31 15:35:49 +00:00
Michael Mann 71c02b20eb Create FT_FCWWN field type.
Also, convert the "string" hf_ entries that used tvb_fcwwn_to_str as a string to use proto_tree_add_item with FT_FCWWN type.

Change-Id: I4ca77870499fd8239584a70874998b5d194a7167
Reviewed-on: https://code.wireshark.org/review/6036
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-28 20:05:29 +00:00
Michael Mann 1d598bbff7 Replace ip6_to_str and ip6_guint8_to_str with address_to_str and tvb_ip_to_str.
Change-Id: I1d258923a7a63539ec8456d3e306bca5016a1e4b
Reviewed-on: https://code.wireshark.org/review/6060
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-28 14:09:27 +00:00
Michael Mann 3d3f97320b Replace ip_to_str with [ep_]address_to_str and tvb_ip_to_str.
Change-Id: I40d0c8253743183aecef252040b7dd6742ae5c71
Reviewed-on: https://code.wireshark.org/review/5934
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-26 21:17:10 +00:00
Michael Mann e03ffe2583 Replace fc_to_str with address_to_str or tvb_fc_to_str.
Change-Id: I69bf25f5abb9d6ad325f922fab73b6f0cf8ca2ea
Reviewed-on: https://code.wireshark.org/review/6035
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-24 18:59:14 +00:00
Michael Mann f002332d88 Replace ether_to_str with either address_to_str or tvb_ether_to_str.
Change-Id: I8cce9fddbfe950e27e96ea8a5a6d2e0921ff4260
Reviewed-on: https://code.wireshark.org/review/5933
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-21 15:13:30 +00:00
Gerald Combs f66de3a749 Fix filename matching.
Change-Id: I2bdfd3ad2798ed1443d06c42b05c9962b8e8041d
Reviewed-on: https://code.wireshark.org/review/5689
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-09 19:26:02 +00:00
Gerald Combs d87a9527ee It's a reasonable expectation that we will have C++ style comments in
ui/qt.

Change-Id: Iedbf2a2d3cbfee00912e6e883928836932dea566
Reviewed-on: https://code.wireshark.org/review/5678
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-08 22:14:00 +00:00
Jeff Morriss cc640f03b9 Prohibit ctype APIs (except toupper() which is still used by file.c - make
that deprecated).

Also remove a few tabs that were in there.

Change-Id: I1bb2ad726828366a9f7d1a4064b1215b743ad3b5
Reviewed-on: https://code.wireshark.org/review/5000
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-30 17:57:00 +00:00
Jeff Morriss e0a352631d Tell the user which file __func__ was found in.
Change-Id: Ia69ceaf320cb97447f80a7c090efe6d36262a1c1
Reviewed-on: https://code.wireshark.org/review/5001
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-10-30 16:02:28 +00:00
Michael Mann 0cda27c83e "Highly discourage" use of proto_tree_add_text.
Change-Id: I2e8d18df71688c654f7acaff51fae7823c08aa6a
Reviewed-on: https://code.wireshark.org/review/3677
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: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-19 16:20:34 +00:00
Peter Wu 0492921adc Replace lseek/fstat by ws_lseek64/ws_fstat64
lseek returns an off_t type which is system-dependent. Use ws_lseek64 in
favor of lseek as that supports 64-bit quanities.

Use ws_fstat64 instead of stat to support 64-bit file sizes on Windows.
For the majority of the changes, this makes no difference as they do not
apply to Windows ("ifndef _WIN32"; availability of st_blksize).

There are no other users of "struct stat" besides the portability code
in wsutil. Forbid the use of fstat and lseek in checkAPIs.

Change-Id: I17b930ab9543f21a9d3100f3795d250c9b9ae459
Reviewed-on: https://code.wireshark.org/review/3198
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-25 21:26:01 +00:00
Evan Huus 1387f54c58 Check for __func__ in checkAPIs.pl
Change-Id: I649c69cbf545a8de32d9142c1156db6adb076b63
Reviewed-on: https://code.wireshark.org/review/3078
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-16 01:58:03 +00:00
Jeff Morriss 5aa6cf9dd5 Update my email address in a couple more spots.
Change-Id: I787ae2651a8083bc3082e5cb85dbd849823a16ca
Reviewed-on: https://code.wireshark.org/review/2638
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-06-25 02:15:55 +00:00
Bill Meier e05dc825ba Add a few more ad-hoc validations of the hf[] FIELDCONVERT field.
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-06-03 01:40:41 +00:00
Jeff Morriss 343098761f Error out if someone passes the address of a pointer to a *_string to VALS() 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-05-07 05:37:40 +00:00
Stig Bjørlykke bd38b3152d Support out-of-source checkapi
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-25 04:23:46 +00:00
Guy Harris 80011ec03c Don't se_ allocate strings when mapping addresses to column strings.
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-19 14:20:06 +00:00
Hadriel Kaplan dd002649c3 Add tvb_get and proto_tree_add for string-encoded timestamps
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-14 11:47:39 +00:00
Hadriel Kaplan 0a5572ea77 Fix Bug 9951: 'git commit hook isn't calling checkAPIs.pl with arguments for 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-14 00:10:20 +00:00
Alexis La Goutte 255eca0c1c Revert Remove check and inverse code to display a error if there is a $Id$
Change-Id: I7061ad312df5079924c927ca95a8fa111c756012
Reviewed-on: https://code.wireshark.org/review/498
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-02 08:57:22 +00:00
Hadriel Kaplan 914cbc2f3c Fix checkApis perl script false positive proto_tree_add with ENC_*
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-04-01 06:09:31 +00:00
Gerald Combs 641eb36dd5 Fix value_string checks in checkAPIs.pl.
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-13 17:25:41 +00:00
Gerald Combs 36db2df1c1 Add a check for newlines in value_strings.
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-03-13 15:54:09 +00:00
Guy Harris 8d234a0d8c More tvbuff API deprecation, comment expansion, and documentation updates.
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-26 22:04:08 +00:00
Evan Huus 22149c5523 TVB API deprecations and cleanup
- 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-22 15:02:01 +00:00
Jeff Morriss d219887b44 Don't complain if files don't have $Id$ in them.
$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>
2014-02-13 23:23:02 +00:00
Michael Mann f882b63d97 Some proto_tree_add_xxx functions have a '_' in the function name so make 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-12-18 22:10:59 +00:00
Evan Huus d97c9e2ff4 Implement address_to_str which is like ep_address_to_str and se_address_to_str
except it takes a wmem scope instead. Add the two emem equivalents to checkAPI
as (weakly) deprecated.

svn path=/trunk/; revision=53528
2013-11-23 22:17:27 +00:00
Michael Mann 625fbd5f9a Allow a "more complex" algorithm to finding proto_tree_add_text overuse. 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-10-06 02:07:47 +00:00
Jörg Mayer 4e74f3a3c3 Don't print a warning about missing svn id when the argument is not
a file. Warn about the "wrong" filetype and continue

svn path=/trunk/; revision=52105
2013-09-16 20:30:34 +00:00
Evan Huus 464bbb1275 Tweak mq macro and checkAPI to avoid false positives - "garbage"
(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-15 22:34:36 +00:00
Jörg Mayer 98baf8ba18 Add help option
List options one by one

svn path=/trunk/; revision=52068
2013-09-15 17:50:18 +00:00
Jörg Mayer 05ba7d3afc http://url is NOT a c++ style comment
svn path=/trunk/; revision=52061
2013-09-15 14:49:16 +00:00
Chris Maynard 50bcbef658 OK, all the Makefiles use -build since r41943, so add that option back for now.
svn path=/trunk/; revision=52016
2013-09-13 18:11:29 +00:00
Chris Maynard 051c082a8c Update the comments to match the current usage.
svn path=/trunk/; revision=52015
2013-09-13 18:00:32 +00:00
Chris Maynard 9c7e47fb2e Rename --build to --check-addtext/--nocheck-addtext for clarity.
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-13 16:52:08 +00:00
Evan Huus 47e241f6c4 Make checkAPI notify (warnings only, for now) about deprecated emem functions.
svn path=/trunk/; revision=51782
2013-09-05 12:50:24 +00:00
Michael Mann e2cfb1f173 Make checkAPIs.pl a little more discerning when looking for too many 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-07-05 14:22:35 +00:00
Martin Kaiser c7dd35dffc flag up a warning if someone includes gcrypt.h instead of wsutil/wsgcrypt.h
svn path=/trunk/; revision=48340
2013-03-16 09:53:19 +00:00
Bill Meier eeb90f99b7 Tweaks:
- Remove comments from the input string before checking hf[] entries;
- Remove code under '#if 0' before doing API checks.

svn path=/trunk/; revision=47447
2013-02-02 15:13:45 +00:00
Jeff Morriss 02a69849b7 Don't do proto_tree_add_ether(..., tvb_get_ptr(...)), just use proto_tree_add_item().
svn path=/trunk/; revision=46598
2012-12-18 22:29:11 +00:00
Jeff Morriss a41c5abab1 Add SET_ADDRESS and SET_ADDRESS_HF to the list of APIs we (may--if we uncomment the code) check for being called with tvb_get_ptr().
svn path=/trunk/; revision=46326
2012-12-02 05:05:04 +00:00
Jeff Morriss 5ee917aea7 As requested by Anders on -dev: check enum_val_t's for NULL termination.
Also check that they are all const.

svn path=/trunk/; revision=46294
2012-11-29 20:25:15 +00:00
Jörg Mayer 30b7b74dde Remove #defines that provided backward source compatibility
for deprecated dissector add/remmove/... functions.

svn path=/trunk/; revision=45000
2012-09-19 07:20:49 +00:00
Bill Meier 5e4bff84d3 Use non-capturing grouping when grouping just for alternatives;
Also: improve error message slightly in the case of a missing NULL termination.

svn path=/trunk/; revision=44826
2012-09-10 01:53:23 +00:00
Jeff Morriss b1a5af9eed string_strings and range_strings must also be {0, NULL} terminated.
Also, remove some tabs.

svn path=/trunk/; revision=44824
2012-09-10 00:48:50 +00:00
Jeff Morriss 1959d4d6bf r43756 said that _snwprintf is banned. Make it so.
svn path=/trunk/; revision=43939
2012-07-23 16:57:16 +00:00
Guy Harris 41be8e4344 Add a local errorCount variable to functions that use it, have them
return it, and use the return value.

svn path=/trunk/; revision=43818
2012-07-19 07:02:00 +00:00
Guy Harris 66ed910844 Yup, that did it. Make use of ENC_ values in non-item proto_tree_add
calls an error.

Fix one case where we weren't counting an error (unregistered ett
variables).

svn path=/trunk/; revision=43817
2012-07-19 04:16:15 +00:00
Jeff Morriss 3d1b5e3474 As suggested by Jakub in 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-07-03 21:55:55 +00:00
Jakub Zawadzki b18e880040 Update FSF address - part II.
svn path=/trunk/; revision=43538
2012-06-28 23:18:38 +00:00
Jeff Morriss 41242190b0 Prohibit strtod() (as per r 43212).
Replace tabs with spaces (for consistency).

svn path=/trunk/; revision=43213
2012-06-11 19:42:05 +00:00
Anders Broman 3ae9cc81c4 Add more depricated functions
svn path=/trunk/; revision=43040
2012-06-03 18:03:51 +00:00
Jeff Morriss ea9e7c2359 Look only for calls to strlen() within an snprintf() call (not for any file
that has the string "strlen" somewhere after a call to snprintf()).

svn path=/trunk/; revision=42950
2012-05-31 21:19:39 +00:00
Gerald Combs 35c22ed068 If we're feeding the output of strlen to an snprintf-style function
there's a good chance we're doing something wrong.

svn path=/trunk/; revision=42947
2012-05-31 20:12:27 +00:00
Jeff Morriss 7f1ccd46ec Followup to r42823: check for RVALS used without BASE_RANGE_STRING.
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-05-24 14:52:06 +00:00
Jeff Morriss 75c3c92f19 Add a "-build" argument to checkAPIs.pl. Use that argument when building
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-04-04 20:46:49 +00:00
Bill Meier 3b9d2fcb93 Revise and enable test for hf[] FT_BOOLEAN fields with a non-zero bit mask and with BASE_... in the 'display' field.
svn path=/trunk/; revision=41399
2012-03-07 16:19:24 +00:00
Bill Meier 7504e53a5e Add test for correct usage of hf[] FT_BOOLEAN 'display' field;
(Commented out until all the incorrect usages in Wireshark have been fixed).

svn path=/trunk/; revision=41380
2012-03-06 20:56:51 +00:00
Jeff Morriss 4cd18234d6 Prohibit using anything other than FT_BOOLEANs with true_false_strings.
Prohibit using FT_BOOLEANS with value_strings.

svn path=/trunk/; revision=41364
2012-03-06 02:27:29 +00:00
Bill Meier d0e9923506 g_fprintf() & g_vfprintf() should not be used....
svn path=/trunk/; revision=41181
2012-02-24 19:02:28 +00:00
Jeff Morriss e8ff75961f As suggested by Joerg on the -dev list yesterday: count up the number of
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-02-08 14:15:01 +00:00
Bill Meier cffa41f052 Update list of deprecated GLib fcns;
Add comment about Wireshark build defines G_DISABLE_DEPRECATED.

svn path=/trunk/; revision=40584
2012-01-19 14:22:46 +00:00
Bill Meier 0908f1c81c Fix a typo; Remove a dup.
svn path=/trunk/; revision=40572
2012-01-18 21:37:55 +00:00
Bill Meier 5940047af0 Update:
- Mark GDK functions which aren't used as 'E'
 - Add GTK functions deprecated after GTK 2.20
 - Add some comments about use of GTK_DISABLE_DEPRECATED
 - reformat
   ...

svn path=/trunk/; revision=40569
2012-01-18 21:08:18 +00:00
Bill Meier 5f2cf1a036 The last GMemChunk usage in Wireshark has been replaced; Error out for any such usage.
svn path=/trunk/; revision=40548
2012-01-16 19:31:44 +00:00
Gerald Combs 5520a452b5 The MSDN page for ZeroMemory recommends using SecureZeroMemory instead,
so do so. Add ZeroMemory to checkAPIs.pl.

svn path=/trunk/; revision=38584
2011-08-17 16:54:24 +00:00
Jörg Mayer 91ad1c8086 Using gtk_tree_view_column_get_cell_renderers is an error now.
svn path=/trunk/; revision=38357
2011-08-05 10:40:45 +00:00
Anders Broman 3e446c629c Update comments.
svn path=/trunk/; revision=38202
2011-07-25 15:55:27 +00:00
Guy Harris 494f9820fb Use gtk_widget_get_has_window() as a wrapper around
GTK_WIDGET_NO_WINDOW() in pre-2.18 versions of GTK+.  Treat calls to
GTK_WIDGET_NO_WINDOW() as an error in checkAPIs.pl.

svn path=/trunk/; revision=38197
2011-07-25 06:40:01 +00:00