Commit Graph

1062 Commits

Author SHA1 Message Date
Michael Mann c302812566 Add enabled protocol list for dissectors who are disabled by default
We save a list of dissectors that are disabled through the Enabled Protocols
dialog.  This is because we assume dissectors are enabled by default.

For dissectors that are disabled by default, we have no way to keep them
enabled through the Enabled Protocols dialog.  A dissector that defaults
to being disabled has to be reset to enabled each time Wireshark is launched.

Add a list similar to the disabled list for enabling dissectors that are
disabled by default.
This mostly applies to post-dissectors.

Change-Id: I31a8d97a9fdbc472fe2a8666384e0f8786bb8e9f
Reviewed-on: https://code.wireshark.org/review/19405
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-12-24 02:30:21 +00:00
Martin Kaiser a1ecbc92b0 make proto_tree_add_bitmask_value_with_flags() work for tvb==NULL
proto_tree_add_bitmask_value_with_flags() eventually calls
proto_tree_add_XXX() for the main hf and for the field elements.

These functions work for tvb==NULL if the length is also set to 0.
Otherwise, we'll end up in proto_tree_add_pi(), get_hfi_length() and
run into the DISSECTOR_ASSERT() there.

proto_tree_add_bitmask_value...() are meant for cases where the data is
passed directly and not read from a tvb. If tvb==NULL, set our length to
0 instead of using the field length from the main hf.

Change-Id: Ia55b068e9842ba4a1ae8be8692320a8e93ea8631
Reviewed-on: https://code.wireshark.org/review/19394
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-23 12:40:05 +00:00
Michael Mann 4e97f74f11 Add support for adding unit names to hf_ fields.
This was inspired by the https://www.wireshark.org/lists/wireshark-dev/201505/msg00029.html thread.

Used TCP and NTP dissectors as the guinea pig with sample use.

Documentation updates includes some unrelated cleanup just because it was noticed.

Change-Id: I59b26e1ca3b95e3473e4757f1759d7ad82976965
Reviewed-on: https://code.wireshark.org/review/19211
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-12-13 13:08:39 +00:00
Dmitry Lazurkin 03a2539b22 extract common logic of proto_item_set_len/proto_item_set_end
Change-Id: I55f9303624471d09b446c10939e5c22bf8e21511
Reviewed-on: https://code.wireshark.org/review/18894
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-11-22 16:46:48 +00:00
Etienne Dechamps 3bf6a18999 Fix -1 lengths in proto_tree_add_item_ret_string_and_length().
Currently, when passing a -1 length to proto_tree_add_item_ret_string_and_length() or
proto_tree_add_item_ret_string(), the -1 length will be passed directly
to the field info. The calculated length should be used instead.

Bug: 13159
Change-Id: I980d18fb9bde3c452e64a8735e62d4830ce53b64
Reviewed-on: https://code.wireshark.org/review/18904
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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-21 09:52:47 +00:00
Guy Harris 548bf927d4 proto_item_set_end() should set the FT_BYTES value length as well.
Change-Id: I33459aabf059e1dc746e7e5f9d5ca28095e056f4
Reviewed-on: https://code.wireshark.org/review/18880
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-20 06:00:12 +00:00
Thomas Wiens 46160ff039 proto: Decode negative values in a bitmask field
Allows to use negative values (FT_INT) in a bitmask field.
If a field type greater or equal (FT_(U)INT40) is used then also
a 64 bit value string and 64 bit format function must be used.

Change-Id: Ib86d45bee73a71a784068ab717d35810c6f48017
Reviewed-on: https://code.wireshark.org/review/18601
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-02 21:35:02 +00:00
Thomas Wiens b61cfd7ec1 bitmask: add missing break statement
Change-Id: Ia9cb54431c8c274c46e299b6a6da8cac14bda88e
Reviewed-on: https://code.wireshark.org/review/18591
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-10-31 10:22:32 +00:00
Guy Harris 45a023f3d0 Don't use proto_tree_add_{uint,uint64}() to add signed integer values.
Change-Id: I8c5506b746f16e5b79d024be5594cb71f95eced1
Reviewed-on: https://code.wireshark.org/review/18584
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-30 23:06:54 +00:00
AndersBroman c205bce8ef proto.c use g_list_prepend when adding heuristic dissectors and plugins.
Change-Id: If55938f0bad556a002fc85466c0b4f0e904991dc
Reviewed-on: https://code.wireshark.org/review/17981
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>
2016-09-29 12:55:21 +00:00
Pascal Quantin 152e245804 proto_tree_add_item_ret_(u)int/proto_tree_add_bitmask_with_flags_ret_uint64: return real value
Apply mask and bit shift on the returned value.

Change-Id: I00aebc854756f01a25199a259d6d5252abea4349
Reviewed-on: https://code.wireshark.org/review/17958
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-28 06:07:01 +00:00
AndersBroman 5972c3d529 [proto.c] proto_all_finfos(), pre-allocate array to hold all fields.
Change-Id: I0d41e417e57e656ccee1c2ce6bd406af4ed23d10
Reviewed-on: https://code.wireshark.org/review/17948
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>
2016-09-27 10:20:20 +00:00
AndersBroman 1a384ef416 [proto.c] Add proto_find_first_finfo() to find first occurance of a field.
Change-Id: I11f50d7b00851880f77067260e2496175d227e76
Reviewed-on: https://code.wireshark.org/review/17937
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>
2016-09-27 03:39:28 +00:00
Pascal Quantin cf12e448b1 proto.c: avoid dereferencing a NULL pointer
Some sub protocols do not register fields

Follow-up of gf4a521e

Change-Id: Iec3165d6204cc6acc0ec31a7266f860012463cd0
Reviewed-on: https://code.wireshark.org/review/17868
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-09-22 18:56:17 +00:00
AndersBroman f4a521ee74 [proto.c] As we know the size of the hf array use g_ptr_array_sized_new()
to allocate the arry to hold them. This should be more efficient.

Change-Id: I84b1095b6eb110fdcc1b2630949c76b51f3a47b6
Reviewed-on: https://code.wireshark.org/review/17866
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-22 15:08:58 +00:00
Guy Harris d7fe514fc0 Improve support for single-character fields and filter expressions.
Add an FT_CHAR type, which is like FT_UINT8 except that the value is
displayed as a C-style character constant.

Allow use of C-style character constants in filter expressions; they can
be used in comparisons with all integral types, and in "contains"
operators.

Use that type for some fields that appear (based on the way they're
displayed, or on the use of C-style character constants in their
value_string tables) to be 1-byte characters rather than 8-bit numbers.

Change-Id: I39a9f0dda0bd7f4fa02a9ca8373216206f4d7135
Reviewed-on: https://code.wireshark.org/review/17787
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-19 02:51:13 +00:00
Guy Harris c8869f68db OK, it probably crashed in proto_initialize_all_prefixes().
Remove the debugging printouts.

The changes that were committed between the last build that didn't crash
and the first build that did were:

commit 961f743d69
Author: Peter Wu <peter@lekensteyn.nl>
Date:   Mon Aug 29 01:34:22 2016 +0200

    xml: fix some memleaks

    No more memleaks reported for the attachment in bug 12790 :-)

    Change-Id: I8472e442143b332edfacdf9ef3b8b893f1ec4386
    Ping-Bug: 12790
    Reviewed-on: https://code.wireshark.org/review/17365
    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: Peter Wu <peter@lekensteyn.nl>

commit a04b6fcb3d
Author: Peter Wu <peter@lekensteyn.nl>
Date:   Sun Aug 28 22:19:29 2016 +0200

    diameter: fix 400kb leaked memory on exit

    Before:

        SUMMARY: AddressSanitizer: 399684 byte(s) leaked in 17208 allocation(s).

    After addressing to-do by calling ddict_free:

        SUMMARY: AddressSanitizer: 3024 byte(s) leaked in 256 allocation(s).

    After fixing all remaining leaks cases in the flex file for diameter:

        SUMMARY: AddressSanitizer: 735 byte(s) leaked in 58 allocation(s).

    Not bad huh :-)

    Ping-Bug: 12790
    Change-Id: I0c730ad77ae15c69390bc6cf0a3a985395a64771
    Reviewed-on: https://code.wireshark.org/review/17364
    Petri-Dish: Peter Wu <peter@lekensteyn.nl>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
    Reviewed-by: Michael Mann <mmann78@netscape.net>
    Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
    Reviewed-by: Peter Wu <peter@lekensteyn.nl>

commit 14312835c6
Author: Peter Wu <peter@lekensteyn.nl>
Date:   Sun Aug 28 19:20:59 2016 +0200

    pcapng: do not leak blocks

    pcapng_open and pcapng_read have 'wblock' allocated on the stack, so if
    they return, they do not have to set wblock.block to NULL.

    pcapng_read_block always sets wblock->block to NULL and may initialize
    it for SHB, IDB, NRB and ISB. Be sure to release the memory for IDB and
    ISB. It is better to have more wtap_block_free calls on a NULL value
    than missing them as this would be a memleak (on the other hand, do not
    release memory that is stored elsewhere such as SHB and NRB).

    Ping-Bug: 12790
    Change-Id: I081f841addb36f16e3671095a919d357f4bc16c5
    Reviewed-on: https://code.wireshark.org/review/17362
    Petri-Dish: Peter Wu <peter@lekensteyn.nl>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
    Reviewed-by: Peter Wu <peter@lekensteyn.nl>

*If* one of those is the cause, my guess is that it's the Diameter one,
as the crash happens before any file is read (so it's probably not the
pcapng one) and thus before any dissection is done (so it's probably not
the XML dissector one).

Change-Id: I816c1bbd6078eab251efd02ebb7c3195f6dd1483
Reviewed-on: https://code.wireshark.org/review/17411
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31 07:40:39 +00:00
Guy Harris 1512ee7d84 Crashing in proto_initialize_all_prefixes()? Debugging output.
Change-Id: I6db711b1730b95460983ee190762753198c1959e
Reviewed-on: https://code.wireshark.org/review/17409
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31 03:04:27 +00:00
Guy Harris 9edb7afa84 More fields, more pre-allocated memory for fields.
Change-Id: I8362e64354c4ca985dbabc190cfb75d2bd31a5ad
Reviewed-on: https://code.wireshark.org/review/17257
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-23 02:58:03 +00:00
Michael Mann 600eca15fe Allow up to 64-bit values to use BASE_RANGE_STRING.
Change-Id: Iea69b5ef533b9b524a624b96bf82e178fd428ce9
Reviewed-on: https://code.wireshark.org/review/16934
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-08-07 07:39:12 +00:00
Michael Mann 8b0e9c6672 Follow up for proto_tree_add_checksum.
Fill in the "gaps" so that all dissectors that verify checksums have both a
status and expert info field.

Also address comments from original proto_tree_add_checksum patch that didn't make it.

Ping-Bug: 8859
Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f
Reviewed-on: https://code.wireshark.org/review/16590
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-27 03:40:02 +00:00
Michael Mann 907d49483d Fix some of the checkAPIs.pl warnings for g_warning.
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-26 04:08:50 +00:00
Pascal Quantin 56706427f5 proto.c: add bounds check to proto_tree_add_text(_valist)_internal
Bug: 12659
Change-Id: I44cb3ce8e647ae2816d5ffa95435068c435a1e5c
Reviewed-on: https://code.wireshark.org/review/16648
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>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-26 03:52:39 +00:00
Michael Mann 1da1f945e2 Fix checkAPI.pl warnings about printf
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-25 04:26:50 +00:00
Michael Mann ad6fc87d64 Add proto_tree_add_checksum.
This is an attempt to standardize display/handling of checksum fields for all dissectors.
The main target is for dissectors that do validation, but dissectors that just report the
checksum were also included just to make them easier to find in the future.

Bug: 10620
Bug: 12058
Ping-Bug: 8859
Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf
Reviewed-on: https://code.wireshark.org/review/16380
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: Michael Mann <mmann78@netscape.net>
2016-07-21 12:35:22 +00:00
Jeff Morriss 29a98d1c7f Allow BASE_NONE (with strings conversion) for integral values again.
This mostly reverts SVN rev 43412 (3fa645481f)
with the addition of documenting that FT_*INT*'s with BASE_NONE and a
FIELDCONVERT tells the Wireshark core that the field's numeric value is
meaningless and should not be shown to the user.

Use BASE_NONE again with the expert info group and severity fields.  This
(finally) resolves the complaint from:

https://www.wireshark.org/lists/wireshark-dev/201206/msg00188.html

(yes, this mail's been sitting in my "todo" pile since then! <sigh>)

Change-Id: I1c6dd2864e7a2e959c97c409f277853af74a8d93
Reviewed-on: https://code.wireshark.org/review/16518
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-20 03:00:52 +00:00
Michael Mann db1e0bcf65 Fix printf style parameters complaints from VS Code Analysis
Change-Id: I5669e2442582f899643fae4a9f86ab6d505dde07
Reviewed-on: https://code.wireshark.org/review/16505
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-17 13:10:37 +00:00
Michael Mann 81beae97c3 proto.c: Unsigned fields should use %u within printf.
Found by VS Code Analysis

Change-Id: I76ea860cd86b41ef33c47dcc8f6b1c122f8bb668
Reviewed-on: https://code.wireshark.org/review/16424
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>
2016-07-14 10:51:46 +00:00
Pascal Quantin b78dd096f4 proto.c: allow calling get_hfi_length() with a 0 byte tvb and length=-1
As indicated in the comment, we allow FT_PROTOCOL, FT_NONE, FT_BYTES, FT_STRING
and FT_STRINGZPAD to be zero-length.
But in that case do not call tvb_ensure_captured_length_remaining() that ensures
that at least 1 byte is  present.

Bug: 12561
Change-Id: I881754368c24d334b88f0dda1d59a68e08219227
Reviewed-on: https://code.wireshark.org/review/16167
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-02 07:38:37 +00:00
Guy Harris a5e9e7e7ae Fix "disable this protocol by default".
Allow a dissector to mark its protocol as "disabled by default", which
means that the "enable all protocols" routine won't enable it.  This is
necessary in order to allow the disabling of protocols not to be
unintentionally changed due to profile changes; see bug 9826.

Change-Id: I3947f794c21350b70a8de06899cfc7715b77f90f
Ping-Bug: 9826
Reviewed-on: https://code.wireshark.org/review/16109
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-23 19:45:51 +00:00
Michael Mann debbf7e930 Move AT_VINES address type to VINES dissector.
proto.c still has to deal with FT_VINES, but maybe that
can be refactored to the dissector too.

Change-Id: Iee04eed3b75f91cb62bb7b625dd44baeeb9aebb3
Reviewed-on: https://code.wireshark.org/review/16069
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-22 04:58:54 +00:00
Pascal Quantin fb38049f4d proto.c: allow calling proto_item_add_bitmask_tree() with a length set to 0
This is required for the flags from packet-frame.c

Bug: 12536
Change-Id: I60bfe671687bcd3a9b5c997ba62bed563e890548
Reviewed-on: https://code.wireshark.org/review/15945
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-15 22:04:09 +00:00
Michael Mann 551b82484f Add proto_tree_add_bitmask_list_value.
Ran across enough situations that proto_tree_add_bitmask_list couldn't
solve that it seemed necessary.

Change-Id: I6a540ac6efca76cae7c4571a84bb400538652784
Reviewed-on: https://code.wireshark.org/review/15880
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-06-13 22:20:57 +00:00
Jens Kilian 767a59e54e Don't sign extend unsigned integer fields larger than 32 bits.
Fix a bug in proto_tree_set_uint64() which caused fields to be sign extended.
(This only showed up when a non-zero bitmask was present.)

Change-Id: Ibcc986e3d42f97348966ea66c2ae9fca73b09992
Reviewed-on: https://code.wireshark.org/review/15764
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2016-06-07 09:56:06 +00:00
Michael Mann 33414fe175 Remove proto_item_append_string.
It requires some "extra work" to get it to work properly.  Despite
documenting it, some previous use cases didn't do the extra work.
Let's just see how we get by without it.

Change-Id: I31dba1d5038d793085f6c9e4b4a6eda574e86872
Reviewed-on: https://code.wireshark.org/review/15610
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>
2016-05-31 10:43:56 +00:00
Jeff Morriss aaa5551346 Update the comments/warnings about using proto_tree_append_string().
packet-wsp.c hasn't used proto_tree_append_string() since
Ic5467289aae7d54e78c1fd65f93358387d6139aa.  Use packet-frame as the example
instead.

Change-Id: I69fb10679ec1685a61aac182414e596b345153fd
Reviewed-on: https://code.wireshark.org/review/15563
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>
2016-05-26 04:12:13 +00:00
Michael Mann 1dccd1ee07 Have fvalue_to_string_repr always return an (wmem) allocated buffer.
Previous patches converted all fvalue_to_string_repr calls to expect
an allocated buffer (and not a passed in one).  Now changing signature
to force an allocated buffer.  Added wmem in case that can be taken
advantage of within epan (and since the function signature was changing
anyway).

Change-Id: Ica1ac4a9a182ce0e73303856329e198d9d525b7b
Reviewed-on: https://code.wireshark.org/review/15343
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-10 22:49:08 +00:00
Michael Mann 82373315fd rawshark: Get "field string values" from existing functionality.
rawshark shouldn't be converting FT_ and BASE_ values into strings on its own, there's a function for that.

Change-Id: Ib4ce1651ee130a03644b5de3ab471333444e19a9
Reviewed-on: https://code.wireshark.org/review/15341
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-10 22:47:54 +00:00
Michael Mann 37ee33c9b2 Dynamically allocate the string for representing FT_IEEE_11073_[S]FLOAT.
Most uses of fvalue_to_string_repr() don't provide a buffer to write to, so memory is allocated dynamically inside the function.  Trying to move to where ALL cases don't provide a buffer to simplify fvalue_to_string_repr handling and the underlying functionality of the ftypes.

Change-Id: Iac03e4eb63b5e38311a6472fbe488009ed55206c
Reviewed-on: https://code.wireshark.org/review/15331
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-05-10 20:39:45 +00:00
Guy Harris 728e683b14 Handle the encoding when displaying the string table.
Don't just treate the strings as piles of ASCII characters.

Add a proto_tree_add_item_ret_string_and_length() routine to help do
this.  Clean up some of the documentation of the proto_tree_add_item_ret
routines while we're at it.

Change-Id: Ib4c52bd8a8331eac97312583326f5be9175889d9
Reviewed-on: https://code.wireshark.org/review/15291
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-08 20:32:21 +00:00
Michael Mann 5493fe0167 Convert ftype-tvbuff.c to ftype-protocol.c
As noted in https://www.wireshark.org/lists/wireshark-dev/201604/msg00103.html
a protocol field isn't really a tv_buff, so allow for the possibility
of a NULL tv_buff in a "protocol type".  If the tvb is NULL, use the
string of the protocol field for comparison

Bug: 12335
Change-Id: Ie12a5f7b31c7293c61006b0f70135d100a97c4e0
Reviewed-on: https://code.wireshark.org/review/15261
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-05 19:27:55 +00:00
Guy Harris ca57399db8 Get rid of duplicate code.
Use CHECK_FOR_NULL_TREE() while we're at it, to make it more like other
routines.

Change-Id: I2cbdf9f043583fd0c9858e94ae1134173a68c875
Reviewed-on: https://code.wireshark.org/review/15116
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-26 00:42:32 +00:00
Guy Harris 7b2d8a16c5 Always call test_length(), even if the tree is null.
Otherwise, we run the risk of getting caught in a loop that runs past
the end of the packet.

Shows up in, for example, the capture in bug 12370; if you read it with
tshark -V, it reports malformed packets, but if you try to read it with
tshark without -V, it spins.

Bug: 12370
Change-Id: Ic3e7be2ddbaaf52b58c4f73348a0f093979af1cc
Reviewed-on: https://code.wireshark.org/review/15115
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-26 00:34:15 +00:00
Gerald Combs 8dc9551e1d Restrict the depth of the protocol tree.
Limit the the protocol tree to 500 levels. This keeps us from running
out of stack space in proto_tree_traverse_{pre,post}_order.

Bug: 12268
Change-Id: I60f6b4487bf51a4d43da0429819a8a20fbdb313a
Reviewed-on: https://code.wireshark.org/review/14887
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-04-13 18:46:26 +00:00
Guy Harris 21d47fa7db OK, we'll increase PROTO_PRE_ALLOC_HF_FIELDS_MEM a bit.
Change-Id: I6c4ed55634468b1200c069f1aeaf9200b47e052c
Reviewed-on: https://code.wireshark.org/review/14772
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-02 00:54:18 +00:00
Guy Harris af8de1a7c5 More "FT_BOOLEAN is 64-bit" fixes.
Change-Id: Iaacd492858ca2fb98c4947d587fbbd26fc102a7d
Reviewed-on: https://code.wireshark.org/review/14486
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-15 23:08:08 +00:00
Jaap Keuter 7bd1158b95 Remove double check for null (CID 1158871)
Make full use of our proper implementation of this macro by
giving it the pointer as is.

Change-Id: I0bbe73d19cc3f578b94ea2d4d904d6fa87b20b48
Reviewed-on: https://code.wireshark.org/review/14391
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-10 13:23:59 +00:00
Alexis La Goutte 4f3a88989e Add conflict check filter
Set ENABLE_CHECK_FILTER to 1 for get list of display filter with conflict...

Ping-Bug:2402
Change-Id: I8d56b1573120d1a29d437aae1088be242e15e9a3
Reviewed-on: https://code.wireshark.org/review/13644
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>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-03-07 07:57:29 +00:00
João Valverde 95dee44a77 const gpointer -> gconstpointer
'const gpointer' is the same as 'void *const'. Replace with gconstpointer
where straightforward (assuming that was the intent) and use gpointer everywhere
else for clarity (that does not change *API* constness contract; it just means
a variable is not declared immutable inside the called funtion).

Change-Id: Iad2ef13205bfb4ff0056b2bce056353b58942267
Reviewed-on: https://code.wireshark.org/review/13945
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-16 05:10:49 +00:00
João Valverde 82bb9ebc01 Add some casts to void * to fix (pedantic) argument mismatch notes
Change-Id: I63e46285b4c6676d4ae57196b85fbad89964898c
Reviewed-on: https://code.wireshark.org/review/13933
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-02-15 00:00:34 +00:00
Alexis La Goutte f3b660dab0 proto.c: fix indent (use tabs)
Change-Id: I1ebd31a694fde845e1ca4e125c1ed31bda7c00a8
Reviewed-on: https://code.wireshark.org/review/13646
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-02 05:23:13 +00:00
Guy Harris c599cd7b0b Add proto_tree_add_item_ret_string() routine.
It adds string-type fields to the protocol tree and returns the value of
the string.

Add the new bitmask-adding routines to the Debian symbol list while
we're at it.

Change-Id: Idaeec44c9cd373588cadce85010f3eaf1f3febb5
Reviewed-on: https://code.wireshark.org/review/13657
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-02 04:57:28 +00:00
Guy Harris b9fb2ceb88 Add heuristic dissectors for the variable part of COTP CR and CC PDUs.
Add tables for heuristic dissectors, and add dissectors for the stuff
Microsoft puts there for RDP; they're violating the COTP spec, but I
guess they're stuck because they're using TP0, which doesn't support
user data.

While we're at it, add variants of proto_tree_add_bitmask() and
proto_tree_add_bitmask_flags() that return the bitmask, for use by
callers.

A side-effect of the change is that the proto_tree_add_bitmask routines
no longer treat the encoding as a Boolean, so we have to pass
ENC_LITTLE_ENDIAN or ENC_BIG_ENDIAN, not just some non-zero or zero
value.  Do so.

Rename ositp_decode_CC() to ositp_decode_CR_CC(), to note that it
decodes both CR and CC PDUs.

Bug: 2626
Change-Id: If5fa2a6dfecd9eb99c1cb8104f2ebceccf1e57c2
Reviewed-on: https://code.wireshark.org/review/13648
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-01 23:20:12 +00:00
Kevin Bracey 9eda2fa063 Set width of hex output according to bitmask
Output from BASE_HEX et al has always been zero-padded to according to
the field type - 8 digits for FT_UINT32, etc.

When the field has a bitmask, this is definitely not appropriate - the
field type is used to indicate the size of the bitfield container, and
tells us nothing about the size of this field.

Instead, determine the actual size of the field by inspecting the
bitmask, and output the corresponding number of hex digits.

Change-Id: I10ec4e93e1e40e8b1354d5368cc8945cf671a617
Reviewed-on: https://code.wireshark.org/review/13225
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>
2016-01-24 00:03:18 +00:00
Guy Harris dced679fcc Squelch Coverity warnings CID 1348057 and 1348058.
No need to use FI_SET_FLAG() in proto_tree_add_item_ret_{u}int() - by
the time we call it, we already know that new_fi is non-null, so we
don't need a wrapper that checks for it being null.

Change-Id: Id00418e73c2ede97388a01eb12c8c94743291853
Reviewed-on: https://code.wireshark.org/review/13460
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-20 20:37:28 +00:00
João Valverde 69e80c4d87 Fix "Apply As Filter..." for BASE_PT field display types
Change-Id: Id92c16d04836b7871a26a285bee5bcf358ca50ef
Reviewed-on: https://code.wireshark.org/review/13399
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-18 17:59:34 +00:00
Guy Harris 241c0da314 Get rid of trailing white space.
Change-Id: Icc086c9dc1215115dd2a2ea4dbf7027237fe892e
Reviewed-on: https://code.wireshark.org/review/13140
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-09 02:27:52 +00:00
Guy Harris c67c6e8f30 Add routines to add an item and return the item's real length.
proto_item_get_len() is *not* guaranteed to return a correct value.
Even if there's a non-null tree item, it might be pointing to a "faked"
item; it really shouldn't be used.

So add proto_tree_add_item_ret_length() and
proto_tree_add_item_new_ret_length(), which calculate the real length
themselves and return it through a pointer.

Fix as many places as we straightforwardly can to use them rather than
to use proto_item_get_len().  (There's a Lua API for
proto_item_get_len(), so we keep it around, but we should add Lua APIs
for the new routines, and deprecate the old API.)

Fix ptvcursor_add() to do the same thing that
proto_tree_add_item_ret_length() and
proto_tree_add_item_new_ret_length() do.

Split the TRY_TO_FAKE_THIS_ITEM macros into a macro to check for the
tree being null and to try to fake the item.  We don't always use the
former macro, as we might need to do more than just return NULL if the
incoming tree is null (for example, calculating the item's real length
and using it...).

new_field_info() never returns NULL; remove checks for it.  The check
for a null tree is done before the calls to new_field_info().

Change-Id: I002a218d1f810c73e0de837e0ac6ebcde21bacec
Reviewed-on: https://code.wireshark.org/review/13139
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-09 02:26:06 +00:00
João Valverde cbc36cbd97 Remove constness from bytestring_to_str() [-Wcast-qual]
Change-Id: I7f942787dfdc4f76dd0ad5111d1eb528b20f0ba9
Reviewed-on: https://code.wireshark.org/review/13011
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-07 22:40:30 +00:00
Guy Harris 32f9f92487 Rename ipv4_addr and ipv6_addr to indicate their full contents.
They're not just addresses, they also include a mask length for IPv4 and
a prefix length for IPv6.  Rename them appropriately.

Rename the old ipv4_addr_and_mask() and ipv6_addr_and_mask() to reflect
that 1) they fetch data from a tvbuff and 2) *don't* fetch the mask
length or prefix length, those lengths are passed as arguments to
indicate how many bytes worth of address to fetch.

Change-Id: I4cad5a186ad7bfcb60022a91dbe8bc8479e6471f
Reviewed-on: https://code.wireshark.org/review/13035
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-04 00:03:34 +00:00
João Valverde 582e9579e0 proto.c: Disable warning when loading a symbol [-Wpedantic]
Change-Id: I309764e9cd0784c674a3cd91050eb697404561c6
Reviewed-on: https://code.wireshark.org/review/13012
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 01:40:53 +00:00
João Valverde 4473c67646 Fix some constness issues [-Wcast-qual]
Change-Id: I111558df3d36436ddf5e2728f113b022cc48a713
Reviewed-on: https://code.wireshark.org/review/13013
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 01:27:47 +00:00
Michal Labedzki 22d561c436 Add support for IEEE-11073 FLOATs
Add support for IEEE-11073 32-bit FLOAT and 16 bit SFLOAT field types.
Use them in Bluetooth ATT dissector.

Change-Id: Ife0f3843da84a9af23483b0a0d9b69cd2f511d08
Reviewed-on: https://code.wireshark.org/review/12680
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-12-29 14:20:02 +00:00
Guy Harris bc13e834cc Don't cast away constness for the key in g_hash_table_lookup().
Change-Id: Ibd5cf8947028d90a734de629e3c4202af9d0514b
Reviewed-on: https://code.wireshark.org/review/12887
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-28 22:24:56 +00:00
Stig Bjørlykke ea1789f925 Qt: Reload Lua expert infos
Support reloading Lua plugins with expert infos.
Use the same delayed deregister logic as for fields.

Change-Id: I36efa0820050b3a7afed4de7a8b0fa16805e8dfa
Reviewed-on: https://code.wireshark.org/review/12498
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>
2015-12-11 05:17:58 +00:00
Michael Mann dc9f782017 Add BASE_ALLOW_ZERO for byte arrays that are validly zero sized.
<MISSING> implies that the field should be there and isn't.  Allow dissectors to specify when a zero-sized array for a field is perfectly valid.

Ping-Bug: 11803
Change-Id: I3fd60e3c6f832c6b4a3a8837ebc52c3e74e795ae
Reviewed-on: https://code.wireshark.org/review/12271
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: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-30 18:28:10 +00:00
Stig Bjørlykke 94b9907d0f Lua: Validate Proto() arguments
Check if description (protocol name) and short_name are used before
registering the protocol.  This because proto_register_protocol() makes
sure there's not already a protocol with any of the names registered
and duplicates will be reported with a g_error() which terminates the
Wireshark unexpectedly.

Also check if short_name contains valid characters.

Give appropriate error messages.

Bug: 11739
Change-Id: Ib9776a2a3406ae5278ce744defd61864ebed0282
Reviewed-on: https://code.wireshark.org/review/11995
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-21 20:30:26 +00:00
Stig Bjørlykke 23258fb841 epan: Removed an unneeded g_malloc.
Change-Id: Ibc8b2651e2f56ecfdf9d00b235c39b6ac43b38b3
Reviewed-on: https://code.wireshark.org/review/12017
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-21 18:42:12 +00:00
Stig Bjørlykke e6b5f015e2 Lua: Added support for ProtoField framenum type.
Change-Id: I1d4cddd4026f08416005f2b3212536b3984d1a8d
Reviewed-on: https://code.wireshark.org/review/11834
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-15 18:33:16 +00:00
Juanjo Martin e52931bab0 RTPS: added new encoding to proto.c and used it in the rtps dissector
RTPS uses NTP encoding with a BASETIME equal to 0.

Also, changed "magic" by "Magic"

Change-Id: I2512176f2018396edaa6b2a1478facd26118cb13
Reviewed-on: https://code.wireshark.org/review/11184
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-11-02 03:48:47 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.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-10-22 11:45:56 +00:00
Martin Mathieson 9768a3e8a0 LTE dialogs: tidy up some loose ends
Change-Id: I18f099311f7660c91cffdf21bbacdb88b7c0fd7e
Reviewed-on: https://code.wireshark.org/review/11182
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-20 20:02:44 +00:00
Michael Mann 26eec29b44 Remove ability to make dissectors "private"
Change-Id: If5897e8137f729503edf2cafb49b2ebeab4716ad
Reviewed-on: https://code.wireshark.org/review/10997
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-10-15 21:17:27 +00:00
João Valverde a643d14187 Change proto_tree_add_ipv6() to take a struct e_in6_addr pointer
tvb_get_ipv6() takes a struct e_in6_addr *, use that here too.

Change-Id: Id8b368daa05c151a61d4bc01dc88c00da13e9c88
Reviewed-on: https://code.wireshark.org/review/10953
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: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-10-14 12:18:00 +00:00
João Valverde 2eb7e879f4 Add BASE_PT_ types to proto_registrar_dump_fields()
Change-Id: Ic6b3d71c3c9a14688b55d98f402d359f69524394
Reviewed-on: https://code.wireshark.org/review/10939
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-12 18:26:14 +00:00
João Valverde 14498f03a3 Fix hfinfo_*_format_display() for BASE_PT_ display types
Change-Id: I1a2a988a737c6821db6ac3a2b9ee9ff48add28c2
Reviewed-on: https://code.wireshark.org/review/10935
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-12 11:28:41 +00:00
João Valverde a459ac72a2 Add BASE_PT_ field display types
Avoid displaying duplicate port numbers with transport name resolution disabled and
make some dissector code simpler.

Introduces port_with_resolution_to_str_buf() function and amends UDP/TCP/DCCP/SCTP to
use the new field display type.

Change-Id: Ifb97810b9c669ccbb1a310a2c0ffd6e2b63af210
Reviewed-on: https://code.wireshark.org/review/10625
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-05 18:10:48 +00:00
Jeffrey Smith 57d954e168 Treat IPv4 subnet masks as distinct from addresses
While IPv4 subnet masks are obviously related and similar to IPv4
addresses, they are distinct enough that they need to be treated
seperately in some aspects.  For instance, there is no value in
attempting to resolve a subnet mask.

This change creates a new display type: BASE_NETMASK, which allows distinction from FT_IPv4
(and possible name resolution) where appropriate.

Change-Id: I99e19c9a58eb613f8e58d481af84c30e2e5e14d7
Reviewed-on: https://code.wireshark.org/review/10438
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>
2015-10-01 20:49:42 +00:00
Jeff Morriss 3ff5afd541 Add a test to verify we pre-allocated enough hf entries.
This way we'll know as soon as we drop below the pre-allocated limit. As
suggested by Graham on https://code.wireshark.org/review/10601

Change-Id: Ieeb14bdcf991d7a67c30787c97ca24ebb35d1763
Reviewed-on: https://code.wireshark.org/review/10627
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-09-23 20:09:39 +00:00
Jeff Morriss cd7387d22b Add a "fieldcount" report to tshark -G to let us easily see how many fields
are registered.

Change-Id: I06f10d96916640cb9a782cae87898a5dd6c9c6e3
Reviewed-on: https://code.wireshark.org/review/10601
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: Anders Broman <a.broman58@gmail.com>
2015-09-23 04:38:01 +00:00
Jeff Morriss e64c81609f Increase the number of pre-allocated hfs (from 144k to 170k).
169756 header fields are currently registered.  Including the 5k expert info
field pre-allocation this gives us about 5k unused entries (until we should
increase this number again).

Change-Id: Id8ea979cbe9e80756c12b5b73e816bbe3e9856ad
Reviewed-on: https://code.wireshark.org/review/10599
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-23 04:37:14 +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 648cf995b1 Make other_decode_bitfield_value private to proto.c.
This is further encouragement to not try to manually create a bitstring while formatting a field.

Change-Id: I4efbeb39a210cf1fd26203cd8560859276b333b0
Reviewed-on: https://code.wireshark.org/review/10494
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-13 00:15:35 +00:00
Gerald Combs f19a173a84 Speed up column sorting.
The GTK+ UI sequentially dissects and caches column strings for all rows
before sorting a column. Do the same in the Qt UI, which can improve
performance considerably.

Don't colorize packets when sorting in the Qt UI unless it's necessary.

When sorting in the Qt UI, let the user cancel the initial packet
dissection.  Note that we'll need to replace std::sort in order to
cancel out of sorting.

Use a pre-allocated and pre-compiled GRexex when we prime columns. Note
that we probably shouldn't parse a regular expression there.

Cache the last result of proto_registrar_get_byname.

Note performance hot spots elsewhere in the code.

To do:

GeoIP in packet-ip.c is pretty slow.

Bug: 11467
Change-Id: Ib34038fee08ef0319261faeffc4eca01e52f4bd3
Reviewed-on: https://code.wireshark.org/review/10275
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-08-28 02:54:20 +00:00
Stig Bjørlykke 079dd03fde Fixed typo in hfinfo_remove_from_gpa_name_map
Change-Id: Ic80fbe9397e50c41fa01ef9147319dd2ac0c0b91
Reviewed-on: https://code.wireshark.org/review/10226
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-24 09:53:23 +00:00
Stig Bjørlykke 216f06b299 Lua: Support deregister ProtoField with existing abbrev
Change-Id: Icb06792bb2662dcee6e5495359ceef420a5b4498
Reviewed-on: https://code.wireshark.org/review/10212
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-24 06:53:24 +00:00
Stig Bjørlykke 5f13933ddb Lua: Free true_false_string values at reload
Change-Id: I8ab194bf094e82f08ddafb0a1451aec42989b93d
Reviewed-on: https://code.wireshark.org/review/10044
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-15 17:26:54 +00:00
Stig Bjørlykke 46d6e8cc62 Added some missing breaks
Change-Id: I3b2f25832ca878ec3e7f9e4dcce258dc870fc5ad
Reviewed-on: https://code.wireshark.org/review/10031
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-14 12:49:36 +00:00
Stig Bjørlykke 7833b93c66 Free all hfi->strings in free_deregister_field
Change-Id: I6fe78266a2e881fa80e1e3a3423b685d3c1764de
Reviewed-on: https://code.wireshark.org/review/10029
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-14 11:47:25 +00:00
Stig Bjørlykke 28b52060d4 Free protocol in proto_free_deregistered_fields
This fixes some issues with use-after-free when reload Lua plugins.

Change-Id: I63f3fd9ebe8a19008f560e72067f2078f5eaf759
Reviewed-on: https://code.wireshark.org/review/10026
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-14 07:30:02 +00:00
Stig Bjørlykke dc7443fcc9 Added guards for deregistered fields
This is functions used when redissecting after a Lua plugins reload.

Change-Id: Ida14526faec1992006938a6732ee894ac83c2d12
Reviewed-on: https://code.wireshark.org/review/9995
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-12 12:09:43 +00:00
Stig Bjørlykke ecc4f756bd Added Reload Lua plugins.
This is initial support for reloading Lua plugins without
restarting the application.

Still todo:
- Deregister FileHandlers
- Support deregister ProtoField with existing abbrev (same_name_hfinfo)
- Add a progress dialog when reloading many plugins
- Search for memory leakages in wslua functions

Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1
Reviewed-on: https://code.wireshark.org/review/5028
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 12:09:07 +00:00
Pascal Quantin d12283b8e9 proto.c: exclude hf_text_only from proto_registrar_is_protocol()
This pseudo field is a specific case that is not linked to any protocol (despite parent being set to -1).
This prevents a crash in Qt GUI when selecting a line added with proto_tree_add_subtree() or similar.

Change-Id: I3b1cc2e6c7e71a71898f2ee9a02e9158eccf6fac
Reviewed-on: https://code.wireshark.org/review/9845
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>
2015-08-02 15:41:45 +00:00
Jeff Morriss 3fc4a831e0 Fix ptvcursor_add() so it can dissect the last bytes in a TVB again.
ptvc->offset has already been incremented by the item length so don't use it as
the offset to test_length(); we need to use the original offset.

Problem introduced by Idfd258c734e7a946300b2564bebf6e4cb374c8d1 .

Change-Id: I0421539bde6e8eb7b5aa3e22dbb0ca8098e88d6f
Reviewed-on: https://code.wireshark.org/review/9779
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-25 13:00:44 +00:00
Michael Mann 5b53445e81 Add test_length to ptvcursor_add so it can do some bounds checking.
Ping-Bug: 11358
Change-Id: Idfd258c734e7a946300b2564bebf6e4cb374c8d1
Reviewed-on: https://code.wireshark.org/review/9655
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-07-23 09:24:06 +00:00
Michael Mann 2c534a93ac Add Enabled Protocols dialog for Qt
This dialog combines the "protocols" and heuristic dissectors (from GTK) into a single tree view where heuristic dissectors are children of their protocol.

Change-Id: I107656afd079c1d1c8a98161b736e4b4ad84f813
Reviewed-on: https://code.wireshark.org/review/9739
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>
2015-07-23 09:15:36 +00:00
Gerald Combs d2acb04b4c Add the RTP Stream Analysis dialog.
Combine the GTK+ RTP Stream Analysis and RTP Graph Analysis dialogs into
one. Yell at the user less. Disable the Analyze RTP Stream menu item if
we don't have an RTP stream selected.

There are a *lot* of moving parts in this dialog. I've tested with the
few RTP captures I have but it's by no means complete.

"To do" items are listed at the top of rtp_analysis.cpp.

Change-Id: Id503977f069bebc46cc68bc749f0c9cbf4d37bf6
Reviewed-on: https://code.wireshark.org/review/9650
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-07-16 00:30:14 +00:00
Pascal Quantin 523ce152e8 Do not try to display a value_string for FT_FRAMENUM type
The hfinfo->strings pointer is used to store a ft_framenum_type_t

Bug: 11325
Change-Id: Ia6ee1bdd4f1e6ff93907e6107fcecab56c0320de
Reviewed-on: https://code.wireshark.org/review/9458
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-02 11:36:11 +00:00
Alexis La Goutte 8e87fad9d7 proto.c : fix indent
Change-Id: I74461666bcfc6e85a92409819e2c63811284e8f8
Reviewed-on: https://code.wireshark.org/review/9433
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-01 08:23:10 +00:00
Pascal Quantin 6126a64550 Fix proto_tree_add_bytes_item() when we fail to decode number from string
We still need to insert an empty g_byte_array

Bug: 11309
Change-Id: Idf2ed8ea81b3f612ef8d6ae1aed158108dcc4356
Reviewed-on: https://code.wireshark.org/review/9114
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-25 01:46:13 +00:00
Martin Kaiser d85a221cd3 proto_tree_add_item_ret_(u)int: do the NULL check at the start
before hfinfo is actually used (coverity 1293631)

Change-Id: I270c30c4699cd6f831a38986e6c8024c2e9ef47a
Reviewed-on: https://code.wireshark.org/review/9061
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-23 20:15:45 +00:00
Anders fde38c099f [MSVC 2015] Try to fix warinings turned errors.
Change-Id: Ife5aba55d6953fbd3874095f2e469a844ca8ef2e
Reviewed-on: https://code.wireshark.org/review/8762
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-06-04 15:10:15 +00:00
Evan Huus 9fd6c45560 proto: use correct mask when checking display
Otherwise numeric fields with BASE_EXT_STRING don't match anything and cause an
assertion failure.

Also fix indentation.

Change-Id: I2708be50a6c5aff5400ec44e6a141db39d2d94e7
Reviewed-on: https://code.wireshark.org/review/8391
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-05-11 21:42:20 +00:00
Guy Harris f80205e32f Make bit masks unsigned.
To quote a run-time error reported in

	https://www.wireshark.org/lists/wireshark-dev/201504/msg00084.html

"left shift of 1 by 31 places cannot be represented in type 'int'", so
use type "unsigned int" instead, by shifting 1U rather than 1 left.

Change-Id: I95cf5ce53aa3b94ccb9f246d31863715bb682409
Reviewed-on: https://code.wireshark.org/review/8252
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-30 18:14:38 +00:00
Guy Harris bba29ddcf4 The previous change doesn't work; do it right.
The correct bit has to be set in the value passed in; create a
proto_tree_add_boolean64() that takes a 64-bit argument and use that.

Change-Id: I28eaab38308baa908bdc1b043b2f0b87a17afe0d
Reviewed-on: https://code.wireshark.org/review/8131
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-20 07:06:30 +00:00
Guy Harris d47373f278 Make sure we handle Booleans even with the upper 32 bits set.
Just pass 1 or 0 to proto_tree_add_boolean() depending on whether the
64-bit value is non-zero or zero.

Change-Id: I5b55c9aff4e559fb8e62bd96ae2b0b34e45189fa
Reviewed-on: https://code.wireshark.org/review/8129
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-20 01:52:28 +00:00
Guy Harris 1edbd5a875 Don't use proto_tree_add_uint() to add FT_BOOLEAN values.
In proto_item_add_bitmask_tree(), if use_value is true, base the routine
we use to add the item to the tree on the type of the field being added.

Also, use DISSECTOR_ASSERT_NOT_REACHED(), not g_assert_not_reached(), to
catch types that aren't integral or Boolean.

Change-Id: I6ff9867bddcae16ddf8b689b48fdc93c6f949105
Reviewed-on: https://code.wireshark.org/review/8127
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-19 21:27:20 +00:00
Michael Mann 6ab6136a94 Add more "bitmask grouping" APIs.
Add proto_tree_add_bitmask_value, proto_tree_add_bitmask_value_with_flags and proto_tree_add_bitmask_list to aid in the removal of proto_tree_add_boolean "groupings" as well as "groups" of fields that use proto_tree_add_item with the same offset/len.

This may be able to be optimized later, but the first step will be converting dissectors to use it.  A sample conversion of each API is also included.

Change-Id: I53febc7450ad632482f82615a7fa62174f8472c9
Reviewed-on: https://code.wireshark.org/review/8038
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-04-13 13:46:11 +00:00
Michael Mann 1f45a37713 Replace PROTO_TREE_ADD_XXX_ITEM macro use with real code.
PROTO_TREE_ADD_XXX_ITEM had a bug in it for int values.  This was
fixed by adding proto_tree_set_ ## ctype ## to the macro, but not
all compilers support macros at the end of a function, so just
remove the macro entirely and just have the duplicate code.

Change-Id: Icf92a6786daa0e84305ba174ce155833f90b6463
Reviewed-on: https://code.wireshark.org/review/8006
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-09 18:27:02 +00:00
Michael Mann eb0489b26e Correct macro expansion in PROTO_TREE_ADD_XXX_ITEM for integer fields.
Change-Id: I57e5dcfabc1c1b4c024b9e1cbfd8b9a34c79c330
Reviewed-on: https://code.wireshark.org/review/8003
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-09 12:42:31 +00:00
Gerald Combs 7787c1b464 Fixup our anonsvn URLs.
Change-Id: Id18d392bf7ff948fc78b684d8222c5c3725d302a
Reviewed-on: https://code.wireshark.org/review/7886
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-04-02 19:21:41 +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
Michael Mann baa83912e3 Eliminate decode_bitfield_value from "public" use.
This "encourages" (forces) dissectors to use the bitmask field of the header_field_info structure to get "bitmask formatting" of a field.

other_decode_bitfield_value should be treated the same (eventually eliminated), but there are still replacements to be made in the dissectors.

Change-Id: I8a0d829c3fef2d5e5a588667a259e231bca559e6
Reviewed-on: https://code.wireshark.org/review/7736
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-03-19 04:33:26 +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
Pascal Quantin b9af5a5b32 proto.c: avoid corrupting stack when printing a 64 bits field in BASE_DEC_HEX or BASE_HEX_DEC format
Bug: 10994
Change-Id: Id5049054d5b04838df325f03a6bfa238a2063fb7
Reviewed-on: https://code.wireshark.org/review/7329
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-24 03:23:45 +00:00
Guy Harris d1865e000e Make FT_{U}INT{40,48,56,64} handle BASE_CUSTOM.
Finish the job of handling integral values > 32 bits similarly to who we
handle values 32 bits or less.

In cases that "should not happen", and where we might *not* be executing
in the context of a dissector (filling in the field label can be done
lazily, being deferred to "print" time, and that doesn't happen in the
context of a dissector), use g_assert_not_reached() rather than
DISSECTOR_ASSERT_NOT_REACHED() - the latter throws an assertion that's
not caught if we're not doing dissection, so we crash anyway.

Bug: 10983
Change-Id: Ia81a0a4925394f99aa35193a333f3e9659a9b93d
Reviewed-on: https://code.wireshark.org/review/7307
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-22 08:56:43 +00:00
Guy Harris 1157aa8fd1 Set 64-bit signed values with proto_tree_set_int64().
As in "don't set it with proto_tree_set_uint64(), signed vs. unsigned
matters".

Change-Id: I23ef3d172fa40c0867dfb6a078ce292bd5282170
Reviewed-on: https://code.wireshark.org/review/7306
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-22 07:26:41 +00:00
Guy Harris 2196378bcb Fetch values appropriately according to the value's type.
This fixes some crashes.

Change-Id: I47583777486486114675ba98cb58971adb8b1b10
Reviewed-on: https://code.wireshark.org/review/7305
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-22 03:45:54 +00:00
JC Wren e2bcee6ac4 Make FT_{U}INT64 behave more like FT_{U}INT32, add support for FT_{U}INT{40,48,56}
Change-Id: I57354c309ecf3a0c8f0c7cff485638027f30bb19
Reviewed-on: https://code.wireshark.org/review/5813
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-21 16:57:52 +00:00
Michael Mann 8d16ac46d5 Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string.

Convert AT_FCWWN to using proper name resolution format

First use of address_with_resolution_to_str with field types in proto.c

Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2
Reviewed-on: https://code.wireshark.org/review/7196
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-02-19 13:09:41 +00:00
Dario Lombardo 60cc8b4fd8 Support for looking for incomplete dissectors.
Change-Id: I03e592dd3d54fc0e1c4af09d5d5336dda93f950e
Reviewed-on: https://code.wireshark.org/review/6978
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-12 11:14:24 +00:00
Guy Harris 207b52a988 tvb_length is a macro wrapper for tvb_captured_length; use tvbuff_length.
This squelches a compiler warning on some platforms.

Change-Id: Ibee5c2fe07fc58e22a860b4c4467a501c2b8a979
Reviewed-on: https://code.wireshark.org/review/7079
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-12 10:26:00 +00:00
Michal Labedzki 707522396c Little tuning of proto_tree_add_bytes_with_length
Change name from proto_tree_add_new_bytes to
proto_tree_add_bytes_with_length and other tweaks
pointed by Peter Wu.

Change-Id: I6058c28a74a154e2882e4eb04558bedcede6f508
Reviewed-on: https://code.wireshark.org/review/7039
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-02-12 09:22:55 +00:00
Bill Meier e88a11f5c9 (Trivial) Fix printf-related 'Mismatch on sign' warnings
Found by MSVC2013 Code Analysis

Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79
Reviewed-on: https://code.wireshark.org/review/7045
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-09 18:57:14 +00:00
Michael Mann 4497bb48fd Add address type registration.
Now address types are setup just like field types and must be registered with a structure that provides its string representation (and more things in the future).  Address types that are limited to a single dissector are registered by the dissector.  More "common" ones are globally registered.  There are still a few that really belong in a dissector, but have other dependencies currently not accounted for in the address type support.

Many of the "address to string" conversions that involved g_sprintf have be changed to use more "performance friendly" methods (some at the cost of needing to_str-int.h)

Leaving all comments regarding this "solution" in address_to_str.c in until all have been implemented

Change-Id: I494f413e016b22859c44675def11135f228796e0
Reviewed-on: https://code.wireshark.org/review/7019
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 01:12:01 +00:00
Michal Labedzki 617c733b9f Add proto_tree_add_new_bytes()
Version to add as generated field, without tvb offset, length.

Change-Id: If4c7aebcbf1b47faa483bcbd40995eff3ccb99f0
Reviewed-on: https://code.wireshark.org/review/6906
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-02-07 16:56:05 +00:00
Michael Mann 90a76e0d51 Convert val_to_str -> val_to_str_wmem.
This is mostly for GUI usage, but a few dissectors needed some "non-packet scope" conversions.

val_to_str officially now uses wmem_packet_scope()

Change-Id: Ic9413eeb3406d7a7683222b86709f3675d628d81
Reviewed-on: https://code.wireshark.org/review/6933
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-04 06:58:49 +00:00
Michael Mann e333e4c90f Convert OID APIs to use wmem.
There are a few oid functions that are only called in oids_test.c.  I'll presume the APIs are used in proprietary dissectors rather than just remove them.

Change-Id: I4595e00f93bf9ab8cf2493fe0432b91960f55a3f
Reviewed-on: https://code.wireshark.org/review/6592
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-19 02:52:11 +00:00
Guy Harris d2d4cf27e6 Remove a couple more apparently-no-longer-necessary emem.h includes.
Change-Id: I007a904613653b60a5b1a4fdc8261bc1480e41c6
Reviewed-on: https://code.wireshark.org/review/6637
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 21:10:41 +00:00
Evan Huus 929d41c685 Replace the last THROW ep_ calls with wmem
They (should) all be strictly within the context of dissection, so can just
become packet_scope.

Change-Id: Iaaa733628132f3ee3f1597f3df956e44080734f6
Reviewed-on: https://code.wireshark.org/review/6631
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-18 20:24:26 +00:00
Bill Meier 24954d6bdf proto.c: Update some comments to reflect reality
Change-Id: I0f82666cb233688d94d6f3a2c45d7490a7f79bec
Reviewed-on: https://code.wireshark.org/review/6634
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-18 19:49:03 +00:00
Michael Mann 0ad15f88cc Replace the last of ep_alloc and ep_alloc0 with wmem equivalent.
Change-Id: I0338d0acda5e4b9957aad4825ca2cfd6fa506ead
Reviewed-on: https://code.wireshark.org/review/6596
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-17 23:23:06 +00:00
Michael Mann 5c5b3f7d26 Convert proto_construct_match_selected_string to use wmem.
Change-Id: I7a40c0996517aa71b4ddb764ce3a6e92a55260ad
Reviewed-on: https://code.wireshark.org/review/6589
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-17 21:04:22 +00:00
Michael Mann f5c4d06dba Replace some "low hanging fruit" uses of emem.
Most of the remaining ep_ uses are grouped with specific functionality.

Change-Id: I8fa64a17acc6bcdcf6891b2d28715ac0c58f1a4a
Reviewed-on: https://code.wireshark.org/review/6484
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-11 00:27:57 +00:00
Guy Harris fdd6554ccd Rename the FT_BYTES separator types to SEP_ from BASE_.
There's no requirement for "display" field values to have names
beginning with BASE_; use SEP_, to indicate that they're separators.

(And, yes, we should introduce SEP_NONE, with a value of 0, and use it.)

While we're at it, fix BASE_SEMICOLON - the separator is a colon, not a
semicolon - and document SEP_SPACE in doc/README.dissector.

Change-Id: I856aafda2c60b8320dffe287f0deb06a9604a2bf
Reviewed-on: https://code.wireshark.org/review/6486
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-11 00:27:28 +00:00
Michael Mann 59c1e32d2c Add BASE_SPACE for FT_BYTES
It's just like BASE_DOT, BASE_DASH and BASE_SEMICOLON, only its a space between bytes.  Since this seems pretty specific to FT_BYTES, perhaps there is a better was to represent the functionality (like FT_BOOLEAN uses numeric values for number of bits)?

Change-Id: I1a8f1ab263ece2736a8012b66fdd6a9105db7282
Reviewed-on: https://code.wireshark.org/review/6451
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 19:57:59 +00:00
Michael Mann effc8266ce Add preference to display spaces between bytes for FT_BYTES fields.
I think this can make fields more readable (for a small amount of bytes).

Converted DeviceNet dissector to use proto_tree_add_item for some FT_BYTES field as tvb_bytes_to_str_punct was used to create this effect "manually".

Change-Id: I59e2acf9b00a4eb1279e6c2b2b7bd8ecef20db9b
Reviewed-on: https://code.wireshark.org/review/6304
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 19:57:27 +00:00
Michael Mann 284229c0f8 Convert EUI64 address APIs to use wmem.
Change-Id: I57d2e435ac72ea07ec9a567e0b1ce4410966e3d2
Reviewed-on: https://code.wireshark.org/review/6419
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 07:44:54 +00:00
Michael Mann 6a6e2efbf9 Have ipxnet addresses use wmem scoped memory.
Change-Id: I1d8eed2ceacccce2768590f0689cd2c83a5e56e9
Reviewed-on: https://code.wireshark.org/review/6418
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 06:02:59 +00:00
Michael Mann d296c75247 Some more random removal of ep_ memory.
Change-Id: I6eccd20280e907bd9e6a5fcf873ccf80afddecac
Reviewed-on: https://code.wireshark.org/review/6416
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 05:54:38 +00:00
Michael Mann 67b1593921 Remove proto_tree_add_ax25
There isn't a legitimate use for the API, all cases can be covered with proto_tree_add_item.  As a bonus, a few more tvb_get_ptr calls can be removed.

Change-Id: I3bb86ba8f05ef3363407bcfe9b059ee27ebc135d
Reviewed-on: https://code.wireshark.org/review/6429
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-09 01:10:28 +00:00
Michael Mann cff098e3eb guid_to_ep_str -> guid_to_str
guid_to_str now uses wmem allocation.

Change-Id: I8e48d1a720942fbefbaa6227ae0929cb9f856359
Reviewed-on: https://code.wireshark.org/review/6391
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08 07:18:09 +00:00
Michael Mann 98d3b1494b Replace bytes_to_ep_str_punct with wmem equivalent.
Change-Id: I8aa7d7374db94685fd875cbf358c3bfbc83f3255
Reviewed-on: https://code.wireshark.org/review/6370
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:12:35 +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
Michael Mann 553da37446 Create BASE_DOT, BASE_DASH, and BASE_SEMICOLON types for the FT_BYTES field type.
These "bases" will put a ".", "-", or ":" respectively between hexidecimal bytes in the field in packet view and display filter.  FT_BYTES with BASE_NONE will have no separator in the packet view, but continue to have the ':' as a separator in the display filter.

Converted the "string" hf_ entries that used tvb_fc_to_str as a string to use proto_tree_add_item with FT_BYTES/BASE_DOT type.

Converted applicable tvb_bytes_to_ep_str_punct() calls to use the new BASE values.

Change-Id: I2442185bb314d04a3ff2ba57883652ecd738b5f9
Reviewed-on: https://code.wireshark.org/review/6098
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04 16:32:03 +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
Guy Harris 147ca45683 Improve the message for "this field has an integral type" assertions.
(Along the lines of provious changes.)

Change-Id: I22d76f22400d4a93242392ff4688acc753eb0039
Reviewed-on: https://code.wireshark.org/review/5961
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-22 00:09:36 +00:00
Guy Harris 48419fc2b7 Improve the message for "this field doesn't have the right type" assertions.
Give the field name in the message.

Change-Id: I046c74b451b473c9c87c2980122b025390f82cc8
Reviewed-on: https://code.wireshark.org/review/5959
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-21 23:17:39 +00:00
Pascal Quantin bd19532bfb Do not use packet scope memory outside packet dissectors
Otherwise it will trigger an assert
Fixes a regression introduced in gf002332

Change-Id: I0cffa2c952b7eff085a1834ebabfec03342095bd
Reviewed-on: https://code.wireshark.org/review/5950
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-21 18:30:33 +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
Michael Mann cdaa669829 Replace ax25_to_str and get_ax25_name with address_to_str.
Change-Id: I74ddb6fc629ef32b217dede7a3ba652cbbf5ab12
Reviewed-on: https://code.wireshark.org/review/5932
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-21 15:12:58 +00:00
Bill Meier 71d13b30af proto.c: Add hint to 'DISSECTOR_ASSERT(hf->bitmask != 0)' to show field name.
Change-Id: Ie578a73742901c1837802da17c0aaf2e58d48c6f
Reviewed-on: https://code.wireshark.org/review/5835
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-18 17:02:39 +00:00
Michal Labedzki 361ea8215d Add support for multifields in custom column
You can now add column with Custom type with more than one field
by using OR "||" splitter.

Bug: 9695

Change-Id: Ia82a91e7a35b867647d36cb9626e3870f46c0d85
Reviewed-on: https://code.wireshark.org/review/5804
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-12-18 11:03:42 +00:00
Michael Mann a971768530 Refactor "color" conversation filters
Have dissectors register their desire to be part of "color" conversation filters and have the GUI use that registered list.  GUI actually using API will come in a separate commit.

Change-Id: I5ffe922d97894fe7bf3182056b76ab5839a9461a
Reviewed-on: https://code.wireshark.org/review/5658
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-10 09:04:00 +00:00
Michael Mann e172ebb3b4 Add proto_tree_add_bitmask_with_flags.
It's proto_tree_add_bitmask with the ability to control the data appended to header.

Change-Id: Icce97437ba7cfc9158ec204a837da8db8138424a
Reviewed-on: https://code.wireshark.org/review/5533
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-08 01:13:02 +00:00
Bill Meier 20153980eb proto.c: proto_registrar_dump_values(): don't skip "same name" fields.
It appears that Wireshark allows (and currently has) fields with the
same name with differing "strings" content.

Change-Id: Iddac5a2c9f456a97ea676f2007f43d786482eebd
Reviewed-on: https://code.wireshark.org/review/5491
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-25 18:52:34 +00:00
Stig Bjørlykke ea167053ff Improved deregistering fields.
This improvement avoids use of deallocated memory (crash) if using a
deregistered field in display filter, color filter, custom column and
other cases when the field is used as "interesting field".

This functionality is currently used in http, imf and ldap preferences.

Also removed unused proto_registrar_n() as this does not work correctly
after deregistering fields.

Change-Id: I043e3bf7a98bd773c9801e712a012d1eab8a7f94
Reviewed-on: https://code.wireshark.org/review/5161
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-11-10 08:01:12 +00:00
Martin Kaiser 179a9b5106 new function proto_tree_get_parent_tree()
it returns the parent tree of a given tree object

Change-Id: I191e0221651ffb5b26df761e9a25075aa0eb2ad3
Reviewed-on: https://code.wireshark.org/review/4954
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-11-02 21:17:15 +00:00
Guy Harris 417c181afb Use guint8 for 8-bit unsigned numeric values.
That slightly better expresses the intent.

Also, fix the message printed for bad bytes in a field name to handle
bytes that are bad because they don't correspond to printable ASCII
characters.

Change-Id: I01f232c35bbbe30286999b6c607bfcf3d491453d
Reviewed-on: https://code.wireshark.org/review/4976
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-28 18:37:09 +00:00
Gerald Combs 1c159818fd Qt: ByteViewText hover information.
When the user hovers over a byte view field, highlight it and show a
description in the status bar.

Add a "byte" status bar context and fix a label stack pop bug.

Keep proto_find_field_from_offset from matching generated items.
Otherwise hovering and selecting finds things like GeoIP entries and
checksum validation information. This affects the GTK+ UI as well.

Change-Id: Ic81c0d8159510a72d30c41f961807d8a48d05e16
Reviewed-on: https://code.wireshark.org/review/4943
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-27 02:05:13 +00:00
Stig Bjørlykke 0bbe48304a Proto: Fixed proto_unregister_field()
This function did not work after svn revision 51396.
This fix affects http, imf and ldap preferences.

Change-Id: I6fcb24c968d03c7d1fdc018cfa907f9cfd8809bb
Reviewed-on: https://code.wireshark.org/review/4881
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-20 20:57:45 +00:00
Stig Bjørlykke 39c3a794d8 Check if mask_greatest_bit_offset is within limits.
The result of the '>>' expression is undefined if mask_greatest_bit_offset = 0.

Change-Id: I15b094a5220a5075878bad65ab0b8c5279e80e8a
Reviewed-on: https://code.wireshark.org/review/4723
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-20 01:45:28 +00:00
Guy Harris 033f096ee9 Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars (which
we weren't always doing before).

Change-Id: Ieceb93029252f646397b6488f2df8a57c6d2a23d
Reviewed-on: https://code.wireshark.org/review/4794
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17 23:11:18 +00:00
Pascal Quantin b3ad51db7c Follow-up of ged0b19b (Make boolean bitmask type 64-bit wide)
- use G_GINT64_MODIFIER instead of "%ll"
- use G_GUINT64_CONSTANT instead of ULL
- add some missing explicit casts

Change-Id: Ic048d9ee8966ea504ea542cefe55688edcfb2dc7
Reviewed-on: https://code.wireshark.org/review/4644
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-13 15:34:09 +00:00
Daniel Mack ed0b19b94b Make boolean bitmask type 64-bit wide
There are protocols out there that have 64-bit wide bit mask fields, so
make the internal representation and bitfield decoders 64-bit aware.

For this, the ws_ctz() fallback and bits_count_ones() have to be tweaked
slightly.

Change-Id: I19237b954a69c9e6c55864f281993c1e8731a233
Reviewed-on: https://code.wireshark.org/review/4158
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
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-10-12 14:15:12 +00:00
Guy Harris b5296f465e Use tvb_new_subset_length() rather than tvb_new_subset().
We rarely, if ever, want to, or need to, explicitly set the captured
length of a packet; we want to set the *reported* length and let the
tvbuff code figure out how much of that data was actually captured.

Change-Id: I9b93d296197989f677d888b10954589dfc1edc59
Reviewed-on: https://code.wireshark.org/review/4138
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-16 21:30:47 +00:00
Bill Meier a379ac74d2 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2
Reviewed-on: https://code.wireshark.org/review/4126
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 15:31:58 +00:00
Jeff Morriss fee9277d76 Fix some logically dead code reported by Coverity (CIDs 1158807, 1158808, 1229737).
Replace some conditional + fprintf + DISSECTOR_ASSERT()s with
DISSECTOR_ASSERT_HINT() or just change the DISSECTOR_ASSERT() to
DISSECTOR_ASSERT_NOT_REACHED() when the hint requires formatting.

Change-Id: I80c7c6579d7755a60d644b5ef60ec4e3299ba0ab
Reviewed-on: https://code.wireshark.org/review/4115
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2014-09-16 00:40:25 +00:00
Guy Harris 176bd64d8c TRY_TO_FAKE_THIS_ITEM() doesn't take a tvbuff_t * argument.
Change-Id: I782f73dd072f515e34ce98892340dc176978a364
Reviewed-on: https://code.wireshark.org/review/4112
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-14 21:08:55 +00:00
Jeff Morriss af9d2dfa13 Don't try to set the length, end, or text of a faked item.
If we try we may (in the case of setting the length or end) mistakenly assert
out.

Bug: 10329
Change-Id: I52083ba17f6427712a6a363f48f1f7ae51f2b74b
Reviewed-on: https://code.wireshark.org/review/4093
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-09-14 18:41:13 +00:00
Jeff Morriss 36ddf54093 Revert "Only fake an item by returning 'tree' if they use the same TVB"
This reverts commit 5460d7fa0c.

Bug:10329
Change-Id: I6f13f9c18bb23fd10b3a574e42ad2d3f6c7beadb
Reviewed-on: https://code.wireshark.org/review/4092
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-09-14 18:40:45 +00:00
Guy Harris 5ade437ffe Treat a length of -1 as a Very Large Length in most cases.
For field types where it doesn't mean "to the end of the tvbuff", treat
it like other negative length values - as if it were unsigned and thus
Very Large and thus likely to be past the end of the tvbuff.  That way,
some of the "we hax0red your SNMP packets" captures, with length fields
of 0xffffffff, report malformed packets rather than dissector bugs.

Change-Id: Id53f828b06b6febe7d79f8539e54523e0b43e5c2
Reviewed-on: https://code.wireshark.org/review/4091
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-12 17:00:03 +00:00
Guy Harris 9accfd1490 Do FT_{U}INT64 the same way we do other FT_{U}INTn types.
Change-Id: Iae9c66fa82abfe20e9e8c922ddedfe87b0ab2abe
Reviewed-on: https://code.wireshark.org/review/4088
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-12 07:49:43 +00:00
AndersBroman 94f90e5473 Code simplification from Hadriels abandoned change.
Change-Id: If859ff904b254d3bc62d1d0dc5cf26cace11cae3
Reviewed-on: https://code.wireshark.org/review/4075
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-09-11 13:54:39 +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
Michael Mann 3635d7bed7 Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood.

Change-Id: Ib76f4a9f89b5933425760af0a980c6a549031b8f
Reviewed-on: https://code.wireshark.org/review/3537
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-10 21:39:20 +00:00
Jakub Zawadzki 76e4698b6d Always create subtree in proto_item_add_subtree().
It might fix bug #10345

Ping-Bug: 10345
Change-Id: I695a2955a9bb0248ff3967bdaef004389500bbc9
Reviewed-on: https://code.wireshark.org/review/3402
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-04 14:29:43 +00:00
Evan Huus 3da89d6cd5 Add missing macro parameter
This is what you get for forward-cherrypicking commits you made on master-1.12.

Change-Id: I8e51181d497dc63c614fe623439506cfe99c6fa3
Reviewed-on: https://code.wireshark.org/review/3385
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-03 17:55:51 +00:00
Evan Huus 5460d7fa0c Only fake an item by returning 'tree' if they use the same TVB
Otherwise the offsets will be wrong when calling, e.g. proto_item_set_end.

Bug:10329
Change-Id: I5ae0c660af90678e446817b65f83c075e7c0b84e
Reviewed-on: https://code.wireshark.org/review/3341
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-03 17:23:59 +00:00
Jeff Morriss a91dbf7aa7 proto_add_subtree_format(): initialize tree_item to 'tree' rather than NULL.
... As would be the case if proto_tree_add_text() + proto_item_add_subtree()
were used.  (This initialization value is only used when TRY_TO_FAKE_THIS_ITEM()
shortcuts us out.)

As reported/discussed on -dev:

https://www.wireshark.org/lists/wireshark-dev/201407/msg00031.html

Change-Id: I4af63e3cf0a70607d58b4641597b2ce7907fbb8b
Reviewed-on: https://code.wireshark.org/review/3271
Reviewed-by: Michael Mann <mmann78@netscape.net>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-31 14:39:46 +00:00
Martin Kaiser 54d503078a (trivial) modify, indent a comment
Change-Id: I64bb64787c83ffe712ffd348cceb5449690dd6d0
Reviewed-on: https://code.wireshark.org/review/3247
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-29 16:02:41 +00:00
Kevin Cox 34e413f66d Make value_string_ext const-correct.
There is still some const-incorrect usage of them but those can be ironed
out after this change has been made.

Change-Id: Iba0631c804bdab34d7c0232b49967130e3370488
Reviewed-on: https://code.wireshark.org/review/3199
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-27 22:02:42 +00:00
Michael Mann 31ecdf5b06 Refactor "common" Conversation table functionality.
Refactor (non-GUI) conversation table functionality from gtk/Qt to epan.  Also refactor "common GUI" conversation table functionality.

The idea is to not have to modify the GUI when a dissector adds a new "conversation type"

Change-Id: I11f08d0d7edd631218663ba4b902c4a4c849acda
Reviewed-on: https://code.wireshark.org/review/3113
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-07-26 20:59:42 +00:00
Bill Meier 9cf40b67b2 Fix Bug #10238: Display filter expression dialog items do not expand/display properly.
Unfortunately, certain proto_hier_tree_model.c functions
    assume/require that a cookie generated by
    proto_(first|next)_protocol_field() will never have a NULL value.

    Bug introduced in gd47ae54.

Change-Id: I42763d02f700e15ca9b3ab9980943d4f8d933ca9
Reviewed-on: https://code.wireshark.org/review/2712
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-30 12:28:12 +00:00
Michael Mann 65b75212e1 Ensure proto_item from subtree is initialized
bug:10223
Change-Id: I40ed92bcf436723ad3927a93181f7c732cf4690f
Reviewed-on: https://code.wireshark.org/review/2623
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-24 19:26:17 +00:00
Michael Mann 28e8ce59cc Add proto_tree_add_subtree and proto_tree_add_subtree_format
This is intended as a replacement for all of the proto_tree_add_text followed by proto_item_add_subtree calls.

Change-Id: I892136d7b9d8b4e100996097eff62ce7af9512d2
Reviewed-on: https://code.wireshark.org/review/2472
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-20 06:58:12 +00:00
Jakub Zawadzki b6d20a27a1 Optimize reseting epan_dissect_t when filtering.
Don't destroy interesting_hfids hash table, just remove all values.

Change-Id: I119aaebf91aca8916aea0f15376ff2cb9d3fbc35
Reviewed-on: https://code.wireshark.org/review/2467
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-19 23:33:14 +00:00
Jeff Morriss f113306e0e More Python-bindings removal.
Change-Id: I4d82175781e65c73179f4c8e737a7900cb050bce
Reviewed-on: https://code.wireshark.org/review/2283
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-06-16 23:14:05 +00:00
Evan Huus 3a3b36f01e kill one last python remnant
Change-Id: I21ec54e59acc799ccb0799f06e95713a60f8e86d
Reviewed-on: https://code.wireshark.org/review/2272
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-16 21:01:19 +00:00
Evan Huus e0aabd97d8 Convert more time_to_str functions to wmem
Change-Id: Ibaae0e79935dc62f12f713f2df5b57d0f3f799b9
Reviewed-on: https://code.wireshark.org/review/2254
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-16 19:10:59 +00:00
Evan Huus de00c49bd8 Convert a bunch of time_to_str functions to wmem
Change-Id: I24fe3cc4a3589dadc4528a77fe7ff13d06b1a983
Reviewed-on: https://code.wireshark.org/review/2245
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-16 17:26:25 +00:00
Guy Harris 38834084b2 Fix type/length mismatch messages for FT_ETHER.
The main limitation that comes to mind for the length of "an Ethernet"
is that a 10BASE5 segment can't be longer than 500 m. :-) Say "a MAC
address" rather than "an Ethernet", as 1) we're fetching an address, not
an actual physical Ethernet and 2) FT_ETHER is really FT_MAC48 and it
used for protocols other than Ethernet.

Change-Id: I402341371006e7933faa5c60dab2e58cfb349eb3
Reviewed-on: https://code.wireshark.org/review/1913
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-01 21:29:31 +00:00
Jakub Zawadzki d7bd2ecf9f Add new proto_tree_add_format_text() function
There are lot of text dissectors which want just to add escaped (not filtrable) text,
add new function proto_tree_add_format_text() which just do this in optimized way.

Change-Id: Ia0e189b620cc0a5b74cfdaef1ad4571d766bb2ab
Reviewed-on: https://code.wireshark.org/review/1678
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-19 02:27:12 +00:00
Evan Huus a1b939313f Revert "Don't throw for offset at end of TVB with len -1."
This reverts commit fe195c0c97.

Conflicts:
	epan/tvbuff.c

Change-Id: I1af618d0bd1e6211281b6d67c0ad197cfa513a0c
Reviewed-on: https://code.wireshark.org/review/1639
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-14 17:12:12 +00:00
AndersBroman a2a17cd6ab Fold alloc_field_info() into proto_tree_add_pi().
Change-Id: Iba9c6133d686fdcf70645238f8bd312815d377b0
Reviewed-on: https://code.wireshark.org/review/1349
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25 13:32:35 +00:00
AndersBroman e2096682fe Consistently use the macro PROTO_REGISTRAR_GET_NTH in proto.c
Change-Id: Iecfdd9463bec7958e8ede764bf5e09f6c29ac895
Reviewed-on: https://code.wireshark.org/review/1326
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-24 16:09:49 +00:00
Alexis La Goutte 7a68dc5bfd Fix packet-ospf.c:1181:33: warning: code will never be executed [-Wunreachable-code] found by Clang with extra compiler flags
Change-Id: I6a923d85cb5cc947a7e96c1845bde72059d92118
Reviewed-on: https://code.wireshark.org/review/1322
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-24 07:30:56 +00:00
Evan Huus fe195c0c97 Don't throw for offset at end of TVB with len -1.
g867a1827e7dc88896ee27a107eb35c4b3973d270 introduced a change to cleanup/fix
handling of bounds checks for -1 length fields, but it ended up guaranteeing a
throw for 0-length tvbs, which isn't good; we ought to be able to add 0-length
FT_PROTOCOL items at the very least.

Better names for the function than _cheat are welcome, but I want to shut up the
buildbot.

Change-Id: I24610f947d03dac32766e2a0ffa0ff7bcc74c3e8
Reviewed-on: https://code.wireshark.org/review/1303
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-23 15:57:13 +00:00
Jeff Morriss 867a1827e7 Fix up get_hfi_length():
Treat FT_BYTES and a few others the same as FT_PROTOCOL: allow a zero length
but throw an exception if the offset is already beyond the end of the TVB
(prior to this change it would assert out).  This (when manually applied to
master-1.10) fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9999 .

While we're at it: tvb_captured_length_remaining() no longer returns -1 (see
r52571) so don't expect it to.  Instead just use
tvb_ensure_captured_length_remaining() to throw an exception if the offset is
bad.

Change-Id: I686722a4fed46b86139466afcf64ff02f319c702
Reviewed-on: https://code.wireshark.org/review/1289
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-23 04:41:11 +00:00
Evan Huus 38b086152b Fix declaration of index shadows global
Change-Id: I14030ab86c5f3a3fe28b6102f7c0d84494b138e2
Reviewed-on: https://code.wireshark.org/review/1234
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-21 15:57:50 +00:00
Evan Huus d47ae54806 Replace linked list of proto fields with array
This is substantially more memory-efficient, shaving another ~1.5MB off our base
usage. It also lets us remove the annoying extra "last_field" pointer and
simplify proto_register_field_common(). It also accidentally fixed what may
have been a memory leak in proto_unregister_field().

It unfortunately complicates proto_get_next_protocol_field() to require
refetching the protocol each time, but that is itself just an array-lookup under
the covers (and isn't much used), so I don't expect the performance hit to be
noticable.

Change-Id: I8e1006b2326d6563fc3b710b827cc99b54440df1
Reviewed-on: https://code.wireshark.org/review/1225
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-21 15:37:06 +00:00
Evan Huus 5983cda769 Replace a GTree with a GHashTable
Shaves ~1.5MB off our base memory usage, and provides O(1) operations instead of
O(log n). We don't need the additional operations a tree provides.

Change-Id: I6159d09ee380a2bca0de3bb2d031a874d8eb79d2
Reviewed-on: https://code.wireshark.org/review/1224
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-21 15:07:23 +00:00
Jeff Morriss 6f0f6120e3 Apply the fix for bug 3290 to proto_tree_add_bytes*(): check the item length before trying to fake the item.
This fixes the case described in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9983

proto_tree_add_bytes_item() and FT_UINT_BYTES both still need work.

Change-Id: Ie421fed9e6dcecbc8b3eed1a57b3032d6ee043e8
Reviewed-on: https://code.wireshark.org/review/1219
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-21 14:43:36 +00:00
Guy Harris 97869f2dec More name changes.
Add ep_ to routines that may return ephemeral strings.

Change "get_XXX" to "XXX_to_display" if the routine returns a formatted
string if it can't get a name.

Change-Id: Ia0e82784349752cf4285bf82788316c9588fdd88
Reviewed-on: https://code.wireshark.org/review/1217
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19 19:30:17 +00:00
Hadriel Kaplan f52626cc83 Add tvb_get and proto_tree_add for string-encoded byte arrays
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for
getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form.

The proto_tree_add_bytes_item routine is also usable for normal
binary encoded byte arrays, and has the advantage of retrieving
the array values 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: I112a038653df6482a5d0ebe7c95708f207319e20
Reviewed-on: https://code.wireshark.org/review/1158
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-17 14:04:19 +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
Michal Labedzki 16d45a69ca Allow FT_BYTES, FT_NONE, FT_STRING use length "-1"
All three types support zero length, so using
-1 (aka length remaining) should be safe.

Change-Id: Ia616d652ce6884f8e12a5ac5782073403810b10b
Reviewed-on: https://code.wireshark.org/review/1072
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-14 06:23:25 +00:00
Pascal Quantin cfe11b1097 Add ENC_ASCII_7BITS encoding
Change-Id: I01ec87ff4181afb5b2de487fd5f5200f8d62f17d
Reviewed-on: https://code.wireshark.org/review/1088
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-13 20:02:52 +00:00
Guy Harris f55269e406 Use ftype_name() to get the name of an FT_ value.
That way we don't have to update the hf_types[] value_string if a new
type is added.

Change-Id: If4fd0a8ff2d6b54d0b70140be407dae9c4ab6b3b
Reviewed-on: https://code.wireshark.org/review/1083
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 22:39:46 +00:00
Guy Harris cb16dff992 Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it.  Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.

Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.

Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 22:27:22 +00:00
Guy Harris 7fb9e9beb0 Fix white space.
Change-Id: Ia36d439d1210f93be25a31d2a7288474688e0d9c
Reviewed-on: https://code.wireshark.org/review/1046
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-09 22:59:35 +00:00
Hadriel Kaplan 97cddf538c Fix proto.c to pass checkAPIs script
Since proto.c was using strcat(), changes to the file won't pass checkAPIs.
So this commit replaces it with the appropriate function, and also replaces
the deprecated tvb_length_remaining and tvb_ensure_length_remaining function
calls with the new versions, since checkAPIs was warning about that too.
This commit does not change the ep_* memorry calls to the new wmem-based
ones though, as that's a bigger deal than this trivial commit I think.

Change-Id: I51e6d5b3a6e03233f2695c890ff4c10d02fdb0c0
Reviewed-on: https://code.wireshark.org/review/905
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01 06:03:57 +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
Martin Kaiser ad76c350f7 replace label_mark_truncated_start() with a macros that calls
label_mark_truncated()

Change-Id: I7ede5f9776d26ebce2ccf427cf6ff5dec56814cd
Reviewed-on: https://code.wireshark.org/review/465
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-04 08:46:35 +00:00
Martin Kaiser f94674d2fb truncate UTF-8 strings only at the boundary between two characters
Change-Id: Ib3ffc1593e877f4f7c708712b82209cf969cecff
Reviewed-on: https://code.wireshark.org/review/464
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-03 22:05:17 +00:00
Guy Harris 61867d0b2f Eliminate fvalue_set() in favor of routines that take arguments
appropriate for particular FT_ types.  This lets us do some more type
checking and lets us use const pointers when appropriate.

Constify a bunch of stuff, and don't cast away constness.

svn path=/trunk/; revision=54811
2014-01-15 01:05:03 +00:00
Pascal Quantin 6ebc058f47 Add proto_tree_add_ts_23_038_7bits_item() / tvb_get_ts_23_038_7bits_string() functions and update dissectors to use it.
Remove gsm_sms_char_7bit_unpack() / gsm_sms_chars_to_utf8() functions.
Update documentation a bit.

svn path=/trunk/; revision=54534
2014-01-01 14:33:19 +00:00
Martin Kaiser fba61a31be add ssl detection to proto_get_frame_protocols()
svn path=/trunk/; revision=54439
2013-12-24 13:44:00 +00:00
Evan Huus a0321ddb9d Avoid one unnecessary use of ephemeral memory.
svn path=/trunk/; revision=54422
2013-12-23 21:19:06 +00:00
Bill Meier 68e0469733 Use G_GINT64_CONSTANT(nnn) instead of nnnul in a few places;
Add a few casts to time_t;
Do a few whitespace tweaks (indentation, trailing, etc)

svn path=/trunk/; revision=54393
2013-12-23 17:20:07 +00:00
Michael Mann 7ec4582b4f Add FT_SYSTEM_ID type and convert the dissectors that use print_system_id with FT_BYTES to now use FT_SYSTEM_ID type.
svn path=/trunk/; revision=54383
2013-12-23 15:18:48 +00:00
Martin Kaiser 217f7109cb don't assert if an FT_BYTES entry is empty
svn path=/trunk/; revision=54290
2013-12-20 13:17:24 +00:00
Evan Huus 2ae8edccea Rename more to_str functions to have ep_ in the name if they return ephemeral
buffers. Remove two unused functions.

svn path=/trunk/; revision=54250
2013-12-19 16:28:39 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Jakub Zawadzki e49da695a1 Use ws_sign_ext64()
svn path=/trunk/; revision=54238
2013-12-18 22:25:18 +00:00
Jakub Zawadzki 0de43ce2dd Create sign extension routines in <wsutil/sign_ext.h>, use it in few places.
svn path=/trunk/; revision=54197
2013-12-17 21:36:33 +00:00
Michael Mann 79d336c664 Handle signed integers > 32 bits. Bug 8454 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8454)
svn path=/trunk/; revision=54183
2013-12-17 16:50:33 +00:00
Pascal Quantin a944c8ef7a Remove proto_tree_add_unicode_string()
svn path=/trunk/; revision=53869
2013-12-08 20:15:07 +00:00
Jakub Zawadzki 7ab18667e5 Drop proto_tree_add_unicode_string() from IP, IPv6, JSON dissectors.
Set .display to STR_UNICODE (instead of STR_ASCII).

svn path=/trunk/; revision=53827
2013-12-07 15:48:35 +00:00
Jakub Zawadzki ffb4e79de9 Add STR_ASCII, STR_UNICODE as possible displays for field_display_e
svn path=/trunk/; revision=53822
2013-12-07 11:50:43 +00:00
Jakub Zawadzki c67d38cf15 Rename base_display_* to field_display
This is preparation to support ->display for FT_STRING values.

svn path=/trunk/; revision=53820
2013-12-07 10:41:42 +00:00
Guy Harris 0cc1545d05 Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins.  Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.

In particular applications, only process the relevant plugin types.

Add a Makefile.common to the codecs directory.

svn path=/trunk/; revision=53710
2013-12-02 08:30:29 +00:00
Evan Huus df1aec4a6b Remove old (2009) and no-longer-necessary compatibility macro.
svn path=/trunk/; revision=53527
2013-11-23 22:03:48 +00:00
Gerald Combs b3a24c5cc4 Replace similar code with a common routine.
svn path=/trunk/; revision=53519
2013-11-23 01:06:30 +00:00
Jakub Zawadzki c0c26f8e2a 64-bits: reorder fields in struct _protocol to remove padding.
This patch decrease size of _protocol structure from 64B to 56B

svn path=/trunk/; revision=53328
2013-11-14 22:50:55 +00:00
Jakub Zawadzki 6f6d04e2f9 Move REPORT_DISSECTOR_BUG() body to proto_report_dissector_bug() function. Remove exceptions.h include from proto.h
svn path=/trunk/; revision=53231
2013-11-10 16:04:15 +00:00
Jakub Zawadzki 12d1509aa1 Move struct _ftype_t + callback typedefs + free macro to ftypes-int.h
svn path=/trunk/; revision=53223
2013-11-10 13:14:09 +00:00
Jakub Zawadzki 0b0bbf0965 Replace STRINGIFY with glib version.
svn path=/trunk/; revision=53193
2013-11-09 14:37:13 +00:00
Jakub Zawadzki 9aac55472c Put "private" to_str.c functions to to_str-int.h
svn path=/trunk/; revision=53187
2013-11-09 11:26:41 +00:00
Jakub Zawadzki 9297c9e780 Rename swar_count_bits() to ws_count_ones()
Try to make ws_count_ones() inline function.

svn path=/trunk/; revision=53178
2013-11-09 04:47:08 +00:00
Jakub Zawadzki e6944e68b9 Try to split ws_ctz() from hfinfo_bitshift().
svn path=/trunk/; revision=53176
2013-11-08 22:01:12 +00:00
Jakub Zawadzki ce6ca9a05d Add infrastructure for section-initializing protocol hfis (without array).
configure implementation later.

svn path=/trunk/; revision=53146
2013-11-07 20:14:18 +00:00
Evan Huus 8a0ef07000 Effectively remove the tree memory pool and port some of its behaviour to the
pinfo memory pool, they have exactly the same scope. Simplification and minor
performance win (one GHashTable we longer have to create/destroy on every
packet).

svn path=/trunk/; revision=53076
2013-11-04 14:12:59 +00:00
Anders Broman 39515def5f Increase PROTO_PRE_ALLOC_HF_FIELDS_MEM
svn path=/trunk/; revision=53009
2013-10-31 21:26:27 +00:00
Anders Broman 1e6927dbb3 Fix proto.c:4498: warning: 'compare_filter_name' defined but not used
svn path=/trunk/; revision=52975
2013-10-29 23:18:26 +00:00
Anders Broman c864a20398 Optimize proto_get_id_by_filter_name() by using the existing hastable for proto_filter_names.
svn path=/trunk/; revision=52972
2013-10-29 22:17:18 +00:00
Jeff Morriss de0fda9436 Revert r52905 and r52908: they're causing plenty of fuzz failures.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9323 is tracking the fix.

svn path=/trunk/; revision=52966
2013-10-29 21:18:22 +00:00
Jeff Morriss 9259176f87 As pointed by Evan: don't leak memory when the string pointer is NULL.
svn path=/trunk/; revision=52908
2013-10-27 22:40:55 +00:00