Method and device for adding, searching and deleting longest match table entry of B-tree
A longest matching and entry technology, applied in the field of communication, can solve the problem that the B tree cannot achieve the longest matching, etc.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0030] Embodiment 1. A method for adding entries to the longest matching B-tree, such as image 3 shown, including:
[0031] A1. Obtain the longest matching entry of length W that needs to be added to the B-tree, where W is a natural number.
[0032] The longest match entry can be expressed in the form: 10101011XXXXXX / 8, 10101011XXXXXXXX / 8, 01XXX / 2, etc., where the first represents the longest match entry with a length of 14 bits and a mask length of 8, and the second Indicates the longest match entry with a length of 16 bits and a mask length of 8, and the third indicates the longest match entry with a length of 5 bits and a mask length of 2.
[0033] For the longest matching entry, the so-called "matching" refers to the partial or full length of the field corresponding to the mask length of the entry to be matched, which is the same as the field corresponding to the mask length of the matched entry. For example, for the to-be-matched entry 01110 / 5, the matched entries 01XX...
Embodiment 2
[0043] Embodiment 2: A method for adding entries to the longest matching B-tree. Compared with Embodiment 1, this embodiment further increases the content of the entries of non-leaf nodes in the B-tree, so that better achieve the longest match. Process such as Figure 4 shown, including:
[0044] B1. Obtain the longest matching entry of length W that needs to be added to the B-tree, where W is a natural number.
[0045] B2. Generate the value of the table entry to be inserted according to the longest matching table entry that needs to be added. For simplicity, in this example, a 1-bit extension is used, and the expanded table entry value to be inserted has W+1 bits. The fields corresponding to the mask length in the table entry are the same.
[0046] B3. Compare the value of the entry to be inserted with the entry value of the existing entry in the B-tree according to the set comparison order, and determine the position to be added.
[0047] In this embodiment, each entry...
Embodiment 3
[0060] Embodiment 3, a kind of table entry search method for the longest matching B-tree, as Image 6 shown, including:
[0061] C1. Obtain the longest matching table entry of length W that needs to be searched in the B-tree, where W is a natural number.
[0062] C2. Generate the value of the to-be-checked table item according to the longest matching table item to be searched.
[0063] The generation method can refer to the method of obtaining the exact entry value by extending the longest matching entry in the first embodiment. Since the expanded precise entry in this example is used for searching, it can be called the value of the entry to be looked up. , in the case of extending 1 bit, the value of the entry to be looked up has W+1 bits, starting from the low order, the field before the bit whose first value is the set value corresponds to the mask in the longest matching entry The length field is the same.
[0064] C3. Compare the value of the entry to be looked up with...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 