aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl
AgeCommit message (Collapse)Author
2015-06-18Change license text to APLv2Bruce Yinhe
2015-01-12BER: Fix ENUMERATED with negative valuesBjörn Gustavsson
The ASN.1 compiler would go into an infinite loop if a value in an ENUMERATED was negative.
2015-01-12Clean up error reporting for duplicate tagsDan Gudmundsson
Split the test case duplicate_tags/1 into two parts. Do the error checking test in error_SUITE. Keep the SeqOptional2 specification and compile it from the per/1 and ber_other/1 test cases (for coverage).
2015-01-12asn1: Fix BER generation for non optional and extended object setsDan Gudmundsson
Object sets with extension mark and without optional fields was not generated properly. It needs the default [enc|dec]_xxx function clause for the open type but no other clauses.
2014-06-05BER: Eliminate dialyzer warnings for specialized decode functionsBjörn Gustavsson
2014-06-05BER: Eliminate dialyzer warning for encoding of BIT STRINGsBjörn Gustavsson
2014-06-05BER: Optimize encoding of ENUMERATEDBjörn Gustavsson
This will also eliminate a dialyzer warning.
2014-05-06BER: Optimize decoding of ENUMERATEDBjörn Gustavsson
2014-05-06BER: Suppress dialyzer warnings for encode_bit_string/4Björn Gustavsson
We don't want to touch the code used for encoding BIT STRINGs when 'legacy_erl_types' is active, since it will be removed within two or three major releases. But we do want to suppress the dialyzer warnings in the meantime. The easiest way is to call encode_bit_string/4 with unknown types from an exported function that is never actually called like this: -export(['dialyzer-suppressions'/0]). 'dialyzer-suppressions'(Arg) -> {A,B,C,D} = Arg, encode_bit_string(A, B, C, D), ok.
2014-04-29BER: Inline testing of constraints when decodingBjörn Gustavsson
Calling library routines for validation of constraints may cause dialyzer warnings if some type of constraints handled by the library routine are not used in a specific ASN.1 module. To avoid those warnings (and slightly speed up the decoding), inline the constraint checking.
2014-04-16Refactor gen_dec_prim/3 to facilitate future optimizationsBjörn Gustavsson
2014-04-16Remove unused arguments for asn1ct_gen_ber_bin_v2:gen_dec_prim()Björn Gustavsson
Make the source code a little bit cleaner.
2014-01-24Fix open typesBjörn Gustavsson
2014-01-24Fix OCTET STRINGBjörn Gustavsson
2014-01-24Fix BIT STRINGBjörn Gustavsson
2013-08-30Clean up checking of objectsBjörn Gustavsson
2013-08-30Remove broken support for multiple UNIQUEBjörn Gustavsson
According to the ASN.1 standard, having multiple UNIQUE in class is allowed. For example: C ::= CLASS { &id1 INTEGER UNIQUE, &id2 INTEGER UNIQUE } In practice, no one uses multiple UNIQUE. The ASN.1 compiler will crash if a class with multiple UNIQUE is used, but the backends have half-hearted support for multiple UNIQUE in that they generate helper functions similar to: getenc_OBJECT_SET(id1, 42) -> fun enc_XXX/3; ... Since we have no plans to implement support for multiple UNIQUE (no one seems to have missed it), simplify the helper functions like this: getenc_OBJECT_SET(42) -> fun enc_XXX/3; ...
2013-08-30Refactor encoding of REALBjörn Gustavsson
To facilitate optimizing PER encoding using an intermediate format, we must change asn1rtt_real_common:encode_real/1 so that it only returns the encoded binary.
2013-05-31asn1ct_check: Don't pass on #'ObjectClassFieldType'{} with fixed typeBjörn Gustavsson
Simplify the backends by letting asn1ct_check replacing a with the actual type.
2013-05-31BER: Fix handling of a constructed default value for a classBjörn Gustavsson
2013-05-31Eliminate handling of #pobjectdef{} from the backendsBjörn Gustavsson
asn1ct_check does not pass #pobjectdef{} records on to the backends (all the original #pobjectdef{} records have been instantiated and changed to #objectdef{} records).
2013-05-31Eliminate clauses that can never matchBjörn Gustavsson
Dialyzer issued two new warnings when the 'catch' was removed in the previous commit.
2013-05-31BER: Don't generate functions that are never usedBjörn Gustavsson
2013-05-31BER: Remove special case handling of certain string typesBjörn Gustavsson
ObjectDescriptor, UTCTime, and GeneralizedTime are not special and can be handled in the same way as all other restricted string types.
2013-05-31BER: Optimize handling of constraints for INTEGERsBjörn Gustavsson
This slight optimization will also eliminate some Dialyzer warnings.
2013-05-31Get rid of 'ANY' in the backendsBjörn Gustavsson
asn1ct_check has translated all occurrences of 'ANY' to 'ASN1_OPEN_TYPE'.
2013-05-31Normalize SIZE constraints to simplify backendsBjörn Gustavsson
2013-05-31Eliminate general use of #typereference{}Björn Gustavsson
The record #typereference{} is only used internally within the asn1ct_parser2 module (the parser translates it to an #'Externaltypereference{} record).
2013-05-31Eliminate duplicated code in gen_inlined_{dec,enc}_funs()Björn Gustavsson
2013-05-31Remove unused function pgen/4 in all backendsBjörn Gustavsson
2013-05-31Remove unnecessary code duplication in gen_objset_{dec,enc}()Björn Gustavsson
2013-05-31asn1ct_name: Remove unused functionsBjörn Gustavsson
asn1ct_name:delete/1 is used from asn1ct_gen_ber_bin_v2:add_removed_bytes/1, but that function is not used.
2013-02-16Eliminate use of obsolete size/1 in generated codeBjörn Gustavsson
It is recommended to use byte_size/1 or tuple_size/1 instead of size/1.
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-23By default, encode BIT STRING to bitstringsBjörn Gustavsson
Add the option 'legacy_bit_string' to decode to the old list format.
2013-01-22BER run-time: Refactor decoding of string data typesBjörn Gustavsson
In the BER run-time code (asn1rtt_ber), there is a general function for decoding a string: decode_restricted_string(Tlv, Range, StringType, TagsIn) But the StringType argument is not important. It is only used internally in asn1rtt_ber to distinguish universal strings and BMP strings from other strings. By slightly refactoring the string decoding code, we can eliminate the StringType argument and a subsequent run-time test on the string type. That will slightly reduce code size, slightly increase speed, and eliminate Dialyzer warnings.
2013-01-22Refactor decoding of BIT STRINGsBjörn Gustavsson
Refactor decoding of BIT STRINGs so that the run-time code does not spend testing conditions that are known already at compile-time (which wastes time and produces unnecessary Dialyzer warnings). There are three ways to decode BIT STRINGs: 1) To a list of bit names (and {bit,Position} for unnamed positions) if the BIT STRING type has any bit names. 2a) To a list of ones and zeros if there are no named bits, and the compact_bit_string option was NOT given. 2b) To a {Unused,Bin} tuple if there are no named bits compact_bit_string option WAS given. Structure the decoding functions in the same way.
2013-01-22Add run-time library templates and use themBjörn Gustavsson
The template modules (asn1rtt_*.erl) are based on the existing run-time modules, but with some simplifications and improvements, for example: The run-time functions for BER encoding took a Constraint argument which was not used. It has been eliminated, along with the unused StringType argument for the encode_restricted_string function. The Range argument for decode_enumerated() has been dropped since it was not used.
2012-12-19Remove support for the {Typename,Value} notation in encodingBjörn Gustavsson
Support for the notation was removed in 6ef8cbdaaaa1c30a7dc462063.
2012-11-23Remove obsolete back-ends and simplify the optionsBjörn Gustavsson
It is time to clean up the mess of back-ends. Remove all the obsolete back-ends and simplify the options used to select them. New Option Old Equivalent ---------- -------------- ber ber_bin,optimize,nif per per,optimize,nif uper uper_bin The old options will still be recognized and translated to the new options, but will also print a warning. That implies that deprecated features that only are implemented in the old 'ber' back-end will no longer work (e.g. the {Typename,Value} notation). Also make the return type for the generated encode/2 function consistent. It used to be a binary for per and uper, and an iolist for ber. Always make it a binary.
2012-11-22Remove the obsolete and deprecated 'keyed_list' optionBjörn Gustavsson
The 'keyed_list' was only supported for the 'ber' and 'ber_bin' backends and has been undocumented for a long time. Also remove the note in the documentation about the feature.
2012-05-17Fix typo error in selected decode functionArtem Teslenko
2012-02-28[asn1] Abstract out table access to new moduleAdam Lindberg
All table access is now performed in a separate module. This will allow changes to how ETS is handled by changing only this module. Note that the module exports a very ETS-like interface for now which would have to be maintained even if the data format would change (to a hash map for example).
2011-12-09Update copyright yearsBjörn-Egil Dahlberg
2011-08-01Update code genaration to call nif/erlang depending on what is configuredLukas Larsson
2011-08-01Update decode_open_type to use nifs if configured to do soLukas Larsson
2010-09-10Merge branch 'kenneth/asn1/nested_extaddgroup/OTP-8797' into devKenneth Lundin
* kenneth/asn1/nested_extaddgroup/OTP-8797: Add support for ExtensionAdditionGroup notation in nested types as well Conflicts: lib/asn1/test/test_undecoded_rest.erl
2010-09-07Add support for ExtensionAdditionGroup notation in nested types as wellKenneth Lundin
In the previous version support for ExtensionAdditionGroups (i.e [[...]]) was added but it did not handle the occurence of the notation in nested types. Now this is handled as well and the support is hopefully complete. Also cleanup of warnings for obsolete guard functions in test suites.
2010-04-09Merge branch 'ta/asn1-verbose' into devErlang/OTP
* ta/asn1-verbose: Add test for verbose option to asn1_SUITE Teach asn1ct verbose option OTP-8565 ta/asn1-verbose By default, the ASN.1 compiler is now silent in the absence of warnings or errors. The new 'verbose' option or the '-v' option for erlc can be given to show extra information (for instance, about the files that are generated). (Thanks to Tuncer Ayaz.)
2010-04-08Teach asn1ct verbose optionTuncer Ayaz
Change asn1ct to print verbose information only when asked to. Signed-off-by: Tuncer Ayaz <[email protected]>