Summary of the invention
The invention provides a kind of method and device of transfer of data, can guarantee the transmission of the packet that transmission priority is higher, effectively shorten the propagation delay time of the higher packet of transmission priority.
The invention provides a kind of method of transfer of data, described method comprises:
Obtain the transmission priority of packet;
When the transmission priority of described packet is high-grade transmission priority, start RTS/CTS handshake mechanism reservation channel, and with preengaging the described packet of transmission.
Preferably, the described step of obtaining the transmission priority of packet is:
Obtain priority tag default in described packet;
According to the described priority tag that obtains, obtain the transmission priority of packet, described transmission priority is drawn and is comprised high-grade transmission priority and low-grade transmission priority.
Preferably, described method also comprises:
In advance with the priority tag of described packet, be arranged in the reservation position of mac frame control domain in packet.
Preferably, described startup RTS/CTS handshake mechanism reservation channel, and comprise with the step of the described packet of reservation transmission:
Steps A, source node detect the transmission priority of packet, if the transmission priority of described packet is high-grade transmission priority, add up the bag number of this transmission, and then source node broadcasts the RTS frame to the internodal total jumping figure of final purpose;
Step B, receive the Section Point of RTS frame, judge that described Section Point is whether on the transmission path of the packet of high-grade transmission priority, if, described Section Point is replied the CTS0 frame to described source node, after source node receives the CTS0 frame, begin described data packet transmission to described Section Point;
Step C, receive the 3rd node of CTS0 frame, judge that described the 3rd node is whether on the transmission path of the packet of high-grade transmission priority, if, described the 3rd node returns to the CTS1 frame to described Section Point, after described Section Point receives the CTS1 frame, begin described data packet transmission to described the 3rd node;
Repeated execution of steps B~step C passes to next-hop node according to transmission path with the packet of high-grade transmission priority, until complete the transmission of the packet of this high-grade transmission priority.
Preferably, described step B specifically comprises:
Receive the described Section Point of RTS frame, read the MAC Address of the final purpose node of the MAC Address of the source node of packet in the RTS frame and packet, search the transmission route table of the packet of default high-grade transmission priority;
If described Section Point not on the transmission path of the packet of high-grade transmission priority, described Section Point dormancy;
If described Section Point is on the transmission path of the packet of high-grade transmission priority, whether the MAC Address that judges the node of down hop equates with the MAC Address of described Section Point, if equate, described Section Point is replied the CTS0 frame to source node, and in the CTS0 frame, the MAC Address of next-hop node is the MAC Address of described Section Point; If the MAC Address of the MAC Address of next-hop node and described Section Point is unequal, described Section Point is not done further processing to the RTS frame.
Preferably, the dormancy time of described Section Point is estimated to the internodal jumping figure of final purpose in conjunction with number and the source node of the MAC Address of next-hop node, packet waiting for transmission.
Preferably, described step C specifically comprises:
Receive described the 3rd node of CTS0 frame, read the MAC Address of the final purpose node of the MAC Address of the source node of packet in the CTS0 frame and packet, search the transmission route table of the packet of default high-grade transmission priority;
If described the 3rd node is not on the transmission path of the packet of high-grade transmission priority the time, described the 3rd node is with dormancy;
If described the 3rd node is on the transmission path of the packet of high-grade transmission priority the time, whether the MAC Address that judges the node of down hop equates with the MAC Address of described the 3rd node, if equate, described the 3rd node is replied the CTS1 frame to described Section Point, and in the CTS1 frame, the MAC Address of next-hop node is the MAC Address of described the 3rd node; If the MAC Address of the MAC Address of next-hop node and described the 3rd node is unequal, described the 3rd node is not done further processing to the CTS1 frame.
Preferably, in described RTS/CTS handshake mechanism, the RTS/CTS frame comprises: the number of the MAC Address of the MAC Address of adapter head, source node, final purpose node, the MAC Address of next-hop node, data to be transmitted bag and source node are to the internodal jumping figure of final purpose.
Preferably, described method also comprises:
When if the transmission priority of described packet is high-grade transmission priority, after startup is preengage channel based on the RTS/CTS handshake mechanism of string tin technology, the frame control domain that described packet is set is confirmed request, shows that needing the recipient to send the ACK frame confirms;
When if the transmission priority of described packet is low-grade transmission priority, the frame control domain that described packet is set is confirmed request, shows that not needing the recipient to send the ACK frame confirms.
The present invention also provides a kind of device of transfer of data, comprising:
Acquisition module is for the transmission priority that obtains packet;
Transport module when being used for transmission priority when described packet and being high-grade transmission priority, starts RTS/CTS handshake mechanism reservation channel, and with preengaging the described packet of transmission.
Preferably, described device also comprises:
Priority arranges module, is used in advance with the priority tag of described packet, is arranged in the reservation position of mac frame control domain in packet.
Preferably, described transport module comprises:
Detecting unit for detection of the transmission priority of packet, if the transmission priority of described packet is high-grade transmission priority, is added up the bag number of this transmission, and then source node broadcasts the RTS frame to the internodal total jumping figure of final purpose;
Judging unit, be used for Section Point that judgement receives the RTS frame whether at the transmission path of the packet of high-grade transmission priority, if, described Section Point is replied the CTS0 frame to described source node, after source node receives the CTS0 frame, begin described data packet transmission to described Section Point; And whether the 3rd node that judgement receives the CTS0 frame is on the transmission path of the packet of high-grade transmission priority, if, described the 3rd node returns to the CTS1 frame to described Section Point, after described Section Point receives the CTS1 frame, begin described data packet transmission to described the 3rd node, repeat, according to transmission path, the packet of high-grade transmission priority is passed to next-hop node, until complete the transmission of the packet of this high-grade transmission priority.
Preferably, described device also comprises:
Feedback module, if when being used for the transmission priority of described packet and being high-grade transmission priority, after startup was preengage channel based on the RTS/CTS handshake mechanism of string tin technology, the frame control domain that described packet is set was confirmed request, shows that needing the recipient to send the ACK frame confirms; And if the transmission priority of described packet is when being low-grade transmission priority, the frame control domain that described packet is set is confirmed request, shows that not needing the recipient to send the ACK frame confirms.
As shown from the above technical solution, embodiments of the invention have following beneficial effect:
At first, in an embodiment of the present invention, can guarantee the transmission of the packet that transmission priority is higher, effectively shorten the propagation delay time of the higher packet of transmission priority;
Secondly, in an embodiment of the present invention, for the higher packet of transmission priority, by adopting the RTS/CTS handshake mechanism reservation channel of listening technology based on string, can greatly reduce the RTS, the CTS control frame that transmit in network.For example for once preengaging channel procedure, the number of control frame is determined by the transmission jump number of packet.The transmission of the packet of jumping for L, in existing IEEE 802.11 RTS/CTS handshake mechanisms, the quantity of control frame is 2L; Listening the quantity of control frame in the RTS/CTS handshake mechanism of technology based on the string in the present embodiment is L+1.Jumping figure is larger, preengages in channel procedure at every turn, and the control frame number of listening the RTS/CTS handshake mechanism of technology to save based on string is more, more is conducive to energy-conservation;
At last, in an embodiment of the present invention, also can improve mechanism based on the ACK of transmission priority, take into full account the wireless sensor network data transmission mode in practical application, reduce the ACK frame of low-grade transmission priority packet unnecessary in network, for effectively, in time transmitting of high-grade transmission priority packet reserved radio channel resource more fully.
Embodiment
In the present embodiment, at first obtain the transmission priority of packet; Then when the transmission priority of packet is high-grade transmission priority, start RTS/CTS handshake mechanism reservation channel, adopt this packet of transmission of reservation.
For the purpose, technical scheme and the advantage that make the embodiment of the present invention is clearer, below in conjunction with embodiment and accompanying drawing, the embodiment of the present invention is described in detail.At this, illustrative examples of the present invention and explanation are used for explanation the present invention, but not as a limitation of the invention.
As shown in Figure 2, be the method flow diagram of transfer of data in embodiments of the invention, concrete steps are as follows:
Step 11, obtain the transmission priority of packet;
For example: transmission priority can be divided in the present embodiment: high-grade transmission priority and low-grade transmission priority, for example:
High-grade transmission priority packet has sudden, when wireless sensor network node monitors anomalous event, the high-grade a large amount of injection networks of transmission priority packet meeting, high-grade transmission priority packet contains abundant amount of information usually, for guaranteeing that anomalous event is in time found and processes, guarantee that high-grade transmission priority packet obtains in time, effectively transmission;
The common cyclical transmission of low-grade transmission priority packet, transmission frequency, speed are known, are used for that regular gather data is analyzed or be used for guaranteeing the network health operation, and the contained amount of information of low-grade transmission priority packet is generally less.
What certainly can understand is that in the present embodiment, in wireless sensor network, the dividing mode of the transmission priority of packet is not limited to aforesaid way.Execution in step 101 is for never with in the packet that transmits priority, obtains the highest packet of transmission priority.
The 7th~9 and the 12nd~13 of IEEE 802.15.4MAC agreement regulation mac frame control domain is the reservation position, and agreement does not keep the position to these two sections and does any restriction.In the present embodiment, can keep the transmission priority that the position is used for sign IEEE 802.15.4 packet with these two sections.
As shown in Figure 3, be the IEEE 802.15.4MAC frame control domain form in the present embodiment, for example: the 7th~9 of IEEE 802.15.4MAC frame control domain is kept the priority tag that the position is defined as IEEE 802.15.4 packet.For example, the priority of IEEE 802.15.4 packet can be divided into 8 grades.In the present embodiment, the priority classification of IEEE 802.15.4 packet can arrange as follows:
The Priority value equals 0, and the transmission priority that identifies this packet is 0, represents that this packet is the packet of low-grade transmission priority;
The Priority value equals 1, and the transmission priority that identifies this packet is 1, represents that this packet is the packet of high-grade transmission priority;
Priority is value in 2~7, does not define in the present embodiment, and it can define according to actual needs.What certainly can understand is not limit in the present embodiment the divided rank of the priority of packet.
Step 12, when the transmission priority of packet is high-grade transmission priority, start RTS/CTS handshake mechanism reservation channel, and with preengaging the channel transmission data bag.
Namely, wireless sensor network node only when sending the packet of high-grade transmission priority, just starts the RTS/CTS handshake mechanism reservation channel of listening technology based on string, in order to make the packet of high-grade transmission priority exclusively enjoy channel.
Listen RTS/CTS handshake mechanism, RTS frame and the equal broadcast transmission of CTS frame of technology based on string.RTS frame and CTS frame are IEEE 802.15.4 packet, and RTS frame and CTS frame have unified payload form, referring to Fig. 4.
As shown in Figure 4, this RTS/CTS frame comprises: the number of the MAC Address of the MAC Address of adapter head, source node, final purpose node, the MAC Address of next-hop node, data to be transmitted bag and source node are to the internodal jumping figure of final purpose, wherein
The Adapter Header subdomain of (1) two byte is adapter head, is used for the identification data packet type;
(2) all contain three 16 bit mac short addresses in RTS and CTS frame: the Src Address subdomain of two bytes is the MAC Address of source node of the packet of high-grade transmission priority, the DstAddress subdomain of two bytes is the MAC Address of final purpose node of the packet of high-grade transmission priority, and the Next Address subdomain of two bytes is the MAC Address of next-hop node;
The Num subdomain of (3) two bytes is used for the number of data packets of this reservation channel of sign high-grade transmission priority waiting for transmission;
The Hop subdomain of (4) one bytes is used for packet internodal jumping figure from the source node to the final purpose of this high-grade transmission priority of sign.
in the present embodiment, set up the number (Num) of data to be transmitted bag and source node to be to the purpose of the internodal jumping figure of final purpose (Hop), when the node strings on the data transfer path of high-grade transmission priority is not heard the RTS/CTS frame, therefrom obtain the information about the transfer of data of high-grade transmission priority, during the transfer of data of high-grade transmission priority, the node on the data transfer path of high-grade transmission priority will not participate in channel competition, can dormancy to reach energy-conservation purpose, dormancy time can calculate in conjunction with Num value and Hop value.
In the present embodiment, start RTS/CTS handshake mechanism reservation channel, and specifically comprise with the step of reservation channel transmission data bag:
Step 121, source node (source node) detect the transmission priority of packet, if the transmission priority of packet is high-grade transmission priority, add up the bag number of this transmission, and then source node broadcasts the RTS frame to the internodal total jumping figure of final purpose.
Step 122, receive the Section Point of RTS frame, judge Section Point whether on the transmission path of the packet of high-grade transmission priority, if, Section Point is replied the CTS0 frame to source node, source node begins data packet transmission to Section Point after receiving the CTS0 frame;
This step specifically comprises:
Receive the Section Point of RTS frame, read the MAC Address (Dst Address) of the final purpose node of the MAC Address (Src Address) of the source node of packet in the RTS frame and packet, search the transmission route table of the packet of default high-grade transmission priority;
If Section Point its not on the transmission path of the packet of high-grade transmission priority, but Section Point dormancy, in order to avoid the transmission of the packet of high-grade transmission priority is impacted, the dormancy time of Section Point in conjunction with the number (Num) of the MAC Address (Next Address) of next-hop node, packet waiting for transmission and source node to the internodal jumping figure of final purpose (Hop) estimation;
If Section Point its on the transmission path of the packet of high-grade transmission priority, whether the MAC Address (Next Address) that can further judge the node of down hop equates with the MAC Address of Section Point, if equate, Section Point is replied the CTS0 frame to source node, after source node receives the CTS0 frame, begin data packet transmission to Section Point, in the CTS0 frame, the MAC Address of next-hop node (NextAddress) is the MAC Address of Section Point; If the MAC Address of next-hop node (Next Address) is unequal with the MAC Address of Section Point, Section Point is not done further processing to the RTS frame.
Step 123, receive the 3rd node of CTS0 frame, judge that the 3rd node is whether on the transmission path of the packet of high-grade transmission priority, if return to the CTS1 frame at the 3rd node to Section Point, after Section Point receives the CTS1 frame, begin data packet transmission to the 3rd node;
This step specifically comprises:
Receive the 3rd node of CTS0 frame, read the MAC Address (Dst Address) of the final purpose node of the MAC Address (Src Address) of the source node of packet in the CTS0 frame and packet, search the transmission route table of the packet of default high-grade transmission priority;
If the 3rd node is not on the transmission path of the packet of high-grade transmission priority the time, the 3rd node is with dormancy, in order to avoid the transmission of the packet of high-grade transmission priority is impacted, dormancy time in conjunction with the number (Num) of the MAC Address (Next Address) of next-hop node, data to be transmitted bag and source node to the internodal jumping figure of final purpose (Hop) estimation;
if the 3rd node is on the transmission path of the packet of high-grade transmission priority the time, whether the MAC Address (Next Address) that can further judge the node of down hop equates with the MAC Address of the 3rd node, if equate, the 3rd node is replied the CTS1 frame to Section Point, after Section Point receives the CTS1 frame, begin data packet transmission to the 3rd node, in the CTS1 frame, the MAC Address of next-hop node (NextAddress) is the MAC Address of the 3rd node, if the MAC Address of next-hop node (Next Address) is unequal with the MAC Address of the 3rd node, the 3rd node is not done further processing to the CTS1 frame.
Source node repeated execution of steps 123~step 124 is passed to next-hop node with the packet of high-grade transmission priority, until complete the transmission of the packet of this high-grade transmission priority.
In the present embodiment, wireless sensor network node can only when the packet of the high-grade transmission priority of transmission, start the ACK frame feedback mechanism of Priority-based.
Namely, also can comprise in said method: obtain the transmission priority of packet, when the transmission priority of packet is high-grade transmission priority, start ACK frame feedback mechanism.
In the present embodiment, the ACK frame feedback mechanism of Priority-based comprises following steps:
When if the transmission priority of source node packet is high-grade transmission priority, after the source node startup is preengage channel based on the RTS/CTS handshake mechanism of string tin technology, the frame control domain that IEEE 820.15.4 packet is set is confirmed request (Ack request), shows that needing the recipient to send the ACK frame confirms;
When if the transmission priority of packet is low-grade transmission priority, the frame control domain that IEEE 820.15.4 packet is set is confirmed request (Ack request), shows that not needing the recipient to send the ACK frame confirms.
In the present embodiment, source node, Section Point and the 3rd node can be realized by existing sensor node.
As shown in Figure 5, be application scenarios schematic diagram in embodiments of the invention, the packet of high-grade transmission priority transfers to node Node3 from node Node0, the transmission path of the packet of default high-grade transmission priority is Node0->Node1->Node2->Node3, and node Node4 only can communicate by letter with node Node1.
Below in conjunction with Fig. 5 and Fig. 6, introduce the transfer process of the packet of transmission priority high-grade in embodiments of the invention.The Node0 transmit mechanism detects mac frame control domain medium priority sign Priority, know when packet waiting for transmission is the packet of high-grade transmission priority, enable the RTS/CTS handshake mechanism reservation channel of listening technology based on string, utilize reservation channel transmission data bag, concrete steps are as follows:
Step 601, Node0 broadcasting RTS0 are with the reservation channel, RTS0 Src Address value is the Node0 address, Dst Address value is the Node3 address, Next Address value is the Node1 address, and fills in Num subdomain and Hop subdomain according to high-grade transmission priority packet (DATA) and the jumping figure that will transmit;
step 602, Node1 receives table of query and routing after RTS0, if Node1 is on the transmission path of high-grade transmission priority packet, and the down hop of high-grade transmission priority data packet transmission is Node1, reply CTS0 to Node0, CTS0 Src Address, Dst Address, Num, the Hop value is all constant, Next Address value is the Node1 address, after Node0 receives CTS0, begin high-grade transmission priority Packet Generation to Node1, high-grade transmission priority packet Ackrequest subdomain is set as 1, after requiring the recipient to receive high-grade transmission priority packet, reply the ACK frame,
step 603, Node2 receives table of query and routing after CTS0, if Node2 is on the transmission path of high-grade transmission priority packet, and the down hop of high-grade transmission priority transfer of data is Node2, reply CTS1 to Node1, CTS1 Src Address, Dst Address, Num, the Hop value is all constant, Next Address value is the Node2 address, after Node1 receives CTS1, begin high-grade transmission priority Packet Generation to Node2, high-grade transmission priority packet Ack request subdomain is set as 1, after requiring the recipient to receive high-grade transmission priority packet, reply the ACK frame,
Step 604, Node4 receive table of query and routing after CTS0, due to Node4 not on the transmission path of high-grade transmission priority packet, with dormancy, dormancy time calculates according to Num value and Hop value Node4 during this high-grade transmission priority data packet transmission;
What certainly can understand is, the content in the present embodiment yet can first execution in step 604 does not limit the execution sequence of step 603 and step 604 in the present embodiment.
step 605, Node3 receives table of query and routing after CTS1, if Node3 is on the transmission path of high-grade transmission priority packet, and the down hop of high-grade transmission priority transfer of data is Node3, reply CTS2, CTS2 Src Address, Dst Address, Num, the Hop value is all constant, Next Address value is the Node3 address, Node2 begins high-grade transmission priority Packet Generation to Node3 after receiving CTS2, high-grade transmission priority packet Ack request subdomain is set as 1, after requiring the recipient to receive high-grade transmission priority packet, reply the ACK frame, high-grade transmission priority packet reaches the final purpose node.
In the present embodiment, by adopting the RTS/CTS handshake mechanism of listening technology based on string, can RTS, the CTS control frame that transmit in network will be greatly reduced.For once preengaging channel procedure, the number of control frame is determined by the data packet transmission jumping figure.For the transfer of data that L jumps, in IEEE 802.11RTS/CTS handshake mechanism, the quantity of control frame is 2L; Be L+1 and listen the quantity of control frame in the RTS/CTS handshake mechanism of technology based on the string in the present embodiment.Hence one can see that, if jumping figure is larger, preengages in channel procedure at every turn, and the control frame number of listening the RTS/CTS handshake mechanism of technology to save based on string is more, more is conducive to energy-conservation.
Further, take into full account in the present embodiment the wireless sensor network data transmission mode in practical application, effectively reduce unnecessary low-grade transmission preferences DBMS ACK frame in network, for effectively, in time transmitting of high-grade transmission preferences DBMS reserved radio channel resource more fully.
As Fig. 7, be depicted as the structured flowchart of the device of transfer of data in embodiments of the invention, the device of this transfer of data comprises:
Acquisition module 71 is for the transmission priority that obtains packet;
Transport module 72 when being used for transmission priority when described packet and being high-grade transmission priority, starts RTS/CTS handshake mechanism reservation channel, and with preengaging the described packet of transmission.
In another embodiment of the present invention, described device also comprises:
Priority arranges module, is used in advance with the priority tag of described packet, is arranged in the reservation position of mac frame control domain in packet.
In another embodiment of the present invention, described transport module comprises:
Detecting unit for detection of the transmission priority of packet, if the transmission priority of described packet is high-grade transmission priority, is added up the bag number of this transmission, and then source node broadcasts the RTS frame to the internodal total jumping figure of final purpose;
Judging unit, be used for Section Point that judgement receives the RTS frame whether at the transmission path of the packet of high-grade transmission priority, if, described Section Point is replied the CTS0 frame to described source node, after source node receives the CTS0 frame, begin described data packet transmission to described Section Point; And whether the 3rd node that judgement receives the CTS0 frame is on the transmission path of the packet of high-grade transmission priority, if, described the 3rd node returns to the CTS1 frame to described Section Point, after described Section Point receives the CTS1 frame, begin described data packet transmission to described the 3rd node, repeat, according to transmission path, the packet of high-grade transmission priority is passed to next-hop node, until complete the transmission of the packet of this high-grade transmission priority.
In another embodiment of the present invention, described device also comprises:
Feedback module, if when being used for the transmission priority of described packet and being high-grade transmission priority, after startup was preengage channel based on the RTS/CTS handshake mechanism of string tin technology, the frame control domain that described packet is set was confirmed request, shows that needing the recipient to send the ACK frame confirms; And if the transmission priority of described packet is when being low-grade transmission priority, the frame control domain that described packet is set is confirmed request, shows that not needing the recipient to send the ACK frame confirms.
The above is only the preferred embodiment of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.