Previous: Subtype Notation and Value Sets Up: Additional Features Next: Macros


  Recursion, a common feature in high-level languages, is also a feature in ASN.1. Data types, such as a set of sets, records with one or more components being a record, linked lists, and trees, are better understood when viewed as recursive structures. ASN.1 allows definitions of these kinds of data types and values to include recursion. For example, the linked list of integer values, each of whose nodes can be a linked list of integer values, is specified:

  LinkedList  ::=  SEQUENCE
          label     IA5String,
          value     CHOICE
             nodevalue    INTEGER,
             node         SEQUENCE OF LinkedList

Figure: Instance of a linked list of linked lists.

Assume L, shown in the following Figure, is an instance of LinkedList consisting of four nodes labeled A,B,C,D, where B is a linked list of three nodes B1,B2,B3 and B3 is a linked list of two nodes B31, B32. Header nodes are not included in this example. Then, the instance can be represented:

   label    "L",
   value    node
       {label     "A", value nodevalue 75},
       {label     "B",
        value     node
            {label   "B1", value nodevalue 60},
            {label   "B2", value nodevalue 50},
            {label   "B3",
             value   node
                 {label   "B31", value nodevalue 48},
                 {label   "B32", value nodevalue 46}
       {label   "C", value nodevalue 35},
       {label   "D", value nodevalue 15}

This site was developed from:
Computer Networks and Open Systems
An Application Development Perspective

Lillian N. Cassel
Richard H. Austing

Jones & Bartlett Publisher
ISBN 0-7637-1122-5

This site is hosted by:

Real World ASN.1 and XML Solutions