A general rule matching method, device, equipment, medium and product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]本发明旨在提供一种通用规则匹配方法、装置、设备、介质及产品,以解决目前逻辑硬实现方案需要针对特定的匹配规则进行逻辑定制设计,通用性欠缺,不能用同一个实现支持多种不同类型的关键字匹配并实现表项灵活分配的问题
本发明具有统一的规则表项存储空间和匹配逻辑,并支持通过配置选项实时定义多种不同匹配规则,实现混合查找的通用规则匹配。其中,关键字匹配支持灵活地关键字字段划分、可配置精确、范围、掩码等多种不同的匹配功能。
Smart Images

Figure CN121530727B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication and security, and more specifically, to a general rule matching method, apparatus, device, medium, and product. Background Technology
[0002] Rule matching is a core technology for implementing various functions in network communication and security fields, including routing and switching, access control, firewalls, intrusion detection, and encrypted communication. Currently, rule matching design methods encompass multiple technical approaches. Software implementations using tree-based search methods and their improved algorithms offer flexible keyword design, adapting to diverse keyword requirements, but also suffer from drawbacks such as complex algorithms and data structures, poor support for dynamic entry updates, and inability to meet high-performance matching requirements. Direct mapping design methods, represented by hash tables, support large numbers of entries, offering flexible and efficient entry management. They can be implemented in both software and hardware, with hardware implementations exhibiting very high matching and lookup performance. However, hash tables cannot directly support range matching or mask matching, making them more suitable for scenarios requiring precise matching. Rule matching using ternary content addressable memory (TCAM) offers high lookup performance, supports mask matching, and allows for flexible partitioning of different matching entries. It boasts strong adaptability and flexibility, making it an excellent general-purpose rule matching technology. However, its cost and power consumption are high, and its support for range matching is weak. Therefore, it is mostly used in high-value devices in specific fields such as high-end routers, and the supported entry size is also limited. Hardware matching methods, which employ field-programmable gate arrays (FPGAs) or custom logic for hard comparison, can be designed to support various combinations of performance, keyword types, and entry sizes. However, current rule matching methods using hard logic implementations are all designed specifically for specific application requirements. For example, rule tables designed specifically for network 5-tuple matching do not support the same implementation being used for different types of keyword lookups and flexible allocation. To support multiple different matching methods, either different matching tables must be implemented and run separately, or logic reloading is required, resulting in a lack of flexibility. Summary of the Invention
[0003] This invention aims to provide a universal rule matching method, apparatus, device, medium, and product to address the shortcomings of current logic-based hard implementations, which require customized logic design for specific matching rules, lack universality, and cannot support matching of multiple different types of keywords and flexibly allocate table entries using a single implementation. Furthermore, compared to traditional TCAM-based universal search implementations, this invention can more broadly support range matching of keywords with variable lengths, not just limited to mask comparison, offering greater flexibility and better suitability for more complex application scenarios beyond network table entry lookups.
[0004] In a first aspect, the present invention provides a general rule matching method, comprising: The table entry management unit manages the table entry storage unit and the configuration register group, and assigns a rule label to each matching rule. This rule label is then distributed to the configuration register group and the user business logic. The table entry storage unit stores each table entry according to the matching rule corresponding to the rule label; The configuration register group stores matching rule partition information and matching rule settings; The matching processing unit receives rule matching requests from user business logic input, including rule tags and keywords. Based on the rule tags, it obtains matching rule partition information and matching rule setting information. Based on the matching rule partition information, it matches the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information.
[0005] In a preferred embodiment, the table entries stored in the table entry storage unit are managed in units of table entry entries. Each table entry entry includes fields such as valid flag, fuzzy matching key field, extended fuzzy matching key field, exact matching key field, priority, and result information. The validity flag is used to indicate whether an entry is a valid entry; Priority is used to indicate the priority of an entry. If the matching result of the matching processing unit contains multiple entries, the entry with the highest priority is taken as the final matching result. Exact match keywords are used to match keywords in the rule matching request; Fuzzy matching keywords and extended fuzzy matching keywords are used together to indicate the range matching boundaries or the one-to-one correspondence between keywords and masks when using mask matching. The results information is used to store the matching results that should be returned to the user's business logic.
[0006] In a preferred embodiment, the exact matching key field, priority, and / or result information are optional fields.
[0007] In a preferred embodiment, the matching rule partitioning information is the start and end addresses of the storage units allocated by the table entry management unit for each matching rule, which is used to guide the matching processing unit to retrieve the rule matching table in the correct partition.
[0008] In a preferred embodiment, the rule setting information is used to configure the specific content of a set of matching rules, including a switch to enable or disable the matching rule and information to guide the rule matching operation logic in the matching processing unit on how to process the rule tags.
[0009] In a preferred embodiment, the matching processing unit supports one or more rule matching request input channels and result output channels to support multiple different user business logics to access rule matching requests; wherein, the channels adopt a round-robin or priority arbitration scheduling method.
[0010] Secondly, the present invention provides a universal rule matching device, comprising: The table entry management unit is used to manage the table entry storage unit and the configuration register group, and to assign a rule label to each matching rule. The rule label is then distributed to the configuration register group and the user business logic. The table entry storage unit is used to store each table entry according to the matching rule corresponding to the rule label; The configuration register group is used to store matching rule partition information and matching rule setting information; The matching processing unit is used to receive rule matching requests input by user business logic, including rule tags and keywords, obtain matching rule partition information and matching rule setting information based on the rule tags, and match the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information based on the matching rule partition information.
[0011] Thirdly, the present invention provides an electronic device, comprising: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor executes the instructions stored in the memory to perform the method described above.
[0012] Fourthly, the present invention provides a computer-readable storage medium for storing instructions that, when executed, cause the above-described method to be implemented.
[0013] Fifthly, the present invention provides a computer program product that, when invoked by a computer, causes the computer to execute the above-described method.
[0014] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are: This invention features a unified rule table storage space and matching logic, and supports real-time definition of multiple different matching rules through configuration options, enabling general rule matching for mixed searches. Keyword matching supports flexible keyword field partitioning, configurable precision, range, masking, and other matching functions.
[0015] This invention achieves high rule matching performance, low implementation cost, and universal rule matching functionality, adaptable to various hybrid rule matching scenarios. It offers better range matching support than TCAM and addresses the limitations of traditional hard comparison techniques, which require specific design and lack universal support, enabling more flexible deployment.
[0016] This invention can be applied to devices implemented with CPU+FPGA chips, SOPC chips and devices implemented with them, ASIC chips and devices implemented with them, etc. It can support various types of rule matching scenarios and has the ability to adjust rule settings in real time, thus having better versatility and reducing the requirements for customized development. Attached Figure Description
[0017] Figure 1 A schematic diagram of a general rule matching method and apparatus provided in an embodiment of the present invention.
[0018] Figure 2 This is a schematic diagram of table entry partitioning in an embodiment of the present invention.
[0019] Figure 3 This is a schematic diagram of the table entry structure in an embodiment of the present invention.
[0020] Figure 4 This is a schematic diagram illustrating the matching rule settings in an embodiment of the present invention.
[0021] Figure 5 This is a schematic diagram of the rule matching request format in an embodiment of the present invention.
[0022] Figure 6 This is a functional diagram of the matching processing unit in an embodiment of the present invention.
[0023] Figure 7 This is a schematic diagram of the matching processing unit performing matching operations in an embodiment of the present invention.
[0024] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0026] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0027] like Figure 1 As shown, this embodiment of the invention provides a general rule matching method, which is implemented based on an entry management unit, an entry storage unit, a configuration register group, and a matching processing unit.
[0028] The table entry management unit manages the table entry storage unit and the configuration register group, and assigns a rule label to each matching rule. The rule label is then distributed to the configuration register group and the user business logic.
[0029] In this embodiment of the invention, the table entry management unit serves as an operation tool, providing input / output interfaces for users or other objects that wish to manipulate the table entry matching function, and implementing corresponding functions, including table entry configuration, working mode settings, and working status information display. The table entry management unit is also responsible for communication with the table entry storage unit and the configuration register group, converting relevant information into a format that meets the requirements for distribution, supporting the addition, deletion, querying, and modification of configuration information for table entries in the table entry storage unit and rule matching tables in the configuration register group, and providing the collection of running status information for each functional module.
[0030] The rule flag is used to mark a specific matching rule. This rule flag will be distributed to the configuration register group and the corresponding user business logic for relevant modules to compare against the matching rule.
[0031] When a user's business logic expects to perform a search for a certain type of matching rule, the user provides keywords and corresponding rule tags in the rule matching request according to the specified format. The matching processing unit then accesses the table entries in the corresponding table entry storage unit according to the information corresponding to the rule tags and initiates the corresponding matching operation.
[0032] This invention does not specify the number of matching rules that can be supported, which is determined by the specific implementation, but requires that each matching rule corresponds to a partition in the table entry storage unit and a set of rule setting information.
[0033] The table entry storage unit stores each table entry according to the matching rule corresponding to the rule label.
[0034] In this embodiment of the invention, the table entry storage unit can be implemented using RAM, registers, or other hardware storage logic. The table entry storage unit is divided into multiple different partitions by the table entry management unit. The number and size of the partitions are adjustable. Each partition is independent and corresponds to table entries under different matching rules, such as... Figure 2 As shown.
[0035] When the matching processing unit receives a rule matching request with a specific rule tag, it retrieves the table entry from the partition corresponding to the table entry storage unit according to the configured matching rule partition information and matching rule settings, and matches it with the keywords in the rule matching request. The number of partitions supported by the table entry storage unit should be consistent with the number of matching rules that can be supported in the specific implementation.
[0036] The table entries stored in the table entry storage unit are managed on a per-entry basis. Each entry includes fields such as a valid flag, a fuzzy matching key field, an extended fuzzy matching key field, a precise matching key field, priority, and result information. The precise matching key field, priority, and / or result information are optional fields. Figure 3 shown. Specifically: The validity flag is used to indicate whether a table entry is valid; only valid entries can be used for matching.
[0037] Priority is an optional field. Whether it is present and the field width A are determined by the specific implementation. It is used to indicate the priority of the table item. If the table item needs to support priority, it can be marked with this priority field. If there are multiple table items in the matching result of the matching processing unit, the table item with the highest priority is taken as the final matching result.
[0038] The exact match keyword is an optional field. Whether it is present and the field width B are determined by the specific implementation. It is used to match the keyword in the rule matching request. The matching processing unit will precisely compare the exact match keyword with the corresponding keyword in the rule matching request as the basis for the hit decision. By using the exact match keyword, the use of a mask can be eliminated, thereby reducing resource consumption.
[0039] Fuzzy matching keywords and extended fuzzy matching keywords are used together to indicate the one-to-one correspondence between keywords and masks when performing range matching or mask matching. When range matching is desired, the fuzzy matching keyword stores the lower bound of the range, and the extended fuzzy matching keyword stores the upper bound of the range. When mask matching is desired, the fuzzy matching keyword stores the keyword, and the extended fuzzy matching keyword stores the mask. Each of these two fields has a width of N bits, where the size of N is determined by the specific implementation.
[0040] The result information is an optional field used to store the matching results that should be returned to the user's business logic. Whether or not result information is included, and the size of its length M, is determined by the specific implementation. If no result information is provided, the returned result should be the index value information of the matched table entries. The result information after rule matching will be used to guide the specific functions of the user's business logic.
[0041] The configuration register group stores the configuration information of the rule matching table, including the matching rule partition information and the matching rule setting information.
[0042] The matching rule partition information refers to the start and end addresses of the storage units allocated by the table entry management unit for each matching rule, which are used to guide the matching processing unit to retrieve the rule matching table in the correct partition.
[0043] The rule setting information is used to configure the specific content of a set of matching rules, including a switch to enable or disable the matching rule and information to guide the rule matching operation logic in the matching processing unit on how to process the rule tags. The guidance information has two categories: One type specifies which fields are related and which fields are independent of each other; Another type specifies which fields are compared using range comparisons and which fields are compared using mask comparisons.
[0044] By flexibly configuring the rules, support for different matching rules can be achieved.
[0045] The granularity of field segmentation and the number of field segments that the matching rules can support are all determined by the specific implementation. Figure 4 Examples of three different matching rules are given when the fuzzy matching keyword length is 104 bits. In these examples, the three different matching requirements are all supported in the same rule matching table implementation.
[0046] The matching processing unit receives a rule matching request input from the user's business logic, including rule tags and keywords. It obtains matching rule partition information and matching rule setting information based on the rule tags, and matches the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information.
[0047] The user's business logic parses the keywords to be matched and sends them, along with the corresponding rule tags, into the rule matching request input channel. The format of the rule matching request is as follows: Figure 5 As shown, it includes rule tags, keywords to be precisely matched, and keywords to be fuzzily matched, wherein the lengths of the keywords to be precisely matched and the keywords to be fuzzily matched should conform to the format in the table entries.
[0048] The function of the matching processing unit is as follows: Figure 6 As shown. It supports one or more rule matching request input channels and result output channels, allowing multiple different user business logics to access rule matching requests. Channels can use arbitrary arbitration scheduling methods such as round-robin or priority scheduling, determined by the specific implementation. After the requests are merged, the matching processing unit obtains the configuration information of the corresponding rule matching table in the configuration register group based on the rule tag in the rule matching request, and matches the table entries in the corresponding partition of the table entry storage unit with the keywords in the request according to the set matching rules.
[0049] This invention does not specify the specific method by which the matching processing unit accesses the table entry storage unit, such as serial access, parallel access, or mixed access; this is determined by the specific implementation. The matching operation is implemented as follows: Figure 7 As shown in the diagram, this schematic specifies a particular table entry format design and matching rule pattern. Upon a successful match, a result is obtained, which should contain at least a 1-bit match flag. If a result information field is available, the result information or both the result information and the table entry index value can be output. If no result information field is available, at least one index value should be output. The matching result is ultimately sent to the corresponding result channel based on which channel the input was sent to, and then returned to the corresponding user business logic.
[0050] Based on the same technological concept, such as Figure 7 As shown, embodiments of the present invention also provide a universal rule matching device, comprising: The table entry management unit is used to manage the table entry storage unit and the configuration register group, and to assign a rule label to each matching rule. The rule label is then distributed to the configuration register group and the user business logic. The table entry storage unit is used to store each table entry according to the matching rule corresponding to the rule label; The configuration register group is used to store matching rule partition information and matching rule setting information; The matching processing unit is used to receive rule matching requests input by user business logic, including rule tags and keywords, obtain matching rule partition information and matching rule setting information based on the rule tags, and match the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information based on the matching rule partition information.
[0051] The working principles of each functional module in the above system can be referred to the description in the aforementioned method embodiments, and will not be repeated here.
[0052] Based on the same technical concept, embodiments of the present invention also provide an electronic device that can implement the general rule matching method flow provided in the above embodiments of the present invention. In one embodiment, the electronic device may be a server, a terminal device, or other electronic device. Figure 8 As shown, the electronic device may include: At least one processor and a memory connected to the at least one processor. In this embodiment of the invention, the specific connection medium between the processor and the memory is not limited. Figure 8 The example used is the connection between the processor and memory via a bus. The bus... Figure 8 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. Buses can be divided into address buses, data buses, control buses, etc., but for ease of representation, [the specific bus type is not shown here]. Figure 8 The processor is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, a processor can also be called a controller; there are no restrictions on the name.
[0053] In this embodiment of the invention, the memory stores instructions that can be executed by at least one processor. By executing the instructions stored in the memory, at least one processor can execute a general rule matching method as described above.
[0054] The processor is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory and calling data stored in memory, it can monitor the device's various functions and process data, thereby enabling overall monitoring of the device.
[0055] In an alternative design, the processor may include one or more processing units. The processor may integrate an application processor and a modem processor, wherein the application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may also not be integrated into the processor. In some embodiments, the processor and memory may be implemented on the same chip; in some embodiments, they may also be implemented separately on separate chips.
[0056] The processor can be a general-purpose processor, such as a CPU, digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of a general rule matching method disclosed in the embodiments of this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0057] Memory, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. In embodiments of the present invention, memory can also be a circuit or any other device capable of implementing storage functions, used to store program instructions and / or data.
[0058] By designing and programming the processor, the code corresponding to the general rule matching method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute the steps of the method described in the foregoing embodiments during runtime. How to design and program the processor is a technique well-known to those skilled in the art, and will not be elaborated upon here.
[0059] Based on the same inventive concept, embodiments of the present invention also provide a storage medium storing computer instructions that, when executed on a computer, cause the computer to perform a general rule matching method described above.
[0060] In some alternative embodiments, the present invention also provides that various aspects of a general rule matching method can also be implemented as a program product comprising program code that, when the program product is run on a device, causes the control device to perform the steps in a general rule matching method according to various exemplary embodiments of the present invention as described above.
[0061] It should be noted that although several units or sub-units of the apparatus have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the invention, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units. Furthermore, although the operation of the method of the invention is described in a specific order in the drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0062] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0063] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a server, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0064] Program code for performing the operations of this invention can be written using any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0065] In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0066] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0067] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0068] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A general rule matching method, characterized in that, include: The table entry management unit manages the table entry storage unit and the configuration register group, and assigns a rule label to each matching rule. This rule label is then distributed to the configuration register group and the user business logic. The table entry storage unit stores each table entry according to the matching rule corresponding to the rule label; The configuration register group stores matching rule partition information and matching rule settings. The matching processing unit receives rule matching requests input by the user's business logic, including rule tags and keywords. It obtains matching rule partition information and matching rule setting information based on the rule tags, and matches the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information based on the matching rule partition information. The table entries stored in the table entry storage unit are managed in units of table entry entries. The fields of each table entry entry include valid flag, fuzzy matching key field, extended fuzzy matching key field, exact matching key field, priority, and result information. The validity flag is used to indicate whether an entry is a valid entry; Priority is used to indicate the priority of an entry. If the matching result of the matching processing unit contains multiple entries, the entry with the highest priority is taken as the final matching result. The exact match key field is used to match keywords in the rule matching request; Fuzzy matching key fields and extended fuzzy matching key fields are used together to indicate the range matching boundaries or the one-to-one correspondence between keywords and masks when using mask matching. The results information is used to store the matching results that should be returned to the user's business logic.
2. The general rule matching method according to claim 1, characterized in that, The precise matching key fields, priority, and / or result information are optional fields.
3. The general rule matching method according to claim 1, characterized in that, The matching rule partitioning information refers to the start and end addresses of the storage units allocated by the table entry management unit for each matching rule, which are used to guide the matching processing unit to retrieve the rule matching table in the correct partition.
4. The general rule matching method according to claim 1, characterized in that, The rule setting information is used to configure the specific content of a set of matching rules, including a switch to enable or disable the matching rule and information to guide the rule matching operation logic in the matching processing unit on how to process the rule tags.
5. The general rule matching method according to claim 1, characterized in that, The matching processing unit supports one or more rule matching request input channels and result output channels to support multiple different user business logics to access rule matching requests; among them, the channels adopt a round-robin or priority arbitration scheduling method.
6. A universal rule matching device, characterized in that, include: The table entry management unit is used to manage the table entry storage unit and the configuration register group, and to assign a rule label to each matching rule. The rule label is then distributed to the configuration register group and the user business logic. The table entry storage unit is used to store each table entry according to the matching rule corresponding to the rule label; The configuration register group is used to store matching rule partition information and matching rule setting information; The matching processing unit is used to receive rule matching requests input by user business logic, including rule tags and keywords, obtain matching rule partition information and matching rule setting information based on the rule tags, and match the table entries in the corresponding partitions of the table entry storage unit with the keywords according to the matching rule setting information based on the matching rule partition information. The table entries stored in the table entry storage unit are managed in units of table entry entries. The fields of each table entry entry include valid flag, fuzzy matching key field, extended fuzzy matching key field, exact matching key field, priority, and result information. The validity flag is used to indicate whether an entry is a valid entry; Priority is used to indicate the priority of an entry. If the matching result of the matching processing unit contains multiple entries, the entry with the highest priority is taken as the final matching result. The exact match key field is used to match keywords in the rule matching request; Fuzzy matching key fields and extended fuzzy matching key fields are used together to indicate the range matching boundaries or the one-to-one correspondence between keywords and masks when using mask matching. The results information is used to store the matching results that should be returned to the user's business logic.
7. An electronic device, characterized in that, include: At least one processor; and a memory communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which executes the instructions stored in the memory to perform the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store instructions that, when executed, cause the method as described in any one of claims 1-5 to be implemented.
9. A computer program product, characterized in that, When the computer program product is invoked by a computer, it causes the computer to perform the method as described in any one of claims 1-5.