aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl
AgeCommit message (Collapse)Author
2017-05-04Update copyright yearRaimo Niskanen
2017-03-15Remove default clauses that cause exceptions for internal errorsBjörn Gustavsson
Just crash if there is an internal error.
2017-03-14Clean up commentsBjörn Gustavsson
* Remove out-commented code * Fix obvious typos and bad grammar * Adhere to the conventions for when to use "%" and "%%".
2017-03-14Clean up use of asn1ct_gen:emit/1Björn Gustavsson
Stop up using asn1ct_gen:emit/1 with a tuple instead of a list. Also remove the remaining uses of asn1ct_gen:demit/1.
2017-03-14Remove the 'debug' optionBjörn Gustavsson
The debug option no longer serves any useful purpose.
2017-02-06Teach the ASN.1 compiler the 'maps' optionBjörn Gustavsson
When the 'maps' option is given, the SEQUENCE and SET types are represented as maps instead of as records. Optional and default values must be not be given as asn1_NOVALUE or asn1_DEFAULT in a map passed to the M:encode/2 function; they must be omitted from the map. Similarly, when decoding missing values will be omitted from the map. No .hrl files will be generated when the 'maps' options is used. That means values in an ASN.1 module must be retrieved by calling the appropriate function in generated module. Since we one day hope to get rid of the options 'compact_bit_string', 'legacy_bit_string', and 'legacy_erlang_types', we will not allow them to be combined with the 'maps' option.
2017-02-03Refactor code generation optionsBjörn Gustavsson
Most options to the code generation pass are passed through the process dictionary. At the same time, an Erule or Erules argument is passed to most code generation functions. The Erule argument is only an atom indicating the encoding rules ('ber', 'per', or 'uper'). Introduce a new record #gen{} to contain code generation options and parameters. Pass it as the Erule argument (renaming it to Gen in functions that we will have to touch anyway). In this commit, eliminate the use of the variable 'encoding_options' in the process dictionary.
2016-05-12Eliminate dialyzer warnings for unmatched returnsBjörn Gustavsson
Dialyzer complains that three calls to gen_dec_line/7 ignore the return value. It turns out that when the last argument to gen_dec_line/7 is 'false', the return value will always be {[],[]}. Introduce gen_dec_line/6 as helper to make it clear that we don't ignore a useful return value.
2016-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2015-01-12Fix BER code generationDan Gudmundsson
PKIX1Explicit-2009 did not compile.
2014-06-05Rewrite the code for testing DEFAULT for DERBjörn Gustavsson
The old code for testing DEFAULT values is messy, inefficient, and causes dialyzer warnings.
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.
2013-10-01Fix broken handling of default values for BIT STRINGsBjörn Gustavsson
For DER/PER/UPER, a value equal to the DEFAULT is not supposed to be encoded. BIT STRINGs values can be represented as Erlang terms in four different ways: as an integer, as a list of zeroes and ones, as a {Unused,Binary} tuple, or as an Erlang bitstring. When encoding a BIT STRING, only certain representations of BIT STRINGs values were recognized. All representations must be recognized. When decoding a DEFAULT value for a BIT STRING, the actual value given in the decoding would be either an integer or a list of zeroes and one (depending on how the literal was written in the specification). We expect that the default value should be in the same representation as any other BIT STRING value (i.e. by default an Erlang bitstring, or a list if the 'legacy_bitstring' option has been given, or as compact bitstring if 'compact_bitstring' has been given).
2013-08-30BER: Handle multiple optional SEQUENCE fields with table constraintsBjö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-28Remove code for handling an object/object set reference in SEQUENCEBjörn Gustavsson
An field in a class that references an object or object set is not allowed to be referenced directly from within a SEQUENCE.
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-31Normalize data representation for table constraintsBjörn Gustavsson
The name of the referenced object set name in #simpletableattributes{} would when used by INSTANCE OF be an atom, but in all other cases be a {Module,ObjectSetName} tuple. Simplify the code by always using the latter format.
2013-05-31Eliminate the {notype,_} return value from asn1ct_gen:type/1Björn Gustavsson
The last clause in asn1ct_gen:type/1 does a catched call to type2/1. If the type2/1 fails {notype,X} is returned. Since the body of type2/1 essentially is: case lists:member(X, [...]) of true -> {primitive,bif}; false -> case lists:member(X, [...]) of true -> {constructed,bif}; false -> {undefined,user} end end there is no way that type2/1 can fail. Therefore, we can eliminate the catch and put the body of type2/1 into the last clause of type/1. We can also eliminate the code in the callers of type/1 that match {notype,X}.
2013-05-31Use the record definition for #ExternaltypereferenceBjö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-31Don't call asn1ct_name:clear/0 directly after asn1ct_name:start/0Björn Gustavsson
Ensure that asn1ct_name:start/0 will call asn1ct_name:clear/0 if the name server process is already running so that we can be sure that the variables are cleared.
2013-02-15BER: Fix broken table constraints inside a SET OF/SEQUENCE OFBjörn Gustavsson
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-22Add and use asn1rtt_extBjörn Gustavsson
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-11-23Remove the unused asn1ct_constructed_ber moduleBjörn Gustavsson
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.
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-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.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP