Summary of the invention
Embodiment of the present invention technical problem to be solved is to provide a kind of multi-connection processing method and device of network application, the a plurality of connections that belong to a kind of network application can be associated together, and the information that each connection can be extracted is shared, do not need simultaneously each bar is connected the process of all carrying out agreement identification yet, further improved the efficient of system's operation.
Embodiment of the present invention is achieved through the following technical solutions, and a kind of multi-connection processing method of network application comprises:
In the negotiation data bag of first connection from multi-link, obtain IP address and port address four-tuple that the next both sides of connection will use;
From the IP address and port address four-tuple that are obtained, set up polynary group of table of prediction connection for two or three that choose correspondence;
Importing the information of extracting in described first connection into described prediction connects in the polynary group of table;
When described next the connection when arriving, search described prediction and connect polynary group of table, obtain the list item that is complementary with address that described next one is connected both sides and the information of extraction in described first connection;
The described entry updating that is complementary is the next IP address of both sides' correspondence and the four-tuple of port address of connecting, carries out described next transmission and the processing that connects packet according to described four-tuple.
Described two or three of choosing correspondence set up prediction and connect polynary group of table, specifically comprise:
All IP addresses of one end and port address pair are made up respectively with all IP addresses of the other end, set up the prediction that comprises tlv triple and connect polynary group of table;
Or, all IP addresses of an end and port address pair are made up respectively with all of the port address of the other end, set up the prediction that comprises tlv triple and connect polynary group of table.
Described two or three of choosing correspondence set up prediction and connect polynary group of table, specifically comprise:
All the IP addresses of one end or all the IP addresses or the port address of the port address and the other end are made up respectively, set up the prediction that comprises two tuples and connect polynary group of table.
Described method also comprises:
The list item that described prediction is connected polynary group of table carries out overtime burin-in process, if in the time of setting, a certain list item does not upgrade, then with the aging deletion of this list item.
When described next the connection when arriving, searching before described prediction connects polynary group of table, also comprise:
Search the four-tuple of setting up in advance and transmit,, then carry out described next transmission and the processing that connects packet according to described four-tuple list item if find corresponding four-tuple list item; If do not find corresponding four-tuple list item, then search described prediction again and connect polynary group of table, finish successor operation.
Comprise in the list item that the described four-tuple of setting up is in advance transmitted: the both sides' that connect IP address and port address four-tuple;
The list item that the described four-tuple of setting up is in advance transmitted carries out overtime burin-in process, if in the time of setting, a certain list item does not upgrade, then with the aging deletion of this list item.
The information of extracting in described first connection comprises: the both sides' that connect for the first time account number or password primary data information (pdi).
Embodiment of the present invention also provides a kind of multi-link processing unit of network application, comprising:
Address resolution unit is used for from the negotiation data bag of first multi-link connection, obtains IP address and port address four-tuple that the next both sides of connection will use;
Prediction connects sets up the unit, is used for from IP address and the port address four-tuple obtained, sets up polynary group of table of prediction connection for two or three that choose correspondence;
The information transfer unit is used for importing the described information that first connects extraction into described prediction and connects in the polynary group of table;
Multi-link processing unit, be used for when next connection arrives, the described next packet that connects is handled, wherein: when the next one connects arrival, search described prediction and connect polynary group of table, obtain the list item that is complementary with address that described next one is connected both sides and the information of extraction in described first connection; The described entry updating that is complementary is the next IP address of both sides' correspondence and the four-tuple of port address of connecting, carries out described next transmission and the processing that connects packet according to described four-tuple.
Also comprise in the described device:
The burin-in process unit is used for described prediction connected and sets up the list item that the prediction of setting up the unit connects polynary group of table and carry out overtime burin-in process, and wherein: if in the time of setting, a certain list item does not upgrade, then with the aging deletion of this list item.
Described device is arranged on the end equipment that connects, or is arranged to independent functional entity.
By the above-mentioned technical scheme that provides as can be seen, at first in the negotiation data bag of the connection of first from multi-link, obtain IP address and port address four-tuple that the next both sides of connection will use; Then from the IP address and port address four-tuple that are obtained, choose corresponding two or three and set up prediction and connect polynary group of table, and will be described first connect in the information of extraction import described prediction into and connect in the polynary group of table; Like this,, just can search described prediction and connect polynary group of table, the list item that the address that obtains to be connected both sides with described next one is complementary, and the information of extraction in described first connection when described next the connection when arriving; Again the described entry updating that is complementary is the next IP address of both sides' correspondence and the four-tuple of port address of connecting, just can carries out described next transmission and the processing that connects packet at last according to described four-tuple.Because when searching polynary group of table of prediction connection, also obtained the information of extraction in first connection simultaneously, when the packet that the next one is connected is handled, just a plurality of connections that belong to a kind of network application can be associated together like this, realize respectively connecting sharing of institute's information extraction; Provide the next forwarding that connects packet to handle owing to set up polynary group of table of prediction connection simultaneously, so when the data of a plurality of connections being transmitted processing, with regard to not needing each bar is connected the process of all carrying out agreement identification, saved Internet resources, improved the efficient of system's operation.
Embodiment
Embodiment of the present invention provides a kind of multi-connection processing method and device of network application.Can be when searching polynary group of table of prediction connection, obtained the information of extraction in first connection simultaneously, when the packet that the next one is connected is handled, just a plurality of connections that belong to a kind of network application can be associated together like this, realize respectively connecting sharing of institute's information extraction; Provide the next forwarding that connects packet to handle owing to set up polynary group of table of prediction connection simultaneously, so when the data of a plurality of connections being transmitted processing, with regard to not needing each bar is connected the process of all carrying out agreement identification, saved Internet resources, improved the efficient of system's operation.
For better describing embodiment of the present invention, now in conjunction with the accompanying drawings the specific embodiment of the present invention is described, be illustrated in figure 1 as the schematic flow sheet of the described method of embodiment of the present invention, described method comprises:
Step 11: the address four-tuple of obtaining the next both sides of connection.
Specifically, be exactly in multi-link network application, if an end of having set up in the two ends that connect needs to connect with the other end again, then from the negotiation data bag of this first connection, obtain IP address and port address four-tuple that the next both sides of connection will use.
Here be sake of clarity, can be set at client C1 and server end S with having set up the two ends that connect, when C1 needs to connect with another client C2 again, C1 can send a negotiation data bag to S, this moment is by obtaining this negotiation data bag and this packet being resolved, in the time of just can obtaining next the connection, IP address and port address that C1 will use are right; Then S again with C2 mutual after, return to a response of C1 negotiation data bag, this moment is by obtaining this response negotiation data bag and this packet being resolved, in the time of just can obtaining next the connection, IP address and port address that C2 will use are right, have so just got access to IP address and port address four-tuple that next connection both sides C1 and C2 will use.Because in actual networking, the address of C1 and C2 may be moved at any time, so IP address that C1 and C2 provided and port address are to being one or more pairs of, IP address that is obtained so and port address four-tuple are exactly the ordered series of numbers that comprises one or more pairs of addresses.
Step 12: set up prediction and connect polynary group of table.
Specifically, exactly after the operation of carrying out step 11, just can be from the IP address and port address four-tuple ordered series of numbers that are obtained, set up polynary group of table of prediction connection for two or three that choose correspondence.
If set up prediction and connect polynary group of table for two that choose correspondence, then all the IP addresses of an end or all the IP addresses or the port address of the port address and the other end are made up respectively, set up the prediction that comprises two tuples and connect polynary group of table.
For instance, if the IP of the C1 that obtains and port address are to being IP1 and port one, and IP2 and port 2; IP that corresponding C2 obtained and port address are to for IP3 and port 3, and IP4 and port 4.So just can in IP1 and port one, choose one, in the IP3 of correspondence and port 3, choose one, it be made up in twos form the list item that prediction connects polynary group of table; Or in IP2 and port 2, choose one, and in the IP4 of correspondence and port 4, choose one, it is made up in twos form the list item that prediction connects polynary group of table.The rest may be inferred, when the IP that obtains and port address are a plurality of to having, as long as choose corresponding IP or port address, just it can be made up and form the list item that prediction connects polynary group of table.
In the practical operation, because two that choose correspondence are made up the prediction of being set up and connect polynary group of table, its forecasting accuracy may be not high, so set up polynary group of table of prediction connection for three that also can choose wherein, be exactly specifically, all IP addresses of one end and port address pair are made up respectively with all IP addresses of the other end, set up the prediction that comprises tlv triple and connect polynary group of table; Or all IP addresses of an end and port address pair made up respectively with all of the port address of the other end, set up the prediction that comprises tlv triple and connect polynary group of table.
For instance, if the IP of the C1 that obtains and port address are to being IP1 and port one, and IP2 and port 2; IP that corresponding C2 obtained and port address are to for IP3 and port 3, and IP4 and port 4.So just can choose IP1 and port one and corresponding IP3 or port 3 and make up, form the list item that the prediction that comprises tlv triple connects polynary group of table; Also can choose IP2 and port 2 and corresponding IP4 or port 4 and make up, form the list item that the prediction that comprises tlv triple connects polynary group of table.The prediction of Jian Liing connects polynary group of table like this, owing to comprised three addresses that connect both sides, so accuracy for predicting is higher, has effectively improved the efficient of system's operation.
Step 13: shared the importing into of link information predicted in polynary group of table of connection.
Specifically, exactly after having set up polynary group of table of prediction connection, just the last time can be connected, the information of being extracted in just connecting is for the first time imported described prediction into and is connected in the polynary group of table, the information of being extracted in connecting for the first time described here can be distinctive information such as the account number, password of the communicating pair that connects for the first time, like this when being connected to next time, just can connect polynary group of table by searching prediction, the information of being extracted in obtaining to connect last time, the multi-link association that realizes information is with shared.
Step 14: when described next connection arrives, the described next packet that connects is carried out respective handling.
Specifically, when described next connection arrives, connect address four-tuple in the packet obtained according to the next one and search described prediction and connect polynary group of table, obtain the list item that is complementary with address that described next one is connected both sides and the information of extraction in described first connection.
The list item that is complementary described here, connect in the polynary group of table in the prediction that comprises two tuples, can obtain in the following way: in the four-tuple of the address of the packet that is obtained, as long as have corresponding two two of being connected a certain list item in the polynary group of table with described prediction to meet, can think that then this list item is exactly the list item that is complementary.
And connect in the polynary group of table in the prediction that comprises tlv triple, be to obtain in the following way: in the four-tuple of the address of the packet that is obtained, there are corresponding three three of being connected a certain list item in the polynary group of table with described prediction to meet, think that then this list item is exactly the list item that is complementary.
After having obtained the list item that is complementary, just the described entry updating that is complementary can be the next IP address of both sides' correspondence and the four-tuple of port address of connecting; And then carry out described next transmission and the processing that connects packet according to described four-tuple.
Described here the list item that is complementary is upgraded, be exactly address four-tuple specifically according to the packet that is obtained, indeterminate in the list item is revised as definite, make its IP address that is updated to the next both sides of connection correspondence and the four-tuple of port address, so just can connect packet to the next one according to this four-tuple sends accordingly and handles, simultaneously since the information of being extracted in connecting for the first time imported into to described prediction connect in the polynary group of table, connect being complementary during list item in the polynary group of table when searching prediction, just obtained the information of being extracted in the connection last time simultaneously, like this when next one connection packet is carried out respective handling, the association that just can realize being connected institute's information extraction with the last time has improved the performance of system with shared.
In addition, in execution in step 14, arrive when described next the connection, searching described prediction connects before the polynary group of table, can also at first search a four-tuple of setting up in advance and transmit, the list item that this four-tuple of setting up is in advance transmitted is the both sides' that possible connect IP address and port address four-tuple.In this four-tuple is transmitted, search,, then carry out described next transmission and the processing that connects packet, so just do not need to search again prediction and connected polynary group of table according to this four-tuple list item that is complementary if can find the four-tuple list item that is complementary; And if do not find the four-tuple list item that is complementary, then search described prediction again and connect polynary group of table, finish successor operation.
In addition, the above is predicted the list item that list item that connects polynary group of table and the four-tuple of setting up are in advance transmitted, can carry out overtime aging processing.That is to say that if in the time of setting, a certain list item does not upgrade, then this list item is worn out and delete.
By the enforcement of above technical scheme, just can when handling, the packet that multiconnection network is used realize respectively connecting sharing of institute's information extraction; Provide the next forwarding that connects packet to handle owing to set up polynary group of table of prediction connection simultaneously, so when the data of a plurality of connections being transmitted processing, with regard to not needing each bar is connected the process of all carrying out agreement identification, saved Internet resources, improved the efficient of system's operation.
Embodiment of the present invention also provides a kind of multi-link processing unit of network application, be illustrated in figure 2 as the structural representation of described device, comprise address resolution unit in the described device, predict to connect and set up unit, information transfer unit and multi-link processing unit, described address resolution unit is used for from the negotiation data bag of first multi-link connection, obtains IP address and port address four-tuple that the next both sides of connection will use.As above the method execution mode is described for the method for specifically obtaining.
Described prediction connection is set up the unit and is used for from IP address and the port address four-tuple obtained, sets up polynary group of table of prediction connection for two or three that choose correspondence.As above the method execution mode is described for the concrete method of setting up.
Described information transfer unit is used for importing the described information that first connects extraction into described prediction and connects in the polynary group of table.The information of being extracted in connecting for the first time described here can be distinctive information such as the account number, password of the communicating pair that connects for the first time, like this when being connected to next time, just can connect polynary group of table by searching prediction, the information of being extracted in obtaining to connect last time, the multi-link association that realizes information is with shared.
Described multi-link processing unit is used for when next connection arrives, and the described next packet that connects is handled.Be exactly specifically, when the next one connect to arrive, search described prediction and connect polynary group of table, obtain the list item that is complementary with address that described next one is connected both sides and the information of extraction in described first connection; The described entry updating that is complementary is the next IP address of both sides' correspondence and the four-tuple of port address of connecting, carries out described next transmission and the processing that connects packet according to described four-tuple.
In addition, can also comprise the burin-in process unit in described device, described burin-in process unit is used for described prediction connected to be set up the list item that the prediction of setting up the unit connects polynary group of table and carries out overtime burin-in process.Be exactly specifically, in the time of setting, if a certain list item does not upgrade, then with the aging deletion of this list item.
Above-described device can be arranged at have been set up on the end equipment that connects; Also can be arranged to independent functional entity, come the equipment that connects is monitored as the bypass equipment in the network.
For further describing embodiment of the present invention, now in conjunction with specific embodiments its technical scheme is described further, be illustrated in figure 3 as the structural representation that multiconnection network is used, among the figure: C1 represents first link, can be client; S represents second link, is server end; C2 represent multi-link in another link, can be another client, in some network applications service, also can be another server end.Connection reciprocal process between them is as described below:
A) at first, C1 sends to S and lands packet 1, can comprise distinctive logon informations such as the account number of C1 or password in this packet;
B) S sends logon information affirmation packet 2 to C1;
C) C1 and S connect, and middle ellipsis is represented between S and the C1 other information interactive process;
D) when C1 need connect with another link C2, because C1 does not also know the address of C2, may only know the account number of C2, so C1 sends negotiation data bag 3 to S, show and want to connect, in negotiation data bag 3, provide C1 open right simultaneously to IP and the port address of C2 with C2;
E) S transmits the negotiation data bag to C2, is packet 4;
F) after C2 receives packet 4, issue S and reply packet 5, the IP and the port address that wherein comprise the open C1 of giving of C2 are right;
G) S is transmitted to C1 with it, is another negotiation data bag 6;
H) at this moment, C1 sends and lands packet 7 to C2, and request connects;
I) C2 replys response data packet 8 and gives C1, and C1 has just set up with C2 and has been connected like this, and following ellipsis is represented between C1 and the C2 other information interactive process.
When the multi-link processing unit setting of network application of the present invention is between C1 and S, just can be to above packet 1,2,3,6,7 and 8 intercept and capture, and handle accordingly according to the difference of these type of data packet then.Wherein, to the handling process of negotiation data bag 3 and 6 as shown in Figure 4, comprise among the figure:
Step 31 judges at first whether this packet is the negotiation data bag; If the negotiation data bag, 3 and 6 in the just above packet then forwards step 32 to and handles, and handles otherwise forward step 37 to;
Step 32 parses from the negotiation data bag and next connects that to be about to the IP address and the port address that use right, just parses next C1 and C2 soon the IP address and the port address of use of being connected from 3 and 6;
Step 33 stores IP address and the port address of the C1 that obtains in the array 1 into;
Step 34, the IP address of the C2 that Jiang obtains and port address store in the array 2;
Step 35 judges whether negotiations process finishes, if finish, then forwards step 38 to and handles; Otherwise forward step 36 to;
Step 36 continues negotiations process;
Step 37 finishes this and sets up prediction process;
Step 38, the IP port in the array 1 pair is right with the IP port in the array 2, and the staggered in twos polynary group of table of prediction of setting up is exactly that each IP port in the array 1 pair and all IP addresses in the array 2 are combined to form the list item of predicting polynary group of table respectively specifically; Each IP port in the array 2 pair and all the IP addresses in the array 1 are combined to form the list item of polynary group of table of prediction respectively; The information of extracting in will connecting last time is simultaneously imported in polynary group of table of prediction of this foundation, exists as a public list item, and the information of extracting in connecting last time described here comprises distinctive logon informations such as the account number of C1 or password.
After carrying out above operation, the process of setting up prediction processing just is through with.We just can be associated together a plurality of connections that belong to a kind of network application thus, owing to carried out effective connection prediction, when second connection, when being the transmits data packets arrival between C1 and the C2, just can connect polynary group of table according to the prediction of setting up handles accordingly, and do not need each transmits data packets is all carried out the process that agreement is discerned, thereby improved running efficiency of system, also realized respectively connecting sharing of institute's information extraction simultaneously, the information of obtaining during first is connected is delivered in the follow-up connection.
Wherein, when the next one connect to arrive, the processing procedure of the transmits data packets that the next one is connected comprised among the figure as shown in Figure 5:
Step 21 at first receives the next transmits data packets that connects, as the packet among Fig. 37 or 8 from network;
Step 22 is carried out the parsing in IP packet header and transport layer packet header to the transmits data packets that receives, and obtains the real ip address and the port address that connect both sides;
Step 23, at first can in transmitting, the four-tuple of setting up in advance search the list item that the notebook data bag is complementary, here to transmit can be that mode with Hash table exists to the four-tuple of setting up in advance, and contents in table is the both sides' that possible connect IP address and port address four-tuple;
Step 24 judges whether to exist the list item that is complementary, if there is the four-tuple list item that is complementary, then forwards step 212 to and handles, and handles otherwise forward step 25 to;
Step 25, connect in the polynary group of table in the prediction of being set up and to search the list item that the notebook data bag is complementary, as long as three of having list item and four-tuple herein when searching meet and are considered as identically, it also can be that mode with Hash table exists that the prediction of foundation described here connects polynary group of table;
Step 26 judges whether to exist the list item that is complementary, if there is the list item that is complementary, then forwards step 27 to and handles, and handles otherwise forward step 28 to;
Step 27 is converted into four-tuple with the tlv triple list item, is about to indeterminate and is revised as and determines, specifically can prediction connects the respective table entry deletion of polynary group of table, and will add to behind this entry updating during the four-tuple of setting up in advance transmits;
Step 28 is carried out the agreement identifying to this packet;
Step 29 judges whether and can discern, if can identify agreement, then forwards step 210 to and handles, and handles otherwise forward step 211 to;
Step 210, newly-built four-tuple list item is during newly-built four-tuple entry updating transmitted to the four-tuple of setting up in advance;
Step 211 abandons the notebook data bag, does not handle;
Step 212, the list item that the four-tuple of setting up is in advance transmitted carries out the aging update processing, promptly upgrades the life period of corresponding list item;
Step 213, the list item of transmitting according to corresponding four-tuple carries out the transmission and the processing of packet, is about to packet and imports pairing application layer parsing inlet into, and carry out application corresponding layer protocol dissection process.
From above step as can be seen,, can connect polynary group of table according to the prediction of setting up earlier and handle accordingly, and not need each transmits data packets is all carried out the process that agreement is discerned, improve running efficiency of system when second connection comes then.
In sum, embodiment of the present invention connects polynary group of table by setting up prediction in advance, can be when searching polynary group of table of prediction connection, obtained the information of extraction in first connection simultaneously, like this when the packet that the next one is connected is handled, just a plurality of connections that belong to a kind of network application can be associated together, realize respectively connecting sharing of institute's information extraction; Provide the next forwarding that connects packet to handle owing to set up polynary group of table of prediction connection simultaneously, so when the data of a plurality of connections being transmitted processing, with regard to not needing each bar is connected the process of all carrying out agreement identification, saved Internet resources, improved the efficient of system's operation.
The above; only be the preferable embodiment of the present invention; but protection scope of the present invention is not limited thereto; anyly be familiar with those skilled in the art in the technical scope that the embodiment of the invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.