blob: 9dc8a21768318d78287c08d04240b4665ca504a5 [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001WHAT TO READ?
2=============
3
vlme43659a2004-09-19 19:40:52 +00004If you haven't installed the asn1c yet, read the INSTALL file for
5a short installation guide.
vlmfa67ddc2004-06-03 03:38:44 +00006
vlmd3686cd2004-09-06 08:08:32 +00007For the list of asn1c command line options, see `asn1c -h` or `man asn1c`.
8
vlmfa67ddc2004-06-03 03:38:44 +00009For more complete documentation on this compiler and on using the
vlm347bcfd2005-11-21 09:17:43 +000010results of compilation phase, please look into asn1c-quick.pdf and
11asn1c-usage.{pdf,html}.
vlme43659a2004-09-19 19:40:52 +000012If you are building the compiler from the sources, these documents reside
13in the ./doc directory, otherwise they lie nearby the README file you're
14reading right now.
vlmfa67ddc2004-06-03 03:38:44 +000015
vlmd79b30d2004-09-05 10:41:23 +000016Please also read the FAQ file.
17
vlmfa67ddc2004-06-03 03:38:44 +000018An excellent book on ASN.1 is written by Olivier Dubuisson:
19"ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0.
20
vlm347bcfd2005-11-21 09:17:43 +000021QUICK START (also check out asn1c-quick.pdf)
22============================================
vlmfa67ddc2004-06-03 03:38:44 +000023
24After building [and installing] the compiler (see INSTALL), you may use
25the asn1c command to compile the ASN.1 specification:
26
vlme43659a2004-09-19 19:40:52 +000027 asn1c <module.asn1> # Compile module
vlmfa67ddc2004-06-03 03:38:44 +000028
29If several specifications contain interdependencies, all of them must be
30specified:
31
vlme43659a2004-09-19 19:40:52 +000032 asn1c <module1.asn1> <module2.asn1> ... # Compile interdependent modules
vlmfa67ddc2004-06-03 03:38:44 +000033
vlme43659a2004-09-19 19:40:52 +000034If you are building the asn1c from the sources, the ./examples directory
35contains several ASN.1 modules and a script to extract the ASN.1 modules
36from RFC documents. Refer to the README file in that directory.
37To compile the X.509 PKI module:
vlmfa67ddc2004-06-03 03:38:44 +000038
vlme43659a2004-09-19 19:40:52 +000039 ./asn1c/asn1c -P ./examples/rfc3280-*.asn1 # Compile-n-print
vlmfa67ddc2004-06-03 03:38:44 +000040
41In this example, -P option is used to instruct the compiler to print the
42compiled text on the standard output instead of creating multiple .c
vlmd79b30d2004-09-05 10:41:23 +000043and .h files for every ASN.1 type found inside the specified ASN.1 modules.
44This is useful for debugging and test automation.
vlmfa67ddc2004-06-03 03:38:44 +000045
46The compiler -E and -EF options are used for testing the parser and
47the semantic fixer, respectively. These options will instruct the compiler
48to dump out the parsed (and fixed) ASN.1 specification as it was
49"understood" by the compiler. It might be useful for checking
50whether a particular syntactic construction is properly supported
51by the compiler.
52
vlme43659a2004-09-19 19:40:52 +000053 asn1c -EF <module-to-test.asn1> # Check semantic validity
vlmfa67ddc2004-06-03 03:38:44 +000054
55
56MODEL OF OPERATION
57==================
58
59The asn1c compiler works by processing the ASN.1 module specification
60in several stages:
611. In the first stage, the ASN.1 file is parsed.
vlmd79b30d2004-09-05 10:41:23 +000062 (Parsing produces an ASN.1 syntax tree for the subsequent levels)
vlmfa67ddc2004-06-03 03:38:44 +0000632. In the second stage, the syntax tree is "fixed".
vlmd79b30d2004-09-05 10:41:23 +000064 (Fixing is a process of checking the tree for semantic errors,
65 accompanied by the tree transformation into the canonical form)
vlmfa67ddc2004-06-03 03:38:44 +0000663. In the third stage, the syntax tree is compiled into the target language.
67
68There are several command-line options reserved for printing the results
69after each stage of operation:
70
71 <parser> => print (-E)
72 <parser> => <fixer> => print (-E -F)
73 <parser> => <fixer> => <compiler> => print (-P)
74 <parser> => <fixer> => <compiler> => save-compiled [default]
75
76
77--
78Lev Walkin
79vlm@lionet.info