aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1_records.hrl
AgeCommit message (Collapse)Author
2017-05-04Update copyright yearRaimo Niskanen
2017-02-16Package abstract code in a record for code generationBjörn Gustavsson
For now, do the packaging before call asn1ct_gen:pgen().
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-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2015-01-12Remove useless fields in #state{}Björn Gustavsson
Three fields ('type','value', and 'vname') are almost unused. They are set, but almost never read. Eliminate the last remaining uses and the fields themselves.
2015-01-12asn1: Fix import checking codeDan Gudmundsson
All errors were not reported. Furthermore, get_referenced_type/2 will report errors if any module is missing, so the attempt to report additional errors in chained_import/4 would not find any errors.
2015-01-12Provide more reliable location of errorsBjörn Gustavsson
File names and line number information was not reliable available when producing error messages. Some items have embedded line number information, and sometimes the S#state.type and/or S#state.value could be used to retrieve the line number information. To make sure that we can always retrieve at least an approximate error location, store the top-level construct being checked in S#state.error_context. Example of top-level constructs: Seq ::= SEQUENCE {...} i INTEGER ::= 42 This is a short-term solution. In the long term, we would want the parser to include line number information in all items.
2014-09-01Add the module name to the #classdef{} recordBjörn Gustavsson
If we want construct an #'Externaltypereference'{} from a #classdef{} record, we will need the module name.
2014-09-01Eliminate the use of #identifier{} outside the tokeniser and parserBjörn Gustavsson
The only remaining use of #identifier{} in asn1ct_check was in a temporary packaging of a value that would be ultimately be put into #valuedef{}. Therefore we can eliminate that last usage but putting the value directly into a #valuedef{} and we can move the record definition into asn1ct_parser2.
2014-09-01Fix problem with object identifiers in external modulesBjörn Gustavsson
When parsing ASN.1, certain constructs can only be understood in the full context of the entire ASN.1 module. For instance, the value following ID in this simplified excerpt from MTSAbstractService88: administration-88 PORT ::= { ID {id-pt-administration 88} } the value following "ID" can be interpreted either as value for: SEQUENCE { id-pt-administration INTEGER } or as an OBJECT IDENTIFIER. Our ASN.1 parser assumes that a SEQUENCE is meant, and if that later turns out to be wrong, the SEQUENCE value is rewritten to an OBJECT IDENTIFIER. The problem is that at the time of the rewrite, we no longer know in which ASN.1 module id-pt-administration was defined in, and we have to use the module name in the state{} record. Unfortunately, the module name in the state{} record may not always be correct. While there are attempts in the code to keep the module name up-to-date when checking imported types, it is not done consistently, and it seems to be a difficult and error-prone task to attempt to make it consistent. A safer and less error-prone approach is to make sure that we don't lose the module name while parsing. To make it clear what we are doing, we will introduce a new #seqtag{} record that are used for tags in SEQUENCE values. The name is based on its primary use. The record also contains the module in case it happens to be an OBJECT IDENTIFIER.
2013-05-31Eliminate use of #constraint{} outside of the parserBjörn Gustavsson
The record #constraint{} is almost unused outside of the parser except for two places in asn1ct_check. The only correct usage of the record is in instance_of_constraints/2. Eliminate that usage by updating the parser to pass that constraint in the same way as all other constraints. In check_integer_range/2, the record is used incorrectly. A constraint for an integer will never be a list of #constraint{} records. Therefore, the list comprehension will always produce an empty list, and check_constr/2 will not actually check anything (which is kind of lucky, since the 'ValueRange' range constraint is incorrectly written - the lower and upper bounds should be in a tuple). For now, we will not attempt to actually start validating integer ranges. Firstly (obviously) we will need to be sure that we correctly handles all forms of constraints, and secondly we will need to consider whether we need to produce a warning rather than an error for compatibility reasons.
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-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-22Remove the unused run-time modulesBjörn Gustavsson
2010-08-25Add support for Extension addition groupKenneth Lundin
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP