Movatterモバイル変換


[0]ホーム

URL:


CN120263352A - A method, device, equipment and storage medium for avoiding protocol frame header conflict - Google Patents

A method, device, equipment and storage medium for avoiding protocol frame header conflict
Download PDF

Info

Publication number
CN120263352A
CN120263352ACN202510615726.4ACN202510615726ACN120263352ACN 120263352 ACN120263352 ACN 120263352ACN 202510615726 ACN202510615726 ACN 202510615726ACN 120263352 ACN120263352 ACN 120263352A
Authority
CN
China
Prior art keywords
data
layer
bitmap
frame
conflict
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
CN202510615726.4A
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.)
XiAn Institute of Optics and Precision Mechanics of CAS
Original Assignee
XiAn Institute of Optics and Precision Mechanics of CAS
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 XiAn Institute of Optics and Precision Mechanics of CASfiledCriticalXiAn Institute of Optics and Precision Mechanics of CAS
Priority to CN202510615726.4ApriorityCriticalpatent/CN120263352A/en
Publication of CN120263352ApublicationCriticalpatent/CN120263352A/en
Pendinglegal-statusCriticalCurrent

Links

Landscapes

Abstract

Translated fromChinese

本发明公开一种协议帧头冲突规避的方法、装置、设备及存储介质,涉及数据传输的技术领域,应用于数据通信的发送端,包括:使用替换数据替换原始数据帧中的冲突数据,得到第一数据帧;根据冲突数据与原始数据帧的数据量,确定冲突率;根据冲突率的大小动态选择单层位图结构或多层位图结构,生成位图标注;在位图标注头部添加层级标识,末尾添加校验位,得到完整位图;将完整位图添加在第一数据帧的末尾。本发明在发送端检测并替换与帧头相同的数据,并在数据包尾部附加位图来标注替换位置,且位图的生成根据冲突数据的频率动态选择适当的位图结构,有效解决了数据传输效率低、处理复杂度高、处理延迟较长、鲁棒性不足以及位图设计僵化的问题。

The present invention discloses a method, device, equipment and storage medium for avoiding protocol frame header conflicts, which relates to the technical field of data transmission and is applied to the transmitting end of data communication, including: using replacement data to replace conflicting data in the original data frame to obtain a first data frame; determining the conflict rate according to the data volume of the conflicting data and the original data frame; dynamically selecting a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the conflict rate to generate a bitmap annotation; adding a level identifier to the header of the bitmap annotation and a check bit at the end to obtain a complete bitmap; adding the complete bitmap to the end of the first data frame. The present invention detects and replaces the same data as the frame header at the transmitting end, and appends a bitmap at the end of the data packet to mark the replacement position, and the generation of the bitmap dynamically selects an appropriate bitmap structure according to the frequency of the conflicting data, which effectively solves the problems of low data transmission efficiency, high processing complexity, long processing delay, insufficient robustness and rigid bitmap design.

Description

Method, device, equipment and storage medium for avoiding protocol frame header collision
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a method, an apparatus, a device, and a storage medium for avoiding a protocol frame header collision.
Background
In a communication protocol, a frame header is a predefined sequence of bytes used to identify the beginning of a data frame. However, when the same byte sequence as the frame header occurs in the data content, the receiving end may erroneously recognize it as a new frame header, resulting in a data parsing error, i.e., a frame header misjudgment. In order to avoid misjudgment of frame head, bit stuffing or byte stuffing is commonly adopted at present. The bit filling is to break the mode similar to the frame head by inserting extra bits in the data stream, and the byte filling is to avoid misjudgment by inserting escape characters and modifying the same data as the frame head. The method is widely applied to serial communication protocols such as HDLC, PPP and the like, and the uniqueness of the frame header is ensured by changing the data content.
In the prior art, a patent with a publication number of CN114337915A discloses a private protocol fault-tolerant processing method based on serial communication, which comprises the steps that frame header check data is added at the tail part of an original data frame by a data sender to obtain a first data frame, the first data frame comprises a frame header, a data area, a CRC check code and frame header check data, a dummy frame header in the data area and the CRC check code is replaced by replacement data to obtain a second data frame, the second data frame is sent to a data receiver, the data of the dummy frame header is identical with the data of the frame header, the data receiver judges whether the frame header check data of the received data frame meets preset conditions, and if yes, the replacement data in the received data frame is restored to the dummy frame header, so that the data frame received by the data receiver is identical with the data frame sent by the data sender.
Although the prior art can prevent erroneous judgment of the frame header in a specific scene, the prior art has the problems of low data transmission efficiency, high processing complexity, long processing delay, insufficient robustness, stiff bitmap design and the like.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for avoiding protocol frame header collision, which solve the problems of low data transmission efficiency, high processing complexity, long processing delay, insufficient robustness and stiff bitmap design in the prior art.
In order to achieve the above purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for avoiding collision of protocol frame headers, applied to a transmitting end of data communication, the method comprising:
the method comprises the steps of detecting conflict data in an original data frame, and replacing the conflict data by using replacement data to obtain a first data frame, wherein the conflict data are the rest data blocks which are the same as frame header bytes except data blocks corresponding to the frame header in the original data frame;
Determining the conflict rate of the original data frame according to the number of the conflict data and the total data block quantity of the original data frame;
Dynamically selecting a single-layer bitmap structure or a multi-layer bitmap structure according to the conflict rate to generate bitmap marks for representing positions of all conflict data, wherein the single-layer bitmap structure directly marks the positions of the conflict data in the original data frame;
adding a corresponding level identifier to the head of the bitmap mark, and adding a check bit to the tail of the bitmap mark to obtain a complete bitmap;
and adding the complete bitmap at the tail of the first data frame to obtain a second data frame.
In one possible implementation manner, the bitmap annotation comprises a single-layer bitmap annotation and a multi-layer bitmap annotation, wherein the single-layer bitmap structure or the multi-layer bitmap structure is dynamically selected according to the conflict rate, and the bitmap annotation used for representing the position of all conflict data is generated specifically comprises:
When the conflict rate is smaller than a first threshold value, selecting a single-layer bitmap structure, and marking whether each data block corresponding to the original data frame is conflict data or not by each bit of marking data of the single-layer bitmap structure to obtain a single-layer mark;
and selecting a multi-layer bitmap structure when the conflict rate is greater than or equal to the first threshold value, marking the position of conflict data in the layer by utilizing each bit of each layer of marking data by using the hierarchical structure, and generating a multi-layer mark.
In one possible implementation manner, the multi-layer bitmap structure comprises a two-layer bitmap structure and a three-layer bitmap structure, and the multi-layer bitmap structure is selected when the conflict rate is greater than or equal to the first threshold value, specifically comprising:
When the conflict rate is greater than or equal to the first threshold value and is smaller than a second threshold value, selecting the two-level graph structure;
and selecting the three-layer bitmap structure when the conflict rate is greater than or equal to the second threshold.
In one possible implementation manner, when the two-layer bitmap structure is selected, the marking data comprises first-layer marking data and second-layer marking data, the generated multi-layer marking is a two-layer marking, and the positions of conflict data in the layer are marked by each bit of each layer marking data to generate the multi-layer marking, which specifically comprises:
Marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a two-layer graph structure;
And marking whether each data block in the data segment containing the conflict data is the conflict data or not by each bit of second-layer marking data of the two-layer graph structure to obtain the two-layer marking.
In one possible implementation manner, when the three-layer bitmap structure is selected, the marking data comprises a first layer marking data, a second layer marking data and a third layer marking data, the generated multi-layer marking is a three-layer marking, and the position of conflict data in the layer is marked by each bit of each layer marking data to generate the multi-layer marking, which specifically comprises:
marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a three-layer bitmap structure, wherein each original data frame comprises a plurality of data segments, each data segment comprises a plurality of data small segments, and each data small segment comprises a plurality of data blocks;
marking whether each data segment in the data segments containing the conflict data contains the conflict data or not by each bit of the second layer marking data of the three-layer bitmap structure;
And marking whether each data block in the data small section containing the conflict data is the conflict data or not by each bit of third layer marking data of the three-layer bitmap structure to obtain three-layer marking.
In one possible implementation manner, the collision rate of the original data frame is determined according to the number of the collision data and the total data block amount of the original data frame, which is specifically:
and calculating the ratio of the number of the conflict data to the total data block quantity of the original data frame to obtain the conflict rate of the original data frame.
In a second aspect, the present invention provides a method for avoiding collision of protocol frame headers, applied to a receiving end of data communication, the method comprising:
The method comprises the steps of receiving a second data frame comprising a first data frame and a complete bitmap, wherein the first data frame is a data frame obtained by replacing conflict data in an original data frame by using replacement data, the conflict data are data blocks which are the same as the bytes of a frame head except the data blocks corresponding to the frame head in the original data frame, and the complete bitmap comprises a hierarchy identifier, a bitmap mark and a check bit which are sequentially arranged;
Determining a data analysis mode to be a single-layer analysis mode corresponding to a single-layer bitmap structure or a multi-layer analysis mode corresponding to a multi-layer bitmap structure according to the level identification, wherein the single-layer bitmap structure directly marks the position of conflict data in the original data frame;
According to the determined data analysis mode, the conflict position of conflict data in an original data frame is obtained by combining the bitmap annotation analysis;
Replacing the data block corresponding to the conflict position in the first data frame with the frame header byte to obtain a restored original data frame;
and outputting the restored original data frame after determining that the check bit accords with preset check data.
In a third aspect, the present invention provides an apparatus for avoiding collision of protocol frame headers, applied to a transmitting end of data communication, the apparatus comprising:
The device comprises a detection processing module, a data processing module and a data processing module, wherein the detection processing module is used for detecting conflict data in an original data frame and replacing the conflict data by using replacement data to obtain a first data frame;
a conflict frequency calculation module, configured to determine a conflict rate of the original data frame according to the number of conflict data and the total data block amount of the original data frame;
The system comprises a first bitmap generation module, a first bitmap generation module and a second bitmap generation module, wherein the first bitmap generation module is used for dynamically selecting a single-layer bitmap structure or a multi-layer bitmap structure according to the conflict rate to generate bitmap marks for representing positions of all conflict data;
the second bitmap generation module adds a corresponding level identifier to the head of the bitmap label, and adds a check bit to the tail of the bitmap label to obtain a complete bitmap;
And the data bitmap synthesis module is used for adding the complete bitmap at the tail end of the first data frame to obtain a second data frame.
In one possible implementation, the bitmap annotation comprises a single-layer bitmap annotation and a multi-layer bitmap annotation, and the first bitmap generation module is specifically configured to execute:
When the conflict rate is smaller than a first threshold value, selecting a single-layer bitmap structure, and marking whether each data block corresponding to the original data frame is conflict data or not by each bit of marking data of the single-layer bitmap structure to obtain a single-layer mark;
and selecting a multi-layer bitmap structure when the conflict rate is greater than or equal to the first threshold value, marking the position of conflict data in the layer by utilizing each bit of each layer of marking data by using the hierarchical structure, and generating a multi-layer mark.
In one possible implementation, the multi-layer bitmap structure includes a two-layer bitmap structure and a three-layer bitmap structure, and when the conflict rate is greater than or equal to the first threshold, the first bitmap generation module is specifically configured to perform:
When the conflict rate is greater than or equal to the first threshold value and is smaller than a second threshold value, selecting the two-level graph structure;
and selecting the three-layer bitmap structure when the conflict rate is greater than or equal to the second threshold.
In one possible implementation manner, when the two-layer bitmap structure is selected, the marking data comprises first-layer marking data and second-layer marking data, the generated multi-layer marking is a two-layer marking, and when each bit of each-layer marking data is used for marking the position of conflict data in the layer, the first bitmap generation module is specifically configured to execute:
Marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a two-layer graph structure;
And marking whether each data block in the data segment containing the conflict data is the conflict data or not by each bit of second-layer marking data of the two-layer graph structure to obtain the two-layer marking.
In one possible implementation manner, when the three-layer bitmap structure is selected, the marking data comprises first-layer marking data, second-layer marking data and third-layer marking data, the generated multi-layer marking is a three-layer marking, and when each bit of each layer marking data is utilized to mark the position of conflict data in the layer, the first bitmap generation module is specifically configured to execute:
marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a three-layer bitmap structure, wherein each original data frame comprises a plurality of data segments, each data segment comprises a plurality of data small segments, and each data small segment comprises a plurality of data blocks;
marking whether each data segment in the data segments containing the conflict data contains the conflict data or not by each bit of the second layer marking data of the three-layer bitmap structure;
And marking whether each data block in the data small section containing the conflict data is the conflict data or not by each bit of third layer marking data of the three-layer bitmap structure to obtain three-layer marking.
In one possible implementation, the collision frequency calculation module is specifically configured to perform:
and calculating the ratio of the number of the conflict data to the total data block quantity of the original data frame to obtain the conflict rate of the original data frame.
In a fourth aspect, the present invention provides an electronic device, including a processor and a memory, where the memory stores at least one instruction, at least one program, a set of codes, or a set of instructions, where the at least one instruction, the at least one program, the set of codes, or the set of instructions are loaded and executed by the processor to implement a method for protocol header collision avoidance as described in any of the preceding claims.
In a fifth aspect, the present invention provides a computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by a processor to implement the method for protocol header collision avoidance as described in any of the preceding claims.
In practical application, the method for avoiding the collision of the protocol frame header detects collision data identical to frame header bytes in an original data frame to be transmitted at a transmitting end of data communication, replaces the collision data with pre-designed replacement data to obtain a first data frame, determines a collision rate according to the collision data and the data quantity of the original data frame, dynamically selects a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the collision rate to generate bitmap marks for representing the positions of the collision data in the original data frame, adds a hierarchical mark at the header of the bit map, adds a check bit at the end to obtain a complete bitmap, finally splices the complete bitmap to the end of the first data frame to obtain a second data frame, and efficiently restores the original data frame by a receiving end according to the complete bitmap. The invention replaces the conflict data in the original data frame by the replacement data, marks the replacement position of the conflict data by the complete bitmap, wherein the generation of the bitmap can dynamically select a proper bitmap structure according to the frequency of the conflict data, namely, the invention effectively improves the data transmission rate, reduces the complexity and delay of data processing and improves the reliability and flexibility of data transmission by the intelligent multi-layer bitmap design scheme of dynamic division, context sensing and self-adaptive threshold adjustment.
Drawings
Fig. 1 is a flowchart of method steps of a method for avoiding collision of a protocol frame header, which is applied to a serial port communication transmitting end and provided by an embodiment of the present invention;
fig. 2 is a flowchart of method steps of a method for avoiding collision of a protocol frame header, which is applied to a serial port communication receiving end and provided by an embodiment of the present invention;
Fig. 3 is a block diagram of a device structure of a serial port communication transmitting end, which is a device for avoiding collision of a protocol frame header according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the embodiments of the present disclosure, unless otherwise indicated, the meaning of "a plurality" is two or more. In addition, the use of "based on" or "according to" is intended to be open and inclusive in that a process, step, calculation, or other action "based on" or "according to" one or more of the stated conditions or values may in practice be based on additional conditions or beyond the stated values.
In the prior art, the key of the private protocol fault-tolerant processing method based on serial communication disclosed in the patent with the publication number CN114337915A is that a data transmitting end identifies a byte sequence identical to a frame header in a data area or a cyclic redundancy check code, the identified byte sequence is called a pseudo frame header, the pseudo frame header is replaced by predefined replacement data to obtain a second data frame, a single-layer bitmap is used for marking a replacement position in the frame header check data, for example, the position of the replacement data is represented by 1, the positions of the rest data are represented by 0, and a receiving end restores the pseudo frame header according to the frame header check data.
Although the above processing method can prevent erroneous judgment of the frame header in a specific scene, there are also problems of low transmission efficiency, high processing complexity, long processing delay, insufficient robustness, stiff bitmap design, and the like.
Wherein, the low transmission efficiency means that the frame header check data filled with bits or bytes increases the extra data amount and reduces the bandwidth utilization. That is, the length of the data packet is further increased by adding the replacement data and the single-layer bitmap structure, especially when the frame header data collision is frequent, the bit-by-bit marking mode of the single-layer bitmap has lower transmission efficiency in the long data packet transmission process, and the more serious the influence on the transmission efficiency is.
The high processing complexity means that the sending end needs to monitor and replace data in real time, and the receiving end needs to decode and restore, thus increasing the calculation burden. That is, the bit-by-bit marking of the single-layer bitmap is more computationally burdensome to monitor, replace, and decode during long packet transmission.
A longer processing delay means that the padding, replacement and decoding process introduces additional processing time, which is not suitable for low delay scenario applications.
The lack of robustness means that filling information or checking data in a noise channel may be lost due to transmission errors, so that the data packet recovery fails, and the problem of misjudgment or tampering of the bitmap itself cannot be solved in the prior art.
The stiffness of the bitmap design refers to that in the data transmission process, only a fixed single-layer bitmap structure is used, and the bitmap structure cannot be adjusted according to the characteristics of the data packet or the channel condition, so that the signal transmission is not efficient in a high-collision or low-collision scene.
In order to solve the problems of low data transmission efficiency, high processing complexity, long processing delay, insufficient robustness and stiff bitmap design existing in the prior art, the embodiment of the invention provides a method, a device, equipment and a storage medium for avoiding protocol frame header collision.
As shown in fig. 1, in one embodiment of the present invention, a method for avoiding collision of protocol frame header is provided, and the method is applied to a transmitting end of data communication, where the data communication modes include serial communication, network communication, local area network communication, wireless communication, industrial communication, and the like;
The method comprises the following steps:
and 101, detecting conflict data in an original data frame, and replacing the conflict data by using replacement data to obtain a first data frame.
The conflict data are the data blocks which are the same as the frame header bytes except the data blocks corresponding to the frame header in the original data frame.
Specifically, the original data frame refers to a data packet to be transmitted, where the data packet includes a frame header byte. In step 101, byte content of each data block in the original data frame is detected in turn, and after collision data identical to the frame header byte is detected, the collision data is replaced by predefined replacement data, so as to obtain a first data frame. For example, the frame header data is AA 55, the predefined replacement data is AB 54, and after collision data is detected, the AB 54 is used for replacing the AA 55.
Step 102, determining the collision rate of the original data frame according to the number of the collision data and the total data block quantity of the original data frame.
Where the collision rate refers to the percentage of the number of collision data to the total number of data blocks of the original data frame.
In order to improve flexibility and adaptability of a communication protocol while solving the problem of frame header misjudgment, a data transmission scene may be divided according to a collision rate, for example, the data transmission scene may be divided into two scenes of high collision and low collision, or the data transmission scene may be divided into three scenes of high collision, medium collision and low collision. And further different bitmap structures are designed for different conflict scenes.
And 103, dynamically selecting a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the conflict rate, and generating bitmap labels for representing the positions of all conflict data.
Wherein the single-layer bitmap structure directly marks the position of the conflicting data in the original data frame.
The original data frame is divided layer by layer in the multi-layer bitmap structure, and the positions of the conflict data in each layer are marked sequentially by using the hierarchical structure.
Specifically, the single-layer bitmap structure is suitable for a scene with sparse conflict, directly marks whether each data block of the original data frame is conflict data, and is simple and efficient.
The multi-layer bitmap structure divides the original data frame into multiple layers layer by layer according to the actual demands of users, and adopts a layering marking mode to mark the position of conflict data in each layer of the original data frame, thereby realizing the optimization of bitmap length. The number of layers of the multi-layer bitmap structure can be designed according to the conflict rate, and when the conflict rate is high, the number of layers of the multi-layer bitmap structure can be properly increased. That is, the multi-layer bitmap structure is suitable for a scene in the collision set, and the data segments in the collision set are marked first through the hierarchical structure, and then specific positions of the collision data are marked in the marked data segments, so that the total length of the bitmap is shortened.
Specifically, the frequency of occurrence of the conflict data is reflected by the size of the conflict rate, and the larger the conflict rate is, the more frequently the conflict data is. In the actual data transmission process, a single-layer bitmap structure or a multi-layer bitmap structure is dynamically selected according to the size of the conflict rate to generate bitmap annotation, so that the best transmission efficiency can be realized under different conflict scenes.
And 104, adding a corresponding level identifier to the head of the obtained bitmap mark, and adding a check bit to the tail of the bitmap mark to obtain a complete bitmap.
Specifically, the hierarchy identifier is used for distinguishing bitmap structures corresponding to the bitmap labels, and the bitmap structures of different hierarchies correspond to different hierarchy identifiers.
Specifically, the bitmap structures corresponding to the bitmap labels are distinguished by using the 2-bit hierarchical labels, for example, a single-layer bitmap structure, a two-layer bitmap structure and a three-layer bitmap structure are respectively represented by 00, 01 and 10.
The check bit is mainly used for data check at the data receiving end, and accuracy of data transmission is improved.
And 105, adding the complete bitmap at the end of the first data frame to obtain a second data frame.
Specifically, the complete bitmap is spliced at the end of the first data frame, and the obtained second data is subjected to data transmission.
In practical application, the method for avoiding the collision of the protocol frame header detects collision data identical to frame header bytes in an original data frame to be transmitted at a transmitting end of data communication, replaces the collision data with pre-designed replacement data to obtain a first data frame, determines a collision rate according to the collision data and the data quantity of the original data frame, dynamically selects a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the collision rate to generate bitmap marks for representing the positions of the collision data in the original data frame, adds a hierarchical mark at the header of the bit map, adds a check bit at the end to obtain a complete bitmap, finally splices the complete bitmap to the end of the first data frame to obtain a second data frame, and efficiently restores the original data frame by a receiving end according to the complete bitmap.
The invention replaces the conflict data in the original data frame by the replacement data, marks the replacement position of the conflict data by the complete bitmap, wherein the generation of the bitmap can dynamically select the proper bitmap structure according to the frequency of the conflict data.
In other words, the intelligent multi-layer bitmap design scheme of dynamic division, context sensing and self-adaptive threshold adjustment effectively improves the data transmission rate, reduces the complexity and processing delay of data processing, and improves the reliability and flexibility of data transmission.
Further, bitmap annotations include single-layer bitmap annotations and multi-layer bitmap annotations. In step 103, dynamically selecting a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the conflict rate, and generating bitmap labels for representing positions of all conflict data, which specifically includes:
Step 1031, selecting a single-layer bitmap structure when the collision rate is smaller than a first threshold value, and marking whether each data block corresponding to the original data frame is collision data or not by each bit of marking data of the single-layer bitmap structure to obtain a single-layer mark.
Specifically, a low-conflict scene with a conflict rate smaller than a first threshold value is selected, a single-layer bitmap structure is selected in a conflict sparse scene, the length of the marked data is equal to the total number of data blocks of the original data frame, each bit of the marked data sequentially corresponds to one data block of the original data frame, and the numerical value of each bit of the marked data is used for indicating whether the corresponding data block is conflict data or not. For example, when a data block of the original data frame is collision data, the flag data bit corresponding to the data block is represented by 1, otherwise, the flag data bit is represented by 0.
Step 1032, selecting a multi-layer bitmap structure when the collision rate is greater than or equal to the first threshold, using the hierarchical structure, marking the position of the collision data within the layer with each bit of the marking data of each layer, and generating a multi-layer marking.
Specifically, a conflict rate is greater than or equal to a first threshold value as a conflict set scene, a multi-layer bitmap structure is selected in the scene, and bitmap length and analysis efficiency are optimized according to the conflict characteristics of data. The number of layers of the marking data is the same as that of the multi-layer bitmap structure, the number of bits of each layer of marking data is the same as that of the segments of the data in the layer, and for each layer of marking data, the numerical value of each bit of the marking data in the layer is used for representing whether the corresponding data segment comprises conflict data or not. For example, for a layer of tag data, if a data segment in the layer contains collision data, the tag data bit corresponding to the data segment is denoted by 1, otherwise, 0 is denoted.
Further, the multi-layer bitmap structure includes a two-layer bitmap structure and a three-layer bitmap structure. Selecting the multi-layer bitmap structure when the conflict rate is greater than or equal to a first threshold value, specifically comprising:
And selecting the two-level bitmap structure when the conflict rate is greater than or equal to the first threshold value and is simultaneously smaller than the second threshold value.
And selecting a three-layer bitmap structure when the conflict rate is greater than or equal to a second threshold.
Specifically, the magnitudes of the first threshold and the second threshold can be adjusted according to the user requirement.
In the embodiment of the invention, the first threshold value is 5%, and the second threshold value is 15%.
When the conflict rate is less than 5%, a single-layer bitmap structure is selected, when the conflict rate is less than or equal to 5% and less than or equal to 15%, a two-layer bitmap structure in the multi-layer bitmap structure is selected, and when the conflict rate is more than or equal to 15%, a three-layer bitmap structure in the multi-layer bitmap structure is selected.
In the present embodiment, each data block is exemplified by 1 byte, and bitmap designs under different conflict scenarios are as follows
Table 1 shows:
Table 1 bitmap design table for low, medium, and high conflict scenarios
As can be seen from table 1, in the low-collision scenario with the collision rate of <5%, the length of the marking data is equal to the number of data blocks through the single-layer bitmap structure, each bit of the marking data corresponds to one data block, and the total length of the generated bitmap marking is fixed.
In a medium conflict scene with a conflict rate of less than or equal to 5 percent and less than 15 percent, marking a data segment containing conflict data by the first layer of marking data of a double-layer bitmap structure, marking the specific position of the conflict data in the marked data segment by the second layer of marking data, and optimizing the bitmap length.
In a high conflict scene with the conflict rate more than or equal to 15%, marking a data segment containing conflict data through a first layer of marking data of a three-layer bitmap structure, marking the position of a data segment containing conflict data in the marked data segment through a second layer of marking data, marking the position of the conflict data in the marked data segment through a third layer of marking data, and balancing the bitmap length and the analysis complexity.
Further, when the two-layer graph structure is selected, the marking data comprise first-layer marking data and second-layer marking data, and the generated multi-layer marking is a two-layer marking.
Marking the position of conflict data in the layer by each bit of each layer of marking data to generate a multi-layer mark, which specifically comprises the following steps:
each bit of the first layer marking data of the two-layer bitmap structure is used for marking whether each data segment in the original data frame contains conflict data.
Wherein each original data frame comprises a plurality of data segments, and each data segment comprises a plurality of data blocks.
And marking whether each data block in the data segment containing the conflict data is the conflict data or not by each bit of second-layer marking data of the two-layer graph structure to obtain the two-layer marking.
Specifically, the conflict rate is larger than or equal to a first threshold value and smaller than a second threshold value at the same time, and a two-level chart structure is adopted in the conflict scene.
The length of the first layer of marking data is the same as the length of the data segments, each bit of the first layer of marking data sequentially corresponds to one data segment, the numerical value of each bit of the first layer of marking data is used for representing whether the corresponding data segment contains conflict data, if so, the corresponding data segment is represented by 1, and otherwise, the corresponding data segment is represented by 0.
The length of the second layer of marking data is equal to the total amount of the data blocks in the data segment containing the conflict data, each bit of the second layer of marking data sequentially corresponds to one data block in the data segment containing the conflict data, the numerical value of each bit of the second layer of marking data is used for representing whether the corresponding data block is the conflict data, if the corresponding data block is the conflict data, the corresponding data block is represented by 1, and otherwise, the corresponding data block is represented by 0.
Further, when the three-layer bitmap structure is selected, the marking data comprises a first layer marking data, a second layer marking data and a third layer marking data, and the generated multi-layer marking is a three-layer marking.
Marking the position of conflict data in the layer by each bit of each layer of marking data to generate a multi-layer mark, which specifically comprises the following steps:
each data segment in the original data frame is marked with each bit of the first layer marking data of the three-layer bitmap structure to determine whether the data segment contains conflicting data.
Wherein each original data frame comprises a plurality of data segments, each data segment comprises a plurality of data small segments, and each data small segment comprises a plurality of data blocks.
Each bit of the second layer marking data of the three-layer bitmap structure is used for marking whether each data small segment in the data segments containing the conflict data contains the conflict data.
And marking whether each data block in the data small section containing the conflict data is the conflict data or not by each bit of third layer marking data of the three-layer bitmap structure to obtain three-layer marking.
Specifically, a high conflict scene with a conflict rate greater than a second threshold value is adopted, and a three-layer bitmap structure is adopted in the conflict scene.
The length of the first layer of marking data is the same as the length of the data segments, each bit of the first layer of marking data sequentially corresponds to one data segment, the numerical value of each bit of the first layer of marking data is used for representing whether the corresponding data segment contains conflict data, if so, the corresponding data segment is represented by 1, and otherwise, the corresponding data segment is represented by 0.
The length of the second layer of marked data is equal to the total amount of the data segments in the data segment containing the conflict data, each bit of the second layer of marked data sequentially corresponds to one data segment in the data segment containing the conflict data, the numerical value of each bit of the second layer of marked data is used for representing whether the corresponding data segment contains the conflict data, if so, the corresponding data segment is represented by 1, and otherwise, the corresponding data segment is represented by 0.
The length of the third layer of marked data is equal to the total amount of data blocks in the data small section containing the conflict data, each bit of the third layer of marked data sequentially corresponds to one data block in the data small section containing the conflict data, the value of each bit of the third layer of marked data is used for indicating whether the corresponding data block is the conflict data, if so, the corresponding data block is indicated by 1, and otherwise, the corresponding data block is indicated by 0.
In the embodiment of the present invention, it is assumed that a packet has a length of 64 bytes, where the frame header data is AA 55, and occupies 2 bytes, and the remaining 62 bytes are data portions. The size of each data block is defined as 2 bytes, so the data portion contains 31 data blocks.
The number of conflict data in 31 data blocks of the data part is detected, the conflict rate is determined according to the number of the conflict data and the total number of the data blocks, and the data transmission scenes are divided into a low conflict scene, a medium conflict scene and a high conflict scene according to the size of the conflict rate.
In the first scenario, it is assumed that the number of conflicting data is 1, and the position of the conflicting data is the 5 th data block.
According to the ratio of the number of conflict data to the total number of data blocks, the conflict rate of the first scene is calculated to be less than 5%, therefore, the first scene is a low-conflict scene, a single-layer bitmap structure is used, 31 data blocks are represented through 31 bits, 4 bytes are occupied (the insufficient bits are filled with 0), and the bitmap generated by the first scene is marked as 00001000 00000000 00000000 00000000 and indicates that the 5 th data block is conflict data.
And using 00 to represent a single-layer bitmap structure, wherein the check bit adopts parity check, when the number of 1 in the bitmap marking is odd, the check bit is 1, and when the number of 1 in the bitmap marking is even, the check bit is 0.
Thus, the full bitmap of the first scene is 00 00001000 00000000 00000000 000000001.
In the second scenario, the number of conflicting data is assumed to be 3, and the positions of the conflicting data are 2 nd, 5 th and 10 th data blocks.
And according to the ratio of the number of the conflict data to the total number of the data blocks, calculating the conflict rate of the second scene of 5 percent to less than or equal to 15 percent. Thus, the second scenario is a medium collision scenario, using a two-level bitmap structure, the first layer of which divides 31 data blocks into 4 data segments, 8 data blocks per segment (7 of the last segment), and marks the data segments containing collision data using 4 bits, and the second layer generates an 8-bit bitmap for each data segment containing collision data, marking the specific location of collision data.
The first layer bitmap of the second scene is 1100, indicating that the first data segment and the second data segment contain conflicting data. The first data segment (1 st to 8 th data block) of the second layer is marked with bitmap 01001000, which indicates that the 2 nd data block and the 5 th data block are conflict data, and the second data segment (1 st to 8 th data block) of the second layer is marked with bitmap 01000000, which indicates that the 10 th data block is conflict data.
A 01 is used to represent a two-level bitmap structure and a check bit is used to check the entire bitmap, which in this embodiment is assumed to be 1.
Thus, the full bitmap of the first scene is 01 1100 01001000 01000000 1.
In the third scenario, the number of conflicting data is assumed to be 10, and the positions of the conflicting data are 1 st, 3 rd, 5 th, 7 th, 9 th, 11 th, 13 th, 15 th, 17 th, and 19 th data blocks.
And according to the ratio of the number of the conflict data to the total number of the data blocks, calculating the third scene conflict rate not less than 15%. Therefore, the third scenario is a high-conflict scenario, using a three-layer bitmap structure, the first layer of which divides 31 data blocks into 2 data segments, 16 data blocks per segment (15 last segments) and marks the data segments containing conflict data using 2 bits, the second layer divides the data segments containing conflict data into 4 data segments, 4 data blocks per segment and marks the data segments containing conflict data using 4 bits, and the third layer generates a 4-bit bitmap for the data segments containing conflict data, marking the specific positions of conflict data.
The first layer bitmap of the second scene is 11, which indicates that 2 data segments each contain conflicting data. The first data segment (1 st to 16 th data block) marking bitmap of the second layer is 1111, which indicates that all the data segments of the first data segment contain conflict data, and the second data segment (17 th to 31 th data block) marking bitmap of the second layer is 1000, which indicates that only the first data segment of the second data segment contains conflict data. The first data small section (1 st to 4 th data blocks) of the first data section of the third layer is marked with bitmaps of 1010, the 1 st data block and the 3 rd data block are the conflict data, the second data small section (5 th to 8 th data blocks) of the first data section of the third layer is marked with bitmaps of 1010, the 5 th data block and the 7 th data block are the conflict data, the third data small section (9 th to 12 th data blocks) of the first data section of the third layer is marked with bitmaps of 1010, the 9 th data block and the 11 th data block are the conflict data, the fourth data small section (13 th to 16 th data blocks) of the first data section of the third layer is marked with bitmaps of 1010, the 13 th data block and the 15 th data block are the conflict data, and the first data small section (17 th to 20 th data blocks) of the second data section of the third layer is marked with bitmaps of 1010, the 17 th data block and the 19 th data block are the conflict data.
A three-layer bitmap structure is denoted by 10 and a check bit is used to check the entire bitmap, which in this embodiment is assumed to be 0.
Thus, the full bitmap of the third scene is 10 11 1111 1000 1010 1010 1010 1010 10100.
The specific values and structures of the bitmaps in the three scenarios are shown in table 2:
TABLE 2 bitmap concrete values and Structure Table for Low Conflict, medium Conflict and high Conflict scenes
As can be seen from Table 2, the invention dynamically adjusts the bitmap level by utilizing the conflict rate, uses a single-layer bitmap in a low-conflict scene, is simple and direct, adopts a two-layer bitmap in a medium-conflict scene to reduce the bitmap length, and adopts a three-layer bitmap in a high-conflict scene to further optimize the bitmap representation efficiency.
Further, in step 102, the collision rate of the original data frame is determined according to the number of the collision data and the total data block of the original data frame, specifically:
and calculating the ratio of the number of the conflict data to the total data block of the original data frame to obtain the conflict rate of the original data frame.
As shown in fig. 2, in another embodiment of the present invention, a method for avoiding collision of protocol frame header is provided, and the method is applied to a receiving end of data communication, and includes:
Step 201, a second data frame comprising a first data frame and a full bitmap is received.
The first data frame is a data frame after replacing conflict data in the original data frame by using replacement data.
The conflict data are the data blocks which are the same as the frame header bytes except the data blocks corresponding to the frame header in the original data frame.
The complete bitmap comprises a hierarchy identifier, a bitmap label and check bits which are sequentially arranged.
Step 202, determining that the data analysis mode is a single-layer analysis mode corresponding to the single-layer bitmap structure or a multi-layer analysis mode corresponding to the multi-layer bitmap structure according to the hierarchy identification.
Wherein the single-layer bitmap structure directly marks the position of the conflicting data in the original data frame.
The original data frame is divided layer by layer in the multi-layer bitmap structure, and the positions of the conflict data in each layer are marked sequentially by using the hierarchical structure.
And 203, according to the determined data analysis mode, combining bitmap annotation analysis to obtain the conflict position of the conflict data in the original data frame.
Wherein the bitmap annotation is generated based on a single-layer bitmap structure or a multi-layer bitmap structure.
And 204, replacing the data block corresponding to the conflict position in the first data frame with the frame header byte to obtain the restored original data frame.
Step 205, after determining that the check bit accords with the preset check data, outputting the restored original data frame.
In the embodiment of the invention, after receiving the second data frame, the receiving end disassembles the second data frame into the first data frame and the complete bitmap.
And secondly, reading the level identification of the complete bitmap header, and determining the bitmap structure according to the level identification. For example, the 2-bit fixed bitmap structure of the header of the complete bitmap is read, and when the read level identifiers are 00, 01 and 10 respectively, the corresponding bitmap structures are a single-layer bitmap structure, a two-layer bitmap structure and a three-layer bitmap structure respectively.
And thirdly, analyzing the bitmap labels of the complete bitmap according to the data analysis mode corresponding to the identified bitmap structure, and determining the position of conflict data.
For example, when the identified bitmap structure is a single-layer bitmap structure, the bitmap annotation is directly read, and the position of the conflict data is determined according to the position of 1 in the bitmap annotation.
When the identified bitmap structure is a two-layer bitmap structure, analyzing the first layer data of the bitmap label to determine a data segment containing conflict data, and analyzing the second layer data of the bitmap label to determine the position of the conflict data in the corresponding data segment.
When the identified bitmap structure is a three-layer bitmap structure, analyzing first-layer data of the bitmap label to determine a data segment containing conflict data, analyzing second-layer data of the bitmap label to determine a data segment where the conflict data in the data segment are located, and finally analyzing third-layer data of the bitmap label to determine the position of the conflict data in the corresponding data segment.
And then, restoring the replacement byte into a frame header byte according to the determined position of the conflict data, namely the position marked as 1 in the bit icon, and obtaining a restored original data frame.
And finally, carrying out data verification on the restored original data frame by combining with the check bit of the complete bitmap, and when the check bit accords with preset check data, considering that the restored original data frame is identical to the original data frame sent by the sending end, and outputting the restored original data frame, otherwise, considering that the restored original data frame is not identical to the original data frame sent by the sending end, and requesting the sending end to carry out data retransmission.
The invention provides a method for avoiding the collision of the frame heads of the communication protocol, which is efficient, simple, convenient and reliable, and has the advantages of high transmission efficiency, low delay, high reliability and flexible bitmap design.
The transmission efficiency is high, and the bitmap occupies fewer bytes, so that the data transmission overhead is obviously reduced.
The low delay is particularly characterized by simple replacement and restoration operation and short processing time, and is suitable for high-speed communication scenes.
The high reliability is embodied in that the bitmap is prevented from being identical with the frame header by constraining the bitmap value, so that the risk of misjudgment is further reduced.
The bitmap design is flexible and specific in that each bit of the bitmap can correspond to data blocks (such as 2 bytes or 4 bytes) with different lengths, and the size of the compressed bitmap is flexibly adjusted according to the length of the frame header.
In still another embodiment of the present invention, as shown in fig. 3, there is provided an apparatus for avoiding collision of protocol frame headers, applied to a transmitting end of data communication, the apparatus comprising:
The detection processing module 301 is configured to detect collision data in an original data frame, and replace the collision data with replacement data to obtain a first data frame, where the collision data is a data block in the original data frame that is the same as a frame header byte except a data block corresponding to the frame header;
a collision frequency calculation module 302, configured to determine a collision rate of the original data frame according to the number of the collision data and the total data block of the original data frame;
A first bitmap generation module 303, configured to dynamically select a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the collision rate, and generate bitmap labels for representing positions of all the collision data;
The second bitmap generation module 304 adds a corresponding level identifier to the head of the bitmap label, and adds a check bit to the tail of the bitmap label to obtain a complete bitmap;
A data bitmap synthesis module 305, configured to add the complete bitmap at the end of the first data frame, to obtain a second data frame.
Further, in the case that the bitmap annotation includes a single-layer bitmap annotation and a multi-layer bitmap annotation, the first bitmap generation module 303 is specifically configured to execute:
When the conflict rate is smaller than a first threshold value, selecting a single-layer bitmap structure, and marking whether each data block corresponding to the original data frame is conflict data or not by each bit of marking data of the single-layer bitmap structure to obtain a single-layer mark;
and selecting a multi-layer bitmap structure when the conflict rate is greater than or equal to the first threshold value, marking the position of conflict data in the layer by utilizing each bit of each layer of marking data by using the hierarchical structure, and generating a multi-layer mark.
Further, the multi-layer bitmap structure includes a two-layer bitmap structure and a three-layer bitmap structure, and when the multi-layer bitmap structure is selected when the conflict rate is greater than or equal to the first threshold, the first bitmap generation module 303 is specifically configured to perform:
When the conflict rate is greater than or equal to the first threshold value and is smaller than a second threshold value, selecting the two-level graph structure;
and selecting the three-layer bitmap structure when the conflict rate is greater than or equal to the second threshold.
Further, when the two-layer bitmap structure is selected, the marking data includes a first layer marking data and a second layer marking data, the generated multi-layer marking is a two-layer marking, and when each bit of each layer marking data is used to mark the position of the conflict data in the layer, the first bitmap generating module 303 is specifically configured to execute:
Marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a two-layer graph structure;
And marking whether each data block in the data segment containing the conflict data is the conflict data or not by each bit of second-layer marking data of the two-layer graph structure to obtain the two-layer marking.
Further, when the three-layer bitmap structure is selected, the marking data includes a first layer marking data, a second layer marking data and a third layer marking data, the generated multi-layer marking is a three-layer marking, and when each bit of each layer marking data is used to mark the position of the conflict data in the layer, the first bitmap generating module 303 is specifically configured to execute:
marking whether each data segment in the original data frame contains conflict data or not by each bit of first-layer marking data of a three-layer bitmap structure, wherein each original data frame comprises a plurality of data segments, each data segment comprises a plurality of data small segments, and each data small segment comprises a plurality of data blocks;
marking whether each data segment in the data segments containing the conflict data contains the conflict data or not by each bit of the second layer marking data of the three-layer bitmap structure;
And marking whether each data block in the data small section containing the conflict data is the conflict data or not by each bit of third layer marking data of the three-layer bitmap structure to obtain three-layer marking.
Further, the collision frequency calculation module 302 is specifically configured to perform:
and calculating the ratio of the number of the conflict data to the total data block quantity of the original data frame to obtain the conflict rate of the original data frame.
The device for avoiding the protocol frame header conflict provided by the embodiment of the invention is used for executing the method for avoiding the protocol frame header conflict, so that the same effect as the method for avoiding the protocol frame header conflict can be achieved.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The embodiment of the invention also provides electronic equipment, which comprises a processor and a memory, wherein at least one instruction, at least one section of program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by the processor to realize the method for avoiding the protocol frame header collision in the embodiment of the invention.
The embodiment of the invention also provides a computer readable storage medium, wherein at least one instruction, at least one section of program, code set or instruction set is stored in the storage medium, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by a processor to realize the method for avoiding the protocol frame header collision in the embodiment of the invention.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.) means from one website, computer, server, or data center. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state disk Solid STATE DISK (SSD)), among others.
The foregoing is merely illustrative of specific embodiments of the present invention, and the scope of the present invention is not limited thereto, but any changes or substitutions within the technical scope of the present invention should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

Translated fromChinese
1.一种协议帧头冲突规避的方法,其特征在于,应用于数据通信的发送端,所述方法包括:1. A method for avoiding a protocol frame header conflict, characterized in that it is applied to a transmitting end of data communication, and the method comprises:检测原始数据帧中的冲突数据,并使用替换数据替换所述冲突数据,得到第一数据帧;所述冲突数据为所述原始数据帧中除帧头对应的数据块外,其余与帧头字节相同的数据块;Detect conflicting data in the original data frame, and replace the conflicting data with replacement data to obtain a first data frame; the conflicting data is the data blocks in the original data frame that have the same bytes as the frame header except for the data block corresponding to the frame header;根据所述冲突数据的数量与所述原始数据帧的数据块总量,确定所述原始数据帧的冲突率;Determining a conflict rate of the original data frame according to the amount of the conflicting data and the total amount of data blocks of the original data frame;根据所述冲突率的大小动态选择单层位图结构或多层位图结构,生成用于表示所有冲突数据所在位置的位图标注;所述单层位图结构直接标记冲突数据在所述原始数据帧中的位置;所述多层位图结构中原始数据帧逐层划分,使用分层结构依次标记冲突数据在每层内的位置;A single-layer bitmap structure or a multi-layer bitmap structure is dynamically selected according to the size of the conflict rate to generate a bitmap annotation for indicating the location of all conflicting data; the single-layer bitmap structure directly marks the location of the conflicting data in the original data frame; in the multi-layer bitmap structure, the original data frame is divided layer by layer, and the location of the conflicting data in each layer is marked in turn using a hierarchical structure;在得到的所述位图标注的头部添加对应的层级标识,末尾添加校验位,得到完整位图;Add the corresponding level identifier to the head of the obtained bitmap annotation, and add a check digit to the end to obtain a complete bitmap;将所述完整位图添加在所述第一数据帧的末尾,得到第二数据帧。The complete bitmap is added to the end of the first data frame to obtain a second data frame.2.根据权利要求1所述的协议帧头冲突规避的方法,其特征在于,所述位图标注包括单层位图标注和多层位图标注;根据所述冲突率的大小动态选择单层位图结构或多层位图结构,生成用于表示所有冲突数据所在位置的位图标注,具体包括:2. The method for avoiding protocol frame header conflicts according to claim 1 is characterized in that the bitmap annotation includes a single-layer bitmap annotation and a multi-layer bitmap annotation; a single-layer bitmap structure or a multi-layer bitmap structure is dynamically selected according to the size of the conflict rate to generate a bitmap annotation for indicating the location of all conflicting data, specifically comprising:在所述冲突率小于第一阈值时选择单层位图结构,以单层位图结构的标记数据的每一位来标记所述原始数据帧对应的每一个数据块是否为冲突数据,得到单层标注;When the conflict rate is less than a first threshold, a single-layer bitmap structure is selected, and each bit of the marking data of the single-layer bitmap structure is used to mark whether each data block corresponding to the original data frame is conflict data, so as to obtain a single-layer marking;在所述冲突率大于或等于所述第一阈值时选择多层位图结构,使用分层结构,利用每层标记数据的每一位来标记冲突数据在本层内的位置,生成多层标注。When the conflict rate is greater than or equal to the first threshold, a multi-layer bitmap structure is selected, and a hierarchical structure is used to mark the position of conflicting data in the layer using each bit of the marking data of each layer to generate a multi-layer label.3.根据权利要求2所述的协议帧头冲突规避的方法,其特征在于,所述多层位图结构包括二层位图结构和三层位图结构;在所述冲突率大于或等于所述第一阈值时选择多层位图结构,具体包括:3. The method for avoiding a protocol frame header conflict according to claim 2, wherein the multi-layer bitmap structure comprises a two-layer bitmap structure and a three-layer bitmap structure; and selecting the multi-layer bitmap structure when the conflict rate is greater than or equal to the first threshold value specifically comprises:在所述冲突率大于或等于所述第一阈值,同时小于第二阈值时,选择所述二层位图结构;When the conflict rate is greater than or equal to the first threshold and less than the second threshold, selecting the two-layer bitmap structure;在所述冲突率大于或等于所述第二阈值时,选择所述三层位图结构。When the conflict rate is greater than or equal to the second threshold, the three-layer bitmap structure is selected.4.根据权利要求3所述的协议帧头冲突规避的方法,其特征在于,在选用所述二层位图结构时,标记数据包括第一层标记数据和第二层标记数据,生成的多层标注为二层标注;利用每层标记数据的每一位来标记冲突数据在本层内的位置,生成多层标注,具体包括:4. The method for avoiding protocol frame header conflicts according to claim 3 is characterized in that when the two-layer bitmap structure is selected, the marking data includes first-layer marking data and second-layer marking data, and the generated multi-layer marking is a two-layer marking; using each bit of each layer of marking data to mark the position of the conflicting data in the current layer, generating a multi-layer marking, specifically including:以二层位图结构的第一层标记数据的每一位来标记所述原始数据帧中每一个数据段是否包含冲突数据;每个原始数据帧包括多个数据段,每个数据段包括多个数据块;Using each bit of the first layer marking data of the two-layer bitmap structure to mark whether each data segment in the original data frame contains conflicting data; each original data frame includes multiple data segments, and each data segment includes multiple data blocks;以二层位图结构的第二层标记数据的每一位来标记包含冲突数据的数据段中的每一个数据块是否为冲突数据,得到二层标注。Each bit of the second-layer marking data of the two-layer bitmap structure is used to mark whether each data block in the data segment containing conflicting data is conflicting data, thereby obtaining a two-layer marking.5.根据权利要求3所述的协议帧头冲突规避的方法,其特征在于,在选用所述三层位图结构时,标记数据包括第一层标记数据、第二层标记数据和第三层标记数据,生成的多层标注为三层标注;利用每层标记数据的每一位来标记冲突数据在本层内的位置,生成多层标注,具体包括:5. The method for avoiding protocol frame header conflicts according to claim 3 is characterized in that, when the three-layer bitmap structure is selected, the marking data includes first-layer marking data, second-layer marking data and third-layer marking data, and the generated multi-layer marking is a three-layer marking; each bit of each layer of marking data is used to mark the position of the conflicting data in the current layer, and the multi-layer marking is generated, which specifically includes:以三层位图结构的第一层标记数据的每一位来标记所述原始数据帧中每一个数据段是否包含冲突数据;每个原始数据帧包括多个数据段,每个所述数据段包括多个数据小段,每个数据小段包括多个数据块;Using each bit of the first-layer marking data of the three-layer bitmap structure to mark whether each data segment in the original data frame contains conflicting data; each original data frame includes multiple data segments, each of the data segments includes multiple data segments, and each data segment includes multiple data blocks;以三层位图结构的第二层标记数据的每一位来标记包含冲突数据的数据段中的每一个数据小段中是否包含冲突数据;Using each bit of the second-layer marking data of the three-layer bitmap structure to mark whether each data segment in the data segment containing conflicting data contains conflicting data;以三层位图结构的第三层标记数据的每一位来标记包含冲突数据的数据小段中的每一个数据块是否为冲突数据,得到三层标注。Each bit of the third-layer marking data of the three-layer bitmap structure is used to mark whether each data block in the data segment containing conflicting data is conflicting data, thereby obtaining a three-layer marking.6.根据权利要求1所述的协议帧头冲突规避的方法,其特征在于,根据所述冲突数据的数量与所述原始数据帧的数据块总量,确定所述原始数据帧的冲突率,具体为:6. The method for avoiding protocol frame header conflicts according to claim 1, characterized in that the conflict rate of the original data frame is determined according to the amount of the conflicting data and the total amount of data blocks of the original data frame, specifically:计算所述冲突数据的数量与所述原始数据帧的数据块总量的比值,得到所述原始数据帧的冲突率。The ratio of the amount of the conflicting data to the total amount of data blocks of the original data frame is calculated to obtain the conflict rate of the original data frame.7.一种协议帧头冲突规避的方法,其特征在于,应用于数据通信的接收端,所述方法包括:7. A method for avoiding a protocol frame header conflict, characterized in that it is applied to a receiving end of data communication, and the method comprises:接收包含第一数据帧和完整位图的第二数据帧;所述第一数据帧为使用替换数据替换原始数据帧中冲突数据后的数据帧;所述冲突数据为所述原始数据帧中除帧头对应的数据块外,其余与帧头字节相同的数据块;所述完整位图包括依次设置的层级标识、位图标注以及校验位;Receive a second data frame including a first data frame and a complete bitmap; the first data frame is a data frame obtained by replacing conflicting data in an original data frame with replacement data; the conflicting data is a data block in the original data frame that has the same bytes as the frame header except for the data block corresponding to the frame header; the complete bitmap includes a hierarchical identifier, a bitmap annotation, and a check bit that are sequentially set;根据所述层级标识确定数据解析方式为与单层位图结构对应的单层解析方式或与多层位图结构对应的多层解析方式;所述单层位图结构直接标记冲突数据在所述原始数据帧中的位置;所述多层位图结构中原始数据帧逐层划分,使用分层结构依次标记冲突数据在每层内的位置;Determine, according to the hierarchical identifier, whether the data parsing mode is a single-layer parsing mode corresponding to a single-layer bitmap structure or a multi-layer parsing mode corresponding to a multi-layer bitmap structure; the single-layer bitmap structure directly marks the position of the conflicting data in the original data frame; in the multi-layer bitmap structure, the original data frame is divided layer by layer, and the hierarchical structure is used to mark the position of the conflicting data in each layer in turn;根据确定的数据解析方式,结合所述位图标注解析得到冲突数据在原始数据帧的冲突位置;所述位图标注基于所述单层位图结构或所述多层位图结构生成;According to the determined data parsing method, the conflicting position of the conflicting data in the original data frame is obtained by combining the bitmap annotation analysis; the bitmap annotation is generated based on the single-layer bitmap structure or the multi-layer bitmap structure;将所述第一数据帧中所述冲突位置对应的数据块替换回所述帧头字节,得到还原后的原始数据帧;Replacing the data block corresponding to the conflict position in the first data frame with the frame header byte to obtain a restored original data frame;在确定所述校验位符合预设校验数据后,输出还原后的所述原始数据帧。After determining that the check bit meets the preset check data, the restored original data frame is output.8.一种协议帧头冲突规避的装置,其特征在于,应用于数据通信的发送端,所述装置包括:8. A device for avoiding a protocol frame header conflict, characterized in that it is applied to a transmitting end of data communication, and the device comprises:检测处理模块,用于检测原始数据帧中的冲突数据,并使用替换数据替换所述冲突数据,得到第一数据帧;所述冲突数据为所述原始数据帧中除帧头对应的数据块外,其余与帧头字节相同的数据块;A detection and processing module, used for detecting conflicting data in an original data frame, and replacing the conflicting data with replacement data to obtain a first data frame; the conflicting data is a data block in the original data frame that has the same bytes as the frame header except for the data block corresponding to the frame header;冲突频率计算模块,用于根据所述冲突数据的数量与所述原始数据帧的数据块总量,确定所述原始数据帧的冲突率;A conflict frequency calculation module, used for determining the conflict rate of the original data frame according to the amount of the conflicting data and the total amount of data blocks of the original data frame;第一位图生成模块,用于根据所述冲突率的大小动态选择单层位图结构或多层位图结构,生成用于表示所有冲突数据所在位置的位图标注;所述单层位图结构直接标记冲突数据在所述原始数据帧中的位置;所述多层位图结构中原始数据帧逐层划分,使用分层结构依次标记冲突数据在每层内的位置;A first bitmap generation module is used to dynamically select a single-layer bitmap structure or a multi-layer bitmap structure according to the size of the conflict rate, and generate a bitmap mark for indicating the location of all conflicting data; the single-layer bitmap structure directly marks the location of the conflicting data in the original data frame; in the multi-layer bitmap structure, the original data frame is divided layer by layer, and the hierarchical structure is used to mark the location of the conflicting data in each layer in turn;第二位图生成模块,在得到的所述位图标注的头部添加对应的层级标识,末尾添加校验位,得到完整位图;The second bitmap generation module adds a corresponding level identifier to the header of the obtained bitmap annotation and adds a check digit to the end to obtain a complete bitmap;数据位图合成模块,用于将所述完整位图添加在所述第一数据帧的末尾,得到第二数据帧。The data bitmap synthesis module is used to add the complete bitmap to the end of the first data frame to obtain a second data frame.9.一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如权利要求1-6中任一项所述的协议帧头冲突规避的方法。9. An electronic device, characterized in that the electronic device includes a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method for avoiding protocol frame header conflicts as described in any one of claims 1 to 6.10.一种计算机可读存储介质,其特征在于,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如权利要求1-6中任一项所述的协议帧头冲突规避的方法。10. A computer-readable storage medium, characterized in that the storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the method for avoiding protocol frame header conflicts as described in any one of claims 1 to 6.
CN202510615726.4A2025-05-142025-05-14 A method, device, equipment and storage medium for avoiding protocol frame header conflictPendingCN120263352A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202510615726.4ACN120263352A (en)2025-05-142025-05-14 A method, device, equipment and storage medium for avoiding protocol frame header conflict

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202510615726.4ACN120263352A (en)2025-05-142025-05-14 A method, device, equipment and storage medium for avoiding protocol frame header conflict

Publications (1)

Publication NumberPublication Date
CN120263352Atrue CN120263352A (en)2025-07-04

Family

ID=96191568

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202510615726.4APendingCN120263352A (en)2025-05-142025-05-14 A method, device, equipment and storage medium for avoiding protocol frame header conflict

Country Status (1)

CountryLink
CN (1)CN120263352A (en)

Similar Documents

PublicationPublication DateTitle
US6895544B1 (en)Encoding method of multimedia data and encoding device therefor
CN1154285C (en)Flexible method of error protection in communications systems
CN1163047C (en) Device and method for transmitting/receiving wireless data
KR100508613B1 (en)Encoding/decoding device and encoding/decoding method
RU2216861C2 (en)Method and device for data burst transmission and reception
CN101478684B (en)Method and system for detecting integrity of stored video data
US20070165673A1 (en)Method for reconstructing lost packets using a binary parity check
WO2007041110A1 (en)Error correction in packet-based communication networks using data consistency checks
CN114710224B (en)Frame synchronization method and device, computer readable medium and electronic equipment
US20230396360A1 (en)Line Coding Method and Apparatus
CN101882096A (en)Method for detecting and correcting damaged control character transmitted between SATA main control device and SATA peripheral device
CN106528437A (en)Data storage system and related method thereof
CN104471888B (en)Processing method, equipment and the system of free block IDLE in block of burst data
US7032032B2 (en)Method and apparatus for providing tandem connection, performance monitoring, and protection architectures over ethernet protocols
JP2002353936A (en)Method for transmitting signaling information via control channel of communication system
CN120263352A (en) A method, device, equipment and storage medium for avoiding protocol frame header conflict
CN111464267B (en)Communication data checking method and device, computer equipment and storage medium
WO2021196774A1 (en)Information transmitting and processing methods, ethernet device, and computer readable medium
CN100385887C (en)Method and apparatus for encoding, transmitting and decoding digital data
US20050257117A1 (en)Method and circuit for determining an ending of an ethernet frame
EP1596518A1 (en)Media encoded data transmission method, apparatus and program
CN112995330B (en)Transparent information extraction method and device for data
CN115987304A (en)Error correction method, device and storage medium for data shielding
CN116893987B (en)Hardware acceleration method, hardware accelerator and hardware acceleration system
CN114208073B (en) Masked Packet Checksum for More Efficient Digital Communications

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp