CN116301907A - Method, device, medium and system for analyzing binary data of structure body - Google Patents

Method, device, medium and system for analyzing binary data of structure body Download PDF

Info

Publication number
CN116301907A
CN116301907A CN202310587225.0A CN202310587225A CN116301907A CN 116301907 A CN116301907 A CN 116301907A CN 202310587225 A CN202310587225 A CN 202310587225A CN 116301907 A CN116301907 A CN 116301907A
Authority
CN
China
Prior art keywords
decoding
binary data
data
parameters
decoding parameters
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
CN202310587225.0A
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.)
Chengdu Sobei Video Cloud Computing Co ltd
Original Assignee
Chengdu Sobei Video Cloud Computing 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 Chengdu Sobei Video Cloud Computing Co ltd filed Critical Chengdu Sobei Video Cloud Computing Co ltd
Priority to CN202310587225.0A priority Critical patent/CN116301907A/en
Publication of CN116301907A publication Critical patent/CN116301907A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, equipment, medium and system for analyzing binary data of a structural body, belonging to the field of data conversion, comprising the following steps: s1, reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file; s2, constructing a decoding parameter manager, and establishing a mapping relation between the generated address of the decoding parameter and the structure body identifier of each binary data block; s3, buffer data is input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation; s4, decoding according to the decoding parameters, and analyzing the decoded parameters into an array; and performing format conversion after the array is formed. The invention does not need to construct and maintain a large amount of similar codes, and greatly saves the research, development, maintenance and management cost.

Description

Method, device, medium and system for analyzing binary data of structure body
Technical Field
The present invention relates to the field of data conversion, and more particularly, to a method, apparatus, medium, and system for resolving binary data of a structure.
Background
In the field of data conversion, in the existing analysis scheme of a structure body, different analysis functions are independently configured for different structure bodies to analyze, if ten thousands of structure bodies need to be converted into JOSN or written into a database, ten thousands of analysis functions need to be written into the database, and the technical scheme causes complicated codes and also needs to maintain and manage a large number of analysis functions in the analysis process. The existing analysis scheme has the problems of various resource waste and maintenance difficulty increase.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a method, equipment, medium and system for analyzing binary data of a structural body, which do not need to construct and maintain a large number of similar codes and greatly save research, development, maintenance and management cost.
The invention aims at realizing the following scheme:
a method of resolving structural binary data, comprising the steps of:
s1, reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file;
s2, constructing a decoding parameter manager, and establishing a mapping relation between the generated address of the decoding parameter and the structure body identifier of each binary data block;
s3, buffer data is input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation;
s4, decoding according to the decoding parameters, and analyzing the decoded parameters into an array; and performing format conversion after the array is formed.
Further, in step S1, one structure corresponds to a plurality of decoding parameters, each decoding parameter having a plurality of data members.
Further, in step S2, each binary data block to be resolved has a structure identifier for locating the decoding parameters.
Further, in step S2, decoding parameters of different message data and an ID mapping table in the message data are stored in the decoding parameter manager, and after each message data comes in, matching is found according to the IDs of the two, so as to find the corresponding decoding parameters.
Further, in step S2, after generating the decoding parameters, the method includes the sub-steps of: the decoding parameters are stored in a constructed decoding parameter manager.
Further, in step S4, the format includes XML format, JSON format.
Further, each data member comprises: data type, address offset, and data length.
An apparatus for resolving structural binary data, comprising:
the initialization module is used for executing an initialization flow: reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file; a decoding parameter manager is reconstructed, and a mapping relation is established between the head address of the generated decoding parameter and the structure body identifier of each binary data block;
the decoding module is used for executing a decoding flow: buffer data input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation; decoding according to the decoding parameters, and analyzing the decoding parameters into an array; and performing format conversion after the array is formed.
A computer readable storage medium having stored therein a computer program loaded by a processor and executing the method of resolving structural binary data as claimed in any one of the preceding claims.
A system for resolving structural binary data comprising an apparatus for resolving structural binary data as described above.
The beneficial effects of the invention include:
according to the invention, the decoding parameters of the maintenance structure body are managed through the decoding parameter manager, and a large number of similar codes do not need to be constructed and maintained when Buffer data are analyzed, so that the research, development and maintenance management cost is greatly saved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is an initialization flow chart of a method according to an embodiment of the present invention;
fig. 2 is a decoding flow chart of the method according to the embodiment of the invention.
Detailed Description
All of the features disclosed in all of the embodiments of this specification, or all of the steps in any method or process disclosed implicitly, except for the mutually exclusive features and/or steps, may be combined and/or expanded and substituted in any way.
Aiming at the problems in the background, the inventor of the invention further considers that the existing analysis scheme has the main problems of large code quantity after creative thinking, and each structure body needs to construct an analysis function; the existing analysis scheme is difficult to maintain, and the analysis function is required to be synchronously maintained when the structural body is modified. Therefore, in order to solve the technical problems, the technical scheme of the invention is as follows: and generating decoding parameters in advance according to the description of the values of the elements in the plurality of structural bodies in the configuration file, constructing a decoding parameter manager, managing the structural bodies and the decoding parameters, and when Buffer data are input, rapidly judging the decoding parameters required for positioning by using the decoding parameter manager, decoding according to the decoding parameters, analyzing into an array and realizing analysis. Wherein, regarding the decoding parameters: the message data is a string of human-unreadable binary data, the decoding parameters are rules for decoding, the decoding parameters prescribe what type is from the beginning to the number of bits, and the binary of the corresponding bit is converted according to the type to obtain a numerical value, so that the decoding is completed. The invention constructs a decoding parameter manager, stores decoding parameters of different message data and ID mapping tables in the message data in the decoding parameter manager, and searches for matching according to the IDs of the two after each message data comes in, so as to find out corresponding decoding parameters. After the decoding parameters are generated, the decoding parameters are stored in a constructed decoding parameter manager.
The method of the present invention includes an initialization process and a decoding process. As shown in fig. 1, in the initialization flow, the following sub-flows are included: and 1, reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structures in the configuration file (one or more elements are taken from the structures meeting requirements). Wherein one of the structures corresponds to a plurality of decoding parameters, each decoding parameter having a plurality of data members, each data member comprising: data type, address offset, data length. For example, according to a certain rule, the following form decoding parameters are parsed: a.c, B.e and C.z. And 2, constructing a decoding parameter manager, wherein the decoding parameter manager is used for maintaining the mapping relation between the structural body and the decoding parameters.
As shown in fig. 2, in the decoding flow, the following sub-flows are included: step 1, when Buffer data is input, the decoding parameter manager automatically matches corresponding analysis parameters according to the Buffer data, if one Buffer data just accords with the example, the 1 st byte of binary data is converted into char type data, 2-3 bytes are converted into short type data, and the 4 th byte is converted into char type data according to the decoding parameters, so that an array is formed by pushing the Buffer data. And 2, after the array is formed, the user converts the array into other formats, such as XML, JSON, time sequence data or other data formats, according to the requirements of the user.
It should be noted that, within the scope of protection defined in the claims of the present invention, the following embodiments may be combined and/or expanded, and replaced in any manner that is logical from the above specific embodiments, such as the disclosed technical principles, the disclosed technical features or the implicitly disclosed technical features, etc.
Example 1
A method of resolving structural binary data, comprising the steps of:
s1, reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file;
s2, constructing a decoding parameter manager, and establishing a mapping relation between the generated address of the decoding parameter and the structure body identifier of each binary data block;
s3, buffer data is input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation;
s4, decoding according to the decoding parameters, and analyzing the decoded parameters into an array; and performing format conversion after the array is formed.
Example 2
On the basis of embodiment 1, in step S1, one structure corresponds to a plurality of decoding parameters, each of which has a plurality of data members.
Example 3
On the basis of embodiment 1, in step S2, each binary data block to be resolved has a structure body identifier for locating decoding parameters.
Example 4
Based on embodiment 1, in step S2, decoding parameters of different message data and an ID mapping table in the message data are stored in the decoding parameter manager, and after each message data comes in, matching is found according to the IDs of the two, so as to find the corresponding decoding parameters.
Example 5
On the basis of embodiment 3, in step S2, after generating decoding parameters, the sub-steps are included: the decoding parameters are stored in a constructed decoding parameter manager.
Example 6
On the basis of embodiment 1, in step S4, the format includes XML format, JSON format.
Example 7
On the basis of example 2, each data member comprises: data type, address offset, and data length.
Example 8
An apparatus for resolving structural binary data, comprising:
the initialization module is used for executing an initialization flow: reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file; a decoding parameter manager is reconstructed, and a mapping relation is established between the head address of the generated decoding parameter and the structure body identifier of each binary data block;
the decoding module is used for executing a decoding flow: buffer data input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation; decoding according to the decoding parameters, and analyzing the decoding parameters into an array; and performing format conversion after the array is formed.
Example 9
A computer-readable storage medium in which a computer program is stored, the computer program being loaded by a processor and executing the method of resolving structural binary data according to any one of embodiments 1 to 7.
Example 10
A system for resolving structural binary data comprising the apparatus for resolving structural binary data as described in embodiment 8.
The units involved in the embodiments of the present invention may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
According to an aspect of embodiments of the present invention, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternative implementations described above.
As another aspect, the embodiment of the present invention also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
The invention is not related in part to the same as or can be practiced with the prior art.
The foregoing technical solution is only one embodiment of the present invention, and various modifications and variations can be easily made by those skilled in the art based on the application methods and principles disclosed in the present invention, not limited to the methods described in the foregoing specific embodiments of the present invention, so that the foregoing description is only preferred and not in a limiting sense.
In addition to the foregoing examples, those skilled in the art will recognize from the foregoing disclosure that other embodiments can be made and in which various features of the embodiments can be interchanged or substituted, and that such modifications and changes can be made without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method of resolving structural binary data, comprising the steps of:
s1, reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file;
s2, constructing a decoding parameter manager, and establishing a mapping relation between the generated address of the decoding parameter and the structure body identifier of each binary data block;
s3, buffer data is input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation;
s4, decoding according to the decoding parameters, and analyzing the decoded parameters into an array; and performing format conversion after the array is formed.
2. The method of claim 1, wherein in step S1, one structure corresponds to a plurality of decoding parameters, each decoding parameter having a plurality of data members.
3. The method of claim 1, wherein in step S2, each binary data block to be resolved has a structure identifier for locating decoding parameters.
4. The method according to claim 1, wherein in step S2, decoding parameters of different message data and ID mapping tables in the message data are stored in the decoding parameter manager, and after each message data comes in, matching is found according to the IDs of the two, so as to find the corresponding decoding parameters.
5. A method of resolving structural binary data according to claim 3, characterized in that in step S2, after generating decoding parameters, it comprises the sub-steps of: the decoding parameters are stored in a constructed decoding parameter manager.
6. The method of parsing structure binary data according to claim 1, wherein in step S4, the format includes XML format, JSON format.
7. The method of resolving structural binary data according to claim 2, wherein each data member comprises: data type, address offset, and data length.
8. An apparatus for resolving binary data of a structure, comprising:
the initialization module is used for executing an initialization flow: reading a configuration file, and generating decoding parameters according to descriptions of values of elements in a plurality of structural bodies in the configuration file; a decoding parameter manager is reconstructed, and a mapping relation is established between the head address of the generated decoding parameter and the structure body identifier of each binary data block;
the decoding module is used for executing a decoding flow: buffer data input, and a decoding parameter manager locates decoding parameters according to the structure body identification and the mapping relation; decoding according to the decoding parameters, and analyzing the decoding parameters into an array; and performing format conversion after the array is formed.
9. A computer-readable storage medium, wherein a computer program is stored in the readable storage medium, and the computer program is loaded by a processor and executes the method for analyzing binary data of a structure according to any one of claims 1 to 7.
10. A system for resolving structural binary data comprising the apparatus for resolving structural binary data according to claim 8.
CN202310587225.0A 2023-05-24 2023-05-24 Method, device, medium and system for analyzing binary data of structure body Pending CN116301907A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310587225.0A CN116301907A (en) 2023-05-24 2023-05-24 Method, device, medium and system for analyzing binary data of structure body

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310587225.0A CN116301907A (en) 2023-05-24 2023-05-24 Method, device, medium and system for analyzing binary data of structure body

Publications (1)

Publication Number Publication Date
CN116301907A true CN116301907A (en) 2023-06-23

Family

ID=86836326

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310587225.0A Pending CN116301907A (en) 2023-05-24 2023-05-24 Method, device, medium and system for analyzing binary data of structure body

Country Status (1)

Country Link
CN (1) CN116301907A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1735209A (en) * 2004-08-02 2006-02-15 三星电子株式会社 Use the binary arithmetic decoding apparatus and method of pipeline organization
CN108052320A (en) * 2017-12-11 2018-05-18 上证所信息网络有限公司 A kind of method that binary structure body is converted to JSON objects
CN109814870A (en) * 2018-12-26 2019-05-28 东软集团股份有限公司 Data analysis method, device, storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1735209A (en) * 2004-08-02 2006-02-15 三星电子株式会社 Use the binary arithmetic decoding apparatus and method of pipeline organization
CN108052320A (en) * 2017-12-11 2018-05-18 上证所信息网络有限公司 A kind of method that binary structure body is converted to JSON objects
CN109814870A (en) * 2018-12-26 2019-05-28 东软集团股份有限公司 Data analysis method, device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN112104664B (en) Protocol conversion method, device and equipment for data of Internet of things
CN109104405B (en) Binary protocol encoding and decoding method and device
CN111090417B (en) Binary file analysis method, binary file analysis device, binary file analysis equipment and binary file analysis medium
CN112287009A (en) Interface calling and interface data warehousing method, device, equipment and storage medium
CN111131403A (en) Message coding and decoding method and device for Internet of things equipment
CN110708307B (en) Transcoder generation method and apparatus, electronic device, and storage medium
CN108664546B (en) XML data structure conversion method and device
CN113076729A (en) Method and system for importing report, readable storage medium and electronic equipment
CN108845995B (en) Data processing method, data processing apparatus, storage medium, and electronic apparatus
CN110806973A (en) Automatic generation method and device of interface message
CN114489594A (en) Method for constructing command parser, method and device for processing command parsing
CN111552839B (en) Object conversion method based on XML template
CN103051480B (en) The storage means of a kind of DN and DN storage device
CN115329759B (en) Information processing method, device, equipment and storage medium
CN116301907A (en) Method, device, medium and system for analyzing binary data of structure body
CN109992293B (en) Method and device for assembling Android system component version information
CN110795915B (en) Method, system, device and computer readable storage medium for modifying xml files in batches
CN116775599A (en) Data migration method, device, electronic equipment and storage medium
CN115437906A (en) Test method and device
CN113378544A (en) Text analysis method, text data acquisition method, device, medium and equipment
CN107612919B (en) Protocol configuration method and device
CN112632167A (en) Data conversion method and system for structured data and related device
CN112230983B (en) Information processing method, electronic device, and medium
CN115001628B (en) Data encoding method and device, data decoding method and device and data structure
CN114385947B (en) Webpage publishing method, system, device and medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230623