A graph theory-based communication protocol analysis method, device, equipment and medium

CN120455567BActive Publication Date: 2026-08-11CHENGDU AIRCRAFT INDUSTRY GROUP
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0006]本发明旨在解决现有技术中含有复帧的ICD在解析时,复用标识之间的依赖关系与数据流不一致时解析报错的问题,提出一种基于图论的通讯协议解析方法、装置、设备及介质,可以实现复杂ICD的正确解析

Benefits of technology

[0035] 1. This invention provides a solution for parsing complex ICDs containing multiple frames. It uses graph theory to prioritize multiplexing identifiers, which can avoid error problems when the dependencies between multiplexing identifiers are inconsistent with the data stream, thus improving the accuracy of complex ICD parsing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455567B_ABST
    Figure CN120455567B_ABST
Patent Text Reader

Abstract

This invention discloses a terminal identification method, device, equipment, and medium based on OCR technology, belonging to the field of automated testing technology. It includes: Step 1, dividing the ICD protocol into blocks according to ICD multiplexing identifiers; Step 2, establishing an adjacency matrix of the graph based on the relationships between multiple frames in the ICD; Step 3, determining the calculation order of each multiplexing identifier according to the adjacency matrix; Step 4, establishing pointers to multiplexing identifiers to provide a basis for setting the data stream buffer size and locating multiplexing identifiers; Step 5, calculating the value of each multiplexing identifier sequentially according to the data stream, selecting the corresponding protocol block, and combining them to form a dedicated parsing protocol for the current data frame; Step 6, repeating Step 5 until the parsing of all data streams is completed. This invention provides a solution for parsing complex ICDs containing multiple frames, effectively solving the error problem when the dependencies between multiplexing identifiers are inconsistent with the data stream.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated testing, and specifically to a graph theory-based method, apparatus, device, and medium for parsing communication protocols. Background Technology

[0002] Multiframes refer to the reuse of certain bytes, bits, or positions in a communication protocol (interface control file, ICD) to improve the compactness of the ICD and facilitate design and maintenance. For ease of description, we call these bytes or bits multiplexed identifiers.

[0003] If the dependencies between reuse identifiers are consistent with the data flow, the situation is relatively simple, such as... Figure 1 As shown, a, b, c, and d are multiplexing identifiers. The selection of Level 1 multiplexing blocks depends on the values ​​of a and d, respectively. The value of d is determined by b and c. The order of the values ​​of a, b, c, and d is consistent with the data stream.

[0004] However, traditional parsing methods will fail to resolve data when the dependencies between reuse identifiers are inconsistent with the data flow. Figure 2 As shown, 'a' is determined by 'b', and 'b' is determined by 'c'. That is, the order in which the values ​​of 'a' to 'c' are determined is 'c', 'b', and 'a'. However, the order of the data stream is 'a', 'b', and 'c'. Therefore, the traditional method of data stream parsing cannot be used.

[0005] In the prior art, patent CN107306256A discloses a communication protocol parsing method based on string type data. This patent matches based on a defined protocol and does not involve the issue of communication protocol reuse. Patent CN113364732A discloses a vehicle terminal communication protocol parsing method and device. This patent involves protocol matching, but it only initially selects based on the protocol's identifier bit and does not reuse internal bytes or bits of the protocol. Summary of the Invention

[0006] This invention aims to solve the problem of parsing errors when the dependencies between multiplexing identifiers are inconsistent with the data stream during the parsing of ICDs containing multiple frames in the prior art. It proposes a communication protocol parsing method, device, equipment and medium based on graph theory, which can realize the correct parsing of complex ICDs.

[0007] To achieve the above-mentioned objectives, the technical solution of the present invention is as follows:

[0008] A graph theory-based method for parsing communication protocols includes the following steps:

[0009] Step 1: Divide the ICD protocol into blocks and extract them individually according to the ICD's multiplexing identifier;

[0010] Step 2: Establish a directed graph adjacency matrix based on the relationships between multiple frames in the ICD;

[0011] Step 3: Determine the solution order for each reuse identifier based on the adjacency matrix;

[0012] Step 4: Establish a pointer to the reuse identifier and a data buffer;

[0013] Step 5: Load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, select the corresponding protocol block to combine, and form the dedicated parsing protocol for the current data frame;

[0014] Step 6: Repeat step 5 until all data streams have been parsed.

[0015] Furthermore, the method of dividing the ICD protocol into blocks based on the ICD multiplexing identifier includes: querying the smallest block containing the multiplexing identifier, extracting it separately, and not operating on other blocks that do not contain the multiplexing identifier.

[0016] Furthermore, the method of establishing a directed graph adjacency matrix based on the relationship between multiple frames in the ICD includes: firstly, determining the size of the initial adjacency matrix as N×N based on the number of multiplexing identifiers N, then the number of adjacency matrices to be calculated is [N / 2], where [N / 2] represents N / 2 rounded down, and the index m of the adjacency matrix is ​​1~[N / 2].

[0017] Furthermore, the step of determining the solution order of each reuse identifier based on the adjacency matrix includes:

[0018] First, the priority of the reuse identifier is determined by calculating the out-degree and in-degree of the current adjacency matrix. The priority of an out-degree of 0 is N-m+1, and the priority of an in-degree of 0 is m.

[0019] The current adjacency matrix is ​​pruned by removing the two rows and columns related to the two reuse identifiers whose priorities have just been determined, and a new adjacency matrix is ​​constructed with a size of [N-2(m-1)]×[N-2(m-1)].

[0020] Repeat the above operation to calculate the out-degree and in-degree of [N / 2] adjacency matrices, and obtain the solution order of each reuse identifier.

[0021] Furthermore, the pointer content to the multiplexing identifier includes the start bit and length of the multiplexing identifier, as well as the size of the block where the multiplexing identifier is located. The sum of the sizes of all the blocks where the multiplexing identifier is located constitutes the size of the data buffer area.

[0022] Furthermore, when determining the solution order of each reuse identifier, if the calculation result of the adjacency matrix has multiple out-degrees or in-degrees of 0, then any one of them can be randomly selected.

[0023] Furthermore, the step of sequentially calculating the value of each multiplexing identifier based on the data stream and selecting the corresponding protocol block for combination includes: selecting matching protocol content from the protocol blocks extracted in step 1 based on the calculated value of the multiplexing identifier, and combining all the matched protocol blocks with other protocols that do not contain multiplexing identifiers.

[0024] The present invention also provides a graph-based communication protocol parsing device, comprising:

[0025] The protocol segmentation module is used to segment the ICD protocol according to the ICD multiplexing identifier and extract the smallest block containing the multiplexing identifier separately.

[0026] The adjacency matrix building module is used to build a directed graph adjacency matrix based on the relationships between multiple frames in the ICD.

[0027] The priority determination module is used to determine the solution order of each reuse identifier based on the adjacency matrix;

[0028] The pointer creation module is used to create pointers to the reuse identifier and the data buffer.

[0029] The protocol generation module is used to load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, and select the corresponding protocol blocks to combine them to form a dedicated parsing protocol for the current data frame.

[0030] This invention also provides a graph-based communication protocol parsing device, comprising:

[0031] Memory, used to store computer programs;

[0032] A processor is used to implement the steps in the graph theory-based communication protocol parsing method described above when executing the computer program.

[0033] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the graph theory-based communication protocol parsing method described above.

[0034] In summary, the present invention has the following advantages:

[0035] 1. This invention provides a solution for parsing complex ICDs containing multiple frames. It uses graph theory to prioritize multiplexing identifiers, which can avoid error problems when the dependencies between multiplexing identifiers are inconsistent with the data stream, thus improving the accuracy of complex ICD parsing.

[0036] 2. This invention improves the parsing efficiency of ICD by establishing a cache for the reusable associated parts and quickly locating the reusable identifier to quickly generate a dedicated ICD for the current frame. Attached Figure Description

[0037] Figure 1 This diagram illustrates the consistency between dependencies and data flow between reuse identifiers.

[0038] Figure 2 This is a diagram illustrating the inconsistency between the dependencies between reuse identifiers and the data flow.

[0039] Figure 3 This is a flowchart of the present invention;

[0040] Figure 4 For the present invention embodiment 1 Figure 1 The constructed directed graph;

[0041] Figure 5 For the present invention embodiment 1 Figure 2 A directed graph has been constructed. Detailed Implementation

[0042] To more clearly illustrate the present invention, the following description, in conjunction with preferred embodiments and accompanying drawings, further clarifies the invention. Those skilled in the art should understand that the specific description below is illustrative rather than restrictive and should not be construed as limiting the scope of protection of the present invention.

[0043] To address the parsing error issue arising from inconsistencies between the dependencies between multiplexing identifiers and the data stream when parsing ICDs containing multiframes, this invention provides a graph-based communication protocol parsing method, such as... Figure 3 As shown, it includes the following steps:

[0044] Step 1: Divide the ICD protocol into blocks and extract them individually according to the ICD's multiplexing identifier;

[0045] Step 2: Establish a directed graph adjacency matrix based on the relationships between multiple frames in the ICD;

[0046] Step 3: Determine the solution order for each reuse identifier based on the adjacency matrix;

[0047] Step 4: Establish pointers to the reuse identifier and a data buffer area to provide a basis for setting the data stream buffer size and locating the reuse identifier;

[0048] Step 5: Load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, select the corresponding protocol block to combine, and form the dedicated parsing protocol for the current data frame;

[0049] Step 6: Repeat step 5 until all data streams have been parsed.

[0050] Example 1

[0051] This embodiment proposes a graph theory-based communication protocol parsing method, which includes the following steps:

[0052] Step 1: Divide the ICD protocol into blocks and extract them individually according to the ICD multiplexing identifier;

[0053] The specific operation method for this step is as follows: query the smallest block where the reuse identifier is located, extract it separately, and do not operate on other blocks that do not contain the reuse identifier.

[0054] Step 2: Establish a directed graph adjacency matrix based on the relationships between multiple frames in the ICD;

[0055] The specific operation method of this step is as follows: First, determine the size of the initial adjacency matrix as N×N based on the number of reuse identifiers N. Then, the number of adjacency matrices to be calculated is [N / 2], where [N / 2] represents N / 2 rounded down. The index m of the adjacency matrix is ​​1~[N / 2].

[0056] Step 3: Determine the solution order for each reuse identifier based on the adjacency matrix;

[0057] The specific steps for this operation are as follows:

[0058] First, the priority of the reuse identifier is determined by calculating the out-degree and in-degree of the current adjacency matrix in pairs; the priority of an out-degree of 0 is N-m+1, and the priority of an in-degree of 0 is m; the higher the priority, the later the calculation order.

[0059] Then, the current adjacency matrix is ​​pruned, removing the rows and columns related to the two reuse identifiers whose priorities have just been determined, and a new adjacency matrix is ​​constructed with a size of [N-2(m-1)]×[N-2(m-1)].

[0060] Finally, repeat the above operations to calculate the out-degree and in-degree of [N / 2] adjacency matrices, and obtain the solution order for each reuse identifier.

[0061] The following is based on Figure 1 Taking the reuse identifier as an example, let's illustrate how to determine the solution order of each reuse identifier based on the adjacency matrix:

[0062] Depend on Figure 1 From this, we know that b is determined by a, c is determined by b, and d is determined by both b and c. Therefore, we can draw the diagram as follows: Figure 4 The initial directed graph shown has N=4 and m takes values ​​of 1 and 2.

[0063] When m=1, its adjacency matrix is:

[0064] ;

[0065] In this matrix, a value of 1 in the first row and second column indicates that 'a' points to 'b'; a value of 1 in the second row and third column indicates that 'b' points to 'c'; a value of 1 in the second row and fourth column indicates that 'b' points to 'd'; and a value of 1 in the third row and fourth column indicates that 'c' points to 'd'. Calculating the row sum of the adjacency matrix yields the out-degrees of 'a', 'b', 'c', and 'd', which are 1, 2, 1, and 0 respectively. Since the out-degree of 'd' is 0, its priority is 4 - 1 + 1 = 4. Calculating the column sum of the adjacency matrix yields the in-degrees of 'a', 'b', 'c', and 'd', which are 0, 1, 1, and 2 respectively. Since the in-degree of 'a' is 0, its priority is 1.

[0066] When m=2, remove the elements related to a and d from the adjacency matrix. The new adjacency matrix has a size of 2×2. Calculate the row sum of the adjacency matrix to get the out-degrees of b and c, which are 1 and 0 respectively. We find that the out-degree of c is 0, so the priority of c is 4-2+1=3. Then calculate the column sum of the adjacency matrix to get the in-degrees of b and c, which are 0 and 1 respectively. We find that the in-degree of b is 0, so the priority of b is 2.

[0067] Therefore, the priorities of a, b, c, and d are 1, 2, 3, and 4, respectively.

[0068] The following is based on Figure 2 Taking the reuse identifier as an example, let's illustrate how to determine the solution order of each reuse identifier based on the adjacency matrix:

[0069] Depend on Figure 2 From this, we know that a is determined by b, and b is determined by c, so we can draw the diagram as follows: Figure 5 The directed graph shown has N=3 and m takes the value 1.

[0070] When m=1, its adjacency matrix is:

[0071] ,

[0072] In this case, a value of 1 in the first column of the second row indicates that b points to a; a value of 1 in the second column of the third row indicates that c points to b.

[0073] Calculating the row sum of the adjacency matrix yields the out-degrees of a, b, and c, which are 0, 1, and 1 respectively. Since a has an out-degree of 0, its priority is 3 - 1 + 1 = 3. Next, calculating the column sum of the adjacency matrix yields the in-degrees of a, b, and c, which are 1, 1, and 0 respectively. Since c has an in-degree of 0, its priority is 1. Therefore, the priorities of a, b, and c are 3, 2, and 1.

[0074] Step 4: Establish a pointer to the reuse identifier and a data buffer;

[0075] In this step, the pointer to the multiplexing identifier contains the start bit and length of the multiplexing identifier, as well as the size of the block containing the multiplexing identifier. Preferably, the size of the data buffer is the sum of the sizes of all blocks containing multiplexing identifiers. It should be noted that not all data is cached here, which can improve system performance.

[0076] Step 5: Load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, select the matching protocol content from the protocol blocks extracted in Step 1, and then combine all the matched protocol blocks with other protocols without multiplexing identifiers to form the dedicated parsing protocol for the current data frame.

[0077] Step 6: Repeat step 5 until all data streams have been parsed.

[0078] This invention provides a solution for parsing complex ICDs containing multiple frames. It can effectively solve the error problem when the dependencies between multiplexing identifiers are inconsistent with the data stream. It not only improves the accuracy of complex ICD parsing, but also improves the parsing efficiency by establishing a cache for the multiplexing association part and quickly locating the multiplexing identifier, thus rapidly generating a dedicated ICD for the current frame.

[0079] Example 2

[0080] Based on the same inventive concept, this embodiment provides a graph theory-based communication protocol parsing device, including: a protocol segmentation module, an adjacency matrix establishment module, a priority determination module, a pointer establishment module, and a protocol generation module.

[0081] The protocol segmentation module is configured to segment the ICD protocol according to the ICD multiplexing identifier and extract the smallest block containing the multiplexing identifier separately.

[0082] The adjacency matrix building module is configured to build a directed graph adjacency matrix based on the relationships between reuse identifiers in the ICD.

[0083] The priority determination module is configured to determine the solution order of each reuse identifier based on the adjacency matrix. Specifically, the priority determination module is configured to determine the solution order of each reuse identifier in the following way: First, by calculating the out-degree and in-degree of the current adjacency matrix, the priority of the reuse identifier is determined in pairs. The priority of an out-degree of 0 is N-m+1, and the priority of an in-degree of 0 is m, where N is the number of reuse identifiers. Then, the current adjacency matrix is ​​pruned, removing the rows and columns related to the two reuse identifiers whose priorities have just been determined, and a new adjacency matrix is ​​constructed with a size of [N-2(m-1)]×[N-2(m-1)]. Finally, the above operation is repeated to calculate the out-degree and in-degree of [N / 2] adjacency matrices to obtain the solution order of each reuse identifier.

[0084] The pointer creation module is configured to create pointers to multiplexed identifiers and a data buffer. Specifically, the pointers to multiplexed identifiers created by the pointer creation module include the start bit and length of the multiplexed identifier, as well as the size of the block containing the multiplexed identifier. The sum of the sizes of all blocks containing multiplexed identifiers constitutes the size of the data buffer.

[0085] The protocol generation module is configured to load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, and select the corresponding protocol blocks to combine them to form a dedicated parsing protocol for the current data frame.

[0086] The functions of each of the above modules correspond one-to-one with the steps in the data processing method in Example 1. Any parts not described in detail will not be repeated.

[0087] Example 3

[0088] Based on the same inventive concept, embodiments of the present invention also provide a graph-based communication protocol parsing device, comprising:

[0089] Memory, used to store computer programs;

[0090] A processor is used to implement the steps of a graph theory-based communication protocol parsing method as described in Embodiment 1 above when executing the computer program.

[0091] Preferably, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the device.

[0092] The processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor can be any conventional processor. The processor is the control center of the device and connects the various parts of the device using various interfaces and lines.

[0093] The memory mainly includes a program storage area and a data storage area. The program storage area can store the operating system, applications required for at least one function, etc., while the data storage area can store related data, etc. In addition, the memory can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard disk, a smart memory card, a secure digital card, and a flash memory card, or the memory can be other volatile solid-state storage devices.

[0094] Example 4

[0095] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the graph theory-based communication protocol parsing method described in Embodiment 1 above.

[0096] Computer storage media can be tangible media that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus or device.

[0097] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A graph theory-based method for parsing communication protocols, characterized in that, Includes the following steps: Step 1: Divide the ICD protocol into blocks and extract them individually according to the ICD's multiplexing identifier; Step 2: Construct a directed graph adjacency matrix based on the relationships between reuse identifiers in the ICD, including: First, the size of the initial adjacency matrix is ​​determined to be N×N based on the number of reuse identifiers N. Then, the number of adjacency matrices to be calculated is [N / 2], where [N / 2] represents N / 2 rounded down. The index m of the adjacency matrix is ​​1~[N / 2]. Step 3: Determine the solution order for each reuse identifier based on the adjacency matrix, including: First, the priority of the reuse identifier is determined by calculating the out-degree and in-degree of the current adjacency matrix. The priority of an out-degree of 0 is N-m+1, and the priority of an in-degree of 0 is m. The current adjacency matrix is ​​pruned by removing the rows and columns related to the two reuse identifiers whose priorities have just been determined, and a new adjacency matrix is ​​constructed with a size of [N-2(m-1)]×[N-2(m-1)]. Repeat the above operation to calculate the out-degree and in-degree of [N / 2] adjacency matrices, and obtain the solution order of each reuse identifier; Step 4: Establish a pointer to the reuse identifier and a data buffer; Step 5: Load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, select the corresponding protocol block to combine, and form the dedicated parsing protocol for the current data frame; Step 6: Repeat step 5 until all data streams have been parsed.

2. The graph theory-based communication protocol parsing method as described in claim 1, characterized in that, The method of dividing the ICD protocol into blocks based on the ICD reuse identifier includes: querying the smallest block containing the reuse identifier, extracting it separately, and leaving other blocks without reuse identifiers as is.

3. The graph theory-based communication protocol parsing method as described in claim 1, characterized in that, The pointer to the multiplexing identifier contains the start bit and length of the multiplexing identifier, as well as the size of the block in which the multiplexing identifier is located. The sum of the sizes of all the blocks in which the multiplexing identifiers are located constitutes the size of the data buffer.

4. The graph theory-based communication protocol parsing method as described in claim 1, characterized in that, When determining the solution order for each reuse identifier, if the calculation result of the adjacency matrix has multiple out-degrees or in-degrees of 0, then any one of them can be selected.

5. The graph theory-based communication protocol parsing method as described in claim 1, characterized in that, The step of sequentially calculating the value of each multiplexing identifier based on the data stream and selecting the corresponding protocol block for combination includes: selecting matching protocol content from the protocol blocks extracted in step 1 based on the calculated value of the multiplexing identifier, and combining all the matched protocol blocks with other protocols that do not contain multiplexing identifiers.

6. A communication protocol parsing device based on graph theory, characterized in that, include: The protocol segmentation module is used to segment the ICD protocol according to the ICD multiplexing identifier and extract the smallest block containing the multiplexing identifier separately. The adjacency matrix establishment module is used to establish a directed graph adjacency matrix based on the relationship between multiple frames in the ICD. It includes: firstly, determining the size of the initial adjacency matrix as N×N based on the number of multiplexing identifiers N, then the number of adjacency matrices to be calculated is [N / 2], where [N / 2] represents N / 2 rounded down, and the index m of the adjacency matrix is ​​1~[N / 2]. The priority determination module is used to determine the solution order of each reuse identifier based on the adjacency matrix. This includes: firstly, calculating the out-degree and in-degree of the current adjacency matrix to determine the priority of each reuse identifier in pairs; the priority of an out-degree of 0 is N-m+1, and the priority of an in-degree of 0 is m; then, pruning the current adjacency matrix by removing the rows and columns related to the two reuse identifiers whose priorities have just been determined, constructing a new adjacency matrix of size [N-2(m-1)]×[N-2(m-1)]; repeating the above operations to calculate the out-degree and in-degree of [N / 2] adjacency matrices to obtain the solution order of each reuse identifier. The pointer creation module is used to create pointers to the reuse identifier and the data buffer. The protocol generation module is used to load the data stream, calculate the value of each multiplexing identifier in sequence according to the data stream, and select the corresponding protocol blocks to combine them to form a dedicated parsing protocol for the current data frame.

7. A communication protocol parsing device based on graph theory, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of a graph-based communication protocol parsing method as described in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of a graph-based communication protocol parsing method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Communication protocol analysis method based on character string type data

    CN107306256A

  • Vehicle-mounted terminal communication protocol analysis method and device

    CN113364732A

  • Graph representation learning approach for efficient provenance graph search

    US20250110991A1

  • Multimodal digital document interfaces for dynamic and collaborative reviews

    WO2025050092A1