Method and device for adding, searching and deleting longest match table entry of B-tree
A longest matching and table entry technology, applied in the field of communication, can solve the problem that B-tree cannot achieve the longest matching
- 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 matching entry can be expressed in the form: 10101011XXXXXX / 8, 10101011XXXXXXXX / 8, 01XXX / 2, etc., where the first one represents the longest matching entry with a length of 14 bits and a mask length of 8, and the second Indicates the longest matching entry with a length of 16 bits and a mask length of 8, and the third one represents the longest matching entry with a length of 5 bits and a mask length of 2.
[0033] For the longest matching entry, the so-called "match" 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 ma...
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 non-leaf node entries in the B-tree, enabling 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 entry to be inserted according to the longest matching entry to be added. For the sake of simplicity, in this example, the method of extending 1 bit is adopted. After the expansion, the value of the table item to be inserted has W+1 bits. Starting from the lower bit, the field before the first bit with a value of "1" matches the longest The fields corresponding to the mask length in the 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 t...
Embodiment 3
[0060] Embodiment 3, a kind of table entry search method for the longest matching B-tree, such as Figure 6 shown, including:
[0061] C1. Obtain the longest matching 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 table item to be searched 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 Embodiment 1. Since the extended exact entry in this example is used for searching, it can be called the value of the table 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 lower bit, the field before the first bit whose 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 table item to be checked with...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 