aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-frame.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't allow multiple registrations of a protocol in dissector tables.Michael Mann2015-11-041-2/+2
| | | | | | | | | | | | The target here is the Decode As dialog where protocols have multiple registrations into a dissector table and that shows up as multiple entries in the Decode As dialog list with the same name so users are unsure which "dissector" they are choosing. The "default" behavior (done in this commit) is to not allow duplicates for a dissector table, whether its part of Decode As or not. It's just ENFORCED for Decode As. Bug: 3949 Change-Id: Ibe14fa61aaeca0881f9cc39b78799e314b5e8127 Reviewed-on: https://code.wireshark.org/review/11405 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
* Don't include "file.h" if you don't need it.Guy Harris2015-11-041-0/+1
| | | | | | | | | | | | | | | | It ends up dragging in libwireshark headers, which programs not linking with libwireshark shouldn't do. In particular, including <epan/address.h> causes some functions that refer to libwireshark functions to be defined if the compiler doesn't handle "static inline" the way GCC does, and you end up requiring libwireshark even though you shouldn't require it. Move plurality() to wsutil/str_util.h, so that non-libwireshark code can get it without include epan/packet.h. Fix includes as necessary. Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3 Reviewed-on: https://code.wireshark.org/review/11545 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Make incomplete dissectors bytes more visibleMichal Labedzki2015-10-171-3/+2
| | | | | | | | | | | | Skipped bytes is now visible in Bytes pane. Change-Id: I17f62caf183d9f871f969869363d9831d810f4d5 Reviewed-on: https://code.wireshark.org/review/11027 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
* Add preference for disabling 'packet size limited during capture' message in ↵Michael Mann2015-07-171-0/+5
| | | | | | | | | | | | Info column. Bug: 9827 Change-Id: I8fdba4827b164bd231981bfdd2e1bd0499f4f87c Reviewed-on: https://code.wireshark.org/review/9669 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>
* Pass the pseudo-header to wtap_encap dissectors via the "data" argument.Guy Harris2015-06-161-7/+11
| | | | | | | | | | | Have the "data" argument to dissectors registered in thw wtap_encap dissector table point to the pseudo-header for the packet. Use that argument in the Bluetooth dissector. Change-Id: I022bbfb796ef51d95df09fb952a149960170d631 Reviewed-on: https://code.wireshark.org/review/8951 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Duplicate the presence of the "ignored" field in order to remove ↵Michael Mann2015-05-261-2/+2
| | | | | | | | | | | proto_tree_add_text. Change-Id: I0906c28656a104210f6fd1f95c9cee7899308538 Reviewed-on: https://code.wireshark.org/review/8619 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>
* Reduce epan dependence on dissectors by having print module "cache" the ↵Michael Mann2015-03-201-5/+5
| | | | | | | | | | | protocol and field ids that it needs. Change-Id: I4ec48067e9ca2cbe88e1cf2e6c9dc1e382379221 Reviewed-on: https://code.wireshark.org/review/7767 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>
* Small improvement in incomplete dissectors check.Dario Lombardo2015-03-091-7/+9
| | | | | | | | | | | This avoids logging "frame" as incomplete dissector. Change-Id: Ifd32c4326fbe9e86d14c94e065b602ca45cb0a7e Reviewed-on: https://code.wireshark.org/review/7390 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: Anders Broman <a.broman58@gmail.com>
* Support for looking for incomplete dissectors.Dario Lombardo2015-02-121-0/+29
| | | | | | | | | 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>
* Remove pkt_comment member from packet_info structure.Michael Mann2015-01-021-14/+19
| | | | | | | | Change-Id: Ifd3d201a09944e3fc36188f891ea8a584886101d Reviewed-on: https://code.wireshark.org/review/5884 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
* Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier2014-12-211-5/+2
| | | | | | | | | | | | | | | | | | | 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>
* Remove annex_a_used from packet_info structure.Michael Mann2014-12-061-1/+0
| | | | | | Change-Id: I660caa8283aecff5060c6ed476f316bc5793373e Reviewed-on: https://code.wireshark.org/review/5643 Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
* Remove file_type_subtype member from packet_info.Michael Mann2014-11-161-6/+12
| | | | | | | | | | | Just pass the necessary data to the frame dissector. Change-Id: I1a4bab32f7b5e28f4e7707794d71b04dab388908 Reviewed-on: https://code.wireshark.org/review/5328 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>
* Adjust indentation to match editor modelines; Do other minor whitespace changes.Bill Meier2014-10-061-24/+24
| | | | | | Change-Id: Ic020b2c92db5d14a2be9dc4d35aef4514b8b0353 Reviewed-on: https://code.wireshark.org/review/4502 Reviewed-by: Bill Meier <wmeier@newsguy.com>
* Fix spelling: cant-->can't, wont-->won't, etcBill Meier2014-09-161-1/+1
| | | | | | Change-Id: I4497f1b8b6eab0e576d9dd31b732965f9a6679c6 Reviewed-on: https://code.wireshark.org/review/4124 Reviewed-by: Bill Meier <wmeier@newsguy.com>
* Fix ISO C does not allow extra ';' outside of a function [-Wpedantic]Alexis La Goutte2014-08-161-1/+1
| | | | | | Change-Id: I7c0be29b5e5a54e269fec928e6058395ada7e04b Reviewed-on: https://code.wireshark.org/review/3644 Reviewed-by: Evan Huus <eapache@gmail.com>
* Remove debugging info from protocol tree for frameGraham Bloice2014-07-011-16/+0
| | | | | | | | Change-Id: Id7f02087e536964bfa6d01a3646c20035a3ab6cb Reviewed-on: https://code.wireshark.org/review/2746 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
* Revert "Fixup: tvb_* -> tvb_captured"Michael Mann2014-06-191-1/+1
| | | | | | | | | | 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>
* Fixup: tvb_* -> tvb_capturedDario Lombardo2014-06-181-1/+1
| | | | | | Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
* Add support for dissecting non-packet records.Guy Harris2014-05-251-56/+92
| | | | | | | | | | | | Add a dissector table indexed by the file type, and, for the file-type-specific records, have the frame dissector skip the usual pseudo-header processing, as the pseudo-header has a file-type-specific record subtype in it, and call the dissector for that file type's records. Change-Id: Ibe97cf6340ffb0dabc08f355891bc346391b91f9 Reviewed-on: https://code.wireshark.org/review/1782 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Don't use -1 as length in frame dissector.Evan Huus2014-05-141-4/+4
| | | | | | | | | | | | | Additional belated followup to gfe195c0c9 per conversation on -dev about the use of -1 and when we should throw exceptions. See also g867a1827e7. Should (in theory) permit reverting gfe195c0c9. Bug:9999 Bug:10030 Change-Id: I56e5f4e5dc12fe82268243d0b113cfc9ff5fdd17 Reviewed-on: https://code.wireshark.org/review/1603 Reviewed-by: Anders Broman <a.broman58@gmail.com>
* Minor optimization to packet-frame.cEvan Huus2014-05-111-1/+1
| | | | | | | | | | | When printing the protocol list item (which happens for every packet when using tshark -T) the resulting string is almost guaranteed to be longer than the default 16 characters. By allocating a bigger buffer right away we avoid some potentially-expensive reallocs as the string grows. Change-Id: Iaa35840f66975f03d8f92bbea26979df48bbc887 Reviewed-on: https://code.wireshark.org/review/1601 Reviewed-by: Michael Mann <mmann78@netscape.net>
* (Benign) Don't use "address-of" operator on arg of VALS() (not that it makes ↵Bill Meier2014-03-071-2/+2
| | | | | | | | | any actual difference).. Change-Id: I0766d0f130648aaa5a58d9f4062fa24e898cbdc3 Reviewed-on: https://code.wireshark.org/review/545 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
* Remove all $Id$ from top of fileAlexis La Goutte2014-03-041-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>
* Add missing includesJakub Zawadzki2013-12-211-0/+2
| | | | svn path=/trunk/; revision=54332
* Add bytestring_to_str() which takes a wmem scope and is otherwise identical toEvan Huus2013-12-191-1/+1
| | | | | | | | | | bytestring_to_ep_str (now deprecated). Use the new one in a few obvious places. Also just print directly to the buffer when loading ethernet addresses for resolution. The straight-to-buffer bytes_to_hexstr seems useful, maybe it shouldn't be in a private header... svn path=/trunk/; revision=54270
* Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus2013-12-191-1/+1
| | | | | | | 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
* Fix [-Wmissing-prototypes]Jakub Zawadzki2013-12-151-0/+3
| | | | svn path=/trunk/; revision=54135
* Avoid including <epan/epan.h> in dissectors.Jakub Zawadzki2013-12-031-0/+1
| | | | svn path=/trunk/; revision=53774
* Create the ability to have packet scoped "proto" data. Bug 9470 ↵Michael Mann2013-11-231-1/+1
| | | | | | | | | | | | (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
* Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki2013-11-101-0/+1
| | | | svn path=/trunk/; revision=53230
* Replace pinfo->layer_names as a string with pinfo->layers as a wmem_list ofEvan Huus2013-11-051-8/+28
| | | | | | | | | | | | | protocol IDs. This is substantially more efficient, which means we can build it all the time rather than only if tree (in my benchmarks the extra time taken is not large enough to be statistically significant even over tens of thousands of packets). This fixes what was probably a bug in btobex that relied on layer_names for non-tree dissection. It also enables a much simpler fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9303 svn path=/trunk/; revision=53089
* Do not reset pinfo->curr_layer_num in packet-frame.cPascal Quantin2013-10-271-1/+0
| | | | | | | | Before this change, curr_layer_num could be off by 1 depending on whether we generated items for Frame protocol or not, leading to a failure to get the UDP heuristic dissector identified during first pass svn path=/trunk/; revision=52897
* Convert proto_tree_add_int64_format calls to ↵Michael Mann2013-09-301-2/+2
| | | | | | proto_tree_add_int64_format_value where appropriate. svn path=/trunk/; revision=52300
* expert_add_info_format_text -> expert_add_info_formatMichael Mann2013-09-091-2/+2
| | | | svn path=/trunk/; revision=51852
* Move a bunch of the crypt modules and pint.h into wsutil.Jeff Morriss2013-08-011-7/+9
| | | | | | | | This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
* Remove fdata->opt_comment, add pkt_comment to pinfoJakub Zawadzki2013-08-011-4/+4
| | | | | | | Original (read from file) comments can be accessed by pkthdr->opt_comment Keep user comments in seperated BST, add new method for epan session to get it. svn path=/trunk/; revision=51090
* Remove interface_id, pack_flags from frame_data structure.Jakub Zawadzki2013-07-301-23/+23
| | | | | | | This patch assumes that wtap_phdr interface_id, pack_flags both from initial read and seek read will contain same values. Please fix if it's not. svn path=/trunk/; revision=51041
* make some variables staticJakub Zawadzki2013-07-271-3/+3
| | | | svn path=/trunk/; revision=50952
* Abuse epan_t more: add callback to get interface name.Jakub Zawadzki2013-07-221-2/+8
| | | | svn path=/trunk/; revision=50794
* Replace relative timestamp with reference frame number. Saves 16B per frame.Jakub Zawadzki2013-07-211-1/+1
| | | | svn path=/trunk/; revision=50772
* Add helper function to epan_session which can be used to get absolute ↵Jakub Zawadzki2013-07-211-2/+2
| | | | | | | | | | | timestamp of given frame. Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number. This patch reduce size of frame_data by 8B (amd64) This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13) svn path=/trunk/; revision=50765
* expert_add_info + proto_tree_add_text = proto_tree_add_expert, where applicableMichael Mann2013-07-031-10/+2
| | | | svn path=/trunk/; revision=50337
* Batch of filterable expert infos.Michael Mann2013-05-261-5/+14
| | | | svn path=/trunk/; revision=49584
* Un-shadow a couple of variables.Gerald Combs2013-05-151-3/+3
| | | | svn path=/trunk/; revision=49317
* - Use the key for comparison of per_proto_data.Anders Broman2013-05-151-0/+16
| | | | | | - Show the number of per-packet-data entries and which protocol has made entries in the frame. svn path=/trunk/; revision=49313
* Add curr_layer_num which can be used to keep track of multiple occurances of ↵Anders Broman2013-04-231-0/+1
| | | | | | the same protocol in a frame. svn path=/trunk/; revision=48997
* From beroset:Anders Broman2013-03-191-1/+1
| | | | | | | remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48426
* Move show_exception() and show_reported_bounds_error() toGuy Harris2013-02-271-121/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | epan/show_exception.c, as it's used outside epan/dissectors/packet-frame.c. Update their callers to include <epan/show_exception.h> to get their declaration. Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if there's more stuff in the packet to dissect after the dissector call that threw the exception, doesn't mean you shouldn't go ahead and dissect that stuff. Use it in all those cases, including ones where BoundsError was inappropriately being caught (you want those passed up to the top level, so that the packet is reported as having been cut short in the capture process). Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that correspond to running past the end of the data for a tvbuff; use it rather than explicitly catching those exceptions individually, and rather than just catching all exceptions (the only place that DissectorError should be caught, for example, is at the top level, so dissector bugs show up in the protocol tree). Don't catch and then immediately rethrow exceptions without doing anything else; just let the exceptions go up to the final catcher. Use show_exception() to report non-fatal errors, rather than doing it yourself. If a dissector is called from Lua, catch all non-fatal errors and use show_exception() to report them rather than catching only ReportedBoundsError and adding a proto_malformed item. Don't catch exceptions when constructing a trailer tvbuff in packet-ieee8023.c - just construct it after the payload has been dissected, and let whatever exceptions that throws be handled at the top level. Avoid some TRY/CATCH/ENDTRY cases by using checks such as tvb_bytes_exist() before even looking in the tvbuff. svn path=/trunk/; revision=47924
* Fix a bunch of warnings.Guy Harris2012-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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