ASN.1 Sequence Confusion -
i'm studying syntax asn.1, , i've read lot of relevant material online:
http://www.itu.int/rec/t-rec-x.690-200811-i/en
http://luca.ntop.org/teaching/appunti/asn1.html
http://www.obj-sys.com/asn1tutorial/node11.html
i'm confused on encoding of asn.1 sequence
types. in general, realize sequence
aggregate - we'd call object or instance in programming languages. it's list of name/value pairs, similar json object. unlike json object, asn.1 sequence
has implicit schema, because instance of "class".
so, class/schema sequence
might like:
{ name utf8string age integer }
and instance of schema sequence
{ "john smith" 42 }
but i'm totally confused how can tell difference between class , instance in actual ber encoding. in fact, i'm confused, i'm not sure if asn.1 sequence
supposed class definition or instance of class.
the documentation seems imply it's instance:
8.9 encoding of sequence value
8.9.1 encoding of sequence value shall constructed.
8.9.2 contents octets shall consist of complete encoding of 1 data value each of types listed in asn.1 definition of sequence type, in order of appearance in definition, unless type referenced keyword optional or keyword default.
8.9.3 encoding of data value may, need not, present type referenced keyword optional or keyword default. if present, shall appear in encoding @ point corresponding appearance of type in asn.1 definition.
so seems sequence list of data values, must correspond schema (class). asn.1 doesn't have class
type, how actual class, know class given sequence instance of?
suppose write following:
r definitions automatic tags ::=
begin
uspostaladdress ::= sequence {
street ia5string, city ia5string, state ia5string (size (2)) (from("a".."z")), zipcode ia5string (size (5)) (from("0".."9"))
}
end
the part between begin , end above called "type assignment". "uspostaladdress" name of (user-defined) "type". writing above, have specified user-defined type , have given name it. each sequence construct (the above sequence construct, example) "type". it's complex type, in contains 1 or more "fields" each having own type. possible "value" of above type denoted follows:
{ street "1234 main st.", city "new york", state "ny", zipcode "12345" }
we talking types , values, not classes , instances. can have type integer (0..15) values integer numbers between 0 , 15, can have sequence type values arrangements of lower-level values. above sequence type simple example of data structures ("types") can define in asn.1.
(in asn.1 there called "class" it's different thing.)
in asn.1, messages of protocols specified top-level types (usually sequence or choice types). particular "message value" value of top-level type. when have value of top-level type in hands, can encode value stream of bits using 1 of standard encoding rules (ber, per, etc.). when receive stream of bits network know value of particular asn.1 type encoded in ber, per, etc., can decode bits , obtain original value.
Comments
Post a Comment