KR101262337B1 - Method and apparatus for pattern matching for multi-character parallel data stream - Google Patents
Method and apparatus for pattern matching for multi-character parallel data stream Download PDFInfo
- Publication number
- KR101262337B1 KR101262337B1 KR1020090079440A KR20090079440A KR101262337B1 KR 101262337 B1 KR101262337 B1 KR 101262337B1 KR 1020090079440 A KR1020090079440 A KR 1020090079440A KR 20090079440 A KR20090079440 A KR 20090079440A KR 101262337 B1 KR101262337 B1 KR 101262337B1
- Authority
- KR
- South Korea
- Prior art keywords
- string
- pattern
- input
- index
- output
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/14—Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
- H04L63/1408—Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
- H04L63/1416—Event detection, e.g. attack signature detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
Abstract
본 발명은 다문자 병렬 데이터 스트림에 대한 패턴 매칭 방법 및 장치에 관한 것이다.The present invention relates to a method and apparatus for pattern matching for multicharacter parallel data streams.
본 발명은 데이터가 1 클록에 n-바이트씩 고속으로 처리되는 높은 처리 용량의 통신 네트워크 장비 또는 시스템에서 메모리를 효율적으로 사용할 수 있는 패턴 매칭 방법 및 장치를 통해, 패턴 매칭 장치에 필요한 메모리를 보다 효율적으로 사용할 수 있으며, 문자열 매칭과 정규 패턴 매칭을 분리함으로써 필요한 경우 그 중 한 부분만 확장이 가능해질 수 있다.The present invention provides a more efficient way of using a pattern matching method and apparatus through a pattern matching method and apparatus that can efficiently use memory in high processing capacity communication network equipment or systems in which data is processed at a high speed of n-bytes per clock. By separating string matching and regular pattern matching, only one of them can be extended if necessary.
패턴 매칭, 문자열, 다문자, 병렬, CAM(Content Addressable Memory), 연쇄 회로 Pattern Matching, Strings, Multicharacters, Parallel, CAM (Content Addressable Memory), Chained Circuits
Description
본 발명은 패턴 매칭 방법 및 장치에 관한 것으로, 특히 다문자 병렬 데이터 스트림에 대한 고속 패턴 매칭 방법 및 장치에 관한 것이다.The present invention relates to a pattern matching method and apparatus, and more particularly, to a fast pattern matching method and apparatus for a multicharacter parallel data stream.
본 발명은 지식경제부의 IT성장동력기술개발사업의 일환으로 수행한 연구로부터 도출된 것이다[과제관리번호: 2008-S-001-01, 과제명: WiBro 네트워크 신뢰성 확보 및 위치 인지 기술 개발].The present invention is derived from a study conducted as part of the IT growth engine technology development project of the Ministry of Knowledge Economy [Task management number: 2008-S-001-01, Task name: WiBro network reliability and location awareness technology development].
본 발명은 높은 처리용량의 통신 네트워크 장비 또는 시스템에서 데이터 패킷을 처리하기 위한 기술이며, 특히 다문자 병렬로 처리되는 데이터 패킷에 대한 고속 패턴 매칭 방법 및 장치에 관한 것이다. BACKGROUND OF THE
통신 네트워크는 진화하고 수없이 많은 서비스들을 새로이 창출하고 있으며, 그에 따른 사용자의 요구도 다양해지고 있다. 이에 따라 통신 네트워크에는 수없이 많은 정보가 생성되고 소멸되며 저장되기도 한다. 이러한 정보 중에는 보안이 필요한 것들이 있으며, 이를 위한 기술 또한 발전되고 있다. Communication networks have evolved and are creating a myriad of new services, and users' needs are also diversified. As a result, a great deal of information is generated, destroyed, and stored in a communication network. Some of this information requires security, and technology for this is being developed.
최근 네트워크 상에는 정보 보안을 위협하는 요소들이 복합적이고 다양화된 방법으로 나타나고 있다. 또한, 네트워크에 접속해 있는 네트워크 장비 및 통신 단말에는 위협 요소를 감지하고 차단하기 위한 기능들이 다양한 형태로 제공되고 있다. 네트워크를 위협하는 요소들은 네트워크를 통해 전달되는 패킷의 모든 계층에 걸쳐 나타날 수 있다. 특히, 응용 계층에 나타나는 요소들을 감지하기 위해서는 그 데이터를 처음부터 끝까지 모두 분석해야만 한다.Recently, threats to information security on the network are appearing in a complex and diversified way. In addition, network devices and communication terminals connected to the network are provided with various types of functions for detecting and blocking threats. Threats to the network can appear at every layer of packets passing through the network. In particular, to detect elements that appear in the application layer, the data must be analyzed from beginning to end.
일반적으로 응용 계층의 데이터로부터 특정 정보를 찾기 위해 패턴 매칭 기술이 활용된다. 즉, 응용 계층의 데이터를 검색해서 찾고자 하는 특정 정보와 일치하는 패턴이 존재하는지 여부를 판단하는 것이다. 찾고자 하는 특정 정보의 위치가 정해져 있는 것이 아니므로 매우 빠른 시간 내에 검색이 끝날 수도 있고 경우에 따라서는 데이터를 끝까지 검색해야 할 수도 있다. In general, a pattern matching technique is used to find specific information from data of an application layer. In other words, the data of the application layer is searched to determine whether there is a pattern matching the specific information to be found. Since the specific information to be searched is not determined, the search may be completed very quickly, and in some cases, the data may need to be searched to the end.
패턴 매칭 기술은 크게 두 가지 형태로 분류할 수 있다. 첫 번째로는 다양한 형태의 중앙 처리 장치와 메모리를 활용하여 소프트웨어적으로 패턴을 찾는 기술이 있다. 이 기술은 알고리즘 설계가 용이하고, 그 알고리즘을 소프트웨어로 구현함에 있어서도 매우 편리하다. 그러나, 중앙 처리 장치와 메모리의 데이터 처리 속도에 의존적이며 데이터를 처리함에 있어서 병렬 처리가 용이하지 않아 데이터를 보다 고속으로 처리함에 있어서는 어느 정도 한계가 있다. Pattern matching techniques can be classified into two types. The first is to find patterns in software using various forms of central processing units and memory. This technique is easy to design algorithms and very convenient to implement the algorithm in software. However, there are some limitations in processing data at higher speed since it depends on the data processing speed of the central processing unit and the memory, and parallel processing is not easy in processing the data.
이러한 한계를 극복하기 위해, CAM(Content Addressable Memory)을 활용하여 하드웨어적으로 패턴을 찾는 기술이 있다. 이 기술은 CAM의 병렬 처리 기능을 활용한 것으로, CAM은 복수의 엔트리를 포함하고 있다. 각 엔트리는 찾고자 하는 데이터를 저장할 수 있는 메모리와 그 메모리에 저장되어 있는 데이터와 CAM에 입력되 는 데이터를 비교할 수 있는 비교기를 포함하고 있다. 또한, CAM에 입력되는 데이터는 CAM에 포함되는 모든 엔트리에 저장되어 있는 데이터와 동시에 비교된다. CAM의 이러한 기능을 활용하면, 응용 계층의 데이터로부터 특정 정보를 찾아냄에 있어서 보다 고속으로 그 데이터를 처리할 수가 있다In order to overcome this limitation, there is a technique of finding a pattern in hardware using CAM (Content Addressable Memory). This technology takes advantage of the parallel processing capabilities of the CAM, which includes multiple entries. Each entry contains a memory to store the data you are looking for, and a comparator to compare the data stored in that memory with the data entered into the CAM. In addition, the data input to the CAM is simultaneously compared with the data stored in all entries included in the CAM. By utilizing these features of CAM, it is possible to process the data faster in finding specific information from the data of the application layer.
응용 계층의 데이터는 ASCII 문자와 같은 형태의 문자들로 구성된다. 즉, 응용 계층의 데이터는 단순한 비트들의 조합이 아니라 보다 의미 있는 1-바이트(1-byte) 문자들의 조합이라고 볼 수 있다. 따라서 응용 계층의 데이터는 통신 네트워크 장비 또는 시스템에서 최소 1-바이트 문자 단위로 처리된다.Data in the application layer consists of characters in the form of ASCII characters. In other words, the data of the application layer is not a simple combination of bits but a more meaningful combination of 1-byte characters. Therefore, data in the application layer is processed in units of at least one byte character in communication network equipment or systems.
응용 계층의 데이터에서 찾고자 하는 패턴은 1-바이트 문자들의 조합이다. 일반적으로, 패턴은 보다 의미 있는 문자열들의 조합이라고 할 수 있다. 많은 패턴 매칭 장치들이 단순한 문자열만을 찾는 것에 그치지 않고, 문자열들의 조합으로 발생될 수 있는 패턴을 찾기 위한 기술들을 포함하고 있다. The pattern to look for in the application layer is a combination of one-byte characters. In general, a pattern is a combination of more meaningful strings. Many pattern matching devices do not just look for simple strings, but include techniques for finding patterns that can be generated from a combination of strings.
그 대표적인 것이 정규 표현 매칭(Regular Expression Matching) 기술이다. 정규 표현은 특정 문자의 집합 또는 문자열을 기호로 바꾸어 놓는 방법으로, 문자열의 집합을 정확하게 표현하기 위해 쓰이는 표현 규칙, 언어의 문법 정의나 검색해야 할 문자열의 지정에 쓰인다. 정규 표현 매칭 기술은 소프트웨어적인 기술에 가깝다. 그러나 최근 그 일부를 하드웨어적으로 처리하기 위한 노력들이 진행되고 있다. A typical example is Regular Expression Matching. Regular expressions are a way of converting a set of characters or a string into a symbol, which is used in the expression rules used to accurately represent a set of strings, the definition of a language's grammar, or the specification of a string to be searched. Regular expression matching techniques are more like software techniques. However, efforts have recently been made to process some of them in hardware.
정규 표현 매칭 기술은 결정적 유한 자동 기계 장치(Deterministic Finite Automaton) 기술과 비결정적 유한 자동 기계 장치(Nondeterministic Finite Automaton) 기술로 분류할 수 있다. 자동 기계 장치는 이산 시간(Discrete Time) 단위로 운영되는 것으로 가정한다. 즉, 자동 기계 장치는 그 장치가 기본적으로 동작하는데 필요한 클록(Clock)에 따라 운영된다. Regular expression matching techniques can be classified into deterministic finite automaton technology and non-deterministic finite automaton technology. It is assumed that the automatic machinery is operated in discrete time units. In other words, the automatic mechanical device operates according to the clock required for the device to operate basically.
자동 기계 장치는 어떠한 초기 상태에 머무르다 특정 조건이 가해지면 다른 상태로 천이한다. 따라서, 정규 표현 매칭 기술은 이러한 특성을 활용하여 특정 문자 또는 문자열이 검출될 때마다 자동 기계 장치의 상태를 천이시킴으로 해서 궁극적으로 어떠한 상태에 이르면 특정 패턴이 검출되었음을 나타낼 수 있다. An automatic machine stays in one initial state and transitions to another when certain conditions are applied. Thus, regular expression matching techniques can exploit this property to transition the state of the automatic machine whenever a particular character or string is detected, ultimately indicating that a certain pattern has been detected.
결정적 유한 기계 장치는 다음 상태로의 천이가 현재 상태와 가해지는 조건에 의해 유일하게 결정되며 동시에 여러 상태로 천이할 수가 없다. 따라서 장치에 데이터가 입력되기 시작하면 상태 천이를 계속하다가 특정 상태에 이르거나 데이터의 입력이 종료되면 상태 천이를 종료할 수 있다. The deterministic finite mechanism is uniquely determined by the current state and the conditions under which the transition to the next state is impossible and cannot transition to several states at the same time. Therefore, when data starts to be input to the device, the state transition may be continued, and when the specific state is reached or the data input is terminated, the state transition may be terminated.
결정적 유한 기계 장치는 입력되는 데이터에 찾고자 하는 패턴들이 복수 포함되어 있는 경우, 그 포함된 패턴들을 순차적으로 검색하며, 맨 처음 검출되는 패턴에 대응되는 상태에 이르게 되면 상태 천이를 종료한다. 또한 결정적 유한 기계 장치를 활용하는 패턴 매칭 장치는 그 검출된 패턴에 따라 입력되는 데이터를 처리한다. If a definite finite machine apparatus includes a plurality of patterns to be searched for in the input data, the determined finite machine apparatus sequentially searches for the included patterns, and terminates the state transition when a state corresponding to the first detected pattern is reached. The pattern matching device utilizing the deterministic finite machine device also processes the input data according to the detected pattern.
비결정적 유한 기계 장치는 현재 상태에서 다음 상태로 천이할 때 동시에 여러 상태로 천이할 수가 있다. 즉, 이것은 동시에 복수의 상태 천이 프로세스들이 공존한다는 의미와 같다. 따라서 장치에 데이터가 입력되기 시작하면 상태 천이를 계속하다가 특정 상태에 이르더라도 현재 공존하고 있는 다른 상태 천이 프로세스 들을 종료할 필요는 없다.A non-deterministic finite mechanism can transition to several states at the same time as it transitions from the current state to the next. In other words, this means that multiple state transition processes coexist at the same time. Therefore, when data starts to be input to the device, the state transition continues, and even if a certain state is reached, other state transition processes that currently coexist do not need to be terminated.
비결정적 유한 기계 장치는 입력되는 데이터에 찾고자 하는 패턴들이 복수 포함되어 있는 경우, 그 포함된 패턴들을 동시에 검색하는 것이 가능하며, 그 중 하나의 패턴이 검출되면 상태 천이를 종료할 수 있다. 또한 비결정적 유한 기계 장치를 활용하는 패턴 매칭 장치는 그 검출된 패턴에 따라 입력되는 데이터를 처리한다. When the non-deterministic finite-mechanical apparatus includes a plurality of patterns to be searched for in the input data, the non-deterministic finite-mechanical apparatus may search for the included patterns at the same time, and terminate the state transition when one of the patterns is detected. A pattern matching device utilizing non-deterministic finite mechanical devices also processes the input data in accordance with the detected pattern.
이와 같이 종래 단일 CAM으로 그 엔트리에 포함된 문자열을 찾는 문자열 매칭과 검출된 문자열로 구성되는 정규 표현을 찾는 정규 표현 매칭을 동시에 수행하는 패턴 매칭 장치의 경우, 그 장치가 찾고자 하는 패턴에 포함되는 문자열들의 수가 많아질수록 그리고 그 포함된 문자열의 길이가 길어질수록 정규 표현 매칭에 따른 상태 천이가 급속히 증가함에 따라 CAM에 포함되는 메모리 및 상태 천이를 위해 사용되는 메모리가 크게 증가한다.As described above, in the case of a pattern matching device which simultaneously performs a string matching to find a string included in the entry and a regular expression matching to find a regular expression consisting of the detected string, the string included in the pattern to be searched for by the single single CAM. As the number of fields increases and the length of the string included increases, the memory included in the CAM and the memory used for the state transition greatly increase as the state transition according to regular expression matching increases rapidly.
따라서, 본 발명은 데이터가 1 클록에 n-바이트씩 고속으로 처리되는 높은 처리 용량의 통신 네트워크 장비 또는 시스템에서 메모리를 효율적으로 사용할 수 있는 패턴 매칭 방법 및 장치를 제공한다. Accordingly, the present invention provides a pattern matching method and apparatus that can efficiently use memory in a high processing capacity communication network equipment or system in which data is processed at high speed by n-bytes per clock.
상기 본 발명의 기술적 과제를 달성하기 위한 본 발명의 하나의 특징인 패턴 매칭 장치의 패턴 매칭 방법은,The pattern matching method of the pattern matching device which is one feature of the present invention for achieving the technical problem of the present invention,
연속적으로 입력되는 문자열 스트림 내에 검색하고자 하는 패턴에 포함되는 제1 문자열이 있는지 확인하고, 상기 제1 문자열을 나타내는 문자열 인덱스 및 상기 문자열 인덱스에 대응되는 오프셋 신호를 출력하는 제1 문자열 매칭 단계; 상기 제1 문자열을 나타내는 문자열 인덱스들로 구성될 수 있는 제2 문자열이 있는지 확인하고, 상기 제2 문자열을 나타내는 문자열 ID를 출력하는 제2 문자열 매칭 단계; 상기 문자열 인덱스를 지연시키는 단계; 상기 문자열 ID와 상기 지연시킨 문자열 인덱스를 이용하여 패턴 키를 생성하는 단계; 및 생성한 상기 패턴 키들로 구성될 수 있는 정규 표현들 중에 검색하고자 하는 상기 패턴을 나타내는 정규 표현을 검출하는 단계를 포함한다.A first string matching step of checking whether there is a first string included in a pattern to be searched in a continuously input string stream, and outputting a string index representing the first string and an offset signal corresponding to the string index; A second string matching step of checking whether there is a second string, which may be composed of string indices representing the first string, and outputting a string ID representing the second string; Delaying the string index; Generating a pattern key using the string ID and the delayed string index; And detecting a regular expression representing the pattern to be searched among regular expressions that may be composed of the generated pattern keys.
상기 본 발명의 기술적 과제를 달성하기 위한 본 발명의 또 다른 특징인 패턴 매칭 장치는,Pattern matching device is another feature of the present invention for achieving the technical problem of the present invention,
연속적으로 입력되는 문자열 스트림 내에 검색하고자 하는 패턴에 포함되는 제1 문자열이 있는지 확인하고, 상기 제1 문자열을 나타내는 문자열 인덱스 및 상기 제1 문자열 인덱스에 대응되는 오프셋 신호를 출력하는 제1 문자열 매칭부; 상기 제1 문자열 매칭부로부터 출력되는 오프셋 신호 및 문자열 인덱스를 이용하여 상기 제1 문자열을 나타내는 문자열 인덱스들로 구성되는 제2 문자열이 있는지 확인하고, 상기 제2 문자열을 나타내는 문자열 ID를 출력하는 제2 문자열 매칭부; 상기 문자열 인덱스를 지연시키는 지연부; 상기 제2 문자열 매칭부에서 출력한 상기 문자열 ID와 상기 지연부에서 지연시킨 상기 문자열 인덱스를 이용하여 패턴 키를 생성하는 키 발생부; 및 상기 키 발생부에서 생성한 상기 패턴 키들로 구성될 수 있는 정규 표현들 중에 검색하고자 하는 상기 패턴을 나타내는 정규 표현을 검출하는 정규 표현 매칭부를 포함한다.A first string matching unit configured to check whether there is a first string included in a pattern to be searched in a continuously input string stream, and to output a string index representing the first string and an offset signal corresponding to the first string index; A second string that checks whether there is a second string composed of string indexes representing the first string using an offset signal and a string index output from the first string matching unit, and outputs a string ID representing the second string A string matching unit; A delay unit for delaying the string index; A key generation unit generating a pattern key using the string ID output from the second string matching unit and the string index delayed by the delay unit; And a regular expression matching unit detecting a regular expression representing the pattern to be searched among regular expressions that may be configured of the pattern keys generated by the key generator.
본 발명의 실시 예에 의하면, 패턴 매칭 장치에 필요한 메모리를 보다 효율적으로 사용할 수 있으며, 문자열 매칭과 정규 패턴 매칭을 분리함으로써 필요한 경우 그 중 한 부분만 확장이 가능해질 수 있다.According to an embodiment of the present invention, the memory required for the pattern matching apparatus can be used more efficiently, and by separating the string matching and the regular pattern matching, only one portion thereof can be expanded if necessary.
아래에서는 첨부한 도면을 참고로 하여 본 발명의 실시예에 대하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 발명을 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙였다.DETAILED DESCRIPTION Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings so that those skilled in the art may easily implement the present invention. The present invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. In the drawings, parts irrelevant to the description are omitted in order to clearly describe the present invention, and like reference numerals designate like parts throughout the specification.
명세서 전체에서, 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다. 또한, 명세서에 기재된 "…부", "…기", "모듈" 등의 용어는 적어도 하나의 기능이나 동작을 처리하는 단위를 의미하며, 이는 하드웨어나 소프트웨어 또는 하드웨어 및 소프트웨어의 결합으로 구현될 수 있다.Throughout the specification, when a part is said to "include" a certain component, it means that it can further include other components, without excluding other components unless specifically stated otherwise. Also, the terms " part, "" module," and " module ", etc. in the specification mean a unit for processing at least one function or operation and may be implemented by hardware or software or a combination of hardware and software have.
이제 본 발명의 실시예에 따른 다문자 병렬 데이터 스트림에 대한 패턴 매칭 방법 및 장치에 대하여 도면을 참고로 하여 상세하게 설명한다. 본 발명의 실시예에서는 ASCII 문자와 같은 형태의 문자들로 구성된 응용 계층의 데이터를 처리함에 있어, 데이터가 n-바이트(여기서, n은 1보다 큰 정수임)씩 입력된다고 가정하여 설명한다.Now, a pattern matching method and apparatus for a multi-character parallel data stream according to an embodiment of the present invention will be described in detail with reference to the accompanying drawings. In the embodiment of the present invention, it is assumed that data is input by n-bytes (where n is an integer greater than 1) in processing data of an application layer composed of characters in the form of ASCII characters.
본 발명의 실시예에서는 문자열은 시간상으로 연속되는 문자들의 순차열을 의미한다. 또한, 본 발명의 실시예에서는 패턴은 문자 및 문자열들의 조합으로 나타낼 수 있는 형태를 의미한다. 예를 들어, "A High Speed and Performance Pattern Matching System for Network Security"라는 문장에서 "Pattern Matching"이나 "Network Security"는 이 문장에서 찾을 수 있는 문자열이다. In an embodiment of the present invention, a string means a sequence of characters that are contiguous in time. In addition, in the embodiment of the present invention, the pattern refers to a form that can be represented by a combination of characters and strings. For example, in the sentence "A High Speed and Performance Pattern Matching System for Network Security", "Pattern Matching" or "Network Security" is a string that can be found in this sentence.
뿐만 아니라 이 문장 전체도 일종의 문자열로 취급할 수 있다. 그러나 이 문장에서 "High Speed System"이라는 문자열은 존재하지 않는다. 다만, "High Speed System"이라는 문자열은 이 문장에서 찾을 수 있는 "High Speed"와 "System" 두 문자열들의 조합으로 구성된 패턴이라 할 수 있다.In addition, the whole sentence can be treated as a string. However, the string "High Speed System" does not exist in this statement. However, the string "High Speed System" is a pattern composed of a combination of the two strings "High Speed" and "System" found in this sentence.
도 1은 본 발명의 실시예에 따른 패턴 매칭 장치의 구조도이다.1 is a structural diagram of a pattern matching apparatus according to an embodiment of the present invention.
도 1에 도시된 바와 같이, 본 발명의 실시예에 따른 패턴 매칭 장치는 제1 문자열 매칭부(100), 제2 문자열 매칭부(200), 지연부(500), 키 발생부(300) 및 정규 표현 매칭부(400)를 포함한다.As shown in FIG. 1, the pattern matching apparatus according to an embodiment of the present invention includes a first
제1 문자열 매칭부(100)는 동시(또는 1클록)에 n-바이트씩 입력되는 데이터 스트림(Data Stream)(또는 '문자열 스트림'이라고도 지칭) 내에, 특징적인 n-바이트 문자열(또는 '제1 문자열'이라고도 지칭)들이 있는지를 검색한다. 그리고 그에 대한 결과로 n-바이트 문자열 인덱스 및 오프셋 신호를 출력한다.The first
제2 문자열 매칭부(200)는 제1 문자열 매칭부(100)에서 출력된 n-바이트 문자열 인덱스 및 오프셋 신호를 활용하여, 보다 의미 있고 완성된 형태의 특징적인 문자열(또는 '제2 문자열'이라고도 지칭)들이 있는지를 검색한다. 그리고 그 결과로 문자열 ID를 출력한다. 여기서 특징적인 문자열들이라 함은, 최종적으로 찾고자 하는 패턴들에 포함되는 문자열을 의미한다. The second
지연부(500)는 제2 문자열 매칭부(200)가 제1 문자열 매칭부(100)에서 출력되는 데이터를 처리하고, 그 결과를 출력하기까지에 소요되는 시간만큼 제1 문자열 매칭부(100)에서 출력되는 n-바이트 문자열 인덱스를 지연시킨다. The
키 발생부(300)는 제2 문자열 매칭부(200)의 검색 결과인 문자열 ID와, 지연부(500)에 의해 지연된 제1 문자열 매칭부(100)에서 출력된 n-바이트 문자열 인덱스를 포함하는 패턴 키를 발생시킨다. The
정규 표현 매칭부(400)는 키 발생부(300)에서 발생된 패턴 키들로 구성될 수 있는 정규 표현(Regular Expression)들 중에서, 찾고자 하는 패턴들에 따른 정규 표현들이 있는지를 검색한다. 여기서 정규 표현들은 키 발생부(300)에서 발생될 수 있는 패턴 키들로 구성되며, 찾고자 하는 패턴들은 이러한 정규 표현들로 표현 가능한 것들이다.The regular
다음은, 상기 구성 요소 중 제1 문자열 매칭부(100)의 세부 구조에 대하여 도 2를 참조하여 설명하기로 한다.Next, a detailed structure of the first
도 2는 본 발명의 실시예에 따른 제1 문자열 매칭부의 구조도이다.2 is a structural diagram of a first string matching unit according to an embodiment of the present invention.
도 2에 도시된 바와 같이, 본 발명의 실시예에 따른 제1 문자열 매칭부(100)는 지연기(110), 분배기(120), 연상 메모리인 복수의 컨텐트 주소지정가능 메모리(Content Addressable Memory, 이하 "CAM"이라 지칭)(130) 및 오프셋 검사기(140)를 포함한다.As shown in FIG. 2, the first
지연기(110)는 입력되는 n-바이트 데이터(혹은 문자열) 스트림을 1 클록만큼 지연시킨다. 참고로, 제1 문자열 매칭부(100)로 데이터 스트림이 n-바이트씩 입력될 때, 연속되는 n-바이트와 n-바이트 사이의 시간 간격은 1 클록이다. 즉, 1 클록에 n-바이트씩 제1 문자열 매칭부(100)로 데이터가 입력된다. 여기서 클록은 본 발명의 실시예에 따른 장치가 기계적으로 동작하는데 필요한 기본 단위 시간을 의미한다.The
분배기(120)는 지연기(110)에서 출력되는 n-바이트 데이터 스트림을 상위로 하고, 제1 문자열 매칭부(100)로 새로이 입력되는 n-바이트 데이터 스트림을 하위로 하는 2n-바이트 데이터 스트림(또는 '제3 문자열 스트림'이라고도 지칭함)을 만든다. 그리고, CAM 1(130-1)에는 2n-바이트 데이터의 상위 첫 번째 바이트부터 n 번째 바이트를 출력하고, CAM 2(130-2)에는 2n-바이트 데이터의 상위 두 번째 바이트부터 (n+1) 번째 바이트를 출력한다. The
이와 같은 방식으로, 임의의 CAM k에는 상기 2n-바이트 데이터의 상위 k 번째 바이트부터 (n+k-1)번째 바이트까지의 n-바이트 데이터 스트림(또는 '제4 문자열 스트림'이라고도 지칭함)을 출력한다. 여기서 k는 1부터 n까지의 정수이다. 이때, 데이터의 형태에 대해 도 3을 참조로 먼저 설명하기로 한다.In this way, an arbitrary n-byte data stream (also referred to as a 'fourth string stream') from the upper k th byte to the (n + k-1) th byte of the 2n-byte data is output to any CAM k. do. Where k is an integer from 1 to n. In this case, the form of data will be described first with reference to FIG. 3.
도 3은 본 발명의 실시예에 따른 데이터의 형태를 나타낸 구조도이다.3 is a structural diagram showing the form of data according to an embodiment of the present invention.
다시 말해, 도 3은 도 2의 페이즈(Phase) 1부터 페이즈 3까지에 해당되는 데이터의 형태를 나타낸 것이다. 예를 들어서, n이 4라고 가정하고, "A High Speed and Performance Pattern Matching System for Network Security"라는 데이터 스트림이 입력된다고 가정한다. In other words, FIG. 3 illustrates a form of data corresponding to
그러면 도 3의 페이즈 1(150-1)과 같이 t=0인 시점부터 t=17인 시점까지, 1 클록에 4 바이트씩 입력된다. 여기서 t는 상기 데이터 스트림이 4 바이트씩 제1 문자열 매칭부(100)에 입력되는 시점을 나타낸다.Then, as in phase 1 (150-1) of FIG. 3, four bytes are input to one clock from the time point t = 0 to the time point t = 17. In this case, t represents a time point at which the data stream is input to the first
지연기(110)는 입력되는 4-바이트 데이터를 1 클록 지연시키기 때문에, 페이즈 2에서는 t=1인 시점부터 t=18인 시점까지 상기 데이터를 4-바이트씩 출력한다. 이와 같이 페이즈 2(150-2)에는 t=1인 시점부터 t=18인 시점까지 지연기(110)에서 출력되는 데이터와 제1 문자열 매칭부(100)로 입력되는 데이터가 도 3의 형태로 분배기(120)에 입력된다. Since the
n이 4라고 가정하였기 때문에, 제1 문자열 매칭부(100)는 최소 4 개의 CAM을 포함한다. 페이즈 2(150-2)에서 형성된 8-바이트 데이터는 4개의 CAM 각각에 4 바이트씩, 도 3의 페이즈 3(150-3)과 같은 형태로 입력된다. Since n is assumed to be 4, the first
데이터 스트림을 구성하는 문자들 중 순차적으로 먼저 나타나는 문자가 상위에 놓이도록 4-바이트 데이터를 정렬하면 다음과 같다. 즉, 페이즈 3에(150-3)서는 페이즈 2(150-2)에서 형성된 8-바이트 데이터의 상위 첫 번째 바이트부터 네 번째 바이트는 CAM 1에, 상위 두 번째 바이트부터 다섯 번째 바이트는 CAM 2에, 상위 세 번째 바이트부터 여섯 번째 바이트는 CAM 3에, 상위 네 번째 바이트부터 일곱 번째 바이트는 CAM 4에 입력되도록 분배한다.If the 4-byte data is arranged such that the first character among the characters constituting the data stream is placed in the upper order, it is as follows. That is, in phase 3 (150-3), the upper first to fourth bytes of the 8-byte data formed in phase 2 (150-2) are in
제1 문자열 매칭부(100)는 도 2에 도시된 바와 같이 최소 n개의 CAM(130-1 ∼ 130-n)을 포함한다. n은 상기에서 설명한 바와 같이, 제1 문자열 매칭부(100)에 매 클록마다 동시에 입력되는 데이터의 바이트 수이다. 모든 CAM은 동일한 구조를 가지며, CAM에 저장되는 컨텐트들도 동일하다. The first
다시 말해서, 각 CAM에 동일한 n-바이트 문자열을 입력하면, 동일한 결과를 얻는다. 단, 각 CAM에는 도 3에 표현된 바와 같이, 분배기(120)에서 출력되는 서로 다른 n-바이트 데이터가 입력된다.In other words, entering the same n-byte character string into each CAM yields the same result. However, as shown in FIG. 3, different n-byte data output from the
도 2의 CAM(130)은 복수의 엔트리를 포함한다. CAM(130)의 엔트리에는 n-바이트 문자열이 컨텐트로서 저장된다. CAM(130)은 분배기(120)에서 출력되는 n-바이트 데이터가 입력되면, 모든 엔트리들에 저장되어 있는 컨텐트들과 n-바이트 데이터를 동시에 비교한다. 그리고 그 결과 일치되는 엔트리가 존재하면 그 엔트리에 해당되는 히트 신호(Hit Signal)를 발생시킨다.
여기서 CAM(130)에 입력되는 n-바이트 데이터는 문자열로 표현 가능하다. 추가적으로 CAM은 히트 신호를 발생시킨 엔트리에 대한 인덱스(Index)를 출력한다. 이때, 인덱스는 CAM의 엔트리가 CAM 내에서 위치하는 곳을 주소의 형태로 표현한 것이다. 추후 설명의 편의를 위하여 이 인덱스를 n-바이트-문자열 인덱스라 칭하며, 문자열들이 저장되는 형태에 대해 도 4를 참조로 설명하기로 한다.Here, n-byte data input to the
도 4는 본 발명의 실시예에 따른 n-바이트 문자열들이 저장되는 형태를 나타 낸 예시도이다.4 is an exemplary diagram illustrating a form in which n-byte character strings are stored according to an embodiment of the present invention.
도 4는 예를 들어 n이 4일 때 "High", "Speed", "Performance", "System", "Network" 등의 문자열을 찾고자 하는 경우, 도 2의 CAM(130)에 그 문자열들이 저장되는 형태를 나타낸다. 상기 n-바이트 문자열들을 모두 4-바이트씩 나누어 CAM(130)에 저장되다. 이때, "High"를 제외한 나머지 4 문자들은 모두 4-바이트씩 정확하게 나누어 떨어지지 않는다. For example, when n is 4, the strings such as "High", "Speed", "Performance", "System", and "Network" are to be found. The strings are stored in the
이 경우에는 부족한 비트에 무관심 항(Don't-Care Term)을 추가하여 4-바이트 문자열을 완성한다. 예를 들어서, "Speed"는 "Spee"와 "d"로 나누어지기 때문에 "d"에 무관심 항을 추가하여 "d***"의 형태로 4-바이트 문자열을 완성한다. 여기서 "*"는 무관심 항을 의미한다. 무관심 항은 그 위치에 아무 문자나 나타나도 상관없음을 의미한다. 도 4에서 ss1, ss2, … 등은 히트 신호들을 나타낸다.In this case, add a Don't-Care Term to the missing bits to complete the 4-byte string. For example, "Speed" is divided into "Spee" and "d", so add an indifference term to "d" to complete a four-byte string in the form of "d ***". Where "*" means the indifference term. An indifference term means that any letter may appear in that position. In FIG. 4, ss 1 , ss 2 ,... And the like represent hit signals.
상기한 바와 같이, n이 4일 때 제1 문자열 매칭부(100)는 최소 4 개의 CAM을 포함하며, 각 CAM에는 도 4와 같은 형태로 찾고자 하는 문자열들이 저장되어 있다. 도 3의 페이즈 3에 해당되는 데이터가 각 CAM에 입력되고, CAM이 입력되는 4-바이트 데이터를 처리하고 출력하기까지에 소요되는 시간이 1 클록이라면, 도 2의 페이즈 4에 해당되는 각 CAM의 출력은 도 5에 표현된 바와 같다. 도 5는 본 발명의 실시예에 따른 CAM에서 출력되는 히트 신호들 및 인덱스의 형태를 나타낸 예시도이다.As described above, when n is 4, the first
도 3에 표현된 바와 같이, CAM 1에는 페이즈 3(150-3)의 첫 번째 데이터 스 트림이 4 바이트씩 입력된다. CAM 1은 도 4에 표현된 바와 같은 형태의 컨텐트들을 저장하고 있다. 따라서, CAM 1에서는 "Netw"와 "ork*"가 검출된다. As shown in FIG. 3, the first data stream of phase 3 (150-3) is input by 4 bytes into
상기한 바와 같이 CAM 1이 데이터를 처리하고 그 결과를 출력하기까지에 소요되는 시간이 1 클록이라면, CAM 1은 도 5에 표현된 바와 같이, t=16인 시점에 "Netw"가 검출되었음을 알리는 히트 신호 ss9를 출력하고, t=17인 시점에 "ork*"가 검출되었음을 알리는 히트 신호 ss10을 출력한다. 또한 이와 동시에 인덱스 9와 10을 출력한다. As described above, if the time required for the
그리고, 도 3에 표현된 바와 같이, CAM 2에는 페이즈 3의 두 번째 데이터 스트림이 4 바이트씩 입력된다. CAM 2는 도 4에 표현된 바와 같은 형태의 컨텐트들을 저장하고 있다. 따라서, CAM 2에서는 "Perf", "orma", "nce*"가 검출된다. CAM 2는, 도 5에 표현된 바와 같이, t=6인 시점에 "Perf"가 검출되었음을 알리는 히트 신호 ss4를 출력하고, t=7인 시점에 "orma"가 검출되었음을 알리는 히트 신호 ss5를 출력하고, t=8인 시점에 "nce*"가 검출되었음을 알리는 히트 신호 ss6을 출력한다. 또한 이와 동시에 인덱스 4, 5, 6을 출력한다. As shown in FIG. 3, the second data stream of
이와 같은 방식으로, CAM 3에서는 "High", "Syst", "em**"가 검출되며, t=2, t=13, t=14인 시점에 각각 그에 해당되는 히트 신호 ss1, ss7, ss8이 출력되고 이와 동시에 인덱스 1, 7, 8이 출력된다. 또한 같은 방식으로, CAM 4에서는 "Spee"와 "d***"가 검출되며, t=3과 t=4인 시점에 각각 그에 해당되는 히트 신호 ss2와 ss3이 출력되고 이와 동시에 인덱스 2와 3이 출력된다.In this way, “High”, “Syst”, and “em **” are detected in
다음, 도 2의 오프셋 검사기(140)는 복수의 CAM에서 출력되는 히트 신호들을 하나로 통합하여 출력하고, 복수의 CAM에서 출력되는 n-바이트 문자열 인덱스들을 하나로 통합하여 n-바이트 문자열을 대표하는 n-바이트 문자열 인덱스를 출력한다. 이 과정에서 도 2의 복수의 CAM(130-1 ∼ 130-n)에서 동시에 히트 신호들과 인덱스들이 출력될 때에는, 그 중 우선 순위가 높은 히트 신호와 인덱스를 선택하여 출력한다. 또한 오프셋 검사기(140)는 연속적으로 히트 신호들이 출력될 때, 그 연속되는 히트 신호들이 동일한 CAM에서 출력되는 것인지의 여부를 알리는 오프셋 신호를 출력한다.Next, the offset
예를 들어서, n이 4일 때 도 5에 표현된 바와 같은 형태의 결과들이 CAM 1, CAM 2, CAM 3, CAM 4에서 출력되면, 도 2의 오프셋 검사기(140)는 도 6에 표현된 바와 같이 하나로 통합된 히트 신호와 n-바이트-문자열 인덱스를 출력한다. 도 6은 본 발명의 실시예에 따른 오프셋 검사 수단에서 출력되는 통합된 히트 신호와 인덱스의 형태를 나타내는 예시도이다.For example, when n is 4 and the results of the form as shown in FIG. 5 are output from
그리고 도 5에 표현된 바와 같이, CAM 1에서는 ss9와 ss10이 연속적으로 출력된다. 이 때 오프셋 검사기(140)는, 도 6에 표현된 바와 같이, ss9와 ss10을 출력할 때, ss10이 ss9와 동일한 CAM에서 출력되었음을 알리는 신호(so)를 출력한다. 같은 방식으로, CAM 2에서는 ss4, ss5, ss6이 연속적으로 출력되므로, ss5와 ss6은 ss4와 동일한 CAM에서 출력되었음을 알리는 신호를 출력한다. As shown in FIG. 5, in
도 6에서 ss는 하나로 통합된 히트 신호이고, so는 오프셋 검사기(140)에서 출력되는 히트 신호가 동일한 CAM에서 연속적으로 출력된 것인지의 여부를 알리는 오프셋 신호이다. 오프셋 검사기(140)가 데이터를 처리하고 그 결과를 출력하기까지에 소요되는 시간이 1 클록이라면, 오프셋 검사기(140)는 도 6에 표현된 바와 같이, t=3인 시점에 CAM 3에서 출력된 ss1에 해당되는 ss를 출력하고 CAM 3에서 출력된 1을 인덱스로서 출력한다.In FIG. 6, ss is a heat signal integrated into one, and so is an offset signal indicating whether or not the heat signal output from the offset
오프셋 검사기(140)는 t=4와 t=5인 시점에 CAM 4에서 출력된 ss2와 ss3에 해당되는 ss를 출력하고 CAM 4에서 출력된 2와 3을 인덱스로서 출력한다. 이 때 ss3은 ss2에 이어서 CAM 4로부터 연속적으로 출력되기 때문에 이를 알리는 신호 so를 출력한다. The offset
같은 방식으로, 오프셋 검사기(140)는 t=7, t=8, t=9인 시점에 CAM 2에서 출력된 ss4, ss5, ss6에 해당되는 ss를 출력하고 CAM 2에서 출력된 4, 5, 6을 인덱스로서 출력한다. 이 때 ss5, ss6은 ss4에 이어서 CAM 2로부터 연속적으로 출력되기 때문에 이를 알리는 신호 so를 출력한다. 이때, so 신호를 출력하는 것은, 동일한 인덱스가 서로 다른 CAM에서 발생될 경우 하나의 CAM에서 연속적으로 발생한 인덱스를 우선순위로 선택하여 사용하고자 함이며, 이에 대해서는 본 발명의 실시예에서는 상세한 설명을 생략하기로 한다.In the same manner, the offset
도 2의 CAM(130)은 보다 바람직하게는 TCAM(Ternary CAM)이다. TCAM은 엔트 리에 포함되는 요소들 각각을 무관심 항으로 만들 수 있는 기능을 포함한다. 예를 들어서, 문자열 "d***"를 찾고자 하는 경우, TCAM에 포함된 기능이 사용된다. 여기서 "*"는 무관심 항들을 나타낸다. 무관심 항은 그 위치에 아무 문자나 나타나도 상관없음을 의미한다.
다음 도 1의 제2 문자열 매칭부(200)에 대하여 도 7을 참조로 설명하기로 한다.Next, the second
도 7은 본 발명의 실시예에 따른 제2 문자열 매칭부의 구조도이다.7 is a structural diagram of a second string matching unit according to an embodiment of the present invention.
도 7에 도시된 바와 같이, 제2 문자열 매칭부(200)는 복수의 엔트리를 포함하는 CAM(210), 연쇄기(220) 및 인덱스 변환기(230)를 포함한다.As shown in FIG. 7, the second
먼저 CAM(210)의 엔트리에는 제1 문자열 매칭부(100)에서 발생될 수 있는 검색 결과, 즉 도 2의 오프셋 검사기(140)에서 출력될 수 있는 n-바이트-문자열 인덱스와 오프셋 신호가 컨텐트로서 저장된다. 또한, CAM(210)은 제1 문자열 매칭부(100)서 출력된 검색 결과들, 즉 오프셋 검사기(140)에서 출력된 n-바이트-문자열 인덱스와 오프셋 신호가 입력되면, 모든 엔트리들에 저장되어 있는 컨텐트들과 입력된 n-바이트-문자열 인덱스 및 오프셋 신호를 동시에 비교한다. 비교 결과 일치되는 엔트리가 존재하면 그 엔트리에 해당되는 히트 신호(si1, si2, … )를 발생시킨다. First of all, an entry of the
제1 문자열 매칭부(100)에서 발생될 수 있는 검색 결과들, 즉 n-바이트-문자열 인덱스와 오프셋은, 보다 의미 있고 완성된 형태의 특징적인 문자열들에 포함되 는 n-바이트 문자열들에 대응된다. 따라서, 도 7의 CAM(210)의 엔트리들에는 이러한 n-바이트 문자열들이 순차적으로 저장된다고 볼 수 있다. The search results that may be generated in the first
CAM(210)을 이용해 특징적인 문자열을 검색하면, 상기 n-바이트-문자열 인덱스들과 오프셋들이 저장되어 있는 CAM(210)의 엔트리들에서, 연쇄적으로 히트 신호(si1, si2, … )들이 출력된다. 예를 들어서, 도 4에 표현된 바와 같이, "Speed"라는 문자열을 검색하고자 하는 경우, 우선, "Speed"에 포함되는 n-바이트 문자열들인 "Spee"와 "d***"에 대응되는 제1 문자열 매칭부(100)에서 발생될 수 있는 검색 결과들, 즉, 도 7에 표현된 바와 같이, n-바이트-문자열 인덱스 2와 3을 CAM에 차례로 저장한다. When a characteristic string is retrieved using
이어서, 제1 문자열 매칭부(100)에 "Speed"라는 문자열이 입력되고, 그 검색 결과로서 도 2의 오프셋 검사기(140)에서 출력된 인덱스와 오프셋 신호가 CAM에 입력되면, "Speed"에 포함된 "Spee"와 "d***"에 대응되는 인덱스들을 저장하고 있는 CAM의 각 엔트리에서 연쇄적으로 히트 신호가 출력된다. 단, "d***"에 대응되는 인덱스를 저장하고 있는 CAM의 엔트리에서 히트 신호가 출력되기 위해서는 오프셋이 동일함을 나타내어야 한다. Subsequently, when the string “Speed” is input to the first
즉, 제1 문자열 매칭부(100)에서 "Spee"와 "d***"를 검출한 CAM이 동일해야 한다. 또한 "Spee"와 "d***"은 동일한 CAM에서 시간상 연속되게 검출되어야 한다. 상기 두 조건을 만족해야 제 2 문자열 매칭 수단을 통해 "Speed"를 검출할 수 있다.That is, the CAM detecting “Spee” and “d ***” in the first
다음, 도 7의 연쇄기(220)는 n-바이트-문자열 인덱스들과 오프셋들을 저장하고 있는 CAM의(210) 각 엔트리에서 연쇄적으로 출력되는 히트 신호(si1, si2, … )들을 논리적으로 조합하여, 완성된 형태의 특징적인 문자열이 검출되었음을 알리는 신호를 발생시킨다. 여기서 n-바이트-문자열 인덱스와 오프셋은 완성된 형태의 특징적인 문자열에 포함되는 n-바이트 문자열에 대응된다. Next, the
연쇄기(220)는 CAM(210)에서 출력되는 히트 신호들을 플립플롭(Flip-Flop)들과 논리곱(Logical AND) 회로들을 이용한 일종의 연쇄 회로로 묶어서, 히트 신호들이 시간상 연쇄적으로 발생되는 경우 완성된 형태의 특징적인 문자열이 검출되었음을 알리는 신호를 발생시킨다. 이는 찾고자 하는 문자열의 첫 n-바이트 문자열부터 마지막 n-바이트 문자열까지 그 문자열을 구성하는 n-바이트 문자열들이 시간상 연쇄적으로 발생되는 경우, 그 문자열이 검출되었음을 알리는 신호를 발생시키는 것을 의미한다. 이때 연쇄기(220)는 복수의 연쇄 회로(220-1, 220-2)를 포함한다. The
여기서, 플립플롭은 입력되는 데이터를 1 클록만큼 지연시킨다. 상기 연쇄 회로가 시작되는 곳에 있는 플립플롭(220-21)으로는 CAM(210)에서 출력되는 히트 신호가 입력되고, 그 외의 플립플롭(220-22)으로는 논리곱 회로(220-23)에서 출력되는 신호가 입력된다. 여기서 클록은 본 발명에 따른 장치가 기계적으로 동작하는데 필요한 기본 단위 시간을 의미한다. Here, the flip-flop delays the input data by one clock. The heat signal output from the
그리고 논리곱 회로는 플립플롭에서 출력되는 신호와 상기 히트 신호를 논리적으로 앤드(AND)한다. 추가적으로 연쇄기(220)는 완성된 형태의 특징적인 문자열 이 검출되었음을 알리는 신호에 대응되는 인덱스를 출력한다. 이때, 인덱스는 복수의 연쇄 회로(220-1, 220-2)에서 출력되는 신호들을 보다 의미 있는 형태의 숫자로 표현한 것이다.The AND circuit logically ANDs the signal output from the flip-flop and the hit signal. In addition, the
예를 들어서 도 4에 표현된 바와 같이, 제1 문자열 매칭부(100)에 포함된 CAM(130)에는 "Performance"라는 문자열에 포함되는 "Perf", "orma", "nce*" 등이 저장되어 있다. 그리고 도 7에 표현된 바와 같이, 제2 문자열 매칭부(200)의 CAM(210)에는 세 개의 4-바이트 문자열("Perf", "orma", "nce*")들에 대응되는 인덱스들이 저장되어 있다고 가정한다. 본 발명의 실시예에 따른 패턴 매칭 장치에 "Performance"라는 문자열이 입력되면, 제1 문자열 매칭부(100)에 포함된 CAM(130)의 "Perf", "orma", "nce*" 등을 저장하고 있는 각 엔트리에서 연쇄적으로 히트 신호(ss4, ss5, ss6)와 더불어 인덱스(4, 5, 6)들이 출력된다. For example, as shown in FIG. 4, the
제1 문자열 매칭부(100)에서 발생된 인덱스(4, 5, 6)들이 제2 문자열 매칭부(200)의 CAM(210)에 입력되면, 그 인덱스들을 저장하고 있는 각 엔트리에서 연쇄적으로 히트 신호(si4, si5, si6)가 출력된다. 우선 "Perf"에 대응되는 인덱스가 입력되면 si4가 출력된다. 이 신호를 플립플롭을 이용해 다음 인덱스가 입력될 때까지 지연시킨다. When the
이어서 "orma"에 대응되는 인덱스가 입력되면 si5가 출력된다. si4의 지연된 신호와 si5를 논리적으로 앤드하고, 그 결과를 플립플롭을 이용해 다음 인덱스가 입 력될 때까지 지연시킨다. 이어서 "nce*"에 대응되는 인덱스가 입력되면 si6이 출력된다. Subsequently, when an index corresponding to "orma" is input, si 5 is output. Logically AND the delayed signal of si 4 and si 5 , and delay the result using a flip-flop until the next index is entered. Subsequently, when an index corresponding to "nce *" is input, si 6 is output.
si4의 지연된 신호와 si5를 논리적으로 앤드한 결과의 지연된 신호와 si5를 논리적으로 앤드하고 그 결과를 플립플롭을 이용해 다음 인덱스가 입력될 때까지 지연시킨다. 이와 같은 방식으로 하면, 결국 "Performance"에 포함된 모든 4-바이트 문자열들에 대응되는 히트 신호들 즉, si4, si5, si6 등을 모두 논리적으로 앤드한 결과가 출력된다. And the delayed signal si and the 5-and the results of the delayed signal and the si si 5 4 logically into logical and using the result to delay flip-flop until the next index type. In this manner, a result of logically ANDing all of the hit signals corresponding to all 4-byte character strings included in "Performance", that is, si 4 , si 5 , si 6, etc., is output.
이는 곧 "Performance"라는 문자열이 검출되었음을 알리는 결과가 된다. 도 7에서 s1, s2, … 등은 상기 완성된 형태의 특징적인 문자열이 검출되었음을 알리는 신호들이다. 도 7에서 s1에 대한 인덱스는 1이고, s2에 대한 인덱스는 3이고, s3에 대한 인덱스는 6이다.This results in a notification that the string "Performance" has been detected. S 1 , s 2 ,. And the like are signals indicating that the characteristic string of the completed form has been detected. In FIG. 7, the index for s 1 is 1 , the index for s 2 is 3, and the index for s 3 is 6.
이와 같이 완성된 형태의 특징적인 문자열들의 길이는 일정하지 않다. 따라서 본 발명의 실시예에 따른 제2 문자열 매칭부(200)는 검색하고자 하는 문자열들에 포함된 n-바이트 문자열들에 대응되는 인덱스들을 CAM(210)에 저장하고자 할 때, 먼저 저장된 문자열의 마지막 n-바이트-문자열 인덱스와 다음 저장될 문자열의 첫 번째 n-바이트-문자열 인덱스 사이의 경계를 알리는 수단을 추가적으로 포함한다. 또한 상기 문자열들 사이의 경계는 CAM(210)의 임의의 엔트리에서 발생할 수 있다. The lengths of the characteristic strings in the completed form are not constant. Therefore, when the second
도 7에 표현된 연쇄기(220)는 찾고자 하는 문자열이 정해지면 그것에 따라 플립플롭들과 논리곱 회로들을 연결하여, 일종의 연쇄 회로를 독립적으로 만들어 두기 때문에 문자열들 사이의 경계는 명확하다고 할 수 있다. 그러나 새 문자열이 추가될 때마다 상기 연쇄 회로를 새로이 추가해야 한다. When the
이러한 작업을 소프트웨어로 처리하는 것은 매우 간단한 것이 될 수 있으나, 하드웨어로 처리하고자 할 때는 매우 번거롭거나 불가능한 일이다. 예를 들어서, FPGA(Field Programmable Gate Array)로 상기 회로를 구현한다면 상기 연쇄 회로가 추가될 때마다, FPGA에 포함된 모든 기능을 정지하고 새로 작성된 코드를 FPGA에 프로그래밍한 후 다시 동작시켜야 한다. Doing this in software can be very simple, but it can be very cumbersome or impossible when you want to do it in hardware. For example, if the circuit is implemented in a field programmable gate array (FPGA), each time the chain circuit is added, all functions included in the FPGA must be stopped, newly written code is programmed into the FPGA, and then operated again.
이것은 매우 번거로운 작업일 뿐만 아니라 상기 기능을 포함한 시스템 운영 중에는 거의 불가능한 일이다. 따라서, 연쇄기(220)는 CAM(210)과 더불어 쉽게 프로그래밍 가능한 구조로 만들어야 한다. 이에 본 발명에 따른 연쇄기(220)는 CAM(210)의 각 엔트리에 대응되는 플립플롭과 논리곱 회로마다 상기 경계를 나타낼 수 있는 수단을 추가적으로 포함한다. 이에 대해 도 8을 참조로 설명하기로 한다.This is not only a very cumbersome task, but also almost impossible during system operation with the above functions. Thus, the
도 8은 본 발명의 실시예에 따른 제2 문자열 매칭부에 포함되는 연쇄기의 구조도이다.8 is a structural diagram of a chain linker included in a second string matching unit according to an embodiment of the present invention.
도 8에 도시된 바와 같이, 도 7에 표현된 연쇄기(220)와 도 8에 도시한 또 다른 연쇄기(220')의 차이점은, 연쇄기(220')에 멀티플렉서(Multiplexer)와 제어 신호가 추가된다는 점이다. 도 8을 참조하면, 연쇄기(220')는 복수의 스테이지를 포함한다. 각 스테이지는 두 입력 단자와 두 출력 단자 및 제어 단자를 가지며, 각 스테이지의 두 입력 단자 중 하나(이하, 제1 입력 단자라고 지칭)는 인접한 스테이지의 두 출력 단자 중 하나의 출력 단자(이하, 제1 출력 단자라고 지칭)에 연결되어 있다. As shown in FIG. 8, the difference between the chainer 220 shown in FIG. 7 and another
그리고, 각 스테이지의 두 입력 단자 중 다른 하나의 입력 단자(이하, 제2 입력 단자라고 지칭)는 검색하고자 하는 문자열의 각 문자에 대응하는 히트 신호가 순차적으로 입력된다. 그리고 제어 단자로는 제어 신호가 입력되며, 각 스테이지의 두 출력 단자 중 다른 하나의 출력 단자(이하, 제2 출력 단자라고 지칭함)로 검출 신호가 출력된다.The other one of the two input terminals of each stage (hereinafter, referred to as a second input terminal) is sequentially input hit signals corresponding to each character of the character string to be searched. The control signal is input to the control terminal, and the detection signal is output to the other output terminal (hereinafter, referred to as a second output terminal) of two output terminals of each stage.
즉, 도 8에서 멀티플렉서(MUX1, MUX2, …)는 두 개의 데이터 입력 포트, 한 개의 출력 포트 그리고 한 개의 제어 신호 입력 포트를 가지고 있다. 두 개의 데이터 입력 포트는 0번 포트와 1번 포트로 구분된다. 제어 신호가 '0'이면 0번 포트에 입력된 데이터가 출력 포트로 출력되고, '1'이면 1번 포트에 입력된 데이터가 출력 포트로 출력된다. That is, in FIG. 8, the multiplexers MUX 1 , MUX 2 ,..., Have two data input ports, one output port, and one control signal input port. The two data input ports are divided into
도 8에서 se1, se2, … 등은 멀티플렉서(MUX1, MUX2, …)들을 제어하기 위한 제어 신호들이다. 이 제어 신호(se1, se2, …)들은 문자열과 문자열 사이 경계를 구분하기 위해 사용된다. 예를 들어서, se1이 '1'이면 첫 번째 플립플롭(FF221-1)의 출력 포트가 그 다음에 오는 두 번째 논리곱 회로(221-2)의 입력 포트에 연결되어 일종의 연쇄 회로가 형성된다. Se 1 , se 2 ,. And the like are control signals for controlling the multiplexers MUX 1 , MUX 2 ,... These control signals se 1 , se 2 ,... Are used to separate the boundary between the character string and the character string. For example, if se 1 is '1', the output port of the first flip-flop (FF 221-1 ) is connected to the input port of the second logical AND circuit 221-2 that follows, forming a kind of chain circuit. do.
반면, se1이 '0'이면 첫 번째 플립플롭(221-11)의 출력이 그 다음에 오는 두 번째 논리곱 회로(221-2)에 전달되지 않고, 그 논리곱 회로(221-2)는 첫 번째 논리곱 회로(221-1)와 같은 형태가 되어 첫 번째 플립플롭(221-11) 및 논리곱 회로(221-1)와 분리가 된다. 즉, se1이 '0'일 때 문자열과 문자열 사이에 경계가 발생되며, 이에 따라 연쇄 회로가 다른 연쇄 회로와 분리된다. 또한 첫 번째 논리곱 회로의 결과가 s1에 전달된다. On the other hand, when se 1 is '0', the output of the first flip-flop 221-11 is not passed to the second logical AND circuit 221-2 that follows, and the logical AND circuit 221-2 is The first logical product circuit 221-1 is formed to be separated from the first flip-flop 221-11 and the logical AND circuit 221-1. That is, when se 1 is '0', a boundary is generated between the character string and the character string, thereby separating the chain circuit from other chain circuits. The result of the first AND circuit is also passed to s 1 .
따라서, si1이 발생하면 즉, 도 7에서 CAM(210)의 첫 번째 엔트리에 해당하는 n-바이트-문자열 인덱스가 제2 문자열 매칭부(200)에 입력된 경우, si1이 s1에 전달되어, 원하는 문자가 검출되었음을 알리게 된다. 도 8에서 se1, se3, se6 등은 '0'으로 하고 se2, se4, se5 등은 '1'로 가정하면, 도 7의 연쇄기(220)에 표현된 연쇄 회로와 동일한 연쇄 회로가 구성된다. 이 때 도 8의 s1, s3, s6 등은 도 7의 s1, s2, s3 등과 각각 동일한 결과를 나타낸다.Therefore, when si 1 occurs, that is, when n-byte-string index corresponding to the first entry of the
도 7의 CAM(220)은 보다 바람직하게는 TCAM(Ternary CAM)이다. TCAM은 포함되는 엔트리 및 그 엔트리에 포함되는 요소들, 즉 도 2의 오프셋 검사기(140)에서 출력될 수 있는 인덱스와 오프셋 신호 각각을 무관심 항으로 만들 수 있는 기능을 포함한다. 도 7에서 "*"는 무관심 항들을 나타낸다. 무관심 항은 그 위치에 아무 신호 또는 값이 나타나도 상관없음을 의미한다.The
도 1의 제2 문자열 매칭부(200)는 도 7에 표현된 바와 같이, 인덱스 변환기(Index Converting Unit)(230)를 포함한다. 인덱스 변환기(230)는 연쇄기(220)에서 완성된 형태의 특징적인 문자열이 검출되었음을 알리는 신호(s1, s2, s3, …)가 발생되었을 때, 출력되는 인덱스(1, 3, 6, …)를 문자열 ID(String Identifier) 형태로 변환한다. As illustrated in FIG. 7, the second
찾고자 하는 문자열들의 수에 비해 CAM(210)에 포함된 엔트리들의 수는 상당히 많다. 또한, 도 8에 표현된 바와 같이, 연쇄기(220')에서 발생 가능한 신호의 수는 CAM(210)에 포함된 엔트리의 수와 동일하다. 따라서, 연쇄기(220')에서 출력된 인덱스는 상당히 큰 수를 표현하기 위해 하드웨어적으로 불필요한 로직을 요구한다.The number of entries included in the
도 7에 표현된 바와 같이, n-바이트-문자열 인덱스들이 검출되면 연쇄기(220')에서 완성된 형태의 특징적인 문자열이 검출되었음을 알리는 신호들이 발생되고, 이때 연쇄기(220')에서 출력되는 인덱스들은 그 특징적인 문자열들을 대표하는 요소들이 된다. 도 7의 연쇄기(220)에서 출력되는 인덱스들만을 놓고 보면, 1, 3, 6 등의 수를 하드웨어적으로 표현하기 위해서는 3 비트가 필요하다. As shown in FIG. 7, when n-byte-string indexes are detected, signals are generated in the
그러나, 인덱스 3을 문자열 ID 2로 그리고 인덱스 6을 문자열 ID 3으로 변환하면, 단지 2 비트로 상기 완성된 형태의 특징적인 문자열들을 대표할 수가 있다. 또한 제2 문자열 매칭부(100)의 검색 결과는 이차적으로 특정 패턴을 찾기 위한 정규 표현 매칭 과정에서 여러 번 사용될 수 있다. 따라서, 이러한 점을 고려한다면, 제2 문자열 매칭부(200)의 검색 결과를 인덱스로 표현하는 것보다는 이를 변환하여 문자열들을 대표할 수 있는 문자열 ID 형태로 표현하는 것이 보다 효율적이다. However, by converting
이때 문자열마다 문자열 ID를 다르게 부여할 필요는 없다. 서로 다른 문자열들을 하나의 그룹으로 묶어서 그 그룹에 속하는 문자열들은 같은 문자열 ID를 부여할 수도 있다.At this time, it is not necessary to give string ID differently for each string. Different strings can be grouped into a group so that the strings in the group can be given the same string ID.
도 1의 제1 문자열 매칭부(100) 및 제2 문자열 매칭부(200)는 특징적인 문자열을 검색하기 위한 것뿐만 아니라, 특징적인 문자를 검색하기 위한 수단으로도 사용될 수 있다. 또한, 검색 대상이 되는 문자들 몇몇을 하나의 그룹으로 묶어서 그 그룹에 속하는 문자들은 상기 인덱스 변환 과정에서 같은 ID를 부여할 수도 있다.The first
다음 상기 도 1의 지연부(500)는 플립플롭 형태의 버퍼를 포함한다. 지연부(500)는 도 1의 제2 문자열 매칭부(200)가 입력되는 데이터를 처리하고 그 결과를 출력하기까지에 소요되는 시간이 1 클록이면, 제2 문자열 매칭부(200)에 입력되는 데이터를 1 클록만큼 지연시킨 후 출력한다. 만약 소요 시간이 2 클록이면 그 입력되는 데이터를 2 클록만큼 지연시킨다. 이를 다시 표현하면, 지연부(500)는 제2 문자열 매칭부(200)에 입력되는 데이터를 일정 클록만큼 지연시킨 후 출력한다. Next, the
다음 도 1의 키 발생부(300)의 구조에 대하여 도 9a 및 도 9b를 참조로 설명하기로 한다.Next, a structure of the
도 9a 및 도 9b는 본 발명의 실시예에 따른 키 발생부에서 출력되는 패턴 키의 형태를 나타내는 구조도이다.9A and 9B are structural diagrams illustrating the shape of a pattern key output from a key generating unit according to an embodiment of the present invention.
도 9a 및 도 9b에 표현된 바와 같이 키 발생부(300)는, 제2 문자열 매칭 부(200)에서 출력되는 문자열 ID와 지연부(500)에서 출력되는 데이터를 포함하는 패턴 키를 만들어 출력한다. 지연부(500)에서 출력되는 데이터는 제1 문자열 매칭부(100)에서 출력되는 n-바이트-문자열 인덱스와 동일하다. As shown in FIGS. 9A and 9B, the
도 9a는 제2 문자열 매칭부(200)에서 출력된 문자열 ID와 지연부(500)에서 출력된 n-바이트-문자열 인덱스를 이어 붙여서, 패턴 키를 만들 수 있음을 의미하는 것이다. FIG. 9A means that a pattern key can be created by concatenating a string ID output from the second
이와 달리 도 9b를 참고하면, 제2 문자열 매칭부(200)에서 특정 문자열이 검출된 경우에는 그 문자열이 검출되었음을 알리는 검출 신호와 그 문자열에 해당되는 문자열 ID를 패턴 키로서 출력하고, 그 외의 경우에는 지연부(500)에서 출력되는 n-바이트-문자열 인덱스를 패턴 키로서 출력하는 것을 의미한다. 도 9b에서 검출 신호는 패턴 키가 문자열 ID인지 n-바이트-문자열 인덱스인지를 구분하는데 사용된다.In contrast, referring to FIG. 9B, when a specific string is detected by the second
다음 상기 도 1의 정규 표현 매칭부(400)의 구조에 대하여 도 10을 참조로 설명하기로 한다.Next, the structure of the regular
도 10은 본 발명의 제1 실시예에 따른 정규 표현 매칭부의 구성도이다.10 is a configuration diagram of a regular expression matching unit according to the first embodiment of the present invention.
도 10에 표현된 바와 같이 제1 실시예에 따른 정규 표현 매칭부(400)는 CAM(410), 상태 천이기(420) 및 지연기(430)를 포함한다.As shown in FIG. 10, the regular
도 10의 CAM(410)은 복수의 엔트리를 포함한다. CAM의 엔트리에는 패턴 키와 상태 변수(State Variable)가 컨텐트로서 저장된다. 여기서 패턴 키는 키 발생부(300)에서 발생 가능한 것들이며, 상태 변수는 상태 천이기(420)에서 발생 가능 한 것들이다. The
CAM(410)은 키 발생부(300)에서 출력된 패턴 키와 상태 천이기(420)에서 출력된 상태 변수가 입력되면, 모든 엔트리들에 저장되어 있는 컨텐트들과 입력되는 패턴 키와 상태 변수로 구성되는 데이터를 동시에 비교한다. 그리고 그 결과 일치되는 엔트리가 존재하면 그 엔트리에 해당되는 히트 신호(h1, h2, … )를 발생시킨다. When the pattern key output from the
추가적으로 CAM(410)은 히트 신호(h1, h2, … )를 발생시킨 엔트리에 대한 인덱스를 출력한다. 여기서 인덱스는 CAM(410)의 엔트리가 CAM 내에서 위치하는 곳을 주소의 형태로 표현한 것이다.Additionally, the
도 10의 상태 천이기(420)는 CAM(410)에서 히트 신호(h1, h2, … )가 발생되었을 때, CAM(410)에서 출력되는 인덱스에 대응되는 상태 변수를 출력한다. 또한, 상태 천이기(420)는 특정 인덱스에 대응되는 실행 정보를 추가적으로 출력한다. 여기서 실행 정보는 찾고자 하는 패턴이 검출되었음을 알리는 히트 신호와 찾고자 하는 패턴이 검출되었음에 따른 다음 단계에서 수행되어야 할 사항들을 포함한다.The state shifter 420 of FIG. 10 outputs a state variable corresponding to an index output from the
예를 들어서, "High", "Speed", "Network" 등의 문자열들이 순차적으로 발생되는 형태의 패턴 1과, "High", "Performance", "System" 등의 문자열들이 순차적으로 발생되는 형태의 패턴 2를 찾고자 하는 경우, 예측 가능한 형태의 상태 천이도를 도 11과 같이 구성할 수 있다. For example,
도 11은 본 발명의 제1 실시예에 따른 정규 표현 매칭부의 상태 천이도이다.11 is a state transition diagram of a regular expression matching unit according to the first embodiment of the present invention.
도 11에 표현된 바와 같이 상태 천이부(420)는 상태 0에서 "High"가 검출되면 상태 1로 천이하고, 상태 1에서 "Speed"가 검출되면 상태 2로 천이한다. 그리고, 상태 2에서 "Network"이 검출되면 상태 3으로 천이한다. 또한 상태 3은 상기 패턴 1이 검출되었음을 의미한다. As illustrated in FIG. 11, the state transition unit 420 transitions to
따라서, 도 10의 상태 천이기(420)는 상태 3에 대한 실행 정보로서 패턴이 검출되었음을 알리는 히트 신호를 출력한다. 상태 1에서 "Performance"가 검출되면 상태 4로 천이하고, 상태 4에서 "System"이 검출되면 상태 5로 천이한다. 또한 상태 5는 상기 패턴 2가 검출되었음을 의미한다. 따라서, 도 10의 상태 천이기(420)는 상태 5에 대한 실행 정보로서 패턴이 검출되었음을 알리는 히트 신호를 출력한다. Accordingly, the state shifter 420 of FIG. 10 outputs a hit signal indicating that a pattern has been detected as execution information for
도 11은 상태 6과 같이 추가적으로 발생 가능한 형태의 상태 천이를 포함하고 있다. 뿐만 아니라, 도 11에 표시된 상태 천이 형태 외에도 다양한 형태의 상태 천이가 가능하다. 도 11에 표현된 문자열들 각각에 도 12에 표현된 형태로 문자열 ID를 부여하면, 도 11의 상태 천이도는 도 10과 같이 구성할 수 있다. 11 includes a state transition in a form that can additionally occur, such as
이제 본 발명에 따른 패턴 매칭 장치에 "A High Speed and Performance Pattern Matching System for Network Security"라는 데이터 스트림이 입력될 때 이를 도 10과 11에 따라 분석하면 다음과 같다. 단, 상기 데이터 스트림이 상기 패턴 매칭 장치에 처음으로 입력되는 데이터 스트림이라 가정한다. Now, when a data stream called "A High Speed and Performance Pattern Matching System for Network Security" is input to the pattern matching device according to the present invention, the analysis is performed according to FIGS. 10 and 11 as follows. However, it is assumed that the data stream is a data stream inputted to the pattern matching device for the first time.
상태 0에서 "High"가 검출되므로 상태 1로 천이하고, 상태 1에서 "Speed"가 검출되므로 상태 2로 천이한다. 그리고 상태 2에서 "Performance"가 검출되므로 상 태 6으로 천이하고, 상태 6에서 "System"이 검출되므로 상태 5로 천이한다. 상태 5는 상기 패턴 2가 검출되었음을 의미하므로, 상태 5로 천이함과 더불어 그에 대한 실행 정보가 출력된다.Transition to
도 1의 본 발명의 제1 실시예에 따른 정규 표현 매칭부(400)는, 도 10에 표현된 바와 같이 지연기(430)도 포함한다. 지연기(430)는 도 10의 CAM(410)에서 출력되는 인덱스를 도 10의 상태 천이기(420)가 CAM(410)에서 출력되는 인덱스와 히트 신호를 처리하고 그에 대한 실행 정보를 출력하기까지에 소요되는 시간만큼 지연시킨다.The regular
도 10의 CAM(410)은 보다 바람직하게는 TCAM(Ternary CAM)이다. TCAM은 포함되는 엔트리 및 엔트리에 포함되는 요소들, 즉 패턴 키와 상태 변수 각각을 무관심 항으로 만들 수 있는 기능을 포함한다. 뿐만 아니라 패턴 키를 구성하고 있는 요소들 각각을 무관심 항으로 만들 수 있는 기능도 포함한다. The
예를 들어서, 현재 상태에 상관없이 문자열 "High"가 검출될 때 상태 1로 천이하고자 한다면, 그에 해당하는 TCAM 엔트리에서 상태 변수를 무관심 항으로 만들면 된다. 또한 상기한 바와 같이 특정 패턴이 검출된 상태 3이나 상태 5에서 이후로 검출되는 문자나 문자열에 상관없이 초기 상태로 천이하고자 한다면, 그에 해당하는 TCAM 엔트리에서 패턴 키를 무관심 항으로 만들면 된다.For example, if you want to transition to
이러한 정규 표현 매칭부(400)는 도 13에 도시한 바와 같이 달리 구성될 수도 있다. 다음 본 발명의 제2 실시예에 따른 정규 표현 매칭부(400')에 대해 도 13을 참조로 설명하기로 한다. The regular
제2 실시예에 따른 정규 표현 매칭부(400')는, 도 13에 표현된 바와 같이, CAM(440), 연쇄기(450), 메모리(460) 및 지연기(470)를 포함한다.The regular
도 13의 CAM(440)은 복수의 엔트리를 포함한다. CAM(440)의 엔트리에는 패턴 키가 컨텐트로서 저장된다. 여기서 패턴 키는 도 1의 키 발생부(300)에서 출력될 수 있는 패턴 키들이다. CAM(440)은 키 발생부(300)에서 출력된 패턴 키가 입력되면 모든 엔트리들에 저장되어 있는 컨텐트들과 입력되는 패턴 키를 동시에 비교한다. 그리고, 그 결과 일치되는 엔트리가 존재하면 그 엔트리에 해당되는 히트 신호(h1, h2, … )를 발생시킨다. The
연쇄기(450)는 패턴 키들을 저장하고 있는 CAM(440)의 각 엔트리에서 순차적으로 출력되는 히트 신호(h1, h2, … )들을 논리적으로 조합하여, 패턴이 검출되었음을 알리는 신호(p1, p2, … )를 발생시킨다. 연쇄기(450)는 CAM(440)에서 출력되는 히트 신호들을 래치(Latch)(450-1, 450-2, …)들과 논리곱 회로(450-11, 450-12, …)들을 이용한, 일종의 연쇄 회로로 묶어서 히트 신호들이 순차적으로 발생되는 경우 상기 패턴이 검출되었음을 알리는 신호를 발생시킨다. The
이는 곧 찾고자 하는 패턴의 첫 문자 또는 문자열부터 마지막 문자 또는 문자열까지 그 패턴을 구성하는 문자 또는 문자열들이 순차적으로 발생되는 경우, 그 패턴이 검출되었음을 알리는 신호를 발생시키는 것을 의미한다. 또한 연쇄기(450)는 복수의 연쇄 회로(450', 450'')를 포함한다. 여기서 문자열은 문자열 ID로 표현된다. This means that when the characters or strings constituting the pattern are sequentially generated from the first character or string of the pattern to be searched to the last character or string, this means generating a signal indicating that the pattern has been detected. The
연쇄기(450)가 시작되는 곳에 있는 래치(450-1, 450-3, …)로는 CAM(440)에서 출력되는 히트 신호(h1, h4, … )가 입력되고, 그 외의 래치(450-2, 450-4, …)로는 논리곱 회로(450-11, 450-12, …)에서 출력되는 신호가 입력된다. The hit signals h 1 , h 4 ,... Output from the
즉, 래치(450-1, 450-2, …)는 CAM(440)에서 출력되는 히트 신호 또는 논리곱 회로에서 출력되는 특정 신호를 계속 유지하여 출력한다. 래치(450-1, 450-2, …)는 특정 데이터가 입력되기 이전에 유지하고 있던 값을 출력하기 위한 수단을 추가적으로 포함한다. 여기서 래치에 대해서 도 14를 참조로 설명하기로 한다.That is, the latches 450-1, 450-2,... Maintain and output the hit signal output from the
도 14는 본 발명의 실시예에 따른 래치의 예시도이다.14 is an exemplary view of a latch according to an embodiment of the present invention.
도 14에 표현된 바와 같이, 래치(450-1)는 플립-플롭(FFL1)과 멀티플렉서(MUXL1)로 구성된다. 도 14에서 제어 신호(h)가 '1'이면 플립-플롭(FFL1)에 '1'이 입력되고, 플립-플롭(FFL1)은 입력된 '1'을 출력한다. 제어 신호(h)가 '0'이면 플립-플롭(FFL1)에 플립-플롭(FFL1)의 출력 단자에서 출력되는 '1'이 다시 입력된다. 따라서 플립-플롭(FFL1)의 출력은 계속 '1'을 유지한다. As shown in FIG. 14, the latch 450-1 includes a flip-flop FF L1 and a multiplexer MUX L1 . It is also a "1" control signal (h) from 14 flip-flops to be '1' input to the (L1 FF), the flip-flop (FF L1) and outputs the inputted "1". A control signal (h) is '0' the flip-flop to flip (FF L1) - a '1' is output from the output terminal of the flop (FF L1) is input again. Therefore, the output of the flip-flop FF L1 remains '1'.
래치(450-1)는 출력되는 값을 '0'으로 변경하기 위한 수단을 추가적으로 포함한다. 즉, 도 14에서 리셋(Reset) 신호가 플립-플롭(FFL1)에 입력되면 래치는 '0'을 출력한다. 그리고 논리곱 회로는 래치(450-1)에서 출력되는 신호와 상기 히트 신호를 논리적으로 앤드한다. The latch 450-1 further includes means for changing the output value to '0'. That is, when the reset signal is input to the flip-flop FF L1 in FIG. 14, the latch outputs '0'. The AND circuit logically ANDs the signal output from the latch 450-1 and the hit signal.
추가적으로 연쇄기(450)는 패턴이 검출되었음을 알리는 신호에 대응되는 인 덱스를 출력한다. 즉, 인덱스는 복수의 연쇄 회로(450', 450'')에서 출력되는 신호들을 보다 의미 있는 형태의 숫자로 표현한 것이다.In addition, the
예를 들어서, "High", "Speed", "Network" 등의 문자열들이 순차적으로 발생되는 형태의 패턴 1과, "High", "Performance", "System" 등의 문자열들이 순차적으로 발생되는 형태의 패턴 2를 찾고자 하는 경우, 두 패턴에 포함되는 문자열들 각각에 도 12에 표현된 형태로 문자열 ID를 부여하고, 도 13에 표현된 바와 같이 CAM(430)에 문자열 ID들을 순차적으로 저장한다. 여기서 도 12는 본 발명의 실시예에 따른 문자열 ID를 표시한 예시도이다.For example,
따라서, 패턴 1 또는 패턴 2에 포함된 문자열들이 순차적으로 검출되면 CAM(430)에서는 그에 해당되는 히트 신호(h1, h2, …)들이 순차적으로 출력된다. 우선 "High"가 검출되면, "High"에 대한 문자열 ID가 1이기 때문에, 이에 대한 히트신호 h1이 출력된다. 이 신호를 제1 래치(450-1)를 이용해 계속 유지한다. Therefore, when the character strings included in the
이어서 "Speed"가 입력되면 h2가 출력된다. 제1 래치(450-1)에서 출력되는 h1과 h2를 논리적으로 앤드하고 그 결과를 제2 래치(450-2)를 이용해 계속 유지한다. 이어서 "Network"이 입력되면 제2 래치(450-2)에서 출력되는 신호와 히트 신호 h3을 논리적으로 앤드한다. 결국, h1, h2, h3 등을 모두 논리적으로 앤드한 결과가 출력된다. Subsequently, when "Speed" is input, h 2 is output. The first-and the h 1 and h 2 to be output from the first latch (450-1) in a logical and maintain the result with a second latch (450-2). Subsequently, when "Network" is input, the signal output from the second latch 450-2 and the hit signal h 3 are logically ANDed. As a result, the result of logically ANDing all of h 1 , h 2 , h 3 and the like is output.
이는 곧 패턴 1이 검출되었음을 알리는 결과가 된다. 도 13에서 p1, p2, … 등은 찾고자 하는 패턴들이 검출되었음을 알리는 신호들이다. 그리고 도 13에 나타낸 바와 같이 p1에 대한 인덱스는 3이고, p2에 대한 인덱스는 6이다.This is a result indicating that
찾고자 하는 패턴들이 포함하는 문자 또는 문자열들의 개수는 일정하지 않다. 따라서, 본 발명의 제2 실시예에 따른 정규 표현 매칭부는 검색하고자 하는 패턴들에 포함된 문자 또는 문자열들을 패턴 키의 형태로 CAM에 저장하고자 할 때, 먼저 저장된 패턴의 마지막 패턴 키와 다음 저장될 패턴의 첫 번째 패턴 키 사이의 경계를 알리는 수단을 추가적으로 포함한다. 또한 상기 패턴들 사이의 경계는 CAM의 임의의 엔트리에서 발생할 수 있다. The number of characters or strings included in the patterns to find is not constant. Therefore, when the regular expression matching unit according to the second embodiment of the present invention intends to store the characters or character strings included in the patterns to be searched in the CAM in the form of a pattern key, the last pattern key of the stored pattern and the next pattern may be stored. And means for informing the boundary between the first pattern key of the pattern. The boundary between the patterns may also occur at any entry in the CAM.
도 13에 나타낸 연쇄기(440)는 찾고자 하는 패턴이 정해지면 그것에 따라 래치들과 논리곱 회로들을 연결하여 일종의 연쇄 회로를 독립적으로 만들어 두기 때문에, 먼저 저장된 패턴의 마지막 패턴 키와 다음 저장될 패턴의 첫 번째 패턴 키 사이의 경계는 명확하다고 할 수 있다. 그러나 새 패턴이 추가될 때마다 연쇄 회로를 새로이 추가해야 한다. Since the
이러한 작업을 소프트웨어로 처리하는 것은 매우 간단한 것이 될 수 있으나, 하드웨어로 처리하고자 할 때는 매우 번거롭거나 불가능한 일이다. 예를 들어서, FPGA로 상기 회로를 구현한다면 상기 연쇄 회로가 추가될 때마다, FPGA에 포함된 모든 기능을 정지하고 새로 작성된 코드를 FPGA에 프로그래밍한 후 다시 동작시켜야 한다. Doing this in software can be very simple, but it can be very cumbersome or impossible when you want to do it in hardware. For example, if you implement the circuit in an FPGA, each time the chain is added, you must stop all the functions contained in the FPGA, program the newly written code in the FPGA, and then run it again.
이것은 매우 번거로운 작업일 뿐만 아니라 상기 기능을 포함한 시스템 운영 중에는 거의 불가능한 일이다. 따라서, 연쇄기(440)는 CAM(430)과 더불어 쉽게 프로그래밍 가능한 구조로 만들어야 한다. 이에 본 발명에 따른 연쇄기(440)는 CAM의 각 엔트리에 대응되는 래치와 논리곱 회로마다 상기 경계를 나타낼 수 있는 수단을 추가적으로 포함한다.This is not only a very cumbersome task, but also almost impossible during system operation with the above functions. Accordingly, the
도 15는 본 발명의 제2 실시예에 따른 정규 표현 매칭부에 포함되는 연쇄기의 예시도이다.15 is an exemplary diagram of a concatemer included in a regular expression matching unit according to the second embodiment of the present invention.
도 15에 도시된 바와 같이, 제2 실시예에 따른 연쇄기(480)는 복수의 스테이지를 포함하며, 각 스테이지는 논리곱 소자(480-1, 480-6, …), 래치(481L1, 481L5, …) 및 멀티플렉서(480M1, 480M10, …)를 포함한다. 여기서 멀티플렉서(480M1, 480M10, …)는 제1 멀티플렉서(480M1, 480M3, 480M5, 480M9 …)와 제2 멀티플렉서(480M2, 480M4, 480M6, 480M8, 480M10 …)로 구분지을 수 있다. 이때, 각 스테이지는 도 8에 도시한 각 스테이지와 유사한 구조를 가진다. 따라서, 연쇄기(480)의 동작은 도 8에 도시한 연쇄기(220')의 동작과 유사하다.As shown in FIG. 15, the
다시 말해, 제2 실시예에 따른 연쇄기(480)가 도 13에 표현된 연쇄기(440)와 다른 점은, 복수의 멀티플렉서(480M1, 480M10, …)와 제어 신호가 추가되었다는 것이다. 도 15에서 멀티플렉서(480M1, 480M10, …)는 두 개의 데이터 입력 포트, 한 개의 출력 포트 그리고 한 개의 제어 신호 입력 포트를 가지고 있다. 두 개의 데이터 입력 포트는 0번 포트와 1번 포트로 구분된다. In other words, the
제어 신호가 '0'이면 0번 포트에 입력된 데이터가 출력 포트로 출력되고, '1'이면 1번 포트에 입력된 데이터가 출력 포트로 출력된다. 도 15에서 pe1, pe2, … 등은 멀티플렉서들을 제어하기 위한 제어 신호들이다. 이 제어 신호들은 패턴과 패턴 사이 경계를 구분하기 위해 사용된다. If the control signal is '0', the data input to
예를 들어서, pe1이 '1'이면 첫 번째 래치(480L1)의 출력 포트가 그 다음에 오는 두 번째 논리곱 회로(480-2)의 입력 포트에 연결되어 일종의 연쇄 회로가 형성된다. 반면, pe1이 '0'이면 첫 번째 래치(480L1)의 출력이 그 다음에 오는 두 번째 논리곱 회로(480-2)에 전달되지 않고 그 논리곱 회로(480-2)는 첫 번째 논리곱 회로(470-1)와 같은 형태가 되어, 첫 번째 래치(480L1) 및 논리곱 회로(480-1)와 분리가 된다. For example, if pe 1 is '1', the output port of the
즉, pe1이 '0'일 때 패턴과 패턴 사이에 경계가 발생되며, 이에 따라 연쇄 회로가 다른 연쇄 회로와 분리된다. 또한 첫 번째 논리곱 회로의 결과가 p1에 전달된다. 따라서, h1이 발생하면 즉, 도 13에서 CAM의 첫 번째 엔트리에 해당하는 패턴 키가 제2 형태의 정규 표현 매칭부(470')에 입력된 경우 h1이 p1에 전달되어, 원하는 패턴이 검출되었음을 알리게 된다. That is, when pe 1 is '0', a boundary is generated between the pattern and the pattern, thereby separating the chain circuit from other chain circuits. The result of the first AND circuit is also passed to p 1 . Therefore, when h 1 occurs, that is, when the pattern key corresponding to the first entry of the CAM in FIG. 13 is input to the regular
도 15에서 pe1과 pe2는 모두 '1'로 하고 pe3은 '0'으로 가정하면, 도 13의 연쇄 수단에 표현된 첫 번째 연쇄 회로와 동일한 연쇄 회로가 구성된다. 이 때 도 15 의 p3은 도 13의 p1과 동일한 결과를 나타낸다. In FIG. 15, assuming that both pe 1 and pe 2 are '1' and pe 3 is '0', the same chain circuit as the first chain circuit represented by the chain means of FIG. 13 is configured. At this time, p 3 of FIG. 15 shows the same result as p 1 of FIG. 13.
도 13의 CAM(440)은 보다 바람직하게는 TCAM이다. TCAM은 포함되는 엔트리 및 그 엔트리에 포함되는 요소를 무관심 항으로 만들 수 있는 기능을 포함한다.
다음 본 발명의 제2 실시예에 따른 정규 표현 매칭부(400')는, 도 13에 표현된 바와 같이 메모리(460)를 포함한다. 메모리(460)는 특정 인덱스에 대응되는 실행 정보를 출력한다. 여기서 실행 정보는 찾고자 하는 패턴이 검출되었음을 알리는 히트 신호와 찾고자 하는 패턴이 검출되었음에 따른 다음 단계에서 수행해야될 사항들을 포함한다.Next, the regular
또한 본 발명의 제2 실시예에 따른 정규 표현 매칭부(400')의 지연기(470)는, 도 13의 메모리(460)가 연쇄기(450)에서 출력되는 인덱스를 처리하고 그에 대한 실행 정보를 출력하기까지에 소요되는 시간만큼 지연시킨다.In addition, the
이상에서 설명한 본 발명의 실시예는 장치 및 방법을 통해서만 구현이 되는 것은 아니며, 본 발명의 실시예의 구성에 대응하는 기능을 실현하는 프로그램 또는 그 프로그램이 기록된 기록 매체를 통해 구현될 수도 있으며, 이러한 구현은 앞서 설명한 실시예의 기재로부터 본 발명이 속하는 기술분야의 전문가라면 쉽게 구현할 수 있는 것이다. The embodiments of the present invention described above are not only implemented by the apparatus and method but may be implemented through a program for realizing the function corresponding to the configuration of the embodiment of the present invention or a recording medium on which the program is recorded, The embodiments can be easily implemented by those skilled in the art from the description of the embodiments described above.
이상에서 본 발명의 실시예에 대하여 상세하게 설명하였지만 본 발명의 권리범위는 이에 한정되는 것은 아니고 다음의 청구범위에서 정의하고 있는 본 발명의 기본 개념을 이용한 당업자의 여러 변형 및 개량 형태 또한 본 발명의 권리범위에 속하는 것이다.While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it is to be understood that the invention is not limited to the disclosed exemplary embodiments, It belongs to the scope of right.
도 1은 본 발명의 실시예에 따른 패턴 매칭 장치의 구조도이다.1 is a structural diagram of a pattern matching apparatus according to an embodiment of the present invention.
도 2는 본 발명의 실시예에 따른 제1 문자열 매칭부의 구조도이다.2 is a structural diagram of a first string matching unit according to an embodiment of the present invention.
도 3은 본 발명의 실시예에 따른 데이터의 형태를 나타낸 구조도이다.3 is a structural diagram showing the form of data according to an embodiment of the present invention.
도 4는 본 발명의 실시예에 따른 문자열들이 저장되는 형태를 나타낸 예시도이다.4 is an exemplary view showing a form in which character strings are stored according to an embodiment of the present invention.
도 5는 본 발명의 실시예에 따른 CAM에서 출력되는 히트 신호들 및 인덱스의 형태를 나타낸 예시도이다.5 is an exemplary view showing the form of the hit signals and the index output from the CAM according to an embodiment of the present invention.
도 6은 본 발명의 실시예에 따른 오프셋 검사 수단에서 출력되는 통합된 히트 신호와 인덱스의 형태를 나타내는 예시도이다.FIG. 6 is an exemplary view illustrating the form of an integrated hit signal and an index output from an offset check means according to an exemplary embodiment of the present invention.
도 7은 본 발명의 실시예에 따른 제2 문자열 매칭부의 구조도이다.7 is a structural diagram of a second string matching unit according to an embodiment of the present invention.
도 8은 본 발명의 실시예에 따른 제2 문자열 매칭부에 포함되는 연쇄기의 구조도이다.8 is a structural diagram of a chain linker included in a second string matching unit according to an embodiment of the present invention.
도 9a 및 도 9b는 본 발명의 실시예에 따른 키 발생부에서 출력되는 패턴 키의 형태를 나타내는 구조도이다.9A and 9B are structural diagrams illustrating the shape of a pattern key output from a key generating unit according to an embodiment of the present invention.
도 10은 본 발명의 제1 실시예에 따른 정규 표현 매칭부의 구성도이다.10 is a configuration diagram of a regular expression matching unit according to the first embodiment of the present invention.
도 11은 본 발명의 제1 실시예에 따른 정규 표현 매칭부의 상태 천이도이다.11 is a state transition diagram of a regular expression matching unit according to the first embodiment of the present invention.
도 12는 본 발명의 실시예에 따른 문자열 ID를 표시한 예시도이다.12 is an exemplary view showing a string ID according to an embodiment of the present invention.
도 13은 본 발명의 제2 실시예에 따른 정규 표현 매칭부의 구성도이다.13 is a configuration diagram of a regular expression matching unit according to the second embodiment of the present invention.
도 14는 본 발명의 실시예에 따른 래치의 예시도이다.14 is an exemplary view of a latch according to an embodiment of the present invention.
도 15는 본 발명의 제2 실시예에 따른 정규 표현 매칭부에 포함되는 연쇄기의 예시도이다.15 is an exemplary diagram of a concatemer included in a regular expression matching unit according to the second embodiment of the present invention.
Claims (25)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR20080121422 | 2008-12-02 | ||
KR1020080121422 | 2008-12-02 |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20100062896A KR20100062896A (en) | 2010-06-10 |
KR101262337B1 true KR101262337B1 (en) | 2013-05-08 |
Family
ID=42363095
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020090079440A KR101262337B1 (en) | 2008-12-02 | 2009-08-26 | Method and apparatus for pattern matching for multi-character parallel data stream |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR101262337B1 (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080046423A1 (en) | 2006-08-01 | 2008-02-21 | Lucent Technologies Inc. | Method and system for multi-character multi-pattern pattern matching |
-
2009
- 2009-08-26 KR KR1020090079440A patent/KR101262337B1/en active IP Right Grant
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080046423A1 (en) | 2006-08-01 | 2008-02-21 | Lucent Technologies Inc. | Method and system for multi-character multi-pattern pattern matching |
Also Published As
Publication number | Publication date |
---|---|
KR20100062896A (en) | 2010-06-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Bispo et al. | Regular expression matching for reconfigurable packet inspection | |
US8972450B2 (en) | Multi-stage parallel multi-character string matching device | |
US7308446B1 (en) | Methods and apparatus for regular expression matching | |
US7464254B2 (en) | Programmable processor apparatus integrating dedicated search registers and dedicated state machine registers with associated execution hardware to support rapid application of rulesets to data | |
US6792502B1 (en) | Microprocessor having a content addressable memory (CAM) device as a functional unit therein and method of operation | |
CN104881422B (en) | Engine, method and software defined network for generating lookups and making decisions | |
US8190738B2 (en) | Detection of patterns in a data stream | |
US7596553B2 (en) | String matching using data bit masks | |
US20140019486A1 (en) | Logic Content Processing for Hardware Acceleration of Multi-Pattern Search | |
WO2006074014A2 (en) | Database query processor | |
JP6592310B2 (en) | Semiconductor device | |
Bando et al. | Scalable lookahead regular expression detection system for deep packet inspection | |
Wang et al. | Memory-based architecture for multicharacter Aho–Corasick string matching | |
US8599853B2 (en) | System and method for an exact match search using pointer based pipelined multibit trie traversal technique | |
US8666930B2 (en) | String matching method | |
Erdem | Tree-based string pattern matching on FPGAs | |
KR101276796B1 (en) | Apparatus and method for matching pattern | |
Simão et al. | Generating checking sequences for partial reduced finite state machines | |
US8463988B2 (en) | System and method for matching patterns | |
KR101262337B1 (en) | Method and apparatus for pattern matching for multi-character parallel data stream | |
Lin et al. | Efficient pattern matching algorithm for memory architecture | |
US6384713B1 (en) | Serial comparator | |
JP2004526274A (en) | Search for words of different sizes | |
Hajiabadi et al. | Scalable, high-throughput and modular hardware-based string matching algorithm | |
Wang et al. | Hardware accelerator to detect multi-segment virus patterns |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20160425 Year of fee payment: 8 |