aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1_records.hrl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-05-23 12:10:46 +0200
committerBjörn Gustavsson <[email protected]>2014-09-01 14:37:14 +0200
commitc266196c016fc1156c7a18cfeec4920ee4075519 (patch)
tree8ef36762455683503885314d6dbd196258ab8d26 /lib/asn1/src/asn1_records.hrl
parent02190d89867029c65d49e3980059f746c7b9c080 (diff)
downloadotp-c266196c016fc1156c7a18cfeec4920ee4075519.tar.gz
otp-c266196c016fc1156c7a18cfeec4920ee4075519.tar.bz2
otp-c266196c016fc1156c7a18cfeec4920ee4075519.zip
Fix problem with object identifiers in external modules
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.
Diffstat (limited to 'lib/asn1/src/asn1_records.hrl')
-rw-r--r--lib/asn1/src/asn1_records.hrl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/asn1/src/asn1_records.hrl b/lib/asn1/src/asn1_records.hrl
index 396ba0fcfa..2540f0effc 100644
--- a/lib/asn1/src/asn1_records.hrl
+++ b/lib/asn1/src/asn1_records.hrl
@@ -73,6 +73,15 @@
% Externalvaluereference -> modulename '.' typename
-record('Externalvaluereference',{pos,module,value}).
+%% Used to hold a tag for a field in a SEQUENCE/SET. It can also
+%% be used for identifiers in OBJECT IDENTIFIER values, since the
+%% parser cannot always distinguish a SEQUENCE with one element from
+%% an OBJECT IDENTIFIER.
+-record(seqtag,
+ {pos :: integer(),
+ module :: atom(),
+ val :: atom()}).
+
-record(state,{module,mname,type,tname,value,vname,erule,parameters=[],
inputmodules,abscomppath=[],recordtopname=[],options,
sourcedir}).