Skip to content

Commit

Permalink
OTP-8463 Support for EXTENSIBILITY IMPLIED and SET/SEQ OF NamedType is
Browse files Browse the repository at this point in the history
          added.
  • Loading branch information
KennethL authored and Erlang/OTP committed Feb 19, 2010
1 parent 729565d commit 18bd123
Show file tree
Hide file tree
Showing 1,369 changed files with 348,428 additions and 105 deletions.
12 changes: 7 additions & 5 deletions lib/asn1/src/Restrictions.txt
@@ -1,10 +1,12 @@
The following restrictions apply to this implementation of the ASN.1 compiler:

Supported encoding rules are:
BER
PER (aligned)
The ASN.1 2002 standard is not fully supported because there has been no need for that.
It seems as if most ASN.1 specifications are still using the 1998 standard or older.

PER (unaligned) IS NOT SUPPORTED
Supported encoding rules are:
BER, DER
PER ALIGNED
PER UNALIGNED

Supported types are:

Expand Down Expand Up @@ -49,7 +51,7 @@ Files with ASN.1 source must have a suffix .asn1 the suffix .py used by the
old ASN.1 compiler is supported in this version but will not be supported in the future.

Generated files:
X.asn1db % the intermediate format of a compiled ASN.1 module
X.asn1db % the intermediate format of a compiled ASN.1 module ,only used by the ASN.1 compiler.
X.hrl % generated Erlang include file for module X
X.erl % generated Erlang module with encode decode functions for
% ASN.1 module X
37 changes: 23 additions & 14 deletions lib/asn1/src/asn1ct_check.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%
%%
%%
Expand Down Expand Up @@ -5416,9 +5416,12 @@ instance_of_constraints(S,#constraint{c={simpletable,Type}}) ->
%% assign values to un-numbered identifiers
%% check that the constraints are allowed and correct
%% put the updated info back into database
check_enumerated(_S,[{Name,Number}|Rest],_Constr) when is_atom(Name), is_integer(Number)->
check_enumerated(_S,[{Name,Number}|_Rest]= NNList,_Constr) when is_atom(Name), is_integer(Number)->
%% already checked , just return the same list
[{Name,Number}|Rest];
NNList;
check_enumerated(_S,{[{Name,Number}|_Rest],L}= NNList,_Constr) when is_atom(Name), is_integer(Number), is_list(L)->
%% already checked , contains extension marker, just return the same lists
NNList;
check_enumerated(S,NamedNumberList,_Constr) ->
check_enum(S,NamedNumberList,[],[],[]).

Expand Down Expand Up @@ -5568,14 +5571,14 @@ expand_components2(_S,{_,#typedef{typespec=#type{def=Seq}}})
case Seq#'SEQUENCE'.components of
{R1,_Ext,R2} -> R1 ++ R2;
{Root,_Ext} -> Root;
Root -> Root
Root -> take_only_rootset(Root)
end;
expand_components2(_S,{_,#typedef{typespec=#type{def=Set}}})
when is_record(Set,'SET') ->
case Set#'SET'.components of
{R1,_Ext,R2} -> R1 ++ R2;
{Root,_Ext} -> Root;
Root -> Root
Root -> take_only_rootset(Root)
end;
expand_components2(_S,{_,#typedef{typespec=RefType=#type{def=#'Externaltypereference'{}}}}) ->
[{'COMPONENTS OF',RefType}];
Expand All @@ -5591,6 +5594,12 @@ expand_components2(S,{_,ERef}) when is_record(ERef,'Externaltypereference') ->
expand_components2(_S,Err) ->
throw({error,{asn1,{illegal_COMPONENTS_OF,Err}}}).

take_only_rootset([])->
[];
take_only_rootset([#'EXTENSIONMARK'{}|_T])->
[];
take_only_rootset([H|T]) ->
[H|take_only_rootset(T)].

check_unique_sequence_tags(S,[#'ComponentType'{prop=mandatory}|Rest]) ->
check_unique_sequence_tags(S,Rest);
Expand Down Expand Up @@ -5885,8 +5894,8 @@ check_relative_oid(_S,_Constr) ->
% - that each alternative is of a valid type
% - that the extension marks are valid
check_choice(S,Type,Components) when is_list(Components) ->
case check_unique([C||C <- Components,
is_record(C,'ComponentType')],#'ComponentType'.name) of
Components1 = [C||C = #'ComponentType'{} <- Components],
case check_unique(Components1,#'ComponentType'.name) of
[] ->
%% sort_canonical(Components),
Components2 = maybe_automatic_tags(S,Components),
Expand Down Expand Up @@ -5927,13 +5936,13 @@ maybe_automatic_tags(S,C) ->
%% Pos == 1 for Root1, 2 for Ext, 3 for Root2
tag_nums(Cl) ->
tag_nums(Cl,0,0).
tag_nums([{'EXTENSIONMARK',_,_}|Rest],Ext,Root2) ->
tag_nums([#'EXTENSIONMARK'{}|Rest],Ext,Root2) ->
tag_nums_ext(Rest,Ext,Root2);
tag_nums([_|Rest],Ext,Root2) ->
tag_nums(Rest,Ext+1,Root2+1);
tag_nums([],Ext,Root2) ->
[0,Ext,Root2].
tag_nums_ext([{'EXTENSIONMARK',_,_}|Rest],Ext,Root2) ->
tag_nums_ext([#'EXTENSIONMARK'{}|Rest],Ext,Root2) ->
tag_nums_root2(Rest,Ext,Root2);
tag_nums_ext([_|Rest],Ext,Root2) ->
tag_nums_ext(Rest,Ext,Root2);
Expand Down Expand Up @@ -5983,7 +5992,7 @@ generate_automatic_tags1([],_) ->

any_manual_tag([#'ComponentType'{typespec=#type{tag=[]}}|Rest]) ->
any_manual_tag(Rest);
any_manual_tag([{'EXTENSIONMARK',_,_}|Rest]) ->
any_manual_tag([#'EXTENSIONMARK'{}|Rest]) ->
any_manual_tag(Rest);
any_manual_tag([_|_Rest]) ->
true;
Expand Down

0 comments on commit 18bd123

Please sign in to comment.