A message keyword matching method, device and equipment and a storage medium

By using Bloom prediction to determine the starting position of packet keywords and re-encode them in network data traffic processing equipment, the problem of multiple lookups in TCAM technology is solved, achieving efficient and accurate multi-rule matching and improving the matching efficiency of the equipment.

CN116451648BActive Publication Date: 2026-11-20DAWNING NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310291343.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2026-11-20
Estimated Expiration
2043-03-21

AI Technical Summary

Technical Problem

In existing network data traffic processing equipment, when using TCAM technology for packet keyword matching, there is a problem that different matching rules require multiple searches, resulting in low matching efficiency and possible rule matching anomalies.

Method used

The starting position of the keyword in the message to be matched is determined by Bloom prediction, and the message is re-encoded according to the preset window range and the maximum keyword length to generate a re-encoded message that is consistent with the encoding format of the pre-issued keyword matching rules. The mask rule is used to distinguish different types of matching rules, so that multiple rules can be matched with a single message.

Benefits of technology

It improves the efficiency and accuracy of message keyword matching, avoids rule matching anomalies, and enables the simultaneous storage and matching of different types of matching rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116451648B_ABST
    Figure CN116451648B_ABST
Patent Text Reader

Abstract

The application discloses a message keyword matching method, device and equipment and a storage medium. The method comprises the following steps: obtaining a to-be-matched message, and determining a keyword starting position in the to-be-matched message through Bloom prediction; re-encoding the to-be-matched message according to the keyword starting position, a preset window range and a preset maximum keyword length, and determining a re-encoded message; and matching the re-encoded message with a pre-delivered keyword matching rule to generate a keyword matching result; wherein the keyword matching rule is at least one of a first keyword matching rule and a second keyword matching rule, the mask rules of the first keyword matching rule and the second keyword matching rule are different, and the encoding format of the re-encoded message is the same as that of the keyword matching rule. Through the above technical solution, the to-be-matched message is not sent for multiple times for different types of matching rules, and rule matching exceptions can be avoided, thereby improving the message keyword matching efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network data processing technology, and in particular to a message keyword matching method, apparatus, device, and storage medium. Background Technology

[0002] Existing network traffic processing equipment often utilizes ternary content addressable memory (TCAM) chips to perform floating rule matching on network data packets. However, with the increasing volume of network traffic requiring keyword filtering, the functional and performance requirements for devices performing packet keyword matching are constantly rising, necessitating the maximization of matching efficiency within the constraints of limited device performance.

[0003] Currently, network data packet matching using TCAM technology mainly has two forms: full-packet floating rule matching and window floating rule matching, which can support different requirements for matching network data packet keywords respectively.

[0004] However, because the two matching rules are executed differently, the message format input to the TCAM for matching under different matching rules should be different. If the same message input is used for both matching rules, the starting point of the message to be matched may be within the window range while the ending value is outside the window range. Furthermore, a message keyword matching device typically stores only one type of matching rule to ensure the accuracy of message matching. If message matching under different matching rules is required, it must be achieved by searching the TCAM twice, reducing the efficiency of message keyword matching. Summary of the Invention

[0005] This invention provides a message keyword matching method, apparatus, device, and storage medium, which can achieve matching of different keyword matching rules through a single message transmission, and can avoid rule matching anomalies, thereby improving message keyword matching efficiency.

[0006] In a first aspect, embodiments of the present invention provide a message keyword matching method, including:

[0007] Obtain the message to be matched, and determine the starting position of the keyword in the message to be matched using Bloom prediction;

[0008] The message to be matched is re-encoded based on the keyword start position, preset window range, and preset maximum keyword length to determine the re-encoded message.

[0009] The recoded message is matched with the pre-issued keyword matching rules to generate keyword matching results;

[0010] The keyword matching rule is at least one of the first keyword matching rule and the second keyword matching rule, and the masking rules of the first keyword matching rule and the second keyword matching rule are different; the encoding format of the re-encoded message is the same as the encoding format of the keyword matching rule.

[0011] Optionally, the message to be matched is re-encoded based on the keyword start position and a preset window range to determine the message to be re-encoded, including:

[0012] The message to be matched is identified as the target message, which starts with the keyword and has a length equal to the preset maximum keyword length.

[0013] Generate a bitmap message with a length equal to the preset maximum keyword length based on the keyword start position, preset window range, and preset maximum keyword length.

[0014] The target message is combined with the range bitmap message to determine the recoded message.

[0015] The above technical solution determines the messages to be matched by setting a window range based on the starting position of the keyword to be matched in the message to be matched. At the same time, the determined messages are re-encoded to make them the same as the pre-issued keyword matching rule structure. Since the encoding format of different types of keyword matching rules is unified in the embodiments of the present invention, the re-encoded messages can be directly matched with the keyword matching rules, avoiding the need to send multiple messages to be matched for different types of matching rules.

[0016] Optionally, based on the keyword start position, a preset window range, and a preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated, including:

[0017] If the starting position of the keyword is outside the preset window range, a range bitmap message with a length of the preset maximum keyword length and all range bitmaps set to one will be generated.

[0018] If the keyword's starting position is within the preset window range, then the starting range bitmap is determined based on the keyword's starting position, the preset maximum keyword length, and the window's ending position within the preset window range. Based on the starting range bitmap and the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated.

[0019] The above technical solution sets up a range bitmap message for mask calculation by relating the starting position of the keyword to the preset window range. The range bitmap message indicates the feasibility of matching the keyword in the message to be matched, avoiding rule matching anomalies caused by exceeding the window range, and improving the accuracy and efficiency of message matching.

[0020] Optionally, the starting range bitmap is determined based on the keyword start position, the preset maximum keyword length, and the preset window range end position, including:

[0021] The difference between the end position of the window and the start position of the keyword is determined as the first difference value;

[0022] The difference between the preset maximum keyword length and the first difference is determined as the second difference, and the second difference plus one is determined as the starting range bitmap.

[0023] The above technical solution clarifies the method for determining the starting range bitmap, so as to set the mask of the recoded message by marking the starting range bitmap, thereby clarifying whether the keyword to be matched in the message to be matched can be hit by the subsequent matching rules, thus improving the accuracy and efficiency of message matching.

[0024] Optionally, based on the starting range bitmap and the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated, including:

[0025] If the starting range bitmap is greater than the preset maximum keyword length, a range bitmap message with the preset maximum keyword length and all range bitmaps set to zero will be generated.

[0026] Otherwise, a range bitmap message with a length of the preset maximum keyword length is generated, the starting range bitmap is set to one, and all other range bitmaps are set to zero is generated.

[0027] The above technical solution sets the bitmap of each range in the recoded message by determining the relationship between the starting range bitmap and the preset maximum keyword length, and clarifies whether the keyword to be matched in the message to be matched can be hit by the subsequent matching rules, thereby improving the accuracy and efficiency of message matching.

[0028] Optionally, before obtaining the message to be matched, the following steps are also included:

[0029] Get the keyword to be matched and the matching rule type;

[0030] Keyword matching rules are constructed and issued based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length.

[0031] The above technical solution constructs keyword matching rules with a consistent encoding format by using the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length. Since the rule format is unified in the message keyword matching process, the rule hit is determined only by setting different mask rules, so that different matching rule types can be stored in the same device at the same time, and different rules can be hit in a single message to be matched.

[0032] Optionally, keyword matching rules are constructed based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length, including:

[0033] Construct a rule keyword message containing the keyword to be matched, with a length equal to the preset maximum keyword length;

[0034] If the matching rule type is a full-coverage matching rule type, then construct a first rule range bitmap message with a length of the preset maximum keyword length, and set each first rule range bitmap in the first rule range bitmap message to a mask and ignore it;

[0035] If the matching rule type is window matching rule type, the unreachable range of the keyword is determined according to the keyword length of the keyword to be matched and the preset maximum keyword length, and a second rule range bitmap message with a length of the preset maximum keyword length is constructed based on the unreachable range of the keyword; wherein, each second rule range bitmap corresponding to the unreachable range of the keyword in the second rule range bitmap message is set to zero and the mask is of concern, and the remaining second rule range bitmaps are set to the mask and are not of concern;

[0036] The rule keyword message is combined with the first rule range bitmap message to determine the first keyword matching rule;

[0037] The rule keyword message is combined with the second rule range bitmap message to determine the second keyword matching rule.

[0038] The above technical solution synchronizes the encoding format of rules and messages during message matching by setting different bits in the rule range bitmap of keyword matching rules and setting whether or not the mask is important, thus avoiding rule matching anomalies and improving message keyword matching efficiency.

[0039] Optionally, the recoded message is matched against the pre-issued keyword matching rules to generate keyword matching results, including:

[0040] Perform masking operations on the recoded message and keyword matching rules;

[0041] If the calculation result is completely consistent, then the keyword matching result is determined as a rule hit;

[0042] Otherwise, the keyword matching result will be determined as a rule mismatch.

[0043] The above technical solution uses masking to determine the match between the recoded message and the keyword matching rule. Due to the different masking states in different keyword matching rules, it achieves accurate matching between a single recoded message transmission and the keyword matching rule, avoids rule matching anomalies, and improves the efficiency of message keyword matching.

[0044] Secondly, embodiments of the present invention also provide a message keyword matching device, comprising:

[0045] The message acquisition module is used to acquire the message to be matched and determine the starting position of the keyword in the message to be matched through Bloom prediction;

[0046] The message recoding module is used to recode the message to be matched based on the keyword start position, preset window range and preset maximum keyword length, and to determine the message to be recoded.

[0047] The keyword matching module is used to match the recoded message with the pre-issued keyword matching rules and generate keyword matching results;

[0048] The keyword matching rule is at least one of the first keyword matching rule and the second keyword matching rule, and the masking rules of the first keyword matching rule and the second keyword matching rule are different; the encoding format of the re-encoded message is the same as the encoding format of the keyword matching rule.

[0049] Thirdly, embodiments of the present invention also provide a message keyword matching device, comprising:

[0050] At least one processor; and

[0051] A memory that is communicatively connected to at least one processor; wherein,

[0052] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor can execute the message keyword matching method provided in the embodiments of the present invention.

[0053] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the message keyword matching method provided in embodiments of the present invention.

[0054] The technical solution of this invention unifies the encoding format of the message to be matched and the keyword matching rule by recoding the message to be matched. Different mask rules are used to distinguish the matching rule types of the keyword matching rule, so that keyword matching rules of different matching rule types can coexist in the device. The recoded message can be directly matched with the keyword matching rule, and accurately hit the rule to be matched according to the corresponding mask. This avoids sending multiple messages to be matched for different types of matching rules, avoids rule matching anomalies, and improves the efficiency of message keyword matching.

[0055] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0056] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0057] Figure 1 A flowchart of a message keyword matching method provided in an embodiment of the present invention;

[0058] Figure 2 A flowchart of another message keyword matching method provided in an embodiment of the present invention;

[0059] Figure 3 This is a flowchart illustrating a process for constructing keyword matching rules based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length, as provided in an embodiment of the present invention.

[0060] Figure 4 This is a schematic diagram of the structure of a message keyword matching device provided in an embodiment of the present invention;

[0061] Figure 5 This is a schematic diagram of a message keyword matching device provided in an embodiment of the present invention. Detailed Implementation

[0062] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0063] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0064] Figure 1 This is a flowchart of a message keyword matching method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to the situation of matching and searching for keywords existing in messages during the processing of network data traffic. The method can be executed by a message keyword matching device, which can be implemented in software and / or hardware. The message keyword matching device can be configured in a message keyword matching equipment, which can be composed of two or more physical entities or a single physical entity.

[0065] In this embodiment of the invention, the message keyword matching method can be implemented by combining a Field Programmable Gate Array (FPGA) and a TCAM chip. The FPGA performs extraction and recoding of the message to be matched, and then sends the processed message to the TCAM. The keyword matching rules pre-deployed in the TCAM then perform a match on the received message. It should be noted that since each bit in the TCAM can represent three values: 0, 1, and X, each bit in the TCAM is actually two bits physically, meaning that the actual value includes a corresponding mask state value. Based on the characteristics of the TCAM chip, this allows keyword matching rules of different matching rule types for the same keyword to be matched to be simultaneously deployed to the TCAM for subsequent matching.

[0066] like Figure 1 As shown in the figure, the message keyword matching method provided by this embodiment of the invention specifically includes the following steps:

[0067] S101. Obtain the message to be matched and determine the starting position of the keyword in the message to be matched by Bloom prediction.

[0068] In this embodiment, the message to be matched can be understood as a filtered network data traffic message, and it is necessary to determine whether it contains a specific keyword. Bloom Filter can be understood as a large-scale deduplication algorithm that can be used to filter key information in messages. In this embodiment, the Bloom Filter algorithm is applied to find the position of the first character of the keyword in the message to be matched. The keyword starting position can be understood as the position of the first character of the keyword to be matched within the message to be matched.

[0069] Specifically, when network data traffic needs to be processed, the FPGA acquires the message to be matched that needs to be matched by keyword matching, and determines the position of the first character of the keyword in the message to be matched by the Bloom prediction algorithm, and determines the position as the keyword starting position.

[0070] For example, assuming the message to be matched is a 200-character message, and the keyword to be matched is a combination of 6 characters located in characters 94-99 of the message to be matched, then the starting position of the keyword is the 94th character of the message to be matched.

[0071] S102. Re-encode the message to be matched based on the keyword starting position, preset window range, and preset maximum keyword length to determine the re-encoded message.

[0072] The encoding format of the recoded message is the same as that of the keyword matching rule.

[0073] In this embodiment, the preset window range can be understood as a pre-set value based on the user's actual needs, indicating the range of messages the user wishes to search for keywords in the message to be matched. For example, assuming the message to be matched is a 200-character message, and the user wishes to perform keyword matching on the message within the range of characters 25 to 140, then the preset window range can be considered to be characters 25-140, without needing to perform keyword matching or subsequent keyword rule matching on messages exceeding this window range. The preset maximum keyword length can be understood as a pre-set value based on the actual situation, representing the maximum length of the keywords to be matched. The re-encoded message can be understood as a message generated after re-encoding the message information in the message to be matched according to the corresponding encoding format of the pre-issued keyword matching rules.

[0074] Specifically, the FPGA determines the messages that need to be entered into the TCAM for matching with the keyword matching rules based on the keyword start position and the preset maximum keyword length. Then, it determines whether all the messages to be matched are within the window range based on the preset window range. It configures the corresponding mask for the determined messages, combines the original message and the mask information, and re-encodes them into messages with the same encoding format as the pre-issued keyword matching rule, thus obtaining the re-encoded message.

[0075] In this embodiment of the invention, by recoding the message to be matched, the recoded message has the same encoding format as the keyword matching rules pre-issued in the TCAM. This eliminates the need for the FPGA to send different messages to the TCAM based on different types of keyword matching rules. Furthermore, since the recoded message includes mask information configured according to a preset window range, keyword start position, and preset maximum keyword length, rule matching anomalies are avoided. Moreover, due to the limitation of the preset window range, the length of the message that needs to be sent to the TCAM is reduced, thereby improving the keyword matching efficiency of the message.

[0076] S103. Match the recoded message with the pre-issued keyword matching rules to generate keyword matching results.

[0077] The keyword matching rule is at least one of the first keyword matching rule and the second keyword matching rule, and the masking rules of the first keyword matching rule and the second keyword matching rule are different.

[0078] In this embodiment, the keyword matching rule can be specifically understood as a rule used to query whether a specified keyword appears in a network packet.

[0079] Specifically, before the message keyword matching device is put into use, keyword matching rules with different masking rules can be generated according to different keywords to be matched and the requirements for network message query positions. These keyword matching rules are then sent to the TCAM for storage. For example, the keyword matching rule that enables keyword matching at any position in the network message can be determined as the first keyword matching rule, and its masking state can be set according to the corresponding encoding format. The keyword matching rule that enables keyword matching within a specified range of positions in the network message can be determined as the second keyword matching rule, and its masking state can be set according to the corresponding encoding format. When the TCAM receives a recoded message sent by the FPGA, it determines the rule to be matched from the pre-issued multiple keyword matching rules based on the keyword content to be matched in the recoded message. Then, it matches the masking information of the recoded message with the masking information in the keyword matching rule to be matched, and determines the hit result of the recoded message and the keyword matching rule as the keyword matching result.

[0080] This invention provides a message keyword matching method. The method involves acquiring a message to be matched and determining the starting position of keywords in the message using Bloom prediction. The message is then re-encoded based on the keyword starting position, a preset window range, and a preset maximum keyword length to determine a re-encoded message. The re-encoded message is then matched against pre-issued keyword matching rules to generate a keyword matching result. The keyword matching rule is at least one of a first keyword matching rule and a second keyword matching rule, and the masking rules for the first and second keyword matching rules are different. The encoding format of the re-encoded message is the same as the encoding format of the keyword matching rule. By adopting the above technical solution, the recoding of the message to be matched unifies the encoding format of the message to be matched and the keyword matching rule. Different mask rules are used to distinguish the matching rule types of the keyword matching rule, so that keyword matching rules of different matching rule types can coexist in the device. The recoded message can be directly matched with the keyword matching rule, and the rule to be matched is accurately hit according to the corresponding mask. This avoids sending multiple messages to be matched for different types of matching rules, avoids rule matching anomalies, and improves the efficiency of message keyword matching.

[0081] Figure 2 This is a flowchart illustrating another message keyword matching method provided by an embodiment of the present invention. The technical solution of this embodiment further refines the aforementioned optional technical solutions, clarifying the keyword matching rules and the encoding format of the recoded message, as well as the determination methods for the two parts of the message in the encoding format. Based on a preset window range, the keyword starting position, and a preset maximum keyword length, the bitmap setting information of each range bitmap in the range bitmap message is determined for subsequent masking operations in TCAM. By unifying the rules and the message encoding format, accurate matching of the keyword rules with a single recoded message transmission is achieved, avoiding rule matching anomalies and improving message keyword matching efficiency.

[0082] like Figure 2 As shown in the figure, the message keyword matching method provided by this embodiment of the invention specifically includes the following steps:

[0083] S201. Obtain the message to be matched and determine the starting position of the keyword in the message to be matched by Bloom prediction.

[0084] S202. The message in the message to be matched that starts with the keyword and has a length equal to the preset maximum keyword length is identified as the target message.

[0085] In this embodiment, the target message can be specifically understood as the original message extracted from the message to be matched and that needs to be sent to TCAM for keyword matching.

[0086] Specifically, to reduce the length of the message sent to TCAM for keyword matching, and to ensure that the determined message can accommodate the keyword to be matched, since the preset maximum keyword length is the maximum length of the message that can be matched for keyword matching in the keyword matching rule, and is also the specified length of the keyword message part in the keyword matching rule encoding format, after the FPGA determines the keyword start position through the Bloom algorithm, it can use the keyword start position as the first byte of the message to be sent to TCAM for keyword matching, and determine the message with a length of the preset maximum keyword length that is included after that byte as the target message to be sent to TCAM for keyword matching.

[0087] For example, assuming the message to be matched is a 200-character message, the maximum keyword length is preset to 20 bytes, and the determined keyword starting position is the 94th character, then the generated target message is the message containing characters 94-113 of the message to be matched.

[0088] S203. Generate a bitmap message with a length equal to the preset maximum keyword length based on the keyword starting position, preset window range, and preset maximum keyword length.

[0089] In this embodiment, the range bitmap message can be understood as a message used to indicate the mask state of each byte in the target message, or as a message used to indicate whether the predicted starting position of the keyword in the target message can appear in the corresponding range bitmap.

[0090] Specifically, by comparing the relationship between the keyword start position and the preset window range, it can be determined whether the target message is the message the user needs to find, and whether the target message contains the keyword to be matched that the user actually needs to find. Based on this, considering the preset maximum keyword length, it can be determined whether the target message can hit the keyword matching rule information pre-issued to TCAM. In this embodiment of the invention, by setting a range bitmap message corresponding to the target message, the mask state of each range bitmap corresponding to the target message is determined according to the keyword start position, the preset window range and the preset maximum keyword length, so as to meet the requirements of subsequent keyword matching rule hits.

[0091] In one embodiment of the present invention, a bitmap message with a length equal to the preset maximum keyword length is generated based on the keyword start position, a preset window range, and a preset maximum keyword length. This can be specifically divided into the following two cases:

[0092] A) If the starting position of the keyword is outside the preset window range, a range bitmap message with a length of the preset maximum keyword length and each range bitmap set to one will be generated.

[0093] Specifically, when the starting position of the keyword is outside the preset window range, it can be assumed that there is no keyword to be matched within the window range that the user needs to match. That is, there is definitely no keyword matching rule in TCAM that can match the recoded message sent to it. Since the range bitmaps set by the keyword matching rules in TCAM are all set to zero under the mask concern condition, a range bitmap message with the same length as the target message and all range bitmaps set to one is generated to ensure that it is not matched by the rule.

[0094] B) If the keyword starting position is within the preset window range, then determine the starting range bitmap based on the keyword starting position, the preset maximum keyword length, and the window ending position of the preset window range. Based on the starting range bitmap and the preset maximum keyword length, generate a range bitmap message with a length equal to the preset maximum keyword length.

[0095] In this embodiment, the window end position can be specifically understood as the position corresponding to the last byte of the message range in which the user wants to perform keyword search in the message to be matched. The start range bitmap can be specifically understood as the range bitmap corresponding to the position where the keyword start position appears within the window range.

[0096] Specifically, if the starting position of the keyword is within the preset window range, the keyword to be matched in the target message may be completely within the preset window range or partially outside the preset window range. To ensure that the end value of the keyword to be matched in the recoded message of the hit rule is always within the window range, a range bitmap in which the starting position of the keyword appears within the preset maximum keyword length can be determined based on the starting position of the keyword, the preset maximum keyword length, and the end position of the window of the preset window range. This range bitmap is then used as the starting range bitmap. The starting range bitmap is then used to determine whether it is within the preset maximum keyword length range, in order to determine whether all target messages corresponding to the range bitmap message are in a hitable state. Finally, a range bitmap message with a length equal to the preset maximum keyword length is generated based on the starting range bitmap.

[0097] In this embodiment of the invention, the starting position of the keyword to be matched in the message to be matched is used to preset the window range to determine the message to be matched. At the same time, the determined message is re-encoded to make it the same as the pre-issued keyword matching rule structure. Since the encoding format of different types of keyword matching rules is unified in this embodiment of the invention, the re-encoded message can be directly matched with the keyword matching rule, avoiding the need to send multiple messages to be matched for different types of matching rules.

[0098] In one implementation of the embodiments of the present invention, determining the start range bitmap according to the keyword start position, the preset maximum keyword length, and the window end position of the preset window range is specifically implemented in the following manner:

[0099] Determine the difference between the window end position and the keyword start position as a first difference; determine the difference between the preset maximum keyword length and the first difference as a second difference, and determine the sum of the second difference plus one as the start range bitmap.

[0100] For example, assume that the window start position byte and the window end position byte corresponding to the preset window range are respectively LN and LM, where LN<LM, the keyword start position byte is Bs, and the preset maximum keyword length is N. When LN<Bs<LM, it is necessary to determine whether the keyword to be matched in the target message is entirely contained in the preset window range, and the range bitmap corresponding to the occurrence position of the keyword start position within the window range is determined as the start range bitmap m, which can be expressed by the following formula:

[0101] m=[N-(LM-Bs)+1]

[0102] In one implementation of the embodiments of the present invention, generating a range bitmap message with a length equal to the preset maximum keyword length according to the start range bitmap and the preset maximum keyword length is specifically divided into the following two cases:

[0103] If the start range bitmap is greater than the preset maximum keyword length, generate a range bitmap message with a length equal to the preset maximum keyword length, in which all range bitmaps are set to zero;

[0104] Otherwise, generate a range bitmap message with a length equal to the preset maximum keyword length, in which the start range bitmap is set to one and all other range bitmaps are set to zero.

[0105] Specifically, if the start range bitmap is greater than the preset maximum keyword length, it can be considered that there is no range bitmap corresponding to the position where the keyword start position cannot appear within the window range in the range bitmap message. At this time, a range bitmap message with a length equal to the preset maximum keyword length is generated, and all range bitmaps therein are set to zero. If the start range bitmap is less than or equal to the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated, in which the start range bitmap is set to one, and all other range bitmaps are set to zero.

[0106] Following the above example, if m>N, all bits of the generated range bitmap message with a length of N are set to zero; otherwise, the m-th range bitmap is set to one, and the remaining N-1 range bitmaps are set to zero.

[0107] S204. Combine the target message with the range bitmap message to determine a re-encoded message.

[0108] Following the example above, the target message containing N bytes and the range bitmap message containing N bytes are combined to form a recoded message of length 2N. The encoding format of the recoded message is shown in the table below:

[0109]

[0110] S205. Perform masking operations on the recoded message and the keyword matching rules.

[0111] Specifically, after TCAM initially determines the keyword matching rules that have the same matching keywords as the recoded message, the range bitmap message in the recoded message is masked with the range bitmap message corresponding to the determined keyword matching rule to obtain the corresponding operation result.

[0112] S206. Determine whether the calculation results are completely consistent. If yes, proceed to step S207; otherwise, proceed to step S208.

[0113] S207. Determine the keyword matching result as a rule hit.

[0114] Specifically, when the result of the masking operation is completely consistent, it can be considered that the recoded message has hit the keyword matching rule, that is, the target message of the recoded message includes the keyword to be matched. At this time, a keyword matching result containing the information of the keyword to be matched in the target message can be generated.

[0115] S208. Determine the keyword matching result as a rule mismatch.

[0116] Specifically, when the results of the masking operation are not completely consistent, it can be assumed that the recoded message does not match any keyword matching rule in TCAM, that is, the target message of the recoded message does not contain the keyword to be matched, and at this time, a keyword matching result that does not match the rule can be generated.

[0117] In one embodiment of the present invention, before obtaining the message to be matched, the method further includes: obtaining the keyword to be matched and the matching rule type; constructing a keyword matching rule based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type and the preset maximum keyword length, and issuing the keyword matching rule.

[0118] In this embodiment, the keyword to be matched can be understood as a pre-set keyword that needs to be searched for and matched in the packet. The matching rule type can be understood as the different types of keyword matching rules divided according to the required keyword query range in the network packet; the matching rule type can be divided into full-packet matching rule type and window matching rule type. The full-packet matching rule type can be understood as a rule type that matches whether the keyword appears at any position in the input network packet, while the window matching rule type can be understood as a rule type that matches whether the keyword appears within a specified position range in the input network packet. The keyword length of the keyword to be matched can be understood as the number of bytes of the keyword to be matched. It should be noted that the keyword length of the keyword to be matched should be less than the preset maximum keyword length.

[0119] Specifically, before the message keyword matching device is put into use, the keyword matching rules used for message keyword matching in the TCAM need to be distributed. This involves first obtaining the keyword to be matched and the matching rule type to construct the keyword matching rules. Then, based on the keyword to be matched and the preset maximum keyword length, a rule keyword message corresponding to the target message in the recoded message is constructed. Using the keyword length, matching rule type, and preset maximum keyword length, the range in which the first byte of the keyword to be matched cannot appear within the preset maximum keyword length is determined. This is then used to construct a rule range bitmap message corresponding to the range bitmap message in the recoded message. This ensures that the determined keyword matching rules can distinguish matching rule types and have the same encoding structure as the recoded message. The constructed keyword rules are then distributed to the TCAM for storage for subsequent rule matching.

[0120] In this embodiment of the invention, keyword matching rules with consistent encoding formats are constructed for the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length. Since the rule format in the message keyword matching process is unified, the rule hit is determined only by setting different mask rules, so that different matching rule types can be stored in the same device at the same time, and different rules can be hit in a single message to be matched.

[0121] Optional, Figure 3 This invention provides a flowchart illustrating a process for constructing keyword matching rules based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and a preset maximum keyword length. Figure 3 As shown, the specific steps may include the following:

[0122] S301. Construct a rule keyword message containing the keyword to be matched, with a length equal to the preset maximum keyword length.

[0123] Specifically, to ensure that the encoding format of the recoded message is consistent with that of the keyword matching rule, and that the keyword length of the keyword to be matched is less than or equal to the preset maximum keyword length, when constructing the keyword rule, a rule keyword with a length of the preset maximum keyword length and content including the keyword to be matched can be generated.

[0124] S302. If the matching rule type is a full-coverage matching rule type, construct a first rule range bitmap message with a length equal to the preset maximum keyword length, set each first rule range bitmap in the first rule range bitmap message to "mask not concerned", and execute step S304.

[0125] Specifically, if the received matching rule type is a full-packet matching rule type, it can be understood that the rule can perform keyword matching on all positions in the received message. That is, there is no position in the keyword matching rule where the keyword start position cannot appear. In other words, regardless of the content of the range bitmap message in the recoded message, the full-packet matching rule corresponding to the keyword to be matched can be hit. At this time, a first rule range bitmap message with a length of the preset maximum keyword length can be constructed, and each first rule range bitmap in the first rule range bitmap message is set to "mask ignored" to ensure that the range bitmap message of the recoded message hits the mask during mask calculation. After constructing the first rule range bitmap message, step S304 is executed.

[0126] S303. If the matching rule type is a window matching rule type, then determine the unreachable range of the keyword based on the keyword length of the keyword to be matched and the preset maximum keyword length, construct a second rule range bitmap message with a length equal to the preset maximum keyword length based on the unreachable range of the keyword, and execute step S305.

[0127] In the second rule range bitmap message, each second rule range bitmap corresponding to the keyword unreachable range is set to zero and the mask is of concern, while the remaining second rule range bitmaps are set to the mask and are of no concern.

[0128] Specifically, if the received matching rule type is a window matching rule type, it can be understood that this rule only supports keyword matching on a portion of the received message, meaning that there are positions in the keyword matching rule where the keyword start position cannot appear. Given that the keyword length to be matched is already known, to ensure that all keywords to be matched are within the window range, the range of keyword length before the end position in the window range is the keyword unreachable range. At this point, a second rule range bitmap message with a preset maximum keyword length can be constructed, and the corresponding second rule range bitmap within the keyword unreachable range is set to zero, and its mask state is set to "mask interested." The remaining second rule range bitmaps are set to "mask uninterested" to ensure that when the range bitmap message of the recoded message is used for mask calculation, if the starting range bitmap in the range bitmap message falls within the unreachable range of the second rule range bitmap message, the recoded message will not be matched. Step S305 is then executed after constructing the second rule range bitmap message.

[0129] S304. Combine the rule keyword message with the first rule range bitmap message to determine the first keyword matching rule.

[0130] S305. Combine the rule keyword message with the second rule range bitmap message to determine the second keyword matching rule.

[0131] For example, assuming the preset maximum keyword length is N, the length of the rule keyword message is N, and the lengths of the first rule range bitmap message and the second rule range bitmap message are both N. Since the keyword matching rule and the re-encoding have the same encoding format, the encoding formats of the generated first and second keyword matching rules are shown in the table below:

[0132]

[0133] In this embodiment of the invention, methods for setting mask rules in the generated keyword matching rules under full-packet matching and window matching conditions are given respectively. These methods synchronize the encoding format of rules and messages during message matching, avoid rule matching anomalies, and improve message keyword matching efficiency.

[0134] Figure 4 This is a schematic diagram of a message keyword matching device provided in an embodiment of the present invention. The message keyword matching device includes: a message acquisition module 41, a message recoding module 42, and a keyword matching module 43.

[0135] The message acquisition module 41 is used to acquire the message to be matched and determine the starting position of the keyword in the message to be matched through Bloom prediction; the message recoding module 42 is used to recode the message to be matched according to the starting position of the keyword, the preset window range and the preset maximum keyword length to determine the recoded message; the keyword matching module 43 is used to match the recoded message with the pre-issued keyword matching rules to generate the keyword matching result; wherein, the keyword matching rule is at least one of the first keyword matching rule and the second keyword matching rule, and the masking rules of the first keyword matching rule and the second keyword matching rule are different; the encoding format of the recoded message is the same as the encoding format of the keyword matching rule.

[0136] The technical solution of this embodiment unifies the encoding format of the message to be matched and the keyword matching rule by recoding the message to be matched. Different mask rules are used to distinguish the matching rule types of the keyword matching rule, so that keyword matching rules of different matching rule types can coexist in the device. The recoded message can be directly matched with the keyword matching rule, and accurately hit the rule to be matched according to the corresponding mask. This avoids sending multiple messages to be matched for different types of matching rules, avoids rule matching anomalies, and improves the efficiency of message keyword matching.

[0137] Furthermore, the message recoding module 42 includes:

[0138] The target message determination unit is used to determine the message in the message to be matched as the target message, which starts with the keyword and has a length of the preset maximum keyword length.

[0139] The range message determination unit is used to generate a range bitmap message with a length equal to the preset maximum keyword length based on the keyword start position, preset window range, and preset maximum keyword length.

[0140] The recoded message determination unit is used to combine the target message with the range bitmap message to determine it as a recoded message.

[0141] Optional, range message determination unit, specifically used for:

[0142] If the starting position of the keyword is outside the preset window range, a range bitmap message with a length of the preset maximum keyword length and all range bitmaps set to one will be generated.

[0143] If the keyword's starting position is within the preset window range, then the starting range bitmap is determined based on the keyword's starting position, the preset maximum keyword length, and the window's ending position within the preset window range. Based on the starting range bitmap and the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated.

[0144] Optionally, the starting range bitmap is determined based on the keyword start position, the preset maximum keyword length, and the preset window range end position, including:

[0145] The difference between the end position of the window and the start position of the keyword is determined as the first difference value;

[0146] The difference between the preset maximum keyword length and the first difference is determined as the second difference, and the second difference plus one is determined as the starting range bitmap.

[0147] Optionally, based on the starting range bitmap and the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated, including:

[0148] If the starting range bitmap is greater than the preset maximum keyword length, a range bitmap message with the preset maximum keyword length and all range bitmaps set to zero will be generated.

[0149] Otherwise, a range bitmap message with a length of the preset maximum keyword length is generated, the starting range bitmap is set to one, and all other range bitmaps are set to zero is generated.

[0150] Optional, keyword matching module 43 includes:

[0151] The masking unit is used to perform masking operations on the recoded message and the keyword matching rules.

[0152] The matching result determination unit is used to determine the keyword matching result as a rule hit if the operation result is completely consistent; otherwise, it determines the keyword matching result as a rule miss.

[0153] Optionally, the message keyword matching device may also include a matching rule construction module.

[0154] The matching rule building module is used to obtain the keyword to be matched and the matching rule type; it constructs keyword matching rules based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length, and then issues the keyword matching rules.

[0155] Optional, the matching rule building module, specifically used for:

[0156] Construct a rule keyword message containing the keyword to be matched, with a length equal to the preset maximum keyword length;

[0157] If the matching rule type is a full-coverage matching rule type, then construct a first rule range bitmap message with a length of the preset maximum keyword length, and set each first rule range bitmap in the first rule range bitmap message to a mask and ignore it;

[0158] If the matching rule type is window matching rule type, the unreachable range of the keyword is determined according to the keyword length of the keyword to be matched and the preset maximum keyword length, and a second rule range bitmap message with a length of the preset maximum keyword length is constructed based on the unreachable range of the keyword; wherein, each second rule range bitmap corresponding to the unreachable range of the keyword in the second rule range bitmap message is set to zero and the mask is of concern, and the remaining second rule range bitmaps are set to the mask and are not of concern;

[0159] The rule keyword message is combined with the first rule range bitmap message to determine the first keyword matching rule;

[0160] The rule keyword message is combined with the second rule range bitmap message to determine the second keyword matching rule.

[0161] The message keyword matching device provided in the embodiments of the present invention can execute the message keyword matching method as provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0162] Figure 5 This is a schematic diagram of a message keyword matching device provided in an embodiment of the present invention. The message keyword matching device 10 can be an electronic device, intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0163] like Figure 5 As shown, the message keyword matching device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the message keyword matching device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0164] Multiple components in the message keyword matching device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, optical disk, etc.; and a communication unit 19, such as a network card, modem, wireless transceiver, etc. The communication unit 19 allows the message keyword matching device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0165] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as message keyword matching methods.

[0166] In some embodiments, the message keyword matching method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the message keyword matching device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the message keyword matching method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the message keyword matching method by any other suitable means (e.g., by means of firmware).

[0167] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0168] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0169] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0170] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0171] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0172] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0173] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0174] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A message keyword matching method, characterized in that, include: Obtain the message to be matched, and determine the starting position of the keyword in the message to be matched by Bloom prediction; The message to be matched is re-encoded based on the keyword start position, the preset window range, and the preset maximum keyword length to determine the re-encoded message. The recoded message is matched with the pre-issued keyword matching rules to generate keyword matching results; The keyword matching rule is at least one of a first keyword matching rule and a second keyword matching rule. The first keyword matching rule is a keyword matching rule of the full packet matching rule type, and the second keyword matching rule is a keyword matching rule of the window matching rule type. The masking rules of the first keyword matching rule and the second keyword matching rule are different. The encoding format of the re-encoded message is the same as the encoding format of the keyword matching rule. The step of recoding the message to be matched based on the keyword start position, a preset window range, and a preset maximum keyword length to determine the recoded message includes: The message in the message to be matched that starts with the keyword and has a length equal to the preset maximum keyword length is identified as the target message; Based on the keyword start position, the preset window range, and the preset maximum keyword length, generate a range bitmap message with a length equal to the preset maximum keyword length; The target message is combined with the range bitmap message to determine the recoded message.

2. The method according to claim 1, characterized in that, The step of generating a bitmap message with a length equal to the preset maximum keyword length based on the keyword start position, the preset window range, and the preset maximum keyword length includes: If the starting position of the keyword is outside the preset window range, a range bitmap message with a length equal to the preset maximum keyword length and each range bitmap set to one is generated. If the starting position of the keyword is within the preset window range, then a starting range bitmap is determined based on the starting position of the keyword, the preset maximum keyword length, and the end position of the window of the preset window range. Based on the starting range bitmap and the preset maximum keyword length, a range bitmap message with a length equal to the preset maximum keyword length is generated.

3. The method according to claim 2, characterized in that, The step of determining the starting range bitmap based on the keyword start position, the preset maximum keyword length, and the preset window range end position includes: The difference between the end position of the window and the start position of the keyword is determined as the first difference value; The difference between the preset maximum keyword length and the first difference is determined as the second difference, and the second difference is incremented by one to determine the starting range bitmap.

4. The method according to claim 2, characterized in that, The step of generating a range bitmap message with a length equal to the preset maximum keyword length based on the starting range bitmap and the preset maximum keyword length includes: If the starting range bitmap is greater than the preset maximum keyword length, then a range bitmap message with a length equal to the preset maximum keyword length and each range bitmap set to zero is generated. Otherwise, a range bitmap message is generated with a length equal to the preset maximum keyword length, the starting range bitmap is set to one, and all other range bitmaps are set to zero.

5. The method according to claim 1, characterized in that, Before obtaining the message to be matched, the following is also included: Get the keyword to be matched and the matching rule type; A keyword matching rule is constructed based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length, and the keyword matching rule is then issued.

6. The method according to claim 5, characterized in that, The step of constructing keyword matching rules based on the keyword to be matched, the keyword length of the keyword to be matched, the matching rule type, and the preset maximum keyword length includes: Construct a rule keyword message containing the keyword to be matched, with a length equal to the preset maximum keyword length; If the matching rule type is a full-packet matching rule type, then a first rule range bitmap message with a length equal to the preset maximum keyword length is constructed, and each first rule range bitmap in the first rule range bitmap message is set to a mask and ignored; the rule keyword message is combined with the first rule range bitmap message to determine the first keyword matching rule; If the matching rule type is a window matching rule type, then the keyword unreachable range is determined according to the keyword length of the keyword to be matched and the preset maximum keyword length, and a second rule range bitmap message with a length equal to the preset maximum keyword length is constructed based on the keyword unreachable range; wherein, in the second rule range bitmap message, each second rule range bitmap corresponding to the keyword unreachable range is set to zero and masked as concerned, while the remaining second rule range bitmaps are set to masked as not concerned; the rule keyword message and the second rule range bitmap message are combined to determine the second keyword matching rule.

7. The method according to claim 1, characterized in that, The step of matching the recoded message with the pre-issued keyword matching rules to generate keyword matching results includes: Perform a masking operation between the recoded message and the keyword matching rule; If the calculation result is completely consistent, then the keyword matching result is determined as a rule hit; Otherwise, the keyword matching result will be determined as a rule mismatch.

8. A message keyword matching device, characterized in that, include: The message acquisition module is used to acquire the message to be matched and determine the starting position of the keyword in the message to be matched through Bloom prediction. The message recoding module is used to recode the message to be matched according to the keyword start position, the preset window range and the preset maximum keyword length, and determine the recoded message; The keyword matching module is used to match the recoded message with the pre-issued keyword matching rules to generate keyword matching results; The keyword matching rule is at least one of a first keyword matching rule and a second keyword matching rule. The first keyword matching rule is a keyword matching rule of the full packet matching rule type, and the second keyword matching rule is a keyword matching rule of the window matching rule type. The masking rules of the first keyword matching rule and the second keyword matching rule are different. The encoding format of the re-encoded message is the same as the encoding format of the keyword matching rule. The message recoding module includes: The target message determination unit is used to determine the message in the message to be matched that starts with the keyword and has a length equal to the preset maximum keyword length as the target message; The range message determination unit is used to generate a range bitmap message with a length equal to the preset maximum keyword length based on the keyword start position, the preset window range, and the preset maximum keyword length. The recoded message determination unit is used to combine the target message with the range bitmap message to determine it as a recoded message.

9. A message keyword matching device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, such that the at least one processor can perform the message keyword matching method according to any one of claims 1-7.

10. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the message keyword matching method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Deep packet inspection method

    CN102437937A

  • Method and system for performing range rule testing in a ternary content addressable memory

    US20030233516A1