aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ber.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-08bytes_to_ep_str -> bytes_to_strMichael Mann1-1/+1
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-26Fix some dissectors doing termio (fprintf(stderr,..), g_warning()).Bill Meier1-4/+2
- Use report_...failure() (in most cases). - Also: Do some misc fixes in certain disectors - re-arrange order of #includes - Fixup preferences help text Change-Id: I385f6f97257f365f53ce611df02f57f9257dc5f9 Reviewed-on: https://code.wireshark.org/review/6039 Petri-Dish: Bill Meier <wmeier@newsguy.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-22First batch of unincludes. Last attempt...Martin Mathieson1-4/+0
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9 Reviewed-on: https://code.wireshark.org/review/5997 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.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-12-03Support dissecting REAL (BER) data valuesMaarten Bezemer1-13/+38
Both exponent and 'integer N' values are limited: * max exponent is 3 octets/24-bits * max integer N is 8 octets/64-bit Tested with zero value/length, integers, doubles, positive and negative numbers all using the Basic Encoding Rules (BER) Change-Id: If92e1b3e209c42909b8cb76e6f50b8e6cd1da0da Reviewed-on: https://code.wireshark.org/review/5527 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>
2014-11-10Use correct offset and lenght for Choice EOC.AndersBroman1-1/+1
Change-Id: I8152e1a07768a3bc245bbafa7c24901ba26a2478 Reviewed-on: https://code.wireshark.org/review/5224 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-11-06Improve error message by including the (expected) class informationMaarten Bezemer1-12/+26
The code checks whether the tag AND class are matching with their expected values, but only the tag information is shown in the error message. When the class is not matching, the error message shows the given and expected tags which are the same, confusing the user what is wrong with it. Furthermore, the messages for SEQUENCE and SEQUENCE OF are made the same/similar. Change-Id: I6c1d0968c903105ec7f6e0648d589a4263a8ca18 Reviewed-on: https://code.wireshark.org/review/5162 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-11-06BER: Fix offset and length of EOC in Sequence loopAndersBroman1-1/+1
Change-Id: I4384339688c1dda5e011b7ff7772940fd61de8d1 Reviewed-on: https://code.wireshark.org/review/5164 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-11-02Eliminate proto_tree_add_text from several dissectors.Michael Mann1-25/+39
Change-Id: I6d3125f15d268edd47ef74dd655eb86cb25ee52d Reviewed-on: https://code.wireshark.org/review/5047 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>
2014-10-31BER: tvb_length... -> tvb_reported_length...AndersBroman1-59/+59
Change-Id: I4868223ab54046977dbe833e6d1a2078d8d2c6d9 Reviewed-on: https://code.wireshark.org/review/5019 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-10-13BER: Code cleanup in call functionsStig Bjørlykke1-25/+9
Change-Id: I0ba958485dffd3cc1e419fb27cf7f2bc492d05fe Reviewed-on: https://code.wireshark.org/review/4643 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-10-07ASN1: Added support for using #.REGISTER_NEWStig Bjørlykke1-15/+48
This will register BER PDU-dissectors as "new". Return number of bytes dissected from dissector_try_* functions. Return number of bytes dissected in DissectorTable:try() This will make it possible to get dissected length when using dissector_try_*() and dissected ASN.1 length in Lua when using DissectorTable:try() (as we already have for Dissector:call). Change-Id: Iee17a68dc214fa0fb50b25fc927026ad7c1cbce4 Reviewed-on: https://code.wireshark.org/review/4531 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-07Revert "ASN1: Added support for using #.REGISTER_NEW"Gerald Combs1-48/+15
This temporarily reverts commit acc09c2aa248d892ee6b894b43c79cb060131b11. Change-Id: I7a55c8c2da3f65e914b90648ee92c84efd57f1a0 Reviewed-on: https://code.wireshark.org/review/4525 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-07ASN1: Added support for using #.REGISTER_NEWStig Bjørlykke1-15/+48
This will register BER PDU-dissectors as "new". Return number of bytes dissected from dissector_try_* functions. Return number of bytes dissected in DissectorTable:try() This will make it possible to get dissected length when using dissector_try_*() and dissected ASN.1 length in Lua when using DissectorTable:try() (as we already have for Dissector:call). Change-Id: I8802a812bd484c1e8794c618b87e676003aea94a Reviewed-on: https://code.wireshark.org/review/4493 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
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-09-16Fix spelling: cant-->can't, wont-->won't, etcBill Meier1-6/+6
Change-Id: I4497f1b8b6eab0e576d9dd31b732965f9a6679c6 Reviewed-on: https://code.wireshark.org/review/4124 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-14Don't use the captured length as the packet length.Guy Harris1-50/+45
Add a routine ber_tvb_new_subset_length() used to construct tvbuffs for parts of the packet, and have it check the specified length against the *reported* length. NOTE: that routine should really take an item and an expert info value as arguments and, if the length is greater than the remaining packet length, add an expert info for that. Also, when counting items in a SEQUENCE-OF: keep track of whether we succeeded in counting them, and report an "unknown number of items" if we didn't; if the length of an item in the SEQUENCE-OF is so big we get an overflow, just bail out of the count loop and indicate that we didn't succeed in counting them - let the error be reported in the process of dissection. Change-Id: I32172737baaed35fc9a0e6c19a727a6ac71ddfb2 Reviewed-on: https://code.wireshark.org/review/4103 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-11Give more information about string encodings.Guy Harris1-13/+50
Fix some indentation while we're at it. Change-Id: I887af6e7507e1cd3c7e2b5bb5124d913aea01f9c Reviewed-on: https://code.wireshark.org/review/3552 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22convert to proto_tree_add_subtree[_format]Michael Mann1-8/+4
Change-Id: Ib60ca75b7da8cfa21cfe2999c9b9448a02c332df Reviewed-on: https://code.wireshark.org/review/2560 Tested-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-20Rename dissector_add_handle() to dissector_add_for_decode_as().Guy Harris1-1/+1
Hopefully that name makes it clear what the routiner's purpose is, and will encourage people to use it rather than using dissector_add_uint() with a bogus integer value. Change-Id: Ic5be456d0ad40b176aab01712ab7b13aed5de2a8 Reviewed-on: https://code.wireshark.org/review/2483 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-69/+69
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-69/+69
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18Fixup: tvb_get_string(z) -> tvb_get_string(z)_encDario Lombardo1-3/+3
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe Reviewed-on: https://code.wireshark.org/review/2376 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-17fix underflow in BER constrained bitstringsEvan Huus1-1/+1
this can happen and cause invalid memory accesses with incorrectly-large padding values Bug:10187 Change-Id: Ib9b2a2fa10766efb4d95d588f57354a56373c626 Reviewed-on: https://code.wireshark.org/review/2325 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-16Register BER dissector as new.Stig Bjørlykke1-5/+8
This makes it possible to dissect part of a package as ASN.1. Change-Id: I53dd6bc916fa0d2c932d77fef437c2094fdd29ed Reviewed-on: https://code.wireshark.org/review/2238 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-07tvb_new_subset -> tvb_new_subset_length when length parameters are equal.Michael Mann1-8/+8
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is. Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d Reviewed-on: https://code.wireshark.org/review/1999 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-05-06Tweak ber_choice flow control.Evan Huus1-2/+2
There appear to be a couple of bugs in the flow control of this function (which is very confusing), at least one of which is leading to a buffer overrun. See the bug comments for more details and guesses of what the correct thing to do is. Bug:9579 Change-Id: Ibd3077792c7689a715ea53e8bf8c7a561c67389f Reviewed-on: https://code.wireshark.org/review/1530 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-18Remove all old BER functions.Stig Bjørlykke1-1120/+0
This should complete the transition to the "New" type. Change-Id: I882b088206c6e6d0592159451c943caeaf5b90ec Reviewed-on: https://code.wireshark.org/review/1202 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-07Absolute and relative OIDs have different FT_ values.Guy Harris1-1/+5
This squelches some run-time dissector asserts. Change-Id: I0ce33c4eb6e9c3bd371e47363a981e9a7a0dc789 Reviewed-on: https://code.wireshark.org/review/997 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-07Handle string types with somewhat appropriate encodings.Guy Harris1-1/+81
For various string types defined in X.680, use the appropriate encoding, or ENC_ASCII|ENC_NA in some cases where we don't have an appropriate encoding yet. This most significantly fixes the handling of BMPString and UniversalString, which are supersets of ASCII (Unicode Basic Multilingual Plane and Unicode, respectively), but don't encode ASCII characters as single octets. It also fixes UTF8String to, well, properly recognize UTF-8. This also lets us get rid of the special handling of SyntaxBMPString in X.509sat (and, in fact, *requires* us to get rid of it, as, otherwise, the string value appears twice). Change-Id: I325c4e71a6110278eb23b86e0d986e6439cfc328 Reviewed-on: https://code.wireshark.org/review/994 Reviewed-by: Guy Harris <guy@alum.mit.edu>
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>
2014-02-03Fix all -fstrict-alias warnings found by gcc 4.1.2Gilbert Ramirez1-1/+1
The majority of the fixes are for calls to uat_new(). Instead of having each caller cast its private data to (void**), we use void* in the uat_new() API itself. Inside uat_new(), we cast the void* to void**. Some dissectors use val64_string arrays, so a VALS64() macro was added for those, to avoid using VALS(), which is useful only for value_string arrays. packet-mq.c was changed because dissect_nt_sid() requires a char**, not a guint**. All other callers of dissect_nt_sid() use char*'s (and take the address of it) for their local storage. So, this was changed to follow the other practices. A confusion between gint and absolute_time_display_e in packet-time.c was cleared up. The ugliest fix is the addition of ip6_guint8_to_str(), for exactly one caller. The caller uses one type of ip6 address byte array, while ip6_to_str() expects another. This new function is in place until the various address implementations can be consolidated. Add VALS64() to the developer documentation. Change-Id: If93ff5c6c8c7cc3c9510d7fb78fa9108e4552805 Reviewed-on: https://code.wireshark.org/review/48 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-01-27Add missing cast.Evan Huus1-1/+1
svn path=/trunk/; revision=54980
2014-01-27Do not handle BER bitstring as ASCII string, because this will failStig Bjørlykke1-1/+1
when the first bit is set. svn path=/trunk/; revision=54977
2013-12-21Add missing includesJakub Zawadzki1-0/+1
svn path=/trunk/; revision=54332
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-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
2013-12-10Get the "Decode As" dialog working, albeit with a few warts. It differsGerald Combs1-1/+1
from the GTK flavor in two major ways: - The "Decode As" and "User Specified Decodes" dialog have been unified. - You can modify the decode as behavior at any time, not just when you have a packet selected. Revert part of 53498 so that we can move items marked /*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/ from epan/decode_as.h to ui/decode_as_utils.h. Move "save" code from decode_as_dlg.c to decode_as_utils.c as well. In packet-dcerpc.c don't register a table named "ethertype". We might want to add checks for duplicate table names. To do: - Add support for ranges? - Either add support for DCERPC or make DCERPC use a regular dissector table. - Fix string selectors (i.e. BER). svn path=/trunk/; revision=53910
2013-11-20Mark parameter as unusedAnders Broman1-1/+1
packet-ber.c:391: warning: unused parameter 'table_name' svn path=/trunk/; revision=53447
2013-11-20Provide "Decode As" functionality through dissectors themselves instead of ↵Michael Mann1-0/+56
the GUI. Bug 9450 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9450) The basic idea behind this design is to have dissectors register with a "decode as list" with their name and dissector table. When "Decode As" dialog is launched, any "registered" dissector found in the packet will cause a tab to be created in the dialog. This patch includes just the dissector portion of the functionality (minus packet-dcerpc.[ch] because it has hooks to the current GUI) svn path=/trunk/; revision=53445
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-02Require dissector_try_string to pass a data parameter to its subdissectors. ↵Michael Mann1-3/+3
There weren't that many calls, so might as well modify the function than create a need for dissector_try_string_new. svn path=/trunk/; revision=53049
2013-10-31Add a data parameter to call_ber_oid_callback to be able to pass data to ↵Michael Mann1-5/+5
subdissectors found with dissector_try_string_new. The intention is to aid in the removal of pinfo->private_data use as well as static global variables in a dissector. For now, all calls to call_ber_oid_callback have the data parameter set to NULL. svn path=/trunk/; revision=52994
2013-10-23#if 0 numerous "unused const variables" (mostly value-string-arrays);Bill Meier1-0/+2
Also; fix a few "set but not used" warnings. svn path=/trunk/; revision=52780
2013-10-13whitespace fixes; mostly: remove trailing blanksBill Meier1-6/+6
svn path=/trunk/; revision=52591
2013-10-06From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192 :Pascal Quantin1-102/+27
Cleanup of relative and absolute OID decoding in packet-ber.c svn path=/trunk/; revision=52420
2013-10-06Add support for RELATIVE-OID ASN.1 type. Bug 9192 ↵Michael Mann1-9/+107
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192) From Ed Beroset. svn path=/trunk/; revision=52393
2013-09-30Convert some proto_tree_add_string_format calls to something more appropriate.Michael Mann1-98/+98
There seem to be several cases of proto_tree_add_string_format where a "string" value/filter doesn't really make sense because it's always empty, and is just being used as a "filterable subtree header (placeholder)". They appear to be more for "presense" than "value" and should probably be FT_NONE, although I'd almost argue for removing the filter in favor of proto_tree_add_text. svn path=/trunk/; revision=52296
2013-09-22emem -> wmem conversion:Pascal Quantin1-4/+4
- 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-20Indicate Sequence of 0 length.Anders Broman1-0/+3
svn path=/trunk/; revision=52155
2013-09-12Convert a few more dissectors to wmemPascal Quantin1-5/+7
svn path=/trunk/; revision=51991