Embodiment
Referring to Fig. 1, be the method flow diagram of a kind of sensor networking of providing of the embodiment of the invention, comprising:
101: obtain the short address of network node and the station location marker of father node.
The short address is corresponding one by one with 64 expansion unique identifier EUI-64 of network node, by network coordinator, is also referred to as gateway, and unified management and distribution can be the prime number of the described network node of unique identification.
Network coordinator can be safeguarded an address pool, comprising all unappropriated short addresses.
Network node can pass through Neighbor Discovery Protocol, obtains the nodal information of at least one neighbor node in the network, and described nodal information comprises the EUI-64 of described neighbor node, short address, station location marker and node type; Described node type can be network coordinator, router or end-apparatus spare etc.
Described network node records the nodal information of described at least one neighbor node in the neighbor information table, comprise described nodal information and neighborhood in the described neighbor information table; Described neighborhood can be father and mother (parent) or child (children) etc.Example is as shown in table 1:
Table 1 neighbor information table
EUI-64 |
The short address |
Node type |
Station location marker |
Neighborhood |
… |
|
|
|
|
|
|
|
|
|
|
|
|
Can also comprise nodename and a territory network mark knowledge (PAN ID) etc. in the described neighbor information table.Described nodename can dispose according to nodal function, and for example a node is to be responsible for detecting the kitchen temperature, then this nodename is configured to the kitchen temperature.
It is that a neighbor node of network coordinator or router is as father node that described network node is selected node type in the described neighbor information table.Described network node can be to described father node sending node route requests message, when described father node allows described network node by own access network, the neighborhood that described father node upgrades network node described in its neighbor information table is child children, and responds the advertising of route message to described network node; After described network node was received described advertising of route message, the neighborhood of upgrading father node described in the described neighbor information table was father and mother parent.
Described network node can according to described neighbor information table, obtain the station location marker of described father node.Wherein, network coordination person's station location marker can be network coordination person's short address, and the station location marker of other nodes is the product of the short address of the station location marker of the father node of this node and this node self.
Described network node can send the Address requests message, distributes the short address to the network coordinator request, comprises the EUI-64 of described network node in the described Address requests message.Described network node can send described Address requests message to described father node, is transmitted to network coordinator by described father node; Described network node can also directly send described Address requests message to network coordinator.
Network coordinator is according to the EUI-64 of described network node, for described network node distributes the short address.Network coordinator can be responded the address assignment message, comprises described short address in the described address assignment message, and for example 13.
Network coordinator can also be preserved a network node information table, comprising the EUI-64 of network node and the corresponding relation of short address.
102: the station location marker that generates described network node according to the station location marker of the short address of described network node and father node.
Described network node can be with the product of the station location marker of described short address and the described father node station location marker as described network node.For example the short address of network node is 13, and the station location marker of father node is 2*5, and then the station location marker of network node generation is 2*5*13.
103: send the position logon message, register the station location marker of described network node to network coordinator.
Described network node sends the position logon message, to the station location marker of network coordinator registration oneself, comprises the station location marker of described network node in the logon message of described position.
After network coordinator is received described position logon message, preserve the station location marker of described network node.
The title that can also comprise described network node in the logon message of described position.Network coordinator can the maintenance position information table, comprises the corresponding relation of the Name ﹠ Location sign of network node in the described positional information table, for example kitchen temperature correspondence position sign 2*5*13.Can be understood as, described network coordinator provides the similar name server function of (Domain Name Server is called for short DNS).
104: receive the location confirmation message from described network coordinator.
Network coordinator is responded the location confirmation message to described network node.Described network node receives described location confirmation message, finishes the process that adds network.
When movement has occured in described network node, during from current parent's node motion to the target father node, described network node can execution in step 101~104 again to add network.
Optionally, can be set a time cycle, within this time cycle, network coordinator is the EUI-64 of network node and short address binding, when network node is moved or short time when leaving, need not again to obtain the short address.
For instance, as shown in Figure 2, be the topological schematic diagram of sensor network in the embodiment of the invention, wherein, the short address of network coordinator is configured to 2, and station location marker also is configured to 2; Wherein, node 6, its EUI-64 are EUI-64-6, and node type is end-apparatus spare, and name is called bathroom humidity, is to add this network of network node.According to the embodiment of the invention, the process that node 6 adds network is as follows:
At first node 6 obtains neighbor node by Neighbor Discovery Protocol, i.e. the nodal information of node 2 and node 5, and wherein the EUI-64 of node 2 is EUI-64-2, the EUI-64 of node 5 is EUI-64-5; And in the neighbor information table of self nodal information of record node 2 and node 5; Starting stage, the neighborhood in the neighbor information table is empty.As follows:
EUI-64 |
The short address |
Node type |
Station location marker |
Neighborhood |
… |
EUI-64-2 |
5 |
Router |
2*5 |
|
|
EUI-64-5 |
13 |
End-apparatus spare |
2*5*13 |
|
|
Equally, node 2 can with the nodal information of node 6, be saved in the neighbor information table of self; Node 5 also can be saved in the nodal information of node 6 in the neighbor information table of self.
It is the neighbor node of router that node 6 is selected node types, and namely the short address is that 5 node 2 is as father node.
Then, node 6 sends the route requests message to node 2, and after node 2 was received described route requests message, if allow node 6 to add network by oneself, the neighborhood of node 6 was child children in the neighbor information table of node 2 renewals self; And to node 6 response advertising of route messages, after node 6 is received described advertising of route message, upgrade father node in the local neighbor information table, namely the neighborhood of node 2 is father and mother parent.
Then, the neighbor information table of node 6 inquiries self, to father node, namely node 2 sends the address registration message, wherein comprises EUI-64-6.After node 2 was received described address registration message, owing to oneself be not network coordinator, the neighbours that inquire about self transmitted, and transmit described address registration message to network coordinator.After network coordinator is received described address registration message, be that node 6 distributes short address 17 according to EUI-64-6; And respond the Address Confirmation message, wherein comprise short address 17; Described Address Confirmation message is through father node, and namely node 2 is transmitted to node 6, and node 6 gets access to the short address 17 of self.
Then node 6 obtains the station location marker 2*5 of father node according to the neighbor information table, is multiplied each other in the short address 17 of self and the station location marker 2*5 of father node, and the product 2*5*17 that obtains is the station location marker of node 6.
Then, node 6 sends the position logon message to network coordinator, wherein comprises the Name ﹠ Location sign 2*5*17 of node 6; After network coordinator is received described position logon message, preserve the corresponding relation of the Name ﹠ Location sign 2*5*17 of node 6, and respond the location confirmation message.
After node 6 is received the location confirmation message, finish the process that adds network.
Referring to Fig. 3, be the method flow diagram of a kind of sensor network route of providing of the embodiment of the invention, comprising:
301: the network node receiving data packets, the destination locations that obtains described data message identifies;
302: when the station location marker of described destination locations sign and described network node not simultaneously, described network node is transmitted described data message according to described destination locations sign.
When the station location marker of described destination locations sign and described network node not simultaneously, described network node judges whether the station location marker of self can divide exactly described destination locations and identify;
When the aliquant described destination locations sign of the station location marker of described network node, the neighbor information table of the local storage of described network node inquiry, neighborhood is transmitted described data message for the neighbor node of father and mother parent in the described neighbor information table;
When the station location marker of described network node can be divided exactly described destination locations sign, the neighbor information table of the local storage of described network node inquiry, neighborhood is child children in the described neighbor information table, and the neighbor node that station location marker can be divided exactly described destination locations sign is transmitted described data message.
When described network node need to be when other nodes send datagram in the network, described network node can be according to the station location marker of the described destination node of name acquiring of destination node.
Described network node can be inquired about the neighbor information table of local storage, when described destination node is not in the neighbor information table of this locality storage,
The described network equipment can send the position enquiring message to network coordinator, and receives the position response message that network coordinator is responded described position enquiring message, obtains the station location marker of described destination node.The title that comprises described destination node in the described position enquiring message comprises the station location marker of described destination node in the response message of described position.Can be understood as, described network coordinator provides the function of similar DNS.
Described network node generates the second data message, and the destination locations of described the second data message is designated the station location marker of described destination node;
When the station location marker of the aliquant described destination node of station location marker of described network node, the neighbor information table of the local storage of described network node inquiry is transmitted described the second data message to neighborhood for the neighbor node of father and mother parent;
When the station location marker of described network node can be divided exactly the station location marker of described destination node, the neighbor information table of the local storage of described network node inquiry, be child children to neighborhood, and the neighbor node that station location marker can be divided exactly the station location marker of described destination node is transmitted described the second data message.
For instance, as shown in Figure 2, node 6 adds after the network, need to send datagram to node 4.
At first node 6 is according to the station location marker of the name acquiring node 4 of node 4; Node 6 generated data messages, the destination locations of described data message is designated the station location marker 2*7*11 of node 4; Node 6 judges whether the station location marker 2*5*17 of self can divide exactly described destination locations sign 2*7*11; When local position identified the station location marker of aliquant described destination node, the neighbor information table of node 6 inquiries self was the neighbor node of father and mother parent to neighborhood, and namely node 2 is transmitted described data message.
Node 2 is received described data message, confirms that the destination locations sign of described data message is different from the station location marker of self; Node 2 judges whether the station location marker of self can divide exactly described destination locations sign; When the aliquant described destination locations sign of the station location marker of self, the neighbor information table of node 2 inquiries self is the neighbor node of father and mother parent to neighborhood, and namely network coordinator is transmitted described data message.
After network coordinator is received described data message, confirm that the destination locations sign of described data message is different from the station location marker of self; Network coordinator judges whether the station location marker of self can divide exactly described destination locations sign; When the station location marker of self can be divided exactly described destination locations sign, the neighbor information table of network coordinator inquiry self, be child children to neighborhood, and station location marker can divide exactly the neighbor node of described destination locations sign, namely node 3 is transmitted described data message.
After node 3 is received described data message, confirm that the destination locations sign of described data message is different from the station location marker of self; Node 3 judges whether the station location marker of self can divide exactly described destination locations sign; When the station location marker of self can be divided exactly described destination locations sign, the neighbor information table of node 3 inquiries self, be child children to neighborhood, and station location marker can divide exactly the neighbor node of described destination locations sign, namely node 4 is transmitted described data message.
After node 4 is received described data message, confirm that the destination locations sign of described data message is identical with the station location marker of self, routing procedure finishes.4 pairs of described data messages of node are processed.
Referring to Fig. 4, be the block diagram of a kind of network node of providing of the embodiment of the invention, be used for realizing the present invention's method shown in Figure 1.Described network node comprises acquiring unit 401, generation unit 402, transmitter 403 and receiver 404.Wherein:
Described acquiring unit 401 is used for obtaining the short address of described network node and the station location marker of father node;
Described generation unit 402 is for the station location marker that generates described network node according to the station location marker of described short address and described father node; Described transmitter 403 is used for sending the position logon message, registers the station location marker of described network node to network coordinator;
Described receiver 404 is used for receiving the location confirmation message from described network coordinator.
Described short address is corresponding one by one with 64 expansion unique identifier EUI-64 of described network node, by network coordinator, is also referred to as gateway, and unified management and distribution can be the prime number of the described network node of unique identification.
Described acquiring unit 401 also is used for by Neighbor Discovery Protocol, obtains the nodal information of at least one neighbor node of described network node, and described nodal information comprises EUI-64, short address, station location marker and node type; Described node type can be network coordinator, router or end-apparatus spare etc.
Described network node can also comprise:
Record cell is used for the nodal information at described at least one neighbor node of neighbor information table record.
Selected cell, being used for selecting described neighbor information table node type is that a neighbor node of network coordinator or router is as father node.
Described acquiring unit 401 specifically is used for according to described neighbor information table, obtains the station location marker of described father node.Described station location marker can be expressed as the product of prime number, for example 2*5.
Described transmitter 403 also can be used for to described father node sending node route requests message, so that the neighborhood of node is child children described in described father node renewal self the neighbor information table.
Described receiver 404 also is used for receiving the advertising of route message that described father node is responded.
Described network node can also comprise:
Updating block is used for upgrading described neighbor information table.
Described updating block specifically is used for according to described advertising of route message, and the neighborhood of upgrading father node described in the described neighbor information table is father and mother parent.
Described transmitter 403 also can be used for sending the Address requests message, distributes the short address to the network coordinator request; The EUI-64 that comprises described network node in the described Address requests message.
Network coordinator is responded the address assignment message to described network node, comprises described short address in the described address assignment message; Described receiver 404 also is used for receiving described address assignment message; Described acquiring unit 401 specifically is used for according to described address assignment message, obtains described short address.
Described generation unit 402 specifically is used for the station location marker of described short address and described father node is multiplied each other, and the product that obtains is as the station location marker of described network node.For example the short address of network node is 13, and the station location marker of father node is 2*5, and then the station location marker of network node generation is 2*5*13.
Referring to Fig. 5, be the block diagram of the another kind of network node that provides of the embodiment of the invention, described network node is used for realizing method shown in Figure 3, comprises receiver 501, acquiring unit 502, judging unit 503 and transmitter 504.Wherein:
Described receiver 501 is used for receiving data packets;
Described acquiring unit 502 is for the destination locations sign of obtaining described data message;
Described judging unit 503 is used for judging whether described destination locations sign is identical with the station location marker of described network node;
Described transmitter 504, be used for when the station location marker of the station location marker of described destination node and described network node not simultaneously, according to the described data message of described destination locations sign forwarding.
Described judging unit 503, also be used for when the station location marker of described destination locations sign and described network node not simultaneously, judge the station location marker whether station location marker of described network node can divide exactly described purpose.
Described acquiring unit 502 also is used for when the aliquant described destination locations sign of the station location marker of described network node, obtains that neighborhood is the nodal information of the neighbor node of father and mother parent in the neighbor information table of described network node; Correspondingly, described transmitter 504 specifically is used for transmitting described data message to described neighborhood for the neighbor node of father and mother parent.
Described acquiring unit 502, also be used for when the station location marker of described network node can be divided exactly described destination locations sign, obtain neighborhood in the neighbor information table of described network node can divide exactly the neighbor node that described destination locations identifies for child children and station location marker nodal information; Correspondingly, described transmitter 504 concrete being used for transmitted described data message to the neighbor node that described neighborhood can divide exactly described destination locations sign for child children and station location marker.
When described network node need to be when other nodes send datagram in the network, described network node can be inquired about the neighbor information table of self, when destination node was not in the neighbor information table at self, described network node can be inquired about to network coordinator the station location marker of described destination node.Can be understood as, described network coordinator provides the function of similar DNS.
Described transmitter 504 also is used for sending the position enquiring message to network coordinator, comprises the title of described destination node in the described position enquiring message.
Described receiver 501 also is used for receiving the position response message that network coordinator is responded described position enquiring message, comprises the station location marker of described destination node in the response message of described position.
Referring to Fig. 6, be a kind of sensor network system block diagram that the embodiment of the invention provides, described network packet includes network node 601 and network coordinator 602.Wherein:
Described network node 601 is used for obtaining the short address of self and the station location marker of father node, and according to the short address of self and the station location marker of described father node, generates the station location marker of self; Also be used for sending the position logon message, to the station location marker of described network coordinator 602 registrations self, and reception is from the location confirmation message of described network coordinator 602;
Described network coordinator 602 is used for receiving described position logon message, and sends described location confirmation message.
Described short address is corresponding one by one with 64 expansion unique identifier EUI-64 of described network node 601, by described network coordinator 602, be also referred to as gateway, unified management and distribution, network node in can the described sensor network of unique identification, described short address is prime number.
Described network coordinator 602 can be safeguarded an address pool, comprising all unappropriated short addresses.
Described father node can be described network coordinator 602.
Described network node 601 also is used for by Neighbor Discovery Protocol, obtains the nodal information of at least one neighbor node in the described network, and records the nodal information of described at least one neighbor node in the neighbor information table of self.
It is that a neighbor node of network coordinator or router is as father node that described network node 601 also is used for selecting described neighbor information table node type, to described father node sending node route requests message, so that upgrading the neighborhood of network node described in its neighbor information table, described father node is child children; And receiving the advertising of route message that described father node is responded, the neighborhood of upgrading father node described in self the neighbor information table is father and mother parent.
Described network node 601 can according to described neighbor information table, obtain the station location marker of described father node.Described station location marker can be expressed as the product of prime number, for example 2*5.
Described network node 601 also is used for sending the Address requests message to described network coordinator 602, comprises the EUI-64 of described network node 601 in the described Address requests message.
Described network coordinator 602 receives described Address requests message, according to the EUI-64 of described network node 601, is that described network node 601 distributes short addresses, and responds the address assignment message, comprises described short address in the described address assignment message, and for example 13.
Described network coordinator 602 can be preserved a network node information table, comprising the EUI-64 of network node and the corresponding relation of short address.
Described network node 601 is concrete to be used for the product of the station location marker of described short address and described father node as described self station location marker.For example the short address of network node is 13, and the station location marker of father node is 2*5, and then the station location marker of network node generation is 2*5*13.
Described network node 601 also is used for sending the position logon message, to the station location marker of described network coordinator 602 registrations self; The station location marker that comprises described network node in the logon message of described position.
After described network coordinator 602 is received described position logon message, preserve the station location marker of described network node, and respond the location confirmation message to described network node 601.
Described network coordinator 602 can the maintenance position information table, comprises the corresponding relation of the Name ﹠ Location sign of network node in the described positional information table, for example kitchen temperature correspondence position sign 2*5*13.Can be understood as, described network coordinator provides the function of similar DNS.
Described network node 601 also is used for receiving data packets, obtains the destination locations sign of described data message; When described destination locations sign with self station location marker not simultaneously, transmit described data message according to described destination locations sign.
When the station location marker of described destination locations sign and described network node 601 not simultaneously, described network node 601 is used for also judging whether the station location marker of self can divide exactly described destination locations and identify;
When the aliquant described destination locations sign of the station location marker of described network node 601, the neighbor information table of described network node 601 inquiries self is transmitted described data message to neighborhood for the neighbor node of father and mother parent;
When the station location marker of described network node 601 can be divided exactly described destination locations sign, the neighbor information table of described network node 601 inquiries self, be child children to neighborhood, and the neighbor node that station location marker can be divided exactly described destination locations sign is transmitted described data message.
As shown in Figure 7, described network can also comprise other network nodes 603; Described other network nodes 603 can be neighborhoods with described network node 601, can not be neighborhoods also.
When described network node 601 need to send datagram to described other network nodes 603, described network node 601 can be according to the station location marker of described other network nodes 603 of the name acquiring of described other network nodes 603.
Described network node can be inquired about first the neighbor information table of self, when described other network nodes 603 are not in the neighbor information table at self, the described network equipment 601 also is used for sending the position enquiring message to described network coordinator 602, and receive the position response message that described network coordinator 602 is responded described position enquiring message, obtain the station location marker of described other network nodes 603.The title that comprises described second network node 603 in the described position enquiring message comprises the station location marker of described other network nodes 603 in the response message of described position.
Described network node 601 also is used for generating and sending the second data message, and the destination locations of described the second data message is designated the station location marker of described other network nodes 603.
The technical scheme that adopts the embodiment of the invention to provide by using prime number short address and station location marker, realizes quickly networking and the route of node in the non-uniform Distribution sensor network, the movement of all right support node; Solved existing wireless sensor network not support node non-uniform Distribution and mobility, perhaps needed to generate and maintaining routing list the problem that consumption of network resources and node energy consumption are high.One of ordinary skill in the art will appreciate that all or part of step that realizes in above-described embodiment method is to come the relevant hardware of instruction to finish by program, described program can be stored in the computer-readable recording medium, described storage medium can be ROM/RAM, disk or CD etc.
The above; only for the better embodiment of the present invention, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.