The content of the invention
To solve the above problems, the invention provides a kind of automation building method of packet load, including following step
Suddenly:
Step 1:Predefine feature, the skew for each feature configuration that will be incorporated into same packet load
Value and depth, initial coverage of each feature configuration in packet load is determined according to deviant and depth.
Step 2:Detect the initial coverage of each feature configuration whether have it is overlapping, in the event of overlapping, then basis
Respective feature length changes respective coverage, makes it not overlapping.If modification failure, then it represents that feature configuration it
Between it is incompatible, jump out this flow.After having monitored, step 3 is performed.
Step 3:Each feature configuration is subjected to ascending order row according to the deviant of the coverage after step 2 adjusts
Row.
Step 4:Since the first place of data pack load, in the range of a last feature configuration initial coverage area,
The feature of each feature configuration and deviant are sequentially covered in sequence, and to before last feature configuration not
The position covered is filled.
Further, the amended coverage of feature configuration of two initial overlapped coverages should not weigh just
It is folded.
Further, in step 2, each amended coverage length of feature configuration should just be characterized content
Length.
Further, the mode of filling is artificial filling or filled by machine.
Beneficial effects of the present invention are:
1. flexibility is high, the generation of multiple types of data bag can be supported, specific protocol, such as HTTP can also be facilitated after extension
Support on ground.
2. relative to packet is manually constructed one by one, there is higher efficiency, and it is not error-prone.
Embodiment
As shown in figure 1, the present invention comprises the following steps:
Step 1:Predefine feature, the skew for each feature configuration that will be incorporated into same packet load
Amount and depth, determine the feature configuration of each packet load to be incorporated into packet load according to offset and depth
Initial coverage.
The feature configuration of packet load includes the content of 3 aspects, respectively feature, deviant, depth.
Feature is usually character string or binary system, and it occupies one section of fixed length in packet.
Deviant refers to the original position range data bag load starting of the feature covering of feature configuration(0th byte)'s
Offset.Deviant minimum 0, default value 0.Represent that the feature of feature configuration covers start bit if deviant is 1
Put be data pack load the 1st byte.
Depth refers to the byte length that feature configuration occupies in data pack load, and the length calculates since deviant.Such as
Depth is 5, then it represents that feature configuration occupies 5 bytes.Depth value is up to 65535, default value 65535.
The initial coverage can be expressed as with section(Deviant, deviant+depth value), i.e., since deviant
(Comprising), terminate to deviant+depth value(Do not include).The deviant of the byte of packet the 0th is that the deviant of the 0, the 1st byte is
The deviant of 1, the 2nd byte is 2.......Such as, the initial coverage of feature configuration is (1,5), feature length
Spend for 3, its initial coverage is the 1st byte to the 4th byte of packet, and feature can be two kinds in packet load
Mode is configured, be respectively configured from the 1st byte of packet load to the 3rd byte, the 2nd word from packet load
Save to the 4th byte and configured.
Step 2:Detect the initial coverage of each feature configuration whether have it is overlapping, in the event of overlapping, then basis
Respective feature length changes respective coverage, makes it not overlapping;If modification failure, then it represents that feature configuration it
Between it is incompatible, jump out this flow;After having monitored, step 3 is performed;
Preferably, the amended coverage of feature configuration of two initial overlapped coverages should be just not overlapping.It is each
The amended coverage length of feature configuration should just be characterized the length of content, and ensure what feature can identify
Meanwhile data package size is reduced as far as possible, it is more convenient to be subsequently extended.
Step 3:Each feature configuration is subjected to ascending order row according to the deviant of the coverage after step 2 adjusts
Row;
Step 4:Since the first place of data pack load, in the range of a last feature configuration initial coverage area, according to
Order is sequentially covered the feature of each feature configuration and deviant, and to not covered before last feature configuration
To position be filled.
The mode of filling is artificial or by configuring the Filling power for allowing machine to fill needs.For example directly filled out used
Fill, data are directly set to 0.
The above method is described in detail with specific example below.
It is assumed that be loaded packet everybody sequentially for the 0th byte, the 1st byte, the 2nd byte, the 3rd byte, the 4th byte,
5th byte, the 6th byte, the 7th byte, the 8th byte, the 9th byte, the 10th byte, the 11st byte.
Such as there are so tri- characteristic values of A, B, C:
It is assumed that A, initial coverage are(0,2), i.e., initial coverage is the 0th byte to the 1st byte, and feature length is
2。
It is assumed that the initial coverages of B are (4,10), i.e., initial coverage is the 4th byte to the 9th byte, and feature is grown
Spend for 3.
It is assumed that the initial coverages of C are(5,11), i.e., initial coverage is the 5th byte to the 10th byte, feature
Length is 3.
Then A, B, C total initial coverage is since the 0th byte of packet load, is terminated to the 11st byte, is needed
A, B, C are reasonably configured in the range of this.A, B initial coverage is non-overlapping, without being adjusted to A,
And between A, B have can fill area.B, C initial coverage is overlapping, it is necessary to according to feature to the 9th byte in the 5th byte
The respective initial coverage of length adjustment, make both just non-overlapping.
A is adjusted(0,2), the filling block between A, B is the 2nd byte to the 3rd byte;
It is after B adjustment(4,7), i.e. coverage is the 4th byte to the 6th byte.It is after C adjustment(7,10), without filling between B, C
For block to be empty, the filling block after C is the 10th byte to the 11st byte.
Certainly, if first feature configuration A has the offset more than 0, also need to since the 0th byte to A
Byte before is filled.As A is(1,3), length 2, initial coverage is the 1st byte to the 2nd byte;This explanation needs
To be filled to the 0th byte.