-- Module Example2-ASN1-Module (X.692:11/2008)
-- See also standard
-- See also the index of all ASN.1 assignments needed in this document

Example2-ASN1-Module {joint-iso-itu-t(2) asn1(1) ecn(4) examples(5)
  asn1-module2(5)} DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

ExampleMessages ::= CHOICE {
  normallySmallValues1                    NormallySmallValues1,
  normallySmallValues2                    NormallySmallValues2,
  sparseEvenlyDistributedValueSet         SparseEvenlyDistributedValueSet,
  sparseUnevenlyDistributedValueSet       SparseUnevenlyDistributedValueSet,
  conditionalPresenceOnValue              ConditionalPresenceOnValue,
  conditionalPresenceOnExternalCondition
    ConditionalPresenceOnExternalCondition,
  enclosingStructureForList               EnclosingStructureForList,
  equalLengthLists                        EqualLengthLists,
  enclosingStructureForChoice             EnclosingStructureForChoice,
  version1Message                         Version1Message
}

NormallySmallValues1 ::= INTEGER(0..1000)

normallySmallValues1 ExampleMessages ::= normallySmallValues1:30

NormallySmallValues2 ::= INTEGER(0..1000)

normallySmallValues2 ExampleMessages ::= normallySmallValues2:100

SparseEvenlyDistributedValueSet ::= INTEGER(2 | 4 | 6 | 8 | 10 | 12 | 14 | 16)

sparseEvenlyDistributedValueSet ExampleMessages ::=
  sparseEvenlyDistributedValueSet:10

SparseUnevenlyDistributedValueSet ::= INTEGER(0 | 3 | 5 | 6 | 11 | 8)

sparseUnevenlyDistributedValueSet ExampleMessages ::=
  sparseUnevenlyDistributedValueSet:11

ConditionalPresenceOnValue ::= SEQUENCE {
  a  INTEGER(0..4),
  b  INTEGER(1..10),
  c  BOOLEAN OPTIONAL,
  -- Condition: "c" is present  if "a" is 0, otherwise "c" is absent 
  d  BOOLEAN OPTIONAL
  -- Condition: "d" is absent  if "a" is 1, otherwise "d" is present 
}

-- Note the implied presence constraints in comments.
-- Note also that the integer field "a" carries application semantics 
-- and has values other than zero and one.  If  "a" has value 0, both 
-- "c" and "d" are present.  If "a" has value 1, both "c" and "d" are missing. 
-- If "a" has values 3 or 4, "c" is absent and "d" is present. 
-- These conditions are very hard to express formally using ASN.1 alone.
conditionalPresenceOnValue ExampleMessages ::=
  conditionalPresenceOnValue:{a 2, b 5, d TRUE}

ConditionalPresenceOnExternalCondition ::= SEQUENCE {
  a  BOOLEAN OPTIONAL-- Condition: "a" is present  if the external  condition "C" holds,
-- otherwise "a" absent 
}

-- Note that the presence constraint can only be supplied in comment.
conditionalPresenceOnExternalCondition ExampleMessages ::=
  conditionalPresenceOnExternalCondition:{a TRUE}

EnclosingStructureForList ::= SEQUENCE {list  VariableLengthList
}

VariableLengthList ::= SEQUENCE (SIZE (0..1023)) OF INTEGER(1..2)

-- Normally the list contains only a few elements (0..31), 
-- but it might contain many.
enclosingStructureForList ExampleMessages ::=
  enclosingStructureForList:{list {1, 2, 1}}

EqualLengthLists ::= SEQUENCE {list1  List1,
                               list2  List2
}
(CONSTRAINED BY {
   
   -- "list1" and "list2" always have the same number of elements. 
   })

List1 ::= SEQUENCE (SIZE (0..1023)) OF BOOLEAN

List2 ::= SEQUENCE (SIZE (0..1023)) OF INTEGER(1..2)

equalLengthLists ExampleMessages ::=
  equalLengthLists:{list1 {TRUE, FALSE, TRUE}, list2 {1, 2, 1}}

EnclosingStructureForChoice ::= SEQUENCE {choice  UnevenChoiceProbability
}

UnevenChoiceProbability ::= CHOICE {
  frequent1  INTEGER(1..2),
  frequent2  BOOLEAN,
  common1    INTEGER(1..2),
  common2    BOOLEAN,
  common3    BOOLEAN,
  rare1      BOOLEAN,
  rare2      INTEGER(1..2),
  rare3      INTEGER(1..2)
}

enclosingStructureForChoice ExampleMessages ::=
  enclosingStructureForChoice:{choice common2:FALSE}

-- Second mapping: Map determinant indexes to bitstrings
Version1Message ::= SEQUENCE {ie-1  BOOLEAN,
                              ie-2  INTEGER(0..20)
}

version1Message ExampleMessages ::= version1Message:{ie-1 TRUE, ie-2 10}

END
-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D