CN103473058A - Convenient coding method for generating ASN1 (abstract syntax notation one) data files - Google Patents

Convenient coding method for generating ASN1 (abstract syntax notation one) data files Download PDF

Info

Publication number
CN103473058A
CN103473058A CN2013104095449A CN201310409544A CN103473058A CN 103473058 A CN103473058 A CN 103473058A CN 2013104095449 A CN2013104095449 A CN 2013104095449A CN 201310409544 A CN201310409544 A CN 201310409544A CN 103473058 A CN103473058 A CN 103473058A
Authority
CN
China
Prior art keywords
length
asn1
fixed
file
configuration
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
CN2013104095449A
Other languages
Chinese (zh)
Other versions
CN103473058B (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.)
Beijing Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology Co Ltd
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 Beijing Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN201310409544.9A priority Critical patent/CN103473058B/en
Publication of CN103473058A publication Critical patent/CN103473058A/en
Application granted granted Critical
Publication of CN103473058B publication Critical patent/CN103473058B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a convenient coding method for generating ASN1 data files. The method comprises writing and analyzing configuration files into a memory; reading fixed-length files; finding the configuration rules corresponding to the fixed-length files; reading a fixed-length record for the fixed-length files; according to the configuration rules, obtaining field value from the fixed-length record to be stored in the corresponding node of an ASN1 structure tree; judging out whether the fixed-length records in the fixed-length files are all processed, if so, encoding the ASN1 structure tree generated through the fixed-length files to generate ASN1 data files, and if not, repeating the steps above until all the fields of all the fixed-length records of the fixed-length files are processed. According to the convenient coding method for generating the ASN1 data files, by means of the configuration files, the formats of the ASN1 data files to be generated can be configured flexibly and accordingly the ASN1 data files can be assembled efficiently and flexibly.

Description

A kind of convenient coding method that generates the ASN1 data file
Technical field
The present invention relates to the document No. method, relate in particular to a kind of coding method of the data file of ASN1 easily, use while particularly in telecommunication system inside, needing the ASN1 data file of form in the encapsulation pot.
Background technology
Along with telecom operators constantly develop, the business expansion is more and more wider, and various new business emerges in an endless stream; In miscellaneous service ticket transmitting procedure, the carrier of carrying is also different, and a kind of file of protocol code will carry the business ticket of multiple format.
Traditional method for packing, be that traffic format is defined in to the program the inside, while so just having caused Added Business and the business of modification, need to be to the modification of program, and workload is large, and risk is high.
In order to tackle this business polytrope, reduce the risk that update routine causes, inventing a kind of efficient data encapsulation method is to be necessary very much, is also very helpful.
Summary of the invention
Technical matters to be solved by this invention is for the deficiencies in the prior art, and a kind of convenient coding method of the ASN1 of generation data file is provided.
ASN1 abstract syntax notation one (Abstract Syntax Notation One) ASN1 is a kind of ISO/ITU-T standard, has described a kind of data layout that data are meaned, encode, transmit and decode.
Fixed-length file refers to that the length of the fixed-length record of storage in it all fixes, as CDR file.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of convenient coding method of the ASN1 of generation data file comprises the steps:
Step 1: write a configuration file be comprised of some cover configuration rules, every cover configuration rule is provided with a file header;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in to internal memory;
Step 4: the header file of all configuration rules in the filename of fixed-length file and configuration file is grown to coupling most, search corresponding configuration rule, if find, enter step 5, otherwise send ALM, finish;
Step 5: read a fixed-length record from fixed-length file;
Step 6: the field value that will obtain from described fixed-length record according to configuration rule is deposited on the respective nodes of ASN1 structure tree;
Step 7: judge that whether all fixed-length records in fixed-length file are all processed, if be disposed, enter step 8, otherwise return to step 5;
Step 8: the structure tree to the ASN1 by the fixed-length file generation is encoded, and generates the ASN1 data file, finishes.
On the basis of technique scheme, the present invention can also do following improvement.
Further, described configuration file comprises some cover configuration rules, and every cover configuration rule comprises some rule items.
Further, described regularization term comprises title regularization term, reference position regularization term, length regularization term, path rule item and data type rule item;
The title of the field of the field value that described title regularization term sign will be obtained;
The starting position of field value in fixed-length record that described reference position regularization term sign will be obtained;
The length of field value in fixed-length record that described length regularization term sign will be obtained;
The field value that described path rule item sign is obtained will deposit the path of ASN1 structure tree in;
The field value that described data type rule item sign is obtained deposits the ASN1 structure tree in which kind of data type.
The concrete steps that the field value that further, will obtain from described fixed-length record according to configuration rule in step 6 is deposited on the respective nodes of ASN1 structure tree are as follows:
Step 6.1: according to the reference position regularization term in configuration rule and length regularization term, obtain the field value of specified location field in this fixed-length record;
Step 6.2: according to the data type rule item in configuration rule and path rule item, the field value obtained is deposited on the respective nodes of ASN1 structure tree with corresponding data type.
Further, also comprise in step 6.2, after every fixed-length record all is disposed for the strictly all rules item in configuration rule, can generate temporary file.
Further, described path rule item is scrabbled up by the tag label value.。
Further, also comprise the generating run daily record and generate the processing daily record.
Further, described ASN1 structure tree is generated by one or more fixed-length file conversion.
The invention has the beneficial effects as follows: the method for the invention is utilized configuration file, the form that will generate the ASN1 data file carries out flexible configuration, make the ASN1 data file can be by efficiently, assembling flexibly, the present invention uses configuration file flexibly, " path " can revise increase at any time at configuration file, the content of " value " is also by the flexible configuration setting, improved to the full extent the dirigibility of program, removed the traffic aided of program, the risk that while having reduced business reorganization, update routine causes.
The accompanying drawing explanation
Fig. 1 is a kind of convenient coding method process flow diagram that generates the ASN1 data file of the present invention;
The process flow diagram that Fig. 2 is step 6 of the present invention.
Embodiment
Below in conjunction with accompanying drawing, principle of the present invention and feature are described, example, only for explaining the present invention, is not intended to limit scope of the present invention.
As shown in Figure 1, a kind of convenient coding method that generates the ASN1 data file, comprise the steps:
Step 1: write a configuration file be comprised of some cover configuration rules, every cover configuration rule is provided with a file header;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in to internal memory;
Step 4: the header file of all configuration rules in the filename of fixed-length file and configuration file is grown to coupling most, search corresponding configuration rule, if find, enter step 5, otherwise send ALM, finish;
Step 5: read a fixed-length record from fixed-length file;
Step 6: the field value that will obtain from described fixed-length record according to configuration rule is deposited on the respective nodes of ASN1 structure tree;
Step 7: judge that whether all fixed-length records in fixed-length file are all processed, if be disposed, enter step 8, otherwise return to step 5;
Step 8: the structure tree to the ASN1 by the fixed-length file generation is encoded, and generates the ASN1 data file, finishes.
Wherein, described configuration file comprises some cover configuration rules, and every cover configuration rule comprises some rule items.
Wherein, described regularization term comprises title regularization term, reference position regularization term, length regularization term, path rule item and data type rule item;
The title of the field of the field value that described title regularization term sign will be obtained;
The starting position of field value in fixed-length record that described reference position regularization term sign will be obtained;
The length of field value in fixed-length record that described length regularization term sign will be obtained;
The field value that described path rule item sign is obtained will deposit the path of ASN1 structure tree in;
The field value that described data type rule item sign is obtained deposits the ASN1 structure tree in which kind of data type.
The concrete steps that the field value that wherein, will obtain from described fixed-length record according to configuration rule in step 6 is deposited on the respective nodes of ASN1 structure tree are as follows:
Step 6.1: according to the reference position regularization term in configuration rule and length regularization term, obtain the field value of specified location field in this fixed-length record;
Step 6.2: according to the data type rule item in configuration rule and path rule item, the field value obtained is deposited on the respective nodes of ASN1 structure tree with corresponding data type.
Wherein, also comprise in step 6.2, after every fixed-length record all is disposed for the strictly all rules item in configuration rule, can generate temporary file.
Wherein, described path rule item is scrabbled up by the tag label value.。
Wherein, also comprise the generating run daily record and generate the processing daily record.
Wherein, described ASN1 structure tree is generated by one or more fixed-length file conversion.
The CDR file of below usining in telecommunication system is as fixed-length file, and generating the ASN. data file by former CDR file is that example describes.
Below for adopting the wherein a set of configuration rule about CDR file in the configuration file related in the method for the invention.
Figure BDA0000379921300000051
Figure BDA0000379921300000061
Grow most coupling according to HEAD content in the filename of CDR file and configuration file, find corresponding configuration rule, in the present embodiment, CDR file dvcr's by name will find the configuration rule that HEAD is dvcr; Regularization term in configuration rule comprises SRC, IN_START, IN_LEN, PATH, FIELD_TYPE; Wherein, the SRC correspondence will be obtained the title of field in former ticket writing; The IN_START correspondence will be obtained the starting position of field in former ticket writing, the IN_LEN correspondence will be obtained the length of field in Original CDR, the field value that the PATH correspondence is obtained will deposit the path of ASN1 structure tree in, the tag value, consist of, the field value that the FILED_TYPE correspondence is obtained with which kind of data type deposits in the ASN1 structure tree.
Each ticket writing in former CDR file all will travel through above-mentioned whole configuration rule (comprising from SRC1 to SRC9); After having traveled through, then read a ticket writing from former CDR file, repeat aforesaid operations, until all ticket writings in CDR file all are disposed, generate the ASN1 structure tree; The structure tree generated is encoded, generated the ASN1 data file.Can generate temporary file after each ticket writing is disposed for the strictly all rules item, and temporary file is stored in alternative document.
In addition, the invention is not restricted to a fixed-length file (being CDR file in the present embodiment), generate an ASN1 structure tree, can generate an ASN1 structure tree by a plurality of fixed-length files, as handle a fixed-length file, internal memory reads a fixed-length file again, carries out above-mentioned processing;
As required, generate an ASN1 structure tree by the fixed-length file of specifying number is common, more final structure book is encoded, generate the ASN1 data file.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (8)

1. a convenient coding method that generates the ASN1 data file, is characterized in that, comprises the steps:
Step 1: write a configuration file be comprised of some cover configuration rules, every cover configuration rule is provided with a file header;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in to internal memory;
Step 4: the header file of all configuration rules in the filename of fixed-length file and configuration file is grown to coupling most, search corresponding configuration rule, if find, enter step 5, otherwise send ALM, finish;
Step 5: read a fixed-length record from fixed-length file;
Step 6: the field value that will obtain from described fixed-length record according to configuration rule is deposited on the respective nodes of ASN1 structure tree;
Step 7: judge that whether all fixed-length records in fixed-length file are all processed, if be disposed, enter step 8, otherwise return to step 5;
Step 8: the ASN1 structure tree generated by fixed-length file is encoded, generate the ASN1 data file, finish.
2. a kind of convenient coding method that generates the ASN1 data file according to claim 1, is characterized in that, described configuration file comprises some cover configuration rules, and every cover configuration rule comprises some rule items.
3. a kind of convenient coding method that generates the ASN1 data file according to claim 2, is characterized in that, described regularization term comprises title regularization term, reference position regularization term, length regularization term, path rule item and data type rule item;
The title of the field of the field value that described title regularization term sign will be obtained;
The starting position of field value in fixed-length record that described reference position regularization term sign will be obtained;
The length of field value in fixed-length record that described length regularization term sign will be obtained;
The field value that described path rule item sign is obtained will deposit the path of ASN1 structure tree in;
The field value that described data type rule item sign is obtained deposits the ASN1 structure tree in which kind of data type.
4. a kind of convenient coding method that generates the ASN1 data file according to claim 1, is characterized in that, the concrete steps that the field value that will obtain from described fixed-length record according to configuration rule in step 6 is deposited on the respective nodes of ASN1 structure tree are as follows:
Step 6.1: according to the reference position regularization term in configuration rule and length regularization term, obtain the field value of specified location field in this fixed-length record;
Step 6.2: according to the data type rule item in configuration rule and path rule item, the field value obtained is deposited on the respective nodes of ASN1 structure tree with corresponding data type.
5. a kind of convenient coding method that generates the ASN1 data file according to claim 4, is characterized in that, also comprises in step 6.2, after every fixed-length record all is disposed for the strictly all rules item in configuration rule, can generate temporary file.
6. a kind of convenient coding method that generates the ASN1 data file according to claim 3, is characterized in that, described path rule item is scrabbled up by the tag label value.
7. a kind of convenient coding method that generates the ASN1 data file according to claim 1, is characterized in that, also comprises the generating run daily record and generate processing daily record.
8. a kind of convenient coding method that generates the ASN1 data file according to claim 1, is characterized in that, described ASN1 structure tree is generated by one or more fixed-length file conversion.
CN201310409544.9A 2013-09-10 2013-09-10 A kind of convenient coded method generating ASN1 data file Active CN103473058B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310409544.9A CN103473058B (en) 2013-09-10 2013-09-10 A kind of convenient coded method generating ASN1 data file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310409544.9A CN103473058B (en) 2013-09-10 2013-09-10 A kind of convenient coded method generating ASN1 data file

Publications (2)

Publication Number Publication Date
CN103473058A true CN103473058A (en) 2013-12-25
CN103473058B CN103473058B (en) 2016-09-14

Family

ID=49797930

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310409544.9A Active CN103473058B (en) 2013-09-10 2013-09-10 A kind of convenient coded method generating ASN1 data file

Country Status (1)

Country Link
CN (1) CN103473058B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976302A (en) * 2016-05-05 2016-09-28 北京思特奇信息技术股份有限公司 Configurable data comparing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5291583A (en) * 1990-12-14 1994-03-01 Racal-Datacom, Inc. Automatic storage of persistent ASN.1 objects in a relational schema
CN101154227A (en) * 2006-09-26 2008-04-02 中兴通讯股份有限公司 Code generation method based on ASN type object
CN102402511A (en) * 2010-09-08 2012-04-04 中兴通讯股份有限公司 Method and system for storing service data
CN102609482A (en) * 2012-01-19 2012-07-25 北京神州数码思特奇信息技术股份有限公司 Packaging method of JSON (JavaScript Object Notiation) data format

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5291583A (en) * 1990-12-14 1994-03-01 Racal-Datacom, Inc. Automatic storage of persistent ASN.1 objects in a relational schema
CN101154227A (en) * 2006-09-26 2008-04-02 中兴通讯股份有限公司 Code generation method based on ASN type object
CN102402511A (en) * 2010-09-08 2012-04-04 中兴通讯股份有限公司 Method and system for storing service data
CN102609482A (en) * 2012-01-19 2012-07-25 北京神州数码思特奇信息技术股份有限公司 Packaging method of JSON (JavaScript Object Notiation) data format

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郑伟光等: ""基于BER的ASN.1语法编译器及编解码器实现与应用"", 《计算机应用与软件》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976302A (en) * 2016-05-05 2016-09-28 北京思特奇信息技术股份有限公司 Configurable data comparing method and system

Also Published As

Publication number Publication date
CN103473058B (en) 2016-09-14

Similar Documents

Publication Publication Date Title
CN102436475B (en) Data table summarizing device and data table summarizing method
CN101504662B (en) Data conversion method and apparatus
CN109558479A (en) Rule matching method, device, equipment and storage medium
CN106599104A (en) Mass data association method based on redis cluster
CN103150332B (en) Earth observation Metadata integration method
CN105956082A (en) Real-time data processing and storage system
Broutin et al. Asymptotics of trees with a prescribed degree sequence and applications
CN106339498A (en) Method, device and system for synchronizing data
CN108984744A (en) A kind of non-master chain block self-propagation method
CN105630500A (en) CIM object model for data processing and programming frame thereof
CN103138981A (en) Method and device for social network service analysis
CN112287642B (en) Binary coding method for tree structure self-increment data node ID and path chain thereof
CN108763546A (en) A kind of conversion method of data format, device, storage medium and terminal
CN104008124B (en) Create the method for composite file and the data storage device with composite file
CN101894135A (en) Method for compressing and storing GPS data based on route clustering
CN102609482B (en) Packaging method of JSON (JavaScript Object Notiation) data format
CN110191156B (en) Data processing method and device based on block chain
CN104536700A (en) Code stream data rapid storage/reading method and system
CN102520953A (en) Page generating method based on BPMN (business process modeling notation) and device
CN104462095A (en) Extraction method and device of common pars of query statements
CN101996161B (en) A kind of old version data processing method of electronic document and device
CN103473058A (en) Convenient coding method for generating ASN1 (abstract syntax notation one) data files
CN109766343A (en) The method and apparatus of different flowline numberings is generated based on WBS instantiated nodes
KR101044870B1 (en) Method and Apparatus for Encoding and Decoding XML Documents Using Path Code
CN105302889B (en) The conversion method and device of data store organisation

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