英文:
How can you define a graph using ASN.1?
问题
维基百科上关于“数据序列化格式比较”的页面提到,ASN.1可以通过“引用”来序列化非层次结构(例如图形),如下所示:
ASN.1拥有X.681(信息对象系统)、X.682(约束)和X.683(参数化),允许精确规定开放类型的规范,其中值的类型可以通过整数、OID等标识。OID是全局唯一标识符的标准格式,也是引用值组件的标准表示(“绝对引用”)。例如,PKIX在RFC 5912中使用了这种表示法。使用此表示法(使用信息对象集对参数化类型进行约束),通用ASN.1工具/库可以自动对文档中的引用进行编码/解码/解析。
我拥有的这本书《ASN.1:教程与参考》(Steedman, 1990)-虽然现在有些过时,但曾经是其时的参考书)并未对此进行描述,而且我的搜索结果也无法找到网络上的示例。它是什么样的?术语是什么?
(例如,你能提供一个ASN.1表示法的示例,用于序列化一个简单的图形吗?)
英文:
Wikipedia on "comparison of data-serialization formats" says ASN.1 can serialize non-hierarchical structure (e.g., graphs) via "references" as follows:
> ASN.1 has X.681 (Information Object System), X.682 (Constraints), and X.683 (Parameterization) that allow for the precise specification of open types where the types of values can be identified by integers, by OIDs, etc. OIDs are a standard format for globally unique identifiers, as well as a standard notation ("absolute reference") for referencing a component of a value. For example, PKIX uses such notation in RFC 5912. With such notation (constraints on parameterized types using information object sets), generic ASN.1 tools/libraries can automatically encode/decode/resolve references within a document.
The book I've got (ASN.1: The Tutorial And Reference (Steedman, 1990) - quite old now but it was the reference for its time) doesn't describe this at all and my search-foo isn't sufficient to find an example on the web. What does it look like? And what is the terminology?
(E.g., can you provide an example of ASN.1 notation that can serialize a simple graph?)
答案1
得分: 1
混淆的地方在于“引用”的含义。ASN.1类型正式指定了一个分层值。ASN.1不支持非分层数据。
所引用的特性在X.680、X.681、X.682和X.683中定义。使用表约束和信息对象,您可以拥有一个字段,其类型由另一个字段确定(例如整数或OID),而不是预先指定的。这确实允许工具自动读取标识符(整数或OID),从而确定“开放类型”字段的实际类型,然后根据其实际类型解码开放类型。然而,这更类似于动态类型,而不是数据结构中的引用或指针,它允许创建循环数据结构。
在ASN.1中,没有正式的指针或引用类型的东西,标准中没有标识或指向数据结构的其他部分的机制。
英文:
The confusion is around what is meant by a reference. An ASN.1 type formally specifies a hierarchical value. ASN.1 does not support non-hierarchical data.
The referenced features are defined in X.680, X.681, X.682, and X.683. With table constraints and information objects, you can have a field whose type is determined by another field (e.g. an integer or OID), rather than specified in advance. It is true that this feature allows tools to automatically read the identifier (the integer or OID), and thereby determine the actual type for the "open type" field, and then decode the open type according to its actual type. However, this would be something more akin to dynamic types than to references or pointers in a data structure, which allow one to have a cyclical data structure.
There is no formal pointer or reference kind of thing in ASN.1 that, by the standard, identifies or points at some other part of the data structure.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论