summaryrefslogtreecommitdiff
path: root/epan/proto.c
AgeCommit message (Collapse)AuthorFilesLines
2013-10-29Fix proto.c:4498: warning: 'compare_filter_name' defined but not usedAnders Broman1-9/+0
svn path=/trunk/; revision=52975
2013-10-29Optimize proto_get_id_by_filter_name() by using the existing hastable for ↵Anders Broman1-10/+7
proto_filter_names. svn path=/trunk/; revision=52972
2013-10-29Revert r52905 and r52908: they're causing plenty of fuzz failures.Jeff Morriss1-7/+7
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9323 is tracking the fix. svn path=/trunk/; revision=52966
2013-10-27As pointed by Evan: don't leak memory when the string pointer is NULL.Jeff Morriss1-1/+1
svn path=/trunk/; revision=52908
2013-10-27Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9323 :Jeff Morriss1-8/+8
Actually handle non-NULL-terminated FT_STRINGs properly. svn path=/trunk/; revision=52905
2013-10-22Optimization: in test_length there's no need to validate that the count valueEvan Huus1-20/+5
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-20Reintroduce back epan_dissect_reset(), proto_tree_reset()Jakub Zawadzki1-2/+33
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-20Remove allocation stem from PROTO_NODE_NEW() macro.Jakub Zawadzki1-6/+7
Tree root-node will be allocated using g_slice() svn path=/trunk/; revision=52704
2013-10-17Revert the optimization in r52578. As Jakub predicted, it caused at least oneEvan Huus1-8/+44
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-13So a while back Jeff added some code to check that the offset+length passed toEvan Huus1-44/+8
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-12Redo r52569 in a way that doesn't break the GUI. Add a mem_pool member toEvan Huus1-101/+50
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-12Revert r52569, it breaks the GUI since that sometimes has multiple trees activeEvan Huus1-3/+17
at once. svn path=/trunk/; revision=52572
2013-10-12Use wmem_free_all on the tree pool rather than freeing each node, label andEvan Huus1-17/+3
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-12Use a wmem block allocator to allocate field_infos, proto_nodes and item_labels.Evan Huus1-7/+13
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-09Prefix all "Wireshark application specific" display filters with a "_ws." to ↵Michael Mann1-3/+3
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-06Add support for RELATIVE-OID ASN.1 type. Bug 9192 ↵Michael Mann1-0/+27
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192) From Ed Beroset. svn path=/trunk/; revision=52393
2013-10-03Make expert items used in "low level" proto functions filterable (and ensure ↵Michael Mann1-28/+61
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-01Add a dissector assert to _set_bytes like the one in _set_oid, noticed whileEvan Huus1-0/+2
debugging https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9214 svn path=/trunk/; revision=52327
2013-09-23The pointer into proto_tree_add_oid can be NULL if the length is 0. ExposedEvan Huus1-1/+1
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-22More emem -> wmem conversion:Pascal Quantin1-4/+1
- 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-22emem -> wmem conversion:Pascal Quantin1-4/+7
- 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-21Add _g_ to the names of functions that allocate glib memory. This is a bit moreEvan Huus1-1/+1
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-17Fix proto_registrar_dump_protocols() bug introduced by theBill Meier1-5/+5
implementation of BASE_VAL64_STRING value_strings. Fixes 'tshark -G values' crash. svn path=/trunk/; revision=52121
2013-09-12The secs field of an nstime_t is a time_t, so cast to that.Guy Harris1-2/+2
svn path=/trunk/; revision=51981
2013-09-12Make proto.c compile on my system (linux, 32 bit)Jörg Mayer1-2/+2
[-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-12Add casts to fix mac buildbots.Evan Huus1-2/+2
svn path=/trunk/; revision=51975
2013-09-12From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9072Evan Huus1-0/+22
Add support for Time-of-Day timestamp format from z/OS. svn path=/trunk/; revision=51974
2013-09-08Couldn't quite figure out how to make the expert items in proto.c and the ↵Michael Mann1-2/+2
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-08-26From Jiri Engelthaler viaEvan Huus1-6/+19
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-22proto: simplify proto_tree_add_pi() remove out pointer to field_info *Jakub Zawadzki1-69/+44
field_info can be already get using PNODE_FINFO(return_value) svn path=/trunk/; revision=51479
2013-08-17Fix few concept of new api tree:Jakub Zawadzki1-8/+6
- (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-16Introduce new proto_tree API required for hf_ variables removal.Jakub Zawadzki1-15/+51
svn path=/trunk/; revision=51396
2013-08-06Try to fix compilation under MSVCJakub Zawadzki1-1/+1
__builtin_ctz() with bitmask == 0 is UB, so only do g_assert there. svn path=/trunk/; revision=51176
2013-08-06Replace hfinfo pointer to same_name_prev, with same_name_prev_id.Jakub Zawadzki1-10/+18
svn path=/trunk/; revision=51175
2013-08-06Remove hfinfo->bitshift member, add hfinfo_bitshift() to get it.Jakub Zawadzki1-36/+27
svn path=/trunk/; revision=51174
2013-08-06Optimize wrs_count_bitshift()Jakub Zawadzki1-5/+10
- Use __builtin_ctz for GCC/clang - Do multiply and lookup on other platforms svn path=/trunk/; revision=51173
2013-08-05Completely remove support for proto_item_set_expert_flags.Michael Mann1-24/+0
svn path=/trunk/; revision=51144
2013-07-30Optimize marking label as truncated in proto_tree_set_representation_*()Jakub Zawadzki1-22/+14
svn path=/trunk/; revision=51036
2013-07-29add a NULL check to report_type_length_mismatch()Martin Kaiser1-6/+8
this might be called via proto_tree_add_item() with tree==NULL which results in a crash svn path=/trunk/; revision=51020
2013-07-28Much simpler (and possibly faster) fix for the 64-bit value string label issue.Evan Huus1-24/+8
svn path=/trunk/; revision=50983
2013-07-28As caught by Stig: 64-bit value strings could print the field name twice.Evan Huus1-18/+25
Don't do that. svn path=/trunk/; revision=50982
2013-07-28Store protocol fields in single linked list, saves about 1 MB of memory.Jakub Zawadzki1-11/+12
svn path=/trunk/; revision=50967
2013-07-28Fix compile error that resulted from whitespace cleanup.Michael Mann1-1/+1
svn path=/trunk/; revision=50963
2013-07-28Make many items filterable for Vines dissectors.Michael Mann1-0/+35
Add support for FT_VINES type. svn path=/trunk/; revision=50962
2013-07-27make some variables staticJakub Zawadzki1-1/+2
svn path=/trunk/; revision=50952
2013-07-26Follow-up to r50935: add support for 64-bit value strings in more places thatEvan Huus1-0/+7
need it, I think this is all of them. svn path=/trunk/; revision=50941
2013-07-26Squelch MSVC warnings. It doesn't know that DISSECTOR_ASSERT_NOT_REACHED doesn'tEvan Huus1-0/+5
return. svn path=/trunk/; revision=50939
2013-07-26Add 64-bit value strings and the appropriate tooling (including yet anotherEvan Huus1-10/+67
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-25As pointed out in ↵Jeff Morriss1-0/+7
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-25Optimize proto_item_append_string()Jakub Zawadzki1-3/+6
- When old string empty just pass new one (like: frame.protocols) - if not, use ep_strconcat() svn path=/trunk/; revision=50890