previous | start | next

ASN.1 Basic Data Types

At its simplest, ASN.1 defines data items in a comparable way to the "declarations" used in most programming languges, so the definitions of basic types should look familiar, even if the syntax is a little strange. Simple[2] data types include:
BOOLEAN(1)
takes values true and false
INTEGER(2)
any positive or negative whole number
REAL(9)
expressed as mantissa, base, exponent
BITSTRING(3), OCTETSTRING(4)
an ordered sequence of 0 or more bits or octets (we would call these bytes)
NULL(5)
takes only one value, null...
ENUMERATED(10)
a list of values is supplied
Examples of some of these include:
brainDamaged ::= BOOLEAN
numberOfEmployees ::= INTEGER
avogadrosNumber ::= REAL(602,10,23)
sevenDeadlySins ::= ENUMERATED {
    pride(1), envy(2), gluttony(3), avarice(4), lust(5), sloth(6),
wrath(7)
} -- corresponding to OSI 7 layers :-)
NB: The numbers given in parentheses, eg (1), are called TAGS, see later this lecture. [2] A Java programmer would probably call these primitive data types; in some other languages they would be called scalars, although most programming languages don't include the "string" types in this category.
Lecture 21: Network Management #1 Copyright © 2005 P.Scott, La Trobe University Bendigo.


previous | start | next