Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The embodiment of the invention provides a kind of multi-type network data transmission method and device, carries out the problem of transfer of data to solve the Network Interface Module of can't accurately selecting that causes owing to type of network interface is more of the prior art.The present invention is described in detail below in conjunction with accompanying drawing.
Embodiment one
The embodiment of the invention provides a kind of multi-type network data transmission method, and as shown in Figure 1, this method comprises:
Step 101 receives the serial data from the network data source;
Step 102 is mated serial data and pre-configured frequency of oscillation, obtains the speed in network data source;
Step 103 is converted to parallel data according to the speed in network data source with serial data;
Step 104 is obtained frame alligning information according to pre-configured physical layer decoding process and frame alignment mode from parallel data, determine the type in network data source according to frame alligning information;
Step 105 is obtained check code according to pre-configured link layer decoding process from parallel data, determine the link layer type in network data source according to check code;
Step 106 is transmitted parallel data according to speed, type and the link layer type in network data source.
By above description as can be seen, by to (promptly from the network data source, network interface) after serial data is carried out matching treatment with pre-configured frequency of oscillation, again with pre-configured physical layer decoding process and frame alignment mode, the link layer decoding process is handled, can obtain the speed of this network interface, type and link layer type, thereby can with this network interface Network Interface Module transmission parallel data correspondingly, guarantee the normal operation of network, overcome the Network Interface Module of can't accurately selecting that causes owing to type of network interface is more of the prior art and transmitted the problem of data.
OSI is divided into seven layers with network, is followed successively by from bottom to up: physical layer, data link layer, network layer, transport layer, session layer, presentation layer and application layer.The embodiment of the invention mainly concentrates on physical layer and data link layer.What wherein, mainly determine in physical layer is the conversion of the speed and the serial parallel data of network interface; What mainly determine in data link layer is the type and the link layer type of network interface.
The data of network interface (perhaps network data source) output, behind physical layer modular converter foremost, the mode with universal serial bus is linked into Network Interface Module usually.Connect for the Ethernet copper cable, the modular converter of front end is a transformer; For connection of Ethernet optical cable or SDH network etc., modular converter is an optical-electrical converter.In seven layers of modular type of network of OSI, this modular converter is commonly referred to the PMD sublayer, is responsible for receiving and send signal from transmission medium.The type of PMD sublayer and network is irrelevant, and is only relevant with transmission medium and speed, and the signal transmission that two-forty usually can compatible low rate.The embodiment of the invention mainly is about the processing section behind the PMD sublayer, promptly receives network signal and is converted to after the universal serial bus from transmission medium.
In order to understand the embodiment of the invention better, below describe step 102,104 and 105 in detail.
(1) step 102
Serial data is mated the speed of obtaining network interface with pre-configured frequency of oscillation comprise as shown in Figure 2 flow process: with serial data input rate match circuit, this rate matching circuit mates serial data with pre-configured frequency of oscillation; If the result of coupling is in the speed lock-out state for rate matching circuit, determine that then pre-configured frequency of oscillation (oscillator signal) rate corresponding is the speed in network data source, exports this speed.Otherwise, proceed coupling with other pre-configured frequencies of oscillation.Wherein, all corresponding clock frequency of each pre-configured frequency of oscillation, each clock frequency is corresponding with a speed.
Particularly, this rate matching circuit can be phase-locked loop pll (Phase-LockedLoop, phase-locked loop) or resonant circuit.With PLL is example, and the idiographic flow of step 102 is: serial data is imported PLL, and PLL carries out the clock frequency sampling with the clock frequency of pre-configured frequency of oscillation correspondence to serial data; If the result of sampling is in the phase locking state for PLL, then represent the speed that this clock frequency rate corresponding is a network interface, export this speed, otherwise, proceed the clock frequency sampling processing with other clock frequencies.
In the specific implementation, can pre-configured information as shown in table 1:
Table 1
Pre-configured frequency of oscillation |
Clock frequency |
Speed |
??S1 |
??F1 |
??V1 |
??S2 |
??F2 |
??V2 |
??S3 |
??F3 |
??V3 |
Serial data input PLL, PLL selects F1 that serial data is carried out the clock frequency sampling, if the result of sampling is in the phase locking state for PLL, represent that then V1 is the speed of network interface, carry out step 103 this moment, otherwise, PLL continues to select the clock frequency of F2 correspondence that serial data is carried out the clock frequency sampling, if the result of sampling is in the phase locking state for PLL, represent that then V2 is the speed of network interface, carry out step 103 this moment, otherwise, PLL continues to select the clock frequency of F3 correspondence that serial data is carried out the clock frequency sampling, is the speed that PLL is in the phase locking state up to finding sampled result.Generally speaking, the pre-configured speed of user has comprised various common types, therefore, in most of the cases can find speed accurately.
The pre-configured speed here is multiple common network interface speed, or the multiple speed that sets of user, for example, the 10M of Ethernet, 100M, 1000M even Wan Zhao etc., the 155.52M of SDH network, 622.08M, 2488.32M etc., this pre-configured speed can exist with the form of form, user friendly configuration.
After matching the speed of network interface, with the clock frequency of this speed correspondence serial data is sampled, be converted to parallel data then.
(2) step 104
After the speed of having determined network interface, parallel data is carried out frame alignment with pre-configured physical layer decoding process and frame alignment mode and is handled.Particularly, parallel data is decoded by pre-configured physical layer decoding process, the decoding back is carried out frame alignment according to pre-configured frame alignment mode and is handled.Wherein, carry out decode operation with pre-configured physical layer decoding process and carry out, carry out the data link layer that operates in of frame alignment processing in pre-configured frame alignment mode and carry out in physical layer.
Different type of network interface has different physical layer decoding processes usually, as the 1+x of SDH
6+ x
7The disturbance coding, the 8B/10B coding of Ethernet etc.; Each physical layer decoding process be usually to there being different frame alignment modes, for example, and different frame alignment bytes, different location byte lengths or different localization methods.If the mode according to certain type of network interface is carried out the frame alignment success to parallel data, illustrate that then parallel data is from such network interface.
Concrete operations are as shown in Figure 3: step 1041, and parallel data is carried out frame alignment with pre-configured physical layer decoding process and frame alignment mode handle; Step 1042, the result who handles according to frame alignment are determined the frame alligning information (as, frame alignment symbol) of parallel data; Step 1043 is determined the type of network interface according to the frame alligning information of parallel data.
Particularly, in parallel data, seek a plurality of frame alignment symbols earlier with the rule of pre-configured frame alignment mode correspondence, reexamine the rule of these a plurality of frame alignment symbols,, the frame alignment success is described then if what (as 1000) frame alignment accord with the rule that all meets this pre-configured frame alignment mode correspondence continuously.If (as 0.1s) can't locate within a certain period of time, then represent the frame alignment failure.
For example, the frame alignment symbol of SDH occurred for the fixed cycle, at first determine to seek in the parallel data a plurality of frame alignment symbols, whether the rule of checking a plurality of frame alignment symbols is to occur the fixed cycle, if continuous 1000 frame alignment symbol all is to occur the fixed cycle, then represent the frame alignment success, the type of network interface of this parallel data is SDH.The frame first symbol of Ethernet and postamble time difference are within certain scope, at first determine to seek in the parallel data a plurality of frame alignment symbols, whether the rule of checking a plurality of frame alignment symbol is that frame first symbol and postamble time difference are within certain scope, if continuous 1000 frame alignment symbol all is that frame first symbol and postamble time difference are within certain scope, then represent the frame alignment success, the type of network interface of this parallel data is an Ethernet.
Here pre-configured frame alignment mode is multiple common frame alignment mode, for example, and PDH frame alignment mode, OTN frame alignment mode etc.Can there be user friendly configuration with the form of form in this pre-configured frame alignment mode.
(3) step 105
After the type of having determined network interface, parallel data is carried out decoding processing with pre-configured link layer decoding process, because different link layer protocols has different code encoding/decoding modes usually, as modes such as BSC encoding and decoding, PPP HDLC encoding and decoding, Cisco HDLC encoding and decoding, LAPS encoding and decoding, GFP encoding and decoding.If parallel data is carried out the encoding and decoding success according to certain link layer code encoding/decoding mode, the network interface of this parallel data from this link layer code encoding/decoding mode then is described, the link layer protocol of this network interface is just corresponding with this code encoding/decoding mode.
Concrete operations flow process as shown in Figure 4: step 1051, parallel data is carried out decoding processing with pre-configured link layer decoding process; Step 1052, obtain with pre-defined rule according to the result of decoding processing and to obtain check code, this pre-defined rule is corresponding with pre-configured link layer decoding process, for example, with last 4 bytes of HDLC packet as check code, with the 3rd and the 4th byte of GFP data fetch packet as check code; Step 1053 is verified check code so that pre-defined rule is counter, to judge whether corresponding pre-configured decoding process of check code, the pre-defined rule here can be the CRC computing method, but the CRC multinomial difference of different agreement usually, the zoning is also different; Step 1054, if judged result is the corresponding pre-configured link layer decoding process of check code, represent that then pre-configured link layer decoding process link corresponding layer type is the link layer type of network interface, output link layer type, otherwise, proceed decoding processing with other pre-configured link layer decoding processes.
For example, pre-configured link layer decoding process has BSC coding, LAPS coding, GFP coding and PPP HDLC coding, if parallel data is decoded with PPP HDLC coded system, decoded result comprises as shown in Figure 5: sign (0x7E), address (0xFF), control bit (0x03), agreement, content and FCS check code.Counter afterwards the checking at first judged the fixed signal position in the decoded result, that is, and and to the judgement of the flag bit of immobilized substance, as, judge whether first byte of HDLC is 0xFF, and whether second byte is 0x03; Calculate the FCS check code in the decoded result then, particularly, the multinomial coefficient of FCS verification is x " 04C11DB7 ", according to this multinomial, decoded result divided by this multinomial, is obtained remainder, then this remainder is compared with the check code in the decoded result, if equate with the check code in the decoded result, represent that then this link is consistent with PPP HDLC, promptly the link layer protocol of this network interface is PPP HDLC.
In practical operation, for the data of certain link layer, may be distributed on the passage of a plurality of physical layers, as the Virtual Concatenation technology of SDH, many E1 binding technology of PDH etc.Therefore, before execution in step 1051, also need the aggregation of data on a plurality of physical layer channels is formed the data of certain link layer, and then carry out decoding processing.
If it is 1+x that pre-configured speed comprises 155.52M, 622.08M, 2488.32M, physical layer encodes mode
6+ x
7Disturbance coding, frame alignment mode comprise that frame alignment byte 0xF628, link layer coded system comprise PPP HDLC, Cisco HDLC, LAPS and GFP, then pass through said method, the speed that matches is 155.52M, the frame alignment mode is 0xF628, coded system conforms to PPP HDLC agreement, the speed that then can know network interface is 155.52M, and type is SDH, and it is PPPHDLC that link becomes agreement.
As seen from the above description, determined by step 102-105 after the parameter of network interface that just recognition network interface module is easily transmitted parallel data accurately, thereby guaranteed the normal operation of network.
Embodiment two
The embodiment of the invention also provides a kind of multi-type network data transmitting device, and this device preferably is used for realizing the method for the foregoing description one.Fig. 6 is the structured flowchart of this device, and as shown in Figure 6, this multi-type network data transmitting device 1 comprises:
Memory cell 10 is used to store pre-configured frequency of oscillation, pre-configured physical layer decoding process, pre-configured frame alignment mode and pre-configured link layer decoding process;
Data Receiving unit 11 is used to receive the serial data from the output of network data source;
Speed acquiring unit 12 is used for serial data and pre-configured frequency of oscillation are mated, and obtains the speed in network data source;
String and converting unit 13 are used for according to the speed in network data source serial data being converted to parallel data;
Type determining unit 14 is used for obtaining frame alligning information according to pre-configured physical layer decoding process and frame alignment mode from parallel data, determines the type in network data source according to frame alligning information;
Link layer type determining unit 15 is used for obtaining check code according to pre-configured link layer decoding process from parallel data, determines the link layer type in network data source according to check code;
Data transmission unit 16, the speed, type and the link layer type that are used for according to the network data source are transmitted parallel data.
By above description as can be seen, through-rate acquiring unit 12, type determining unit 14 and link layer type determining unit 15 just can be determined speed, type and the link layer type of network interface, thereby can be with the corresponding Network Interface Module transmission of this network interface parallel data, guaranteed the normal operation of network, overcome the Network Interface Module of can't accurately selecting that causes owing to type of network interface is more of the prior art and transmitted the problem of data.
In order further to understand the embodiment of the invention, below describe speed acquiring unit 12, type determining unit 14 and link layer type determining unit 15 respectively in detail.
As shown in Figure 7, speed acquiring unit 12 comprises:
Matching module 121 is used for serial data input rate match circuit, and rate matching circuit mates serial data with pre-configured frequency of oscillation; This rate matching circuit can be phase-locked loop (PLL) or resonant circuit.
Speed determination module 122 is used for determining that pre-configured frequency of oscillation rate corresponding is the speed in network data source when the result of coupling is in the speed lock-out state for rate matching circuit.
As shown in Figure 8, type determining unit 14 comprises:
Frame alignment processing module 141 is used for according to pre-configured physical layer decoding process and frame alignment mode parallel data being carried out the frame alignment processing;
Frame alligning information acquisition module 142 is used for obtaining according to the result that frame alignment is handled the frame alligning information (as, frame alignment symbol) of parallel data;
Type determination module 143 is used for determining according to the frame alligning information of parallel data the type in network data source.
As shown in Figure 9, link layer type determining unit 15 comprises:
Decoder module 151 is used for parallel data is carried out decoding processing with pre-configured link layer decoding process;
Check code acquisition module 152 is used for obtaining check code according to the result of decoding processing with pre-defined rule;
Authentication module 153 is used for the check code that obtains is verified with pre-defined rule, to judge whether corresponding pre-configured link layer decoding process of this check code;
Link layer type determination module 154 is used for determining that pre-configured link layer decoding process link corresponding layer type is the link layer type of network interface when judged result is the corresponding pre-configured link layer decoding process of check code.
In practical operation, for the data of certain link layer, may be distributed on the passage of a plurality of physical layers, as the Virtual Concatenation technology of SDH, many E1 binding technology of PDH etc.Link layer type determining unit also is used for the aggregation of data on a plurality of physical layer channels is formed the data of certain link layer, and then carries out decoding processing.
In the specific implementation, physical layer decode operation part in above-mentioned Data Receiving unit 11, speed acquiring unit 12, string and converting unit 13 and the type determining unit 14 can be arranged in the physical layer of OSI seven layer model, the frame alignment processing section of type determining unit 14 and link layer type determining unit 15 can be arranged in the data link layer of OSI seven layer model, as shown in figure 10, the PMD sublayer receives network signal from transmission medium (can be Ethernet copper cable or Ethernet optical cable), and converts network signal to universal serial bus.The Data Receiving unit receives serial data, the speed acquiring unit carries out the clock frequency sampling processing according to corresponding clock frequency in the configurable Speedometer Drive (being above-mentioned pre-configured oscillation frequency counting rate meter) successively to serial data, up to the clock frequency that finds coupling, determine that the clock frequency rate corresponding that matches is the speed of network interface, and with the speed of the network interface determined serial data is gone here and there and convert parallel data to by string and converting unit; Then, according to physical layer decoding process in the configurable type list and frame alignment mode parallel data is carried out the frame alignment processing by the type determining unit, up to the frame alignment mode that finds coupling, determine the type of the type of network interface of the frame alignment mode correspondence that matches for this network interface; Afterwards, according to the link layer decoding process in the configurable links table parallel data is carried out decoding processing by link layer type determining unit again, up to the decoding process that finds coupling, determine that the decoding process link corresponding layer protocol that matches is the link layer protocol of this network interface.Afterwards, parallel data is transmitted in network layer based on speed, type, the link layer protocol of the network interface of determining.
Implementation between above-mentioned each module can repeat no more here with reference to associated description in the foregoing description one.
In sum, by pre-configured each network interface rate corresponding, physical layer decoding process, frame alignment mode and link layer decoding process, the serial data that receives is carried out determining after the matching treatment speed of network interface, and go here and there and be converted to parallel data with the speed of network interface, then parallel data is carried out frame alignment with pre-configured physical layer decoding process and frame alignment mode and handle, determine the type of network interface; Afterwards, parallel data is carried out decoding processing with pre-configured link layer decoding process, determine the link layer type of network interface, thereby can know the parameter of this network interface, for the correct transmission of parallel data provides assurance, compare and prior art, the scheme that the embodiment of the invention provides is the access network interface module simply accurately, has guaranteed the normal operation of network.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method can control relevant hardware by program and finish, this program can be stored in the computer read/write memory medium, such as ROM/RAM, magnetic disc, CD etc.
Above specific embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; below only be specific embodiments of the invention; and be not intended to limit the scope of the invention; within the spirit and principles in the present invention all, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.