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