Refactor main loop

This commit is contained in:
luwenpeng
2024-04-11 16:30:21 +08:00
parent cfbad63021
commit 84541c40e2
11 changed files with 240 additions and 216 deletions

View File

@@ -14,20 +14,6 @@ struct packet_idetify
unsigned int ip_dst;
} __attribute__((packed, aligned(1)));
struct config
{
int enable;
unsigned int capacity;
double error_rate;
int expiry_time;
} config = {
.enable = 1,
.capacity = 1000000,
.error_rate = 0.00001,
.expiry_time = 3,
};
struct packet_idetify idetify = {
.tcp_seq = 2172673142,
.tcp_ack = 2198097831,
@@ -41,7 +27,7 @@ struct packet_idetify idetify = {
TEST(DABLOOMS, TEST)
{
struct expiry_dablooms_handle *handle = expiry_dablooms_new(config.capacity, config.error_rate, 1, config.expiry_time);
struct expiry_dablooms_handle *handle = expiry_dablooms_new(1000000, 0.00001, 1, 3);
EXPECT_TRUE(handle != nullptr);
EXPECT_TRUE(expiry_dablooms_search(handle, (const char *)&idetify, sizeof(idetify), 1) != 1); // no exist