blob: 03d8a970352377835eba683267e1e4fde3d3b1f3 [file] [log] [blame]
Lev Walkin84291e02004-06-03 03:49:45 +00001#LyX 1.3 created this file. For more info see http://www.lyx.org/
2\lyxformat 221
3\textclass book
Lev Walkin26587ab2004-08-23 15:12:04 +00004\begin_preamble
5%\fancyhf{}
6%\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1\ sdf}{}}
7%\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{\thesection.\ #1}}}
8%\fancyhead[LE,RO]{\thepage}
9%\fancyhead[LO]{\rightmark}
10%\fancyhead[RE]]{\leftmark}
11\usepackage{extramarks}
12\lhead{\firstxmark}
13\rfoot{\lastxmark}
14\end_preamble
Lev Walkin84291e02004-06-03 03:49:45 +000015\language english
16\inputencoding latin1
Lev Walkin26587ab2004-08-23 15:12:04 +000017\fontscheme times
Lev Walkin84291e02004-06-03 03:49:45 +000018\graphics default
19\paperfontsize default
20\spacing single
21\papersize Default
22\paperpackage a4
23\use_geometry 0
24\use_amsmath 0
25\use_natbib 0
26\use_numerical_citations 0
27\paperorientation portrait
28\secnumdepth 3
29\tocdepth 3
30\paragraph_separation indent
31\defskip medskip
32\quotes_language swedish
33\quotes_times 2
34\papercolumns 1
Lev Walkin26587ab2004-08-23 15:12:04 +000035\papersides 2
36\paperpagestyle fancy
Lev Walkin84291e02004-06-03 03:49:45 +000037
38\layout Title
39
Lev Walkin26871b52004-09-08 03:01:06 +000040Using the Open ASN.1 Compiler
Lev Walkin84291e02004-06-03 03:49:45 +000041\layout Author
42
43Lev Walkin <
44\begin_inset LatexCommand \url{vlm@lionet.info}
45
46\end_inset
47
48>
49\layout Standard
50
51
Lev Walkin26587ab2004-08-23 15:12:04 +000052\begin_inset ERT
53status Open
54
55\layout Standard
56
57\backslash
Lev Walkin35d446b2004-09-24 20:56:07 +000058extramarks{$Revision$ -- describes asn1c-0.9.6}{}
Lev Walkin26587ab2004-08-23 15:12:04 +000059\end_inset
60
61
62\layout Standard
63
64
Lev Walkin84291e02004-06-03 03:49:45 +000065\begin_inset LatexCommand \tableofcontents{}
66
67\end_inset
68
69
Lev Walkin26587ab2004-08-23 15:12:04 +000070\layout Standard
71
72
73\begin_inset ERT
74status Collapsed
75
76\layout Standard
77
78\backslash
79pagestyle{headings}
80\end_inset
81
82
Lev Walkin4a83dd52004-08-07 05:00:07 +000083\layout Part
84
85ASN.1 Basics
Lev Walkin84291e02004-06-03 03:49:45 +000086\layout Chapter
87
Lev Walkin4a83dd52004-08-07 05:00:07 +000088Abstract Syntax Notation: ASN.1
Lev Walkin84291e02004-06-03 03:49:45 +000089\layout Standard
90
91
92\emph on
93This chapter defines some basic ASN.1 concepts and describes several most
94 widely used types.
95 It is by no means an authoritative or complete reference.
96 For more complete ASN.1 description, please refer to Olivier Dubuisson's
97 book
98\begin_inset LatexCommand \cite{Dub00}
99
100\end_inset
101
Lev Walkin4a83dd52004-08-07 05:00:07 +0000102 or the ASN.1 body of standards itself
Lev Walkin84291e02004-06-03 03:49:45 +0000103\begin_inset LatexCommand \cite{ITU-T/ASN.1}
104
105\end_inset
106
107.
108\layout Standard
109
110The Abstract Syntax Notation One is used to formally describe the semantics
111 of data transmitted across the network.
112 Two communicating parties may have different formats of their native data
113 types (i.e.
114 number of bits in the integer type), thus it is important to have a way
115 to describe the data in a manner which is independent from the particular
116 machine's representation.
117 The ASN.1 specifications is used to achieve one or more of the following:
118\layout Itemize
119
120The specification expressed in the ASN.1 notation is a formal and precise
121 way to communicate the data semantics to human readers;
122\layout Itemize
123
124The ASN.1 specifications may be used as input for automatic compilers which
125 produce the code for some target language (C, C++, Java, etc) to encode
126 and decode the data according to some encoding rules (which are also defined
127 by the ASN.1 standard).
128\layout Standard
129
130Consider the following example:
131\layout LyX-Code
132
133Rectangle ::= SEQUENCE {
134\layout LyX-Code
135
136 height INTEGER,
137\layout LyX-Code
138
139 width INTEGER
140\layout LyX-Code
141
142}
143\layout Standard
144
145This ASN.1 specification describes a constructed type,
146\emph on
147Rectangle
148\emph default
149, containing two integer fields.
150 This specification may tell the reader that there is this kind of data
151 structure and that some entity may be prepared to send or receive it.
152 The question on
153\emph on
154how
155\emph default
156 that entity is going to send or receive the
157\emph on
158encoded data
159\emph default
160 is outside the scope of ASN.1.
161 For example, this data structure may be encoded according to some encoding
162 rules and sent to the destination using the TCP protocol.
163 The ASN.1 specifies several ways of encoding (or
164\begin_inset Quotes sld
165\end_inset
166
167serializing
168\begin_inset Quotes srd
169\end_inset
170
171, or
172\begin_inset Quotes sld
173\end_inset
174
175marshaling
176\begin_inset Quotes srd
177\end_inset
178
179) the data: BER, CER, DER and XER, some of them which will be described
180 later.
181\layout Standard
182
183The complete specification must be wrapped in a module, which looks like
184 this:
185\layout LyX-Code
186
187UsageExampleModule1
188\layout LyX-Code
189
190 { iso org(3) dod(6) internet(1) private(4)
191\layout LyX-Code
192
193 enterprise(1) spelio(9363) software(1)
194\layout LyX-Code
195
196 asn1c(5) docs(2) usage(1) 1 }
197\layout LyX-Code
198
Lev Walkin26587ab2004-08-23 15:12:04 +0000199 DEFINITIONS AUTOMATIC TAGS ::=
Lev Walkin84291e02004-06-03 03:49:45 +0000200\layout LyX-Code
201
202BEGIN
203\layout LyX-Code
204
205
206\layout LyX-Code
207
208-- This is a comment which describes nothing.
209\layout LyX-Code
210
211Rectangle ::= SEQUENCE {
212\layout LyX-Code
213
214 height INTEGER, -- Height of the rectangle
215\layout LyX-Code
216
Lev Walkin26587ab2004-08-23 15:12:04 +0000217 width INTEGER -- Width of the rectangle
Lev Walkin84291e02004-06-03 03:49:45 +0000218\layout LyX-Code
219
220}
221\layout LyX-Code
222
223
224\layout LyX-Code
225
226END
227\layout Standard
228
229The module header consists of module name (UsageExampleModule1), the module
Lev Walkin26587ab2004-08-23 15:12:04 +0000230 object identifier ({...}), a keyword
Lev Walkin84291e02004-06-03 03:49:45 +0000231\begin_inset Quotes sld
232\end_inset
233
Lev Walkin26587ab2004-08-23 15:12:04 +0000234DEFINITIONS
235\begin_inset Quotes srd
236\end_inset
237
238, a set of module flags (AUTOMATIC TAGS) and
239\begin_inset Quotes sld
240\end_inset
241
242::= BEGIN
Lev Walkin84291e02004-06-03 03:49:45 +0000243\begin_inset Quotes srd
244\end_inset
245
246.
247 The module ends with an
248\begin_inset Quotes sld
249\end_inset
250
251END
252\begin_inset Quotes srd
253\end_inset
254
255 statement.
256\layout Section
257
258Some of the ASN.1 Basic Types
259\layout Subsection
260
261The BOOLEAN type
262\layout Standard
263
264The BOOLEAN type models the simple binary TRUE/FALSE, YES/NO, ON/OFF or
265 a similar kind of two-way choice.
266\layout Subsection
267
268The INTEGER type
269\layout Standard
270
271The INTEGER type is a signed natural number type without any restrictions
272 on its size.
273 If the automatic checking on INTEGER value bounds are necessary, the subtype
274 constraints must be used.
275\layout LyX-Code
276
277SimpleInteger ::= INTEGER
278\layout LyX-Code
279
Lev Walkin26587ab2004-08-23 15:12:04 +0000280
281\layout LyX-Code
282
Lev Walkin84291e02004-06-03 03:49:45 +0000283-- An integer with a very limited range
284\layout LyX-Code
285
286SmallInt ::= INTEGER (0..127)
287\layout LyX-Code
288
Lev Walkin26587ab2004-08-23 15:12:04 +0000289
290\layout LyX-Code
291
Lev Walkin84291e02004-06-03 03:49:45 +0000292-- Integer, negative
293\layout LyX-Code
294
295NegativeInt ::= INTEGER (MIN..0)
296\layout Subsection
297
298The ENUMERATED type
299\layout Standard
300
301The ENUMERATED type is semantically equivalent to the INTEGER type with
302 some integer values explicitly named.
303\layout LyX-Code
304
305FruitId ::= ENUMERATED { apple(1), orange(2) }
306\layout LyX-Code
307
Lev Walkin26587ab2004-08-23 15:12:04 +0000308
309\layout LyX-Code
310
Lev Walkin84291e02004-06-03 03:49:45 +0000311-- The numbers in braces are optional,
312\layout LyX-Code
313
Lev Walkin26587ab2004-08-23 15:12:04 +0000314-- the enumeration can be performed
Lev Walkin84291e02004-06-03 03:49:45 +0000315\layout LyX-Code
316
317-- automatically by the compiler
318\layout LyX-Code
319
320ComputerOSType ::= ENUMERATED {
321\layout LyX-Code
322
323 FreeBSD, -- will be 0
324\layout LyX-Code
325
326 Windows, -- will be 1
327\layout LyX-Code
328
329 Solaris(5), -- will remain 5
330\layout LyX-Code
331
332 Linux, -- will be 6
333\layout LyX-Code
334
335 MacOS -- will be 7
336\layout LyX-Code
337
338}
339\layout Subsection
340
341The OCTET STRING type
342\layout Standard
343
344This type models the sequence of 8-bit bytes.
345 This may be used to transmit some opaque data or data serialized by other
346 types of encoders (i.e.
347 video file, photo picture, etc).
348\layout Subsection
349
350The OBJECT IDENTIFIER type
351\layout Standard
352
353The OBJECT IDENTIFIER is used to represent the unique identifier of any
354 object, starting from the very root of the registration tree.
355 If your organization needs to uniquely identify something (a router, a
356 room, a person, a standard, or whatever), you are encouraged to get your
357 own identification subtree at
358\begin_inset LatexCommand \htmlurl{http://www.iana.org/protocols/forms.htm}
359
360\end_inset
361
362.
363\layout Standard
364
365For example, the very first ASN.1 module in this document has the following
366 OBJECT IDENTIFIER: 1 3 6 1 4 1 9363 1 5 2 1 1.
367\layout LyX-Code
368
369ExampleOID ::= OBJECT IDENTIFIER
370\layout LyX-Code
371
Lev Walkin26587ab2004-08-23 15:12:04 +0000372
373\layout LyX-Code
374
Lev Walkin84291e02004-06-03 03:49:45 +0000375usageExampleModule1-oid ExampleOID
376\layout LyX-Code
377
378 ::= { 1 3 6 1 4 1 9363 1 5 2 1 1 }
379\layout LyX-Code
380
Lev Walkin26587ab2004-08-23 15:12:04 +0000381
382\layout LyX-Code
383
Lev Walkin84291e02004-06-03 03:49:45 +0000384-- An identifier of the Internet.
385\layout LyX-Code
386
387internet-id OBJECT IDENTIFIER
388\layout LyX-Code
389
390 ::= { iso(1) identified-organization(3)
391\layout LyX-Code
392
393 dod(6) internet(1) }
394\layout Standard
395
396As you see, names are optional.
397\layout Subsection
398
399The RELATIVE-OID type
400\layout Standard
401
402The RELATIVE-OID type has the semantics of a subtree of an OBJECT IDENTIFIER.
403 There may be no need to repeat the whole sequence of numbers from the root
404 of the registration tree where the only thing of interest is some of the
405 tree's subsequence.
406\layout LyX-Code
407
408this-document RELATIVE-OID ::= { docs(2) usage(1) }
409\layout LyX-Code
410
Lev Walkin26587ab2004-08-23 15:12:04 +0000411
412\layout LyX-Code
413
Lev Walkin84291e02004-06-03 03:49:45 +0000414this-example RELATIVE-OID ::= {
415\layout LyX-Code
416
417 this-document assorted-examples(0) this-example(1) }
418\layout Section
419
420Some of the ASN.1 String Types
421\layout Subsection
422
423The IA5String type
424\layout Standard
425
426This is essentially the ASCII, with 128 character codes available (7 lower
Lev Walkin26587ab2004-08-23 15:12:04 +0000427 bits of an 8-bit byte).
Lev Walkin84291e02004-06-03 03:49:45 +0000428\layout Subsection
429
430The UTF8String type
431\layout Standard
432
433This is the character string which encodes the full Unicode range (4 bytes)
434 using multibyte character sequences.
435\layout Subsection
436
437The NumericString type
438\layout Standard
439
440This type represents the character string with the alphabet consisting of
441 numbers (
442\begin_inset Quotes sld
443\end_inset
444
4450
446\begin_inset Quotes srd
447\end_inset
448
449 to
450\begin_inset Quotes sld
451\end_inset
452
4539
454\begin_inset Quotes srd
455\end_inset
456
457) and a space.
458\layout Subsection
459
460The PrintableString type
461\layout Standard
462
463The character string with the following alphabet: space,
464\begin_inset Quotes sld
465\end_inset
466
467
468\series bold
469'
470\series default
471
472\begin_inset Quotes srd
473\end_inset
474
475 (single quote),
476\begin_inset Quotes sld
477\end_inset
478
479
480\series bold
481(
482\series default
483
484\begin_inset Quotes sld
485\end_inset
486
487,
488\begin_inset Quotes sld
489\end_inset
490
491
492\series bold
493)
494\series default
495
496\begin_inset Quotes srd
497\end_inset
498
499,
500\begin_inset Quotes sld
501\end_inset
502
503
504\series bold
505+
506\series default
507
508\begin_inset Quotes srd
509\end_inset
510
511,
512\begin_inset Quotes sld
513\end_inset
514
515,
516\begin_inset Quotes srd
517\end_inset
518
519 (comma),
520\begin_inset Quotes sld
521\end_inset
522
523
524\series bold
525-
526\series default
527
528\begin_inset Quotes srd
529\end_inset
530
531,
532\begin_inset Quotes sld
533\end_inset
534
535
536\series bold
537.
538\series default
539
540\begin_inset Quotes srd
541\end_inset
542
543,
544\begin_inset Quotes sld
545\end_inset
546
547
548\series bold
549/
550\series default
551
552\begin_inset Quotes srd
553\end_inset
554
555, digits (
556\begin_inset Quotes sld
557\end_inset
558
5590
560\begin_inset Quotes srd
561\end_inset
562
563 to
564\begin_inset Quotes sld
565\end_inset
566
5679
568\begin_inset Quotes srd
569\end_inset
570
571),
572\begin_inset Quotes sld
573\end_inset
574
575
576\series bold
577:
578\series default
579
580\begin_inset Quotes srd
581\end_inset
582
583,
584\begin_inset Quotes sld
585\end_inset
586
587
588\series bold
589=
590\series default
591
592\begin_inset Quotes srd
593\end_inset
594
595,
596\begin_inset Quotes sld
597\end_inset
598
599
600\series bold
601?
602\series default
603
604\begin_inset Quotes srd
605\end_inset
606
607, upper-case and lower-case letters (
608\begin_inset Quotes sld
609\end_inset
610
611A
612\begin_inset Quotes srd
613\end_inset
614
615 to
616\begin_inset Quotes sld
617\end_inset
618
619Z
620\begin_inset Quotes srd
621\end_inset
622
623 and
624\begin_inset Quotes sld
625\end_inset
626
627a
628\begin_inset Quotes srd
629\end_inset
630
631 to
632\begin_inset Quotes sld
633\end_inset
634
635z
636\begin_inset Quotes srd
637\end_inset
638
639)
640\layout Subsection
641
642The VisibleString type
643\layout Standard
644
645The character string with the alphabet which is more or less a subset of
646 ASCII between space and
647\begin_inset Quotes sld
648\end_inset
649
Lev Walkin26587ab2004-08-23 15:12:04 +0000650
651\series bold
Lev Walkin84291e02004-06-03 03:49:45 +0000652~
Lev Walkin26587ab2004-08-23 15:12:04 +0000653\series default
654
Lev Walkin84291e02004-06-03 03:49:45 +0000655\begin_inset Quotes srd
656\end_inset
657
658 (tilde).
Lev Walkin26587ab2004-08-23 15:12:04 +0000659 Alternatively, the alphabet may be described as the PrintableString alphabet
660 presented earlier, plus the following characters:
Lev Walkin84291e02004-06-03 03:49:45 +0000661\begin_inset Quotes sld
662\end_inset
663
664
665\series bold
666!
667\series default
668
669\begin_inset Quotes srd
670\end_inset
671
672,
673\begin_inset Quotes sld
674\end_inset
675
676
677\series bold
678
679\begin_inset Quotes srd
680\end_inset
681
682
683\series default
684
685\begin_inset Quotes srd
686\end_inset
687
688,
689\begin_inset Quotes sld
690\end_inset
691
692
693\series bold
694#
695\series default
696
697\begin_inset Quotes srd
698\end_inset
699
700,
701\begin_inset Quotes sld
702\end_inset
703
704
705\series bold
706$
707\series default
708
709\begin_inset Quotes srd
710\end_inset
711
712,
713\begin_inset Quotes sld
714\end_inset
715
716
717\series bold
718%
719\series default
720
721\begin_inset Quotes srd
722\end_inset
723
724,
725\begin_inset Quotes sld
726\end_inset
727
728
729\series bold
730&
731\series default
732
733\begin_inset Quotes srd
734\end_inset
735
736,
737\begin_inset Quotes sld
738\end_inset
739
740
741\series bold
742*
743\series default
744
745\begin_inset Quotes srd
746\end_inset
747
748,
749\begin_inset Quotes sld
750\end_inset
751
752
753\series bold
754;
755\series default
756
757\begin_inset Quotes srd
758\end_inset
759
760,
761\begin_inset Quotes sld
762\end_inset
763
764
765\series bold
766<
767\series default
768
769\begin_inset Quotes srd
770\end_inset
771
772,
773\begin_inset Quotes sld
774\end_inset
775
776
777\series bold
778>
779\series default
780
781\begin_inset Quotes srd
782\end_inset
783
784,
785\begin_inset Quotes sld
786\end_inset
787
788
789\series bold
790[
791\series default
792
793\begin_inset Quotes srd
794\end_inset
795
796,
797\begin_inset Quotes sld
798\end_inset
799
800
801\series bold
802
803\backslash
804
805\series default
806
807\begin_inset Quotes srd
808\end_inset
809
810,
811\begin_inset Quotes sld
812\end_inset
813
814
815\series bold
816]
817\series default
818
819\begin_inset Quotes srd
820\end_inset
821
822,
823\begin_inset Quotes sld
824\end_inset
825
826
827\series bold
828^
829\series default
830
831\begin_inset Quotes srd
832\end_inset
833
834,
835\begin_inset Quotes sld
836\end_inset
837
838
839\series bold
840_
841\series default
842
843\begin_inset Quotes srd
844\end_inset
845
846,
847\begin_inset Quotes sld
848\end_inset
849
850
851\series bold
852`
853\series default
854
855\begin_inset Quotes srd
856\end_inset
857
858 (single left quote),
859\begin_inset Quotes sld
860\end_inset
861
862
863\series bold
864{
865\series default
866
867\begin_inset Quotes srd
868\end_inset
869
870,
871\begin_inset Quotes sld
872\end_inset
873
874
875\series bold
876|
877\series default
878
879\begin_inset Quotes srd
880\end_inset
881
882,
883\begin_inset Quotes sld
884\end_inset
885
886
887\series bold
888}
889\series default
890
891\begin_inset Quotes srd
892\end_inset
893
894,
895\begin_inset Quotes sld
896\end_inset
897
Lev Walkin26587ab2004-08-23 15:12:04 +0000898
899\series bold
Lev Walkin84291e02004-06-03 03:49:45 +0000900~
Lev Walkin26587ab2004-08-23 15:12:04 +0000901\series default
902
Lev Walkin84291e02004-06-03 03:49:45 +0000903\begin_inset Quotes srd
904\end_inset
905
906.
907\layout Section
908
909ASN.1 Constructed Types
910\layout Subsection
911
912The SEQUENCE type
913\layout Standard
914
915This is an ordered collection of other simple or constructed types.
916 The SEQUENCE constructed type resembles the C
917\begin_inset Quotes sld
918\end_inset
919
920struct
921\begin_inset Quotes srd
922\end_inset
923
924 statement.
925\layout LyX-Code
926
927Address ::= SEQUENCE {
928\layout LyX-Code
929
930 -- The apartment number may be omitted
931\layout LyX-Code
932
933 apartmentNumber NumericString OPTIONAL,
934\layout LyX-Code
935
936 streetName PrintableString,
937\layout LyX-Code
938
939 cityName PrintableString,
940\layout LyX-Code
941
942 stateName PrintableString,
943\layout LyX-Code
944
945 -- This one may be omitted too
946\layout LyX-Code
947
948 zipNo NumericString OPTIONAL
949\layout LyX-Code
950
951}
952\layout Subsection
953
954The SET type
955\layout Standard
956
957This is a collection of other simple or constructed types.
958 Ordering is not important.
959 The data may arrive in the order which is different from the order of specifica
960tion.
961 Data is encoded in the order not necessarily corresponding to the order
962 of specification.
963\layout Subsection
964
965The CHOICE type
966\layout Standard
967
968This type is just a choice between the subtypes specified in it.
969 The CHOICE type contains at most one of the subtypes specified, and it
970 is always implicitly known which choice is being decoded or encoded.
971 This one resembles the C
972\begin_inset Quotes sld
973\end_inset
974
975union
976\begin_inset Quotes srd
977\end_inset
978
979 statement.
980\layout Standard
981
982The following type defines a response code, which may be either an integer
983 code or a boolean
984\begin_inset Quotes sld
985\end_inset
986
987true
988\begin_inset Quotes srd
989\end_inset
990
991/
992\begin_inset Quotes srd
993\end_inset
994
995false
996\begin_inset Quotes srd
997\end_inset
998
999 code.
1000\layout LyX-Code
1001
1002ResponseCode ::= CHOICE {
1003\layout LyX-Code
1004
1005 intCode INTEGER,
1006\layout LyX-Code
1007
1008 boolCode BOOLEAN
1009\layout LyX-Code
1010
1011}
1012\layout LyX-Code
1013
1014\layout Subsection
1015
1016The SEQUENCE OF type
1017\layout Standard
1018
1019This one is the list (array) of simple or constructed types:
1020\layout LyX-Code
1021
1022-- Example 1
1023\layout LyX-Code
1024
1025ManyIntegers ::= SEQUENCE OF INTEGER
1026\layout LyX-Code
1027
Lev Walkin26587ab2004-08-23 15:12:04 +00001028
1029\layout LyX-Code
1030
Lev Walkin84291e02004-06-03 03:49:45 +00001031-- Example 2
1032\layout LyX-Code
1033
1034ManyRectangles ::= SEQUENCE OF Rectangle
1035\layout LyX-Code
1036
Lev Walkin26587ab2004-08-23 15:12:04 +00001037
1038\layout LyX-Code
1039
Lev Walkin84291e02004-06-03 03:49:45 +00001040-- More complex example:
1041\layout LyX-Code
1042
1043-- an array of structures defined in place.
1044\layout LyX-Code
1045
1046ManyCircles ::= SEQUENCE OF SEQUENCE {
1047\layout LyX-Code
1048
1049 radius INTEGER
1050\layout LyX-Code
1051
1052 }
1053\layout Subsection
1054
1055The SET OF type
1056\layout Standard
1057
1058The SET OF type models the bag of structures.
1059 It resembles the SEQUENCE OF type, but the order is not important: i.e.
1060 the elements may arrive in the order which is not necessarily the same
1061 as the in-memory order on the remote machines.
1062\layout LyX-Code
1063
1064-- A set of structures defined elsewhere
1065\layout LyX-Code
1066
1067SetOfApples :: SET OF Apple
1068\layout LyX-Code
1069
Lev Walkin26587ab2004-08-23 15:12:04 +00001070
1071\layout LyX-Code
1072
Lev Walkin84291e02004-06-03 03:49:45 +00001073-- Set of integers encoding the kind of a fruit
1074\layout LyX-Code
1075
1076FruitBag ::= SET OF ENUMERATED { apple, orange }
Lev Walkin4a83dd52004-08-07 05:00:07 +00001077\layout Part
1078
1079Using the ASN.1 Compiler
Lev Walkin84291e02004-06-03 03:49:45 +00001080\layout Chapter
1081
Lev Walkin4a83dd52004-08-07 05:00:07 +00001082Introduction to the ASN.1 Compiler
Lev Walkin84291e02004-06-03 03:49:45 +00001083\layout Standard
1084
1085The purpose of the ASN.1 compiler, of which this document is part, is to
1086 convert the ASN.1 specifications to some other target language (currently,
1087 only C is supported
1088\begin_inset Foot
1089collapsed false
1090
1091\layout Standard
1092
1093C++ is
1094\begin_inset Quotes sld
1095\end_inset
1096
1097supported
1098\begin_inset Quotes srd
1099\end_inset
1100
Lev Walkin26587ab2004-08-23 15:12:04 +00001101 too, as long as an class-based approach is not a definitive factor.
Lev Walkin84291e02004-06-03 03:49:45 +00001102\end_inset
1103
1104).
1105 The compiler reads the specification and emits a series of target language
1106 structures and surrounding maintenance code.
1107 For example, the C structure which may be created by compiler to represent
1108 the simple
1109\emph on
1110Rectangle
1111\emph default
1112 specification defined earlier in this document, may look like this
1113\begin_inset Foot
1114collapsed false
1115
1116\layout Standard
1117
1118
1119\emph on
Lev Walkin99301892004-09-14 12:48:17 +00001120-fnative-types
Lev Walkin84291e02004-06-03 03:49:45 +00001121\emph default
1122 compiler option is used to produce basic C
1123\emph on
1124int
1125\emph default
Lev Walkin26587ab2004-08-23 15:12:04 +00001126 types instead of infinite width INTEGER_t structures.
1127 See Table
1128\begin_inset LatexCommand \vref{cap:asn1c-cmdopts}
1129
1130\end_inset
1131
1132.
Lev Walkin84291e02004-06-03 03:49:45 +00001133\end_inset
1134
1135:
1136\layout LyX-Code
1137
1138typedef struct Rectangle_s {
1139\layout LyX-Code
1140
1141 int height;
1142\layout LyX-Code
1143
1144 int width;
1145\layout LyX-Code
1146
1147} Rectangle_t;
1148\layout Standard
1149
1150This would not be of much value for such a simple specification, so the
1151 compiler goes further and actually produces the code which fills in this
Lev Walkin26587ab2004-08-23 15:12:04 +00001152 structure by parsing the opaque binary
Lev Walkin84291e02004-06-03 03:49:45 +00001153\begin_inset Foot
Lev Walkin26587ab2004-08-23 15:12:04 +00001154collapsed true
Lev Walkin84291e02004-06-03 03:49:45 +00001155
1156\layout Standard
1157
1158BER, CER and DER encodings are binary.
1159 However, the XER encoding is text (XML) based.
1160\end_inset
1161
1162 data provided in some buffer.
1163 It also produces the code that takes this structure as an argument and
1164 performs structure serialization by emitting a series of bytes.
Lev Walkin26587ab2004-08-23 15:12:04 +00001165\layout Chapter
Lev Walkin84291e02004-06-03 03:49:45 +00001166
1167Quick start
1168\layout Standard
1169
Lev Walkin26587ab2004-08-23 15:12:04 +00001170After building and installing the compiler, the
1171\emph on
1172asn1c
1173\begin_inset Foot
1174collapsed false
1175
1176\layout Standard
1177
1178The 1 symbol in asn
1179\series bold
11801
1181\series default
1182c is a digit, not an
1183\begin_inset Quotes sld
1184\end_inset
1185
1186ell
1187\begin_inset Quotes srd
1188\end_inset
1189
1190 letter.
1191\end_inset
1192
1193
1194\emph default
1195 command may be used to compile the ASN.1 specification
Lev Walkin84291e02004-06-03 03:49:45 +00001196\begin_inset Foot
1197collapsed false
1198
1199\layout Standard
1200
1201This is probably
1202\series bold
1203not
1204\series default
1205 what you want to try out right now -- read through the rest of this chapter
Lev Walkin26587ab2004-08-23 15:12:04 +00001206 to find out about
1207\series bold
1208-P
1209\series default
1210 and
1211\series bold
1212-R
1213\series default
1214 options.
Lev Walkin84291e02004-06-03 03:49:45 +00001215\end_inset
1216
1217:
1218\layout LyX-Code
1219
1220asn1c
1221\emph on
1222<spec.asn1>
1223\layout Standard
1224
Lev Walkin26587ab2004-08-23 15:12:04 +00001225If several specifications contain interdependencies, all of the files must
1226 be specified altogether:
Lev Walkin84291e02004-06-03 03:49:45 +00001227\layout LyX-Code
1228
1229asn1c
1230\emph on
1231<spec1.asn1> <spec2.asn1> ...
1232\layout Standard
1233
Lev Walkin26587ab2004-08-23 15:12:04 +00001234The compiler
1235\series bold
1236-E
1237\series default
1238 and
1239\series bold
1240-EF
1241\series default
1242 options are used for testing the parser and the semantic fixer, respectively.
1243 These options will instruct the compiler to dump out the parsed (and fixed,
1244 if
1245\series bold
1246-F
1247\series default
1248 is involved) ASN.1 specification as it was "understood" by the compiler.
1249 It might be useful to check whether a particular syntactic construction
Lev Walkin84291e02004-06-03 03:49:45 +00001250 is properly supported by the compiler.
1251\layout LyX-Code
1252
Lev Walkin26587ab2004-08-23 15:12:04 +00001253asn1c
1254\series bold
1255-EF
1256\series default
1257
Lev Walkin84291e02004-06-03 03:49:45 +00001258\emph on
1259<spec-to-test.asn1>
1260\layout Standard
1261
Lev Walkin26587ab2004-08-23 15:12:04 +00001262The
1263\series bold
1264-P
1265\series default
1266 option is used to dump the compiled output on the screen instead of creating
1267 a bunch of .c and .h files on disk in the current directory.
1268 You would probably want to start with
1269\series bold
1270-P
1271\series default
1272 option instead of creating a mess in your current directory.
1273 Another option,
1274\series bold
1275-R
1276\series default
1277, asks compiler to only generate the files which need to be generated, and
1278 supress linking in the numerous support files.
1279\layout Standard
1280
1281Print the compiled output instead of creating multiple source files:
1282\layout LyX-Code
1283
1284asn1c
1285\series bold
1286-P
1287\series default
1288
1289\emph on
1290<spec-to-compile-and-print.asn1>
1291\layout LyX-Code
1292
1293\layout Chapter
1294
1295Using the ASN.1 Compiler
Lev Walkin84291e02004-06-03 03:49:45 +00001296\layout Section
1297
Lev Walkin26587ab2004-08-23 15:12:04 +00001298Command-line options
1299\layout Standard
1300
1301The Table
1302\begin_inset LatexCommand \vref{cap:asn1c-cmdopts}
1303
1304\end_inset
1305
1306 summarizes various options affecting the compiler's behavior.
1307\layout Standard
1308
1309
1310\begin_inset Float table
1311wide false
Lev Walkindd32b592004-09-06 08:07:29 +00001312collapsed false
Lev Walkin26587ab2004-08-23 15:12:04 +00001313
1314\layout Standard
1315
1316
1317\begin_inset Tabular
Lev Walkin35d446b2004-09-24 20:56:07 +00001318<lyxtabular version="3" rows="20" columns="2">
Lev Walkin26587ab2004-08-23 15:12:04 +00001319<features>
1320<column alignment="left" valignment="top" leftline="true" width="0">
1321<column alignment="block" valignment="top" leftline="true" rightline="true" width="3in">
1322<row topline="true" bottomline="true">
1323<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1324\begin_inset Text
1325
1326\layout Standard
1327
1328
1329\series bold
1330Overall Options
1331\end_inset
1332</cell>
1333<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1334\begin_inset Text
1335
1336\layout Standard
1337
1338
1339\series bold
1340Description
1341\end_inset
1342</cell>
1343</row>
1344<row topline="true">
1345<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1346\begin_inset Text
1347
1348\layout Standard
1349
1350-E
1351\end_inset
1352</cell>
1353<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1354\begin_inset Text
1355
1356\layout Standard
1357
1358
1359\size small
1360Stop after the parsing stage and print the reconstructed ASN.1 specification
1361 code to the standard output.
1362\end_inset
1363</cell>
1364</row>
1365<row topline="true">
1366<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1367\begin_inset Text
1368
1369\layout Standard
1370
1371-F
1372\end_inset
1373</cell>
1374<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1375\begin_inset Text
1376
1377\layout Standard
1378
1379
1380\size small
1381Used together with -E, instructs the compiler to stop after the ASN.1 syntax
1382 tree fixing stage and dump the reconstructed ASN.1 specification to the
1383 standard output.
1384\end_inset
1385</cell>
1386</row>
1387<row topline="true">
1388<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1389\begin_inset Text
1390
1391\layout Standard
1392
1393-P
1394\end_inset
1395</cell>
1396<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1397\begin_inset Text
1398
1399\layout Standard
1400
1401
1402\size small
1403Dump the compiled output to the standard output instead of cre- ating the
1404 target language files on disk.
1405\end_inset
1406</cell>
1407</row>
1408<row topline="true">
1409<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1410\begin_inset Text
1411
1412\layout Standard
1413
1414-R
1415\end_inset
1416</cell>
1417<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1418\begin_inset Text
1419
1420\layout Standard
1421
1422
1423\size small
1424Restrict the compiler to generate only the ASN.1 tables, omit- ting the usual
1425 support code.
1426\end_inset
1427</cell>
1428</row>
Lev Walkin35d446b2004-09-24 20:56:07 +00001429<row topline="true" bottomline="true">
Lev Walkin26587ab2004-08-23 15:12:04 +00001430<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1431\begin_inset Text
1432
1433\layout Standard
1434
1435-S
1436\emph on
1437<directory>
1438\end_inset
1439</cell>
1440<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1441\begin_inset Text
1442
1443\layout Standard
1444
1445
1446\size small
1447Use the specified directory with ASN.1 skeleton files.
1448\end_inset
1449</cell>
1450</row>
Lev Walkin26587ab2004-08-23 15:12:04 +00001451<row topline="true">
1452<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1453\begin_inset Text
1454
1455\layout Standard
1456
1457
1458\series bold
1459Warning Options
1460\end_inset
1461</cell>
1462<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1463\begin_inset Text
1464
1465\layout Standard
1466
1467
1468\series bold
1469Description
1470\end_inset
1471</cell>
1472</row>
1473<row topline="true">
1474<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1475\begin_inset Text
1476
1477\layout Standard
1478
1479-Werror
1480\end_inset
1481</cell>
1482<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1483\begin_inset Text
1484
1485\layout Standard
1486
1487
1488\size small
1489Treat warnings as errors; abort if any warning is produced.
1490\end_inset
1491</cell>
1492</row>
1493<row topline="true">
1494<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1495\begin_inset Text
1496
1497\layout Standard
1498
1499-Wdebug-lexer
1500\end_inset
1501</cell>
1502<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1503\begin_inset Text
1504
1505\layout Standard
1506
1507
1508\size small
1509Enable lexer debugging during the ASN.1 parsing stage.
1510\end_inset
1511</cell>
1512</row>
1513<row topline="true">
1514<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1515\begin_inset Text
1516
1517\layout Standard
1518
1519-Wdebug-fixer
1520\end_inset
1521</cell>
1522<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1523\begin_inset Text
1524
1525\layout Standard
1526
1527
1528\size small
1529 Enable ASN.1 syntax tree fixer debugging during the fixing stage.
1530\end_inset
1531</cell>
1532</row>
1533<row topline="true" bottomline="true">
1534<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1535\begin_inset Text
1536
1537\layout Standard
1538
1539-Wdebug-compiler
1540\end_inset
1541</cell>
1542<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1543\begin_inset Text
1544
1545\layout Standard
1546
1547
1548\size small
1549Enable debugging during the actual compile time.
1550\end_inset
1551</cell>
1552</row>
1553<row topline="true">
1554<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1555\begin_inset Text
1556
1557\layout Standard
1558
1559
1560\series bold
1561Language Options
1562\end_inset
1563</cell>
1564<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1565\begin_inset Text
1566
1567\layout Standard
1568
1569
1570\series bold
1571Description
1572\end_inset
1573</cell>
1574</row>
1575<row topline="true">
1576<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1577\begin_inset Text
1578
1579\layout Standard
1580
Lev Walkindd32b592004-09-06 08:07:29 +00001581-fall-defs-global
1582\end_inset
1583</cell>
1584<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1585\begin_inset Text
1586
1587\layout Standard
1588
1589Normally the compiler hides the definitions (asn1_DEF_xxx) of the inner
1590 structure elements (members of SEQUENCE, SET and other types).
1591 This option makes all such definitions global.
1592 Enabling this option may pollute the namespace by making lots of asn1_DEF_xxx
1593 structures globally visible, but will allow you to manipulate (encode and
1594 decode) the individual members of any complex ASN.1 structure.
1595\end_inset
1596</cell>
1597</row>
1598<row topline="true">
1599<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1600\begin_inset Text
1601
1602\layout Standard
1603
Lev Walkin26587ab2004-08-23 15:12:04 +00001604-fbless-SIZE
1605\end_inset
1606</cell>
1607<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1608\begin_inset Text
1609
1610\layout Standard
1611
1612
1613\size small
1614Allow SIZE() constraint for INTEGER, ENUMERATED, and other types for which
1615 this constraint is normally prohibited by the standard.
1616 This is a violation of an ASN.1 standard and compiler may fail to produce
1617 the meaningful code.
1618\end_inset
1619</cell>
1620</row>
1621<row topline="true">
1622<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1623\begin_inset Text
1624
1625\layout Standard
1626
Lev Walkin99301892004-09-14 12:48:17 +00001627-fnative-types
Lev Walkin26587ab2004-08-23 15:12:04 +00001628\end_inset
1629</cell>
1630<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1631\begin_inset Text
1632
1633\layout Standard
1634
1635
1636\size small
Lev Walkin99301892004-09-14 12:48:17 +00001637Use the native machine's data types (int, double) whenever possible, instead
1638 of the compound ASN.1 INTEGER_t, ENUMERATED_t and REAL_t types.
Lev Walkin26587ab2004-08-23 15:12:04 +00001639
1640\end_inset
1641</cell>
1642</row>
1643<row topline="true">
1644<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1645\begin_inset Text
1646
1647\layout Standard
1648
1649-funnamed-unions
1650\end_inset
1651</cell>
1652<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1653\begin_inset Text
1654
1655\layout Standard
1656
1657
1658\size small
1659Enable unnamed unions in the definitions of target language's structures.
1660\end_inset
1661</cell>
1662</row>
1663<row topline="true" bottomline="true">
1664<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1665\begin_inset Text
1666
1667\layout Standard
1668
1669-ftypes88
1670\end_inset
1671</cell>
1672<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1673\begin_inset Text
1674
1675\layout Standard
1676
1677
1678\size small
1679Use only ASN.1:1988 embedded types.
1680\end_inset
1681</cell>
1682</row>
1683<row topline="true">
1684<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1685\begin_inset Text
1686
1687\layout Standard
1688
1689
1690\series bold
1691Output Options
1692\end_inset
1693</cell>
1694<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1695\begin_inset Text
1696
1697\layout Standard
1698
1699
1700\series bold
1701Description
1702\end_inset
1703</cell>
1704</row>
1705<row topline="true">
1706<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1707\begin_inset Text
1708
1709\layout Standard
1710
1711-print-constraints
1712\end_inset
1713</cell>
1714<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1715\begin_inset Text
1716
1717\layout Standard
1718
1719
1720\size small
1721When -EF are also specified, this option forces the compiler to explain
1722 its internal understanding of subtype constraints.
1723\end_inset
1724</cell>
1725</row>
1726<row topline="true" bottomline="true">
1727<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1728\begin_inset Text
1729
1730\layout Standard
1731
1732-print-lines
1733\end_inset
1734</cell>
1735<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1736\begin_inset Text
1737
1738\layout Standard
1739
1740
1741\size small
1742Generate "-- #line" comments in -E output.
1743\end_inset
1744</cell>
1745</row>
1746</lyxtabular>
1747
1748\end_inset
1749
1750
1751\layout Caption
1752
1753
1754\begin_inset LatexCommand \label{cap:asn1c-cmdopts}
1755
1756\end_inset
1757
1758The list of asn1c command line options
1759\end_inset
1760
1761
1762\layout Section
Lev Walkin84291e02004-06-03 03:49:45 +00001763
1764Recognizing compiler output
1765\layout Standard
1766
1767After compiling, the following entities will be created in your current
1768 directory:
1769\layout Itemize
1770
1771A set of .c and .h files, generally a single pair for each type defined in
1772 the ASN.1 specifications.
1773 These files will be named similarly to the ASN.1 types (
1774\emph on
1775Rectangle.c
1776\emph default
1777 and
1778\emph on
1779Rectangle.h
1780\emph default
1781 for the specification defined in the beginning of this document).
1782\layout Itemize
1783
1784A set of helper .c and .h files which contain generic encoders, decoders and
1785 other useful routines.
Lev Walkin26587ab2004-08-23 15:12:04 +00001786 There will be quite a few of them, some of them even are not always necessary,
1787 but the overall amount of code after compiling will be rather small anyway.
Lev Walkin84291e02004-06-03 03:49:45 +00001788\layout Standard
1789
1790It is your responsibility to create .c file with the
1791\emph on
1792 int main()
1793\emph default
1794 routine and the Makefile (if needed).
1795 Compiler helps you with the latter by creating the Makefile.am.sample, containing
1796 the skeleton definition for the automake, should you want to use autotools.
1797\layout Standard
1798
1799In other words, after compiling the Rectangle module, you have the following
1800 set of files: { Makefile.am.sample, Rectangle.c, Rectangle.h,
1801\series bold
1802\SpecialChar \ldots{}
1803
1804\series default
1805 }, where
1806\series bold
1807
1808\begin_inset Quotes sld
1809\end_inset
1810
1811\SpecialChar \ldots{}
1812
1813\begin_inset Quotes srd
1814\end_inset
1815
1816
1817\series default
1818 stands for the set of additional
1819\begin_inset Quotes sld
1820\end_inset
1821
1822helper
1823\begin_inset Quotes srd
1824\end_inset
1825
1826 files created by the compiler.
1827 If you add the simple file with the
1828\emph on
1829int main()
1830\emph default
1831 routine, it would even be possible to compile everything with the single
1832 instruction:
1833\layout LyX-Code
1834
1835cc -o rectangle *.c # It could be
1836\emph on
1837that
1838\emph default
1839 simple
1840\begin_inset Foot
1841collapsed false
1842
1843\layout Standard
1844
1845Provided that you've also created a .c file with the
1846\emph on
1847int main()
1848\emph default
1849 routine.
1850\end_inset
1851
1852
Lev Walkin26587ab2004-08-23 15:12:04 +00001853\layout Section
Lev Walkin84291e02004-06-03 03:49:45 +00001854
1855Invoking the ASN.1 helper code from the application
1856\layout Standard
1857
Lev Walkin26587ab2004-08-23 15:12:04 +00001858First of all, you should to include one or more header files into your applicati
1859on.
1860 For our Rectangle module, including the Rectangle.h file is enough:
Lev Walkin84291e02004-06-03 03:49:45 +00001861\layout LyX-Code
1862
1863#include <Rectangle.h>
1864\layout Standard
1865
1866The header files defines the C structure corresponding to the ASN.1 definition
1867 of a rectangle and the declaration of the ASN.1 type descriptor, which is
1868 used as an argument to most of the functions provided by the ASN.1 module.
1869 For example, here is the code which frees the Rectangle_t structure:
1870\layout LyX-Code
1871
Lev Walkin26587ab2004-08-23 15:12:04 +00001872Rectangle_t *rect = ...;
1873\layout LyX-Code
1874
1875
Lev Walkin84291e02004-06-03 03:49:45 +00001876\layout LyX-Code
1877
1878asn1_DEF_Rectangle->free_struct(&asn1_DEF_Rectangle,
1879\layout LyX-Code
1880
1881 rect, 0);
1882\layout Standard
1883
1884This code defines a
1885\emph on
1886rect
1887\emph default
1888 pointer which points to the Rectangle_t structure which needs to be freed.
1889 The second line invokes the generic free_struct routine created specifically
1890 for this Rectangle_t structure.
1891 The
1892\emph on
1893asn1_DEF_Rectangle
1894\emph default
1895 is the type descriptor, which holds a collection of generic routines to
1896 deal with the Rectangle_t structure.
1897\layout Standard
1898
1899There are several generic functions available:
1900\layout Description
1901
Lev Walkin84291e02004-06-03 03:49:45 +00001902ber_decoder This is the generic
1903\emph on
1904restartable
1905\begin_inset Foot
1906collapsed false
1907
1908\layout Standard
1909
1910Restartable means that if the decoder encounters the end of the buffer,
1911 it will fail, but may later be invoked again with the rest of the buffer
1912 to continue decoding.
1913\end_inset
1914
1915
1916\emph default
1917BER decoder (Basic Encoding Rules).
1918 This decoder would create and/or fill the target structure for you.
1919 Please refer to Section
1920\begin_inset LatexCommand \ref{sub:Decoding-BER}
1921
1922\end_inset
1923
1924.
1925\layout Description
1926
1927der_encoder This is the generic DER encoder (Distinguished Encoding Rules).
Lev Walkin35d446b2004-09-24 20:56:07 +00001928 This encoder will take the target structure and encode it into a series
Lev Walkin84291e02004-06-03 03:49:45 +00001929 of bytes.
1930 Please refer to Section
1931\begin_inset LatexCommand \ref{sub:Encoding-DER}
1932
1933\end_inset
1934
1935.
1936\layout Description
1937
Lev Walkin35d446b2004-09-24 20:56:07 +00001938xer_encoder This is the generic XER encoder (XML Encoding Rules).
1939 This encoder will take the target structure and represent it as an XML
1940 (text) document.
1941 Please refer to Section
1942\begin_inset LatexCommand \ref{sub:Encoding-XER}
1943
1944\end_inset
1945
1946.
1947\layout Description
1948
1949check_constraints Check that the contents of the target structure are semantical
1950ly valid and constrained to appropriate implicit or explicit subtype constraints.
1951 Please refer to Section
1952\begin_inset LatexCommand \vref{sub:Validating-the-target}
1953
1954\end_inset
1955
1956.
1957\layout Description
1958
Lev Walkin84291e02004-06-03 03:49:45 +00001959print_struct This function convert the contents of the passed target structure
1960 into human readable form.
1961 This form is not formal and cannot be converted back into the structure,
1962 but it may turn out to be useful for debugging or quick-n-dirty printing.
1963 Please refer to Section
1964\begin_inset LatexCommand \ref{sub:Printing-the-target}
1965
1966\end_inset
1967
1968.
1969\layout Description
1970
1971free_struct This is a generic disposal which frees the target structure.
1972 Please refer to Section
1973\begin_inset LatexCommand \ref{sub:Freeing-the-target}
1974
1975\end_inset
1976
1977.
1978\layout Standard
1979
Lev Walkin35d446b2004-09-24 20:56:07 +00001980check_constraints Check that the contents of the target structure are semantical
1981ly valid and constrained to appropriate implicit or explicit subtype constraints.
1982 Please refer to Section
1983\begin_inset LatexCommand \vref{sub:Validating-the-target}
1984
1985\end_inset
1986
1987.
1988\layout Standard
1989
Lev Walkin84291e02004-06-03 03:49:45 +00001990Each of the above function takes the type descriptor (
1991\emph on
1992asn1_DEF_\SpecialChar \ldots{}
1993
1994\emph default
1995) and the target structure (
1996\emph on
1997rect
1998\emph default
1999, in the above example).
2000 The target structure is typically created by the generic BER decoder or
2001 by the application itself.
2002\layout Standard
2003
2004Here is how the buffer can be deserialized into the structure:
2005\layout LyX-Code
2006
2007Rectangle_t *
2008\layout LyX-Code
2009
Lev Walkin26587ab2004-08-23 15:12:04 +00002010simple_deserializer(const void *buffer, size_t buf_size) {
Lev Walkin84291e02004-06-03 03:49:45 +00002011\layout LyX-Code
2012
2013 Rectangle_t *rect = 0; /* Note this 0! */
2014\layout LyX-Code
2015
2016 ber_dec_rval_t rval;
2017\layout LyX-Code
2018
2019
2020\layout LyX-Code
2021
2022 rval = asn1_DEF_Rectangle->ber_decoder(
2023\layout LyX-Code
2024
2025 &asn1_DEF_Rectangle,
2026\layout LyX-Code
2027
2028 (void **)&rect,
2029\layout LyX-Code
2030
2031 buffer, buf_size,
2032\layout LyX-Code
2033
2034 0);
2035\layout LyX-Code
2036
2037
2038\layout LyX-Code
2039
2040 if(rval
2041\series bold
2042.code
2043\series default
2044 == RC_OK) {
2045\layout LyX-Code
2046
2047 return rect; /* Decoding succeeded */
2048\layout LyX-Code
2049
2050 } else {
2051\layout LyX-Code
2052
Lev Walkin26587ab2004-08-23 15:12:04 +00002053 /* Free partially decoded rect */
2054\layout LyX-Code
2055
Lev Walkin84291e02004-06-03 03:49:45 +00002056 asn1_DEF_Rectangle->free_struct(
2057\layout LyX-Code
2058
2059 &asn1_DEF_Rectangle, rect, 0);
2060\layout LyX-Code
2061
2062 return 0;
2063\layout LyX-Code
2064
2065 }
2066\layout LyX-Code
2067
2068}
2069\layout Standard
2070
2071The code above defines a function,
2072\emph on
2073simple_deserializer
2074\emph default
2075, which takes a buffer and its length and expected to return a pointer to
2076 the Rectangle_t structure.
2077 Inside, it tries to convert the bytes passed into the target structure
2078 (rect) using the generic BER decoder and returns the rect pointer afterwards.
2079 If the structure cannot be deserialized, it frees the memory which might
2080 be left allocated by the unfinished
2081\emph on
2082ber_decoder
2083\emph default
2084 routine and returns NULL.
2085
2086\series bold
2087This freeing is necessary
2088\series default
2089 because the ber_decoder is a restartable procedure, and may fail just because
2090 there is more data needs to be provided before decoding could be finalized.
2091 The code above obviously does not take into account the way the
2092\emph on
2093ber_decoder
2094\emph default
2095 failed, so the freeing is necessary because the part of the buffer may
2096 already be decoded into the structure by the time something goes wrong.
2097\layout Standard
2098
2099Restartable decoding is a little bit trickier: you need to provide the old
2100 target structure pointer (which might be already half-decoded) and react
2101 on RC_WMORE return code.
2102 This will be explained later in Section
2103\begin_inset LatexCommand \vref{sub:Decoding-BER}
2104
2105\end_inset
2106
2107
Lev Walkin26587ab2004-08-23 15:12:04 +00002108\layout Subsection
Lev Walkin84291e02004-06-03 03:49:45 +00002109
2110
2111\begin_inset LatexCommand \label{sub:Decoding-BER}
2112
2113\end_inset
2114
2115Decoding BER
2116\layout Standard
2117
2118The Basic Encoding Rules describe the basic way how the structure can be
2119 encoded and decoded.
2120 Several other encoding rules (CER, DER) define a more restrictive versions
2121 of BER, so the generic BER parser is also capable of decoding the data
2122 encoded by CER and DER encoders.
2123 The opposite is not true.
2124\layout Standard
2125
2126The ASN.1 compiler provides the generic BER decoder which is implicitly capable
2127 of decoding BER, CER and DER encoded data.
2128\layout Standard
2129
2130The decoder is restartable (stream-oriented), which means that in case the
2131 buffer has less data than it is expected, the decoder will process whatever
2132 it is available and ask for more data to be provided.
2133 Please note that the decoder may actually process less data than it is
2134 given in the buffer, which means that you should be able to make the next
2135 buffer contain the unprocessed part of the previous buffer.
2136\layout Standard
2137
2138Suppose, you have two buffers of encoded data: 100 bytes and 200 bytes.
2139\layout Itemize
2140
2141You may concatenate these buffers and feed the BER decoder with 300 bytes
2142 of data, or
2143\layout Itemize
2144
2145You may feed it the first buffer of 100 bytes of data, realize that the
2146 ber_decoder consumed only 95 bytes from it and later feed the decoder with
2147 205 bytes buffer which consists of 5 unprocessed bytes from the first buffer
2148 and the latter 200 bytes from the second buffer.
2149\layout Standard
2150
2151This is not as convenient as it could be (like, the BER encoder would consume
2152 the whole 100 bytes and keep these 5 bytes in some temporary storage),
2153 but in case of stream-based processing it might actually be OK.
2154 Suggestions are welcome.
2155\layout Standard
2156
2157There are two ways to invoke a BER decoder.
2158 The first one is a direct reference of the type-specific decoder.
2159 This way was shown in the previous example of
2160\emph on
2161simple_deserializer
2162\emph default
2163 function.
2164 The second way is to invoke a
2165\emph on
2166ber_decode
2167\emph default
2168 function, which is just a simple wrapper of the former approach into a
2169 less wordy notation:
2170\layout LyX-Code
2171
2172rval = ber_decode(&asn1_DEF_Rectangle, (void **)&rect,
2173\layout LyX-Code
2174
2175 buffer, buf_size);
2176\layout Standard
2177
2178Note that the initial (asn1_DEF_Rectangle->ber_decoder) reference is gone,
2179 and also the last argument (0) is no longer necessary.
2180\layout Standard
2181
2182These two ways of invocations are fully equivalent.
2183\layout Standard
2184
2185The BER de
2186\emph on
2187coder
2188\emph default
2189 may fail because (
2190\emph on
2191the following RC_\SpecialChar \ldots{}
2192 codes are defined in ber_decoder.h
2193\emph default
2194):
2195\layout Itemize
2196
2197RC_WMORE: There is more data expected than it is provided (stream mode continuat
2198ion feature);
2199\layout Itemize
2200
2201RC_FAIL: General failure to decode the buffer;
2202\layout Itemize
2203
2204\SpecialChar \ldots{}
2205 other codes may be defined as well.
2206\layout Standard
2207
2208Together with the return code (.code) the ber_dec_rval_t type contains the
2209 number of bytes which is consumed from the buffer.
2210 In the previous hypothetical example of two buffers (of 100 and 200 bytes),
2211 the first call to ber_decode() would return with .code = RC_WMORE and .consumed
2212 = 95.
2213 The .consumed field of the BER decoder return value is
2214\series bold
2215always
2216\series default
2217 valid, even if the decoder succeeds or fails with any other return code.
2218\layout Standard
2219
2220Please look into ber_decoder.h for the precise definition of ber_decode()
2221 and related types.
Lev Walkin26587ab2004-08-23 15:12:04 +00002222\layout Subsection
Lev Walkin84291e02004-06-03 03:49:45 +00002223
2224
2225\begin_inset LatexCommand \label{sub:Encoding-DER}
2226
2227\end_inset
2228
2229Encoding DER
2230\layout Standard
2231
Lev Walkin35d446b2004-09-24 20:56:07 +00002232The Distinguished Encoding Rules is the
2233\emph on
2234canonical
2235\emph default
2236 variant of BER encoding rules.
2237 The DER is best suited to encode the structures where all the lengths are
2238 known beforehand.
Lev Walkin84291e02004-06-03 03:49:45 +00002239 This is probably exactly how you want to encode: either after a BER decoding
2240 or after a manual fill-up, the target structure contains the data which
2241 size is implicitly known before encoding.
2242 The DER encoding is used, for example, to encode X.509 certificates.
2243\layout Standard
2244
2245As with BER decoder, the DER encoder may be invoked either directly from
2246 the ASN.1 type descriptor (asn1_DEF_Rectangle) or from the stand-alone function,
2247 which is somewhat simpler:
2248\layout LyX-Code
2249
2250/*
2251\layout LyX-Code
2252
2253 * This is a custom function which writes the
2254\layout LyX-Code
2255
2256 * encoded output into some FILE stream.
2257\layout LyX-Code
2258
2259 */
2260\layout LyX-Code
2261
Lev Walkin26587ab2004-08-23 15:12:04 +00002262static int
2263\layout LyX-Code
2264
2265write_stream(const void *buffer, size_t size, void *app_key) {
Lev Walkin84291e02004-06-03 03:49:45 +00002266\layout LyX-Code
2267
2268 FILE *ostream = app_key;
2269\layout LyX-Code
2270
2271 size_t wrote;
2272\layout LyX-Code
2273
2274
2275\layout LyX-Code
2276
2277 wrote = fwrite(buffer, 1, size, ostream);
2278\layout LyX-Code
2279
2280
2281\layout LyX-Code
2282
2283 return (wrote == size) ? 0 : -1;
2284\layout LyX-Code
2285
2286}
2287\layout LyX-Code
2288
2289
2290\layout LyX-Code
2291
2292/*
2293\layout LyX-Code
2294
2295 * This is the serializer itself,
2296\layout LyX-Code
2297
2298 * it supplies the DER encoder with the
2299\layout LyX-Code
2300
2301 * pointer to the custom output function.
2302\layout LyX-Code
2303
2304 */
2305\layout LyX-Code
2306
2307ssize_t
2308\layout LyX-Code
2309
2310simple_serializer(FILE *ostream, Rectangle_t *rect) {
2311\layout LyX-Code
2312
Lev Walkin35d446b2004-09-24 20:56:07 +00002313 asn_enc_rval_t er; /* Encoder return value */
Lev Walkin84291e02004-06-03 03:49:45 +00002314\layout LyX-Code
2315
2316
2317\layout LyX-Code
2318
Lev Walkin35d446b2004-09-24 20:56:07 +00002319 er = der_encode(&asn1_DEF_Rect, rect,
Lev Walkin84291e02004-06-03 03:49:45 +00002320\layout LyX-Code
2321
Lev Walkin26587ab2004-08-23 15:12:04 +00002322 write_stream, ostream);
Lev Walkin84291e02004-06-03 03:49:45 +00002323\layout LyX-Code
2324
Lev Walkin35d446b2004-09-24 20:56:07 +00002325 if(er.
Lev Walkin84291e02004-06-03 03:49:45 +00002326\series bold
Lev Walkin35d446b2004-09-24 20:56:07 +00002327encoded
Lev Walkin84291e02004-06-03 03:49:45 +00002328\series default
2329 == -1) {
2330\layout LyX-Code
2331
2332 /*
2333\layout LyX-Code
2334
Lev Walkin35d446b2004-09-24 20:56:07 +00002335 * Failed to encode the rectangle data.
Lev Walkin84291e02004-06-03 03:49:45 +00002336\layout LyX-Code
2337
2338 */
2339\layout LyX-Code
2340
2341 fprintf(stderr,
2342\begin_inset Quotes sld
2343\end_inset
2344
2345Cannot encode %s: %s
2346\backslash
2347n
2348\begin_inset Quotes srd
2349\end_inset
2350
2351,
2352\layout LyX-Code
2353
Lev Walkin35d446b2004-09-24 20:56:07 +00002354 er.
Lev Walkin84291e02004-06-03 03:49:45 +00002355\series bold
Lev Walkin35d446b2004-09-24 20:56:07 +00002356failed_type
Lev Walkin84291e02004-06-03 03:49:45 +00002357\series default
2358->name,
2359\layout LyX-Code
2360
2361 strerror(errno));
2362\layout LyX-Code
2363
2364 return -1;
2365\layout LyX-Code
2366
2367 } else {
2368\layout LyX-Code
2369
2370 /* Return the number of bytes */
2371\layout LyX-Code
2372
Lev Walkin35d446b2004-09-24 20:56:07 +00002373 return er.encoded;
Lev Walkin84291e02004-06-03 03:49:45 +00002374\layout LyX-Code
2375
2376 }
2377\layout LyX-Code
2378
2379}
2380\layout Standard
2381
2382As you see, the DER encoder does not write into some sort of buffer or something.
2383 It just invokes the custom function (possible, multiple times) which would
2384 save the data into appropriate storage.
2385 The optional argument
2386\emph on
2387app_key
2388\emph default
2389 is opaque for the DER encoder code and just used by
2390\emph on
2391_write_stream()
2392\emph default
2393 as the pointer to the appropriate output stream to be used.
2394\layout Standard
2395
2396If the custom write function is not given (passed as 0), then the DER encoder
2397 will essentially do the same thing (i.e., encode the data) but no callbacks
2398 will be invoked (so the data goes nowhere).
2399 It may prove useful to determine the size of the structure's encoding before
2400 actually doing the encoding
2401\begin_inset Foot
2402collapsed false
2403
2404\layout Standard
2405
2406It is actually faster too: the encoder might skip over some computations
2407 which aren't important for the size determination.
2408\end_inset
2409
2410.
2411\layout Standard
2412
2413Please look into der_encoder.h for the precise definition of der_encode()
2414 and related types.
Lev Walkin26587ab2004-08-23 15:12:04 +00002415\layout Subsection
Lev Walkin84291e02004-06-03 03:49:45 +00002416
2417
Lev Walkin35d446b2004-09-24 20:56:07 +00002418\begin_inset LatexCommand \label{sub:Encoding-XER}
2419
2420\end_inset
2421
2422Encoding XER
2423\layout Standard
2424
2425The XER stands for XML Encoding Rules, where XML, in turn, is eXtensible
2426 Markup Language, a text-based format for information exchange.
2427 The encoder routine API comes in two flavors: stdio-based and callback-based.
2428 With the callback-based encoder, the encoding process is very similar to
2429 the DER one, described in Section
2430\begin_inset LatexCommand \vref{sub:Encoding-DER}
2431
2432\end_inset
2433
2434.
2435 The following example uses the definition of write_stream() from up there.
2436\layout LyX-Code
2437
2438/*
2439\layout LyX-Code
2440
2441 * This procedure generates the XML document
2442\layout LyX-Code
2443
2444 * by invoking the XER encoder.
2445\layout LyX-Code
2446
2447 * NOTE: Do not copy this code verbatim!
2448\layout LyX-Code
2449
2450 * If the stdio output is necessary,
2451\layout LyX-Code
2452
2453 * use the xer_fprint() procedure instead.
2454\layout LyX-Code
2455
2456 * See Section
2457\begin_inset LatexCommand \vref{sub:Printing-the-target}
2458
2459\end_inset
2460
2461.
2462\layout LyX-Code
2463
2464 */
2465\layout LyX-Code
2466
2467int
2468\layout LyX-Code
2469
2470print_as_XML(FILE *ostream, Rectangle_t *rect) {
2471\layout LyX-Code
2472
2473 asn_enc_rval_t er; /* Encoder return value */
2474\layout LyX-Code
2475
2476
2477\layout LyX-Code
2478
2479 er = xer_encode(&asn1_DEF_Rect, rect,
2480\layout LyX-Code
2481
2482 XER_F_BASIC, /* BASIC-XER or CANONICAL-XER */
2483\layout LyX-Code
2484
2485 write_stream, ostream);
2486\layout LyX-Code
2487
2488
2489\layout LyX-Code
2490
2491 return (er.encoded == -1) ? -1 : 0;
2492\layout LyX-Code
2493
2494}
2495\layout Standard
2496
2497Please look into xer_encoder.h for the precise definition of xer_encode()
2498 and related types.
2499\layout Standard
2500
2501See Section
2502\begin_inset LatexCommand \ref{sub:Printing-the-target}
2503
2504\end_inset
2505
2506 for the example of stdio-based XML encoder and other pretty-printing suggestion
2507s.
2508\layout Subsection
2509
2510
Lev Walkin84291e02004-06-03 03:49:45 +00002511\begin_inset LatexCommand \label{sub:Validating-the-target}
2512
2513\end_inset
2514
2515Validating the target structure
2516\layout Standard
2517
2518Sometimes the target structure needs to be validated.
2519 For example, if the structure was created by the application (as opposed
2520 to being decoded from some external source), some important information
2521 required by the ASN.1 specification might be missing.
2522 On the other hand, the successful decoding of the data from some external
2523 source does not necessarily mean that the data is fully valid either.
2524 It might well be the case that the specification describes some subtype
2525 constraints that were not taken into account during decoding, and it would
2526 actually be useful to perform the last check when the data is ready to
2527 be encoded or when the data has just been decoded to ensure its validity
2528 according to some stricter rules.
2529\layout Standard
2530
2531The asn_check_constraints() function checks the type for various implicit
2532 and explicit constraints.
2533 It is recommended to use asn_check_constraints() function after each decoding
2534 and before each encoding.
2535\layout Standard
2536
2537Please look into constraints.h for the precise definition of asn_check_constraint
2538s() and related types.
Lev Walkin26587ab2004-08-23 15:12:04 +00002539\layout Subsection
Lev Walkin84291e02004-06-03 03:49:45 +00002540
2541
2542\begin_inset LatexCommand \label{sub:Printing-the-target}
2543
2544\end_inset
2545
2546Printing the target structure
2547\layout Standard
2548
2549There are two ways to print the target structure: either invoke the print_struct
2550 member of the ASN.1 type descriptor, or using the asn_fprint() function,
2551 which is a simpler wrapper of the former:
2552\layout LyX-Code
2553
2554asn_fprint(stdout, &asn1_DEF_Rectangle, rect);
2555\layout Standard
2556
2557Please look into constr_TYPE.h for the precise definition of asn_fprint()
2558 and related types.
Lev Walkin35d446b2004-09-24 20:56:07 +00002559\layout Standard
2560
2561Another practical alternative to this custom format printing would be to
2562 invoke XER encoder.
2563 The default BASIC-XER encoder performs reasonable formatting for the output
2564 to be useful and human readable.
2565 To invoke the XER decoder in a manner similar to asn_fprint(), use the
2566 xer_fprint() call:
2567\layout LyX-Code
2568
2569xer_fprint(stdout, &asn1_DEF_Rectangle, rect);
2570\layout Standard
2571
2572See Section
2573\begin_inset LatexCommand \vref{sub:Encoding-XER}
2574
2575\end_inset
2576
2577 for XML-related details.
Lev Walkin26587ab2004-08-23 15:12:04 +00002578\layout Subsection
Lev Walkin84291e02004-06-03 03:49:45 +00002579
2580
2581\begin_inset LatexCommand \label{sub:Freeing-the-target}
2582
2583\end_inset
2584
2585Freeing the target structure
2586\layout Standard
2587
2588Freeing the structure is slightly more complex than it may seem to.
2589 When the ASN.1 structure is freed, all the members of the structure and
2590 their submembers etc etc are recursively freed too.
2591 But it might not be feasible to free the structure itself.
2592 Consider the following case:
2593\layout LyX-Code
2594
2595struct my_figure { /* The custom structure */
2596\layout LyX-Code
2597
2598 int flags; /* <some custom member> */
2599\layout LyX-Code
2600
2601 /* The type is generated by the ASN.1 compiler */
2602\layout LyX-Code
2603
2604
2605\emph on
2606Rectangle_t rect;
2607\layout LyX-Code
2608
2609 /* other members of the structure */
2610\layout LyX-Code
2611
2612};
2613\layout Standard
2614
2615In this example, the application programmer defined a custom structure with
2616 one ASN.1-derived member (rect).
2617 This member is not a reference to the Rectangle_t, but an in-place inclusion
2618 of the Rectangle_t structure.
2619 If the freeing is necessary, the usual procedure of freeing everything
2620 must not be applied to the &rect pointer itself, because it does not point
2621 to the memory block directly allocated by memory allocation routine, but
2622 instead lies within such a block allocated for my_figure structure.
2623\layout Standard
2624
2625To solve this problem, the free_struct routine has the additional argument
2626 (besides the intuitive type descriptor and target structure pointers),
2627 which is the flag specifying whether the outer pointer itself must be freed
2628 (0, default) or it should be left intact (non-zero value).
2629\layout LyX-Code
2630
2631/* Rectangle_t is defined within my_figure */
2632\layout LyX-Code
2633
2634struct my_figure *mf =
2635\series bold
2636...
2637\series default
2638;
2639\layout LyX-Code
2640
2641/*
2642\layout LyX-Code
2643
2644 * Freeing the Rectangle_td
2645\layout LyX-Code
2646
2647 * without freeing the mf->rect pointer
2648\layout LyX-Code
2649
2650 */
2651\layout LyX-Code
2652
2653asn1_DEF_Rectangle->free_struct(
2654\layout LyX-Code
2655
2656 &asn1_DEF_Rectangle, &mf->rect,
2657\emph on
26581
2659\emph default
2660 /* !free */);
2661\layout LyX-Code
2662
2663
2664\layout LyX-Code
2665
2666/* Rectangle_t is a stand-alone pointer */
2667\layout LyX-Code
2668
2669Rectangle_t *rect =
2670\series bold
2671...
2672\series default
2673;
2674\layout LyX-Code
2675
2676/*
2677\layout LyX-Code
2678
2679 * Freeing the Rectangle_t
2680\layout LyX-Code
2681
2682 * and freeing the rect pointer
2683\layout LyX-Code
2684
2685 */
2686\layout LyX-Code
2687
2688asn1_DEF_Rectangle->free_struct(
2689\layout LyX-Code
2690
2691 &asn1_DEF_Rectangle, rect,
2692\emph on
26930
2694\emph default
2695 /* free the pointer too */);
2696\layout Standard
2697
2698It is safe to invoke the
2699\emph on
2700free_struct
2701\emph default
2702 function with the target structure pointer set to 0 (NULL), the function
2703 will do nothing.
2704\layout Bibliography
Lev Walkin26587ab2004-08-23 15:12:04 +00002705\bibitem [ASN1C]{ASN1C}
2706
Lev Walkin26871b52004-09-08 03:01:06 +00002707The OpenSource ASN.1 Compiler.
Lev Walkin26587ab2004-08-23 15:12:04 +00002708
2709\begin_inset LatexCommand \htmlurl{http://lionet.info/asn1/}
2710
2711\end_inset
2712
2713
2714\layout Bibliography
Lev Walkin84291e02004-06-03 03:49:45 +00002715\bibitem [Dub00]{Dub00}
2716
2717Olivier Dubuisson --
2718\emph on
2719ASN.1 Communication between heterogeneous systems
2720\emph default
2721 -- Morgan Kaufmann Publishers, 2000.
2722
2723\begin_inset LatexCommand \htmlurl{http://asn1.elibel.tm.fr/en/book/}
2724
2725\end_inset
2726
2727.
2728 ISBN:0-12-6333361-0.
2729\layout Bibliography
2730\bibitem [ITU-T/ASN.1]{ITU-T/ASN.1}
2731
2732ITU-T Study Group 17 -- Languages for Telecommunication Systems
2733\begin_inset LatexCommand \url{http://www.itu.int/ITU-T/studygroups/com17/languages/}
2734
2735\end_inset
2736
2737
2738\the_end