Resources
Type | Description | Usage Example |
BOOLEAN | Similar to boolean type in programming languages. Has two possible values: TRUE and FALSE. | doorOpen BOOLEAN ::= TRUE |
INTEGER | Similar to integer type in programming languages, yet it can be of any magnitude (your platform may use arrays of bytes to accommodate unconstrained integers). |
speed INTEGER (0..60) ::= 40
|
BIT STRING | Used for bits arrays that are not necessarily multiple of 8 bits, e.g. bitmasks. You can assign meanings to each bit individually. Values have 3 possible forms: binary - '011'B, hex - '6'H, and named - {windowOpen, engineOn}. These are identical values for myStatus in the example. |
Sensors ::= BIT STRING {
doorOpen(0), windowOpen(1), engineOn(2) } myStatus Sensors ::= {windowOpen, engineOn} |
OCTET STRING | Used when you have binary data that is multiple of 8 bits. Values have 2 possible forms: binary - '01100110'B or hex - '66'H. | MyBinaryFile ::=
OCTET STRING |
DATE | Used when you need to represent a date. Values have the form "YYYY-MM-DD". |
harvardEstablished DATE ::= "1636-09-18"
|
TIME-OF-DAY | Used when you need to represent a time of the day. Values have the form "HH:MM:SS". |
callTime TIME-OF-DAY ::= "18:30:23"
|
DATE-TIME | Used when you need to represent a date with a time. Values have the form "YYYY-MM-DDTHH:MM:SS" |
callTime DATE-TIME ::= "2000-11-22T18:30:23"
|
REAL | Used when you need numbers that include a decimal point. Values have two possible forms: decimal format such as 245.34 or sequence format such as {mantissa 24534, base 10, exponent -2}. These two values are identical. | Total ::=
REAL |
ENUMERATED | Used when you have a list of items which you prefer to identify by name rather than by a number. Note that the names of values always begin with a lowercase letter. |
CarColors ::= ENUMERATED {black, red, white}
myCar CarColors ::= white |
OBJECT IDENTIFIER | Used when you need a globally unique identifier for something. A common example of this is an attribute in a digital certificate. An object identifier value is a list of arcs from the root to a node in the object identifier tree. | {joint-iso-itu-t(2)
country(16) us(840) organization(1)} |
SEQUENCE | Used when you have a collection of items to group together. |
Contact ::= SEQUENCE {
name VisibleString, phone NumericString } driver Contact ::= {name "J.Smith", phone "7325555555"} |
SEQUENCE OF | Used when you have list or array of a repeated item. |
breakTimes SEQUENCE OF TIME-OF-DAY ::= {"10:00:00", "12:00:00", "14:45:00"}
|
CHOICE | Used when you have a collection of items for which only one of the items can be present at a time. |
Location ::= CHOICE {
streetAddress Address, intersection Intersection, landmark LandMarkName, gpsCoordinates GpsInfo } meetAt Location ::= landmark: "Statue of Liberty" |
IA5String | Used when you need to use ASCII including control characters | TextWithLayout ::=
IA5String |
VisibleString | Used when you need to use the subset of ASCII that does not include control characters. | LineOfText ::=
VisibleString |
NumericString | Used when you need to use only digits and spaces. | LineOfNumbers ::=
NumericString |
UTF8String | Used when you need to handle Unicode characters. | TextInAnyLanguage
::= UTF8String |
NULL | Used when you need a placeholder for which there is no value. This most often is used as an alternative in a CHOICE type, or as an optional component of a SEQUENCE type. |
Type | Description |
UTCTime | The UTCTime type was originally for representing dates and times in a form that was independent of what time zone you were currently in. Note, however, that a 2-digit year is used here which potentially causes ambiguity regarding which century is being represented by the date. The new TIME type fully handles dates and times without potential ambiguity caused by the 2-digit year of UTCTime. |
GeneralizedTime | The GeneralizedTime type was originally for representing local dates and times, with the possibility of indicating local time zone as an offset from UTC time. Although a 4-digit year is used here, eliminating some potential ambiguities, the new TIME type is preferred since it fully supports ISO 8601 which is the definitive standard for time and date representations. |
GraphicString | The GraphicString type was originally for supporting different character sets which could be displayed on a screen. It uses special "escape" characters to switch to different character sets. This type should be avoided since UTF8String, BMPString or UniversalString cover all character sets without needing to "escape" into different character sets. |
TeletexString | The TeletexString type was originally for supporting different character sets which could be printed by Teletex machine. It uses special "escape" characters to switch to different character sets. This type should be avoided since UTF8String, BMPString or UniversalString cover all character sets without needing to "escape" into different character sets. |
SET | The SET type is similar to the SEQUENCE type except that items can be sent in any order. The reason this should be avoided is that it unnecessarily makes decoders slower and more complex without adding any significant benefit. In particular for some encoding rules (such as BER) the decoders are slower since each check for a component must cover every possible component in the SET. |
SET OF | The SET OF type is similar to the SEQUENCE OF type except that items can potentially be received in a different order than in which they originally sent. The reason this should be avoided is that it unnecessarily makes encoders and decoders slower and more complex without adding any significant benefit. In particular, some encoding rules (such as DER or PER) require the components to be sorted in ascending order based on their content. |