| 1 | % asn1c(1) ASN.1 Compiler |
| 2 | % Lev Walkin <[email protected]> |
| 3 | % 2016-01-23 |
| 4 | |
| 5 | # NAME |
| 6 | |
| 7 | asn1c -- the ASN.1 Compiler |
| 8 | |
| 9 | # SYNOPSIS |
| 10 | |
| 11 | asn1c [**-E** [**-F**] | **-P** | **-R**] \ |
| 12 | [**-S***dir*] [**-X**] \ |
| 13 | [**-W***debug-*...] [**-f***option*] [**-gen-***option*] |
| 14 | [**-pdu**={**all**|**auto**|*Type*}] \ |
| 15 | [**-print-***option*] \ |
| 16 | *input-filenames*... |
| 17 | |
| 18 | # DESCRIPTION |
| 19 | |
| 20 | asn1c compiles ASN.1 specifications into a set of |
| 21 | target language (C/C++) encoders and decoders for BER, DER, PER, XER |
| 22 | and other encoding rules. |
| 23 | |
| 24 | # OPTIONS |
| 25 | |
| 26 | ## Stage Selection Options |
| 27 | |
| 28 | -E |
| 29 | : Run the parsing stage only. Print the reconstructed ASN.1 text. |
| 30 | |
| 31 | -F |
| 32 | : Used together with **-E**, |
| 33 | instructs the compiler to stop after the ASN.1 syntax |
| 34 | tree fixing stage and dump the reconstructed ASN.1 specification |
| 35 | to the standard output. |
| 36 | |
| 37 | -P |
| 38 | : Dump the compiled output to the standard output instead of creating the |
| 39 | target language files on disk. |
| 40 | |
| 41 | -R |
| 42 | : Restrict the compiler to generate only the ASN.1 tables, |
| 43 | omitting the usual support code. |
| 44 | |
| 45 | -S *directory* |
| 46 | : Use the specified directory with ASN.1 skeleton files. |
| 47 | |
| 48 | -X |
| 49 | : Generate an XML DTD schema for the specified ASN.1 files. |
| 50 | |
| 51 | ## Warning Options |
| 52 | |
| 53 | -Werror |
| 54 | : Treat warnings as errors; abort if any warning is produced. |
| 55 | |
| 56 | -Wdebug-lexer |
| 57 | : Enable lexer debugging during the ASN.1 parsing stage. |
| 58 | |
| 59 | -Wdebug-fixer |
| 60 | : Enable ASN.1 syntax tree fixer debugging during the fixing stage. |
| 61 | |
| 62 | -Wdebug-compiler |
| 63 | : Enable debugging during the actual compile time. |
| 64 | |
| 65 | ## Language Options |
| 66 | |
| 67 | -fbless-SIZE |
| 68 | : Allow `SIZE()` constraint for `INTEGER`, `ENUMERATED`, |
| 69 | and other types for which this constraint is normally prohibited |
| 70 | by the standard. |
| 71 | This is a violation of ASN.1 standard, and the compiler may |
| 72 | fail to produce a meaningful code. |
| 73 | |
| 74 | -fcompound-names |
| 75 | : Using this option prevents name collisions in the target source code |
| 76 | by using complex names for target language structures. |
| 77 | (Name collisions may occur if the ASN.1 module reuses the same identifiers |
| 78 | in multiple contexts). |
| 79 | |
| 80 | -findirect-choice |
| 81 | : When generating code for a `CHOICE` type, compile the `CHOICE` members |
| 82 | as indirect pointers instead of declaring them inline. |
| 83 | Consider using this option together with **-fno-include-deps** |
| 84 | to prevent circular references. |
| 85 | |
| 86 | -fincludes-quoted |
| 87 | : Refer to header files in `#include`s using **"**double**"** instead of **\<**angle**>** quotes. |
| 88 | |
| 89 | -fknown-extern-type=*name* |
| 90 | : Pretend the specified type is known. |
| 91 | The compiler will assume the target language source files |
| 92 | for the given type have been provided manually. |
| 93 | |
| 94 | -fline-refs |
| 95 | : Include ASN.1 module's line numbers in generated code comments. |
| 96 | |
| 97 | -fno-constraints |
| 98 | : Do not generate ASN.1 subtype constraint checking code. |
| 99 | This may make a shorter executable. |
| 100 | |
| 101 | -fno-include-deps |
| 102 | : Do not generate courtesy #include lines for non-critical type dependencies. |
| 103 | Helps prevent namespace collisions. |
| 104 | |
| 105 | -funnamed-unions |
| 106 | : Enable unnamed unions in the definitions of target language's structures. |
| 107 | |
| 108 | -fwide-types |
| 109 | : Use the unbounded size data types (`INTEGER_t`, `ENUMERATED_t`, `REAL_t`) |
| 110 | by default, instead of using the native machine's data types (long, double). |
| 111 | |
| 112 | ## Codecs Generation Options |
| 113 | |
| 114 | -gen-PER |
| 115 | : Generate the Packed Encoding Rules (PER) support code. |
| 116 | |
| 117 | -pdu={all|auto|*Type*} |
| 118 | : Create a PDU table for specified types, or discover Protocol Data Units |
| 119 | automatically. In case of **-pdu=all**, |
| 120 | all ASN.1 types defined in all modules will form a PDU table. |
| 121 | In case of **-pdu=auto**, all types not referenced by any other type will |
| 122 | form a PDU table. |
| 123 | If *Type* is an ASN.1 type identifier, the identifier is added to |
| 124 | the generated PDU table. |
| 125 | The last form may be specified multiple times to add any number of PDUs. |
| 126 | |
| 127 | ## Output Options |
| 128 | |
| 129 | -print-constraints |
| 130 | : When **-EF** options are also specified, |
| 131 | this option forces the compiler to explain its internal understanding |
| 132 | of subtype constraints. |
| 133 | |
| 134 | -print-lines |
| 135 | : Generate "`-- #line`" comments in **-E** output. |
| 136 | |
| 137 | # SEE ALSO |
| 138 | |
| 139 | `unber`(1), `enber`(1). |
| 140 |