词条 | Encoding Control Notation |
释义 |
The Encoding Control Notation (ECN) is a standardized formal language that is part of the Abstract Syntax Notation One (ASN.1) family of international standards.[1] ECN is designed to be used along with ASN.1, and each ECN specification (a coherent set of encoding definitions) is explicitly related to a particular ASN.1 specification (a coherent set of type definitions). The ECN standard is published by both the ITU-T and the ISO, and is officially named ITU-T Recommendation X.692 | ISO/IEC 8825-3, Information technology – ASN.1 encoding rules: Specification of Encoding Control Notation (ECN) .[2] ECN supports the formal specification of non-standard encoding rules for ASN.1 type definitions, and is intended to be used whenever it is necessary to use encodings that differ from those provided by standardized encoding rules such as BER or PER. Uses of ECNAn ASN.1 type has a set of abstract values. Encoding rules specify the representation of these abstract values as a series of bits. There are applications in which special encodings, different from those obtainable through any of the standard sets of ASN.1 encoding rules, are required. Here are some examples of possible situations that require some smaller or larger deviations from the standard encodings:
In the above cases and in many other similar cases, the combined use of ASN.1 and ECN makes it possible to create a full, formal specification of both abstract syntax (schema) and encodings. Encoders and decoders can then be automatically generated from the combined specifications. This is a significant factor in reducing both the amount of work and the possibility of errors in making interoperable systems. Another significant advantage of ECN is the ability to provide automatic tool support for testing. These advantages are available with ASN.1 alone when standardized encoding rules suffice, but ECN provides these advantages in circumstances where the standardized encoding rules are not sufficient. Overview of ECNConceptsTo understand how ECN works, it is useful to focus on four kinds of elements of the ASN.1 language: built-in types (e.g., The ECN language also has built-in types, built-in constructor keywords, user-defined simple types, and user-defined complex types. These elements of the ECN language are similar to those of ASN.1, but their names always begin with a Unlike ASN.1, ECN allows the user of the language to define synonyms of ECN constructor keywords (e.g., From the ECN viewpoint, every user-defined ASN.1 type occurring in an ASN.1 specification has a hidden ECN type implicitly associated with it. Officially this hidden ECN type is called an implicitly generated encoding structure but here we will simply call it the hidden ECN type of the ASN.1 type. Hidden ECN types are a special kind of user-defined ECN types (their ECN definition is automatically generated from a user-defined ASN.1 type rather than being provided by the user), but they behave like other user-defined ECN types. The hidden ECN type of an ASN.1 type is almost identical to the original ASN.1 type (but slightly simplified) and is the starting point for an encoding process, specified in ECN, which ultimately generates the series of bits representing any given value of the original ASN.1 type. An ASN.1 type (or any of its parts) is not directly referenceable for the purpose of specifying an encoding in ECN, but its hidden ECN type is. ECN types and ECN constructor keywords can be explicitly referenced within an ECN specification and are encoded by applying the rules contained in the ECN specification. Roughly speaking, an ECN specification does two things: it says how to modify a hidden ECN type to produce a new (colored; see below) hidden ECN type, and it says how an ECN type (as well as each of its components if it's a complex type) is to be encoded. The latter can be applied recursively, in the sense that an encoding step for a component of an ECN type may result in a further in-place modification of the remaining part of the ECN type that is being encoded. This process can go on through any number of cycles, until the final ECN type has been completely encoded, that is, all the bits representing the value of the original ASN.1 type have been generated. Lastly we introduce the concept of encoding object. This is a very important element of the ECN language, and refers to each individual encoding rule that is part of an ECN specification and is applied to an ECN type or ECN constructor keyword, either built-in or user-defined, occurring in the specification. MechanismsThe first step of the encoding process is the automatic generation of hidden ECN types from all ASN.1 types present in the ASN.1 specification. The hidden ECN types corresponding to complex user-defined ASN.1 types can be modified by a mechanism called coloring, which consists in replacing the names of the types of some of their components with synonyms. It is also possible to replace the ECN built-in constructor keywords (e.g., The second step of the encoding process is the application of an encoding object to a hidden ECN type. The value to be encoded will be one of the possible values of an ASN.1 type defined in the ASN.1 specification, and the encoding process will select the hidden ECN type of that ASN.1 type and will apply the appropriate encoding object to it. There may be further steps consisting in the recursive application of encoding objects that work by replacing an ECN type (or part of it) with another ECN type. In ECN there are several kinds of encoding objects. Some encoding objects completely determine the actual bit-level encoding of simple ECN types and are the easiest to understand. Others apply to ECN constructor keywords rather than to ECN types, and determine some structural aspects of the encoding of the complex ECN type (or part of it) constructed by an ECN constructor keyword (but do not specify its entire encoding). Others work by replacing an ECN type (or a part of it) with another ECN type, which must then be encoded by applying a different encoding object to it. The most important kinds of encoding objects in ECN are listed below:
These encoding objects apply mostly to simple ECN types, and have several parameters specifying the bit-level encoding of a value, the size of the encoding, any preceding or trailing padding, any alignment to an octet or word boundary, any bit reversals, etc.
The replacement type must be specified in the ECN specification, not in the ASN.1 specification. The user-defined ECN type must have a name beginning with a
The replacement type must be specified in the ECN specification, not in the ASN.1 specification. The user-defined ECN type must have a name beginning with a
Here are some typical ways in which these encoding objects can represent the presence of the optional component: # by utilizing a (typically boolean) field whose value indicates presence or absence of the optional component, and which was inserted in the ECN type by another encoding object applied at an earlier stage; # by relying on a particular bit pattern that occurs at certain precise bit locations within the encodings of all the possible values of the optional component but never occurs within the encodings of any of the types which can come after the optional component according to the ECN specification; # by relying on the size of the enclosing encoding to determine whether the encoding of the optional component will fit in the remaining space.
Here are some typical ways in which these encoding objects can represent the length of a list: # by utilizing a field containing the length of the list, and which was inserted in the ECN type by another encoding object applied at an earlier stage; # by relying on a particular bit pattern that occurs at certain precise bit locations within the encodings of all the possible values of the repeating component of the list but never occurs within the encodings of any of the types which can come after the list according to the ECN specification; # by relying on the size of the enclosing encoding to determine how many instances of the encoding of the repeating component will fit in the remaining space; # by choosing a bit string that does not match the encoding of any value of the repeating component of the list, and inserting that bit string after the last item of the list; # by utilizing a (typically boolean) field within the repeating component, whose value indicates whether that item is the last item of the list.
Here are some typical ways in which these encoding objects can indicate which of the alternatives of a # by utilizing a field containing the index of the alternative, and which was added to the ECN type by another encoding object applied at an earlier stage; # by relying on a particular bit pattern that occurs at certain precise bit locations within the encodings of all the possible values of each alternative and is different for each alternative.
References1. ^{{cite web| url=http://www.itu.int/rec/T-REC-X.680/en| title=ITU-T Rec. X.680 / ISO/IEC 8824-1|accessdate=2008-08-28}} 2. ^{{cite web| url=http://www.itu.int/rec/T-REC-X.692/en| title=ITU-T Rec. X.692 / ISO/IEC 8825-3|accessdate=2008-08-28}} External links
3 : ITU-T recommendations|Data serialization formats|ASN.1 |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。