# About
ASN.1 to C compiler takes the ASN.1 module files (example) and generates
the C++ compatible C source code. That code can be used to serialize
the native C structures into compact and unambiguous BER/OER/PER/XER-based
data files, and deserialize the files back.
Various ASN.1 based formats are widely used in the industry,
such as to encode the X.509 certificates employed in the HTTPS handshake,
to exchange control data between mobile phones and cellular networks,
to perform car-to-car communication in intelligent transportation networks.
The ASN.1 family of standards is large and complex, and no open source
compiler supports it in its entirety.
The asn1c is arguably the most evolved open source ASN.1 compiler.
# ASN.1 Transfer Syntaxes
<details>
<summary>ASN.1 encodings interoperability table</summary>
The ASN.1 family of standards define a number of ways to encode data,
including byte-oriented (e.g., BER), bit-oriented (e.g., PER),
and textual (e.g., XER). Some encoding variants (e.g., DER) are just stricter
variants of the more general encodings (e.g., BER).
The interoperability table below specifies which API functions can be used
to exchange data in a compatible manner. If you need to _produce_ data
conforming to the standard specified in the column 1,
use the API function in the column 2.
If you need to _process_ data conforming to the standard(s) specified in the
column 3, use the API function specified in column 4.
See the [doc/asn1c-usage.pdf](doc/asn1c-usage.pdf) for details.
Encoding | API function | Understood by | API function
-------------- | ------------------ | ------------- | -------------
BER | der_encode() | BER | ber_decode()
DER | der_encode() | DER, BER | ber_decode()
CER | _not supported_ | CER, BER | ber_decode()
BASIC-OER | oer_encode() | *-OER | oer_decode()
CANONICAL-OER | oer_encode() | *-OER | oer_decode()
BASIC-UPER | uper_encode() | *-UPER | uper_decode()
CANONICAL-UPER | uper_encode() | *-UPER | uper_decode()
*-APER | _not supported_ | *-APER | _not supported_
BASIC-XER | xer_encode(XER_F_BASIC) | *-XER | xer_decode()
CANONICAL-XER | xer_encode(XER_F_CANONICAL)| *-XER | xer_decode()
*) Asterisk means both BASIC and CANONICAL variants.
</details>
# Build and Install
If you haven't installed the asn1c yet, read the [INSTALL.md](INSTALL.md) file
for a short installation guide.
[![Build Status](https://travis-ci.org/vlm/asn1c.svg?branch=master)](https://travis-ci.org/vlm/asn1c)
# Documentation
For the list of asn1c command line options, see `asn1c -h` or `man asn1c`.
The comprehensive documentation on this compiler is in [doc/asn1c-usage.pdf](doc/asn1c-usage.pdf).
Please also read the [FAQ](FAQ) file.
An excellent book on ASN.1 is written by Olivier Dubuisson:
"ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0.
# Quick start
(also check out [doc/asn1c-quick.pdf](doc/asn1c-quick.pdf))
After installing the compiler (see [INSTALL.md](INSTALL.md)), you may use
the asn1c command to compile the ASN.1 specification:
asn1c <module.asn1> # Compile module
If several specifications contain interdependencies, all of them must be
specified at the same time:
asn1c <module1.asn1> <module2.asn1> ... # Compile interdependent modules
The asn1c source tarball contains the [examples/](examples/) directory
with several ASN.1 modules and a [script](examples/crfc2asn1.pl)
to extract the ASN.1 modules from RFC documents.
Refer to the [examples/README](examples/README) file in that directory.
To compile the X.509 PKI module:
./asn1c/asn1c -P ./examples/rfc3280-*.asn1 # Compile-n-print
In this example, the **-P** option is to print the compiled text on the
standard output. The default behavior is that asn1c compiler creates
multiple .c and .h files for every ASN.1 type found inside the specified
ASN.1 modules.
The compiler's **-E** and **-EF** options are used for testing the parser and
the semantic fixer, respectively. These options will instruct the compiler
to dump out the parsed (and fixed) ASN.1 specification as it was
"understood" by the compiler. It might be useful for checking
whether a particular syntactic construction is properly supported
by the compiler.
asn1c -EF <module-to-test.asn1> # Check semantic validity
# Model of operation
The asn1c compiler works by processing the ASN.1 module specifications
in several stages:
1. During the first stage, the ASN.1 file is parsed.
(Parsing produces an ASN.1 syntax tree for the subsequent levels)
2. During the second stage, the syntax tree is "fixed".
(Fixing is a process of checking the tree for semantic errors,
accompanied by the tree transformation into the canonical form)
3. During the third stage, the syntax tree is compiled into the target language.
There are several command-line options reserved for printing the results
after each stage of operation:
<parser> => print (-E)
<parser> => <fixer> => print (-E -F)
<parser> => <fixer> => <compiler> => print (-P)
<parser> => <fixer> => <compiler> => save-compiled [default]
--
Lev Walkin
vlm@lionet.info
没有合适的资源?快使用搜索试试~ 我知道了~
ASN转换工具源码 hhhhh
共960个文件
c:185个
asn1:162个
h:124个
需积分: 5 1 下载量 67 浏览量
2022-12-29
16:05:16
上传
评论 1
收藏 16.52MB RAR 举报
温馨提示
asn 工具 asn1c 生成V2X协议栈代码 协议转换 源码
资源推荐
资源详情
资源评论
收起资源包目录
ASN转换工具源码 hhhhh (960个子文件)
149-with-components-SE.asn1.-E 983B
04-enum-SE.asn1.-E 236B
49-real-life-OK.asn1.-E 176B
70-xer-test-OK.asn1.-EF 2KB
119-per-strings-OK.asn1.-EF 2KB
34-class-OK.asn1.-EF 891B
42-real-life-OK.asn1.-EF 872B
14-resolver-OK.asn1.-EF 870B
152-value-and-type-references-OK.asn1.-EF 813B
55-components-of-OK.asn1.-EF 748B
62-any-OK.asn1.-EF 733B
84-param-tags-OK.asn1.-EF 716B
16-constraint-OK.asn1.-EF 710B
18-class-OK.asn1.-EF 696B
93-asn1c-controls-OK.asn1.-EF 609B
37-indirect-choice-OK.asn1.-EF 608B
97-type-identifier-SW.asn1.-EF 606B
19-param-OK.asn1.-EF 577B
03-enum-OK.asn1.-EF 573B
31-set-of-OK.asn1.-EF 554B
32-sequence-of-OK.asn1.-EF 535B
98-attribute-class-OK.asn1.-EF 523B
112-param-class-OK.asn1.-EF 495B
21-tags-OK.asn1.-EF 493B
20-constr-OK.asn1.-EF 442B
86-atags-OK.asn1.-EF 441B
150-with-components-OK.asn1.-EF 432B
82-with-comps-OK.asn1.-EF 368B
07-int-OK.asn1.-EF 358B
58-param-OK.asn1.-EF 355B
22-tags-OK.asn1.-EF 351B
24-sequence-OK.asn1.-EF 340B
23-bits-OK.asn1.-EF 332B
60-any-OK.asn1.-EF 332B
100-class-ref-OK.asn1.-EF 289B
153-single-value-constraint-OK.asn1.-EF 287B
125-bitstring-constraint-OK.asn1.-EF 258B
79-constrained-by-OK.asn1.-EF 240B
124-multiconstraint-OK.asn1.-EF 237B
123-valueassignment-OK.asn1.-EF 221B
130-enum-OK.asn1.-EF 211B
129-enum-OK.asn1.-EF 202B
121-empty-imports-OK.asn1.-EF 185B
117-real-constraint-OK.asn1.-EF 180B
102-class-ref-SE.asn1.-EF 0B
45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt 173B
99-class-sample-OK.asn1.-EFprint-class-matrix 2KB
140-component-relation-OK.asn1.-EFprint-class-matrix 1KB
34-class-OK.asn1.-EFprint-class-matrix 1KB
141-component-relation-OK.asn1.-EFprint-class-matrix 1KB
139-component-relation-OK.asn1.-EFprint-class-matrix 986B
98-attribute-class-OK.asn1.-EFprint-class-matrix 807B
104-param-1-OK.asn1.-EFprint-class-matrix 351B
50-constraint-OK.asn1.-EFprint-constraints 12KB
90-cond-int-type-OK.asn1.-EFprint-constraints 6KB
16-constraint-OK.asn1.-EFprint-constraints 3KB
118-per-constraint-OK.asn1.-EFprint-constraints 2KB
74-int-enum-constraints-OK.asn1.-EFprint-constraints 1KB
151-per-b2110-OK.asn1.-EFprint-constraints 525B
90-cond-int-type-OK.asn1.-P 34KB
32-sequence-of-OK.asn1.-P 12KB
141-component-relation-OK.asn1.-P 11KB
139-component-relation-OK.asn1.-P 9KB
140-component-relation-OK.asn1.-P 9KB
144-ios-parameterization-OK.asn1.-P 9KB
44-choice-in-sequence-OK.asn1.-P 8KB
143-inner-parameterization-OK.asn1.-P 7KB
94-set-optionals-OK.asn1.-P 7KB
106-param-constr-OK.asn1.-P 6KB
98-attribute-class-OK.asn1.-P 3KB
125-bitstring-constraint-OK.asn1.-P 2KB
91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE 8KB
31-set-of-OK.asn1.-Pfcompound-names 13KB
142-anonymous-types-deco-OK.asn1.-Pfcompound-names 12KB
158-sequence-of-sequence-nested-OK.asn1.-Pfcompound-names 9KB
110-param-3-OK.asn1.-Pfcompound-names 9KB
89-bit-string-enum-OK.asn1.-Pfcompound-names 2KB
92-circular-loops-OK.asn1.-Pfindirect-choice 42KB
65-multi-tag-OK.asn1.-Pfnative-types 10KB
50-constraint-OK.asn1.-Pfwide-types 63KB
70-xer-test-OK.asn1.-Pfwide-types 47KB
92-circular-loops-OK.asn1.-Pfwide-types 42KB
90-cond-int-type-OK.asn1.-Pfwide-types 35KB
154-with-REAL-components-OK.asn1.-Pfwide-types 27KB
72-same-names-OK.asn1.-Pfwide-types 20KB
73-circular-OK.asn1.-Pfwide-types 17KB
43-recursion-OK.asn1.-Pfwide-types 16KB
84-param-tags-OK.asn1.-Pfwide-types 15KB
31-set-of-OK.asn1.-Pfwide-types 13KB
37-indirect-choice-OK.asn1.-Pfwide-types 13KB
19-param-OK.asn1.-Pfwide-types 12KB
65-multi-tag-OK.asn1.-Pfwide-types 10KB
03-enum-OK.asn1.-Pfwide-types 10KB
93-asn1c-controls-OK.asn1.-Pfwide-types 9KB
105-param-2-OK.asn1.-Pfwide-types 8KB
47-set-ext-OK.asn1.-Pfwide-types 8KB
95-choice-per-order-OK.asn1.-Pfwide-types 7KB
60-any-OK.asn1.-Pfwide-types 5KB
39-sequence-of-OK.asn1.-Pfwide-types 5KB
104-param-1-OK.asn1.-Pfwide-types 5KB
共 960 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
weixin_42038726
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功