Embodiment
Below in conjunction with the drawings and specific embodiments, a kind ofly set up the method for route and the embodiment of device is described in further detail to of the present invention.
The invention provides a kind of method of setting up route, for set up the process of route at wireless self-networking, as shown in Figure 1, the method comprises:
Step 101, present node receives the route requests RREQ message that is mail to destination node by source node;
Step 102, present node obtain described RREQ message from source node transfer to present node through the network quality in the first path;
Step 103, present node determines when the network quality in described the first path is better than existing present node to the network quality of the reverse route of described source node, utilizes described in the rightabout routing update in described the first path oppositely route; Wherein, present node set up first to the reverse route of described source node, be to utilize the described RREQ message institute that receives first through path foundation.
When the present invention program sets up reverse route between present node and source node, add the judgement to path network quality, while transferring to present node by calculating the RREQ message of each reception from source node through the network quality in path, the path that selection has a better network quality upgrades to existing reverse route that (described existing reverse route is that present node is before this receives described RREQ message, reverse route to source node that set up first or recent renewal), thereby can there is for the connection setup between source node and destination node the reverse route of better network quality, obtain higher communication speed and network stabilization preferably.
Preferably, the described method of setting up route, further comprise: if present node is destination node, and is established to first the reverse route of described source node or is updated to the reverse route of described source node, return to route response RREP message according to described reverse route that set up first or that upgrade; If present node is non-destination node, and is established to first the reverse route of described source node or is updated to the reverse route of described source node, broadcast described RREQ message.
In said method, only between present node and source node, set up in the process of reverse route and added the mechanism that judges path network quality, and the process of setting up forward route between present node and destination node is not limited, can use the mechanism of setting up forward route in prior art, or, in the process of setting up forward route, also introduce the judgement to path network quality.In order also to choose the path that network quality is good from various possible paths in the time setting up forward route, preferred, the inventive method can also comprise:
Present node receives the RREP message that is mail to described source node by described destination node; Present node obtain described RREP message from destination node transfer to present node through the network quality in the second path; Present node determines when the network quality in described the second path is better than existing present node to the network quality of the forward route of described destination node, utilizes forward route described in the rightabout routing update in described the second path; Wherein, present node set up first to the forward route of described destination node, be to utilize the described RREP message institute that receives first through path foundation.
In said method, described existing forward route be present node before this receives described RREP message, set up first or the present node of recent renewal to the forward route of destination node.
The network quality in the whole path that message experiences in transmittance process be by path between all nodes minimum network quality determine, preferably, RREQ message from source node transfer to present node be respective path through the network quality in path, the poorest network quality in the network quality between any two adjacent nodes; RREP message from destination node send transfer to present node be respective path through the network quality in path, the poorest network quality in the network quality between any two adjacent nodes.
In Ad Hoc network, only has ability direct communication between neighbor node, so RREQ message is by (the node of reverse last node for arriving before described RREQ message arrival present node of the reverse last node in transmission path, with present node be neighborhood) while sending to present node, present node can only directly calculate the network quality between self and reverse last node.Preferably, second node determination that receives RREQ message after source node is when as non-destination node, in broadcasted RREQ message, comprise the network quality between self and source node, such the 3rd node that gets described RREQ message, just can calculate after self and described second network quality receiving between RREQ information node, determine described RREQ message when source node transfers to self the poorest network quality through path (when the described RREQ message of this poorest network quality transfers to self from source node through the network quality in path), and this poorest network quality is recorded in described RREQ message and is broadcasted away, the like, when the 4th and the node that later receives described RREQ message just can obtain described RREQ message and transfer to reverse last node from source node from the current RREQ message receiving through the network quality Q_W1 in path.
Preferably, present node obtain described RREQ message from source node transfer to present node through the network quality in the first path, be specially: present node obtains the network quality Q_N1 between reverse last node the node of described reverse last node for arriving before described RREQ message arrival present node; When present node obtains described RREQ message and transfers to reverse last node from source node through the network quality Q_W1 in path; Present node determines that the network quality in described the first path is one poor in described network quality Q_N1 and network quality Q_W1.
Similar with said method, preferred, present node specifically from the RREP message receiving, when obtaining described RREP message and transferring to the last node of forward from destination node through the network quality Q_W2 in path.
Preferably, present node obtain described RREP message from destination node transfer to present node through the network quality in the second path, be specially: present node obtains the network quality Q_N2 between the last node of forward the node of the last node of described forward for arriving before described RREP message arrival present node; When present node obtains described RREP message and transfers to the last node of forward from destination node through the network quality Q_W2 in path; Present node determines that the network quality in described the second path is one poor in described network quality Q_N2 and network quality Q_W2.
The network quality that relates to message path in said process is calculated, and in radio communication, the network quality of message path needs directly communication speed and the stability of reflection network.Because the signal to noise ratio of channel in radio communication has conclusive impact to communication speed, and the finiteness of channel can make the communication between multinode in certain limit occur interfering with each other, thereby affect the stable of communication speed and network, preferably, the jumping figure being comprised take signal to noise ratio and path, as parameter, can adopt respectively following two kinds of formula to calculate the network quality of message path in radio communication:
Q=SNR/Hop (1)
Q=SNR-Hop*Const (2)
Wherein, Q is network quality, and Q value is larger, and network quality is better, and SNR is signal to noise ratio, the jumping figure that Hop comprises for path, and Const is constant, can determine according to actual needs the occurrence of Const.Can be as the case may be in practical application, select the one in above two kinds of computing formula, for example: when the network quality Q that uses formula 1 to calculate more can reflect path communication speed and stability, select the account form of formula 1 as network quality Q; Or, after determining suitable Const value, while using formula 2 can calculate the network quality Q that more can reflect path communication speed and stability, select the account form of formula 2 as network quality Q.
In AODV agreement, Hello message is the message of mutually broadcasting between node, and only have neighbor node just can receive Hello message, and the neighbor node that reverse last node or the last node of forward are present node, in order to obtain the signal to noise ratio between present node and reverse last node or the last node of forward, preferably, present node, in the time determining the Hello message of receiving neighbor node broadcast, obtains signal to noise ratio between present node and neighbor node and uses when setting up route.
Preferably, present node calculates the network quality Q_N1 between reverse last node, specifically comprise: utilize the signal to noise ratio between described present node and reverse last node, described RREQ message from source node transfer to present node be parameter through the jumping figure in path, and adopt above-mentioned formula (1) or formula (2), calculate the network quality between present node and reverse last node;
Present node calculates the network quality Q_N2 between the last node of forward, specifically comprise: utilize the signal to noise ratio between the last node of described present node and forward, described RREP message from destination node transfer to present node be parameter through the jumping figure in path, and adopt above-mentioned formula (1) or formula (2), calculate the network quality between present node and the last node of forward.
The invention provides a kind of embodiment of the method for setting up route, the process that relates to AODV agreement selecting paths in the time setting up reverse route, forward route, mainly comprises the processing to following three kinds of message: route requests (RREQ) message, routing broadcast (Hello) message and route response (RREP) message.
Between node in neighborhood or non-neighborhood in the embodiment of the present invention, all realize the foundation of forward and reverse route by RREQ message and RREP message.Below the current node that receives all types of message is called to present node.
1, set up reverse route
Source node broadcast RREQ message (wherein having carried the information such as IP address of source node and destination node), due to the node ability direct communication of only having between neighborhood, so the neighbor node of source node is being received after RREQ message and it can broadcasted away again, until arrive destination node.As shown in Figure 2, in the embodiment of the present invention present node by receiving RREQ message, to be established to the process of reverse route of source node as follows:
Step 201, present node receives after the RREQ message of reverse last node (node of described reverse last node for arriving before described RREQ message arrival present node) broadcast, first judge whether this RREQ message is that self initiates, if, end process, otherwise, continue to process.
When specific implementation, present node can also judge that whether the reverse last node that sends this RREQ message is the node in self blacklist, if so, and end process, otherwise, continue to process.
Step 202, present node judges whether to receive first the RREQ message that is mail to described destination node by described source node, if so, performs step 203, otherwise, execution step 204.
Source node is only broadcasted the RREQ message of corresponding same destination node within a certain period of time, if when therefore present node is received the RREQ message from same source node within a certain period of time again, determine it is again to receive the RREQ message that is mail to described destination node by described source node, but not receive first.
Step 203, present node is definite to be received while mailing to the RREQ message of described destination node by described source node first, when calculating this RREQ message and transferring to present node from source node first through the network quality Q1_first of path Route1_first, by source node IP address corresponding this RREQ message, first store in reverse network quality record sheet Table_Q1 through the network quality Q1_first of path Route1_first, then described in utilizing, institute sets up present node to the reverse route of source node (the reverse route of foundation first) through the reverse path of path Route1_first first, and this reverse route is stored in reverse routing table Table_Route1, execution step 207.
Step 204, present node is definite to be received while mailing to the RREQ message of described destination node by described source node again, when calculating this RREQ message and transferring to present node from source node, institute, through the network quality Q1_now of path Route1_now, performs step 205 at present.
Step 205, present node reads the reverse route network quality Q 1 of the same source node IP of previously stored correspondence address from reverse network quality record sheet Table_Q1, then judge this RREQ message at present whether be better than previously stored reverse route network quality Q 1 through the network quality Q1_now of path Route1_now, if, perform step 206, otherwise, abandon current the network quality Q1_now through path Route1_now, and end process.
Step 206, the reverse route network quality Q 1 of corresponding same source node IP address in reverse network quality record sheet Table_Q1 is updated to current the network quality Q1_now through path Route1_now, and by present node in reverse routing table Table_Route1 to the reverse routing update of source node for this RREQ message at present through the reverse path of path Route1_now.
Step 207, present node judges whether self is the destination node of this RREQ message, if so, performs step 208, otherwise execution step 209.
Step 208, present node determines from as destination node, and when setting up first or just having upgraded the reverse route between present node and source node, sends RREP message according to the reverse route of setting up first or upgrade to source node.
Step 209, present node is determined certainly as non-destination node, and when setting up first or just having upgraded the reverse route between present node and source node, when increasing this message transfer to present node from source node in described RREQ message at present through the network quality Q1_now of path Route1_now, then this RREQ message is broadcasted away again.
In said process, can utilize the signal to noise ratio between present node and reverse last node, described RREQ message from source node send transfer to present node be parameter through the jumping figure in path, when calculating RREQ message and transferring to present node from source node through the network quality in path.
In the embodiment of the present invention, utilize and receive routing broadcast Hello message, obtain the signal to noise ratio between present node and reverse last node:
Certain neighbor node is periodically broadcasted Hello message, present node is determined when the message of receiving is Hello message, obtain signal to noise ratio between present node and neighbor node (in Ad Hoc network, node all can calculate signal to noise ratio and is kept in the preset field in internal memory obtaining after packet by physical layer data), use when setting up route between present node and neighbor node.As shown in Figure 3, obtaining the process of signal to noise ratio for example can be as follows:
Step 301, the WIFI of present node drives and receives the packet that neighbor node sends.
Step 302, the device operating system of present node calculates the signal to noise ratio snr _ now between present node and neighbor node by physical layer data, and is deposited in the default field of internal memory.
Step 303, the device operating system of present node judges whether the message in packet is Hello message, the device operating system of for example present node calls the Hook Function AODVNetfilter that AODV agreement articulates and judges whether the message in packet is Hello message, if, continue to process, otherwise, end process.
Step 304, the device operating system of present node reads the signal to noise ratio snr _ now storing in described internal memory preset field, and by socket Netlink, described signal to noise ratio snr _ now and source node IP address is sent to the client layer of present node with Hook Function.
Step 305, the client layer of present node judges the entry that whether has corresponding described IP address in signal to noise ratio record sheet Table_S after receiving, if do not had, is first treated, execution step 306; Otherwise, execution step 307.
Step 306, present node using described source node IP address and signal to noise ratio snr _ now deposit in described signal to noise ratio record sheet Table_S as new entry, and end process.
Step 307, the signal to noise ratio in the entry of corresponding described IP address in described signal to noise ratio record sheet Table_S is updated to described signal to noise ratio snr _ now by present node.
In this process, described signal to noise ratio record sheet Table_S has specifically stored the content of following part: the signal to noise ratio between IP address, present node and the described neighbor node of neighbor node.Wherein, present node is in the time judging the entry that there is no corresponding described neighbor node IP address in described signal to noise ratio record sheet Table_S, determine the Hello message that receives first described neighbor node broadcast, the signal to noise ratio of calculating during using this neighbor node IP address, the current Hello of receiving message, as new entry, deposits in described signal to noise ratio record sheet Table_S together; Afterwards, present node is in the time judging the entry that has had corresponding described neighbor node IP address in described signal to noise ratio record sheet Table_S, determine and again received the Hello message of same neighbourhood node broadcasts, previously stored signal to noise ratio in described signal to noise ratio record sheet Table_S is updated to the current signal to noise ratio of calculating while again receiving Hello message.
Due to the features of movement of Ad Hoc nodes, the SNR_now that present node calculates while receiving the Hello message of same neighbourhood node periodic broadcast may have larger difference, in order to reduce error, preferably, while judging the entry that has corresponding described IP address in signal to noise ratio record sheet Table_S, the snr value accumulative total of precedence record in described signal to noise ratio snr _ now and described signal to noise ratio record sheet Table_S is added together, then ask its mean value as the signal to noise ratio between present node and described same neighbourhood node, and preferred, after every 5 accumulative totals are average, this entry is once reset.
Based on the signal to noise ratio of obtaining above, in Fig. 2 step 203 calculate this RREQ message while transferring to present node from source node first through the network quality Q1_first of path Route1_first, as shown in Figure 4, be specially:
Step 401, present node reads the signal to noise ratio (neighbor node that reverse last node is present node of corresponding reverse last node IP address from signal to noise ratio record sheet Table_S, in the time that reverse last node sends Hello message to present node, present node has calculated the signal to noise ratio between the two and has been stored in signal to noise ratio record sheet Table_S).
Step 402, present node read in this RREQ message, record transfer to present node from source node time first the jumping figure that comprises through path Route1_first.
Step 403, present node take the signal to noise ratio of the reverse last node IP address of described correspondence and first the jumping figure that comprises through path Route1_first as parameter, calculate the network quality Q_N1 between present node and reverse last node.
Step 404, present node read in this RREQ message, record, when source node is issued to reverse last node through the network quality in path (the path experiencing, have the network quality between two nodes of the poorest network quality) Q_W1, then judge the quality of described Q_W1 and Q_N1, select poor in described network quality Q_W1 and described network quality Q_N1 one while transferring to present node for this RREQ message from source node first through the network quality Q1_first of path Route1_first.
Make described RREQ message when source node transfers to present node first be one poor Q_W1 and Q_N1 through the network quality Q1_first of path Route1_first, this be the network quality in the whole path that experiences in transmittance process due to message be by path between all nodes minimum network quality determine, and poor to be exactly described RREQ message when source node transfers to present node have through path a network quality between two nodes of poor network quality in Q_W1 and Q_N1.
In like manner, in Fig. 2 step 204 calculate this RREQ message while transferring to present node from source node at present through the network quality Q1_now of path Route1_now, be specially:
Step a1, present node reads the signal to noise ratio of corresponding reverse last node IP address from signal to noise ratio record sheet Table_S.
Step a2, present node read in this RREQ message, record transfer to present node from source node time at present the jumping figure that comprises through path Route1_now.
Step a3, present node take the signal to noise ratio of the reverse last node IP address of described correspondence and at present the jumping figure that comprises through path Route1_now as parameter, calculate the network quality Q_N1 between present node and reverse last node.
Step a4, present node reads and records in this RREQ message, while being issued to reverse last node from source node through the network quality Q_W1 in path, and judge the quality of described Q_W1 and Q_N1, make this RREQ message when source node transfers to present node at present be one poor Q_W1 and Q_N1 through the network quality Q1_now of path Route1_now.
Reverse routing table Table_Route1 in said process has stored the reverse route of setting up between present node and source node, and oppositely network quality record sheet Table_Q1 has stored following two parts: source node IP address (for determining whether again to receive the RREQ message that is mail to described destination node by described source node) corresponding to RREQ message, the network quality Q1 of described reverse route.Wherein, present node receives while mailing to the route requests RREQ message of described destination node by described source node first, determine reverse route between present node and the source node recording in reverse routing table Table_Route1 for this RREQ message first through the reverse path of path Route1_first, and determine the described reverse route network quality Q 1 that records in reverse network quality record sheet Table_Q1 for first through the network quality Q1_first of path Route1_first, after present node again receive while mailing to the RREQ message of described destination node by described source node, when if this RREQ message transfers to present node from source node at present through the network quality Q1_now of path Route1_now, be better than previously stored reverse route network quality Q 1 in reverse network quality record sheet Table_Q1, by the present node recording in reverse routing table Table_Route1 to the reverse routing update between source node for this RREQ message at present through the reverse path of path Route1_now, and by the reverse route network quality Q 1 recording in reverse network quality record sheet Table_Q1, be updated to described current the network quality Q1_now through path Route1_now.
In the mechanism of above-mentioned processing RREQ message, present node is receiving first while mailing to the RREQ message of destination node by source node, use the path that experienced to be first established to the reverse route between source node, still select the fastest path of response speed to set up route according to the mode of prior art, but after again receive while mailing to the RREQ message of described destination node by described source node, not to stop immediately processing, but can be according to the comparative result of the network quality of the network quality of current path and the reverse route of previously having set up, determine whether to upgrade the reverse route of present node to source node, if determine that the network quality of current path is better than the network quality in previous path, reverse route is upgraded, otherwise just continue to use previous path.Like this in the time setting up the process of reverse route, choose the path with better network quality between just always can be from present node to source node in various possible paths and set up reverse route, and then RREQ message is continued broadcast away, until arrival destination node.
The embodiment of the present invention is in the process of processing RREQ message, destination node and the each node between source node and destination node are similar, also can repeatedly receive the RREQ message of being sent by described source node, and may repeatedly upgrade destination node to the reverse route between source node, destination node is upgraded after reverse route each, all returns to a RREP message to source node according to newly-established reverse route.
2, set up forward route
RREP message is that destination node is received after RREQ message, sends to the message of source node according to reverse route clean culture, and source node is set up the forward route of source node to destination node by receiving RREP message.In embodiments of the present invention, because destination node all can send RREP message after the reverse route of each renewal, therefore may return to many RREP message to source node according to different paths (the reverse route that corresponding different time is set up).In order also to select to have the path of better network quality when the forward route of setting up between source node and destination node, treatment mechanism with RREQ message is similar, the embodiment of the present invention has also added the judgement of network quality to the processing of RREP message, as shown in Figure 5, concrete processing procedure is as follows:
Step 501, present node receives after the RREP message of the last node of forward (node of the last node of described forward for arriving before described RREP message arrival present node) clean culture, judge whether to receive first the RREP message that is mail to described source node by described destination node, if, perform step 502, otherwise, execution step 503.
Because source node is only broadcasted the RREQ message of corresponding same destination node within a certain period of time, therefore destination node just only can send RREP message to same source node clean culture within the regular hour, if when therefore present node is received the RREP message from described destination node within a certain period of time again, determine it is again to receive the RREP message that is mail to described source node by described destination node, but not receive first.
Step 502, present node is definite to be received while mailing to the RREP message of described source node by described destination node first, when calculating this RREP message and transferring to present node from destination node, first through the network quality Q2_first of path Route2_first, by destination node IP address corresponding this RREP message, first store in forward network quality record sheet Table_Q2 through the network quality Q2_first of path Route2_first, then set up present node to the forward route of destination node for described in first through the reverse path of path Route2_first, and this reverse route is stored in forward routing table Table_Route2, execution step 506.
Step 503, present node is definite to be received while mailing to the RREP message of described source node by described destination node again, when calculating this RREP message and transferring to present node from destination node, institute, through the network quality Q2_now of path Route2_now, performs step 504 at present.
Step 504, present node reads the forward route network quality Q 2 of the same destination node IP of previously stored correspondence address from forward network quality record sheet Table_Q2, then judge this RREP message at present whether be better than previously stored forward route network quality Q 2 through the network quality Q2_now of path Route2_now, if, perform step 505, otherwise, abandon current the network quality Q2_now through path Route2_now, and end process.
Step 505, the forward route network quality Q 2 of corresponding same destination node IP address in forward network quality record sheet Table_Q2 is updated to current the network quality Q2_now through path Route2_now, and by present node in forward routing table Table_Route2 to the forward routing update of source node for this RREP message at present through the reverse path of path Route2_now.
Step 506, present node judges whether self is the source node of this RREP message, if so, performs step 507, otherwise execution step 508.
Step 507, present node is definite certainly as after source node, and determining can be according to the forward route of having set up, reverse route between destination node.
Step 508, present node forwards this RREP message according to reverse route again.
The embodiment of the present invention is to the following calculating relating in the processing procedure of RREP message: when the calculating of message path network quality, this RREP message transfer to present node from destination node first in the time that calculating, this RREP message of the network quality Q2_first of path Route2_first transfer to present node from destination node at present through the calculating of the network quality Q2_now of path Route2_now, all according to the embodiment of the present invention, corresponding processing mode in the processing procedure of RREQ message is processed, do not repeated them here.
Forward routing table Table_Route2 in said process has stored the forward route of setting up between present node and destination node, and forward network quality record sheet Table_Q2 has stored following two parts: destination node IP address (for determining whether again to receive the RREP message that is mail to described source node by described destination node) corresponding to RREP message, the network quality Q2 of described forward route.Wherein, present node receives while mailing to the RREP message of described source node by described destination node first, determine forward route between present node and the destination node recording in forward routing table Table_Route2 for this RREP message first through the reverse path of path Route2_first, and the described positive route network quality Q2 recording in definite forward network quality record sheet Table_Q2 for first through the network quality Q2_first of path Route2_first, after present node again receive while mailing to the RREP message of described source node by described destination node, when if this RREP message transfers to present node from destination node at present through the network quality Q2_now of path Route2_now, be better than previously stored forward route network quality Q 2 in forward network quality record sheet Table_Q2, the forward route to destination node by the present node recording in forward routing table Table_Route2, be updated to this RREP message at present through the reverse path of path Route2_now, and by the forward route network quality Q 2 recording in forward network quality record sheet Table_Q2, be updated to described current the network quality Q2_now through path Route2_now.
In Ad Hoc network, arbitrary node can be source node or destination node or intermediate node, also can receive RREQ message or RREP message, set up reverse route or forward route between source node, preferably, each node store with same network quality record sheet current reception RREQ message/RREP message through the network quality in path, be that reverse network quality record sheet Table_Q1 and forward network quality record sheet Table_Q2 are same, as long as the network quality to dissimilar path (path of forward route or the oppositely path of route) is carried out different marks.In like manner, preferably, each node is stored the forward route between reverse route between self and source node and self and destination node by same routing table, be that reverse routing table Table_Route2 and forward routing table Table_Route1 are same, as long as dissimilar route (forward route or oppositely route) is carried out to different marks.
In the mechanism of above-mentioned processing RREP message, present node is receiving first while mailing to the RREP message of described source node by described destination node, use the path that experienced to be first established to the forward route between destination node, after again receive while mailing to the RREP message of described source node by described destination node, comparative result according to the network quality of current path with the network quality of the forward route of previously having set up, determine whether to upgrade the forward route of present node to destination node, if determine that the network quality of current path is better than the network quality in previous path, forward route is upgraded, otherwise just continue to use previous path.Like this in the time setting up the process of forward route, between just always can be from present node to destination node, in various possible paths, choose the path with better network quality and set up forward route, and then according to reverse route, RREP message continuation clean culture is sent, until arrive source node.
Unlike the prior art, although RREP message is unicast messages, but the node in the present invention between destination node and source node also may repeatedly receive the RREP message that is mail to described source node by described destination node, in this case, the present node that receives RREP message just can adopt to be chosen the mode with better network quality path and sets up forward route, rather than as in prior art being simple receiving after RREP message, set up the forward route with reverse route with same paths, like this, forward route just can have different paths from reverse route, in the asymmetric situation of the communication resource that source node and destination node have in Ad Hoc network, be conducive to improve the communication quality between source node and destination node.
By above to Hello message, RREQ message, the description of RREP message processing procedure, in embodiments of the present invention known, each present node can record the signal to noise ratio between self and neighbor node, then and destination node/source node between while setting up reverse route/forward route, when RREQ message/RREP message of utilizing the snr computation that recorded to go out current reception transfers to present node from source node/destination node through the network quality in path, and repeatedly receiving and having after RREQ message/RREP message of identical sources node and destination node, selection has the path of better network quality reverse route/forward route of having set up is upgraded, thereby can there is for the connection setup between source node and destination node the path of better network quality, obtain higher communication speed and network stabilization preferably.
In existing AODV agreement, to be present node set up the route for single-hop path between neighbor node receiving after Hello message to the treatment mechanism of Hello message immediately, will directly use afterwards this single-hop path to communicate between present node and neighbor node.If can cause like this network quality between the node in neighborhood very poor, the multihop path that has better network quality that AODV agreement can not go selection to exist yet, and the single-hop path that directly use has established, result will cause the communication speed between neighbours very slow, and communication quality declines.
And in the method that the embodiment of the present invention provides, neighbor node is received after Hello message, not setting up between source node is immediately the route in single-hop path, but adopt after sending RREQ message and receiving RREP message, just set up the forward and reverse route between source node/destination node, when network quality that so just can be between neighbours is very poor, the multihop path that selection has better network quality communicates, rather than only limits to use single-hop path between the two as route.
When the route of having set up maintenance in AODV agreement, use RRER message, the embodiment of the present invention relates generally to the process of AODV agreement selecting paths in the time setting up forward, reverse route, safeguard that route still adopts the treatment mechanism of RRER message in existing AODV agreement, does not repeat them here.
The embodiment of the present invention also provides a kind of device of setting up route, and this device is contained in present node, and as shown in Figure 6, this device comprises:
RREQ receiver module 601, for receiving the route requests RREQ message that is mail to destination node by source node;
The first acquisition module 602, for obtain described RREQ message from source node transfer to present node through the network quality in the first path;
Oppositely routing update module 603, when determining that the network quality in described the first path is better than existing present node to the network quality of the reverse route of described source node, utilizes described in the rightabout routing update in described the first path oppositely route;
Wherein, present node set up first to the reverse route of described source node, be to utilize described RREQ message institute that present node receives first through path foundation.
Preferably, the above-mentioned device of setting up route can also comprise:
RREP receiver module 604, for receiving the RREP message that is mail to described source node by described destination node;
The second acquisition module 605, for obtain described RREP message from destination node transfer to present node through the network quality in the second path;
Forward routing update module 606, when determining that the network quality in described the second path is better than existing present node to the network quality of the forward route of described destination node, utilizes forward route described in the rightabout routing update in described the second path;
Wherein, present node set up first to the forward route of described destination node, be to utilize described RREP message institute that present node receives first through path foundation.
Further, oppositely routing update module 603 can be for: if present node is destination node, and be established to first the reverse route of described source node or be updated to the reverse route of described source node, return to RREP message according to described reverse route that set up first or that upgrade; If present node is non-destination node, and is established to first the reverse route of described source node or is updated to the reverse route of described source node, broadcast packet is containing the RREQ message of the network quality in described the first path.
Wherein, described network quality is: in respective path, and the poorest network quality in the network quality between any two adjacent nodes.
The first acquisition module 602 obtain described RREQ message from source node transfer to present node through the network quality in the first path, be specifically as follows: obtain the network quality Q_N1 between present node and reverse last node, the node of described reverse last node for arriving before described RREQ message arrival present node; When obtaining described RREQ message and transferring to reverse last node from source node through the network quality Q_W1 in path; The network quality of determining described the first path is one poor in described network quality Q_N1 and network quality Q_W1.
The second acquisition module 605 obtain described RREP message from destination node transfer to present node through the network quality in the second path, be specifically as follows: obtain the network quality Q_N2 between the last node of present node and forward, the node of the last node of described forward for arriving before described RREP message arrival present node; When obtaining described RREP message and transferring to the last node of forward from destination node through the network quality Q_W2 in path; The network quality of determining described the second path is one poor in described network quality Q_N2 and network quality Q_W2.
Further, the RREQ message that the first acquisition module 602 specifically can receive from described RREQ receiver module 601, when obtaining described RREQ message and transferring to reverse last node from source node through the network quality Q_W1 in path.The RREP message that the second acquisition module 605 specifically can receive from RREP receiver module 604, when obtaining described RREP message and transferring to the last node of forward from destination node through the network quality Q_W2 in path.
Further, the described device of setting up route can also comprise signal to noise ratio acquisition module, and this signal to noise ratio acquisition module, in the time that present node is received Hello message, obtains the signal to noise ratio between present node and the node of transmission hello message.Further, signal to noise ratio acquisition module can also be used for averaging after obtaining present node and sending the signal to noise ratio pre-determined number between the node of Hello message, determines that described mean value is the signal to noise ratio between the node of the described Hello of transmission message.
The first acquisition module 602 obtains the network quality Q_N1 between present node and reverse last node, specifically can comprise: utilize the signal to noise ratio between described present node and reverse last node, described RREQ message from source node transfer to present node through the jumping figure in path, calculate the network quality Q_N1 between present node and reverse last node.
The second acquisition module 605 obtains the network quality Q_N2 between present node and the last node of forward, specifically can comprise: utilize the signal to noise ratio between the last node of described present node and forward, described RREP message from destination node transfer to present node through the jumping figure in path, calculate the network quality Q_N2 between present node and the last node of forward.
Further, the first acquisition module 602, the second acquisition module 605 specifically can adopt following formula computing network quality:
Q=SNR/Hop; Or
Q=SNR-Hop*Const;
Wherein, Q is network quality, and Q value is larger, and network quality is better, and SNR is signal to noise ratio, and Hop is jumping figure, and Const is constant.
Accordingly, the embodiment of the present invention also provides a kind of node for wireless self-networking, and this node includes the device of setting up as mentioned above route.
Describedly set up the device of route, for the operation principle of the node of wireless self-networking with reference to the above-mentioned embodiment of setting up method for routing, do not repeat them here.
Obviously, those skilled in the art can carry out various changes and modification and not depart from the spirit and scope of the present invention the present invention.Like this, if within of the present invention these are revised and modification belongs to the scope of the claims in the present invention and equivalent technologies thereof, the present invention is also intended to comprise these changes and modification interior.