ASN.1
Previous: Listing of Universal Tags Up: ASN.1 Next: About this document


Exercises

  1. Given the definition
          company  ::=  SET
                      {
                       name           [0]  IA5String,
                       zipcode        [1]  IA5String,
                       CitationType        INTEGER,
                       other               ANY DEFINED BY CitationType
                      }
    where the INTEGER value of CitationType can be 0 = INTEGER, 1 = REAL, or 2 = BOOLEAN, which of the following values are valid? Assume tagging has been done accurately.
    1. ``CyberReal'', ``20742-1911'', 1, TRUE
    2. ``60603'', ``Villaland'', 0, 500000.00
    3. 0, 450, ``HomeNet''
    4. ``SitCom'', 1, 70000.00

  2. Write a module that identifies DaysOfWeek as a BIT STRING consisting of seven bits, one for each day of the week and the first of which represents Sunday. Write a value of the string that represents (Monday, Wednesday, Saturday).

  3. Differentiate between the following two representations?
      a.  HouseType  ::=  INTEGER       b.  HouseType  ::=  ENUMERATED
            (                                 {
             Ranch        (1)                  Ranch        (1)
             SplitLevel   (2)                  SplitLevel   (2)
             Colonial     (3)                  Colonial     (3)
             TownHome     (4)                  TownHome     (4)
            }                                 }

  4. Assume Employee is of type SEQUENCE with the following components: hire date, job title, age, salary, and office location (a city name). Write an ASN.1 notation for Employee. Give a valid representation of Employee.

  5. Distinguish among the various kinds of tagging in ASN.1. Use an example to illustrate the distinctions. Indicate the effects of IMPLICIT and EXPLICIT.

  6. Differentiate among SEQUENCE, SET, ENUMERATED, and WITH COMPONENTS. In your discussion, use the following structures as examples to illustrate differences.

      a) airport ::= SEQUENCE
                       {
                         origin       [0]  IA5String,
                         stop         [1]  IA5String  OPTIONAL,
                         destination  [2]  IA5String
                       }
    
      b) airport ::= SET
                       {
                         origin       [0]  IA5String,
                         stop         [1]  IA5String,
                         destination  [2]  IA5String
                       }
    
      c) airport ::= ENUMERATED
                       {
                         origin       [o],
                         stop         [s],
                         destination  [d]
                       }
    
      d) airport_list ::= airport
                     ( WITH COMPONENTS
                       {
                         origin       [0],
                         stop         [1],
                         destination  [2]
                       }
                     )

  7. Give an instance of the AirlineFlight example in Structured Types Section that includes a stop in the Dallas-Fort Worth (DFW) airport.

  8. For each of the following examples, name an appropriate ASN.1 data type and write the corresponding ASN.1 definition.
    1. An alphabetized list of employees.
    2. One of a movie, play, or sport event.
    3. Prime numbers between 0 and 15.
    4. 110010001111000011111100
    5. The local time in hours, minutes, and seconds.
    6. A sentence of text.
    7. Number of cars delivered, sold, leased, and on-hand.

  9. The following data structures are written in C. Write each structure in ASN.1.
      a) struct calendar birthday[2] =
           { { {`O', `C', `T'}, 2, 1948 }, { {`A', `P', `R'}, 14, 1955 } }
    
         where "calendar" is a structure defined by
    
         struct  calendar
           {
            char  name[3];
            int   date:
            int   year;
           };
    
      b) struct time  depart_time, arrive_time;
    
         where "time" is a structure defined by
    
           struct  time
             {
              int  hour;
              int  minute;
              int  second;
             };
    
      c) char array[7] = "NETWORK"
    
      d) struct entry
           {
            char  *word;
            int   *page_number;
           } index[50] =
               {  {"ARPANET", 105}, {"ASN.1", 328}  };

  10. Write in Pascal (or another high-level language different from C) each of the ASN.1 representations you produced in the preceding exercise.

  11. CASE: Stores in Philadelphia and Washington, but not Baltimore, carry colonial flags. The stores obtain the flags for 25.99 each. The identification number for colonial flags is cf1783, The Philadelphia store has 14 flags on hand and the Washington store has 10. Write the ASN.1 representation(s) for this CASE using the module in this Figure.

  12. Write a definition of NonStopFlights in this Section with the following additional conditions: include United Airlines and allow both nonstop flights and those that stop in Dallas-Fort Worth (DFW).

  13. Consider the entries in the Table of Contents for this chapter as records in ``ASN.1''.
    1. Which main section headings represent simple records and which represent structured records?
    2. Write an ASN.1 recursive definition that specifies a record such as ``ASN.1''.
    3. Write the Table of Contents as an instance of the record definition.

  14. Write an ASN.1 recursive definition of a binary tree.

  15. Use your definition of a binary tree in the preceding exercise to represent the following instance:
                               50
                              /  \
                            /      \
                          42        60
                         /  \      /
                       30    47  58
                         \
                          25



Previous: Summary Up: ASN.1 Next: About this document


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

by
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