Summary of the invention
In view of this, the purpose of the embodiment of the invention is to provide a kind of method, device of method, device and parsing multi-frame of synthetic multi-frame, to realize improving efficiency of transmission by reducing self-defined HDLC frame head expense.
For addressing the above problem, the embodiment of the invention provides a kind of method of synthetic multi-frame, comprising:
Obtain at least two High-Level Data Link Control HDLC Frames, the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Obtain the length information of described at least two HDLC Frames, described length information is the user profile of each HDLC Frame and the length of data message;
Described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises:
Described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and length information;
Describedly at least two HDLC Frames merged into multi-frame comprise:
Keep the address field Addr field of the described destination address information of a expression and the control domain Control field of expression controlled attribute information;
The field that is used to write down this HDLC Frame length information for each HDLC Frame increase, after representing that respectively the frame territory Label N field of the user profile of described HDLC Frame and data message and payload information Info field copy the field of pairing length information to, form the HDLC multi-frame that comprises described at least two HDLC Frame information.
A kind of method of resolving multi-frame also is provided, has comprised:
Obtain the destination address information and the controlled attribute information of multi-frame, and the length information of HDLC Frame;
According to the length information of destination address information, controlled attribute information and HDLC Frame, generate the HDLC Frame;
Generate described HDLC Frame frame check sequence information;
Described generation HDLC Frame comprises:
Duplicate the address field Addr field and the control domain Control field of representing controlled attribute information of the described destination address information of expression of multi-frame data;
Field according to each HDLC Frame length information of record, calculate the length of each HDLC Frame, and the frame territory Label N field of the user profile of representing described HDLC Frame respectively and data message and payload information Info field are copied to after the corresponding C ontrol field.
A kind of device of synthetic multi-frame also is provided, has comprised:
First acquiring unit is used to obtain at least two High-Level Data Link Control HDLC Frames, and the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Second acquisition unit is used to obtain the length information of described at least two HDLC Frames, and described length information is the user profile of each HDLC Frame and the length of data message;
Merge cells is used for described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises:
Described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information;
Describedly at least two HDLC Frames merged into multi-frame comprise:
Keep the address field Addr field of the described destination address information of a expression and the control domain Control field of expression controlled attribute information;
The field that is used to write down this HDLC Frame length information for each HDLC Frame increase, after representing that respectively the frame territory Label N field of the user profile of described HDLC Frame and data message and payload information Info field copy the field of pairing length information to, form the HDLC multi-frame that comprises described at least two HDLC Frame information.
A kind of device of resolving multi-frame also is provided, has comprised:
The 3rd acquiring unit is used to obtain the destination address information and the controlled attribute information of multi-frame and the length information of HDLC Frame;
First generation unit is used for according to described destination address information and controlled attribute information, and the length information of described HDLC Frame, generates the HDLC Frame; Described generation HDLC Frame comprises: the address field Addr field and the control domain Control field of representing controlled attribute information of duplicating the described destination address information of expression of multi-frame data; Field according to each HDLC Frame length information of record, calculate the length of each HDLC Frame, and the frame territory Label N field of the user profile of representing described HDLC Frame respectively and data message and payload information Info field are copied to after the corresponding C ontrol field;
Second generation unit is used to generate described HDLC Frame frame check sequence information.
A kind of multi-frame treatment system also is provided, has comprised the device of synthetic multi-frame and the device of parsing multi-frame,
The device of described synthetic multi-frame is used to obtain at least two High-Level Data Link Control HDLC Frames, and the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information; Obtain the length information of described at least two HDLC Frames, described length information is the user profile of each HDLC and the length of data message; Described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises: described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information; Describedly at least two HDLC Frames are merged into multi-frame comprise: keep the address field Addr field of the described destination address information of a expression and the control domain Control field of expression controlled attribute information; The field that is used to write down this HDLC Frame length information for each HDLC Frame increase, after representing that respectively the frame territory Label N field of the user profile of described HDLC Frame and data message and payload information Info field copy the field of pairing length information to, form the HDLC multi-frame that comprises described at least two HDLC Frame information;
The device of described parsing multi-frame is used to receive the multi-frame from the device of described synthetic multi-frame, obtains the destination address information and the controlled attribute information of multi-frame, and the length information of HDLC Frame; According to the length information of destination address information, controlled attribute information and HDLC Frame, generate the HDLC Frame; And generate described HDLC Frame frame check sequence information; Described generation HDLC Frame comprises: the address field Addr field and the control domain Control field of representing controlled attribute information of duplicating the described destination address information of expression of multi-frame data; Field according to each HDLC Frame length information of record, calculate the length of each HDLC Frame, and the frame territory Label N field of the user profile of representing described HDLC Frame respectively and data message and payload information Info field are copied to after the corresponding C ontrol field.
Compared with prior art, the embodiment of the invention has the following advantages:
Utilize embodiments of the invention, by obtaining at least two High-Level Data Link Control HDLC Frames, the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Obtain the length information of described at least two HDLC Frames, described length information is the user profile of each HDLC Frame and the length of data message;
Described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises:
Described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information.Thereby realized:
At first, the frame head of the single frames data that destination address is identical with controlled attribute has carried out shared, has saved the data occupancy with identical like attribute, has improved service efficiency.
Secondly, the multi-frame data after the merging had both comprised the identical attribute of each single frames data, and data also that each single frames data are inequality are all preserved and indicated.
At last, utilize multi-frame merging method of the present invention, make efficiency of transmission be improved, and synthetic single frames data are many more, efficiency of transmission promotes obvious more.
Embodiment
Below in conjunction with accompanying drawing the specific embodiment of the invention is done further and to be elaborated.
At first, introduce the relevant basic conception of each embodiment of the present invention.
When base transceiver station BTS used HDLC transmission data, its frame format can be with reference to shown in the figure 1, wherein:
Addr presentation address territory: the address that can be base transceiver station or base station controller.
Control represents control domain: can be the attribute of HDLC link in use; As attributes such as priority.
Label N represents the different frame territory: this territory can comprise that information such as sequence number, user's unique identification distinguish each user, and the information of each user in Label N has nothing in common with each other.
Info represents payload information: user's data can be in this field transmission.
In addition, also have Flag (frame initial/end mark) information end to end, FCS information such as (FrameCheck Sequence, frame check sequences) etc. is arranged at postamble at frame head.
Multiplexing in order to realize the HDLC multiframe, former frame structure is carried out following modification:
As shown in Figure 2, in the HDLC Frame, increase multiframe multiplexed information indication field " M " (Multi-frame Indication: multiframe is indicated):
M=0: expression notebook data frame is a single frames, has only the data message of a valid data frame;
M=1: expression notebook data frame is a multi-frame, comprises the data message that surpasses a valid data frame;
For the those skilled in the art, can understand, can also adopt other mode to be used to indicate single frames and multi-frame.Be not only to be limited to use M=0 to represent single frames, can also use opposite mode to identify.Only need in former frame, increase new indication field and carry out that multi-frame or single frames identify, can realize the present invention.
1., 2. the tentation data frame is two Frames to same BSC, because its destination address is identical, so the Addr field is identical;
1., 2. Frame has identical priority and other controlled attributes, and then the Control field is identical;
Frame 1., 2. different fields comprises the Label field, as represent different users; The Info field, as represent different voice.
Multi-frame form after then multiframe merges can be as shown in 3.:
Wherein: Addr is identical with the Control field, only keeps a;
In order in multi-frame, to find out the 1. length in Info territory of Frame, increased len field, len field is in order to indication Label 1+Info field length sum.
Equally, 2. Frame is increased the length sum of field LEN with record Label 2+Info field.
At last, again 3. the entire data frame is carried out CRC check, the result who obtains inserts the FCS field.Increase the Flag field at initial and end, can form a HDLC multi-frame that comprises two frame informations.
Repeat said process, can obtain comprising the multi-frame of a plurality of HDLC Frame information.
With reference to shown in Figure 3, be the method embodiment that the embodiment of the invention provides, comprise step:
Step 301, obtain at least two HDLC (High-Level Data Link Control, High-Level Data LinkControl) Frame, the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Step 302, obtain the length information of described at least two HDLC Frames, this length information is the length of user profile and data message;
Step 303, described at least two HDLC Frames are merged into multi-frame, described multi-frame comprises:
The common destination address information of all HDLC Frames and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and length information.
Below to obtain the method that two HDLC Frames are the example explanation embodiment of the invention one, comprise step:
Steps A, obtain two HDLC Frames, the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Step B, obtain the length information of above-mentioned two HDLC Frames, this length information is the user profile of each HDLC Frame and the length sum of data message;
Before step B, can also comprise:
According to the multiframe multiplexed information of above-mentioned two HDLC Frames, judge whether above-mentioned two HDLC Frames are single frames, if above-mentioned two HDLC Frames are single frames, then carry out the step of the length information that obtains two HDLC Frames, i.e. execution in step B.
Step C, above-mentioned two HDLC Frames are merged into multi-frame, described multi-frame comprises:
Destination address information and controlled attribute information that above-mentioned two HDLC Frames are common, and the user profile of described at least two HDLC Frames, data message and length information.
Above-mentioned enforcement one is to obtain the method that two HDLC Frames are the example explanation embodiment of the invention, for the those skilled in the art, this method includes but not limited to obtain two HDLC Frames, three HDLC Frames, four HDLC Frames or the more methods that can use the embodiment of the invention one to provide are provided, are not repeated them here.
Wherein, described multi-frame also further comprises: frame check sequence information, the frame check sequence information that described frame check sequence information is described multi-frame.
Wherein, obtaining the HDLC Frame can be specially: the HDLC Frame that obtains or obtain no more than default number in the Preset Time section.
Utilize embodiments of the invention, merge by the HDLC Frame that will have identical destination address and controlled attribute, the destination address of multiplexing each HDLC Frame and controlled attribute, thus realized:
At first, the frame head of the single frames data that destination address is identical with controlled attribute has carried out shared, has saved the data occupancy with identical like attribute, has improved service efficiency.
Secondly, the multi-frame data after the merging had both comprised the identical attribute of each single frames data, and data also that each single frames data are inequality are all preserved and indicated.
At last, utilize multi-frame merging method of the present invention, make efficiency of transmission be improved, and synthetic single frames data are many more, efficiency of transmission promotes obvious more.
Wherein, in the foregoing description, described the HDLC Frame is merged into after the multi-frame, is also comprised:
Send described multi-frame.
On the basis that above-mentioned Frame merges, with reference to shown in Figure 4, be the embodiment two of the method for the merging multi-frame that provides of the embodiment of the invention, present embodiment has illustrated how a plurality of data messages to be merged and has sent after becoming the multi-frame data.
Before process of transmitting carries out, require a plurality of data messages are synthesized a multi-frame, the size of the multi-frame of merging can be controlled with two parameters: stand-by period t and maximum multi-frame length M AX_Len.Wherein: the stand-by period determines same multi-frame to need the maximum time of waiting in building-up process; MAX_Len determines that maximum can comprise what packets or maximum data length in the multi-frame.
Step 401, obtain one and send message (this message can be the HDLC Frame), judge the numerical value in described message M territory;
If step 402 M=1 illustrates that current data is a multi-frame, disregards; To being the data of multi-frame, can not carry out multiplexing again.
If step 403 M=0 illustrates then that this HDLC Frame can be synthesized and is multi-frame, prepare the data field, start this multi-frame timer, fill in multi-frame head Control and Addr field;
Step 404, calculate the length LEN of Label+Info, write multi-frame Control field after, the data of Label and Info are write on LEN after; LEN is the length that is used for representing Label+Info, in order to the length in each Label+Info territory in the multi-frame of location.
Step 405, judge multi-frame timer whether then, or whether the multi-frame number reaches the maximum multi-frame packet number of permission.Both one of condition satisfy, then execution in step 410, otherwise, execution in step 406; This step can be carried out in the mode of periodically monitoring in actual applications, can walk abreast with other steps and carry out;
Step 406, obtain the next message that sends, judge the numerical value in described message M territory; If M=1 illustrates that current data is a multi-frame, disregards;
If step 407 M=0, then with existing HDLC Frame relatively, judge whether all identical with Addr, the Control of existing HDLC Frame, if Addr, Control are identical, execution in step 408, otherwise other opens up a data field, execution in step 403;
Step 408, calculate the length LEN of the Label+Info of this message, write successively after the previous frame information Info with the Label+Info field, referring to Fig. 2 multi-frame frame structure.Behind public head, every frame data all form all are LEN+Label+Info, LEN+Label+Info, so the next frame data should write after the previous frame, and promptly after the Info territory, repeating step 405;
Step 409, calculate the FCS of whole multiplexed frame, and write after last HDLC Frame Info, mend a Flag (0x7E), be used to increase frame initial/end mark;
Step 410, the M value is set at " 1 ", being used to indicate current data is multi-frame; Finish multi-frame framing process, the timeing closing device is removed the multi-frame buffering area, sends described multi-frame.
With reference to shown in Figure 5, be the embodiment one of the method for multi-frame parsing of the present invention, comprise step:
Step 501, for the multi-frame that receives, obtain the destination address information and the controlled attribute information of multi-frame data, and the length information of HDLC Frame;
Step 502, according to the length information of HDLC Frame, destination address information and controlled attribute information generate the HDLC Frame;
Step 503, the described HDLC Frame frame check sequence information of generation.
Utilize the embodiment of the method for multi-frame parsing of the present invention,, duplicate the address field and the control domain of described multi-frame data by for the multi-frame data that receive; According to multi-frame length field information, calculate the length of described each Frame; Duplicate user profile and data message in the multi-frame data; Calculate described each Frame frame check sign indicating number.Thereby realized:
At first, the common data of each Frame that only need to transmit in the multi-frame copy in each Frame, have reduced the volume of transmitted data of transmission course, have improved efficiency of transmission.
Secondly, the peculiar information reproduction of each Frame entrained in the multi-frame to each Frame, has been recovered each Frame easily.
Wherein, in the foregoing description, before the described destination address information and controlled attribute information of obtaining described multi-frame data, also comprise:
Judge whether described multi-frame frame check is successful, if then receive this multi-frame, execution in step 501.
Wherein, in the foregoing description, before the described destination address information and controlled attribute information of obtaining described multi-frame data, also comprise:
According to described multi-frame data multiframe multiplexed information indication, judge whether described multi-frame is multi-frame, and then execution in step 501.
With reference to shown in Figure 6, be the embodiment two of the method for the parsing multi-frame that provides of the embodiment of the invention, after present embodiment is used to illustrate the multi-frame receiving course, how to parse each subframe in the multi-frame, comprise step:
Step 601, receive a Frame, judge whether success of FCS verification;
If step 602 verification succeeds receives data, execution in step 604;
If step 603 verification failure does not receive described data;
The value of M in step 604, the judgment data frame if equal 1, then is a multi-frame.Enter step 606;
If the value of M equals 0 in step 605 Frame, show that current data is the single frames data, handles by the processing mode of single frames data;
Step 606, recover to comprise each Frames of first frame data successively, recovery process comprises:
Duplicate Addr, the Control territory of multi-frame data,, calculate the length of first frame data, Label and Info are copied to after the Control, calculate the FCS of first frame data, recover first frame data according to len field.
Recover second frame data, recovery process comprises:
Duplicate Addr, Control territory,, calculate the length of second frame data, Label and Info are copied to after the Control according to the len field of second frame.Recomputate the FCS of second frame data, recover second frame data.
And the like, recover all data in the multi-frame.
From receive and process of transmitting as can be seen, owing to the existence that multiplexing indication field " M " arranged, the sending and receiving both sides all can consult whether to use the multiframe multiplex technique in advance, this can simplified design and implementation procedure.
Utilizing multi-frame merging method of the present invention, make efficiency of transmission be improved, is example with above-mentioned frame format:
The data of supposing transmission are speech frames, and effective length is 20 bytes;
Addr is 1 byte; Control is 2 bytes; Label is 1 byte; FCS is 2 bytes.LEN length is 1 byte.
Before not using the multiframe multiplex technique, efficiency of transmission is:
Length (Info)/(Length (head and the tail Flag+Addr+Control+Label+Info+FCS))=20/ (2+1+2+1+20+2)=20/28=71.4%
If 5 Frames are multiplexed in the Frame, then efficiency of transmission is:
(5*Length (Info))/(5*Length (LEN+Label+Info)+Length (head and the tail Flag+Addr+Control+FCS))=(5*20)/(5* (1+1+20)+(2+1+2+2))=100/117=85.47%
Its efficiency of transmission ratio has improved 85.47%-71.4%=14.07% when not using multiplex technique.
For the those skilled in the art,, efficiency of transmission can improved to a greater extent by improving the number of multiplexed frame.
With reference to shown in Figure 7, be the embodiment one of the device of synthetic multi-frame data of the present invention, comprising:
First acquiring unit 701 is used to obtain at least two High-Level Data Link Control HDLC Frames, and the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information;
Second acquisition unit 702 is used to obtain the length information of described at least two HDLC Frames, and described length information is the user profile of each HDLC Frame and the length of data message;
Merge cells 703 is used for described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises:
Described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information.
Utilize embodiments of the invention, by obtained at least two High-Level Data Link Control HDLC Frames by first acquiring unit 701, the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information; Second acquisition unit 702 obtains the length information of described at least two HDLC Frames, and described length information is the user profile of each HDLC Frame and the length of data message; Merge cells 703 is merged into multi-frame with described at least two HDLC Frames, and described multi-frame comprises:
Described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information.Thereby realized:
At first, the frame head of the single frames data that destination address is identical with controlled attribute has carried out shared, has saved the data occupancy with identical like attribute, has improved service efficiency.
Secondly, the multi-frame data after the merging had both comprised the identical attribute of each single frames data, and data also that each single frames data are inequality are all preserved and indicated.
At last, utilize multi-frame merging method of the present invention, make efficiency of transmission be improved, and synthetic single frames data are many more, efficiency of transmission promotes obvious more.
Wherein, in the foregoing description, also comprise:
First judging unit is used for the multiframe multiplexed information according to described at least two HDLC Frames, judges whether described at least two HDLC Frames are single frames, if described at least two HDLC Frames are single frames, then indicates the described first acquiring unit work.
Wherein, in the foregoing description, described multi-frame also further comprises: frame check sequence information, the frame check sequence information that described frame check sequence information is described multi-frame.
Wherein, in the foregoing description, also comprise:
Whether then second judging unit is used to judge the multi-frame timer that sets in advance, if the multi-frame timer is then, or
Judge that the number that described first acquiring unit obtains the HDLC Frame reaches maximum number, then:
Indicate described first acquiring unit to finish to obtain the process of HDLC Frame.。
Wherein, in the foregoing description, also comprise:
The unit being set, being used at described multi-frame multiframe multiplexed information being set, is multi-frame to be used to indicating described multi-frame.
Wherein, in the foregoing description, also comprise:
Transmitting element is used to send described multi-frame.
With reference to shown in Figure 8, be the embodiment one of the device of parsing multi-frame data of the present invention, comprising:
The 3rd acquiring unit 801 is used to obtain the destination address information and the controlled attribute information of multi-frame and the length information of HDLC Frame;
First generation unit 802 is used for according to described destination address information and controlled attribute information, and the length information of described HDLC Frame, generates the HDLC Frame;
Second generation unit 803 is used to generate described HDLC Frame frame check sequence information.
Utilize the embodiment of the device of multi-frame parsing of the present invention, by the 3rd acquiring unit 801, obtain the destination address information and the controlled attribute information of multi-frame, and the length information of each HDLC Frame, described length information comprises the length of user profile and data message; First generation unit 802, according to described destination address information and controlled attribute information, and the length information of each described HDLC Frame, described length information is the user profile of each HDLC Frame and the length of data message, generates the HDLC Frame; Second generation unit 803 generates described HDLC Frame frame check sequence information.Thereby realized:
At first, the common data of each Frame that only need to transmit in the multi-frame copy in each Frame, have reduced the volume of transmitted data of transmission course, have improved efficiency of transmission.
Secondly, the peculiar information reproduction of each Frame entrained in the multi-frame to each Frame, has been recovered each Frame easily.
Wherein, in the foregoing description, also comprise:
The 3rd judging unit is used to judge whether described multi-frame frame check is successful, if then indicate described the 3rd acquiring unit work.
Wherein, in the foregoing description, also comprise:
The 4th judging unit is used for judging that according to described multi-frame multiframe multiplexed information indication described data are multi-frame, then indicates described the 3rd acquiring unit work.
Wherein, in the foregoing description, also comprise:
Receiving element if be used for described multi-frame frame check success, then receives described data.
With reference to shown in Figure 9, be the embodiment one of multi-frame treatment system of the present invention, comprise: the device 902 of the device 901 of synthetic multi-frame and parsing multi-frame, wherein, the device of described synthetic multi-frame is used to obtain at least two High-Level Data Link Control HDLC Frames, and the HDLC Frame that wherein obtains has identical destination address information and controlled attribute information; Obtain the length information of described at least two HDLC Frames, described length information is the user profile of each HDLC and the length of data message; Described at least two HDLC Frames are merged into multi-frame, and described multi-frame comprises: described destination address information and controlled attribute information, and the user profile of described at least two HDLC Frames, data message and described length information;
The device of described parsing multi-frame is used to receive the multi-frame from the device of described synthetic multi-frame, obtains the destination address information and the controlled attribute information of multi-frame, and the length information of HDLC Frame; According to the length information of destination address information, controlled attribute information and HDLC Frame, generate the HDLC Frame; And generate described HDLC Frame frame check sequence information.。
Through the above description of the embodiments, the those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium, comprise that some instructions are with so that a computer equipment (can be a personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
Above-described embodiment of the present invention does not constitute the qualification to protection range of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within protection scope of the present invention.