Commit Graph

29 Commits

Author SHA1 Message Date
John Thacker 6fd212926a epan: Constify a few range functions 2022-08-06 08:26:40 -04:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Guy Harris 01f2e2b201 We really only need one range_foreach routine.
Rename range_foreach_r() to range_foreach(), getting rid of the old
range_foreach().

If your callback doesn't require an additional argument, just pass NULL
when calling range_foreach(), and declare the argument as unused.

Change-Id: I49a56f90610e39cf2ddc398c9e30ed11a6ca90db
Reviewed-on: https://code.wireshark.org/review/23025
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-08 22:06:27 +00:00
Ahmad Fatoum e63db3ce0e Rename reentrant range_foreach2 to range_foreach_r
to avoid mistaking it for a range function that operates on pairs.

Change-Id: If9117c195ba21d55a476c3b9deb2a2ca7a1056ed
Reviewed-on: https://code.wireshark.org/review/22994
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-07 22:53:07 +00:00
Ahmad Fatoum a0ee5d6e42 Fix -Wdocumentation warning about range_foreach2
Mismatch between parameter name in comment and prototype

Change-Id: Ia458362a3cc8cd073dbb0a184f28b28f12b19b9f
Reviewed-on: https://code.wireshark.org/review/22993
Reviewed-by: João Valverde <j@v6e.pt>
2017-08-07 18:26:34 +00:00
João Valverde 733c19a072 Optimize the "services" dictionary
Remove assignee and other miscellaneous information that changes more
frequently than service name and can be consulted directly in the IANA
registry.

Allow merging identical transports into a single line for convenience
and size/speed optimization (a backward-compatible change).

Remove obsolete make-services.pl.

Change-Id: I3ecbd1a6a68d87c084d77498a0eeb44b7afdab67
Reviewed-on: https://code.wireshark.org/review/22872
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-04 05:55:08 +00:00
Guy Harris 974f985bd9 Add SUBOBJECT_INITIALIZER and use it.
Just as we have OD_ENTRY_INITIALIZER, add SUBOBJECT_INITIALIZER, and use
it rather than memset().

Whether removing initializer warnings is a Good Thing is subject to
debate; remove a comment that implies it's been deemed a Good Thing.

Change-Id: Ife658d8bb1d4868789ca3b929aff6e4fccecb430
Reviewed-on: https://code.wireshark.org/review/21892
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-02 08:30:16 +00:00
Michael Mann 6a6d7ea34f Convert range API to always use wmem memory.
This is mostly to address memory leaks in range preferences (the biggest
user of range functionality) on shutdown.
Now range preferences must use epan scoped memory when referencing
internal preference structures to keep consistency.

Change-Id: Idc644f59b5b42fa1d46891542b53ff13ea754157
Reviewed-on: https://code.wireshark.org/review/19387
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-07 00:44:10 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Michael Mann d29b369bdc Add range_add_value and range_remove_value.
These APIs can insert or remove a single value into a range structure.
Adding a value may extend an existing range or create a new one.
Removing a value may remove a range item.

Change-Id: Ia6995ecf7760aca1fb7fd9b4c53972298a57675f
Reviewed-on: https://code.wireshark.org/review/17836
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-09-22 13:49:42 +00:00
Gerald Combs ec3f923e3e Add the Display Filter Expression dialog.
Changes from the GTK+ UI:
- The display filter is built on the fly with immediate syntax feedback.
- Slightly different layout.
- You can search for fields.

Make the plain SyntaxLineEdit a bit more plain.

Bug: 11128
Change-Id: I06a48cd7b9ba7b9dc193b0199540aede4eb62fa7
Reviewed-on: https://code.wireshark.org/review/8742
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-06-03 02:27:00 +00:00
Michael Mann 7967ef9510 Remove emem APIs from UAT functionality.
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856
Reviewed-on: https://code.wireshark.org/review/6460
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-12 14:25:12 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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-03-04 14:27:33 +00:00
Jakub Zawadzki 90858e3058 Avoid including <epan/range.h> in dissectors.
svn path=/trunk/; revision=54315
2013-12-20 23:25:36 +00:00
Alexis La Goutte 9f24c44709 Fix (-W)documentation error found by Clang
../../epan/range.h:87:11: error: empty paragraph passed to '@return' command [-Werror,-Wdocumentation]
 * @return
   ~~~~~~~^
../../epan/range.h:86:11: error: parameter 'max_value'' not found in the function declaration [-Werror,-Wdocumentation]
 * @param max_value' specifies the maximum value in a range.
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../epan/range.h:86:11: note: did you mean 'max_value'?
 * @param max_value' specifies the maximum value in a range.
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          max_value

svn path=/trunk/; revision=51256
2013-08-10 21:28:17 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Jeff Morriss 6eba069093 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4768 :
Return an error if the user specifies a value in a range in excess of the
range-specified maximum.

Except when reading in preferences files which might have ranges that exceed
the maximum (because we didn't use to check): in that case silently lower the
out-of-range values.

svn path=/trunk/; revision=34698
2010-10-29 22:09:31 +00:00
Anders Broman e17efa574d Doxygen fix.
svn path=/trunk/; revision=34013
2010-08-30 14:22:49 +00:00
Anders Broman a96e6b2047 Doxygen changes.
svn path=/trunk/; revision=33981
2010-08-28 19:27:19 +00:00
Stig Bjørlykke 74766c736a From Andrew Feren (bug 2433):
Add support for port ranges in services.

svn path=/trunk/; revision=24934
2008-04-12 14:08:19 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris b0993663a1 From Jeff Morriss: SSCOP over UDP and SSCF-NNI support.
svn path=/trunk/; revision=12585
2004-11-24 02:59:49 +00:00
Guy Harris a053ee960e Have "range_convert_range()" dynamically allocate a string large enough
to hold the representation of the range, rather than imposing a
fixed-size limit on the string.

Check for overflow in "strtoul()" - and use "strtoul()" rather than
"strtol()" for range members.

Clean up indentation.

Get rid of an unnecessary include in <epan/range.h>.

svn path=/trunk/; revision=12323
2004-10-17 01:31:36 +00:00
Guy Harris 727ad67453 Remove the fixed maximum number of subranges in a range_t; dynamically
allocate them to be large enough.

Add checks that the numbers in the range fit in a guint32.

Check the validity of a range before saving or printing, and report
errors in an alert box.

Clean up white space.

svn path=/trunk/; revision=12320
2004-10-16 23:32:24 +00:00
Guy Harris b2543fed6c Make the nranges member of a range_t be the number of ranges, not the
number of ranges - 1, and update loops that iterate over all the ranges
appropriately.

Make "range_convert_str()" return a success/failure indication, and
check it.  Rewrite it to do more checks, and not to blithely ignore
unknown characters.

svn path=/trunk/; revision=12313
2004-10-16 08:33:40 +00:00
Guy Harris abd16b297f From Jeff Morriss: PREF_RANGE preference type, for ranges of integers.
svn path=/trunk/; revision=12300
2004-10-14 23:45:09 +00:00
Guy Harris 3c7631aa32 Split the pure range stuff out into separate files, exporting their own
functions.

svn path=/trunk/; revision=11892
2004-09-04 01:32:13 +00:00