Age | Commit message (Collapse) | Author |
|
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.
|
|
Make sure that we continue to follow external references until
we find a real type.
|
|
|
|
EXPORTS ALL is the same as leaving out the EXPORTS statement.
|
|
|
|
|
|
|
|
|
|
|
|
This will also eliminate a dialyzer warning.
|
|
The clause is just an optimization for a (extremly rare) special case.
Removing it will eliminate a dialyzer warning.
|
|
|
|
The code generator would crash.
|
|
If a named BIT STRING has a lower size bound of 0, treat it the same
way as if there was no constraint for the purposes of trailing zero
bits.
That change will eliminate a dialyzer warning.
|
|
The encoder for the following type would generate a dialyzer warning:
Ns ::= NumericString (FROM ("0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"))
Optimize this case to make it slightly faster as well as eliminate
the dialyzer warning.
|
|
|
|
|
|
Running dialyzer on test suites is good for finding both bugs and
useless dialyzer warnings. Add a mechanism in asn1_test_lib for
turning on running of dialyzer on all generated code.
Turned off by default, because it is slow and because there are
still a few dialyzer warnings left.
|
|
|
|
The default value for an OCTET STRING when legacy_erlang_types was
active would be a binary instead of a list.
|
|
|
|
The old code for testing DEFAULT values is messy, inefficient, and
causes dialyzer warnings.
|
|
We need to test DEFAULT values both with and without
legacy_erlang_types.
|
|
If SetIn is defined like this:
SetIn ::= SET {
boolIn BOOLEAN,
intIn INTEGER
}
then it may not be used with an empty DEFAULT value like this:
SetDef1 ::= SET {
set1 SetIn DEFAULT {}
}
The ASN.1 compiler prints an warning message, but still generates
code. (That should be fixed.)
Fix the incorrect ASN.1 specification by making the
components in SetIn optional:
SetIn ::= SET
{
boolIn BOOLEAN OPTIONAL,
intIn INTEGER OPTIONAL
}
|
|
|
|
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.
|
|
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.
|
|
|
|
Make the source code a little bit cleaner.
|
|
A newline was forgotten.
|
|
|
|
* bjorn/asn1/documentation:
Consistenly use ASN.1 instead of asn1
Correct some spelling, grammar and punctation issues
Correct description of the undec_rest option
Correct description of the REAL type
Replace "extend-ability" with "extensibility"
Remove the section about encoding rules
Bring information about tags up to date
Don't waste words describing the SET type
Correct and modernize the examples for DEFAULT
Correct the UTF8String description and example
Correct the PrimStrings example
Remove all uses of the deprecated asn1{ct,rt}:{en,de}code/2 functions
Correct and modernize the "A First Example" section
Shorten the Introduction section, keeping only the essential details
Fix an ampersand
Document the asn1_OPENTYPE wrapper
|
|
When talking about the ASN.1 standard, ASN.1 specifications, and
the ASN.1 compiler, consistently use "ASN.1" instead of "asn1".
|
|
|
|
The trailing bytes returned are now always a binary. Also condense
and clean up the language.
|
|
REAL is implemented, sort of. But real numbers must be given in
a string.
|
|
While "extendability" (without the hyphen) is an English word,
"extensibility" is the established term used when talking about
the extensibility of ASN.1 types.
|
|
The section about encoding rules serves no useful purpose. Most users
already know which encoding rule to use for their specifications. The
few users that have their own specification and need to decide on
which encoding rule to use will need much more information.
|
|
Since 1994 when the AUTOMATIC TAGS was introduced, ASN.1 users
no long need to worry about tagging, and the following sentence
no longer makes any sense:
It is essential for all users of ASN.1 to
understand all the details about tags.
Therefore, remove the entire existing section of tags, and replace
it with a shorter section explaining why we no longer need to know
about tags. Remove all tags from the examples.
|
|
Since the SET type is used exactly the same way as the SEQUENCE
type in Erlang, we can simply say so and note that decoding will
be less efficient for the BER and DER encoding rules.
|
|
It turns out that the current BER back-end can recognize complex
DEFAULT values, so I had to commit up with a more elaborate
example to show a difference between the BER and DER back-ends.
|
|
|
|
The decode functions now return a binary, not an iolist, so we must
both change the output and remove the call to list_to_binary when
decoding.
|
|
|
|
Replace "IMPLICIT TAGS" with "AUTOMATIC TAGS" since AUTOMATIC TAGS
is recommended for all new ASN.1 specifications.
|
|
We can assume that anyone that reads the documentation for the Asn1
documentation already knows about ASN.1, so we don't need three
paragraphs of introductory. Keep one short paragraph explaining
what ASN.1 is in case a reader unfamiliar with ASN.1 stumbles upon
the manual.
While we are at it, reformat the paragraphs in Introduction to
shorter lines that don't wrap.
|
|
|
|
|
|
|
|
Most dependencies introduced are exactly the dependencies to other
applications found by xref. That is, there might be real dependencies
missing. There might also be pure debug dependencies listed that
probably should be removed. Each application has to be manually
inspected in order to ensure that all real dependencies are listed.
All dependencies introduced are to application versions used in
OTP 17.0. This since the previously used version scheme wasn't
designed for this, and in order to minimize the work of introducing
the dependencies.
|