CN101159743A - Data type selecting method in automatic generation of ASN.1 coding/decoding function - Google Patents

Data type selecting method in automatic generation of ASN.1 coding/decoding function Download PDF

Info

Publication number
CN101159743A
CN101159743A CNA2007101673085A CN200710167308A CN101159743A CN 101159743 A CN101159743 A CN 101159743A CN A2007101673085 A CNA2007101673085 A CN A2007101673085A CN 200710167308 A CN200710167308 A CN 200710167308A CN 101159743 A CN101159743 A CN 101159743A
Authority
CN
China
Prior art keywords
data type
type
abstract data
coding
integer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2007101673085A
Other languages
Chinese (zh)
Other versions
CN101159743B (en
Inventor
李兴华
聂浅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN2007101673085A priority Critical patent/CN101159743B/en
Publication of CN101159743A publication Critical patent/CN101159743A/en
Application granted granted Critical
Publication of CN101159743B publication Critical patent/CN101159743B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a data type selection method during automatic generation of ASN.1 coding/decoding function, which comprises analyzing abstract data type in ASN.1; and subjecting the programmable data type to normalization process, and converting the abstract data type into corresponding programmable data type. Therefore, the computer-based generation of coding/decoding code of ASN.1 message data unit is simplified, and has the important meanings for achieving normative conversion from normative ASN.1 abstract data type to programmable data type.

Description

Data type system of selection during the ASN.1 coding/decoding function generates automatically
Technical field
The present invention relates to the communications field, more specifically, relate to a kind of in the communication protocol file based on ASN.1 (abstract syntax notation one, Abstract Sybtax Notation One) message data cell carries out coding/decoding function when generating automatically, and various ASN.1 abstract data types are carried out the method that data type is selected.
Background technology
In the modern communications field, along with becoming stronger day by day of communication function, a lot of procotols have become very huge and complicated software systems, many encoding-decoding process based on different encoding and decoding rules are arranged, such as layer 3 message encoding and decoding and based on the encoding and decoding of the message data cell of ASN.1 definition etc. in this system.These encoding-decoding process are important component parts of whole protocol software system, and play an important role.
At present, can adopt and write the automatic code Core Generator, and produce the way of codec code automatically with its for realization based on the codec code of the message data cell of ASN.1 definition.Present method has manual analysis ASN.1 abstract data type, and is rewritten into the discernible document form of compiler and is used further to that the automatic code Core Generator is analyzed and produce codec code; Though flexibility is big, obviously this kind mode workload is big, and manual operation also can be brought many unnecessary mistakes into.After the method that adopts automatic scan ASN.1 file to generate coding/decoding function is automatically used, but just need to formulate the system of selection that a basic rule is come standard ASN.1 abstract data type data type when compiling file changes.
Summary of the invention
Consider the problems referred to above and make the present invention, for this reason, main purpose of the present invention is, the data type system of selection in the automatic generation of a kind of ASN.1 coding/decoding function is provided, and it comprises:
Analyze the abstract data type among the ASN.1; And
Carry out normalized to compiling data type, and abstract data type is converted to corresponding compiled data type.
Abstract data type can comprise Boolean type, integer type, enumeration type, bit string type, byte serial type, casement, sequence type, sequence type group and selection type.
Abstract data type can be by the non-negative bigit coding that is used for the basic coding process, the binary coding of complement code, the coding of restricted integer, common little nonnegative integer coding, half restricted integer coding, one or more of restricted integer coding and length coding are not encoded.
Abstract data type can be converted to the long that can compile in the data type, the structure build, common type, Boolean type, enumeration type, and self-defining UINT8, UINT16, UINT32, INT8, INT16, a kind of with in the data types such as INT32, wherein, UINT8 represents 8 unsigned ints, UINT16 represents 16 unsigned ints, UINT32 represents 32 unsigned ints, INT8 represents that 8 have the symbol integer, INT16 represents that 16 have the symbol integer, and INT32 represents that 32 have the symbol integer, and wherein, UINT8, UINT16, UINT32, INT8, INT16, with INT32 is too much to agree the normalized that data type not of the same name is done in order to shield the compiler support.
When abstract data type is integer, judge whether abstract data is limited, if abstract data is a restricted integer then represent abstract data by long not, if abstract data is a restricted integer then according to the required figure place of coding with whether there is symbol to represent.
If abstract data type is signless integer, and when the required figure place of coding is represented abstract data type by UINT8 during smaller or equal to 8, when the required figure place of coding is represented abstract data type by UINT16 during smaller or equal to 16, and represent abstract data type by UINT32 during greater than 16 when the required figure place of encoding.
If abstract data type is the integer that symbol is arranged, then represent abstract data type by INT8 during smaller or equal to 8 when the required figure place of coding, when the required figure place of coding is represented abstract data type by INT16 during smaller or equal to 16, and represent abstract data type by INT32 during greater than 16 when the required figure place of encoding.
If abstract data type is a Boolean type, then by the compiled data types to express abstract data type of Boolean type; If abstract data type is an enumeration type, then by the compiled data types to express abstract data type of enumeration type; If abstract data type is a sequence type, then by the compiled data types to express abstract data type of structure build; And if abstract data type is selection type, then by the compiled data types to express abstract data type of common type.
If abstract data type is the bit string type, then, wherein, comprise the variable of a UNIT8 array and an expression UNIT8 array size in the structure by the compiled data types to express abstract data type of structure build.
If abstract data type is the byte serial type, then, wherein, comprise the variable of a UNIT8 array and an expression UNIT8 array size in the structure by the compiled data types to express abstract data type of structure build.
If abstract data type is the ordinal type group, then, wherein, comprise the variable of a structure build array and an expression array size in the structure by the compiled data types to express abstract data type of structure build.
Pass through technique scheme, realized that the ASN.1 codec code generates requisite essential step automatically, the codec code that can make computer generate the ASN.1 message data cell becomes easier, and to the normative translation that can compile data type important meaning is arranged for standard ASN.1 abstract data type.
Other features and advantages of the present invention will be set forth in the following description, and, partly from specification, become apparent, perhaps understand by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the specification of being write, claims and accompanying drawing.
Description of drawings
Accompanying drawing is used to provide further understanding of the present invention, and constitutes the part of specification, is used from explanation the present invention with embodiments of the invention one, is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 shows the flow chart according to the data type system of selection in the automatic generation of ASN.1 coding/decoding function of the present invention.
Embodiment
Below in conjunction with accompanying drawing the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein only is used for description and interpretation the present invention, and be not used in qualification the present invention.
With reference to Fig. 1, the data type system of selection in the automatic generation of a kind of ASN.1 coding/decoding function is provided, it comprises:
Analyze the abstract data type among the ASN.1; And
Carry out normalized to compiling data type, and abstract data type is converted to corresponding compiled data type.
Abstract data type can comprise Boolean type, integer type, enumeration type, bit string type, byte serial type, casement, sequence type, sequence type group and selection type.
Abstract data type can be by the non-negative bigit coding that is used for the basic coding process, the binary coding of complement code, the coding of restricted integer, common little nonnegative integer coding, half restricted integer coding, one or more of restricted integer coding and length coding are not encoded.
Abstract data type can be converted to the long that can compile in the data type, the structure build, common type, Boolean type, enumeration type, and self-defining UINT8, UINT16, UINT32, INT8, INT16, a kind of with in the data types such as INT32, wherein, UINT8 represents 8 unsigned ints, UINT16 represents 16 unsigned ints, UINT32 represents 32 unsigned ints, INT8 represents that 8 have the symbol integer, INT16 represents that 16 have the symbol integer, and INT32 represents that 32 have the symbol integer, and wherein, UINT8, UINT16, UINT32, INT8, INT16, with INT32 is too much to agree the normalized that data type not of the same name is done in order to shield the compiler support.
When abstract data type is integer, judge whether abstract data is limited, if abstract data is a restricted integer then represent abstract data by long not, if abstract data is a restricted integer then according to the required figure place of coding with whether there is symbol to represent.
If abstract data type is signless integer, then represent abstract data type by UINT8 during smaller or equal to 8 when the required figure place of coding, when the required figure place of coding is represented abstract data type by UINT16 during smaller or equal to 16, and represent abstract data type by UINT32 during greater than 16 when the required figure place of encoding.
If abstract data type is the integer that symbol is arranged, then represent abstract data type by INT8 during smaller or equal to 8 when the required figure place of coding, when the required figure place of coding is represented abstract data type by INT16 during smaller or equal to 16, and represent abstract data type by INT32 during greater than 16 when the required figure place of encoding.
If abstract data type is a Boolean type, then by the compiled data types to express abstract data type of Boolean type; If abstract data type is an enumeration type, then by the compiled data types to express abstract data type of enumeration type; If abstract data type is a sequence type, then by the compiled data types to express abstract data type of structure build; And if abstract data type is selection type, then by the compiled data types to express abstract data type of common type.
If abstract data type is the bit string type, then, wherein, comprise the variable of a UNIT8 array and an expression UNIT8 array size in the structure by the compiled data types to express abstract data type of structure build.
If abstract data type is the byte serial type, then, wherein, comprise the variable of a UNIT8 array and an expression UNIT8 array size in the structure by the compiled data types to express abstract data type of structure build.
If abstract data type is the ordinal type group, then, wherein, comprise the variable of a structure build array and an expression array size in the structure by the compiled data types to express abstract data type of structure build.
Below with more detailed description the present invention.
That analyzes that the ASN.1 abstract data type generally can use mainly contains boolean (Boolean type), integer (integer type), enumerated (enumeration type), bitstring (bit string type), octetstring (byte serial type), null (void type), sequence (ordinal type), sequence-of (ordinal type group), choice (selection type); These abstract data types can use more basic cataloged procedure to encode, these basic cataloged procedures mainly contain Encoding as a non-negative-binary-integer (non-negative bigit coding), Encoding as a 2 ' s-complement-binary-Integer (binary coding of complement code), Encoding of a constrained whole number (coding of restricted integer), Encodingof a normally small non-negative whole number (common little nonnegative integer coding).Encoding of a semi-constrained whole number (half restricted integer coding), Encoding of an unconstrained whole number (not restricted integer coding), General rules for encoding a length determinant (general rule of length coding).
Because the data type that general compiler is supported makes in the code data type seem in disorder and manageability not too much easily, therefore need us that the data type that compiles that will use is done normalized, definition UINT8, UINT16, UINT32, INT8, INT16, INT32 is totally 6 kinds of data types, select LONG, struct, union in addition again for use, bool, enum etc. can compile data type and be used for changing the various abstract data types that define among the ASN.1.
UINT8, UINT16, UINT32 is a unsigned type for three kinds, can be used for the no symbol restricted integer of expression, these three types account for one, two, four byte respectively.According to can calculating the needed bit number of coding about the cataloged procedure of restricted integer in the ASN.1 abstract data type, when the bit number can use UINT8 to represent smaller or equal to 8 the time; When the bit number can use UINT16 to represent smaller or equal to 16 the time; Other situation can use UINT32 to represent.
INT8, INT16, INT32 have sign pattern, can be used to represent to have the restricted integer type of symbol, and these three types account for one, two, four byte respectively.According to can calculating the needed bit number of coding about the cataloged procedure of restricted integer in the ASN.1 abstract data type, when the bit number can use INT8 to represent smaller or equal to 8 the time; When the bit number can use INT16 to represent smaller or equal to 16 the time; Other situation can use INT32 to represent.
When ASN.1 abstract data type when being not limited, use LONG to represent, LONG can be different according to the different bit numbers of system.
Whether constant has the size of symbol and value to mention type above can determining to adopt according to the value of constant and represents.
Boolean (Boolean type), the Boolean type definition that can discern according to compiler gets final product.
Whether integer (integer type) is according to having symbol and limited situation to select to represent that according to mode described above type gets final product in the ASN.1 definition.
Enumerated (enumeration type), the enumeration type definition that can discern according to compiler gets final product.
Bitstring (bit string type), when the upper and lower limit of bitstring is unequal, be expressed as the form of a structure (struct), one is the UINT8 array in the structure, another is the variable of expression UINT8 array size, the size of UINT8 array is that the bit number of bitstring is divided by 8 merchant, if the merchant is not to add 1 after integer just rounds; Can directly use a UINT8 array representation (also can not being placed in the structure) when upper and lower limit equates, array size is that the bit number of bitstring is divided by 8 merchant, if the merchant is not to add 1 after integer just rounds.
Octetstring (byte serial type), when the upper and lower limit of octetstring is unequal, be expressed as the form of a structure (struct), one is the UINT8 array in the structure, and another is the variable of expression UINT8 array size, and the size of UINT8 array equals higher limit; Can directly use a UINT8 array representation (also can not being placed in the structure) when upper and lower limit equates, array size equals higher limit.
Null (void type), can compile do not have in the type can be corresponding type.
Sequence (ordinal type), the struct type definition that can discern according to compiler gets final product.
Sequence-of (ordinal type group) is the array of structure according to its implication, is expressed as the form of a structure, and one is the array of a structure in the structure, and another is the variable of expression array size.
Choice (selection type) is defined as the union form and gets final product.
The 3rd. according to rule defined above, we just can produce the various data types of discernible various message elements structures of compiler and inside configuration easily according to above rule when the file of the message data cell of scan A SN.1 definition.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (11)

1. the data type system of selection during an ASN.1 coding/decoding function generates automatically is characterized in that, comprising:
Step S102 analyzes the abstract data type among the described ASN.1; And
Step S104 carries out normalized to compiling data type, and described abstract data type is converted to the corresponding described data type that compiles.
2. data type system of selection according to claim 1 is characterized in that, described abstract data type comprises Boolean type, integer type, enumeration type, bit string type, byte serial type, casement, sequence type, sequence type group and selection type.
3. data type system of selection according to claim 2, it is characterized in that described abstract data type is not by the non-negative bigit coding that is used for the basic coding process, the binary coding of complement code, the coding of restricted integer, common little nonnegative integer coding, half restricted integer coding, one or more of restricted integer coding and length coding are encoded.
4. data type system of selection according to claim 2 is characterized in that step S104 comprises:
Described abstract data type is converted to the described long that compiles in the data type, the structure build, common type, Boolean type, enumeration type, and self-defining UINT8, UINT16, UINT32, INT8, INT16, a kind of with in the data types such as INT32, wherein, described UINT8 represents 8 unsigned ints, described UINT16 represents 16 unsigned ints, described UINT32 represents 32 unsigned ints, described INT8 represents that 8 have the symbol integer, described INT16 represents that 16 have the symbol integer, and INT32 represents that 32 have the symbol integer, and wherein, described UINT8, described UINT16, described UINT32, described INT8, described INT16, with described INT32 is too much to agree the normalized that data type not of the same name is done in order to shield the compiler support.
5. data type system of selection according to claim 4, it is characterized in that, when described abstract data type is integer type, judge whether described abstract data type is limited, if described data type is a restricted integer then represent described abstract data type by long not, if described abstract data type is a restricted integer then according to the required figure place of coding with whether there is symbol to select.
6. data type system of selection according to claim 5, it is characterized in that, if described abstract data type is signless integer, then represent described abstract data type by described UINT8 during smaller or equal to 8 when the required figure place of described coding, when the required figure place of described coding is represented described abstract data type by described UINT16 during smaller or equal to 16, and represent described abstract data type by described UINT32 during greater than 16 when the required figure place of described coding.
7. data type system of selection according to claim 5, it is characterized in that, if described abstract data type is the integer that symbol is arranged, then represent described abstract data by described INT8 during smaller or equal to 8 when the required figure place of described coding, when the required figure place of described coding is represented described abstract data by described INT16 during smaller or equal to 16, and represent described abstract data by described INT32 during greater than 16 when the required figure place of described coding.
8. data type system of selection according to claim 4 is characterized in that, if described abstract data type is a Boolean type, then represents described abstract data type by compiling Boolean type; If described abstract data type is an enumeration type, then represent described abstract data type by compiling enumeration type; If described abstract data type is a sequence type, then represent described abstract data type by the structure build that can compile; And if described abstract data type is selection type, then by the described described abstract data of data types to express that compiles of the common type that can compile.
9. data type system of selection according to claim 4, it is characterized in that, if described abstract data type is the bit string type, then by the described described abstract data type of structure build data types to express that compiles, wherein, the variable that comprises a UINT8 array and a described UINT8 array size of expression in the described structure, wherein, when the upper and lower limit of bit string type equates, in structure, only use a UINT8 array representation, perhaps remove structure with the direct representation of a UINT8 array.
10. data type system of selection according to claim 4, it is characterized in that, if described abstract data type is the byte serial type, then by the described described abstract data type of structure build data types to express that compiles, wherein, the variable that comprises a UINT8 array and a described UINT8 array size of expression in the described structure, wherein, when the upper and lower limit of byte serial type equates, in structure, only use a UINT8 array representation, perhaps remove structure with the direct representation of a UINT8 array.
11. data type system of selection according to claim 4, it is characterized in that, if described abstract data type is the sequence type group, then by the described abstract data type of structure build data types to express that can compile, wherein, the variable that comprises a structure build array and a described array size of expression in the described structure.
CN2007101673085A 2007-10-22 2007-10-22 Data type selecting method in automatic generation of ASN.1 coding/decoding function Expired - Fee Related CN101159743B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007101673085A CN101159743B (en) 2007-10-22 2007-10-22 Data type selecting method in automatic generation of ASN.1 coding/decoding function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007101673085A CN101159743B (en) 2007-10-22 2007-10-22 Data type selecting method in automatic generation of ASN.1 coding/decoding function

Publications (2)

Publication Number Publication Date
CN101159743A true CN101159743A (en) 2008-04-09
CN101159743B CN101159743B (en) 2010-06-23

Family

ID=39307661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007101673085A Expired - Fee Related CN101159743B (en) 2007-10-22 2007-10-22 Data type selecting method in automatic generation of ASN.1 coding/decoding function

Country Status (1)

Country Link
CN (1) CN101159743B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036877A (en) * 2012-12-10 2013-04-10 北京中创信测科技股份有限公司 Device and method for code generation of coding and decoding based on threshold limit value (TLV) form protocol
CN101316241B (en) * 2008-07-02 2013-05-01 中兴通讯股份有限公司 TLV format processing method for communication data
CN103246671A (en) * 2012-02-09 2013-08-14 中兴通讯股份有限公司 Processing method and device for abstract syntax notation files
CN104113390A (en) * 2014-06-20 2014-10-22 广州市集智信息科技有限公司 Serialization method of mobile network data
CN106294102A (en) * 2015-05-20 2017-01-04 腾讯科技(深圳)有限公司 The method of testing of application program, client, server and system
CN109063058A (en) * 2018-07-20 2018-12-21 上海达梦数据库有限公司 A kind of date storage method, device, equipment and storage medium
US10228920B2 (en) 2014-05-13 2019-03-12 Oracle International Corporation Automatic selection of an abstract data type
CN111817727A (en) * 2020-06-28 2020-10-23 积成电子股份有限公司 PER encoder implementation method suitable for DL/T860 standard

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6883164B2 (en) * 2000-12-15 2005-04-19 International Business Machines Corporation Strategy for dynamically modeling ASN.1 data to an object model
CN1707473A (en) * 2004-06-07 2005-12-14 资通电脑股份有限公司 Method for reference label used for abstract syntax account recording system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101316241B (en) * 2008-07-02 2013-05-01 中兴通讯股份有限公司 TLV format processing method for communication data
CN103246671A (en) * 2012-02-09 2013-08-14 中兴通讯股份有限公司 Processing method and device for abstract syntax notation files
CN103036877A (en) * 2012-12-10 2013-04-10 北京中创信测科技股份有限公司 Device and method for code generation of coding and decoding based on threshold limit value (TLV) form protocol
US10228920B2 (en) 2014-05-13 2019-03-12 Oracle International Corporation Automatic selection of an abstract data type
CN104113390A (en) * 2014-06-20 2014-10-22 广州市集智信息科技有限公司 Serialization method of mobile network data
CN106294102A (en) * 2015-05-20 2017-01-04 腾讯科技(深圳)有限公司 The method of testing of application program, client, server and system
CN109063058A (en) * 2018-07-20 2018-12-21 上海达梦数据库有限公司 A kind of date storage method, device, equipment and storage medium
CN111817727A (en) * 2020-06-28 2020-10-23 积成电子股份有限公司 PER encoder implementation method suitable for DL/T860 standard
CN111817727B (en) * 2020-06-28 2024-04-09 积成电子股份有限公司 PER encoder realization method suitable for DL/T860 standard

Also Published As

Publication number Publication date
CN101159743B (en) 2010-06-23

Similar Documents

Publication Publication Date Title
CN101159743B (en) Data type selecting method in automatic generation of ASN.1 coding/decoding function
US8181163B2 (en) Program synthesis and debugging using machine learning techniques
CN102289375B (en) Code generating method and system
CN101841515A (en) Target variable protocol data unit codec code automatic generation implementation method
CN1669024A (en) Method and devices for encoding/decoding structured documents, especially XML documents
CN102521120A (en) Software automation test system and method
CN104932905A (en) Automatic code generation method from AADL to C language
CN109522008B (en) Intelligent contract construction method for block chain
CN107291522B (en) Compiling optimization method and system for user-defined rule file
CN104407863A (en) Abstract control model programming device and method
CN110489088A (en) A kind of cross-platform small routine development approach
CN107832059A (en) A kind of code Static Analysis Method and device based on Makefile
CN103186582A (en) Device description file-based data analysis method
CN107133049A (en) The treating method and apparatus of service based on communication
CN104346171A (en) Automatic construction and optimizing method of programming trading strategy
CN102819527A (en) Method and system for matching rules in mobile communication system
CN102314371A (en) Coding method, decoding method and coding/decoding device based on extensible markup language (XML)
CN103984539A (en) Operation method and operation system for household appliance
US20090187601A1 (en) Automation process system and method to upgrade from non-unicode transformation support to unicode data transformation support
CN107015840A (en) A kind of rapid implementation method of resolver and quick execution system
CN202143092U (en) Message processing system
CN110324325A (en) A kind of satellite ground systems communication protocol implementation method based on configuration file
CN107544813A (en) A kind of switching method and system of static library configuration
Dower et al. ESDL: A simple description language for population-based evolutionary computation
CN107391133A (en) A kind of application generator

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100623

Termination date: 20201022