CN103473058B - A kind of convenient coded method generating ASN1 data file - Google Patents
A kind of convenient coded method generating ASN1 data file Download PDFInfo
- Publication number
- CN103473058B CN103473058B CN201310409544.9A CN201310409544A CN103473058B CN 103473058 B CN103473058 B CN 103473058B CN 201310409544 A CN201310409544 A CN 201310409544A CN 103473058 B CN103473058 B CN 103473058B
- Authority
- CN
- China
- Prior art keywords
- file
- length
- fixed
- asn1
- rule
- 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.)
- Active
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to a kind of convenient coded method generating ASN1 data file, including: write configuration file and be resolved in internal memory;Read fixed-length file;Find the corresponding configuration rule of fixed-length file;A fixed-length record is read from fixed-length file;According to configuration rule, the field value obtained from fixed-length record is stored in the respective nodes of ASN1 structure tree;It is disposed if the fixed-length record judged in fixed-length file is the most processed, if be disposed, fixed-length file the structure tree of the ASN1 generated is encoded, generate ASN1 data file, otherwise repeat the above steps, until all fields of all fixed-length records are the most processed complete in fixed-length file;The method of the invention utilizes configuration file, and the form that will generate ASN1 data file carries out flexible configuration so that ASN1 data file can be by efficiently, assemble flexibly.
Description
Technical field
The present invention relates to document No. method, particularly relate to the coded method of a kind of data file of ASN1 easily, especially
Use when being the ASN1 data file needing to encapsulate form in pot inside telecommunication system.
Background technology
Along with telecom operators constantly develop, operation expanding is increasingly wider, and various new business emerge in an endless stream;Miscellaneous service
In ticket transmitting procedure, the carrier of carrying is the most different, the business ticket of the file multiple format to be carried of a kind of protocol code.
Traditional method for packing, is to be defined on inside program by traffic format, thus causes Added Business and amendment
During business, needing the amendment to program, workload is big, and risk is high.
In order to tackle this business polytropy, reduce the risk that amendment program causes, a kind of efficient data encapsulation of invention
Method is to be highly desirable to, and is also the most helpful.
Summary of the invention
The technical problem to be solved is for the deficiencies in the prior art, it is provided that a kind of generation ASN1 data file
Convenient coded method.
ASN1 abstract syntax notation one (Abstract Syntax Notation One) ASN1 is a kind of ISO/ITU-T mark
Standard, describes a kind of data form being indicated data, encode, transmit and decoding.
The length of the fixed-length record that fixed-length file stores in referring to it is all fixing, such as CDR file.
The technical scheme is that a kind of convenient coding staff generating ASN1 data file
Method, comprises the steps:
Step 1: writing a configuration file being made up of some set configuration rules, often set configuration rule is provided with a file
Head;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in internal memory;
Step 4: the header file of all with configuration file for the filename of fixed-length file configuration rules is grown most and mates,
Search corresponding configuration rule, if it is found, then enter step 5, otherwise send ALM, terminate;
Step 5: read a fixed-length record from fixed-length file;
Step 6: the field value obtained from described fixed-length record is stored to the corresponding of ASN1 structure tree according to configuration rule
On node;
Step 7: judging that all fixed-length records in fixed-length file are the most processed, if be disposed, then entering
Step 8, otherwise returns step 5;
Step 8: encode the structure tree of the ASN1 generated by fixed-length file, generates ASN1 data file, terminates.
On the basis of technique scheme, the present invention can also do following improvement.
Further, described configuration file includes some set configuration rules, and often set configuration rule includes some rules
?.
Further, described regularization term includes title regularization term, original position regularization term, length regularization term, path rule item
With data type rule item;
The title of the field of the field value that described title regularization term mark is to be obtained;
Described original position regularization term identifies field value the to be obtained starting position in fixed-length record;
Described length regularization term identifies field value the to be obtained length in fixed-length record;
The field value that described path rule item mark obtains will be stored in the path of ASN1 structure tree;
The field value that described data type rule item mark obtains is stored in ASN1 structure tree with which kind of data type.
Further, the field value obtained from described fixed-length record is stored to ASN1 structure according to configuration rule by step 6
Specifically comprising the following steps that in the respective nodes of tree
Step 6.1: according to the original position regularization term in configuration rule and length regularization term, obtains this fixed-length record middle finger
Determine the field value of position field;
Step 6.2: according to the data type rule item in configuration rule and path rule item, by the field value of acquisition with phase
The data type answered is stored in the respective nodes of ASN1 structure tree.
Further, also including in step 6.2, every fixed-length record has all processed for the strictly all rules item in configuration rule
Bi Houhui generates temporary file.
Further, described path rule item is scrabbled up by tag label value..
Further, also include that generating run daily record and generation process daily record.
Further, described ASN1 structure tree is generated by the conversion of one or more fixed-length file.
The invention has the beneficial effects as follows: the method for the invention utilizes configuration file, ASN1 data file will be generated
Form carries out flexible configuration so that ASN1 data file can be by efficiently, assemble flexibly, and the present invention uses and configures flexibly
File, " path " can revise increase at any time at configuration file, and the content of " value " is arranged also by flexible configuration, to the full extent
Improve the motility of program, eliminate the business dependency of program, when decreasing business reorganization, revise the risk that program causes.
Accompanying drawing explanation
Fig. 1 is a kind of convenient coded method flow chart generating ASN1 data file of the present invention;
Fig. 2 is the flow chart of step 6 of the present invention.
Detailed description of the invention
Being described principle and the feature of the present invention below in conjunction with accompanying drawing, example is served only for explaining the present invention, and
Non-for limiting the scope of the present invention.
As it is shown in figure 1, a kind of convenient coded method generating ASN1 data file, comprise the steps:
Step 1: writing a configuration file being made up of some set configuration rules, often set configuration rule is provided with a file
Head;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in internal memory;
Step 4: the header file of all with configuration file for the filename of fixed-length file configuration rules is grown most and mates,
Search corresponding configuration rule, if it is found, then enter step 5, otherwise send ALM, terminate;
Step 5: read a fixed-length record from fixed-length file;
Step 6: the field value obtained from described fixed-length record is stored to the corresponding of ASN1 structure tree according to configuration rule
On node;
Step 7: judging that all fixed-length records in fixed-length file are the most processed, if be disposed, then entering
Step 8, otherwise returns step 5;
Step 8: encode the structure tree of the ASN1 generated by fixed-length file, generates ASN1 data file, terminates.
Wherein, described configuration file includes some set configuration rules, and often set configuration rule includes some rule items.
Wherein, described regularization term include title regularization term, original 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 mark is to be obtained;
Described original position regularization term identifies field value the to be obtained starting position in fixed-length record;
Described length regularization term identifies field value the to be obtained length in fixed-length record;
The field value that described path rule item mark obtains will be stored in the path of ASN1 structure tree;
The field value that described data type rule item mark obtains is stored in ASN1 structure tree with which kind of data type.
Wherein, the field value obtained from described fixed-length record is stored to ASN1 structure tree according to configuration rule by step 6
Respective nodes on specifically comprise the following steps that
Step 6.1: according to the original position regularization term in configuration rule and length regularization term, obtains this fixed-length record middle finger
Determine the field value of position field;
Step 6.2: according to the data type rule item in configuration rule and path rule item, by the field value of acquisition with phase
The data type answered is stored in the respective nodes of ASN1 structure tree.
Wherein, also including in step 6.2, every fixed-length record is all disposed for the strictly all rules item in configuration rule
After can generate temporary file.
Wherein, described path rule item is scrabbled up by tag label value..
Wherein, also include that generating run daily record and generation process daily record.
Wherein, described ASN1 structure tree is generated by the conversion of one or more fixed-length file.
Below using the CDR file in telecommunication system as fixed-length file, original words monofile generating ASN. data file is
Example illustrates.
Below for using the most a set of the joining about CDR file in the configuration file related in the method for the invention
Put rule.
Filename according to CDR file and HEAD content in configuration file are grown most and are mated, and find the configuration rule of correspondence
Then, the configuration rule that HEAD will be found to be dvcr of the entitled dvcr of CDR file in the present embodiment;Regularization term in configuration rule
Including SRC, IN_START, IN_LEN, PATH, FIELD_TYPE;Wherein, SRC correspondence field to be obtained is in original words unirecord
Title;The corresponding field the to be obtained starting position in original words unirecord of IN_START, IN_LEN correspondence field to be obtained exists
Length in Original CDR, the path of field value ASN1 the to be stored in structure tree that PATH correspondence obtains, it is made up of tag value,
The field value that FILED_TYPE correspondence obtains with which kind of data type is stored in ASN1 structure tree.
Each ticket writing in original words monofile will travel through above-mentioned whole configuration rule (include from SRC1 to
SRC9);After having traveled through, then read a ticket writing from original words monofile, repeat aforesaid operations, until in CDR file
All ticket writings are all disposed, and generate ASN1 structure tree;The structure tree generated is encoded, generates ASN1 data literary composition
Part.Each ticket writing can generate temporary file after being disposed for strictly all rules item, and temporary file is stored other
In file.
It addition, the invention is not restricted to a fixed-length file (for CDR file in the present embodiment), generate an ASN1 structure
Tree, can generate an ASN1 structure tree with multiple fixed-length files, and as processed a fixed-length file, internal memory reads a fixed length again
File, carries out above-mentioned process;
As required, the fixed-length file specifying number jointly generate an ASN1 structure tree, then to final structure book
Encode, generate ASN1 data file.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all spirit in the present invention and
Within principle, any modification, equivalent substitution and improvement etc. made, should be included within the scope of the present invention.
Claims (6)
1. the convenient coded method generating ASN1 data file, it is characterised in that comprise the steps:
Step 1: writing a configuration file being made up of some set configuration rules, often set configuration rule is provided with a file header;
Often set configuration rule includes some rule items;
Described regularization term includes title regularization term, original position regularization term, length regularization term, path rule item and data type rule
Then item;
The title of the field of the field value that described title regularization term mark is to be obtained;
Described original position regularization term identifies field value the to be obtained starting position in fixed-length record;
Described length regularization term identifies field value the to be obtained length in fixed-length record;
The field value that described path rule item mark obtains will be stored in the path of ASN1 structure tree;
The field value that described data type rule item mark obtains is stored in ASN1 structure tree with which kind of data type;
Step 2: configuration file is resolved in internal memory;
Step 3 a: fixed-length file is read in internal memory;
Step 4: the header file of all with configuration file for the filename of fixed-length file configuration rules is grown most and mates, search
Corresponding configuration rule, if it is found, then enter step 5, otherwise sends ALM, terminates;
Step 5: read a fixed-length record from fixed-length file;
Step 6: according to configuration rule, the field value obtained from described fixed-length record is stored to the respective nodes of ASN1 structure tree
On;
Step 7: judging that all fixed-length records in fixed-length file are the most processed, if be disposed, then entering step
8, otherwise return step 5;
Step 8: encode the ASN1 structure tree generated by fixed-length file, generates ASN1 data file, terminates.
A kind of convenient coded method generating ASN1 data file, it is characterised in that in step 6
The concrete step field value obtained from described fixed-length record being stored in the respective nodes of ASN1 structure tree according to configuration rule
Rapid as follows:
Step 6.1: according to the original position regularization term in configuration rule and length regularization term, obtain specific bit in this fixed-length record
Put the field value of place's field;
Step 6.2: according to the data type rule item in configuration rule and path rule item, by the field value of acquisition with accordingly
Data type is stored in the respective nodes of ASN1 structure tree.
A kind of convenient coded method generating ASN1 data file, it is characterised in that also include step
In rapid 6.2, every fixed-length record can generate temporary file after being all disposed for the strictly all rules item in configuration rule.
A kind of convenient coded method generating ASN1 data file, it is characterised in that described path
Regularization term is scrabbled up by tag label value.
A kind of convenient coded method generating ASN1 data file, it is characterised in that also include raw
Running log and generation is become to process daily record.
A kind of convenient coded method generating ASN1 data file, it is characterised in that described ASN1
Structure tree is generated by the conversion of one or more fixed-length file.
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 CN103473058A (en) | 2013-12-25 |
CN103473058B true 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) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105976302A (en) * | 2016-05-05 | 2016-09-28 | 北京思特奇信息技术股份有限公司 | Configurable data comparing method and system |
Citations (4)
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 |
-
2013
- 2013-09-10 CN CN201310409544.9A patent/CN103473058B/en active Active
Patent Citations (4)
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)
Title |
---|
"基于BER的ASN.1语法编译器及编解码器实现与应用";郑伟光等;《计算机应用与软件》;20110228;第28卷(第2期);第196页左栏第11行至第198页左栏第40行 * |
Also Published As
Publication number | Publication date |
---|---|
CN103473058A (en) | 2013-12-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100432937C (en) | Delivering multimedia descriptions | |
CN100580661C (en) | Method and devices for encoding/decoding structured documents, especially XML documents | |
CN104620235B (en) | For the section boundary in adaptive crossfire and the system and method for identification | |
MXPA02006077A (en) | Binary format for mpeg-7 instances. | |
CN100399824C (en) | Generic adaptation layer for JVT video | |
CN109818930B (en) | Communication text data transmission method based on TCP protocol | |
CN102799592B (en) | The parsing method and system of rich text document | |
KR20040017327A (en) | Incremental bottom-up construction of data documents | |
CN105630500A (en) | CIM object model for data processing and programming frame thereof | |
CN101145157A (en) | XML format embedded type apparatus characteristic information analysis method | |
CN111666575B (en) | Text carrier-free information hiding method based on word element coding | |
CN103473058B (en) | A kind of convenient coded method generating ASN1 data file | |
CN105843663B (en) | Decoding method suitable for the description of ASN.1 recursion resolution data structure | |
JP4898224B2 (en) | How to encode structured documents | |
CN101189594A (en) | Method and system for mapping between components of a packaging model and features of a physical representation of a package | |
CN102609482B (en) | Packaging method of JSON (JavaScript Object Notiation) data format | |
KR101044870B1 (en) | Method and Apparatus for Encoding and Decoding XML Documents Using Path Code | |
CN101324846B (en) | Method for creating data model according to ASN.1 information dynamic state | |
CN101996161B (en) | A kind of old version data processing method of electronic document and device | |
CN104753891A (en) | XML (Extensive Markup Language) message analyzing method and device | |
CN104320454B (en) | A kind of method and system that self-defined output is realized in http protocol reduction | |
CN103139528B (en) | The processing method of a kind of audio, video data and device | |
CN108141640A (en) | Information processing equipment and information processing method | |
CN103246671A (en) | Processing method and device for abstract syntax notation files | |
CN111125207B (en) | Data acquisition method and device, connector and presto engine |
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 |