+

CN102185749B - Method for avoiding routing loop by adopting tree topology relationship - Google Patents

Method for avoiding routing loop by adopting tree topology relationship Download PDF

Info

Publication number
CN102185749B
CN102185749B CN201110151082.6A CN201110151082A CN102185749B CN 102185749 B CN102185749 B CN 102185749B CN 201110151082 A CN201110151082 A CN 201110151082A CN 102185749 B CN102185749 B CN 102185749B
Authority
CN
China
Prior art keywords
node
sequence number
topological
branch
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201110151082.6A
Other languages
Chinese (zh)
Other versions
CN102185749A (en
Inventor
秦雅娟
张宏科
郑涛
段俊奇
元男
崔英
雷振飞
闫晓晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jiaotong University
Original Assignee
Beijing Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jiaotong University filed Critical Beijing Jiaotong University
Priority to CN201110151082.6A priority Critical patent/CN102185749B/en
Publication of CN102185749A publication Critical patent/CN102185749A/en
Application granted granted Critical
Publication of CN102185749B publication Critical patent/CN102185749B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供一种采用树形拓扑关系避免路由环路的方法,建立了树形网络,向节点分配拓扑序号,在树形网络中创建分支拓扑序列信息以及在树形网络中避免路由环路的方法,该方法包括:源节点广播RREQ报文,收到该RREQ报文的节点查询所述分支拓扑序列信息;判断源节点是否为所述收到该RREQ报文的节点的祖先节点;如果否,则所述收到该RREQ报文的节点响应该RREQ报文;如果是,则所述收到该RREQ报文的节点不响应该RREQ报文。该方法通过分析节点之间的拓扑层次关系,阻止路由环路发生的可能性。

The invention provides a method for avoiding routing loops by adopting tree-shaped topological relationships, establishing a tree-shaped network, assigning topological serial numbers to nodes, creating branch topology sequence information in the tree-shaped network, and avoiding routing loops in the tree-shaped network The method comprises: a source node broadcasts a RREQ message, and the node receiving the RREQ message inquires about the branch topology sequence information; judging whether the source node is the ancestor node of the node receiving the RREQ message; if not , then the node receiving the RREQ message responds to the RREQ message; if yes, the node receiving the RREQ message does not respond to the RREQ message. This method prevents the possibility of routing loops by analyzing the topological hierarchical relationship between nodes.

Description

采用树形拓扑关系避免路由环路的方法Method of Avoiding Routing Loop Using Tree Topology

技术领域 technical field

本发明涉及一种无线传感器网络的路由方法。更具体地,本发明涉及一种采用树形拓扑关系避免路由环路的无线传感器网络路由方法。The invention relates to a routing method for a wireless sensor network. More specifically, the present invention relates to a wireless sensor network routing method using a tree topology relationship to avoid routing loops.

背景技术 Background technique

无线传感器网络(Wireless Sensor Networks,WSNs)技术是现代通信技术和计算机网络技术的重要组成部分,它是由分布在观测区域内的大量的廉价微型传感器节点组成,通过无线通信方式形成的一个多跳的自组织网络。各传感器节点之间协同合作地感知物理世界的对象信息(如:温度、湿度、加速度、光强等),并最终将数据信息汇聚、融合至服务器和观察者。Wireless Sensor Networks (WSNs) technology is an important part of modern communication technology and computer network technology. It is composed of a large number of cheap micro-sensor nodes distributed in the observation area, and forms a multi-hop network through wireless communication. self-organizing network. The sensor nodes cooperate to perceive the object information in the physical world (such as: temperature, humidity, acceleration, light intensity, etc.), and finally gather and fuse the data information to the server and observer.

近年来,随着物联网的兴起和发展,无线传感器网络技术受到了更多的关注,其逐渐成为实现物理世界和信息世界相互融合的重要保障。与此同时,伴随无线传感器网络技术发展而产生的应用扩展也有着越来越广阔的空间和美好的前景。目前无线传感器网络技术已广泛应用于智能交通、智能电网、智能家居、工业控制、环境监测、医疗保健、军事等领域。In recent years, with the rise and development of the Internet of Things, wireless sensor network technology has received more attention, and it has gradually become an important guarantee for the integration of the physical world and the information world. At the same time, with the development of wireless sensor network technology, the application expansion has more and more broad space and bright prospects. At present, wireless sensor network technology has been widely used in intelligent transportation, smart grid, smart home, industrial control, environmental monitoring, medical care, military and other fields.

图1表示的是无线传感器网络的基本结构。无线传感器网络一般包括:传感节点(sensor节点)如W、X、Y、Z和汇聚节点(sink节点),无线传感器网络通过sink节点接入服务器从而与各种网络交互。各传感节点(以下如无特指,统称为节点)之间协作地感知信息,通过多跳将信息汇聚至sink节点,再连接至服务器,经各种无线或有限网络供用户查询、配置和管理。What Fig. 1 shows is the basic structure of the wireless sensor network. A wireless sensor network generally includes: sensor nodes (sensor nodes) such as W, X, Y, and Z, and sink nodes (sink nodes). The wireless sensor network interacts with various networks by connecting to a server through the sink node. Each sensor node (hereinafter referred to as a node unless otherwise specified) cooperates to sense information, gathers the information to the sink node through multiple hops, and then connects to the server for users to query, configure and communicate via various wireless or limited networks manage.

无线传感器网络一般拥有数量众多的节点设备,在许多情况下,每一个节点都需要配置全球唯一的IP地址,因此IPv6技术在无线传感器网络中有着重要的应用价值。但另一方面,无线传感器网络由于资源受限等原因,对于IPv6协议栈占用的资源(如128比特IPv6地址)不能很好的适应和满足,这尤其体现在路由协议的设计和实现上。Wireless sensor networks generally have a large number of node devices. In many cases, each node needs to be configured with a globally unique IP address. Therefore, IPv6 technology has important application value in wireless sensor networks. But on the other hand, due to resource constraints and other reasons, the wireless sensor network cannot adapt to and satisfy the resources occupied by the IPv6 protocol stack (such as 128-bit IPv6 address), which is especially reflected in the design and implementation of routing protocols.

AODV(Ad hoc On-Demand Distance Vector Routing)路由协议是无线传感器网络中经典的按需路由协议之一,但是考虑到资源受限等因素,因此需要重新对AODV路由协议进行改进和优化。MSRP(Micro Sensor Router Protocol)协议按照上述思想对AODV协议进行了优化,分别精简了路由交互报文格式,使用64位(8字节)IPv6地址接口标识符即IPv6地址的后64位代替IPv6中的128位(16字节)地址,可以有效减少地址字段的长度,使得路由解析过程变得更加简单、有效,符合无线传感器网络能量、存储资源受限的要求,其中,1位就是1比特(bit),8位就是1字节。此外,IEEE802.15.4协议规定两种地址格式,64位地址和16位地址。其中,采用64位地址能够保证地址的唯一性,能够实现节点地址的自动配置,而采用16位地址则需要网关分配,并且需要考虑地址重复检测、地址回收等问题,实现起来复杂,所以采用64位IPv6地址接口标识符符合IEEE 802.15.4标准对于地址字段的要求。以下分别为路由请求(RREQ)报文、路由回复(RREP)报文、路由错误(RERR)报文的格式:AODV (Ad hoc On-Demand Distance Vector Routing) routing protocol is one of the classic on-demand routing protocols in wireless sensor networks, but considering resource constraints and other factors, it is necessary to improve and optimize the AODV routing protocol. The MSRP (Micro Sensor Router Protocol) protocol optimizes the AODV protocol according to the above ideas, simplifies the routing interaction message format, and uses a 64-bit (8-byte) IPv6 address interface identifier, that is, the last 64 bits of the IPv6 address to replace the IPv6 address. The 128-bit (16-byte) address can effectively reduce the length of the address field, making the routing analysis process simpler and more effective, and meets the requirements of wireless sensor network energy and storage resources. Among them, 1 bit is 1 bit ( bit), 8 bits is 1 byte. In addition, the IEEE802.15.4 protocol stipulates two address formats, 64-bit address and 16-bit address. Among them, the use of 64-bit addresses can ensure the uniqueness of the address and realize the automatic configuration of node addresses, while the use of 16-bit addresses requires gateway allocation, and issues such as address duplication detection and address recycling need to be considered, which is complicated to implement, so 64-bit addresses are used. The bit IPv6 address interface identifier conforms to the requirements of the IEEE 802.15.4 standard for address fields. The following are the formats of routing request (RREQ) packets, routing reply (RREP) packets, and routing error (RERR) packets:

RREQ报文格式RREQ message format

其中的类型为000,表示RREQ报文类型,跳数为RREQ报文携带的从源节点到当前节点的跳数;路由请求ID为RREQ消息的唯一标识;源地址为源节点的地址即发出RREQ报文的节点或者该节点的某个RFD(Reduced FunctionDevice)节点的IEEE802.15.4定义的64比特(8字节)接口标识符;目的地址为目的节点的地址即接收RREQ请求路由节点的64比特(8字节)接口标识符;最小LQI:报文携带从RREQ源节点到当前节点的链路质量度量值的最小值。LQI(Link Quality Indicator)是符合IEEE802.15.4标准的一项对于无线传感器网络链路质量进行度量的参数。采用此字段可以在路由建立的过程中作为选路的依据,以此建立的路由能够保证较高的链路质量。RFD节点可以理解为没有路由功能,只能与其他节点通信的采集节点。The type is 000, indicating the type of RREQ message, and the hop count is the hop count from the source node to the current node carried by the RREQ message; the routing request ID is the unique identifier of the RREQ message; the source address is the address of the source node to send the RREQ The node of the message or the 64-bit (8-byte) interface identifier defined by IEEE802.15.4 of a certain RFD (Reduced Function Device) node of the node; the destination address is the address of the destination node, that is, the 64-bit ( 8 bytes) interface identifier; minimum LQI: the message carries the minimum value of the link quality metric value from the RREQ source node to the current node. LQI (Link Quality Indicator) is a parameter that measures the link quality of wireless sensor networks in compliance with the IEEE802.15.4 standard. Using this field can be used as the basis for route selection during route establishment, and the route established in this way can guarantee high link quality. The RFD node can be understood as a collection node that has no routing function and can only communicate with other nodes.

RREP报文格式RREP packet format

其中的类型为001,表示RREP报文类型;跳数为RREP报文携带的从源节点到当前节点的跳数;源地址为发起RREP的节点或该节点的某个RFD节点的IEEE802.15.4定义的64比特接口标识符;目的地址为接收RREP的节点即对应于RREQ发起节点的IEEE802.15.4定义的64比特接口标识符;最小LQI:报文携带从RREP源节点到当前节点的链路质量度量值的最小值。The type is 001, indicating the type of RREP message; the hop count is the hop count from the source node to the current node carried by the RREP message; the source address is the IEEE802.15.4 definition of the node that initiated the RREP or a certain RFD node of the node The 64-bit interface identifier; the destination address is the node receiving the RREP, which corresponds to the 64-bit interface identifier defined by IEEE802.15.4 of the RREQ initiating node; the minimum LQI: the message carries the link quality metric from the RREP source node to the current node The minimum value.

RERR报文格式RERR message format

类型:010,表示RERR报文类型;不可达地址的数目:某节点检测的失效邻居节点的个数;不可达目的地址:某节点检测的失效邻居节点的IEEE802.15.4定义的64比特接口标识符。不可达地址的数目决定不可达目的地址的个数,因此如果有更多不可达目的地址,则报文格式中可以携带更多的不可达目的地址。Type: 010, indicating the type of RERR message; the number of unreachable addresses: the number of failed neighbor nodes detected by a node; unreachable destination address: the 64-bit interface identifier defined by IEEE802.15.4 of the failed neighbor nodes detected by a node . The number of unreachable addresses determines the number of unreachable destination addresses, so if there are more unreachable destination addresses, more unreachable destination addresses can be carried in the packet format.

其中MSRP协议建立路由的基本过程是,无路由的节点向邻居节点广播路由请求(RREQ)报文,并经过中间节点转发,当sink节点收到该路由请求报文时,就向发起路由请求(RREQ)报文的节点回复路由回复(RREP)报文,从而建立节点到sink节点的路由。Wherein the basic process of MSRP protocol establishment routing is that the node without routing broadcasts the routing request (RREQ) message to the neighbor node, and forwards it through the intermediate node, when the sink node receives the routing request message, it will initiate the routing request (RREQ) message to the neighbor node The node of the RREQ) message replies with a route reply (RREP) message, thereby establishing a route from the node to the sink node.

但是MSRP协议将所有的路由回复(RREP)报文交由sink节点处理的方式,不仅大大增加了sink节点的负载,也增加了节点建立路由的时延。因此现有技术又进一步采取中间节点回复RREP的方式解决sink节点负载过重和路由时延过大等缺陷,即如果中间节点的路由表中存在到达sink节点的可用路由时,由该中间节点直接回复RREP而不是向sink节点转发,而这样的方式又会不可避免的带来路由环路的新问题。However, the MSRP protocol hands over all routing reply (RREP) messages to the sink node for processing, which not only greatly increases the load of the sink node, but also increases the time delay for the node to establish a route. Therefore, the existing technology further adopts an intermediate node to reply RREP to solve defects such as sink node overload and excessive routing delay, that is, if there is an available route to the sink node in the routing table of the intermediate node, the intermediate node directly Reply to RREP instead of forwarding to the sink node, and this method will inevitably bring about new problems of routing loops.

所谓路由环路就是,数据包在一系列节点之间不断传输却始终无法到达其预期目的节点的一种现象。当两个节点或多个节点的路由信息中存在错误地指向不可达目的节点的有效路径时,就可能发生路由环路。举例来说,假设网络中有节点A、B、C、E,初始路由是C→B→A和E→B→A。某一时刻,节点B链路出错,处于失效状态。在一次发送数据过程中,节点C发送给节点B的数据包全部收不到ACK回复,那么节点C就会判定自己到节点B的路由错误,因此开始广播RREQ重新寻找路由,这个RREQ被节点E所获取,因为节点E此时并不知道节点B不工作了,因此会回复RREP给节点C,重新建立的路由为C→E→B→A。但是,这条路由仍然包括已经不工作的节点B,实际仍是无效路由。随后,节点E在发送数据的过程中也发现有大量的包丢失,因此发起广播RREQ过程,此时节点C因为路由已经更新,节点B已经不再被节点C认为无效,所以当节点C收到节点E发来的RREQ后,向其回复RREP,从而使节点E具有新的路由即变成E→C→E→B→A,对于节点C向节点E提供的路由是否仍包括节点E本身,节点C在提供路由之前是无法判断的,因此这种过程会一直往复,导致用户的数据包不停在网络上循环发送,且跳数越来越大,造成网络资源的严重浪费。The so-called routing loop is a phenomenon in which a data packet is continuously transmitted between a series of nodes but cannot reach its intended destination node. Routing loops may occur when the routing information of two or more nodes incorrectly points to an effective path that cannot reach the destination node. For example, suppose there are nodes A, B, C, and E in the network, and the initial routes are C→B→A and E→B→A. At a certain moment, the link of Node B has an error and is in a failure state. In the process of sending data once, all the data packets sent by node C to node B cannot receive ACK reply, then node C will judge that the route to node B is wrong, so it starts to broadcast RREQ to find the route again, this RREQ is taken by node E Obtained, because node E does not know that node B is not working at this time, so it will reply RREP to node C, and the re-established route is C→E→B→A. However, this route still includes Node B which is no longer working, and is actually still an invalid route. Subsequently, node E also found that a large number of packets were lost during the process of sending data, so it initiated the broadcast RREQ process. At this time, node C has updated the route, and node B is no longer considered invalid by node C, so when node C receives After the RREQ sent by node E, reply RREP to it, so that node E has a new route that becomes E→C→E→B→A, whether the route provided by node C to node E still includes node E itself, Node C cannot judge before providing the route, so this process will continue to repeat, causing the user's data packets to be sent cyclically on the network, and the number of hops is getting larger and larger, resulting in a serious waste of network resources.

发明内容 Contents of the invention

本发明目的在于提供一种采用树形拓扑关系避免路由环路的方法,避免在数据包传输过程中产生路由环路。The purpose of the present invention is to provide a method for avoiding routing loops by adopting a tree topology relationship, so as to avoid routing loops during data packet transmission.

本发明的技术方案是:一种树形网络,包括一级节点,二级节点和三级节点,The technical solution of the present invention is: a tree-shaped network, including a first-level node, a second-level node and a third-level node,

所述一级节点为所述树形网络的根节点;The first-level node is the root node of the tree network;

所述二级节点为所述一级节点的子节点,具有由所述一级节点分配的唯一拓扑序号;The second-level node is a child node of the first-level node, and has a unique topology number assigned by the first-level node;

所述三级节点为所述一级节点或所述二级节点的子树节点,每个三级节点具有由所述一级节点或所述二级节点分配的唯一拓扑序号;The third-level node is a subtree node of the first-level node or the second-level node, and each third-level node has a unique topology number assigned by the first-level node or the second-level node;

一个或多个分支拓扑序列信息,每个分支拓扑序列信息以所述根节点的一个子树中各节点的拓扑序号的组合记录该子树中各节点的拓扑关系。One or more branch topology sequence information, each branch topology sequence information records the topological relationship of each node in a subtree of the root node in combination with the topology sequence numbers of each node in a subtree of the root node.

利用树形拓扑结构的描述可以构建网络中分层次的节点关系,适用于经常以广播形式发送报文的网络,为本发明中逐级分配节点的拓扑序号以及以树的形式精确记录分支拓扑序列信息提供前提。The hierarchical node relationship in the network can be constructed by using the description of the tree topology structure, which is suitable for the network that often sends messages in the form of broadcast, for the topology sequence number of the nodes assigned step by step in the present invention and the accurate record of the branch topology sequence in the form of a tree Prerequisites for providing information.

本发明还提供一种在树形网络中创建分支拓扑序列信息的方法,包括:The present invention also provides a method for creating branch topology sequence information in a tree network, including:

步骤S1、在初始建立路由中分配拓扑序号并生成分支拓扑序列信息;Step S1, assigning a topology sequence number and generating branch topology sequence information during the initial routing establishment;

步骤S2、一级节点的子节点向其子树节点多播所述分支拓扑序列信息;Step S2, the child node of the first-level node multicasts the branch topology sequence information to its subtree nodes;

步骤S3、所述子树节点存储所述分支拓扑序列信息;Step S3, the subtree node stores the branch topology sequence information;

步骤S4、判断是否还存在未获得拓扑序号的节点,如果存在,进入步骤S5;Step S4, judging whether there are nodes that have not obtained the topology serial number, and if so, proceed to step S5;

步骤S5、向所述未获得拓扑序号的节点补分配拓扑序号并更新分支拓扑序列信息,并返回步骤S3。Step S5, assign topological serial numbers to the nodes that have not obtained topological serial numbers and update branch topology sequence information, and return to step S3.

向网络中的节点分配数值型的拓扑序号,利用拓扑序号生成数值型分支拓扑序列信息,既能够体现节点间的拓扑层次关系也适合存储于报文中进行传输。Assign numerical topological serial numbers to nodes in the network, and use the topological serial numbers to generate numerical branch topology sequence information, which can not only reflect the topological hierarchical relationship between nodes, but also be suitable for storage in messages for transmission.

进一步地,根据权利要求2所述的一种在树形网络中创建分支拓扑序列信息的方法,步骤S1包括以下子步骤:Further, according to a method for creating branch topology sequence information in a tree network according to claim 2, step S1 includes the following sub-steps:

步骤S11、节点发送RREQ报文;Step S11, the node sends a RREQ message;

步骤S12、一级节点向其子节点回复RREP报文并分配拓扑序号;Step S12, the first-level node replies the RREP message to its child node and assigns a topology number;

步骤S13、二级节点向该二级节点的子节点回复RREP报文并分配拓扑序号,生成分支拓扑序列信息;Step S13, the secondary node replies the RREP message to the child node of the secondary node and assigns a topology sequence number to generate branch topology sequence information;

步骤S14、三级节点向其子节点回复RREP报文,完成初始建立路由。Step S14, the third-level node replies the RREP message to its child nodes, and completes the initial route establishment.

优先利用现有技术中建立路由的过程进行拓扑序号的分配,使得拓扑序号的分配过程与现有技术的建立路由过程紧密结合,节省了节点能量。The process of establishing routes in the prior art is preferentially used to allocate the topology serial numbers, so that the process of assigning the topology serial numbers is closely combined with the process of establishing routes in the prior art, saving node energy.

进一步地,所述步骤S5包括以下子步骤:Further, the step S5 includes the following sub-steps:

步骤S51、所述未获得拓扑序号的节点发送分支拓扑序号请求报文;Step S51, the node that has not obtained the topology sequence number sends a branch topology sequence number request message;

步骤S52、根据分支拓扑序号请求报文所经过的节点记录当前的分支拓扑序列信息;Step S52, recording the current branch topology sequence information according to the nodes through which the branch topology sequence number request message passes;

步骤S53、接收所述分支拓扑序号请求报文的节点判断自己是否具有分配拓扑序号的权限,如果是则进入步骤S54,如果否则进入步骤S56;Step S53, the node receiving the branch topology serial number request message judges whether it has the authority to assign a topology serial number, if yes, proceed to step S54, otherwise proceed to step S56;

步骤S54、所述接收所述分支拓扑序号请求报文的节点判断自己是否具有分配拓扑序号的能力,如果是则进入步骤S55,如果否则进入步骤S56;Step S54, the node receiving the branch topology serial number request message judges whether it has the ability to allocate topology serial numbers, if yes, proceed to step S55, if not, proceed to step S56;

步骤S55、所述接收所述分支拓扑序号请求报文的节点向其子树节点发送携带有拓扑序号和分支拓扑序列信息的分支拓扑序号更新报文,进入步骤S57;Step S55, the node receiving the branch topology sequence number request message sends a branch topology sequence number update message carrying the topology sequence number and branch topology sequence information to its subtree node, and enters step S57;

步骤S56、所述接收所述分支拓扑序号请求报文的节点转发所述分支拓扑序号请求报文,返回步骤S52;Step S56, the node receiving the branch topology serial number request message forwards the branch topology serial number request message, and returns to step S52;

步骤S57、所述未获得拓扑序号的节点获得所述拓扑序号。Step S57, the node that has not obtained the topology sequence number obtains the topology sequence number.

在无法通过建立路由进行拓扑序号分配时,本发明设计了分支拓扑序号的分配过程,并将分配序号过程与更新分支拓扑序列信息同时通过同一报文完成,节省了链路中的传输数据量,提高了创建分支拓扑序列信息的效率。When the topology sequence number cannot be assigned by establishing a route, the present invention designs the distribution process of the branch topology sequence number, and completes the process of assigning the sequence number and updating the branch topology sequence information through the same message at the same time, saving the amount of transmission data in the link. Improved efficiency in creating branch topology sequence information.

进一步地,所述RREQ报文包括EN字段和RREQ序号字段,所述EN字段标识RREQ源节点是否拥有拓扑序号,所述RREQ序号字段用于存储RREQ报文源节点的拓扑序号;Further, the RREQ message includes an EN field and a RREQ sequence number field, the EN field identifies whether the RREQ source node has a topology sequence number, and the RREQ sequence number field is used to store the topology sequence number of the RREQ message source node;

所述RREP报文包括CN字段和分配拓扑序号字段,所述CN字段标识是否有权限分配拓扑序号并且是否有分配能力;所述分配拓扑序号字段用于存储分配的拓扑序号。The RREP message includes a CN field and an allocation topology number field. The CN field identifies whether the allocation topology number is authorized and whether there is an allocation capability; the allocation topology number field is used to store the allocated topology number.

本发明只改变路由建立阶段的报文的格式使之既能够携带拓扑序号,分支拓扑序列信息,又能标识出报文发出节点的当前状态,使得报文传输数据信息的功能加强,并有利于接收节点根据发出节点的状态做出灵活的处理。The present invention only changes the format of the message in the routing establishment stage so that it can not only carry the topology sequence number and branch topology sequence information, but also identify the current state of the node sending the message, so that the function of message transmission data information is strengthened, and it is beneficial to The receiving node makes flexible processing according to the status of the sending node.

进一步地,所述分支拓扑序号请求报文和所述分支拓扑序号更新报文包括拓扑序列字段,所述拓扑序列字段用于存储当前的分支拓扑序列信息;Further, the branch topology sequence number request message and the branch topology sequence number update message include a topology sequence field, and the topology sequence field is used to store current branch topology sequence information;

所述分支拓扑序号更新报文还包括节点序号字段,该节点序号字段用于存储所述分配的拓扑序号。The branch topology sequence number update message further includes a node sequence number field, which is used to store the assigned topology sequence number.

本发明增加了专门分配拓扑序号及传输分支拓扑序列信息的报文,并设置了相应的存储用字段,补充了利用路由建立的报文分配拓扑序号和生成分支拓扑序列信息的不完整,使得节点可以更有针对性地解析该专门性的报文中各字段的信息。The present invention adds a special message for assigning topology numbers and transmitting branch topology sequence information, sets corresponding storage fields, supplements the incomplete distribution of topology numbers and generation of branch topology sequence information for messages established by routing, and makes nodes The information of each field in the specialized message can be parsed more specifically.

进一步地,步骤S2也利用所述分支拓扑序号更新报文多播所述分支拓扑序列信息。Further, step S2 also uses the branch topology serial number update message to multicast the branch topology sequence information.

利用分支拓扑序号,可以在路由建立阶段不额外增加新的报文种类而传递分支拓扑序列信息,节省节点能量,并有利于本发明技术方案扩展应用。By using the branch topology sequence number, the branch topology sequence information can be transmitted without additionally adding new message types in the routing establishment stage, saving node energy and facilitating the extended application of the technical solution of the present invention.

进一步地,如果接收所述分支拓扑序号请求报文或所述分支拓扑序号更新报文的节点再次收到重复的分支拓扑序号请求报文,则直接丢弃。Further, if the node receiving the branch topology sequence number request message or the branch topology sequence number update message receives a duplicate branch topology sequence number request message again, it will discard it directly.

这样可以避免节点对重复的报文进行多次处理,节省了节点的能量,也减少了链路中冗余的数据量。In this way, the node can avoid multiple processing of repeated messages, save the energy of the node, and also reduce the amount of redundant data in the link.

本发明提供的一种在树形网络中避免路由环路的方法包括:A method for avoiding routing loops in a tree network provided by the present invention includes:

源节点广播RREQ报文,收到该RREQ报文的节点查询所述分支拓扑序列信息;The source node broadcasts the RREQ message, and the node receiving the RREQ message queries the branch topology sequence information;

判断源节点是否为所述收到该RREQ报文的节点的祖先节点;Determine whether the source node is the ancestor node of the node that received the RREQ message;

如果否,则所述收到该RREQ报文的节点响应该RREQ报文;If not, the node that receives the RREQ message responds to the RREQ message;

如果是,则所述收到该RREQ报文的节点不响应该RREQ报文。If yes, the node that receives the RREQ message does not respond to the RREQ message.

进一步地,所述响应该RREQ报文包括以下子步骤:Further, said responding to the RREQ message includes the following substeps:

所述收到该RREQ报文的节点查询路由表是否有到目的节点的有效路由,如果有,则回复RREP报文;如果无,则转发该RREQ报文,并重复本步骤。The node that receives the RREQ message inquires whether there is an effective route to the destination node in the routing table, if yes, then replies the RREP message; if not, then forwards the RREQ message, and repeats this step.

本发明的技术方案采用了创建分支拓扑序列信息来记录网络树形拓扑关系,在链路出错需重新建立路由时,可以根据分支拓扑序列信息分析出接收RREQ报文的节点与RREQ源节点之间的拓扑层次关系,并对其拥有的路由中依然会经过RREQ源节点的接收节点做出判断,然后令这样的接收节点不回复RREP报文,因此避免了源节点建立的路由具有路由环路的风险,减少了链路中的传输数据量,也节省了节点的能量。The technical solution of the present invention uses the creation of branch topology sequence information to record the network tree topology relationship. When a link needs to re-establish a route when a link fails, the node that receives the RREQ message and the RREQ source node can be analyzed according to the branch topology sequence information. The topological hierarchical relationship of the route, and make a judgment on the receiving node that still passes the RREQ source node in the route it owns, and then make such a receiving node not reply the RREP message, thus avoiding the routing loop established by the source node risk, reduces the amount of transmitted data in the link, and saves the energy of the nodes.

附图说明 Description of drawings

下面将参照附图并结合实施例对本发明进行具体说明。The present invention will be specifically described below with reference to the accompanying drawings and examples.

图1为无线传感器网络的工作示意图;Figure 1 is a working schematic diagram of a wireless sensor network;

图2为本发明优选实施例的网络结构示意图;Fig. 2 is a schematic diagram of a network structure of a preferred embodiment of the present invention;

图3为本发明创建分支拓扑序列信息的基本方法流程图;Fig. 3 is the flow chart of the basic method of creating branch topology sequence information in the present invention;

图4为本发明步骤S1的具体实施方式流程图;FIG. 4 is a flow chart of a specific embodiment of step S1 of the present invention;

图5为本发明步骤S3的具体实施方式流程图;Fig. 5 is the specific implementation flow chart of step S3 of the present invention;

图6为本发明在树形网络中避免路由环路的方法流程图。FIG. 6 is a flow chart of the method for avoiding routing loops in a tree network according to the present invention.

其中,图2中的实线表示网络拓扑结构,箭头表示数据汇聚的方向。Wherein, the solid line in FIG. 2 represents the network topology, and the arrow represents the direction of data aggregation.

具体实施方式 Detailed ways

本发明将网络以树形结构进行拓扑层次分配,将汇聚节点(sink节点)作为根节点,并将距离汇聚节点一跳的节点为根节点的子节点即根节点的下一层次节点;每个节点所引出的各分支都是该节点的子树,比如根节点的各个子节点分别引领各自的子树,距离根节点两跳及两跳以上的节点分别属于各个所述根节点的子节点的子树节点;上一跳节点是下一跳节点的父节点,一个节点的父节点及父节点以上层次的节点是该节点的祖先节点。通过这样的树形网络可以将节点之间传输数据的方式基于树形拓扑结构之中,为进一步描述拓扑层次关系提供了网络结构依据。In the present invention, the network is distributed in a tree-like topology, the sink node is used as the root node, and the node that is one hop away from the sink node is the child node of the root node, that is, the next layer node of the root node; each Each branch derived from a node is a subtree of the node. For example, each child node of the root node leads its own subtree, and nodes that are two or more hops away from the root node belong to the child nodes of each root node. Subtree node; the previous hop node is the parent node of the next hop node, and the parent node of a node and the nodes above the parent node are the ancestor nodes of the node. Through such a tree-shaped network, the way of data transmission between nodes can be based on the tree-shaped topology, which provides a network structure basis for further describing the topological hierarchical relationship.

通过向节点分配唯一的拓扑序号,再通过所述拓扑序号记录树形网络中节点之间的拓扑关系,从而形成分支拓扑序列信息。当路由出错时,需要重建路由的源节点重新广播RREQ报文,收到RREQ报文的节点查询所述分支拓扑序列信息来比较自己与所述源节点之间的拓扑层次关系,从而确定处理所述RREQ报文的方式,这样就避免了不分辨拓扑关系而回复路由造成路由环路的风险。下面参照附图并借助本发明的实施例,对本发明的技术方案做详细描述。The branch topology sequence information is formed by allocating unique topological serial numbers to the nodes, and then recording the topological relationship between the nodes in the tree network through the topological serial numbers. When the route is wrong, the source node that needs to rebuild the route re-broadcasts the RREQ message, and the node that receives the RREQ message queries the branch topology sequence information to compare the topology hierarchy between itself and the source node, so as to determine the processing step. The RREQ message is used to avoid the risk of routing loops caused by replying to routes without distinguishing topology relationships. The technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and with the help of embodiments of the present invention.

在本发明中对路由建立过程所使用的RREQ报文、RREP报文进行了格式的改进。In the present invention, the format of the RREQ message and RREP message used in the routing establishment process is improved.

RREQ报文增加了EN字段和RREQ序号字段,所述EN字段是由RREQ报文中的5位保留字段中启用了1位而得来,标识RREQ源节点是否拥有拓扑序号,报文中RREQ序号字段用于存储RREQ报文的源节点的拓扑序号。本发明中RREQ报文格式如下:The RREQ message adds the EN field and the RREQ sequence number field. The EN field is obtained by enabling 1 bit in the 5-bit reserved field in the RREQ message, and identifies whether the RREQ source node has a topology sequence number. The RREQ sequence number in the message The field is used to store the topology number of the source node of the RREQ message. RREQ message format is as follows among the present invention:

RREQ报文格式RREQ message format

具体地,类型为000,表示RREQ报文;EN为0则表示RREQ源节点无拓扑序号,为1表示RREQ源节点有拓扑序号;跳数,表示RREQ源节点到当前节点的跳数;源地址,即RREQ源节点的64比特IPv6地址接口标识符;目的地址,接收RREQ节点的64比特IPv6地址接口标识符;路由请求ID,标识RREQ报文的唯一性ID;最小LQI,从RREQ源节点到当前节点链路质量的最小值;RREQ序号存储RREQ源节点的拓扑序号。Specifically, if the type is 000, it means the RREQ message; if EN is 0, it means that the RREQ source node has no topology number, and if it is 1, it means that the RREQ source node has a topology number; the number of hops means the number of hops from the RREQ source node to the current node; the source address , that is, the 64-bit IPv6 address interface identifier of the RREQ source node; the destination address, the 64-bit IPv6 address interface identifier of the receiving RREQ node; the routing request ID, which identifies the unique ID of the RREQ message; the minimum LQI, from the RREQ source node to The minimum value of the link quality of the current node; the RREQ serial number stores the topology serial number of the RREQ source node.

RREP报文增加了CN字段和分配拓扑序号字段,所述CN字段由RREP报文中的5位保留字段中启用了2位而得来,标识是否有权限分配拓扑序号以及是否有分配能力;分配拓扑序号字段用于存储分配给RREP目的节点即RREQ源节点的拓扑序号。RREP的报文格式如下:The RREP message adds a CN field and an allocation topology number field. The CN field is obtained by enabling 2 bits in the 5-bit reserved field in the RREP message. The topology sequence number field is used to store the topology sequence number assigned to the destination node of the RREP, that is, the source node of the RREQ. The format of the RREP message is as follows:

RREP报文格式RREP packet format

具体地,类型为001,表示RREP报文;CN,第一位表示RREP源节点是否有权限分配序号,0表示无权限,1表示有权限,第二位标识分配拓扑序号字段是否有效,也同时标识该RREP源节点是否有分配能力,0表示分配拓扑序号字段无效即该RREP源节点无分配能力,1表示分配拓扑序号字段有效即该RREP源节点有分配能力;跳数,表示RREP报文从RREP源节点到当前节点的跳数;源地址,RREP源节点即RREQ目的节点的64比特IPv6地址接口标识符;目的地址,接收RREP节点即RREQ源节点的64比特IPv6地址接口标识符;最小LQI,从RREP源节点到当前节点链路质量的最小值;分配拓扑序号,表示RREP源节点分配给RREP目的节点即RREQ源节点的拓扑序号。Specifically, the type is 001, which means RREP message; CN, the first bit indicates whether the RREP source node has the right to assign the serial number, 0 means no authority, 1 means has the right, and the second bit indicates whether the allocation topology number field is valid, and at the same time Indicates whether the RREP source node has distribution capability. 0 indicates that the distribution topology sequence number field is invalid, that is, the RREP source node has no distribution capability; 1, that the distribution topology sequence number field is valid, that is, the RREP source node has distribution capability; The number of hops from the RREP source node to the current node; the source address, the 64-bit IPv6 address interface identifier of the RREP source node, that is, the RREQ destination node; the destination address, the 64-bit IPv6 address interface identifier of the receiving RREP node, that is, the RREQ source node; the minimum LQI , the minimum value of the link quality from the RREP source node to the current node; the assigned topology number indicates the topology number assigned by the RREP source node to the RREP destination node, that is, the RREQ source node.

在本发明中,将树形网络的所有节点划分为一级节点、二级节点和三级节点这三个等级,所述一级节点为所述树形网络的根节点;所述二级节点为所述一级节点的子节点,具有由所述一级节点分配的唯一拓扑序号;所述三级节点为所述一级节点或所述二级节点的子树节点,每个三级节点具有由所述一级节点或所述二级节点分配的唯一拓扑序号,也就是,网络中除一级节点和二级节点外,其余的节点被划分为三级节点,包括一级节点的子节点中除二级节点之外的节点和二级节点的子树节点。In the present invention, all nodes of the tree-shaped network are divided into three grades of first-level nodes, second-level nodes and third-level nodes, the first-level nodes are the root nodes of the tree-shaped network; the second-level nodes It is a child node of the first-level node, and has a unique topological serial number assigned by the first-level node; the third-level node is a subtree node of the first-level node or the second-level node, and each third-level node It has a unique topological serial number assigned by the first-level node or the second-level node, that is, except for the first-level node and the second-level node, the remaining nodes in the network are divided into third-level nodes, including the children of the first-level node Nodes other than secondary nodes and subtree nodes of secondary nodes in the node.

一级节点按照一定的方法确定第一多个二级节点,具体见下文步骤S12的说明。一级节点还具有向二级节点、三级节点分配拓扑序号的权限和分配拓扑序号的能力。二级节点具有向其子树节点分配拓扑序号的权限和分配第二多个拓扑序号的能力。The first-level node determines the first plurality of second-level nodes according to a certain method, see the description of step S12 below for details. The first-level nodes also have the authority to assign topological serial numbers to the second-level nodes and third-level nodes and the ability to assign topological serial numbers. The secondary node has the right to assign topological sequence numbers to its subtree nodes and the ability to assign a second plurality of topological sequence numbers.

所述第一多个和第二多个与设置的拓扑序号的位数和分配规则有关。例如,设置拓扑序号由8位(1字节)的二进制数值表示;拓扑序号的分配规则是:该8位二进制的拓扑序号被分为三个部分,第7位、第6至4位和第3至0位。当一级节点给二级节点分配时,第7位为0,且第3至0位也为0,仅变化第6至4位的值的拓扑序号,因此在本实施例中,所述第一多个至多为7个;当一级节点给三级节点分配时,从第7位为1,第6至4位、第3至0位都为0开始;当二级节点给其子树节点分配时,保持第7位、第6至4位数值分别与二级节点的拓扑序号相同位的值一致,仅变化第3至0位的值,因此在本实施例中,所述第二多个至多为15个。The first multiple and the second multiple are related to the number of digits of the set topology serial number and the allocation rule. For example, set the topology serial number to be represented by an 8-bit (1 byte) binary value; the distribution rule of the topology serial number is: the 8-bit binary topology serial number is divided into three parts, the 7th bit, the 6th to 4th bits and the 3 to 0 digits. When the first-level node is assigned to the second-level node, the seventh bit is 0, and the third to zero bits are also 0, and only the topological sequence number of the value of the sixth to fourth bits is changed. Therefore, in this embodiment, the first There are at most 7 ones; when a first-level node is assigned to a third-level node, the seventh bit is 1, the sixth to fourth, and the third to 0th are all 0; when the second level node is assigned to its subtree When assigning nodes, keep the 7th, 6th to 4th digits respectively consistent with the values of the topological serial numbers of the secondary nodes, and only change the 3rd to 0th values, so in this embodiment, the second Multiple up to 15.

如图2所示,一级节点(sink节点)确定了其子节点中的节点A、B、C、D、E、F、G 7个节点为二级节点,分别向这7个二级节点分配以下拓扑序号:0 001 0000、0 010 0000、0 011 0000、0 100 0000、0 101 0000、0 110 0000、0 1110000(本说明书为了方便区分拓扑序号的三部分各自的变化而添加了空格,实际中拓扑序号各位之间无空格,以下同);对于一级节点的其他子节点如H节点被划分为三级节点,一级节点向其分配的拓扑序号从1 000 0000开始;二级节点比如节点A向其子树节点分配的拓扑序号分别为:0 001 0001、0 0010 010、0 001 0011、0 001 0100、……、0 001 1110、0 001 1111,可见二级节点具有至多15个拓扑序号的分配能力。As shown in Figure 2, the first-level node (sink node) determines that seven nodes of its child nodes, A, B, C, D, E, F, and G, are second-level nodes, and the seven second-level nodes are respectively sent Assign the following topological serial numbers: 0 001 0000, 0 010 0000, 0 011 0000, 0 100 0000, 0 101 0000, 0 110 0000, 0 1110000 (this manual adds spaces for the convenience of distinguishing the changes of the three parts of the topological serial number, In practice, there are no spaces between the topological serial numbers, the same below); for other child nodes of the first-level nodes such as H nodes, they are divided into third-level nodes, and the topological serial numbers assigned to them by the first-level nodes start from 1 000 0000; the second-level nodes For example, the topological serial numbers assigned by node A to its subtree nodes are: 0 001 0001, 0 0010 010, 0 001 0011, 0 001 0100, ..., 0 001 1110, 0 001 1111. It can be seen that the secondary nodes have at most 15 The ability to assign topology numbers.

分支拓扑序列信息是通过所述拓扑序号分别记录所述树形网络中根节点的各子树的拓扑关系。本发明中分支拓扑序列信息可以以树的存储方式表达,将节点的拓扑序号按照节点的拓扑层次排列,上下层次节点之间利用1字节的0即00000000分隔。The branch topology sequence information is to respectively record the topology relationship of each subtree of the root node in the tree network through the topology sequence number. In the present invention, branch topological sequence information can be expressed in a tree storage manner, and the topological serial numbers of the nodes are arranged according to the topological levels of the nodes, and the nodes of the upper and lower levels are separated by 0 of 1 byte, that is, 00000000.

例如图2中一级节点的节点A子树的拓扑关系由分支拓扑序列信息记录,利用树的存储方式表达为:For example, the topological relationship of the node A subtree of the first-level node in Figure 2 is recorded by the branch topology sequence information, and expressed as:

00010000 00000000 00010001 00010010 00000000 00010100 00010011(本说明书为了方便区分分支拓扑序列信息中各拓扑序号而添加了空格,实际中各拓扑序号之间无空格,以下同);00010000 00000000 00010001 00010010 00000000 00010100 00010011 (in this manual, spaces are added for the convenience of distinguishing each topology number in the branch topology sequence information. In practice, there are no spaces between each topology number, the same below);

节点B子树的分支拓扑序列信息表达为:The branch topology sequence information of node B subtree is expressed as:

00100000 00000000 00100001;00100000 00000000 00100001;

节点C子树的分支拓扑序列信息表达为:The branch topology sequence information of node C subtree is expressed as:

00110000 00000000 00110001 00000000 00110010 00000000 0011001100110000 00000000 00110001 00000000 00110010 00000000 00110011

如图3,本发明还提供一种在树形网络中创建分支拓扑序列信息的方法,包括:As shown in Figure 3, the present invention also provides a method for creating branch topology sequence information in a tree network, including:

步骤S1、在初始建立路由阶段分配拓扑序号,也就是,所有无路由的节点需初始建立到汇聚节点的路由,本发明利用建立路由的过程进行拓扑序号的分配并通过分配拓扑序号生成当前的分支拓扑序列信息。Step S1, distribute the topology sequence number in the stage of initially establishing the route, that is, all nodes without routes need to initially establish the route to the aggregation node, the present invention uses the process of establishing the route to distribute the topology sequence number and generate the current branch by assigning the topology sequence number Topological sequence information.

步骤S2、一级节点的子节点向其子树节点多播所述分支拓扑序列信息。将一级节点的子树当前的分支拓扑序列信息多播给该子树中的节点,这样每个子树节点在经过步骤S3后可以掌握所在根节点子树的整体拓扑结构以及自身与其他该根节点子树中的节点之间的拓扑层次关系。Step S2, the child nodes of the primary node multicast the branch topology sequence information to their subtree nodes. Multicast the current branch topology sequence information of the subtree of the first-level node to the nodes in the subtree, so that each subtree node can grasp the overall topology structure of the root node subtree and the relationship between itself and other root nodes after step S3. The topological hierarchical relationship between nodes in the node subtree.

步骤S3、所述子树节点存储所述分支拓扑序列信息。Step S3, the subtree node stores the branch topology sequence information.

步骤S4、判断是否还存在未获得拓扑序号的节点,如果网络中还存在未获得拓扑序号的节点,则进入步骤S5。Step S4 , judging whether there are nodes that have not obtained topological serial numbers, and if there are still nodes in the network that have not obtained topological serial numbers, go to step S5 .

由于在初始建立路由阶段,从汇聚节点开始,依次由上一层次节点向其下一层次节点回复RREP报文从而逐步使每个节点都建立到汇聚节点的路由。但由于三级节点的分布情况不同,三级节点不一定都可以在建立路由阶段获得拓扑序号。比如一级节点的子节点中除二级节点之外的节点,不具有分配拓扑序号的权限,这样的三级节点的子节点在建立路由时无法获得拓扑序号;比如二级节点只能分配第二多个拓扑序号的能力,对于超过该第二多个的二级节点的子节点在建立路由时也无法获得拓扑序号。而且如果网络中还具有更多向下层次的三级节点,也无法在其父节点向其建立路由时获得拓扑序号,因此,其中距离二级节点两跳或两跳以上的节点,都需要通过步骤S5获得拓扑序号。如图2所示,节点M收到节点I给予的路由回复后建立路由,但是节点I没有分配序号的权限,因此节点M在路由建立结束后未获得拓扑序号。所以步骤S1中生成的分支拓扑序列信息只能记录已获得拓扑序号的节点之间的拓扑层次关系。Since in the initial route establishment stage, starting from the aggregation node, the upper layer nodes reply RREP messages to the lower layer nodes in turn, so that each node gradually establishes a route to the aggregation node. However, due to the different distribution of the third-level nodes, the third-level nodes may not all be able to obtain the topology sequence number during the route establishment phase. For example, nodes other than the second-level nodes among the sub-nodes of the first-level nodes do not have the authority to assign topological serial numbers, and the sub-nodes of such third-level nodes cannot obtain the topological serial numbers when establishing routes; for example, the second-level nodes can only assign the first With the capability of two or more topological serial numbers, the child nodes of the secondary nodes exceeding the second multiple cannot obtain the topological serial numbers when establishing routes. Moreover, if there are more third-level nodes in the downward hierarchy in the network, it is impossible to obtain the topology number when its parent node establishes a route to it. Therefore, nodes that are two or more hops away from the second-level node need to pass Step S5 obtains the topology number. As shown in Figure 2, node M establishes a route after receiving the route reply from node I, but node I does not have the authority to assign serial numbers, so node M does not obtain the topology serial number after the route is established. Therefore, the branch topology sequence information generated in step S1 can only record the topological hierarchical relationship between the nodes that have obtained the topology sequence numbers.

步骤S5、向所述未获得拓扑序号的节点补分配拓扑序号并更新分支拓扑序列信息,并返回步骤S3。本发明增加了拓扑序号交互报文,通过拓扑序号交互报文,节点可以请求拓扑序号或者向其它节点分配拓扑序号,并传递更新的分支拓扑序列信息。拓扑序号交互报文的格式如下:Step S5, assign topological serial numbers to the nodes that have not obtained topological serial numbers and update branch topology sequence information, and return to step S3. The invention adds a topological serial number interactive message, through which a node can request a topological serial number or distribute a topological serial number to other nodes, and transmit updated branch topology serial information. The format of the topology sequence number interaction message is as follows:

拓扑序号交互报文格式Topology Sequence Number Interaction Message Format

其中,类型:011,表示分支拓扑序号交互报文;SN:00表示分支拓扑序号请求报文,01表示分支拓扑序号更新报文,10表示路由通告报文,11保留;S/D:表示本报文中的地址字段是源地址或目的地址,0表示源地址,1表示目的地址;跳数:表示分支拓扑序号交互报文从源节点到目的节点的最大跳数。序列长度:表示分支拓扑序列字段的长度,长度字段的数值为几就代表分支拓扑序列实际长度为几字节;地址:用于存储发出该报文的源节点的64比特IPv6地址接口标识符或接收该报文的目的节点的64比特IPv6地址接口标识符;分支拓扑序号交互报文ID:分支拓扑序号交互报文的唯一性标识;节点序号:表示被分配的分支拓扑序号或者源节点的拓扑序号;分支拓扑序列:用于存储分支拓扑序列信息。Among them, Type: 011, indicates the branch topology sequence number interaction message; SN: 00 represents the branch topology sequence number request message, 01 represents the branch topology sequence number update message, 10 represents the route notification message, and 11 is reserved; S/D: represents the current The address field in the message is the source address or destination address, 0 means the source address, 1 means the destination address; hop count: indicates the maximum hop number of the branch topology sequence number interaction message from the source node to the destination node. Sequence length: Indicates the length of the branch topology sequence field, the value of the length field represents the actual length of the branch topology sequence in bytes; address: used to store the 64-bit IPv6 address interface identifier or The 64-bit IPv6 address interface identifier of the destination node receiving the message; the branch topology serial number interaction message ID: the unique identification of the branch topology serial number interaction message; the node serial number: indicating the assigned branch topology serial number or the topology of the source node Serial number; branch topology sequence: used to store branch topology sequence information.

其中跳数字段所设置的最大跳数可以帮助支路的节点判断是否需要继续转发该报文,也就是说,交互报文每经过一次转发跳数值就减1,当某节点收到该交互报文并将跳数减1后得0时,判断出自己就是网络树形拓扑层次的末端节点(即叶节点),这样该节点不需要再试图向前转发该报文,而直接停止转发,从而节约了节点的能量。跳数字段的值可以根据网络的大小预先设定,也可以根据路由表中存储的跳数设定。Among them, the maximum hop count set by the hop count field can help the nodes of the branch to judge whether to continue forwarding the message. When the text and the hop count are reduced by 1 to get 0, it is judged that it is the end node (ie leaf node) of the network tree topology level, so that the node does not need to try to forward the message forward, but directly stops forwarding, thus Save the energy of the node. The value of the hop count field can be preset according to the size of the network, or can be set according to the hop count stored in the routing table.

当然,步骤S2也可以后于步骤S4、S5进行,即先判断是否存在未获得拓扑序号的节点,存在未获得拓扑序号的节点时先补分配拓扑序号并更新分支拓扑序列信息后,再执行步骤S2进行当前分支拓扑序列信息的多播。Of course, step S2 can also be carried out after steps S4 and S5, that is, first determine whether there are nodes that have not obtained the topology number, and if there is a node that has not obtained the topology number, first assign the topology number and update the branch topology sequence information, and then execute the step S2 multicasts the current branch topology sequence information.

进一步地,在步骤S2也可以利用多播分支拓扑序号更新报文的方式发送分支拓扑序列信息,比如图2中二级节点B启用分支拓扑序号交互报文,即类型字段置为011,并将SN字段置为01,表示分支拓扑序号更新报文;将生成的分支拓扑序列信息00100000 00000000 00100001存入分支拓扑序列字段,由于该分支拓扑序列信息为3字节,因此将代表3的二进制数值00000011存入序列长度字段;在S/D字段置0,表示地址字段为源地址;在地址字段存入该二级节点的64比特IPv6地址接口标识符;跳数置为1,这样在分支拓扑序号更新报文从二级节点B多播至其子节点时,跳数减1后得0,这样可以使二级节点B的子节点不再转发该报文。在本实施例中,节点B的子节点仅有节点K,因此节点B将携带分支拓扑序列信息00100000 00000000 00100001的分支拓扑序号更新报文发送给节点K。Further, in step S2, the branch topology sequence information can also be sent in the form of a multicast branch topology sequence number update message, for example, in Figure 2, the secondary node B enables the branch topology sequence number interaction message, that is, the type field is set to 011, and the The SN field is set to 01, indicating that the branch topology sequence number is updated; the generated branch topology sequence information 00100000 00000000 00100001 is stored in the branch topology sequence field. Since the branch topology sequence information is 3 bytes, it will represent the binary value of 3 00000011 Store in the sequence length field; set 0 in the S/D field, indicating that the address field is the source address; store the 64-bit IPv6 address interface identifier of the secondary node in the address field; set the hop count to 1, so that the branch topology sequence number When the update message is multicast from the secondary node B to its child nodes, the hop count is reduced by 1 to get 0, so that the child nodes of the secondary node B will no longer forward the message. In this embodiment, the only child node of node B is node K, so node B sends a branch topology sequence number update message carrying branch topology sequence information 00100000 00000000 00100001 to node K.

如图4所示,步骤S1在初始建立路由阶段分配拓扑序号并生成分支拓扑序列信息还包括以下子步骤:As shown in Figure 4, step S1 assigns the topology sequence number and generates the branch topology sequence information in the initial route establishment stage, which also includes the following sub-steps:

步骤S11、节点发送RREQ报文,其中RREQ报文中的EN字段置0,RREQ序号字段也置0,表示RREQ源节点无拓扑序号,且RREQ序号字段没有存储拓扑序号。Step S11, the node sends a RREQ message, wherein the EN field in the RREQ message is set to 0, and the RREQ sequence number field is also set to 0, indicating that the source node of the RREQ has no topology sequence number, and the RREQ sequence number field does not store a topology sequence number.

步骤S12、一级节点向其子节点回复RREP报文并通过RREP报文分配拓扑序号。其中,一级节点可以按照回复所述RREP报文的顺序确定二级节点比如将前第一多个RREP报文的目的节点作为二级节点,但不限于这种方式,也可以通过人为指定方式或以及一级节点发送控制包方式等。Step S12, the first-level node replies the RREP message to its child nodes and distributes the topology sequence number through the RREP message. Among them, the first-level node can determine the second-level node according to the order in which the RREP message is replied. For example, the destination node of the first multiple RREP messages is used as the second-level node, but it is not limited to this method, and can also be manually specified. Or and the way the first-level node sends the control packet, etc.

优选地,如图2,拓扑序号用8位二进制数值表示,一级节点向前7个RREP报文的分配拓扑序号字段分别存入拓扑序号0 001 0000、0 010 0000、0 0110000、0 100 0000、0 101 0000、0 110 0000、0 111 0000,并将RREP报文的CN字段的第一位和第二位置1,表示一级节点既有权限分配拓扑序号,又有分配能力,RREP报文中的分配拓扑序号字段的值有效。分别接收前7个RREP报文的节点A、B、C、D、E、F、G成为二级节点,建立到一级节点的路由并将接收到的RREP报文中携带的拓扑序号记录为自己的拓扑序号,如节点A的拓扑序号为0 001 0000,节点B的拓扑序号为0 010 0000,节点C的拓扑序号为0 011 0000。Preferably, as shown in Figure 2, the topology sequence number is represented by an 8-bit binary value, and the topological sequence number fields of the first 7 RREP messages are stored in the topology sequence number 0 001 0000, 0 010 0000, 0 0110000, 0 100 0000 respectively . The value of the Allocation Topology Sequence Number field in is valid. The nodes A, B, C, D, E, F, and G that received the first 7 RREP messages respectively become the second-level nodes, establish routes to the first-level nodes, and record the topology sequence numbers carried in the received RREP messages as Its own topology number, such as the topology number of node A is 0 001 0000, the topology number of node B is 0 010 0000, and the topology number of node C is 0 011 0000.

一级节点继续给其他子节点如图2中的节点H回复RREP报文并通过该RREP报文携带拓扑序号,并从1 000 0000开始分配。节点H属于三级节点,不具有向其子树节点分配拓扑序号的权限。The first-level node continues to reply RREP messages to other child nodes as shown in node H in Figure 2, and carries the topology sequence number through the RREP message, and starts to allocate from 1 000 0000. Node H is a third-level node and does not have the right to assign topological numbers to its subtree nodes.

步骤S13、二级节点向其子节点回复RREP报文建立路由,将RREP报文中的CN字段的第一位置1,第二位置1,表示RREP源节点既具有分配权限,又具备分配能力,报文中分配拓扑序号字段的值有效,并将拓扑序号存入该RREP报文的分配拓扑序号字段。Step S13, the secondary node replies the RREP message to its child node to establish a route, and sets the first position of the CN field in the RREP message to 1, and the second position to 1, indicating that the RREP source node has both allocation authority and allocation capability, The value of the allocated topology sequence number field in the message is valid, and the topology sequence number is stored in the allocated topology sequence number field of the RREP message.

如图2,二级节点A向其两个子节点I、J分别回复RREP报文,回复给节点I的RREP报文的分配拓扑序号字段为0 001 0001,回复给节点J的RREP报文的分配拓扑序号字段为0 001 0010;二级节点B向其子节点K回复的RREP报文的分配拓扑序号字段为0 010 0001;二级节点C向其子节点L回复的RREP报文的分配拓扑序号字段为0 011 0001。As shown in Figure 2, the secondary node A replies RREP messages to its two child nodes I and J respectively, the distribution topology sequence number field of the RREP message replying to node I is 0 001 0001, and the distribution of the RREP message replying to node J The topology sequence number field is 0 001 0010; the distribution topology sequence number field of the RREP message that the secondary node B replies to its child node K is 0 010 0001; the distribution topology sequence number of the RREP message that the secondary node C replies to its child node L The field is 0 011 0001.

并且,二级节点根据其各子节点发来的RREQ报文所记录的跳数和路径生成该二级节点、该二级节点的各子节点之间的分支拓扑序列信息。Moreover, the secondary node generates branch topology sequence information between the secondary node and its child nodes according to the hop count and path recorded in the RREQ message sent by its child nodes.

需要指出的是,由于每个二级节点具有第二多个拓扑序号的分配能力,如果某个二级节点的子节点超过该第二多个,那么这时该二级节点已不再具有分配能力,这时二级节点所回复的RREP报文的CN字段的第一位置1,而第二位置0,表示该二级节点具有分配权限,但已无分配能力,该RREP报文中分配拓扑序号字段中的值无效,因此除第二多个之外的该二级节点的子节点无法通过RREP报文获得拓扑序号。另外,如果某个二级节点的子节点不足第二多个,则该二级节点在向其子节点全部回复分配有拓扑序号的RREP报文后,依然具有分配能力。It should be pointed out that since each secondary node has the ability to allocate a second number of topological serial numbers, if a child node of a certain secondary node exceeds the second multiple, then the secondary node no longer has the ability to allocate At this time, the first position of the CN field of the RREP message replied by the secondary node is 1, and the second position is 0, indicating that the secondary node has the allocation authority, but has no allocation ability, and the allocation topology in the RREP message The value in the sequence number field is invalid, so the child nodes of the secondary node except the second one cannot obtain the topology sequence number through the RREP message. In addition, if a secondary node has less than the second largest number of child nodes, the secondary node still has the allocation capability after replying to all its child nodes with RREP messages assigned topology numbers.

步骤S14、获得路由的三级节点如果接收到了该三级节点的子节点发来的RREQ请求建立路由,则该三级节点继续向其子节点回复RREP报文建立路由,但三级节点不具有分配拓扑序号的权限,所以由三级节点回复的RREP报文中的CN字段第一位和第二位都置0,表示该三级节点既无分配权限也无分配能力。并且,三级节点根据其各子节点发来的RREQ报文所记录的跳数和路径生成该三级节点及该三级节点的各子节点之间的分支拓扑序列信息。至此完成网络的初始路由建立过程。Step S14, if the third-level node that has obtained the route receives the RREQ request from the child node of the third-level node to establish the route, the third-level node will continue to reply the RREP message to its child node to establish the route, but the third-level node does not have The right to allocate topology serial numbers, so the first and second bits of the CN field in the RREP message replied by the third-level node are both set to 0, indicating that the third-level node has neither allocation authority nor allocation ability. Moreover, the third-level node generates branch topology sequence information between the third-level node and each child node of the third-level node according to the hop count and the path recorded in the RREQ message sent by each child node of the third-level node. So far, the initial route establishment process of the network is completed.

如图5所示,步骤S4向所述未获得拓扑序号的节点补分配拓扑序号并更新分支拓扑序列信息还包括以下子步骤:As shown in Figure 5, step S4 assigns a topological serial number to the node that has not obtained a topological serial number and updates branch topology sequence information also includes the following sub-steps:

步骤S51、所述未获得拓扑序号的节点发送分支拓扑序号请求报文;Step S51, the node that has not obtained the topology sequence number sends a branch topology sequence number request message;

步骤S52、根据分支拓扑序号请求报文所经过的节点记录当前的分支拓扑序列信息;Step S52, recording the current branch topology sequence information according to the nodes through which the branch topology sequence number request message passes;

步骤S53、接收所述分支拓扑序号请求报文的节点判断自己是否具有分配拓扑序号的权限,如果是则进入步骤S54,如果否则进入步骤S56;Step S53, the node receiving the branch topology serial number request message judges whether it has the authority to assign a topology serial number, if yes, proceed to step S54, otherwise proceed to step S56;

步骤S54、所述接收所述分支拓扑序号请求报文的节点判断自己是否具有分配能力,如果是则进入步骤S55,如果否则进入步骤S56;Step S54, the node receiving the branch topology sequence number request message judges whether it has the allocation capability, if yes, proceed to step S55, if not, proceed to step S56;

步骤S55、所述接收所述分支拓扑序号请求报文的节点向其子树节点发送携带有拓扑序号和分支拓扑序列信息的分支拓扑序号更新报文,进入步骤S57;Step S55, the node receiving the branch topology sequence number request message sends a branch topology sequence number update message carrying the topology sequence number and branch topology sequence information to its subtree node, and enters step S57;

步骤S56、所述接收所述分支拓扑序号请求报文的节点转发所述分支拓扑序号请求报文,返回步骤S52;Step S56, the node receiving the branch topology serial number request message forwards the branch topology serial number request message, and returns to step S52;

步骤S57、所述未获得拓扑序号的节点获得所述拓扑序号。Step S57, the node that has not obtained the topology sequence number obtains the topology sequence number.

例如,如图2所示,在路由建立过程中,由于节点N在路由建立中未被分配到拓扑序号。因此节点N执行步骤S5,首先执行步骤S51、节点N发送分支拓扑序号请求报文,该拓扑序号请求报文格式中,类型字段为011,SN字段置00,S/D字段置0,即地址字段为源地址,在地址字段写源节点即节点N的地址,节点序号字段、分支拓扑序列字段、序号长度字段均置0。该分支拓扑序号请求报文会经过节点J,在步骤S52中,该分支拓扑序号请求报文会记录当前的分支拓扑序列信息,比如当前的分支拓扑序列信息记录了节点A、I、J、的拓扑层次关系即00010000 00000000 00010001 00010010,并且记录节点N是节点J的下一层次节点。在步骤S53中,节点J判断出自己不具有分配权限,因此执行步骤S56将分支拓扑序号请求报文转发至节点A,节点A也执行步骤S52,记录当前的分支拓扑序列信息,比如当前的分支拓扑序列信息记录了节点A、I、J、M的拓扑层次关系即00010000 00000000 00010001 0001001000000000 00010100,并记录节点N所在的拓扑层次。节点A执行步骤S53,判断出自己具有分配权限,执行步骤S54,判断自己是否具有分配能力。For example, as shown in FIG. 2 , during the route establishment process, node N is not assigned a topology number during route establishment. Therefore, node N executes step S5, first executes step S51, and node N sends a branch topology sequence number request message. In the topology sequence number request message format, the type field is 011, the SN field is set to 00, and the S/D field is set to 0, which is the address The field is the source address, and the address of the source node, that is, node N, is written in the address field, and the node sequence number field, branch topology sequence field, and sequence number length field are all set to 0. The branch topology sequence number request message will pass through node J, and in step S52, the branch topology sequence number request message will record the current branch topology sequence information, such as the current branch topology sequence information records nodes A, I, J, The topological hierarchical relationship is 00010000 00000000 00010001 00010010, and it is recorded that node N is the next level node of node J. In step S53, node J judges that it does not have the allocation authority, so it executes step S56 to forward the branch topology sequence number request message to node A, and node A also executes step S52 to record the current branch topology sequence information, such as the current branch Topological sequence information records the topological hierarchical relationship of nodes A, I, J, and M, namely 00010000 00000000 00010001 0001001000000000 00010100, and records the topological hierarchy of node N. Node A executes step S53 to determine whether it has the allocation authority, and executes step S54 to determine whether it has the allocation ability.

如果节点A分配的拓扑序号数量未达到第二多个,则此时节点A仍具有分配拓扑序号的能力,节点A执行步骤S55,节点A要分配拓扑序号0001 0011给节点N,启动分支拓扑序号更新报文,类型字段置011,SN字段置01,将拓扑序号0001 0011存入节点序号字段,将分支拓扑序号请求报文所记录的分支拓扑序列信息结合节点N的拓扑序号更新分支拓扑序列信息为:If the number of topology serial numbers allocated by node A does not reach the second most, then node A still has the ability to allocate topology serial numbers at this time, node A executes step S55, node A will assign topology serial numbers 0001 0011 to node N, and start branch topology serial numbers Update the message, set the type field to 011, set the SN field to 01, store the topology sequence number 0001 0011 in the node sequence number field, and combine the branch topology sequence information recorded in the branch topology sequence number request message with the topology sequence number of node N to update the branch topology sequence information for:

00010000 00000000 00010001 00010010 00000000 00010100 00010011,并存入分支拓扑序列字段,由于该分支拓扑序列信息为7字节,因此将代表7的二进制数值00000111存入序列长度字段;在S/D字段置1,表示地址字段为目的节点地址即节点N的地址;在地址字段存入节点N的64比特IPv6地址接口标识符;跳数置为2,节点A向其子树的所有节点多播发送该分支拓扑序号更新报文。00010000 00000000 00010001 00010010 00000000 00010100 00010011, and store it in the branch topology sequence field. Since the branch topology sequence information is 7 bytes, the binary value 00000111 representing 7 is stored in the sequence length field; set 1 in the S/D field, indicating The address field is the address of the destination node, that is, the address of node N; the 64-bit IPv6 address interface identifier of node N is stored in the address field; the hop count is set to 2, and node A multicasts the branch topology sequence number to all nodes of its subtree Update message.

如果节点A已经分配完第二多个拓扑序号,则此时节点A不具有分配能力,节点A执行步骤S56,继续向汇聚节点(sink节点)转发,sink节点经过步骤S53、S54的判断,具备分配权限和分配能力,因此由sink节点给节点N分配拓扑序号,并向节点A发送携带有拓扑序号和当前分支拓扑序列信息的分支拓扑序号更新报文,再由节点A向其子树的所有节点多播转发该分支拓扑序号更新报文。If node A has allocated the second plurality of topology serial numbers, then node A does not have the ability to allocate at this time, node A executes step S56, and continues to forward to the sink node (sink node), and the sink node is judged by steps S53 and S54, and has Allocate permissions and capabilities, so the sink node assigns a topology number to node N, and sends a branch topology number update message carrying the topology number and the current branch topology sequence information to node A, and then node A sends a message to all its subtrees. The node multicasts and forwards the branch topology sequence number update message.

步骤S57,节点N获得了拓扑序号00010011。In step S57, the node N obtains the topology number 00010011.

步骤S5中,节点A的子树的所有节点包括节点N在内,通过分支拓扑序号更新报文获得了最新的分支拓扑序列信息。因此均将其存储并更新为自己的分支拓扑序列信息。从而创建完毕节点A子树的分支拓扑序列信息。In step S5, all nodes in the subtree of node A including node N obtain the latest branch topology sequence information through the branch topology sequence number update message. Therefore, it is stored and updated as its own branch topology sequence information. Thus, the branch topology sequence information of the node A subtree is created.

进一步地,分支拓扑更新报文可以定时发送,从而保证子树节点能够实时获得最新的分支拓扑序列信息。Furthermore, the branch topology update message can be sent regularly, so as to ensure that the subtree nodes can obtain the latest branch topology sequence information in real time.

进一步地,如果接收所述分支拓扑序号请求报文或所述分支拓扑序号更新报文的节点再次收到重复的分支拓扑序号请求报文,则直接丢弃。由于发出分支拓扑序号交互报文时,可能会经过多条路径转发,因此接收该分支拓扑序号交互报文的节点可能会接收到多个重复的报文,为避免该节点重复处理同样的报文,该节点将再次收到的重复报文直接丢弃。Further, if the node receiving the branch topology sequence number request message or the branch topology sequence number update message receives a duplicate branch topology sequence number request message again, it will discard it directly. Since the branch topology sequence number interaction message is sent, it may be forwarded through multiple paths, so the node receiving the branch topology sequence number interaction message may receive multiple duplicate messages. To avoid the node repeatedly processing the same message , the node directly discards the duplicate message received again.

本发明增加了分支拓扑序号交互报文入口表来判断接收到的分支拓扑序号交互报文是否重复,该入口表格式为:The present invention adds a branch topology serial number interactive message entry table to judge whether the received branch topology serial number interactive message is repeated, and the entry table format is:

分支拓扑序号交互报文入口表Branch Topology Sequence Number Interaction Message Entry Table

具体地,分支拓扑序号报文源地址:发起分支拓扑序号交互报文节点的64比特IPv6地址接口标识符;分支拓扑序号交互报文ID:用于存储分支拓扑序号交互报文中的分支拓扑序号交互报文ID字段的值;生存时间:该入口表项的生存时间。Specifically, the source address of the branch topology sequence number message: the 64-bit IPv6 address interface identifier of the node that initiates the branch topology sequence number interaction message; the branch topology sequence number interaction message ID: used to store the branch topology sequence number in the branch topology sequence number interaction message The value of the ID field of the interaction message; lifetime: the lifetime of the entry entry.

将节点第一次收到分支拓扑序号交互报文,它会把该报文的源地址和分支拓扑序号交互报文ID分别存入入口表中分支拓扑序号报文源地址字段和分支拓扑序号交互报文ID字段,当该节点再次收到一个分支拓扑序号交互报文时,会将这个报文的源地址和ID分别与所述入口表中已存储的源地址和ID进行比较,如果二者的源地址和ID分别一样,那么该节点不会再次处理这个报文,而是直接丢弃。When the node receives the branch topology sequence number interaction message for the first time, it will store the source address of the message and the branch topology sequence number interaction message ID in the entry table respectively in the source address field of the branch topology sequence number message and the branch topology sequence number interaction Message ID field, when the node receives a branch topology sequence number interaction message again, it will compare the source address and ID of this message with the source address and ID stored in the entry table, if the two source address and ID are the same respectively, then the node will not process the message again, but discard it directly.

当网络运行稳定后,如果有新节点加入该网络,重复上述步骤S1至S5,但是,由于网络的不断变化,该新节点的邻居节点所维护的路由表中如果不存在有效路由,那么该新节点的RREQ报文需要经过多跳才能获得RREP报文的回复,在本发明中,为了保持与初始建立路由时的一致性,设计距离二级节点两跳以上的节点只能通过步骤S5的分支拓扑序号请求和更新报文获得拓扑序号,而不能通过二级节点回复RREP报文来获得拓扑序号,即使该二级节点还具有分配能力。具体地,如果为该新节点回复RREP报文的节点恰好是还具有分配能力的二级节点时,二级节点通过判断接收到的RREQ的跳数值是否大于1来决定回复的RREP报文是否携带要分配的拓扑序号,如果跳数值大于1,则二级节点将要回复的RREP报文中的CN字段第一位置1,而将第二位置0,从而把分配拓扑序号的过程放在后续的步骤S5执行。When the network is running stably, if a new node joins the network, repeat the above steps S1 to S5. The RREQ message of the node needs to go through multiple hops to obtain the reply of the RREP message. In the present invention, in order to maintain the consistency with the initial route establishment, the design distance from the node of the secondary node more than two hops can only pass through the branch of step S5 The topology sequence number is obtained through the topology sequence number request and update messages, but the topology sequence number cannot be obtained through the reply of the RREP message by the secondary node, even if the secondary node still has the allocation capability. Specifically, if the node that replies the RREP message for the new node happens to be a second-level node that still has the ability to allocate, the second-level node determines whether the returned RREP message carries The topology number to be assigned, if the hop value is greater than 1, the secondary node will set the first position of the CN field in the RREP message to be replied as 1, and set the second position to 0, so that the process of assigning the topology number is placed in the next step S5 executes.

在经过上述创建分支拓扑序列信息的过程,网络进入数据通信过程,在通信过程中,若有节点例如图2中的节点O发送数据包未收到回复,则说明节点O到汇聚节点的链路出错,需要该节点重新广播RREQ报文,重新建立路由。After the above-mentioned process of creating branch topology sequence information, the network enters the data communication process. During the communication process, if a node such as node O in Figure 2 sends a data packet but does not receive a reply, it means that the link between node O and the sink node If an error occurs, the node needs to re-broadcast the RREQ message to re-establish the route.

为了避免路由环路,本发明还提供一种在树形网络中避免路由环路的方法,如图6所示,包括:In order to avoid routing loops, the present invention also provides a method for avoiding routing loops in a tree network, as shown in Figure 6, including:

S601、源节点广播RREQ报文,收到该RREQ报文的节点查询所述分支拓扑序列信息;S601. The source node broadcasts a RREQ message, and the node receiving the RREQ message queries the branch topology sequence information;

例如,节点O发送RREQ报文并附带了源节点O所拥有的拓扑序号00110010,并且将RREQ报文中的EN字段置1,表示该源节点O具有拓扑序号。接收到RREQ报文的节点L、P各自查询自己所存储的分支拓扑序列信息,即节点C子树的分支拓扑序列信息:For example, node O sends a RREQ message and attaches the topology number 00110010 owned by the source node O, and sets the EN field in the RREQ message to 1, indicating that the source node O has a topology number. Nodes L and P receiving the RREQ message query their own stored branch topology sequence information, that is, the branch topology sequence information of the subtree of node C:

00110000 00000000 00110001 00000000 00110010 00000000 00110011。00110000 00000000 00110001 00000000 00110010 00000000 00110011.

S602、比对源节点拓扑序号和接收到RREQ报文的节点自身的拓扑序号在分支拓扑序列信息中的拓扑层次关系,判断源节点是否为所述收到该RREQ报文的节点的祖先节点。S602. Compare the topology number of the source node with the topology hierarchy of the node receiving the RREQ message in the branch topology sequence information, and determine whether the source node is an ancestor node of the node receiving the RREQ message.

S603、如果否,则所述收到该RREQ报文的节点响应该RREQ报文,该收到RREQ报文的节点查询路由表是否有到目的节点即汇聚节点的有效路由,若有有效路由,则直接回复RREP报文。若无有效路由,则进一步向其父节点转发,并查询当前接收RREQ报文的节点路由表的有无有效路由,直到具有有效路由的节点回复RREP报文。S603. If not, the node that received the RREQ message responds to the RREQ message, and the node that receives the RREQ message queries the routing table to see if there is an effective route to the destination node, that is, the sink node. If there is an effective route, Then reply the RREP message directly. If there is no effective route, then further forward to its parent node, and query whether there is an effective route in the routing table of the node currently receiving the RREQ message, until the node with an effective route replies to the RREP message.

例如图2中,在节点L的拓扑序号0011 0001处于节点O的拓扑序号00110010的上一层次,因此节点O不是节点L的祖先节点,因此节点L在其路由表具有有效路由时,向节点O回复RREP报文建立路由,在不具有有效路由时,向更上一层次节点C转发,直到有节点回复RREP报文。For example, in Figure 2, the topology number 0011 0001 of node L is at the upper level of node O's topology number 00110010, so node O is not the ancestor node of node L, so node L sends to node O when its routing table has a valid route. Reply the RREP message to establish a route, and if there is no valid route, forward it to the node C at the higher level until a node replies with the RREP message.

根据RREQ报文的EN字段值为1,该RREP报文只用来建立路由而不需要分配拓扑序号,因此,即使回复RREP报文的节点是具有分配拓扑序号权限和能力的二级节点甚至一级节点,该RREP报文中的CN字段第一位置1,第二位置0。从而避免了RREQ源节点在收到RREP报文时再解析该报文分配拓扑序号字段,从而节省了节点能量。According to the value of the EN field of the RREQ message is 1, the RREP message is only used to establish a route and does not need to assign a topology number. For a level node, the first position of the CN field in the RREP message is 1, and the second position is 0. Therefore, it is avoided that the RREQ source node parses the packet allocation topology sequence number field when receiving the RREP packet, thereby saving node energy.

S604、如果是,则所述收到该RREQ报文的节点不响应该RREQ报文。S604. If yes, the node receiving the RREQ message does not respond to the RREQ message.

例如节点P的拓扑序号0011 0011处于节点O的拓扑序号0011 0010的下一层次,节点O是节点P的祖先节点,因此节点P不查询路由表,不予回复RREP报文。在本发明中,节点P继续转发该RREQ报文,由于节点O是节点P的下一跳节点,因此该RREQ报文被转发回节点O,节点O收到该RREQ报文会发现此报文源于自己,因此将此RREQ报文丢弃。从而避免了现有技术中节点P无法判断路由表中的路由依然是须经过节点O的路径而为节点O建立路由后出现的数据传输的路由环路问题。For example, the topology number 0011 0011 of node P is at the next level of the topology number 0011 0010 of node O, and node O is the ancestor node of node P, so node P does not query the routing table and does not reply RREP messages. In the present invention, the node P continues to forward the RREQ message. Since the node O is the next hop node of the node P, the RREQ message is forwarded back to the node O, and the node O will find the message when receiving the RREQ message It originates from itself, so the RREQ message is discarded. Thus avoiding the routing loop problem of data transmission that occurs after the node P cannot judge that the route in the routing table still needs to pass through the node O and establishes a route for the node O in the prior art.

另外,分支拓扑序号交互报文还包括路由通告报文,即SN字段为10。路由通告报文主要用于拓扑序号失效时的通告,也就是,一个节点如果退出了网络,那么已经分配给它的拓扑序号需要通告失效,并且回收其拓扑序号以便重新分配给其他新加入网络的节点,此时就需要用到路由通告报文。In addition, the branch topology sequence number interaction message also includes a route notification message, that is, the SN field is 10. The route notification message is mainly used for notification when the topology number is invalid, that is, if a node exits the network, the topology number already assigned to it needs to be notified to be invalid, and its topology number should be reclaimed for redistribution to other newly joined networks. node, at this time, the route advertisement message is needed.

应当理解,以上借助优选实施例对本发明的技术方案进行的详细说明是示意性的而非限制性的。本领域的普通技术人员在阅读本发明说明书的基础上可以对各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。本发明的保护范围仅由随附权利要求书限定。It should be understood that the above detailed description of the technical solution of the present invention with the aid of preferred embodiments is illustrative rather than restrictive. Those skilled in the art can modify the technical solutions recorded in each embodiment on the basis of reading the description of the present invention, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the corresponding technical solutions Essentially deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention. The scope of protection of the present invention is limited only by the appended claims.

Claims (9)

1. a method that creates branch's topological sequences information in tree network system, is characterized in that,
Described tree network system comprises one-level node, two-level node and three grades of nodes,
The root node that described one-level node is described tree network;
Described two-level node is the child node of described one-level node, has the unique topological sequence number of being distributed by described one-level node;
The subtree node that described three grades of nodes are described one-level node or described two-level node, each three grades of nodes have the unique topological sequence number of being distributed by described one-level node or described two-level node;
One or more branches topological sequences information, each branch topological sequences information records the topological relation of each node in this subtree with the combination of the topological sequence number of each node in a subtree of described root node;
The concrete steps that create branch's topological sequences information comprise:
Step S1, in initially setting up route, distribute topological sequence number and generate branch's topological sequences information;
The child node of step S2, one-level node is to branch's topological sequences information described in its subtree node multicast;
Step S3, described subtree node are stored described branch topological sequences information;
Step S4, judge whether also to exist the node that does not obtain topological sequence number, if existed, enter step S5, if there is no, finish;
Step S5, distribute topological sequence number and upgrade branch's topological sequences information to the described node that does not obtain topological sequence number, and return to step S3.
2. a kind of method that creates branch's topological sequences information in tree network system according to claim 1, is characterized in that, step S1 comprises following sub-step:
Step S11, node send RREQ message;
Step S12, one-level node are replied RREP message and distribute topological sequence number to its child node;
Step S13, two-level node are replied RREP message and distribute topological sequence number to the child node of this two-level node, generate branch's topological sequences information;
Step S14, three grades of nodes are replied RREP message to its child node, complete and initially set up route.
3. a kind of method that creates branch's topological sequences information in tree network system according to claim 1, is characterized in that, described step S5 comprises following sub-step:
Step S51, the described node that does not obtain topological sequence number send branch's topology sequence number request message;
Step S52, branch topology sequence number request message the current branch's topological sequences information of nodes records of process;
Step S53, the node that receives described branch topology sequence number request message judges the authority oneself whether with the topological sequence number of distribution, if yes then enter step S54, if otherwise enter step S56;
The node of step S54, the described branch of described reception topology sequence number request message judges oneself whether to have the ability of distributing topological sequence number, if yes then enter step S55, if otherwise enter step S56;
The node of step S55, the described branch of described reception topology sequence number request message sends the branch's topology sequence number renewal message that carries topological sequence number and branch's topological sequences information to its subtree node, enter step S57;
The node of step S56, the described branch of described reception topology sequence number request message forwards described branch topology sequence number request message, returns to step S52;
Step S57, the described node that does not obtain topological sequence number obtain described topological sequence number.
4. a kind of method that creates branch's topological sequences information in tree network system according to claim 2, is characterized in that,
Described RREQ message comprises EN field and RREQ sequence number field, and whether described EN field identification RREQ source node has topological sequence number, the topological sequence number of described RREQ sequence number field for storing RREQ message source node;
Described RREP message comprises CN field and the topological sequence number field of distribution, and whether described CN field identification has right assignment topology sequence number and whether have distribution capability; The topological sequence number field of described distribution is for the topological sequence number of memory allocation.
5. a kind of method that creates branch's topological sequences information in tree network system according to claim 3, is characterized in that,
Described branch topology sequence number request message and described branch topology sequence number are upgraded message and are comprised topological sequences field, and described topological sequences field is for storing current branch's topological sequences information;
Described branch topology sequence number is upgraded message and is also comprised node ID field, and this node ID field is for storing the topological sequence number of described distribution.
6. a kind of method that creates branch's topological sequences information in tree network system according to claim 5, is characterized in that,
Step S2 also utilizes described branch topology sequence number to upgrade branch's topological sequences information described in message multicast.
7. a kind of method that creates branch's topological sequences information in tree network system according to claim 4, is characterized in that,
Again receive branch's topology sequence number request message of repetition if receive the node of described branch topology sequence number request message or described branch topology sequence number renewal message, directly abandon.
8. a method of avoiding route loop in tree network system, is characterized in that,
Described tree network system comprises one-level node, two-level node and three grades of nodes,
The root node that described one-level node is described tree network;
Described two-level node is the child node of described one-level node, has the unique topological sequence number of being distributed by described one-level node;
The subtree node that described three grades of nodes are described one-level node or described two-level node, each three grades of nodes have the unique topological sequence number of being distributed by described one-level node or described two-level node;
One or more branches topological sequences information, each branch topological sequences information records the topological relation of each node in this subtree with the combination of the topological sequence number of each node in a subtree of described root node;
Avoid the concrete steps of route loop to comprise:
Source node broadcast RREQ message, receives branch's topological sequences information described in the querying node of this RREQ message;
Judge that source node receives the ancestor node of the node of this RREQ message described in being whether;
If not, receive that the node of this RREQ message responds this RREQ message described in;
If so, receive that the node of this RREQ message does not respond this RREQ message described in.
9. a kind of method of avoiding route loop according to claim 8, is characterized in that, this RREQ message of described response comprises following sub-step:
Whether the described querying node routing table of receiving this RREQ message has the effective routing to destination node, if had, replys RREP message; If nothing, forwards this RREQ message, the duplicate step of laying equal stress on.
CN201110151082.6A 2011-06-07 2011-06-07 Method for avoiding routing loop by adopting tree topology relationship Expired - Fee Related CN102185749B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110151082.6A CN102185749B (en) 2011-06-07 2011-06-07 Method for avoiding routing loop by adopting tree topology relationship

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110151082.6A CN102185749B (en) 2011-06-07 2011-06-07 Method for avoiding routing loop by adopting tree topology relationship

Publications (2)

Publication Number Publication Date
CN102185749A CN102185749A (en) 2011-09-14
CN102185749B true CN102185749B (en) 2014-12-10

Family

ID=44571820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110151082.6A Expired - Fee Related CN102185749B (en) 2011-06-07 2011-06-07 Method for avoiding routing loop by adopting tree topology relationship

Country Status (1)

Country Link
CN (1) CN102185749B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420699B (en) * 2011-11-22 2014-08-20 京信通信系统(中国)有限公司 Equipment number distribution method of digital radio frequency remote system and system thereof
CN103023731B (en) * 2012-11-29 2016-01-13 深圳市迪威视讯股份有限公司 A kind of subtended conference implementation method and system
CN103401789A (en) * 2013-07-23 2013-11-20 杭州华三通信技术有限公司 Method and equipment for transmitting LSP (Link State Protocol Data Unit) messages
CN103414644B (en) * 2013-07-31 2016-12-07 华为技术有限公司 Method that list item issues and controller
CN103596283A (en) * 2013-11-28 2014-02-19 无锡清华信息科学与技术国家实验室物联网技术中心 Conflict resolving method and system based on correlation sequence
CN104270466B (en) * 2014-10-22 2018-07-03 中国建设银行股份有限公司 Data reporting method and relevant device
CN107509206B (en) * 2017-08-25 2021-11-02 北京建筑技术发展有限责任公司 Data networking method for intelligent lighting system
CN109617751A (en) * 2019-01-31 2019-04-12 北京淳中科技股份有限公司 Network-building method and control node cluster
CN110730106B (en) * 2019-12-18 2020-04-17 数字广东网络建设有限公司 Electronic official document exchange method and device based on tree structure and computer equipment
CN113300951B (en) * 2020-02-21 2023-10-24 华为技术有限公司 Method, equipment and system for sending message
CN113766508B (en) * 2021-09-27 2023-05-16 金陵科技学院 False data en-route filtering method applied to wireless sensor network
CN115396361B (en) * 2022-08-16 2023-09-01 中国电子科技集团公司第七研究所 An Unmanned Swarm Network Loop Avoidance System
CN115514653B (en) * 2022-10-09 2024-07-26 科来网络技术股份有限公司 Topology diagram generation method and device of industrial control network, electronic equipment and storage medium
CN119254572B (en) * 2024-10-15 2025-04-15 慷智集成电路(上海)有限公司 An audio transmission system based on tree topology

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1934560A (en) * 2004-03-26 2007-03-21 城域信息包系统公司 Method of sending information through a tree and ring topology of a network system
CN101043444A (en) * 2007-04-26 2007-09-26 浙江大学 Distributed quality of service multicast routing process based on ant group optimization
CN101179466A (en) * 2007-10-15 2008-05-14 北京交通大学 A method and system for realizing a distributed peer-to-peer network based on centralized services
CN101252479A (en) * 2008-04-01 2008-08-27 杭州华三通信技术有限公司 Loop detection method and switch

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100387018C (en) * 2005-04-12 2008-05-07 华为技术有限公司 Acquisition of Tree Network Topology Structure and Address Assignment Method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1934560A (en) * 2004-03-26 2007-03-21 城域信息包系统公司 Method of sending information through a tree and ring topology of a network system
CN101043444A (en) * 2007-04-26 2007-09-26 浙江大学 Distributed quality of service multicast routing process based on ant group optimization
CN101179466A (en) * 2007-10-15 2008-05-14 北京交通大学 A method and system for realizing a distributed peer-to-peer network based on centralized services
CN101252479A (en) * 2008-04-01 2008-08-27 杭州华三通信技术有限公司 Loop detection method and switch

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王利国 等.基于6LoWPAN的传感器网络动态路由协议研究.《重庆邮电学院学报(自然科学版)》.2006,第18卷(第6期),参见论文第2节. *

Also Published As

Publication number Publication date
CN102185749A (en) 2011-09-14

Similar Documents

Publication Publication Date Title
CN102185749B (en) Method for avoiding routing loop by adopting tree topology relationship
CN102056263B (en) Routing method and device as well as sensor equipment based on wireless sensor tree network
CA2387569C (en) System for communicating labeled routing trees
Jain et al. Viro: A scalable, robust and namespace independent virtual id routing for future networks
CN101652959A (en) Device and method related to network management
CN103414644B (en) Method that list item issues and controller
CN101005452A (en) Method and system for communication between IP devices
CN102769885B (en) Method for realizing routing in sensor network and sensor network
Awad et al. Exploiting virtual coordinates for improved routing performance in sensor networks
CN103338274A (en) Routing-oriented address assignment method in tree-shaped ubiquitous network
CN103476081B (en) Method for routing in wireless sensor network
CN101686188B (en) Method for establishing route table, routing method and router in hierarchy sequential address packet network
WO2022199294A1 (en) Multicast packet sending method and device
CN102970702B (en) Wireless sensor network structure maintenance method and system based on Zigbee protocol
Guo et al. Pangu: Towards a software-defined architecture for multi-function wireless sensor networks
CN101547188B (en) System and method for achieving generalized routing protocol of wireless sensor network
CN101784093B (en) Wireless communication network and routing method
CN101409905A (en) Routing method for mobile multi-hop grouping wireless network based on random broadcast mode
KR101081941B1 (en) Recording medium recorded node address and routing information structure, method of sensor network organization and method of sensor network routing
Ancillotti et al. On the interplay between RPL and address autoconfiguration protocols in LLNs
CN106559490B (en) A management method for storage cluster equipment
Felsche et al. Routing protocols for 6LoWPAN
Hui et al. Analysis and research on OLSR protocol for multi-channel assignment of wireless mesh network
Hickman et al. A variable length address assignment scheme for 6LoWPAN
Jaussaud Contribution a l'etude thermodynamique de l'hydrolyse de Pa (V) a l'echelle des traces par la technique d'extraction liquide-liquide avec la thenoyltrifluoroacetone (TTA).-Caracterisationdu partage de la thenoyltrifluoroacetone dans le systeme TTA/H $ _2 $ O/toluene/Na $^+ $/H $^+ $/ClO $ _4$

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20141210

Termination date: 20180607

CF01 Termination of patent right due to non-payment of annual fee
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载