Age | Commit message (Collapse) | Author |
|
|
|
Encoding an empty named BIT STRING would fail for BER.
Noticed-by: Svilen Ivanov
|
|
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
ObjectDescriptor, UTCTime, and GeneralizedTime are not special and
can be handled in the same way as all other restricted string types.
|
|
This slight optimization will also eliminate some Dialyzer warnings.
|
|
|
|
Given the type:
S ::= IA5String (SIZE (5, ...))
attempting to encode (to PER/UPER) a string shorter than 5 characters
would fail. Similarly, attempting to decode such string in the BER
format would fail.
In the case of BER, we can do no range checks if the size constraint
is extensible.
|
|
It is recommended to use byte_size/1 or tuple_size/1 instead of
size/1.
|
|
|
|
Add the option 'legacy_bit_string' to decode to the old list format.
|
|
We do it in the simplest possible way by converting the bitstring
to a compact bitstring tuple.
The encoding of BIT STRINGs should be cleaned up and optimized.
|
|
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.
|
|
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.
|
|
Also make sure that the error handling is contained within the
asn1rt_nif module and does not leak out to generated code.
|
|
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.
|