CN113742294A - Method, system, device and medium for decoding ASN.1-PER signaling message - Google Patents

Method, system, device and medium for decoding ASN.1-PER signaling message Download PDF

Info

Publication number
CN113742294A
CN113742294A CN202110967044.1A CN202110967044A CN113742294A CN 113742294 A CN113742294 A CN 113742294A CN 202110967044 A CN202110967044 A CN 202110967044A CN 113742294 A CN113742294 A CN 113742294A
Authority
CN
China
Prior art keywords
data structure
decoding
type
description
asn
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.)
Pending
Application number
CN202110967044.1A
Other languages
Chinese (zh)
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.)
Eastone Century Technology Co ltd
Original Assignee
Eastone Century 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 Eastone Century Technology Co ltd filed Critical Eastone Century Technology Co ltd
Priority to CN202110967044.1A priority Critical patent/CN113742294A/en
Publication of CN113742294A publication Critical patent/CN113742294A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses a method, a system, a device and a medium for decoding an ASN.1-PER signaling message, wherein the method comprises the following steps: acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class; reading the description file line by line to obtain data structure description; traversing each data structure description, analyzing the data structure description by adopting a keyword matching mode, and acquiring the data structure type of the data structure description; calling a decoding flow corresponding to the data structure type according to the data structure type for processing; playing all the data structure descriptions in a traversing way to realize the code generation of a decoder; the decoding flow is realized in a C + + mode. The invention calls different decoding functions according to different data structure types, analyzes the ASN.1 description file, generates codes and can quickly adapt to a new PER coding communication protocol. The invention can be widely applied to the technical field of communication.

Description

Method, system, device and medium for decoding ASN.1-PER signaling message
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, a system, an apparatus, and a medium for decoding an asn.1-PER signaling message.
Background
In the field of telecommunications, there are two types of asn.1 coding methods currently available: one is BER (basic coding rule) and PER (compression coding rule).
BER coding suffers from excessive overhead in size, requiring on average 50% more additional data than real coded data. PER coding is performed using bits as a minimum coding unit, and compression coding can be performed to the maximum extent, and thus PER coding is widely used in fields requiring high-speed data transmission, such as VoIP, video telephony, multimedia, and 3G.
PER coding must rely on asn.1 documentation. That is, both the transmitting and receiving parties must also know the specific structure of the message so that the encoded and decoded message can be compiled and identified.
In a communication system, more and more communication protocols adopt asn.1-PER for coding, such as S1AP in the LTE era, LTE-RRC protocol, NGAP in the 5G era, NR-RRC protocol, etc., and a signaling analysis system must decode the communication protocols to obtain communication parameters for subsequent data analysis.
The prior art discloses a method for coding and decoding ASN.1-PER data by inputting user configuration options and ASN.1 texts, and the core of the method is to introduce a coding and decoding method capable of customizing a data structure interface according to needs. The existing method has the following defects: 1) an asn.1-PER protocol usually includes a large number of data structures, the types of the data structures are different, different analysis codes need to be written for each data structure type, and developers need to know the details of the protocol, which has a large influence on development efficiency. 2) The customizable output static or dynamic data structure interface is mainly introduced, and how to facilitate later development of users is not introduced from the code implementation point of view.
Disclosure of Invention
To solve at least one of the technical problems in the prior art to a certain extent, an object of the present invention is to provide a method, a system, a device and a medium for decoding an asn.1-PER signaling message.
The technical scheme adopted by the invention is as follows:
an ASN.1-PER signaling message decoding method comprises the following steps:
acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class;
reading the description file line by line to obtain data structure description;
traversing each data structure description, analyzing the data structure description by adopting a keyword matching mode, and acquiring the data structure type of the data structure description;
calling a decoding flow corresponding to the data structure type according to the data structure type for processing;
playing all the data structure descriptions in a traversing way to realize the code generation of a decoder;
wherein the data structure types include a data type, a basic structure type, and a composite structure type.
Further, when the data structure type is a data type, the decoding process performs the following processing on the data structure description:
analyzing the data structure description according to the data type, extracting the specific data type of the data structure description, and extracting and recording a numerical value;
and writing the specific data type and the numerical value obtained by analysis into the header file in a decoding class member constant form.
Further, when the data structure type is the basic structure type, the decoding process performs the following processing on the data structure description:
judging the type of the data structure definition described by the data structure through keyword matching identification;
analyzing the data structure description according to the judged type to generate a processing function code of the basic structure type;
and writing the generated function code into the header file and the source file in the form of member functions of the decoding class.
Further, when the data structure type is a composite structure type, the decoding process performs the following processing on the data structure description:
analyzing the data structure description according to the composite structure type to obtain the specific type and the substructure member of the data structure description;
traversing the substructure members, identifying the substructure types of the substructure members, and calling corresponding decoding flows according to the substructure types for processing;
after traversing all the substructure members, generating a processing function code of a composite structure type;
writing the generated processing function code into a header file and a source file in a decoding class member function form;
wherein the substructure types include an anonymous base structure type and an anonymous composite structure type.
Further, the invoking a corresponding decoding process according to the substructure type for processing includes:
if the substructure type is an anonymous basic structure type, executing the following steps:
calling a decoding flow corresponding to the basic structure type to process the substructure members;
if the substructure type is an anonymous composite structure type, executing the following steps:
and recursively and repeatedly calling a decoding flow corresponding to the processing composite structure type to process the substructure members.
Further, the method for decoding the ASN.1-PER signaling message further comprises the following steps:
for the analysis in the PER coding, reading the bit stream by packaging a bit pointer class;
the bit pointer class encapsulates two member variables, which are a byte pointer m _ pos and a byte median offset m _ bit _ offset, respectively.
Further, the method for decoding the ASN.1-PER signaling message further comprises the following steps:
and adding member functions or overloading operators for the bit pointer class by utilizing the characteristic of adding member functions to the C + + class.
The other technical scheme adopted by the invention is as follows:
an asn.1-PER signaling message decoding system, comprising:
the file acquisition module is used for acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class;
the file reading module is used for reading the description file line by line to obtain the data structure description;
the file analysis module is used for traversing each data structure description, analyzing the data structure description in a keyword matching mode and acquiring the data structure type of the data structure description;
the file decoding module is used for calling a decoding flow corresponding to the data structure type according to the data structure type for processing;
the code generation module is used for playing all the data structure descriptions in a traversing manner to realize the generation of the decoder codes;
wherein the data structure types include a data type, a basic structure type, and a composite structure type.
The other technical scheme adopted by the invention is as follows:
an asn.1-PER signaling message decoding apparatus comprising:
at least one processor;
at least one memory for storing at least one program;
when executed by the at least one processor, cause the at least one processor to implement the method described above.
The other technical scheme adopted by the invention is as follows:
a storage medium having stored therein a processor-executable program for performing the method as described above when executed by a processor.
The invention has the beneficial effects that: the invention calls different decoding functions according to different data structure types, analyzes the ASN.1 description file, generates codes and can quickly adapt to a new PER coding communication protocol; in addition, the method is realized by adopting C + + language, has the speed of C language, and is suitable for analysis processing of large data volume scenes such as a signaling analysis system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description is made on the drawings of the embodiments of the present invention or the related technical solutions in the prior art, and it should be understood that the drawings in the following description are only for convenience and clarity of describing some embodiments in the technical solutions of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart illustrating an ASN.1-PER signaling message decoding method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a decoding process based on data structure type according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating generation of a function call relationship according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of BitPtr classes in an embodiment of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention. The step numbers in the following embodiments are provided only for convenience of illustration, the order between the steps is not limited at all, and the execution order of each step in the embodiments can be adapted according to the understanding of those skilled in the art.
In the description of the present invention, it should be understood that the orientation or positional relationship referred to in the description of the orientation, such as the upper, lower, front, rear, left, right, etc., is based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and larger, smaller, larger, etc. are understood as excluding the number, and larger, smaller, inner, etc. are understood as including the number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless otherwise explicitly limited, terms such as arrangement, installation, connection and the like should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
In this embodiment, an implementation method for generating a concise asn.1-PER analysis code is provided, where the asn.1-PER analysis code is implemented by using a C + + encapsulation characteristic. In the following, a detailed description is made by steps of encapsulating bit pointers, designing PER data structure parsing function, extracting structure key information from asn.1 document, generating parsing code, and the like.
(1) Encapsulated bit pointers
PER encoding is performed using bits as a minimum unit, whereas encoding and decoding of conventional protocols are performed using bytes (8-bit groups) as a minimum unit, and computer programming languages basically process data using bytes as a minimum unit of memory addressing. Therefore, for parsing PER coding, this embodiment proposes an operation method for reading a bitstream by encapsulating a bit pointer class (bitpttr class).
The bitpttr class encapsulates two member variables, namely a byte pointer m _ pos and a byte median offset m _ bit _ offset, by which the position of any bit in the stream can be represented. As shown in fig. 4, fig. 4 is a schematic diagram of the bitpttr class.
In addition, the characteristics of member functions can be added by using the C + + class, and some member functions or reloading operators are added to the bit pointer, such as:
1) the addition of a reload operator function based on bit-backward shifting makes the use of bit pointers as convenient as byte pointers.
2) And adding a bit-based shaping value-taking function, introducing a specified bit number as a parameter, and returning a shaping numerical value represented by a plurality of bits in the network byte order from the current bit position.
3) Adding a byte stream value-taking function for acquiring a plurality of lengths, transmitting a specified bit number and a byte stream output buffer pointer as parameters, and filling data of a plurality of bits starting from the current bit position into an output buffer.
4) And aiming at the encoding of the PER alignment mode, adding an alignment function for the alignment operation.
(2) Designing PER data structure universal analytic function
The data types for PER encoding include a basic data structure and a composite data structure. The present embodiment supports basic data structure parsing supported by PER coding, including a NULL type, a BOOLEAN type, an ENUMERATED type, an INTEREGER type, a BIT STRING type, and an OCTET STRING type. And the basic data structure analysis function transmits the current bit pointer and the upper and lower limit values of the structure quantity, and outputs the information decoding result contained in the type. The present embodiment supports the composite data structure analysis supported by PER coding, and mainly includes a CHOICE type, a SEQUENCE type, and a SEQUENCE OF type. And the composite data structure analysis function transmits a current bit pointer, the upper and lower limit values of the structure quantity and a sub-structure type analysis function pointer specific to the structure, and the analysis is performed item by item in a traversing manner. The parsing function pointer uses template type transfer values.
The CHOICE type parsing function may output the option sequence number value decoding information. Aiming at the condition that CHOICE and SEQUENCE types have expansion items, the analysis function of the type is realized by adopting a heavy-load homonymous function mode, wherein a function pointer transmits a value in an array form, and an introduced analysis function pointer array is divided into a base item and an expansion item so as to adapt to data analysis under two conditions. The design ensures the consistency of the number value of the substructure and the pointer value, and reduces the error probability caused by the number problem in later development and maintenance.
All PER data structure parsing functions constitute a generic decoding function library. All the general analytic functions are distinguished by the incoming parameters and call an aligned or non-aligned mode for decoding.
(3) Extracting structure key information from ASN.1 document, and generating decoding processing function code
As mentioned in the introduction, PER coding has to rely on asn.1 description documents, therefore, for parsing an asn.1-PER coding protocol, we need to acquire its asn.1 description documents first, and then extract key information for each type description to generate parsing type processing function codes.
A protocol generates a decoding class, a self-defined structure analysis function in the same protocol is realized in a member function mode of the decoding class, and a general decoding function library or other member functions are called to complete decoding.
The member function parameters of the decoding class uniformly take the reference of the current bit pointer and the residual bit length as input parameters so as to realize calling by using the uniform function pointer.
The custom structure refers to a data structure defined by the symbol in the ASN.1 description text.
In order to facilitate uniform calling, the types of the sub-structure function pointers transmitted by the analysis function of the composite data structure are unified into member function pointers of the decoding class.
And when the sub-structure type of the composite data structure is a basic data structure and a composite data structure defined by PER (PER encoding), the sub-structure type is regarded as an anonymous internal data type, a new structure name is formed by adopting the parent structure name and the sub-structure name, and the new structure name is processed by defining a member function of a decoding class.
And establishing an array, wherein the content is the name and the serial number of each processed self-defined structure, and a call stack is marked in the decoding process for subsequent developers to carry out field positioning and value taking according to the data structure level.
Based on the above description, the following describes the steps of processing the asn.1 document and generating the decoder code in detail with reference to the accompanying drawings.
As shown in fig. 1 and fig. 2, the present embodiment provides an asn.1-PER signaling message decoding method, including the following steps:
s1, acquiring the description file of ASN.1 text format needing data analysis, and creating the header file and source file of decoding class.
And acquiring an ASN.1 text format description document of data to be analyzed, reading the file content into a memory buffer area, and creating a decoding header file and a source file.
And S2, reading the description file line by line to obtain the data structure description. And reading the text line by line, and ignoring the empty lines and the annotations until a complete data structure description is read.
S3, traversing each data structure description, adopting a keyword matching mode to analyze the data structure description, and obtaining the data structure type of the data structure description. The data structure types include a data type, a basic structure type, and a composite structure type.
The data structure description obtained in step 2 is parsed by the key matching method, and the process proceeds to the following step S41 when the data structure type is a data type, to the following step S42 when the type is a basic structure type, and to step S43 when the type is a composite structure type.
And S4, calling a decoding flow corresponding to the data structure type according to the data structure type for processing.
Wherein, the step S4 includes steps S41-S43:
s41, analyzing the specific type of the data according to the data type obtained in the step S3, and recording the data; the generated data definition is additionally written into the header file created in the front in the form of the constant of the decoding class member. Go to step S2 to continue processing the next data structure description.
S42, according to the basic structure type obtained in the step S3, the specific type of the data structure definition is judged through keyword matching identification. And generating a corresponding type processing function code by analyzing the parameter information, and additionally writing a header file and a source file in a decoding type member function form. Go to step S2 to continue processing the next data structure description.
S43, analyzing the specific type and the sub-structure members according to the composite structure type obtained in the step S3, traversing the sub-structure members, and calling the step S42 to process when the sub-structure type is an anonymous basic structure type and the composite structure name _ sub-structure name is taken as a global name; when the substructure type is an anonymous composite structure type, the 'composite structure name _ substructure name' is taken as a global name, the step S43 is called repeatedly in a recursion mode, after traversal is completed, a composite data structure processing function code is generated according to the processing function names of all the substructures, and a header file and a source file are additionally written in a decoding member function mode.
And S5, playing all the data structure descriptions in a traversing way to realize the generation of the decoder codes.
Based on the function call, as shown in fig. 3, fig. 3 is a schematic diagram of generating a function call relationship. The boxes in the figure represent various analytic functions, including a general basic structure analytic function, a general composite structure analytic function, a class member basic structure analytic function, and a class member composite structure analytic function. The various analysis functions are in a calling relation, and a tree structure calling mode is formed according to the ASN.1 document definition. Wherein leaf nodes must be defined as generic infrastructure parsing functions.
The Parse functions are uniformly named using the Parse _ type name form.
Parse _ INTEREGER, Parse _ ENUMERATED, Parse _ OCTET _ STRING, Parse _ BIT _ STRING, and Parse _ BOOLEAN are referred to as generic base structure parsing functions.
Parse _ SEQUENCE et al, a defined type of parsing function that contains substructures is referred to as a generic composite structure parsing function. The contents contained in the boxes in the figure indicate the name of the parsing function to be used when parsing the sub-structure of the composite structure type.
The general analysis function is used for analyzing the data of the basic structure type and the composite structure type, and the general function is not dependent on specific ASN.1 document generation.
As shown in fig. 3, Parse _ a1, Parse _ a2, Parse _ a5, Parse _ B2, Parse _ Type1_ item3 are class member basic structure parsing functions, and the general basic structure parsing functions are directly called for processing.
The Parse _ Type1 and the Parse _ Type1_ item4 are class member composite structure parsing functions and contain substructure information, and arrays formed by the parsing functions of the substructures are required to be used as parameters and transmitted into corresponding universal composite structure parsing functions (such as Parse _ SEQUENCE) for processing.
The decoding class member analysis function is used for analyzing the structure type defined by the ASN.1 document and is generated according to different ASN.1 protocol documents, and the generation functions shown in the schematic diagram of FIG. 3 refer to generation of the decoding class member analysis function. Typically an asn.1 protocol document generates a decoding class.
In summary, compared with the prior art, the method of the present embodiment has the following beneficial effects:
(1) the method for reading data by using bit as minimum unit of memory addressing. The embodiment realizes the encapsulation processing of the reference pointer, realizes the pointer with the bit as the minimum addressing unit, and solves the problem that the prior art is difficult to maintain for processing the data in the bit stream format in the development process.
(2) And the resolution processing method of the ASN.1-PER coded data is realized by adopting a C + + mode. The embodiment utilizes the object-oriented characteristic of the C + + language to improve the readability and maintainability of the code. Compared with other languages, the C + + language is realized by adopting the C + + language, and compared with the other languages, the C + + language is used as a static type language, can keep the object-oriented characteristic, has the speed of the C language, and is suitable for analysis processing of large-data-volume scenes such as a signaling analysis system and the like. The uniform processing of the encapsulation of the bit pointers is realized by utilizing the class encapsulation of C + + and the characteristics of the function template, and the code structure is simplified; in the later development and maintenance, the interface member variables can be easily added without modifying the function interface or using the global variables, so that the readability and the maintainability of the code are ensured.
(3) A method for extracting information from an ASN.1 description file to generate a C + + analytic code. By adopting the method for extracting information from the ASN.1 description file to generate codes, the new PER coding communication protocol can be quickly adapted, the development workload is reduced, and the universality and the expandability of the analysis function are improved.
The present embodiment further provides an asn.1-PER signaling message decoding system, including:
the file acquisition module is used for acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class;
the file reading module is used for reading the description file line by line to obtain the data structure description;
the file analysis module is used for traversing each data structure description, analyzing the data structure description in a keyword matching mode and acquiring the data structure type of the data structure description;
the file decoding module is used for calling a decoding flow corresponding to the data structure type according to the data structure type for processing;
the code generation module is used for playing all the data structure descriptions in a traversing manner to realize the generation of the decoder codes;
wherein the data structure types include a data type, a basic structure type, and a composite structure type.
The asn.1-PER signaling message decoding system of this embodiment may execute the asn.1-PER signaling message decoding method provided in the method embodiments of the present invention, may execute any combination of the implementation steps of the method embodiments, and has the corresponding functions and beneficial effects of the method.
The present embodiment further provides an asn.1-PER signaling message decoding device, including:
at least one processor;
at least one memory for storing at least one program;
when executed by the at least one processor, cause the at least one processor to implement the method of fig. 1.
The asn.1-PER signaling message decoding device of this embodiment can execute the asn.1-PER signaling message decoding method provided in the method embodiments of the present invention, can execute any combination of the implementation steps of the method embodiments, and has the corresponding functions and benefits of the method.
The embodiment of the application also discloses a computer program product or a computer program, which comprises computer instructions, and the computer instructions are stored in a computer readable storage medium. The computer instructions may be read by a processor of a computer device from a computer-readable storage medium, and executed by the processor to cause the computer device to perform the method illustrated in fig. 1.
The embodiment also provides a storage medium, which stores instructions or programs capable of executing the method for decoding the asn.1-PER signaling message provided by the embodiment of the method of the present invention, and when the instructions or the programs are executed, the steps can be implemented by any combination of the embodiments of the method, and the method has corresponding functions and advantages of the method.
In alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flow charts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and in which sub-operations described as part of larger operations are performed independently.
Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the described functions and/or features may be integrated in a single physical device and/or software module, or one or more functions and/or features may be implemented in a separate physical device or software module. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary for an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be understood within the ordinary skill of an engineer, given the nature, function, and internal relationship of the modules. Accordingly, those skilled in the art can, using ordinary skill, practice the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative of and not intended to limit the scope of the invention, which is defined by the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the foregoing description of the specification, reference to the description of "one embodiment/example," "another embodiment/example," or "certain embodiments/examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. An ASN.1-PER signaling message decoding method is characterized by comprising the following steps:
acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class;
reading the description file line by line to obtain data structure description;
traversing each data structure description, analyzing the data structure description by adopting a keyword matching mode, and acquiring the data structure type of the data structure description;
calling a decoding flow corresponding to the data structure type according to the data structure type for processing;
playing all the data structure descriptions in a traversing way to realize the code generation of a decoder;
the decoding process is implemented in a C + + manner, and the data structure type includes a data type, a basic structure type, and a composite structure type.
2. The method of claim 1, wherein when the data structure type is data type, the decoding process performs the following processes on the data structure description:
analyzing the data structure description according to the data type, extracting the specific data type of the data structure description, and extracting and recording a numerical value;
and writing the specific data type and the numerical value obtained by analysis into the header file in a decoding class member constant form.
3. The method of claim 1, wherein when the data structure type is the basic structure type, the decoding process performs the following processes on the data structure description:
judging the type of the data structure definition described by the data structure through keyword matching identification;
analyzing the data structure description according to the judged type to generate a processing function code of the basic structure type;
and writing the generated function code into the header file and the source file in the form of member functions of the decoding class.
4. The method for decoding asn.1-PER signaling message as claimed in claim 1, wherein when the data structure type is a composite structure type, said decoding procedure performs the following processing on said data structure description:
analyzing the data structure description according to the composite structure type to obtain the specific type and the substructure member of the data structure description;
traversing the substructure members, identifying the substructure types of the substructure members, and calling corresponding decoding flows according to the substructure types for processing;
after traversing all the substructure members, generating a processing function code of a composite structure type;
writing the generated processing function code into a header file and a source file in a decoding class member function form;
wherein the substructure types include an anonymous base structure type and an anonymous composite structure type.
5. The method of claim 4, wherein said invoking a corresponding decoding procedure according to said substructure type for processing comprises:
if the substructure type is an anonymous basic structure type, executing the following steps:
calling a decoding flow corresponding to the basic structure type to process the substructure members;
if the substructure type is an anonymous composite structure type, executing the following steps:
and recursively and repeatedly calling a decoding flow corresponding to the processing composite structure type to process the substructure members.
6. The method for decoding ASN.1-PER signaling message as recited in claim 1, wherein said method for decoding ASN.1-PER signaling message further comprises the steps of:
for the analysis in the PER coding, reading the bit stream by packaging a bit pointer class;
the bit pointer class encapsulates two member variables, which are a byte pointer m _ pos and a byte median offset m _ bit _ offset, respectively.
7. The method for decoding ASN.1-PER signaling message as recited in claim 6, wherein said method for decoding ASN.1-PER signaling message further comprises the steps of:
and adding member functions or overloading operators for the bit pointer class by utilizing the characteristic of adding member functions to the C + + class.
8. An asn.1-PER signaling message decoding system, comprising:
the file acquisition module is used for acquiring a description file in an ASN.1 text format which needs data analysis, and creating a header file and a source file of a decoding class;
the file reading module is used for reading the description file line by line to obtain the data structure description;
the file analysis module is used for traversing each data structure description, analyzing the data structure description in a keyword matching mode and acquiring the data structure type of the data structure description;
the file decoding module is used for calling a decoding flow corresponding to the data structure type according to the data structure type for processing;
the code generation module is used for playing all the data structure descriptions in a traversing manner to realize the generation of the decoder codes;
wherein the data structure types include a data type, a basic structure type, and a composite structure type.
9. An asn.1-PER signaling message decoding apparatus, comprising:
at least one processor;
at least one memory for storing at least one program;
when executed by the at least one processor, cause the at least one processor to implement the method of any one of claims 1-7.
10. A storage medium having stored therein a program executable by a processor, wherein the program executable by the processor is adapted to perform the method of any one of claims 1-7 when executed by the processor.
CN202110967044.1A 2021-08-23 2021-08-23 Method, system, device and medium for decoding ASN.1-PER signaling message Pending CN113742294A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110967044.1A CN113742294A (en) 2021-08-23 2021-08-23 Method, system, device and medium for decoding ASN.1-PER signaling message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110967044.1A CN113742294A (en) 2021-08-23 2021-08-23 Method, system, device and medium for decoding ASN.1-PER signaling message

Publications (1)

Publication Number Publication Date
CN113742294A true CN113742294A (en) 2021-12-03

Family

ID=78732202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110967044.1A Pending CN113742294A (en) 2021-08-23 2021-08-23 Method, system, device and medium for decoding ASN.1-PER signaling message

Country Status (1)

Country Link
CN (1) CN113742294A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115190183A (en) * 2022-05-30 2022-10-14 深圳市科陆电子科技股份有限公司 Data structure construction, coding and decoding method of ASN.1 message
CN115913857A (en) * 2022-09-13 2023-04-04 成都芯通软件有限公司 Data processing method, device, radio frequency unit, base station and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0879311A (en) * 1994-07-07 1996-03-22 Kokusai Denshin Denwa Co Ltd <Kdd> Compression coding method for asn.1
CN1627757A (en) * 2003-12-12 2005-06-15 华为技术有限公司 Method for realizing general message interpreter
CN101197818A (en) * 2006-12-08 2008-06-11 中兴通讯股份有限公司 ASN.1 packet object oriented processing method
CN101202739A (en) * 2006-12-11 2008-06-18 中兴通讯股份有限公司 Device for processing ASN.1 message OO
US20110134939A1 (en) * 2008-07-02 2011-06-09 Xinping Zhang Method for processing tlv format of communication data
CN103677952A (en) * 2013-12-18 2014-03-26 华为技术有限公司 Coder decoder generating device and method
CN104539593A (en) * 2014-12-18 2015-04-22 中国人民解放军信息工程大学 H.245 message analysis method
CN105072130A (en) * 2015-08-26 2015-11-18 广州慧睿思通信息科技有限公司 Method for automatically generating code of ASN.1 decoder
CN105843663A (en) * 2016-04-18 2016-08-10 苏州简约纳电子有限公司 Coding and decoding method applicable to ASN.1 recursive solution data structure description
CN106412086A (en) * 2016-10-31 2017-02-15 武汉斗鱼网络科技有限公司 Method and system for automatically generating communication codes by employing protocol description file
CN111625244A (en) * 2020-05-29 2020-09-04 华畅科技(大连)股份有限公司 3GPP protocol-based ASN.1-PER dynamic and static encoding and decoding method
CN112188211A (en) * 2020-08-21 2021-01-05 北京新媒传信科技有限公司 Transcoding implementation method and device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0879311A (en) * 1994-07-07 1996-03-22 Kokusai Denshin Denwa Co Ltd <Kdd> Compression coding method for asn.1
CN1627757A (en) * 2003-12-12 2005-06-15 华为技术有限公司 Method for realizing general message interpreter
CN101197818A (en) * 2006-12-08 2008-06-11 中兴通讯股份有限公司 ASN.1 packet object oriented processing method
CN101202739A (en) * 2006-12-11 2008-06-18 中兴通讯股份有限公司 Device for processing ASN.1 message OO
US20110134939A1 (en) * 2008-07-02 2011-06-09 Xinping Zhang Method for processing tlv format of communication data
CN103677952A (en) * 2013-12-18 2014-03-26 华为技术有限公司 Coder decoder generating device and method
CN104539593A (en) * 2014-12-18 2015-04-22 中国人民解放军信息工程大学 H.245 message analysis method
CN105072130A (en) * 2015-08-26 2015-11-18 广州慧睿思通信息科技有限公司 Method for automatically generating code of ASN.1 decoder
CN105843663A (en) * 2016-04-18 2016-08-10 苏州简约纳电子有限公司 Coding and decoding method applicable to ASN.1 recursive solution data structure description
CN106412086A (en) * 2016-10-31 2017-02-15 武汉斗鱼网络科技有限公司 Method and system for automatically generating communication codes by employing protocol description file
CN111625244A (en) * 2020-05-29 2020-09-04 华畅科技(大连)股份有限公司 3GPP protocol-based ASN.1-PER dynamic and static encoding and decoding method
CN112188211A (en) * 2020-08-21 2021-01-05 北京新媒传信科技有限公司 Transcoding implementation method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115190183A (en) * 2022-05-30 2022-10-14 深圳市科陆电子科技股份有限公司 Data structure construction, coding and decoding method of ASN.1 message
CN115913857A (en) * 2022-09-13 2023-04-04 成都芯通软件有限公司 Data processing method, device, radio frequency unit, base station and storage medium
CN115913857B (en) * 2022-09-13 2024-05-28 成都芯通软件有限公司 Data processing method, device, radio frequency unit, base station and storage medium

Similar Documents

Publication Publication Date Title
CN107835178B (en) Multi-protocol service communication method and device and electronic equipment
EP2609720B1 (en) Method and apparatus for filtering streaming data
CN113742294A (en) Method, system, device and medium for decoding ASN.1-PER signaling message
JPH11249987A (en) Message processor, its method and storage medium storing message processing control program
US8683320B2 (en) Processing module, a device, and a method for processing of XML data
CN101202736B (en) Method for realizing encoding-decoding in communication network
CN111191422A (en) File format conversion method and device and computer readable storage medium
CN101702641A (en) Coding method and network server
CN112188211A (en) Transcoding implementation method and device
US20080313291A1 (en) Method and apparatus for encoding data
US8918356B2 (en) Method, apparatus and machine-readable medium for transforming, converting and processing messages between multiple systems
CN103036641A (en) Method and system of data exchange and deserialization method
Kangasharju et al. Xebu: A binary format with schema-based optimizations for XML data
US20070239818A1 (en) Method, apparatus and system for transforming, converting and processing messages between multiple systems
CN111049813B (en) Message assembling method, message analyzing method, message assembling device, message analyzing device and storage medium
CN117041652A (en) Video recording method and device based on browser, electronic equipment and storage medium
CN111782882A (en) TCP message conversion method, device, system and computer storage medium
CN110839022A (en) Vehicle-mounted control software communication protocol analysis method based on xml language
US7769896B2 (en) Method, apparatus and system for dispatching messages within a system
KR100898614B1 (en) Schema, syntactic analysis method and method of generating a bit stream based on a schema
US7243341B2 (en) Scripting language for processing typed structured data
CN115589440B (en) Message annotation configuration method, packet packing method and parsing method
CN114390032B (en) Outlet gateway request method, device, equipment and medium
CN110601794A (en) ASN.1 coding and decoding module and message data coding and decoding method
CN100589358C (en) Metod and system for processing messages, and message sending end and message receiving end

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination