Commit Graph

804 Commits

Author SHA1 Message Date
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
Jeff Morriss 8e2f00bf3d Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9323 :
Actually handle non-NULL-terminated FT_STRINGs properly.

svn path=/trunk/; revision=52905
2013-10-27 21:56:58 +00:00
Evan Huus 5b9ec08eae Optimization: in test_length there's no need to validate that the count value
for FT_UINT_STRINGs and FT_UINT_BYTEs is still in the TVB. Any infinite loop
that adds a counted field ought to be extracting the length for its own offset
anyways, in which case it will overflow on the next iteration and won't actually
loop forever.

svn path=/trunk/; revision=52766
2013-10-22 16:02:13 +00:00
Jakub Zawadzki bad81b517f Reintroduce back epan_dissect_reset(), proto_tree_reset()
This time it makes more sense, cause for each dissection we need two wmem allocators.
Reseting wmem allocator is much faster than destroy & create.

svn path=/trunk/; revision=52706
2013-10-20 10:21:25 +00:00
Jakub Zawadzki 336befd903 Remove allocation stem from PROTO_NODE_NEW() macro.
Tree root-node will be allocated using g_slice()

svn path=/trunk/; revision=52704
2013-10-20 10:03:32 +00:00
Evan Huus cbe8af0a8b Revert the optimization in r52578. As Jakub predicted, it caused at least one
infinite loop to pop up. We're just going to have to eat the performance hit.
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9282)

svn path=/trunk/; revision=52660
2013-10-17 12:24:25 +00:00
Evan Huus efdbb598b8 So a while back Jeff added some code to check that the offset+length passed to
proto_tree_add_item was valid *before* we short-circuited based on a NULL tree.
This was good in that it removed a common source of really-long-loop bugs. It
was less good in that it cost us about 8% in speed when doing a tree-less
dissection, but we decided the tradeoff was worth it.

After Anders' recent mail to -dev about performance, I started thinking about
how to optimize this. It occurred to me that the vast majority of the logic
involved in the check was dealing with the length value - fetching the actual
length if it was a counted string, calculating the length if it was -1, adding
the length to the offset in a way that was free from overflows, etc.

All of this is (theoretically) unnecessary - simply checking the offset without
worrying about the length will still catch the very-long-loops, since it is the
offset that increases in each iteration, not the length.

All that to justify:
- implement tvb_ensure_offset_exists which throws an exception if the offset is
  not within the tvb
- use it instead of all the complicated other logic in the pre-short-circuit
  step of proto_tree_add_item and friends

This gives us back about 3/4 of the performance we lost in the original patch.
We're still ~2% slower than without any check, but this is the best I can think
of right now.

svn path=/trunk/; revision=52578
2013-10-13 04:54:14 +00:00
Evan Huus c2b2d204db Redo r52569 in a way that doesn't break the GUI. Add a mem_pool member to
tree_data and reference it directly when allocating/freeing tree items. This
lets us keep multiple around when we need them, and still lets us use
wmem_free_all for a major speedup. It also, coincidentally, lets us get rid of
the annoying fi_tmp hack that was needed before, since that element gets swept
up in the free_all with everything else.

Keep one pool cached to avoid creating/destroying a pool for each packet,
another minor performance win.

The various changes in approach seem to balance out pretty much exactly, this
still gives ~11% over pre-52569.

svn path=/trunk/; revision=52573
2013-10-12 21:01:17 +00:00
Evan Huus 2e1497b532 Revert r52569, it breaks the GUI since that sometimes has multiple trees active
at once.

svn path=/trunk/; revision=52572
2013-10-12 18:14:19 +00:00
Evan Huus 540e9c745d Use wmem_free_all on the tree pool rather than freeing each node, label and
field_info separately. We still have to walk the tree in order to free certain
fvalues, but that's not a big deal. Another ~11% speed-up running "tshark -nVr"
on a large capture.

svn path=/trunk/; revision=52569
2013-10-12 17:57:51 +00:00
Evan Huus d19a20746b Use a wmem block allocator to allocate field_infos, proto_nodes and item_labels.
Even without making use of free_all (which should be possible) this still
results in ~8% speedup running "tshark -nVr" on a large file in my tests.

svn path=/trunk/; revision=52568
2013-10-12 17:32:41 +00:00
Michael Mann 9ccefb0ecd Prefix all "Wireshark application specific" display filters with a "_ws." to distinguish them from dissector filters.
This was committed now to get it into the 1.11 release so users can start getting used to the changed filter names.

svn path=/trunk/; revision=52462
2013-10-09 12:56:19 +00:00
Michael Mann ee208c8dcc Add support for RELATIVE-OID ASN.1 type. Bug 9192 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192)
From Ed Beroset.

svn path=/trunk/; revision=52393
2013-10-06 02:31:10 +00:00
Michael Mann a891f3e70b Make expert items used in "low level" proto functions filterable (and ensure they are called even with a NULL tree). I don't really like the Type Length Mismatch "protocol", but it doesn't seem that much different than the exception "protocols".
svn path=/trunk/; revision=52341
2013-10-03 01:54:02 +00:00
Evan Huus ccbb52b436 Add a dissector assert to _set_bytes like the one in _set_oid, noticed while
debugging https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9214

svn path=/trunk/; revision=52327
2013-10-01 22:50:29 +00:00
Evan Huus f1ba7e1095 The pointer into proto_tree_add_oid can be NULL if the length is 0. Exposed
because wmem_alloc(pool, 0) returns NULL (like pretty much every other
malloc-style function) where ep_ or se_ alloc did not.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9175

svn path=/trunk/; revision=52187
2013-09-23 12:09:20 +00:00
Pascal Quantin 102c452bcb More emem -> wmem conversion:
- tvb_get_g_stringz()/tvb_get_ephemeral_stringz()/tvb_get_seasonal_stringz() -> tvb_get_stringz()
- tvb_get_g_stringz_enc()/tvb_get_ephemeral_stringz_enc() -> tvb_get_stringz_enc()
- tvb_get_ephemeral_unicode_stringz() -> tvb_get_unicode_stringz()
- tvb_bcd_dig_to_ep_str() -> tvb_bcd_dig_to_wmem_packet_str()
- update docs accordingly

svn path=/trunk/; revision=52180
2013-09-22 20:04:35 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Evan Huus 6df83e8078 Add _g_ to the names of functions that allocate glib memory. This is a bit more
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures
that take the appropriate wmem pool.

Majority of the conversion done with sed.

svn path=/trunk/; revision=52164
2013-09-21 17:04:41 +00:00
Bill Meier 3bb06ab6a5 Fix proto_registrar_dump_protocols() bug introduced by the
implementation of BASE_VAL64_STRING value_strings.

Fixes 'tshark -G values' crash.

svn path=/trunk/; revision=52121
2013-09-17 18:33:03 +00:00
Guy Harris aa8fbf09d2 The secs field of an nstime_t is a time_t, so cast to that.
svn path=/trunk/; revision=51981
2013-09-12 20:31:31 +00:00
Jörg Mayer 934cc4526d Make proto.c compile on my system (linux, 32 bit)
[-Werror,-Wshorten-64-to-32]
                                time_stamp.secs = (todsecs  / 1000000) - TOD_BASETIME;
                                                ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/jmayer/work/wireshark/svn/trunk/epan/proto.c:1613:44: error: implicit conversion
      loses integer precision: 'unsigned long long' to 'time_t' (aka 'long')
      [-Werror,-Wshorten-64-to-32]
                                time_stamp.secs = (todsecs  / 1000000) - TOD_BASETIME;
                                                ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

svn path=/trunk/; revision=51978
2013-09-12 20:07:48 +00:00
Evan Huus 3d5ed04f60 Add casts to fix mac buildbots.
svn path=/trunk/; revision=51975
2013-09-12 17:17:42 +00:00
Evan Huus f8693e35e0 From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9072
Add support for Time-of-Day timestamp format from z/OS.

svn path=/trunk/; revision=51974
2013-09-12 16:56:37 +00:00
Michael Mann 1b009df749 Couldn't quite figure out how to make the expert items in proto.c and the LUA API filterable (suggestions welcome!), but I wanted to start forcing dissectors to use the filterable expert API (nothing like compile errors to force change!). I created expert_add_info_format_internal (original expert_add_info_format) and used it as a placeholder for proto.c/LUA API until a solution is created. The "new" expert_add_info_format will be the "old" expert_add_info_format_text, and I'll slowly do the search/replace.
For those with dissectors outside the source tree, please see tools/convert_expert_add_info_format.pl for help with the conversion.  Please do not use expert_add_info_format_internal, as it's support time will be very short lived.

svn path=/trunk/; revision=51844
2013-09-08 19:32:10 +00:00
Evan Huus 304bbabbbe From Jiri Engelthaler via
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9055

Add support for bitmask set for signed integer types.

svn path=/trunk/; revision=51522
2013-08-26 16:23:55 +00:00
Jakub Zawadzki 850f80fdc1 proto: simplify proto_tree_add_pi() remove out pointer to field_info *
field_info can be already get using PNODE_FINFO(return_value)

svn path=/trunk/; revision=51479
2013-08-22 21:20:50 +00:00
Jakub Zawadzki 4e870dd240 Fix few concept of new api tree:
- (for now) keep ABI, restore prototype of old proto_tree_add_item, add new proto_tree_add_item_new
- add few helpers for boolean, time, string which will do ->id
- don't use HFI_INIT directly, use it by another macro (MSVC has very small limit for section name)

svn path=/trunk/; revision=51401
2013-08-17 07:16:12 +00:00
Jakub Zawadzki 9d79b3233a Introduce new proto_tree API required for hf_ variables removal.
svn path=/trunk/; revision=51396
2013-08-16 21:21:52 +00:00
Jakub Zawadzki 97bddef1a2 Try to fix compilation under MSVC
__builtin_ctz() with bitmask == 0 is UB, so only do g_assert there.

svn path=/trunk/; revision=51176
2013-08-06 21:06:56 +00:00
Jakub Zawadzki 9cfac1227d Replace hfinfo pointer to same_name_prev, with same_name_prev_id.
svn path=/trunk/; revision=51175
2013-08-06 20:53:47 +00:00
Jakub Zawadzki 72ea2f9c9c Remove hfinfo->bitshift member, add hfinfo_bitshift() to get it.
svn path=/trunk/; revision=51174
2013-08-06 20:10:59 +00:00
Jakub Zawadzki 93f56d8a77 Optimize wrs_count_bitshift()
- Use __builtin_ctz for GCC/clang
- Do multiply and lookup on other platforms

svn path=/trunk/; revision=51173
2013-08-06 19:53:54 +00:00
Michael Mann 81f3faf1e8 Completely remove support for proto_item_set_expert_flags.
svn path=/trunk/; revision=51144
2013-08-05 02:25:45 +00:00
Jakub Zawadzki 430bd9eacc Optimize marking label as truncated in proto_tree_set_representation_*()
svn path=/trunk/; revision=51036
2013-07-30 20:02:24 +00:00
Martin Kaiser 3b92f760ed add a NULL check to report_type_length_mismatch()
this might be called via proto_tree_add_item() with tree==NULL
which results in a crash

svn path=/trunk/; revision=51020
2013-07-29 21:10:13 +00:00
Evan Huus dbabc55955 Much simpler (and possibly faster) fix for the 64-bit value string label issue.
svn path=/trunk/; revision=50983
2013-07-28 20:05:04 +00:00
Evan Huus 4e5ac2989c As caught by Stig: 64-bit value strings could print the field name twice.
Don't do that.

svn path=/trunk/; revision=50982
2013-07-28 19:56:23 +00:00
Jakub Zawadzki 5b15390b3a Store protocol fields in single linked list, saves about 1 MB of memory.
svn path=/trunk/; revision=50967
2013-07-28 10:47:31 +00:00
Michael Mann f3dac73d38 Fix compile error that resulted from whitespace cleanup.
svn path=/trunk/; revision=50963
2013-07-28 00:11:30 +00:00
Michael Mann a87f47c02c Make many items filterable for Vines dissectors.
Add support for FT_VINES type.

svn path=/trunk/; revision=50962
2013-07-28 00:07:49 +00:00
Jakub Zawadzki 0d414ac0fd make some variables static
svn path=/trunk/; revision=50952
2013-07-27 20:57:58 +00:00
Evan Huus 5ede3bcde0 Follow-up to r50935: add support for 64-bit value strings in more places that
need it, I think this is all of them.

svn path=/trunk/; revision=50941
2013-07-26 23:51:00 +00:00
Evan Huus c0cac8611e Squelch MSVC warnings. It doesn't know that DISSECTOR_ASSERT_NOT_REACHED doesn't
return.

svn path=/trunk/; revision=50939
2013-07-26 22:52:34 +00:00
Evan Huus 6e3a30794e Add 64-bit value strings and the appropriate tooling (including yet another
overloaded use of the DISPLAY field). Thanks to Jakub for pointing out I'd done
this wrong the first time (months ago in r49357).

Fixes severity display for collectd protocol, originally filed at:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8472

svn path=/trunk/; revision=50935
2013-07-26 21:51:39 +00:00
Jeff Morriss d58c13c363 As pointed out in https://www.wireshark.org/lists/wireshark-dev/201307/msg00153.html :
The fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3290 needs
to allow for giving a length of -1 for FT_STRINGZ's.

This is another fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8960
(in addition to r50836).  There's no point in reverting that revision, though,
since there was no need to use a length of -1 in that case.

svn path=/trunk/; revision=50892
2013-07-25 18:37:18 +00:00
Jakub Zawadzki 696a79707b Optimize proto_item_append_string()
- When old string empty just pass new one (like: frame.protocols)
- if not, use ep_strconcat()

svn path=/trunk/; revision=50890
2013-07-25 17:19:17 +00:00
Guy Harris 8bd5a3649a Have get_uint_value() assume it's being passed an encoding value, which
isn't necessarily going to be zero if the item is big-endian.

The last argument to test_length() is an encoding, not a big-endian vs.
little-endian Boolean; name it appropriately.

This fixes bug 8953.

svn path=/trunk/; revision=50806
2013-07-22 23:11:07 +00:00
Jakub Zawadzki 547eabc949 Use label_fill also when boolean / bitfield.
svn path=/trunk/; revision=50682
2013-07-16 22:21:10 +00:00
Jakub Zawadzki 13e07be25f optimize: remove g_snprintf()'s from label_fill[_descr]
svn path=/trunk/; revision=50681
2013-07-16 22:09:29 +00:00
Alexis La Goutte 7c5b471584 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=50632
2013-07-15 18:06:29 +00:00
Jakub Zawadzki e26b65f0ec proto_custom_set() cleanup
- Merge _UINT / _INT into one case
- fix possible generation of wrong expression ("some_integer") for unknown value in BASE_NONE field 

svn path=/trunk/; revision=50548
2013-07-13 09:14:25 +00:00
Jeff Morriss b53ced1e6a get_hfi_and_length() hasn't returned the hfi since r50015: rename it
to get_hfi_length().

svn path=/trunk/; revision=50509
2013-07-11 15:03:43 +00:00
Jeff Morriss 160c35c8e9 For consistency:
s/hf_index/hfindex/g
s/hf_info/hfinfo/g

svn path=/trunk/; revision=50507
2013-07-11 14:58:11 +00:00
Jeff Morriss b6ee11e928 Fix the very long loop fuzz failure reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8923 :
Apply the fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3290
to proto_tree_add_bits_item().  That is, test that we have offset+length bytes
left in the TVB before trying to fake the item.

svn path=/trunk/; revision=50504
2013-07-11 14:46:30 +00:00
Jakub Zawadzki 87646b1126 Fixes for tmp_fld_check_value():
- FT_FRAMENUM can't have strings
- mask hfinfo->display to compare with valid BASE_ value

svn path=/trunk/; revision=50444
2013-07-08 05:59:07 +00:00
Jakub Zawadzki ed4622dc7f ups? first add + 1, then multiply.
svn path=/trunk/; revision=50438
2013-07-07 21:32:12 +00:00
Jakub Zawadzki d4f1a2c599 tree_is_expanded: make it bit array.
Right now we have about 36K of ett items, and tree_is_expanded takes: 144K of memory (36K*sizeof(gboolean))
By making tree_is_expanded bit array, it reduce size to 4.5K (36K/8)

svn path=/trunk/; revision=50434
2013-07-07 17:13:17 +00:00
Jakub Zawadzki 792f35a28c Make tree_is_expanded array static, add setter/getter function.
svn path=/trunk/; revision=50433
2013-07-07 16:33:49 +00:00