WO2012163091A1 - 一种数据定位、重组方法及装置 - Google Patents

一种数据定位、重组方法及装置 Download PDF

Info

Publication number
WO2012163091A1
WO2012163091A1 PCT/CN2012/070092 CN2012070092W WO2012163091A1 WO 2012163091 A1 WO2012163091 A1 WO 2012163091A1 CN 2012070092 W CN2012070092 W CN 2012070092W WO 2012163091 A1 WO2012163091 A1 WO 2012163091A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
data structure
attribute
value
module
Prior art date
Application number
PCT/CN2012/070092
Other languages
English (en)
French (fr)
Inventor
沈志平
李冰
卢勤元
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012163091A1 publication Critical patent/WO2012163091A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Definitions

  • the present invention relates to the field of data processing, and in particular, to a method and a corresponding apparatus for data positioning and recombination in a network communication process.
  • MTUs maximum transmission units
  • FDDI fiber distribution data interface
  • Token Ring frame is between 4500 bytes and 17800 bytes
  • an important function of the IP protocol is to be able to transmit data larger than the MTU of the hardware interface.
  • segmented transmission That is, packets larger than MTU will be transmitted in two or more suitable sizes.
  • a fragment may also continue to be fragmented in the path to the receiving host. Therefore, at the receiving end, it is necessary to locate and reassemble data packets belonging to the same IP data stream.
  • there are many methods for data stream localization but there are certain defects in positioning time and positioning accuracy.
  • the present invention provides a data positioning method, including: receiving slice data and feature attributes;
  • Finding a hash table according to the value of the feature attribute if a key value matching the value of the feature attribute is found, inserting a pointer of the slice data into a data structure indicated by a hash address corresponding to the key value If a matching key value is not found, a new hash address corresponding to the value of the feature attribute is generated in the hash table, and the data structure indicated by the new hash address is to be fragmented data. The pointer is inserted into the data structure indicated by the new hash address.
  • the feature attribute is an attribute unique to each data packet, and is the number of all the fragments in each data packet. According to the same attributes.
  • the feature attributes include a source IP address, a destination IP address, an IP identifier, and a protocol type.
  • the data structure includes: a linked list, an array, a tree, or a graph.
  • the present invention also provides a data reorganization method, including:
  • Finding a hash table according to the value of the feature attribute if a key value matching the value of the feature attribute is found, inserting a pointer of the slice data into a data structure indicated by a hash address corresponding to the key value If a matching key value is not found, a new hash address corresponding to the value of the feature attribute is generated in the hash table, and the data structure indicated by the new hash address is to be fragmented data. a pointer inserted into the data structure indicated by the new hash address;
  • the fragmentation data in the same data structure is reorganized in order.
  • the steps of reorganizing the fragment data in the same data structure in order include:
  • All fragment data in the same data structure is reconstructed in order according to the offset of each slice data in the same data structure.
  • the feature attribute is an attribute unique to each packet and is the same attribute of all the fragment data in each packet.
  • the feature attributes include a source IP address, a destination IP address, an IP identifier, and a protocol type.
  • the data structure includes: a linked list, an array, a tree, or a graph.
  • the invention also provides a data locating device, comprising: a receiving module, a searching module and a positioning module, wherein:
  • the receiving module is configured to receive the fragment data and the feature attribute
  • the lookup module is configured to search a hash table according to the value of the feature attribute
  • the positioning module is configured to: when the search module finds a key value that matches the value of the feature attribute, insert a pointer of the fragment data into the data structure indicated by the hash address corresponding to the key value And generating, when the lookup module does not find a matching key value, generating a new hash address corresponding to the value of the feature attribute in the hash table, and a data structure indicated by the new hash address, A pointer to the fragmented data is inserted into the data structure indicated by the new hash address.
  • the feature attribute is an attribute unique to each data packet, and is the same attribute of all the fragment data in each data packet; the data structure includes: a linked list, an array, a tree, or a graph.
  • the present invention also provides a data reorganization apparatus, comprising: a receiving module, a searching module, a positioning module, and a recombining module, wherein:
  • the receiving module is configured to receive the fragment data and the feature attribute
  • the lookup module is configured to search a hash table according to the value of the feature attribute
  • the positioning module is configured to: when the search module finds a key value that matches the value of the feature attribute, insert a pointer of the fragment data into the data structure indicated by the hash address corresponding to the key value And generating, when the lookup module does not find a matching key value, generating a new hash address corresponding to the value of the feature attribute in the hash table, and a data structure indicated by the new hash address, A pointer to the fragmentation data is inserted into the data structure indicated by the new hash address; the reassembly module is arranged to reassemble the fragmentation data in the same data structure in order.
  • the feature attribute is an attribute unique to each data packet, and is the same attribute of all the fragment data in each data packet;
  • the data structure includes: a linked list, an array, a tree, or a graph.
  • the reassembly module is configured to reorganize the fragment data in the same data structure in the following manner: Recompose all the fragment data in the same data structure in order according to the offset of each fragment data in the same data structure.
  • the invention uses the high-efficiency HASH (hash) algorithm to locate all the data packets belonging to the same data stream, and the positioning speed is fast, and the overall characteristic of the data stream is used as the key value, the positioning precision is high, and the efficiency of the reorganization is correspondingly improved. Compared with previous positioning algorithms and other hash algorithms, the efficiency is greatly improved.
  • HASH high-efficiency HASH
  • FIG. 1 is a flowchart of a positioning method according to Embodiment 1 of the present invention.
  • FIG. 2 is a schematic structural view of a positioning device according to Embodiment 1 of the present invention.
  • Embodiment 3 is a flowchart of a method for reorganizing Embodiment 2 of the present invention.
  • FIG. 4 is a schematic structural diagram of a reorganization device according to Embodiment 2 of the present invention.
  • 5 is an application IP packet IP header information of the present invention.
  • FIG. 6 is a flowchart of an application example IP data stream positioning according to the present invention.
  • the positioning method is shown in Figure 1, and includes the following steps:
  • Step 110 Receive fragment data and feature attributes.
  • the feature attribute is an attribute unique to each data packet and is the same attribute of all the fragment data in each data packet;
  • Feature attributes are unique to each packet, which ensures that the feature attribute can distinguish between individual packets.
  • the value of the characteristic attribute is the same, which can facilitate the positioning and reorganization of the receiving end.
  • Step 120 the value of the feature attribute is used as a key value to find a hash table, if a matching key value is found, step 130 is performed, if no matching key value is found, step 140 is performed;
  • Step 130 Insert a pointer of the fragment data into the data structure indicated by the hash address corresponding to the key value
  • Step 140 Generate a new hash address corresponding to the key value in the hash table, and a data structure indicated by the new hash address, and insert a pointer of the fragment data into the data indicated by the new hash address. In the structure.
  • Each hash value (key value) in the hash table uniquely corresponds to a hash address, and the hash address stores a data structure address, that is, each hash address uniquely indicates a data structure, in each data structure.
  • the above data structure can be a linked list, an array, or a tree or a graph, or other A data structure that enables positioning.
  • the data positioning device for implementing the above positioning method is as shown in FIG. 2, and includes: a receiving module, a searching module, and a positioning module, where:
  • the receiving module is configured to receive the fragment data and the feature attribute
  • the searching module is configured to search the hash table with the value of the feature attribute as a key value; the positioning module is configured to: insert the pointer of the fragment data into the location when the search module finds the matching key value Generating the data structure indicated by the hash address corresponding to the key value; and generating a new hash address corresponding to the key value in the hash table when the search module does not find the matching key value, and The data structure indicated by the new hash address inserts a pointer of the fragmented data into the data structure indicated by the new hash address.
  • the above characteristic attribute is an attribute unique to each data packet, and is the same attribute of all the fragment data in each data packet.
  • the above data structure comprises: a linked list, an array, a tree or a graph.
  • the reorganization method is shown in Figure 3 and includes the following steps:
  • Step 310 Receive fragment data and feature attributes.
  • the feature attribute is an attribute unique to each data packet and is the same attribute of all the fragment data in each data packet;
  • Feature attributes are unique to each packet, which ensures that the feature attribute can distinguish between individual packets.
  • the value of the characteristic attribute is the same, which can facilitate the positioning and reorganization of the receiving end.
  • Step 320 Search the hash table with the value of the feature attribute as the key value. If the matching key value is found, go to step 330. If no matching key value is found, go to step 340. Step 330, the fragment will be segmented. A pointer of the data is inserted into the data structure indicated by the hash address corresponding to the key value; Step 340: Generate a new hash address corresponding to the key value in the hash table, and a data structure indicated by the new hash address, and insert a pointer of the fragment data into the data indicated by the new hash address. In the structure.
  • Each hash value (key value) in the hash table uniquely corresponds to a hash address, and the hash address stores a data structure address, that is, each hash address uniquely indicates a data structure, in each data structure.
  • Step 350 Reorganize the fragment data in the same data structure in order.
  • the above data structures can be linked lists, arrays, trees or graphs, or other data structures that can be located and reorganized.
  • the data recombining device for implementing the above data recombining method is as shown in FIG. 4, and includes: a receiving module, a searching module, a positioning module, and a recombining module, wherein:
  • the receiving module is configured to receive the fragment data and the feature attribute
  • the searching module is configured to search the hash table with the value of the feature attribute as a key value; the positioning module is configured to: insert the pointer of the fragment data into the location when the search module finds the matching key value Generating the data structure indicated by the hash address corresponding to the key value; and generating a new hash address corresponding to the key value in the hash table when the search module does not find the matching key value, and a data structure indicated by the new hash address, inserting a pointer of the fragment data into the data structure indicated by the new hash address;
  • the reassembly module is arranged to reassemble the fragmentation data in the same data structure in order.
  • the feature attribute is an attribute unique to each data packet and is the same attribute of all the fragment data in each data packet.
  • the data structure comprises: a linked list, an array, a number or a graph.
  • the reassembly module reorganizes the fragment data in the same data structure in the following manner: Recombining all the fragment data in the same data structure according to the offset of each fragment data in the same data structure.
  • IP data packet is transmitted according to the IP protocol and the data structure is a linked list is taken as an example.
  • the same IP packet stream contains the same stream quaternion information: source IP address, destination IP address, IP identifier, protocol type.
  • the four pieces of information are taken as four feature values.
  • the IP header information of the IP packet, the source IP address, the destination IP address, the IP identifier, and the protocol type are carried in the IP packet header, where:
  • IP identification 16 bits
  • the IP software maintains a counter in the memory. Each time a packet is generated, the counter is incremented by 1, and this value is assigned to the identification field.
  • the packet has to be fragmented because the length exceeds the MTU of the network.
  • the value of this identity field is copied to the identity field of all packets. The value of the same identification field enables the fragmented packets to be correctly reloaded into the original data packet;
  • Protocol type 8 bits, this field indicates which protocol is used by the data carried by this packet, so that the IP layer of the destination host knows which processing should be handed over to the data part;
  • Source IP address 32 bits, indicating the sender of the packet
  • Destination IP address 32 bits, indicating the receiver of the packet.
  • the above four-tuple is used as a feature attribute because if the values of the four fields of the two IP packets are the same, it can be determined that the two IP data packets belong to the same IP data stream.
  • Step 610 Receive an IP data packet, and extract feature attributes according to the IP data packet header information.
  • Step 620 Determine whether the data packet is an IP protocol data packet. If yes, go to step 630. If not, the process ends.
  • Step 630 Extract the quaternion information of the IP protocol packet header and save it in the structure.
  • Step 640 Query the hash structure obtained as the key value in step 630 as a key value.
  • Step 650 Determine whether the hash table has a return. As a result, if yes, step 660 is performed, if not, step 670 is performed; Step 660, if there is a return result, indicating that there is a matching key value, indicating that there is a fragment belonging to the same IP data packet, inserting the IP data packet pointer into the linked list obtained by the HASH query, and ending;
  • Step 670 if no result is returned, indicating that there is no matching key value, a new linked list is created, and the linked list is inserted into the hash table, and then the data packet pointer is inserted into the linked list.
  • This method locates the IP data stream by using the HASH table, improves the speed of positioning, and improves the accuracy of positioning by using the whole quaternion information as a key value, and provides a fast positioning method for subsequent IP packet reassembly and other applications. .
  • the source IP address, the destination IP address, the IP identifier, and the protocol type are taken as characteristic attributes.
  • other attributes can also be used as feature attributes, as long as the data packet can be distinguished, but the fragments in the data packet are not distinguished.
  • a plurality of shards belonging to the same data packet are reassembled, and the order of each shard is determined according to the offset of the shard relative to the puncturing header.
  • the hash algorithm used in this embodiment uses various methods such as shifting and subtracting, which greatly improves the hit rate.
  • the hash algorithm has the characteristics of fast speed, distributed hook, and small hash bucket length, which is very suitable for large The calculation of the amount of data.
  • the present invention uses an efficient HASH (Hash) algorithm to locate all data packets belonging to the same data stream, and has a fast positioning speed, and the overall feature value of the data stream is used as a key value, and the positioning accuracy is high, and at the same time
  • HASH Hash

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种数据定位方法及装置,减少定位时间,提高定位精度。所述方法包括:接收分片数据以及特征属性;根据所述特征属性的值查找哈希表,如果查找到与所述特征属性的值匹配的关键值,则将分片数据的指针插入到所述关键值对应的哈希地址所指示的数据结构中;如果没有查找到匹配的关键值,则在哈希表中生成与所述特征属性的值对应的新的哈希地址,以及该新的哈希地址指示的数据结构,将分片数据的指针插入所述新的哈希地址所指示的数据结构中。所述定位装置包括:接收模块、查找模块和定位模块。本发明采用高效HASH算法定位属于同一个数据流的所有数据包,定位速度快,并且以数据流的特征属性整体作为键值,定位精度高,同时重组的效率也相应提高。

Description

一种数据定位、 重组方法及装置
技术领域
本发明涉及数据处理领域, 尤其涉及在网络通信过程中数据定位、 重组 的方法及相应装置。
背景技术
随着互联网业务的高速发展, 业务类型层出不穷, 数据量也越来越大, 我们都知道, 不同类型的网络, 其 MTU (最大传输单元)各不相同, 如以太网 中, 最大的传输帧为 1500字节, FDDI (光纤分布数据接口)为 4500字节, 令牌环帧在 4500字节到 17800字节之间, 而 IP协议的一个重要功能就是能 够在传输的数据大于硬件接口的 MTU时, 对其进行分段传输。 即大于 MTU 的数据包将被分为 2个或多个的合适的大小被传输。 一个分片在到达接收主 机的路径中, 还可能被继续分片。 因此在接收端就必须对同属于一个 IP数据 流的数据包进行定位与重组。 目前数据流定位的方法有许多种, 但是在定位 时间和定位精度上都有一定的缺陷。
发明内容
本发明的目的是提供一种数据定位方法及装置, 减少定位时间, 提高定 位精度。
为解决上述技术问题, 本发明提供了一种数据定位方法, 包括: 接收分片数据以及特征属性; 以及
根据所述特征属性的值查找哈希表, 如果查找到与所述特征属性的值匹 配的关键值, 则将分片数据的指针插入到所述关键值对应的哈希地址所指示 的数据结构中; 如果没有查找到匹配的关键值, 则在哈希表中生成与所述特 征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将 分片数据的指针插入所述新的哈希地址所指示的数据结构中。
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性。 所述特征属性包括源 IP地址、 目的 IP地址、 IP标识和协议类型。
所述数据结构包括: 链表、 数组、 树或图。
为解决上述问题, 本发明还提供一种数据重组方法, 包括:
接收分片数据以及特征属性;
根据所述特征属性的值查找哈希表, 如果查找到与所述特征属性的值匹 配的关键值, 则将分片数据的指针插入到所述关键值对应的哈希地址所指示 的数据结构中; 如果没有查找到匹配的关键值, 则在哈希表中生成与所述特 征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将 分片数据的指针插入所述新的哈希地址所指示的数据结构中; 以及
将同一数据结构中的分片数据按顺序重组。
将同一数据结构中的分片数据按顺序重组的步骤包括:
根据同一数据结构中各分片数据的偏移量顺序重组同一数据结构中的所 有分片数据。
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性。 所述特征属性包括源 IP地址、 目的 IP地址、 IP标识和协议类型。
所述数据结构包括: 链表、 数组、 树或图。
本发明还提供一种数据定位装置, 包括: 接收模块、 查找模块和定位模 块, 其中:
所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成根据所述特征属性的值查找哈希表;
所述定位模块设置成: 在所述查找模块查找到与所述特征属性的值匹配 的关键值时, 将分片数据的指针插入到所述关键值对应的哈希地址所指示的 数据结构中; 以及在所述查找模块没有查找到匹配的关键值时, 在哈希表中 生成与所述特征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的 数据结构, 将分片数据的指针插入所述新的哈希地址所指示的数据结构中。 所述特征属性为每个数据包独有的属性, 且为每个数据包中的所有分片 数据的相同的属性; 所述数据结构包括: 链表、 数组、 树或图。
本发明还提供一种数据重组装置, 包括: 接收模块、 查找模块、 定位模 块和重组模块, 其中:
所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成根据所述特征属性的值查找哈希表;
所述定位模块设置成: 在所述查找模块查找到与所述特征属性的值匹配 的关键值时, 将分片数据的指针插入到所述关键值对应的哈希地址所指示的 数据结构中; 以及在所述查找模块没有查找到匹配的关键值时, 在哈希表中 生成与所述特征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的 数据结构, 将分片数据的指针插入所述新的哈希地址所指示的数据结构中; 所述重组模块设置成将同一数据结构中的分片数据按顺序重组。
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性; 所述数据结构包括: 链表、 数组、 树或图。
所述重组模块是设置成釆用以下方式将同一数据结构中的分片数据按顺 序重组: 根据同一数据结构中各分片数据的偏移量顺序重组同一数据结构中 的所有分片数据。
本发明釆用高效 HASH (哈希)算法定位属于同一个数据流的所有数据 包, 定位速度快, 并且以数据流的特征属性整体作为键值, 定位精度高, 同 时重组的效率也相应提高。 相比于以往的定位算法以及其它 hash算法大大提 高了效率。
附图概述
图 1为本发明实施例 1定位方法流程图;
图 2为本发明实施例 1定位装置结构示意图;
图 3为本发明实施例 2重组方法流程图;
图 4为本发明实施例 2重组装置结构示意图; 图 5为本发明应用示例 IP数据包 IP首部信息;
图 6为本发明应用示例 IP数据流定位流程图。
本发明的较佳实施方式
为使本发明的目的、 技术方案和优点更加清楚明白, 下文中将结合附图 对本发明的实施例进行详细说明。 需要说明的是, 在不冲突的情况下, 本申 请中的实施例及实施例中的特征可以相互任意组合。
实施例 1
定位方法如图 1所示, 包括以下步骤:
步骤 110, 接收分片数据以及特征属性;
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性;
特征属性为每个数据包独有, 这样可以保证该特征属性可以区分各个数 据包。 而对于数据包中的分片数据来说, 其特征属性的值均是相同的, 这样 可以方便接收端进行定位和重组。
步骤 120, 以该特征属性的值作为关键值查找哈希表, 如果查找到匹配 的关键值,则执行步骤 130,如果没有查找到匹配的关键值,则执行步骤 140;
步骤 130, 将分片数据的指针插入到该关键值对应的哈希地址所指示的 数据结构中;
步骤 140, 在哈希表中生成所述关键值对应的新的哈希地址, 以及该新 的哈希地址指示的数据结构, 将分片数据的指针插入该新的哈希地址所指示 的数据结构中。
哈希表中的每个哈希值(关键值)唯一对应一个哈希地址, 该哈希地址 存放的是一个数据结构地址, 即每个哈希地址唯一指示一个数据结构, 每个 数据结构中保存有同一个数据包的所有分片的地址。 也就是说, 利用特征属 性值可以准确定位到一个数据包。
上述数据结构可以是链表, 也可以是数组, 或者是树或图, 或者是其他 能够进行定位的数据结构。
实现上述定位方法的数据定位装置如图 2所示, 包括: 接收模块、 查找 模块和定位模块, 其中:
所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成以所述特征属性的值作为关键值查找哈希表; 所述定位模块设置成: 在所述查找模块查找到匹配的关键值时, 将分片 数据的指针插入到所述关键值对应的哈希地址所指示的数据结构中; 以及在 所述查找模块没有查找到匹配的关键值时, 在哈希表中生成所述关键值对应 的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将分片数据的指针 插入所述新的哈希地址所指示的数据结构中。
优选地, 上述特征属性为每个数据包独有的属性, 且为每个数据包中所 有分片数据的相同的属性。
优选地, 上述数据结构包括: 链表、 数组、 树或图。
实施例 2
重组方法如图 3所示, 包括以下步骤:
步骤 310 , 接收分片数据以及特征属性;
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性;
特征属性为每个数据包独有, 这样可以保证该特征属性可以区分各个数 据包。 而对于数据包中的分片数据来说, 其特征属性的值均是相同的, 这样 可以方便接收端进行定位和重组。
步骤 320 , 以该特征属性的值作为关键值查找哈希表, 如果查找到匹配 的关键值,则执行步骤 330 ,如果没有查找到匹配的关键值,则执行步骤 340; 步骤 330 , 将分片数据的指针插入到该关键值对应的哈希地址所指示的 数据结构中; 步骤 340 , 在哈希表中生成所述关键值对应的新的哈希地址, 以及该新 的哈希地址指示的数据结构, 将分片数据的指针插入该新的哈希地址所指示 的数据结构中。
哈希表中的每个哈希值(关键值)唯一对应一个哈希地址, 该哈希地址 存放的是一个数据结构地址, 即每个哈希地址唯一指示一个数据结构, 每个 数据结构中保存有同一个数据包的所有分片的地址。 也就是说, 利用特征属 性值可以准确定位到一个数据包。
步骤 350, 将同一数据结构中的分片数据按顺序重组。
上述数据结构可以是链表, 也可以是数组, 或者是树或图, 或者是其他 能够进行定位和重组的数据结构。
实现上述数据重组方法的数据重组装置如图 4所示, 包括: 接收模块、 查找模块、 定位模块和重组模块, 其中:
所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成以所述特征属性的值作为关键值查找哈希表; 所述定位模块设置成: 在所述查找模块查找到匹配的关键值时, 将分片 数据的指针插入到所述关键值对应的哈希地址所指示的数据结构中; 以及在 所述查找模块没有查找到匹配的关键值时, 在哈希表中生成所述关键值对应 的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将分片数据的指针 插入所述新的哈希地址所指示的数据结构中;
所述重组模块设置成将同一数据结构中的分片数据按顺序重组。
优选地, 所述特征属性为每个数据包独有的属性, 且为每个数据包中的 所有分片数据的相同的属性。
优选地, 所述数据结构包括: 链表、 数组、 数或图。
优选地, 所述重组模块釆用以下方式将同一数据结构中的分片数据按顺 序重组: 根据同一数据结构中各分片数据的偏移量顺序重组同一数据结构中 的所有分片数据。 应用示例
以根据 IP协议传输 IP数据包、 数据结构为链表为例进行说明。 同一个 IP数据包流含有相同的流四元组信息: 源 IP地址 , 目的 IP地址 , IP标识 , 协议类型。 将该四个信息作为四个特征值。 如图 5所示为 IP数据包的 IP首 部信息, 源 IP地址、 目的 IP地址、 IP标识以及协议类型均携带在该 IP数据 包头中, 其中:
IP标识: 占 16位, IP软件在存储器中维持一个计数器, 每产生一个数 据包, 计数器就加 1 , 并将此值赋给标识字段, 当数据包由于长度超过网络 的 MTU 而必须分片时, 这个标识字段的值就被复制到所有的数据包的标识 字段中。 相同的标识字段的值使分片后的各数据包最后能正确地重装成为原 来的数据包;
协议类型: 占 8位, 该字段指出此数据包携带的数据是使用何种协议, 以便使目的主机的 IP层知道应将数据部分上交给哪个处理过程;
源 IP地址: 占 32位, 表示数据包发送方;
目的 IP地址: 占 32位, 表示数据包接收方。
釆用上述四元组作为特征属性是因为,如果两个 IP数据包的这四个字段 的值相同, 就可以确定这两个 IP数据包属于同一个 IP数据流。
定位过程如图 6所示, 包括:
步骤 610, 接收 IP数据包, 根据 IP数据包头信息, 提取特征属性; 步骤 620, 判断数据包是否为 IP协议数据包, 如果是, 执行步骤 630, 如果不是, 本流程结束;
步骤 630,提取该 IP协议数据包头部的四元组信息, 并保存在结构体中; 步骤 640, 将步骤 630得到的结构体整体作为关键值查询 hash表; 步骤 650, 判断 hash表是否有返回结果, 如果有, 执行步骤 660, 如果 没有, 执行步骤 670; 步骤 660, 如果有返回结果则说明有匹配的关键值, 说明此前有属于同 一个 IP数据包的分片,将此 IP数据包指针插入到 HASH查询得到的链表中, 结束;
步骤 670, 如果没有返回结果则说明没有匹配的关键值, 则新建一个链 表, 并将并将此链表插入哈希表中, 然后把数据包指针插入链表中。
当所有的数据包都传输完毕后 , 同一个链表中的所有数据分片便是属于 同一个 IP数据包流的。
这种方法定位利用 HASH表搜索 IP数据流,提高了定位的速度, 将四元 组信息整体作为键值提高了定位的精度,对于其后续的 IP数据包重组以及其 它应用提供了快速的定位方法。
本实施例仅以源 IP地址、 目的 IP地址、 IP标识、 协议类型作为特征属 性为例进行说明。 对于其他协议也可釆用其他的属性作为特征属性, 只要保 证能够区分数据包, 但不区分数据包中的分片即可。
在釆用上述方法定位后, 将属于同一数据包的多个分片进行重组, 各分 片的顺序可才艮据该分片相对于包头的偏移确定。
本实施例所用的 hash算法釆用移位与减法等多种方式, 大大提高了命中 率, 相比于其它类型的 hash算法有速度快, 分布均勾, hash桶长小的特点, 非常适合大数据量的运算。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件完成, 所述程序可以存储于计算机可读存储介质中, 如只读 存储器、 磁盘或光盘等。 可选地, 上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。 相应地, 上述实施例中的各模块 /单元可以釆用 硬件的形式实现, 也可以釆用软件功能模块的形式实现。 本发明不限制于任 何特定形式的硬件和软件的结合。
当然, 本发明还可有其他多种实施例, 在不背离本发明精神及其实质的 但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。 工业实用性
与现有技术相比, 本发明釆用高效 HASH (哈希)算法定位属于同一个 数据流的所有数据包, 定位速度快, 并且以数据流的特征属性整体作为键值, 定位精度高, 同时重组的效率也相应提高。

Claims

1、 一种数据定位方法, 包括:
接收分片数据以及特征属性; 以及
根据所述特征属性的值查找哈希表, 如果查找到与所述特征属性的值匹 配的关键值, 则将分片数据的指针插入到所述关键值对应的哈希地址所指示 的数据结构中; 如果没有查找到匹配的关键值, 则在哈希表中生成与所述特 征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将 分片数据的指针插入所述新的哈希地址所指示的数据结构中。
2、 如权利要求 1所述的方法, 其中,
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性。
3、 如权利要求 2所述的方法, 其中,
所述特征属性包括源 IP地址、 目的 IP地址、 IP标识和协议类型。
4、 如权利要求 1或 2或 3所述的方法, 其中,
所述数据结构包括: 链表、 数组、 树或图。
5、 一种数据重组方法, 包括:
接收分片数据以及特征属性;
根据所述特征属性的值查找哈希表, 如果查找到与所述特征属性的值匹 配的关键值, 则将分片数据的指针插入到所述关键值对应的哈希地址所指示 的数据结构中; 如果没有查找到匹配的关键值, 则在哈希表中生成与所述特 征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的数据结构, 将 分片数据的指针插入所述新的哈希地址所指示的数据结构中; 以及
将同一数据结构中的分片数据按顺序重组。
6、 如权利要求 5所述的方法, 其中,
将同一数据结构中的分片数据按顺序重组的步骤包括:
根据同一数据结构中各分片数据的偏移量顺序重组同一数据结构中的所 有分片数据。
7、 如权利要求 5所述的方法, 其中,
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性。
8、 如权利要求 7所述的方法, 其中,
所述特征属性包括源 IP地址、 目的 IP地址、 IP标识和协议类型。
9、 如权利要求 5或 6或 7或 8所述的方法, 其中,
所述数据结构包括: 链表、 数组、 树或图。
10、 一种数据定位装置, 包括: 接收模块、 查找模块和定位模块, 其中: 所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成根据所述特征属性的值查找哈希表;
所述定位模块设置成: 在所述查找模块查找到与所述特征属性的值匹配 的关键值时, 将分片数据的指针插入到所述关键值对应的哈希地址所指示的 数据结构中; 以及在所述查找模块没有查找到匹配的关键值时, 在哈希表中 生成与所述特征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的 数据结构, 将分片数据的指针插入所述新的哈希地址所指示的数据结构中。
11、 如权利要求 10所述的装置, 其中,
所述特征属性为每个数据包独有的属性, 且为每个数据包中的所有分片 数据的相同的属性; 所述数据结构包括: 链表、 数组、 树或图。
12、 一种数据重组装置, 包括: 接收模块、 查找模块、 定位模块和重组 模块, 其中:
所述接收模块设置成接收分片数据以及特征属性;
所述查找模块设置成根据所述特征属性的值查找哈希表;
所述定位模块设置成: 在所述查找模块查找到与所述特征属性的值匹配 的关键值时, 将分片数据的指针插入到所述关键值对应的哈希地址所指示的 数据结构中; 以及在所述查找模块没有查找到匹配的关键值时, 在哈希表中 生成与所述特征属性的值对应的新的哈希地址, 以及该新的哈希地址指示的 数据结构, 将分片数据的指针插入所述新的哈希地址所指示的数据结构中; 所述重组模块设置成将同一数据结构中的分片数据按顺序重组。
13、 如权利要求 12所述的装置, 其中,
所述特征属性为每个数据包独有的属性, 且为每个数据包中所有分片数 据的相同的属性; 所述数据结构包括: 链表、 数组、 树或图。
14、 如权利要求 12所述的装置, 其中,
所述重组模块是设置成釆用以下方式将同一数据结构中的分片数据按顺 序重组: 根据同一数据结构中各分片数据的偏移量顺序重组同一数据结构中 的所有分片数据。
PCT/CN2012/070092 2011-06-02 2012-01-06 一种数据定位、重组方法及装置 WO2012163091A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110147954.1 2011-06-02
CN2011101479541A CN102811158A (zh) 2011-06-02 2011-06-02 一种数据定位、重组方法及相应装置

Publications (1)

Publication Number Publication Date
WO2012163091A1 true WO2012163091A1 (zh) 2012-12-06

Family

ID=47234743

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/070092 WO2012163091A1 (zh) 2011-06-02 2012-01-06 一种数据定位、重组方法及装置

Country Status (2)

Country Link
CN (1) CN102811158A (zh)
WO (1) WO2012163091A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103746919A (zh) * 2014-01-14 2014-04-23 浪潮电子信息产业股份有限公司 一种结合多路决策树和哈希表进行网络包快速分类的方法
CN104217034A (zh) * 2014-09-29 2014-12-17 北京北纬点易信息技术有限公司 基于指针操作的ip地址快速检索相关信息的方法
CN109558423A (zh) * 2018-10-31 2019-04-02 深圳壹账通智能科技有限公司 一种基于键值对的数据查找方法、装置及设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102516584B1 (ko) * 2018-11-21 2023-04-03 에스케이하이닉스 주식회사 메모리 시스템
CN112311692A (zh) * 2019-07-31 2021-02-02 华为技术有限公司 报文处理方法及装置、端设备
CN111225021B (zh) * 2019-11-13 2020-11-27 北京连山时代科技有限公司 一种基于文件破碎与重组的多链路并发传输方法和系统
CN112491745B (zh) * 2020-11-17 2023-03-28 广州西麦科技股份有限公司 一种流量去重方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6714985B1 (en) * 2000-04-28 2004-03-30 Cisco Technology, Inc. Method and apparatus for efficiently reassembling fragments received at an intermediate station in a computer network
CN1494274A (zh) * 2002-10-31 2004-05-05 ����ͨѶ�ɷ����޹�˾ 基于网络处理器实现ip报文分片重组的方法
CN1929453A (zh) * 2006-09-18 2007-03-14 华为技术有限公司 重组分片数据的方法与装置
CN101645851A (zh) * 2009-09-03 2010-02-10 中兴通讯股份有限公司 一种ip分片报文的重组方法和装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6914901B1 (en) * 2001-12-05 2005-07-05 Cisco Technology, Inc. System and method for communicating using multiple memory banks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6714985B1 (en) * 2000-04-28 2004-03-30 Cisco Technology, Inc. Method and apparatus for efficiently reassembling fragments received at an intermediate station in a computer network
CN1494274A (zh) * 2002-10-31 2004-05-05 ����ͨѶ�ɷ����޹�˾ 基于网络处理器实现ip报文分片重组的方法
CN1929453A (zh) * 2006-09-18 2007-03-14 华为技术有限公司 重组分片数据的方法与装置
CN101645851A (zh) * 2009-09-03 2010-02-10 中兴通讯股份有限公司 一种ip分片报文的重组方法和装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103746919A (zh) * 2014-01-14 2014-04-23 浪潮电子信息产业股份有限公司 一种结合多路决策树和哈希表进行网络包快速分类的方法
CN104217034A (zh) * 2014-09-29 2014-12-17 北京北纬点易信息技术有限公司 基于指针操作的ip地址快速检索相关信息的方法
CN109558423A (zh) * 2018-10-31 2019-04-02 深圳壹账通智能科技有限公司 一种基于键值对的数据查找方法、装置及设备

Also Published As

Publication number Publication date
CN102811158A (zh) 2012-12-05

Similar Documents

Publication Publication Date Title
WO2012163091A1 (zh) 一种数据定位、重组方法及装置
TWI683587B (zh) 用於唯一枚舉解析樹中的路徑的裝置和方法
US7089240B2 (en) Longest prefix match lookup using hash function
JP5921666B2 (ja) パケットスイッチングのための方法及び装置
CN113301008B (zh) 具有时间感知分组处理管线的网络适配器
JP5993521B2 (ja) データ通信ネットワークにおいてメッセージを修正及び転送する方法及び装置
KR100997182B1 (ko) 플로우 정보 제한장치 및 방법
WO2011069388A1 (zh) 一种协议识别的方法、装置和系统
US20240176760A1 (en) Data stream protocol field decoding by a systolic array
WO2011060732A1 (zh) 报文检测方法及装置
CN101645851B (zh) 一种ip分片报文的重组方法和装置
TWI661698B (zh) 轉發乙太網路封包的方法和裝置
US20040213278A1 (en) System, method, and computer program product for in-place, lightweight Ack promotion in a cable modem environment
JP2017054500A (ja) コンテンツ中心ネットワークにおけるネットワーク名称付きフラグメント
TW202209850A (zh) 封包聚合及解聚合方法
WO2011032321A1 (zh) 一种数据转发方法、数据处理方法、系统以及相关设备
WO2016062031A1 (zh) 一种openflow流表的查表方法和装置、存储介质
CN103873602A (zh) 一种网络资源命名方法与生成装置
WO2018075120A1 (en) Forwarding information base architecture for a hybrid ip and content centric network router
CN101316232B (zh) 基于网络协议版本6的分片重组方法
KR102337513B1 (ko) 패킷 컨텐츠로부터 해시 입력을 형성하는 방법 및 장치
WO2015176277A1 (zh) 一种报文处理方法及装置
US10567399B2 (en) Fragmented malware hash lookup in cloud repository
CN115225734A (zh) 一种报文处理方法和网络设备
JP6678401B2 (ja) 変更のためにパケットを個々のレイヤに分割し、変更後のレイヤを情報処理で継合する方法およびその装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12792741

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12792741

Country of ref document: EP

Kind code of ref document: A1