-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhs_wrapper.h
More file actions
30 lines (27 loc) · 727 Bytes
/
hs_wrapper.h
File metadata and controls
30 lines (27 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef HS_WRAPPER_H_DEFINED
#define HS_WRAPPER_H_DEFINED
#include <hs/hs.h>
#include <memory>
#include <string>
#include <vector>
class HyperScanDatabase {
public:
typedef match_event_handler EventHandler;
enum class ScanMode {
BLOCK,
STREAM
};
HyperScanDatabase(ScanMode scanMode);
~HyperScanDatabase();
int addPattern(const char* pattern, int flags);
int scan(const char* data, size_t dataSize, EventHandler);
private:
std::vector<char*> m_patterns;
std::vector<unsigned int> m_flags;
std::vector<unsigned int> m_ids;
bool m_compiled = false;
ScanMode m_scanMode;
hs_database_t* m_database;
hs_scratch_t* m_scratch;
};
#endif // HS_WRAPPER_H_DEFINED