aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ndps.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-01ndps: convert GHashtable to wmem_map.Dario Lombardo1-28/+6
Change-Id: Id1f46ed533980e67bf18aa13fcc828bf1f5e7f6e Reviewed-on: https://code.wireshark.org/review/19898 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31format_text_wmem -> format_textMichael Mann1-1/+1
All cases of the "original" format_text have been handled to add the proper wmem allocator scope. Remove the "original" format_text and replace it with one that has a wmem allocator as a parameter. Change-Id: I278b93bcb4a17ff396413b75cd332f5fc2666719 Reviewed-on: https://code.wireshark.org/review/19884 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31Add format_text_wmem.Michael Mann1-1/+1
This allows for a wmem_allocator for users of format_text who want it (dissectors for wmem_packet_scope()). This lessens the role of current format_text functionality in hopes that it will eventually be replaced. Change-Id: I970557a65e32aa79634a3fcc654ab641b871178e Reviewed-on: https://code.wireshark.org/review/19855 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-29Register reassembly tablesMichael Mann1-10/+2
Register all reassembly tables with a central unit, allowing the central unit to have the callback that initializes and destroys the reassembly tables, rather than have dissectors do it individually. Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4 Reviewed-on: https://code.wireshark.org/review/19834 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-10-08Combine Decode As and port preferences for tcp.port dissector table.Michael Mann1-6/+1
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-20Create call_data_dissector() to call data dissector.Michael Mann1-4/+1
This saves many dissectors the need to find the data dissector and store a handle to it. There were also some that were finding it, but not using it. For others this was the only reason for their handoff function, so it could be eliminated. Change-Id: I5d3f951ee1daa3d30c060d21bd12bbc881a8027b Reviewed-on: https://code.wireshark.org/review/14530 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-07ndps: don't THROW() an exception from a dissectorMartin Kaiser1-21/+3
if we just return the offset, there's no need to check for overflows the caller continues dissection from the returned offset if the offset is invalid, the core routines will throw an exception if we call proto_item_set_end() with the calculated offset, we can do the range check using tvb_ensure_bytes_exist() Change-Id: I0e2a7b2a866596eda0d7ed4a948fbea8ed084845 Reviewed-on: https://code.wireshark.org/review/13792 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-01-25Move the proto data stuff out of frame_data.[ch].Guy Harris1-0/+1
It's not tied to the frame_data structure any more, so it belongs by itself. Clean up some #includes while we're at it; in particular, frame_data.h doesn't use anything related to tvbuffs, so don't have it gratuitiously include tvbuff.h. Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c Reviewed-on: https://code.wireshark.org/review/13518 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24Add the packet number to the packet_info structure, and use it.Guy Harris1-8/+8
That removes most of the uses of the frame number field in the frame_data structure. Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22 Reviewed-on: https://code.wireshark.org/review/13509 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-08Fix a lot of typos and misspellingsmoshekaplan1-4/+4
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3 Reviewed-on: https://code.wireshark.org/review/13069 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>
2015-12-09new_create_dissector_handle -> create_dissector_handle for dissector directory.Michael Mann1-2/+2
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now. Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f Reviewed-on: https://code.wireshark.org/review/12484 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03Call reassembly_table_destroy and move g_hash_table_destroyPeter Wu1-6/+9
This patch moves g_hash_table_destroy calls from the init routine to the cleanup routine. Besides that, the conditional check for the hash table has been removed, assuming that init is always paired with a cleanup call. If reassembly_table_init is found, a reassembly_table_destroy call is prepended to the cleanup function as well. Comments have been removed from the init function as well as these did not seem to have additional value ("destroy hash table" is clear from the context). The changes were automatically generated using https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=4d11f07180d9c115eb14bd860e9a47d82d3d1dcd Manually edited files (for assignment auditing): dvbci, ositp, sccp, tcp. Other files that needed special attention due to the use of register_postseq_cleanup_routine: - ipx: keep call, do not add another cleanup routine. - ncp: remove empty mncp_postseq_cleanup. mncp_hash_lookup is used even if a frame is visited before (see dissect_ncp_common), hence the hash table cannot be destroyed here. Do it in cleanup instead. - ndps: add cleanup routine to kill reassembly table, but do not destroy the hash table as it is already done in ndps_postseq_cleanup. Change-Id: I95a72b3df2978b2c13fefff6bd6821442193d0ed Reviewed-on: https://code.wireshark.org/review/9223 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-23Remove more deprecated tvb_length callsEvan Huus1-14/+14
Change-Id: Ie137e6f4e20fe26b1a4d9510e267896219c1c631 Reviewed-on: https://code.wireshark.org/review/9075 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-23Replace more deprecated tvb_length callsEvan Huus1-3/+3
The return values of new-style dissectors always use the captured length, so replace those automagically with sed. Change-Id: Ic43072ee4a80d433cd4264444583a0e670adc26a Reviewed-on: https://code.wireshark.org/review/9065 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-07NDPS: fix V535 warnings reported by PVS-StudioPascal Quantin1-12/+12
The variable 'ii' is being used for this loop and for the outer loop. Change-Id: I3e6e0e390a646fac62fd46ebf9dcdc56070f7609 Reviewed-on: https://code.wireshark.org/review/8820 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-04-22Convert proto_tree_add_boolean to ↵Michael Mann1-17/+9
proto_tree_add_bitmask_[value|value_with_flags|list] Part 2 of a few Change-Id: Ic1f1aafe2ed02dce95b15c03a91cbd68807a5cf4 Reviewed-on: https://code.wireshark.org/review/8165 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-27Lua: Expose tcp_dissect_pdus() to LuaHadriel Kaplan1-1/+1
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus() to make TCP-based dissection easier. Bug: 9851 Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3 Reviewed-on: https://code.wireshark.org/review/6778 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-12-23Deleting unnecessary #includes from dissectors.Martin Mathieson1-1/+0
Fourth batch (packet-mac-lte.c -> packet-rtp.c). Will look at cleaning up and committing script afterwards. Change-Id: Id921f07f4b274f0cfb77ce81abe4a285fdb8b644 Reviewed-on: https://code.wireshark.org/review/6023 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-23NDPS: Missing break in switch (CID 281286)Alexis La Goutte1-0/+1
Change-Id: I2363370249d7beb2ed8a29987ac2cb602979d0a3 Reviewed-on: https://code.wireshark.org/review/5988 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-3/+0
Specifically: - Set packet.h to be the first wireshark #include after config.h and "system" #includes. packet.h added as an #include in some cases when missing. - Remove some #includes included (directly/indirectly) in packet.h. E.g., glib.h. (Done only for those files including packet.h). - As needed, move "system" #includes to be after config.h and before wireshark #includes. - Rework various #include file specifications for consistency. - Misc. Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95 Reviewed-on: https://code.wireshark.org/review/5923 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-19Remove unnecessary tvb_ensure_bytes_exist calls.Michael Mann1-24/+0
All of the calls removed are followed by proto_tree_add_xxx calls of the same offset/length of the tvb_ensure_bytes_exist call. The proto_tree_add_xxx calls should throw the exception, so we don't need the "double check". There are probably more calls that can be removed, these were just obvious as first glance, spurred mostly by noticing the (ab)use in packet-wsp.c Change-Id: I37cee347c8cf8ab0559e21562c802d3b37f4871e Reviewed-on: https://code.wireshark.org/review/4833 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>
2014-09-29Add editor modelines; fix indentation as needed.Bill Meier1-0/+13
Change-Id: I1ad94654343e5a018a0b3159481d45ffb3a91263 Reviewed-on: https://code.wireshark.org/review/4363 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-18Eliminate proto_tree_add_text from some dissectors.Michael Mann1-43/+33
Other minor cleanup while in the neighborhood. Change-Id: I77cac916d617f56f92f686e9cd9f15fba058facf Reviewed-on: https://code.wireshark.org/review/3675 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-02NDPS dissector is the poster child for proto_tree_add_subtree[_format].Michael Mann1-831/+558
NDPS dissector is also the poster child for not being considered "that naughty" by checkAPIs because most of its proto_tree_add_text calls don't have printf-style arguments (which is what checkAPIs really keys off of) Fixed both cases and removed about 370 proto_tree_add_text calls from the dissector. Change-Id: I721678c39d4a0544e5e7212e622c0c2eebfd04f7 Reviewed-on: https://code.wireshark.org/review/2775 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-18/+18
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html This reverts commit 246fe2ca4c67d8c98caa84e2f57694f6322e2f96. Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f Reviewed-on: https://code.wireshark.org/review/2430 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-18/+18
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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>
2013-12-19Use proto_tree_add_item() or tvb_get_string_enc() instead ofGuy Harris1-2/+2
tvb_get_unicode_string(). If there's an indication that the encoding is UCS-2, use that, otherwise use UTF-16. (For example, "BMP" stands for "Basic Multilingual Plane", which is the part of Unicode that can be encoded in 16 bits, hence UCS-2.) In the description of the "Use Heuristics for UDP" preference for the XML dissector, note that it's not just trying to recognize XML in UCS-2, it's trying to recognize XML in *big-endian* UCS-2. svn path=/trunk/; revision=54245
2013-12-14Fix [-Wmissing-prototypes]Jakub Zawadzki1-0/+3
svn path=/trunk/; revision=54095
2013-12-10Reject the packet if data is NULL.Chris Maynard1-0/+4
svn path=/trunk/; revision=53914
2013-11-24Create/use a fair number of extended value_strings;Bill Meier1-734/+765
Add an XXX comment noting that the 'ndps_error_types' array has a number of duplicate values; Also note the commenting out of those dups which would not have been found via a linear search in the original unsorted array. svn path=/trunk/; revision=53558
2013-11-23Create the ability to have packet scoped "proto" data. Bug 9470 ↵Michael Mann1-4/+4
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470) I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future. And search/replace of a function name is easy enough to do. The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As. All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope(). All other dissectors were converted to using file_scope() which was the original scope for "proto" data. svn path=/trunk/; revision=53520
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+2
svn path=/trunk/; revision=53230
2013-11-09Add data parameter to tcp_dissect_pdus() as well as convert it to using ↵Michael Mann1-11/+12
"new" style dissectors. Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that? Should tcp_dissect_pdus return length (bytes consumed)? There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb). Seems like that could all be rolled into one. svn path=/trunk/; revision=53198
2013-10-23#if 0 numerous "unused const variables" (mostly value-string-arrays);Bill Meier1-0/+4
Also; fix a few "set but not used" warnings. svn path=/trunk/; revision=52780
2013-10-19Pass SPX "private data" into subdissectors instead of using pinfo->private_data.Michael Mann1-13/+10
svn path=/trunk/; revision=52698
2013-09-22emem -> wmem conversion:Pascal Quantin1-2/+2
- 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-15emem -> wmemPascal Quantin1-4/+4
svn path=/trunk/; revision=52063
2013-09-09expert_add_info_format_text -> expert_add_info_formatMichael Mann1-4/+4
svn path=/trunk/; revision=51852
2013-07-17Remove fragment_data, add fragment_head, fragment_item - for now alias it to ↵Jakub Zawadzki1-1/+1
the same structure. This is begin of work to split fragment head and fragments items. svn path=/trunk/; revision=50708
2013-07-14Rewrite reassemble API to use TVBs instead of raw data.Jakub Zawadzki1-2/+1
(it seems to be working for TCP ^^) svn path=/trunk/; revision=50580
2013-06-14Removed check_col() and the occasional tree.Michael Mann1-24/+16
svn path=/trunk/; revision=49938
2013-05-27Batch of filterable expert infosMichael Mann1-4/+18
svn path=/trunk/; revision=49596
2013-05-12Add the posibillity to use a key for per-packet-data.Anders Broman1-4/+4
svn path=/trunk/; revision=49259
2013-03-29Rename value string (and similar) functions to use a consistent pattern. ThisEvan Huus1-20/+20
was done using textual search+replace, not anything syntax-aware, so presumably it got most comments as well (except where there were typos). Use a consistent coding style, and make proper use of the WS_DLL_* defines. Group the functions appropriately in the header. I ended up getting rid of most of the explanatory comments since many of them duplicated what was in the value_string.c file (and were out of sync with the recent updates I made to those in r48633). Presumably most of the comments should be in the .h file not the .c file, but there's enough churn ahead that it's not worth fixing yet. Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467 svn path=/trunk/; revision=48634
2013-03-22Don't wire into the reassembly code the notion that reassemblies shouldGuy Harris1-6/+5
be done on flows from one address to another; reassembly for protocols running atop TCP should be done on flows from one TCP endpoint to another. We do this by: adding "reassembly table" as a data structure; associating hash tables for both in-progress reassemblies and completed reassemblies with that data structure (currently, not all reassemblies use the latter; they might keep completed reassemblies in the first table); having functions to create and destroy keys in that table; offering standard routines for doing address-based and address-and-port-based flow processing, so that dissectors not needing their own specialized flow processing can just use them. This fixes some mis-reassemblies of NIS YPSERV YPALL responses (where the second YPALL response is processed as if it were a continuation of a previous response between different endpoints, even though said response is already reassembled), and also allows the DCE RPC-specific stuff to be moved out of epan/reassembly.c into the DCE RPC dissector. svn path=/trunk/; revision=48491
2013-03-19From beroset:Anders Broman1-6/+6
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48425
2013-01-31Use '#if 0 ... #endif' rather than /** ... **/ to comment outBill Meier1-20/+20
unused hf[] entries (which I should have done in the first place). svn path=/trunk/; revision=47390
2013-01-26Comment out cases of unused hf array entries found by checkhf.Bill Meier1-10/+30
svn path=/trunk/; revision=47302
2012-12-26Fix a bunch of warnings.Guy Harris1-1/+0
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748