aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
AgeCommit message (Collapse)Author
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-10Merge branch 'bjorn/asn1/not-small-bugs/OTP-11153' into maintBjörn Gustavsson
* bjorn/asn1/not-small-bugs/OTP-11153: PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensions testConstraints: Improve tests of semi-constrained INTEGERs Test ENUMERATED with many extended values UPER: Correct encoding of ENUMERATED with more than 63 extended values Add asn1_test_lib:hex_to_bin/1
2013-06-08PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensionsBjörn Gustavsson
2013-06-08testConstraints: Improve tests of semi-constrained INTEGERsBjörn Gustavsson
Make sure that semi-constrained integers are correctly encoded in the mininum number of bytes. (The roundtrip test does not catch problems with non-minimal encodings.) Also test huge values that must be encoded in 128 or 256 bytes.
2013-06-08Test ENUMERATED with many extended valuesBjörn Gustavsson
2013-06-07PER, UPER: Fix record name mismatch between HRL file and decoding codeBjörn Gustavsson
When a SEQUENCE was defined inline inside extension addition group like this: InlinedSeq ::= SEQUENCE { ..., [[ s SEQUENCE { a INTEGER, b BOOLEAN } ]] } the decoding code would return the contents of the SEQUENCE in a record named 'InlinedSeq_ExtAddGroup1_s', while the record definition in the generated HRL file would be 'InlinedSeq_s'. Since there is no reason to use the longer record name (no risk for ambiguity), correct the name in the decoding code.
2013-06-07UPER: Correct encoding of ENUMERATED with more than 63 extended valuesBjörn Gustavsson
2013-06-07Add asn1_test_lib:hex_to_bin/1Björn Gustavsson
2013-06-03testSeqOf: Test constrained, extensible sizesBjörn Gustavsson
2013-05-31Clean up testSeqOfBjörn Gustavsson
2013-05-31Extend tests cases for BIT STRINGBjörn Gustavsson
2013-05-31Improve tests of ENUMERATEDBjörn Gustavsson
2013-05-31asn1ct_check: Eliminate useless Per argument from complist_as_tuple()Björn Gustavsson
The Per argument is no longer used; it is only passed around.
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-31asn1ct_gen_per: Remove useless renewal of 'enumval'Björn Gustavsson
Since fbcb7fe589edbfe79d10d7fe01be8a9f77926b89, the 'enumval' variable is no longer used.
2013-05-31Fix encoding of semi-constrained, extensible INTEGERsBjörn Gustavsson
Given: Semi ::= INTEGER (Lb..MAX, ...) where Lb is an arbitrary integer, attempting to encode an integer less than Lb would cause the encoder to enter an infinite loop.
2013-05-31PER/UPER: Fix decoding of semi-constrained INTEGERsBjörn Gustavsson
A semi-constrained INTEGER with a non-zero lower bound would be incorrectly decoded. This bug was introduced in R16.
2013-05-31testPrim: Simplify test cases using a roundtrip functionBjörn Gustavsson
While at it, also test more integer values.
2013-05-31BER: Fix handling of a constructed default value for a classBjörn Gustavsson
2013-05-31PER: Generate code for deep table constraints at compile-timeBjörn Gustavsson
For the PER backends, generate code for accessing deep table constraints at compile-time in the same way as is done for BER. While at it, remove the complicated indentation code. Also modernize the test suite and add a test for a deeper nested constraint.
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-31asn1ct: Simplify check_value/2Björn Gustavsson
Most types don't have any validation functions that does anything useful, so it is sufficient to call normalize_value/4 for them.
2013-05-31Extend tests to cover more code in asn1ct_checkBjörn Gustavsson
2013-05-31Clean up checking of values for ENUMERATEDsBjörn Gustavsson
Unify the code for checking an enumeration value named in a DEFAULT and in an ENUMERATED value. There is no need to handle those cases differently. That also will also make sure that the following works: E ::= ENUMERATED { x, ..., y } e E ::= x (Extensible ENUMERATEDs were not handled when defining values.) Always generate an error when an unknown enumeration value is given (used in a DEFAULT, a message would be printed, but the compilation would succeed). Also make sure that we always include the line number for the incorrect enumeration. Write a new test case and remove the extremely rudimentary value_bad_enum_test/1 test case.
2013-05-31Introduce a new mechanism for structured error handlingBjörn Gustavsson
2013-05-31asn1_db: Make dbput/3 and dbsave/2 asynchronousBjörn Gustavsson
Those functions have no reason to be synchronous since they don't have a useful return value.
2013-05-31asn1_db: Remove unused functionsBjörn Gustavsson
Also replace unused code with assertions. While at it, also let reply/2 return 'ok' to silence Dialyzer warnings for unmatched returns.
2013-05-31asn1ct_check: Clean up checkc/3Björn Gustavsson
2013-05-31asn1ct_check: Clean up checkp/3Björn Gustavsson
2013-05-31asn1ct_check: Clean up checkv/3Björn Gustavsson
2013-05-31asn1ct_check: Introduce check_fold/3 and clean up checkt/3Björn Gustavsson
Capture the common pattern of checking a list of named ASN.1 items in a check_fold/3 function. Clean up checkt/3 using it, replacing the old-style catch with a try..catch.
2013-05-31asn1ct: Refactor running of compiler passesBjörn Gustavsson
As a preparation for future clean up of the error handling, we will need to take control on how how asn1ct runs the different compiler passes.
2013-05-31asn1ct_constructed_per: Remove dead code for handling of ENUMERATEDBjörn Gustavsson
An ENUMERATED is always represented as a two-tuple, never as three-tuple.
2013-05-31PER/UPER: Eliminate gen_encode_prim_wrapper() and DoTag argumentBjörn Gustavsson
asn1ct_constructed_per:gen_encode_prim_wrapper() no longer serves any useful purpose, as it is easier to call asn1ct_per:gen_encode_prim() directly. Also, the DoTag argument for asn1ct_per:gen_encode_prim() is never actually used, so it can be eliminated at the same time.
2013-05-31Remove files that are not used by any test caseBjörn Gustavsson
The list of files to remove was obtained by running "ls -lut" after running the test cases and comparing the atime for each file with the start of the test run.
2013-05-31asn1_SUITE: Add testS1AP/1Bjö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-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-31When testing, don't tolerate warnings from the BEAM compilerBjörn Gustavsson
2013-05-31BER: Don't generate functions that are never usedBjörn Gustavsson
2013-05-31asn1ct, asn1ct_gen: Eliminate unused exportsBjörn Gustavsson
Stop export functions that are not called from outside their module. If the functions are not used at all, remove the functions too. The unused exports were found by running: xref:start(s). xref:add_application(s, code:lib_dir(asn1)). io:format("~p\n", [xref:analyze(s, exports_not_used)]).
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-31Open the output file in raw mode with delayed writeBjörn Gustavsson
This change brings down the execution time on my computer for the entire asn1 test suite from about 340 seconds to 310 seconds.
2013-05-31Generate one call to io:put_chars/2 for each call to asn1ct_gen:emit/1Björn Gustavsson
asn1ct_gen:emit/1 used to make one call to io:put_chars/2 for each part of the term passed emit/1. By collecting all output into one iolist for each call emit/1 the time for running the entire asn1 test suite is reduced from about 460 seconds to 340 seconds on my computer.
2013-05-31asn1_test_lib: Purge old code when loading a new moduleBjörn Gustavsson
In the 64-bit run-time, there is about 40Mb in old code after running the asn1 test suite. Since it is very easy to reclaim that memory, let's do it. Also get rid of the unnecessary call to code:soft_purge/1 just before loading the new code.
2013-05-31PER/UPER: Remove support for a list argument for encode_open_type/1Björn Gustavsson
Almost always, encode_open_type/1 is called with the return value from complete/1, which always is a binary. In the rare situation that encode_open_type/1 is called directly with data from the user application, call iolist_to_binary/1 before calling encode_open_type/1.
2013-05-31Introduce asn1ct_gen_per:gen_decode_external/3Björn Gustavsson
Hiding the details of decoding an external type will facilitate changing the calling convention in a future commit.
2013-05-31Clean up testPrimStringsBjörn Gustavsson
Eliminate use of line macros and asn1_wrapper.