Summary of the invention
In view of this, the object of the embodiment of the present invention is to provide communication protocol deciphering method and device, realizes the decoding of communication protocol in link, for the data in test communications link provide foundation.
For achieving the above object, following technical scheme is embodiments provided:
A kind of communication protocol deciphering method, comprising:
Frame is obtained from the data collected;
Detect the protocol characteristic information whether comprising default communication protocol in described Frame;
The sum of Frame according to the sum of detected Frame and the protocol characteristic information that wherein comprises described default communication protocol determines the protocol type that collected data use.
The sum of Frame according to the sum of detected Frame and the protocol characteristic information that wherein comprises described default communication protocol determines that the protocol type that collected data use is specially:
The matching rate of data and the described default communication protocol collected is calculated according to the sum of detected Frame and the sum of Frame of protocol characteristic information that wherein comprises described default communication protocol;
The protocol type that collected data use is determined according to described matching rate.
Described default communication protocol is one, determines that the protocol type that collected data use is specially according to described matching rate:
If described matching rate reaches the matching threshold of described default communication protocol, then determine that gathered data employ the communication protocol of current preset.
Described default communication protocol is multiple, and the matching rate that the sum of the Frame that described basis is detected and the sum of Frame of protocol characteristic information wherein comprising described default communication protocol calculate data and the described default communication protocol collected is specially:
The matching rate of data and each the default communication protocol described collected is calculated according to the sum of detected Frame and the sum of Frame of protocol characteristic information that wherein comprises each default communication protocol described;
Describedly determine that the protocol type that collected data use is specially according to described matching rate:
Judge whether the matching rate of each communication protocol reaches the default matching threshold of each communication protocol;
From the communication protocol matching rate reaching matching threshold, choose the communication protocol that communication protocol corresponding to maximum matching rate uses as the described data collected.
Obtain Frame the described data from collecting to comprise:
Detect the speed of the data collected, judge whether this speed exceedes scheduled rate threshold value;
Data speed not being exceeded to described rate-valve value carry out sub-frame processing, obtain Frame;
Data speed being exceeded to described rate-valve value first carry out shunting process, carry out sub-frame processing again, obtain Frame after shunting process.
Described protocol characteristic information comprises:
At least one particular value in Frame;
Or, the particular value of at least one ad-hoc location in Frame.
A kind of communication protocol deciphering device, comprising:
Memory cell, for storing the protocol characteristic information of default communication protocol;
Framing device, for obtaining Frame from the data collected;
Characteristic detection unit, for detect described framing device obtain Frame in whether comprise the protocol characteristic information stored in described memory cell;
Determining unit, the sum for the Frame of the sum of Frame that detects according to described characteristic detection unit and the protocol characteristic information that wherein comprises described default communication protocol determines the protocol type that collected data use.
Described determining unit specifically comprises:
Matching rate computation subunit, for calculating the matching rate of current detected data and described default communication protocol according to the sum of detected Frame and the sum of Frame of protocol characteristic information that wherein comprises described default communication protocol;
Determine subelement, determine for the matching rate calculated according to described matching rate computation subunit the protocol type that collected data use.
The communication protocol of described cell stores is one, describedly determines that subelement is when the described matching rate that described matching rate computation subunit calculates reaches described matching threshold, determines that the data collected employ the agreement of current matching.
The communication protocol stored in described memory cell is multiple, then:
Described matching rate computation subunit, for calculating the matching rate of each communication protocol;
Describedly determine subelement, for judging the matching threshold whether matching rate of each communication protocol reaches each communication protocol and preset respectively; From the communication protocol comparative result reaching matching threshold, choose the communication protocol that communication protocols corresponding to maximum matching rate uses as the described data collected.
Described device also comprises:
Rate detecting unit, for detecting the speed of collected data;
Shunt, the data for exceeding scheduled rate threshold value to speed first carry out shunting process;
Described framing device, also for carrying out sub-frame processing to the data after shunting process.
Described device also comprises:
Subscriber interface module, for receiving the decoding configuration information that user selects.
The decoding configuration information that described user selects comprises:
Inlet flow type, shunt type, framing device type and protocol characteristic information type.
Described protocol characteristic information comprises:
At least one particular value in Frame;
Or, the particular value of at least one ad-hoc location in Frame.
Visible, in embodiments of the present invention, from the data collected, obtain Frame; Detect the protocol characteristic information whether comprising default communication protocol in described Frame; The sum of Frame according to the sum of detected Frame and the protocol characteristic information that wherein comprises described default communication protocol determines the protocol type that collected data use, by the method that the embodiment of the present invention provides, when there is no data details, decode the communication protocol used in communication data, thus guidance can be provided for the setting of follow-up test parameter, and then find the information required for us from the data of transmission.
Embodiment
Embodiments provide communication protocol deciphering method and device, for making object of the present invention, technical scheme and advantage clearly understand, to develop simultaneously embodiment referring to accompanying drawing, the present invention is described in further detail.
See Fig. 1, in an embodiment of the present invention, the method that realizing the embodiment of the present invention provides comprises the following steps:
Step 101: obtain Frame from the data collected.
T1 and E1 is the standard with high-quality call and transfer of data, and wherein, North America adopts T1 standard, can support the transfer of data of 24 64Kbps, and Europe and China adopt E1 standard, can support the transfer of data of 32 64Kbps.For the transfer of data of E1 standard, the method that the embodiment of the present invention provides is described in the embodiment of the present invention.
When link adopts the data of E1 standard transmission, according to speed needs, following several transmission means can be divided into:
Unframe, without the form of E1 standard frame, this form directly provides physical layer services, carrying data content.
PCM 30, uses 1-30 time slot, the data content of carrying 64Kbps*30=1920Kbps speed.
PCM 31, uses 1-31 time slot, the data content of carrying 64Kbps*31=1984Kbps speed.
N*64Kbps, uses 1 or N number of time slot in 1-31 time slot, the data content of carrying 64Kbps*N speed.
Sub-slots mode, 1 64Kbps time slot can be divided into 8 sub-slots, can use 1 in 8 sub-slots or n sub-slots, the data content of carrying n*8Kbps speed.Such as, need 16Kbps speed, then take 2 sub-slots; Need 32Kbps speed, then take 4 sub-slots.
No matter adopt which kind of mode to transmit data, the data flow in each transmission channel is the binary data of continuous print 0 and 1, and the content of practical communication is encapsulated in the Frame of link layer.Generally, in link, transmit the filler be made up of 0 and 1 that some are pre-specified, such as, filler in ABIS signaling HDLC agreement be 01111110 and continuous 51 after one 0.Only when needs, just have Frame and occur, the Frame that is by the data in the data flow of each transmission channel being forms with filler.
Because the content of practical communication is encapsulated in the Frame of link layer, so need Frame to extract from data flow just can recognize Content of Communication, sub-frame processing extracts Frame exactly from data flow.
When carrying out sub-frame processing, by detecting the content of transmission channel data flow, rejecting filler wherein, such as, to ABIS signaling HDLC agreement, rejecting the framing symbol 01111110 of wherein filling, and removing the bit 0 after continuous 51.Extract Frame, thus form data frame stream.Because now and do not know that whether the data that are detected are exactly really that what adopt is ABIS signaling HDLC agreement, so current way is just decoded the agreement that current data adopt according to known agreement.
In other embodiments, be specially obtaining Frame from the data collected:
Detect the speed of the data collected, judge whether this speed exceedes scheduled rate threshold value;
Data speed not being exceeded to described rate-valve value carry out sub-frame processing, obtain Frame;
Data speed being exceeded to described rate-valve value first carry out shunting process, carry out sub-frame processing again, obtain Frame after shunting process.
Some communication protocol transmits data with special speed, in order to make detection more effective accurately, can carry out shunting process in certain embodiments according to the agreement feature of prediction to the data gathered.
The data flow of 1 64Kbps can be divided into n channel data stream of sub-slots mode by shunting processing procedure.
Such as, in the data flow of 1 64Kbps, the dividing mode of sub-slots is: each byte is totally 8 bits, is numbered as 0-7,8 sub-slots of reference numeral to be the speed of 0-7 be 8K.
1 6Kbps speed needs to take two sub-slots, and such as 0,1 or 2,3 or 4,5 or 6,7.
32Kbps speed needs to take 4 sub-slots, and such as 0,1,2,3 or 4,5,6,7.
Example is treated to 16Kbps shunting, its course of work first the bit of 2 corresponding for byte each in 64Kbps data flow sub-slots is taken out, then assembled by arrival sequencing, namely the byte of 4 64Kbps data flow can extract the 16K data flow of 1 byte.Data are the channel data stream of 16Kbps by assembled rear synthesis speed.
Aforesaid sub-frame processing is carried out to the data after shunting again and just can obtain Frame, thus form data frame stream.
Step 102: detect the protocol characteristic information whether comprising default communication protocol in described Frame.
The effect of described protocol characteristic information comforms in multi-communication protocol to distinguish a certain agreement, and described protocol characteristic information can be at least one particular value in described Frame, or the particular value of at least one ad-hoc location in described Frame.
The such as feature of IP agreement there is the byte that value is 16 system 0x45 in a data frame, if so when decoding IP agreement, particular value in Frame can be adopted as protocol characteristic information, and the byte of this particular value to be value be 16 system 0x45.Accordingly, described in be detected as from Frame frame head, search value is the IP packet header flag byte of the byte of 16 system 0x45.
The feature of ABIS signaling is first 6 of Frame first byte is specific bit value (scope 0-63), comprising feature 0 (ordinary signaling) and 63 (managing signalings).The particular value of ad-hoc location can be adopted as protocol characteristic information when decoding ABIS signaling, accordingly, described in be detected as first 6 of detecting Frame first byte and whether have particular value.
Step 103: the sum of Frame according to the sum of detected Frame and the protocol characteristic information that wherein comprises described default communication protocol determines the protocol type that collected data use.
In one embodiment, the sum of the Frame of the sum first adding up detected Frame and the protocol characteristic information wherein comprising described default communication protocol, then determines the data of current collection and the matching rate of described default communication protocol.
Such as, corresponding to the protocol characteristic information of certain communication protocol, suppose that the total Frame gathered is 1000 frames, and the Frame wherein comprising described protocol characteristic information is 945 frames, so, matching rate between the data of current collection and described communication protocol is 945/1000=0.945, and namely matching rate is 94.5%.
After obtaining matching rate, the matching threshold that matching rate and this communication protocol are preset is compared, if exceeded matching threshold, thinks that the data of current collection have employed communication protocol corresponding to this protocol characteristic information.
Still continue to use example above, when the acquisition data of current collection and the matching rate of present communication protocols are after 94.5%, the matching threshold of this matching rate and present communication protocols is compared.Suppose that the matching threshold of present communication protocols is 90%, so obviously, can determine that the current data collected employ described communication protocol.
By the method that the embodiment of the present invention provides, agreement decoding is carried out to the transmission data originally known nothing, thus achieve detailed understanding is carried out to data link configuration situation, from transmission data, extract required information exactly further provide condition for follow-up.
In actual applications; the protocol characteristic information of multiple communication protocol often can be adopted to detect the data collected; see Fig. 2; with the protocol characteristic information corresponding to three communication protocols, example is detected as to the data collected in the embodiment of the present invention, the situation that multi-communication protocol detects is described.For convenience, described three features protocol are the first agreement, second protocol and the 3rd agreement respectively, and the protocol characteristic information corresponding to each communication protocol is the first protocol characteristic information, second protocol characteristic information respectively, and the method specifically comprises:
Step 201: the transmission rate detecting the data flow gathered, judges whether it exceedes rate-valve value, if do not exceed, then enter step 203; If exceed, then enter step 202.
Step 202: to the data collected carry out shunting process, shunting process complete laggard enter step 203.
Step 203: carry out sub-frame processing to the data collected, obtains Frame.
Step 204: according to the protocol characteristic information of the first agreement, second protocol and the 3rd agreement, described Frame is detected respectively.
For convenience of description, by detected Frame, the frame number comprising the first protocol characteristic information of the first agreement is designated as the first agreement frame number, accordingly, the frame number comprising the second protocol characteristic information of second protocol is designated as second protocol frame number, corresponding to the 3rd agreement, has the 3rd agreement frame number.
Step 205: the totalframes of statistic mixed-state, and add up the first agreement frame number, second protocol frame number and the 3rd agreement frame number respectively.
Step 206: calculate the data of current collection and the matching rate of described first agreement, second protocol and the 3rd agreement respectively.
With similar in previous embodiment, the calculating of described matching rate is: be divided by with the described first agreement frame number of statistics, the totalframes of second protocol frame number and the 3rd agreement frame number and statistics respectively, the value obtained is the matching rate of the current data that collect and described first agreement, second protocol and the 3rd agreement, is designated as the first matching rate, the second matching rate and the 3rd matching rate respectively.
Step 207: judge when whether first three matching rate reaches the default threshold value of each communication protocol, chooses the communication protocol that the communication protocol corresponding to maximum matching rate uses as the data of current collection from the matching rate reaching predetermined threshold value.
Such as, suppose that described first matching rate is 85%, second matching rate is the 95%, the 3rd matching rate is 90%, and the matching threshold of three communication protocols is 90%, so that is, the second matching rate and the 3rd matching rate reach matching threshold, and the second matching rate is greater than the 3rd matching rate, so, determine that second communication agreement is the communication protocol of the data use of current collection.
Certainly, if the second matching rate and the 3rd matching rate are closely, such as the second matching rate is the 95%, the 3rd matching rate is 95.5%, so can increase Additional Agreement characteristic information further for the feature of second communication agreement and third communication agreement and second communication agreement and third communication agreement are done further differentiation; Certainly, also can according to getting the communication protocol that maximum principle determination third communication agreement is the data use of current collection.
By the method that the embodiment of the present invention provides, agreement decoding is carried out when not transmitting data configuration situation particulars, thus achieve detailed understanding is carried out to data link configuration situation, from transmission data, extract required information exactly further provide condition for follow-up.
Corresponding with embodiment of the method, the embodiment of the present invention is also provided for the device that agreement is decoded, and see Fig. 3, this device comprises:
Memory cell 301, for storing the protocol characteristic information of default communication protocol.
Described protocol characteristic information comprises: at least one particular value in Frame; Or, the particular value of at least one ad-hoc location in Frame.
Framing device 302, for obtaining Frame from the data collected.
Characteristic detection unit 303, for detect framing device obtain Frame in whether comprise the protocol characteristic information stored in memory cell.
Determining unit 304, the sum for the Frame of the sum of Frame that detects according to characteristic detection unit and the protocol characteristic information that wherein comprises described default communication protocol determines the protocol type that collected data use.
In one embodiment, described determining unit concrete 304 comprises:
Matching rate computation subunit 3041: for calculating the matching rate of current detected data and described default communication protocol according to the sum of detected Frame and the sum of Frame of protocol characteristic information that wherein comprises described default communication protocol:
Determine subelement 3042, determine for the matching rate calculated according to described matching rate computation subunit the protocol type that collected data use.
When only storing the protocol characteristic information of a communication protocol in described memory cell 301, describedly determine that subelement 3042 is specially:
Judge whether the subelement that described matching rate calculates reaches default matching threshold;
When described matching rate reaches described matching threshold, then determine that the data collected employ the agreement of current matching.
When storing the protocol characteristic information of more than one communication protocol in described memory cell 301, described matching rate computation subunit 3041, for calculating the matching rate of each communication protocol;
Describedly determine subelement 3042, for judging the matching threshold whether matching rate of each communication protocol reaches each communication protocol and preset respectively; From the communication protocol comparative result reaching matching threshold, choose the communication protocol that communication protocols corresponding to maximum matching rate uses as the described data collected.
In one embodiment, the device shown in Fig. 3 also comprises:
Rate detecting unit 305, for detecting the speed of collected data.
Shunt 306, the data for exceeding described rate-valve value to speed first carry out shunting process.
Described framing device 302, also for carrying out sub-frame processing to the data after shunting process.
The agreement provided by the embodiment of the present invention decodes device, agreement decoding is carried out to the transmission data originally known nothing, detailed understanding is carried out to data link configuration situation, extracts required information exactly and provide condition from transmission data for follow-up further.
The structural representation of a kind of agreement decoding device that Fig. 4 provides for the embodiment of the present invention, this agreement decodes device based on given frame form, link protocol, upper-layer protocol, carries out many combined tests, with optimum Match rate for criterion carries out agreement decoding.
Wherein, test point 401 can be the test binding post for E1 standard, uses the mode of high-ohmic cross-connection to be connected with coaxial cable connecting line; Also can be the mirror port for SDH (Synchronous Digital Hierarchy) (SDH) transmission equipment, be connected with connection line of optic fibre.Tested physical signalling all can be drawn by these two kinds of modes, is linked in test card.
Test board 402 can by the signal extraction on coaxial line and in optical fiber out, after amplifying, be reduced to digital signal, and according to the corresponding transmission protocol of E1 or SDH, therefrom decode the 2M physical layer frame of E1, and according to the specification of E1, by configuration requirement, get the data flow with stream identification.
Stream identification comprises: board number, No. E1, timeslot number, sub-slots number or use board number+one numbering.
Subscriber interface module 403, for receiving the input item that user selects, shows test results to user.
Wherein, user's input selection item comprises:
1, inlet flow combination, for board configuration module 409 provides may combining of inlet flow, the i.e. mode transmitted on E1 of link, comprise: to be 1 Unframe, E1 be E1 that PCM30 uses entirely, E1 is that PCM31 uses entirely, use 31 64K in E1, if not above-mentioned possibility situation, manual option and installment E1 can be carried out.Can select in addition not use board, just use document data record is analyzed.
2, shunt combination is selected, and comprises and does not use shunt, 8K shunt, 16K shunt, 32K shunt, if E1 configuration is not above-mentioned situation, manual configuration can specify sub-slots shunt.
3, the combination of framing device is selected, and comprises and does not use framing device, HDLC framing device, ABIS 40 framing device, NotelTrunk framing device etc.
4, the combination of agreement assessor is selected, and comprises and does not use agreement assessor, GSM voice assessor, ABIS signaling assessor, GPRS Abis assessor, ppp protocol assessor, FR agreement assessor, CiscoHDLC agreement assessor, IP bag assessor etc.
5, the E1 quantity of every batch processing.If analyzed multiple E1, based on the consideration of performance, limit the E1 quantity of every batch processing.Such as, when SDH 155M analyzes, totally 63 E1, can every batch processing 4 E1, coprocessing 16 batches.
6, every layout detects the time needed, generally in seconds.
Fig. 5 is the input selection surface chart of the decoding device shown in Fig. 4.
Shunt module 404, the shunt combination according to receiving from subscriber interface module carries out shunting process to the data gathered.
Framing device module 405, framing device combination according to receiving from subscriber interface module carries out sub-frame processing to the data after shunting, certainly, if the data collected are without the need to shunting process, so described framing device module directly carries out sub-frame processing to the data collected, and obtains Frame.
Agreement assessor module 406, detects according to the Frame that the protocol characteristic information butt joint self stored receives, and calculates matching rate.Determine whether this data frame stream employs the communication protocol of self detection according to matching rate.
From the function of agreement assessor module, the agreement assessor described in Fig. 4 is corresponding with the detection module in device described in Fig. 3 and determination module.
Detection control module 407, selects according to the user received from subscriber interface module 403, calls board configuration module configuration board; Call shunt, framing device, agreement assessor module, create corresponding objects on data stream and carry out corresponding function process, and generate test result; Produce batch, layout, control automatically carrying out of whole process; According to testing result, automatically generate board test profile.
Data recordin module 408, for recording input, the output content of modules, and can show and show recorded content; Record data content.
Wherein, the input of the modules of record, output content are just showing the content in corresponding record device as inlet flow display, shunt output display, framing device output display, agreement assessor output display function.
And the data content of record comprise frame number, length, 16 systems displays content frame, for convenience of the frame bias internal amount instruction etc. checked of branch.
In order to carry out the integration test of ABIS, actually or needing passage 16K 32K or 64K determining ABIS signaling link on E1, this passage is positioned at which time slot, which sub-slots.Form the configuration to test board according to above-mentioned information, test board obtains the ABIS signaling data that each passage transmits again according to configuration, finally carry out the analytic statistics of ABIS signaling data.When operator not easily provides link configuration data or need to verify that whether the link configuration data provided is correct, the device shown in Fig. 4 can be used to carry out the decoding of upper-layer protocol and coded system.
Known ABIS signaling link speed is 64K, 32K or 16K.
User shown in Fig. 5 selects option to be:
Board selects SDH155M test card, totally 63 E1;
20 seconds detection times of every layout;
Often criticize detection 4 E1;
Inlet flow combines, and only selects to use 31 64K (can not be again high speed) in E1;
Sub-slots shunt combines, and selects 16K shunt, 32K shunt and does not use shunt three kinds;
Framing device combines, and only selects HDLC framing device a kind of;
Agreement assessor combines, and only selects ABIS signaling assessor a kind of.
The LAPD underlying protocol of ABIS signaling assessor to ABIS is differentiated, by extracting front 6 bit values (scope 0-63) of the first byte in a data frame, the i.e. SAPI parameter that specifies of LAPD agreement, compare with the feature 0 (ordinary signaling) of ABIS signaling conventions and 63 (managing signalings), these two kinds in this way, think that the match is successful, otherwise think failure.Further, the above results is added up.
After starting detection, run 16 batches, often criticize 3 layouts, every layout 20 seconds, amount to after 960 seconds, draw testing result.
After drawing testing result, use and generate board configuration feature from testing result, automatically generate the E1 on this SDH155M and link configuration file.
By above-mentioned configuration file, pass to the acquisition module of other monitoring arrangement, acquisition module uses this to configure, and reads in data from corresponding board, carries out ABIS monitoring signaling.
According to practical application needs, each functional module above-mentioned can combination in any, and various combination does not all affect the realization of the embodiment of the present invention.
By the device that the embodiment of the present invention provides, based on existing frame format, link protocol, upper-layer protocol, carry out many combined tests, with optimum Match rate for criterion carries out agreement decoding, for the follow-up process to data provides configuration information.
The present invention can describe in the general context of computer executable instructions, such as program module.Usually, program module comprises the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.Also can put into practice the present invention in a distributed computing environment, in these distributed computing environment (DCE), be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium comprising memory device.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.