Summary of the invention
The object of this invention is to provide a kind of media data transfer approach that considers heterogeneous terminals and heterogeneous network environment, the tree type layered network architecture based on service coverage network and P2P overlay network.
For reaching above object, the present invention takes following technical scheme to be achieved:
A kind of application layer group broadcasting method of supporting heterogeneous terminals and heterogeneous network environment, it is characterized in that, build the tree type layered network architecture based on service coverage network and P2P overlay network, this network architecture is divided into trunk Ceng He branch layer, the tree type service coverage network of trunk layer for building, the tree type P2P overlay network of branch's layer for building, media data is transmitted to branch's node layer by trunk node layer; Trunk layer consists of DTU (data retransmission unit) node and service centre's node, and trunk layer is divided into two-layer from function, and ground floor is responsible for multichannel data retransmission, and realizes the transfer of data between different I SP by operating in the DTU node of two ISP; The second layer is responsible for monophonic data retransmission, except DTU node, every layer of service centre's node that all promising this layer of DTU serves, the DTU node of service centre's this layer of node administration of trunk layer ground floor, and the request of DTU node or user node is redirected to the second layer service centre with this node with identical ISP; The service centre of the trunk layer second layer is responsible for that this layer of DTU multicast tree built and the building of branch's layer tree type P2P multicast tree; Branch's layer consists of user node, according to network type, the network bandwidth, online hours and the resolution of user node, build P2P tree type framework, user node receives media data from the father node of P2P tree type framework, be stored in the data buffer zone of user node, the decoder module of invoke user node is to decoding data, and playback demonstration, the data dispatch module searches forward node list of user node simultaneously, the child node by the data retransmission of data buffer zone to P2P tree type framework.
In such scheme, the described request by DTU node or user node is redirected to that to have the concrete steps of second layer service centre of identical ISP as follows with this node:
First, provide concept and the definition of in algorithm steps, using, the S of ground floor service centre is safeguarding the DTU information list D of this layer
f[1-n], the list S of second layer service centre
n[1-n] with and corresponding root DTU list D
sr[1-n] and direct broadcast band list C < N, Source, T[n
i] >, in channel list, N represents channel n
1, n
2... n
i, Source represents source node information, T[n
i] represent to add channel n
idTU node listing;
Step1:DTU node or user node Node
iconnect the S of ground floor service centre, request adds direct broadcast band n
i, the S of service centre is according to this node IP address judgement Node
iplace ISP, and search current channel list C < N, Source, T[n
i] N=n in >
idTU list T[n
i], find and Node
iin the second layer root DTU of same ISP node D
sr[k], carries out Step4, if can not find, carries out Step2;
Step2: the S of service centre is by the root DTU list D of the second layer
srin [1-n] with Node
ilist D in identical ISP
sr[i-j] (1 <=i <=j <=n) information sends to Node
i, Node
itest and D
srthe RTT time of all DTU nodes in [i-j], obtain with its RTT and postpone minimum DTU node D
sr[k] (i <=k <=j);
Step3: the S of service centre adds D
sr[k] is to T[n
i], if D
sr[k] and T[n
i] in root node not at same ISP, need to be from D
fin [1-n], find out a transit node D
f[f] (1 <=f <=n) makes it to become T[n
i] child nodes of root node, find out and D simultaneously
sr[k] same ISP and postpone the DTU node D of minimum ground floor
f[g] (1 <=g <=n) is as D
fthe child nodes of [f] and D
srthe father node of [k];
Step4: the S of service centre is by the list S of second layer service centre
nin [1-n] with D
srthe S of service centre that [k] is corresponding
nthe information of [k] sends to Node
i, Node
ireconnect the S of second layer service centre
n[k];
It is as follows that the service centre of the described trunk layer second layer is responsible for the concrete steps that this layer of DTU multicast tree build:
First, provide concept and the definition of in algorithm steps, using, second layer service centre safeguards DTU node listing DTU < id, d_degree, u_degree, level >, wherein id is the unique identifier of DTU node, d_degree can connect the quantity of DTU node for this node, and u_degree can connect the quantity of user node for this node, and level is the number of plies at this node place;
DTU multicast tree to build concrete steps as follows:
Step1:DTU node D
iconnect the S of ground floor service centre, request adds direct broadcast band n
i, S is redirected algorithm by its corresponding S of second layer service centre according to node request
n[k] information sends to D
i;
Step2:DTU node D
iconnect the S of second layer service centre
n[k], the S of service centre
n[k] judges this node network type of living in, and juxtaposition current search layer N is 1;
Step3: if D
iin outer net, the S of service centre
n[k] adopts BFS mode to travel through N layer, searches first DTU node D that current access DTU node number is less than d_degree
k, by D
ias D
kchild node, if D
iin Intranet, the S of service centre
n[k] adopts BFS mode to travel through N layer, searches first DTU node D that current access DTU node number is less than d_degree and is positioned at outer net
k, by D
ias D
kchild node, if found, exit, otherwise N=N+1, continue to carry out Step3;
The building of the described layer tree type P2P of branch multicast tree comprises to be supported the user node based on relative importance value of intranet and extranet to add and exits algorithm;
1) user node adds algorithm steps:
The user node list USER[id that second layer service centre safeguards, ip, resolution, degree, father_id, father_ip], wherein, id is the unique identification of user node, ip is the IP address of user node, and resolution represents the resolution of user node, and degree represents that user node can be accessed by node number, father_id represents the id of the father node of user node, and father_ip is the IP address of user node father node;
Concrete steps are as follows:
Step1: user node connects the S of ground floor service centre, request adds direct broadcast band n
i, S is redirected algorithm by its corresponding S of second layer service centre according to node request
n[k] information sends to U
i;
Step2: user node U
iconnect the S of second layer service centre
n[k], the S of service centre
n[k] judges this node network type of living in, and juxtaposition current search layer N is 1, and both candidate nodes set set (n) is initialized as sky, and candidate parent node set set (fn) is initialized as sky;
Step3: if this node in outer net, the S of service centre
n[i] adopts BFS mode to travel through N layer, by this layer with ask to add user node and the DTU node that ingress has equal resolution and add both candidate nodes set set (n), if this node in Intranet, the S of service centre
n[i] adopts BFS mode to travel through N layer, by this layer with ask to add ingress and there is equal resolution and the user node in outer net and DTU node and add both candidate nodes set set (n);
Step4: traversal set (n), using the node that wherein access user number of nodes is less than degree as candidate parent node set (fn), if | set (fn) |=0, put N=N+1, jump to Step3, if | set (fn) | > 0, carries out Step5;
Step5: the relative importance value π that calculates each node in set (fn)
i, the node of selection relative importance value maximum, using this node as newly added node U
ifather node, if the relative importance value of node is identical in set (fn), node of random choose is as the father node of new node, wherein node U
irelative importance value π
icomputational methods as follows:
In formula:
T
i---the online hours of node i;
C
i---the network bandwidth of node i;
B---the shared bandwidth of a road multi-medium data;
K
i---the child node number of node i;
T
j---the online hours of the child node j of node i;
C
j---the network bandwidth of the downstream site j of node i;
K
j---the child node number of node j;
2) to exit algorithm steps as follows for user node:
Step1: user node U
igive the S of second layer service centre of its current connection
n[i] sends an exit message;
Step2: the S of service centre
n[i] receives after message, according to U
iid find its father node f
n, give f
nsend this node exit message;
Step3: the S of service centre
n[i] calculates U
icurrent out-degree D (n) and its father node f
nresidue out-degree D (f
n), if D (n)≤D (f
n), by U
idownstream site receive node f
nunder, and jump to Step5, otherwise forward Step4 to;
Step4: from exiting node U
ichild node set set (C
n) middle m the node hildren (i) that selects relative importance value maximum, make
then by node f
nand children (i) is as residue node set (C
nthe candidate parent node of)-children (i), residue node downstream site structure is constant, adopts user node to add algorithm to join in system, then forwards Step5 to;
Step5: exit node U
idownstream site all join after system, node U
ilog off.
Compared with prior art, advantage of the present invention is: adopt the tree type layered network architecture based on service coverage network and P2P overlay network, considered the heterogeneous network environment of different I SP network and intranet and extranet, and the heterogeneous terminals factor of the network type of user node, the network bandwidth, online hours and resolution, realized support heterogeneous network and heterogeneous terminals media data efficiently, transmit fast.
Embodiment
For a more clear understanding of the present invention, below in conjunction with accompanying drawing, the present invention is described in further detail.
1, the tree type layered network architecture based on service coverage network and P2P overlay network
Tree type layered network architecture topological diagram based on service coverage network and P2P overlay network in the present invention as shown in Figure 1.
As shown in Figure 1, the node relating in tree type layered network architecture based on service coverage network and P2P overlay network is divided into four classes: source node, service centre's node, DTU node and user node, wherein source node is the source Nodes of multi-medium data, service centre's node is in charge of DTU node and user node, build and safeguard overlay topology, DTU node is responsible for repeating multimedia data, and user node receives live multi-medium data, and shows in this locality.
As shown in Figure 1, tree type layered network architecture based on service coverage network and P2P overlay network is divided into trunk Ceng He branch layer, the tree type service coverage network of trunk layer for building, the tree type P2P overlay network of branch's layer for building, media data is transmitted to branch's node layer by trunk node layer;
Trunk layer is divided into again two-layer function, ground floor is responsible for multichannel data retransmission, and realize two transfer of data between different I SP by may operate in the DTU node of two ISP, the second layer is responsible for monophonic data retransmission, except DTU node, every layer of service centre's node that all promising this layer of DTU serves, the DTU node of service centre's this layer of node administration of ground floor, and the request of DTU node or user node is redirected to the second layer service centre with this node with identical ISP; The service centre of the second layer is responsible for that this layer of DTU multicast tree built and the building of branch's layer tree type P2P overlay network.
The Shu Xing branch layer of branch's layer for building, by user node, formed, and build P2P tree type framework according to network type, the network bandwidth, online hours and the resolution of user node, user node receives media data from the father node of P2P tree type framework, be stored in the data buffer zone of user node, the decoder module of invoke user node is to decoding data, and playback shows, the data dispatch module searches forward node list of user node simultaneously, the child node by the data retransmission of data buffer zone to P2P tree type framework.
Trunk layer DTU node deployment figure is as accompanying drawing 2, and ground floor DTU node is divided according to ISP, wherein has DTU node to operate between different I SP simultaneously, is responsible for the data retransmission between two DTU nodes of different I SP.The second layer consists of DTU multicast tree, and the root DTU of multicast tree is connected with the DTU node of ground floor according to the difference of ISP.The service centre of ground floor has the function of differentiating node place ISP, and the service centre of the second layer has the function that decision node type is outer net or Intranet, differentiates thus the network environment of node, realizes the media data transfer approach of supporting heterogeneous network.
2, the request of DTU node or user node is redirected to the second layer service centre algorithm with this node with identical ISP
Ground floor service centre is safeguarding the DTU information list D of this layer
f[1-n], the list S of second layer service centre
n[1-n] with and corresponding root DTU list D
sr[1-n] and direct broadcast band list C < N, Source, T[n
i] >, in channel list, N represents channel n
1, n
2... n
i, Source represents source node information, T[n
i] represent to add channel n
idTU node listing.
The Maintenance Point list Node < id of second layer service centre, d_degree, u_degree, level >, wherein id is the unique identifier of DTU node and user node, and d_degree, for this node can connect the quantity of DTU node, is 0 concerning user node, u_degree can connect the quantity of user node for this node, and level is the number of plies at this node place.
The service centre of ground floor has the function of the ISP that differentiates node place; The type that the service centre of the second layer has decision node is the function of outer net or Intranet.
1) method of discrimination of DTU node or user node ISP of living in
According to the IP address lookup IP address database of node, can judge place ISP.When having new node request to arrive, ground floor service centre obtains after the real IP address of node, by string searching and with the ISP of the method for calculating subnet mask under IP address database is found this IP address.Then the service centre of ground floor returns to node by the IP of service centre address and the port of the second layer with the identical ISP of this node, and node just can go to connect the service centre of the suitable second layer like this.
When using the computer access Gmail mailbox of education network IP address of 202.117.10.76, the shown IP address of mailbox is 117.32.153.161.If the computer deploy Yi Ge service centre that is 202.117.10.75 in an IP address of the education network that coexists, then goes to connect this service centre with this computer, the IP address that this service centre gets so should be 202.117.10.76.By the socket of the access node of coming, can obtain the IP address of node, the IP address of Gmail mailbox is globally unique IP address, and accessing its accessed IP address must be node real IP address information.And this IP address of 202.117.10.76 should be distributed by NAT mode.So the service centre of ground floor must be deployed in backbone network, it could obtain the real IP of node address like this, just can pass through the correct decision node of IP address base place ISP.
2) request of DTU node or user node is redirected to that to have the second layer service centre algorithm concrete steps of identical ISP as follows with this node:
As node Node
irequest adds direct broadcast band n
itime, first connecting ground floor service centre, ground floor service centre is according to Node
iiP address judgement Node
ithe ISP at place, according to channel n
iwith ISP at current channel list C < N, Source, T[n
i] search in > and whether have and Node
iin the second layer root DTU of same ISP node, if having, ground floor service centre is by the list S of second layer service centre
nin [1-n] with D
srthe S of service centre that [k] is corresponding
nthe information of [k] sends to Node
i, Node
ireconnect the S of second layer service centre
n[k].
If do not find DTU node in current channel list, ground floor service centre is by the root DTU list D of the second layer
srin [1-n] with Node
ilist D in identical ISP
sr[i-j] (1 <=i <=j <=n) information sends to Node
i, Node
itoward D
srin [i-j], all DTU nodes send PING bag, from the ACK bag of receiving, obtain RTT time delay, select the DTU node D of RTT time delay minimum
sr[k] (i <=k <=j);
Ground floor service centre adds D
sr[k] is to T[n
i], if D
sr[k] and T[n
i] in root node not at same ISP, need to be from D
fin [1-n], find out a transit node D
f[f] (1 <=f <=n) makes it to become T[n] child nodes of root node, find out and D simultaneously
srthe DTU node D of the ground floor of [k] same ISP and RTT time delay minimum
f[g] (1 <=g <=n) is as D
fthe child nodes of [f] and D
srthe father node of [k];
The S of ground floor service centre is by the list S of second layer service centre
nin [1-n] with D
srthe S of service centre that [k] is corresponding
nthe information of [k] sends to Node
i, Node
ireconnect the S of second layer service centre
n[k];
3, DTU multicast tree builds algorithm
1) method of the network type of decision node
As shown in Figure 3, IP address is the inner net computer of 192.168.1.20, use 2000 ports to remove to access the server of outer net, when by NAT gateway, it is different from himself IP address that its IP address and port are converted into NAT gateway address 202.117.10.76:7678 automatically.So differentiate the method for node network type of living in, be: node is when connecting the service centre of outer net deployment, the local ip address that oneself is obtained is packaged into message and sends to service centre, IP address the message of the IP address that service centre relatively obtains from socket and the transmission of node, identical is outer net node, otherwise is Intranet node.
2) DTU multicast tree builds
The building method of multicast tree has two kinds: breadth First (BFS-Breadth First Search) and depth-first (DFS-Depth First Search) method.As shown in accompanying drawing 4 (1), in the multicast tree building according to breadth first method, D6 is in ground floor, shown in accompanying drawing 4 (2), in the multicast tree building according to depth first method, D6 node is in the 3rd layer, suppose that transmitting procedure postpones all identical, in breadth First multicast tree, the transfer of data number of plies is few so, and D6 transmission delay is also just low than the D6 in depth-first multicast tree.Therefore the present invention adopts breadth first method from left to right to build second layer DTU multicast tree.
When building DTU tree in heterogeneous network environment, be faced with as the problem of Intranet DTU node service and the problem of utilizing Intranet DTU node bandwidth to increase network utilization.Because penetrating between two Intranet nodes is difficult to realize, therefore the present invention is based on breadth first method, the mixed multicast tree building method of taking of intranet and extranet has been proposed.
The primitive rule that multicast tree is built is as follows:
The father node of a.DTU node can only be DTU node, and it is that d_degree connects DTU node that each DTU node distributes out-degree quota, and out-degree quota is that u_degree connects user node;
B.DTU tree is breadth First tree, and when the DTU out-degree quota of high one deck does not use, the DTU node of low one deck can not be as the alternative father node that newly adds live node;
C. in the DTU of Intranet node, can only be using the DTU node of outer net as father node, its child nodes can only be also outer net node;
The concrete steps that DTU multicast tree is built are as follows:
DTU node D
iconnect the S of ground floor service centre, request adds direct broadcast band n
i, S according to node locating algorithm by its corresponding S of second layer service centre
n[k] information sends to D
i; DTU node D
iconnect the S of second layer service centre
n[k], the S of service centre
n[k] is according to D
iiP address judge this node D
inetwork type of living in, juxtaposition current search layer N is 1; If D
iin outer net, the S of service centre
n[k] adopts BFS mode from left to right to travel through N layer, searches first DTU node D that current access DTU node number is less than d_degree
k, by D
ias D
kchild node; If D
iin Intranet, the S of service centre
n[k] same BFS mode from left to right that adopts travels through N layer, searches first DTU node D that current access DTU node number is less than d_degree and is positioned at outer net
k, by D
ias D
kchild node; If found, exit, otherwise N=N+1 continues traversal and searches;
The DTU multicast tree building according to the mixed method of taking of intranet and extranet as shown in Figure 5.
3, branch's layer tree type P2P multicast tree builds
The building of the layer tree type P2P of branch multicast tree comprises to be supported the user node based on relative importance value of intranet and extranet to add and exits algorithm.
1) user node adds algorithm
After DTU multicast tree has built, in the layer tree type P2P of branch multicast tree, add user node will consider the accessing terminal to network type of user node, the network bandwidth, online hours and resolution isomerism.
Wherein terminal resolution has larger impact to multicast bandwidth: on market, each Terminal Type resolution has tens kinds, the display effect that sends to terminal through the data of the different resolution in source node collection, sends the demonstration that a kind of size of data can be suitable for a segment resolution.The data that for example send 480*320 are that 320*240 can reach satisfied effect on the terminal of 640*480 in resolution.Use 320*480,800*600, these three kinds of big or small data of 1024*768 substantially can meet the demonstration demand of current all terminals.Accompanying drawing 6 has shown that the resolution of different receiving terminals is respectively 1024*768,800*600 and 480*320, receive respectively 3 layers, 2 layers and level 1 data volume, from accompanying drawing 6, can find out, change the position of two nodes, allow total bandwidth drop to 37.8 from 41.8, as can be seen here, node is preferentially received have below equal resolution node and can be reduced bandwidth consumption.
In the present invention, support the method for resolution isomery to need the newly-built first search array that comprises N node of trunk layer second layer service centre, be used for recording the information that has added ingress, nodal information form is:
USER[id,ip,resolution,degree,father_id,father_ip]
Id: the unique identification of node;
Ip: the IP address of node;
Resolution: the resolution of node;
Degree: the out-degree of node;
Father_id: the title of the father node of node, as the unique identification of this node;
Father_ip: the IP address of node father node;
Support the user based on relative importance value of intranet and extranet to add algorithm to be implemented as follows:
User node U
iadd fashionablely, first connect the S of ground floor service centre, request adds direct broadcast band n
i, S according to node locating algorithm by its corresponding S of second layer service centre
n[k] information sends to U
i; U
iconnect the S of second layer service centre
n[k], S
n[k] is according to U
iiP address judge this node network type of living in, juxtaposition current search layer N is 1, both candidate nodes set set (n) is initialized as sky, candidate parent node set set (fn) is also initialized as sky;
If user node U
iin outer net, the S of service centre
n[k] adopts BFS method layering traversal multicast tree N layer from left to right, and node identical with the terminal resolution that adds user node in resolution current layer is added to both candidate nodes set set (n); If user node U
iin Intranet, the S of service centre
n[k] adopts BFS method layering traversal multicast tree N layer from left to right, and node identical with the terminal resolution that adds user node in resolution current layer and in outer net is added to both candidate nodes set set (n);
The node that choose both candidate nodes in set set (n) in, access user number of nodes is less than degree is as candidate parent node set set (fn), if | set (fn) |=0, put N=N+1, continue the lower one deck of traversal, if | set (fn) | > 0, calculate the relative importance value of all candidate parent nodes, select the node of relative importance value maximum as father node, if there is the relative importance value of a plurality of candidate parent nodes identical, choose at random a node as father node.Accompanying drawing 7 has provided BFS model.
Wherein, the relative importance value π of node i
icomputational methods as follows:
Formula 2
In formula:
T
i---the online hours of node i;
C
i---the network bandwidth of node i;
B---the shared bandwidth of a road multi-medium data;
K
i---the child node number of node i;
T
j---the online hours of the child node j of node i;
C
j---the network bandwidth of the downstream site j of node i;
K
j---the child node number of node j;
2) user node exits algorithm
When user node exits P2P multicast tree, need to notify the interdependent nodes such as its father node, child node and service centre, complete the Partial Reconstruction of multicast tree.According to exiting node residing position in multicast tree, need to investigate two kinds of situations: exit node U
ifor leaf node, exit node U
ifor forward node.
A. exit node U
ifor leaf node, work as U
iexit Shi Gei service centre and send exit message, after the exit message of user node is received by service centre, according to the id that exits node, find its father node, send the message that this node exits then to its father node, after its father node is received this message, from forwarding list, delete this node, stop the data retransmission to this node;
B. exit node U
ifor forward node, as node U
iwhile exiting, because it has downstream site, so this node exits, system is had to locality impact.If its downstream site all adds algorithm to add according to user node again, this process need takies the more time, and it is by node U that the present invention adopts strategy
ifather node and larger m the children (i) of relative importance value, make
then by node f
nand children (i) is as the candidate parent node of residue node, remains node downstream site structure constant, adopts user node to add algorithm to join in system;
Specifically exit step:
Exit node U
igive the S of second layer service centre of its current connection
n[i] sends an exit message; As the S of service centre
n[i] receives after node exit message, according to U
iid find its father node f
n, give f
nsend this node exit message; Then the S of service centre
n[i] calculates U
icurrent out-degree D (n) and its father node f
nresidue out-degree D (f
n), if D (n)≤D (f
n), by U
idownstream site receive node f
nunder, node U
ilog off; Otherwise, from exiting node U
ichild node set set (C
n) middle m the node children (i) that selects relative importance value maximum, make
then by node f
nand children (i) is as residue node set (C
nthe candidate parent node of)-children (i), residue node downstream site structure is constant, adopts user node to add algorithm to join in system, will exit node U
idownstream site all join system, node U
ilog off.
Accompanying drawing 8 has been illustrated said process, suppose that all node online hours are identical, node c exits, first calculating a remaining degree is 2, and the son node number of c is 3, can not all receive under a node, then from the child node of c, choose m node until meet such condition: the redundancy of this m node and the redundancy sum of a can meet adding of residue node.Here choose node f and just can satisfy condition, then allow node a and node f as the candidate parent node of residue node g and h, according to user node, add algorithm to join in multicast tree, because the relative importance value of f is higher than a, all node g and node h receive under node f.