rename packet_filter to packet_dabloom
This commit is contained in:
@@ -49,8 +49,8 @@ target_link_libraries(gtest_packet_parser packet_manager gtest)
|
||||
add_executable(gtest_packet_builder gtest_packet_builder.cpp)
|
||||
target_link_libraries(gtest_packet_builder packet_manager gtest)
|
||||
|
||||
add_executable(gtest_packet_filter gtest_packet_filter.cpp)
|
||||
target_link_libraries(gtest_packet_filter packet_manager gtest)
|
||||
add_executable(gtest_packet_dabloom gtest_packet_dabloom.cpp)
|
||||
target_link_libraries(gtest_packet_dabloom packet_manager gtest)
|
||||
|
||||
add_executable(gtest_packet_ldbc gtest_packet_ldbc.cpp)
|
||||
target_link_libraries(gtest_packet_ldbc packet_manager gtest)
|
||||
@@ -79,7 +79,7 @@ gtest_discover_tests(gtest_gtp2_utils)
|
||||
gtest_discover_tests(gtest_packet_frag)
|
||||
gtest_discover_tests(gtest_packet_parser)
|
||||
gtest_discover_tests(gtest_packet_builder)
|
||||
gtest_discover_tests(gtest_packet_filter)
|
||||
gtest_discover_tests(gtest_packet_dabloom)
|
||||
gtest_discover_tests(gtest_packet_ldbc)
|
||||
gtest_discover_tests(gtest_packet_pool)
|
||||
gtest_discover_tests(gtest_packet_manager)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "tuple.h"
|
||||
#include "packet_internal.h"
|
||||
#include "packet_parser.h"
|
||||
#include "packet_filter.h"
|
||||
#include "packet_dabloom.h"
|
||||
|
||||
/******************************************************************************
|
||||
* [Protocols in frame: eth:ethertype:ip:ipv6:tcp]
|
||||
@@ -67,7 +67,7 @@ unsigned char data[] = {
|
||||
0x81, 0x80, 0x5c, 0x76, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20, 0x00, 0xf7, 0x57, 0x00, 0x00, 0x02, 0x04, 0x04, 0xc4, 0x01, 0x03, 0x03, 0x08, 0x01, 0x01,
|
||||
0x04, 0x02};
|
||||
|
||||
TEST(DUPLICATED_PACKET_FILTER, TEST)
|
||||
TEST(PACKET_DABLOOM, TEST)
|
||||
{
|
||||
struct packet pkt;
|
||||
uint32_t capacity = 1000000;
|
||||
@@ -77,17 +77,17 @@ TEST(DUPLICATED_PACKET_FILTER, TEST)
|
||||
memset(&pkt, 0, sizeof(pkt));
|
||||
packet_parse(&pkt, (const char *)data, sizeof(data));
|
||||
|
||||
struct packet_filter *filter = packet_filter_new(capacity, timeout, error_rate, 1);
|
||||
struct packet_dabloom *filter = packet_dabloom_new(capacity, timeout, error_rate, 1);
|
||||
EXPECT_TRUE(filter != nullptr);
|
||||
|
||||
EXPECT_TRUE(packet_filter_lookup(filter, &pkt, 1) == 0); // no found
|
||||
packet_filter_add(filter, &pkt, 1); // add
|
||||
EXPECT_TRUE(packet_filter_lookup(filter, &pkt, 1) == 1); // found
|
||||
EXPECT_TRUE(packet_filter_lookup(filter, &pkt, 2) == 1); // found
|
||||
EXPECT_TRUE(packet_filter_lookup(filter, &pkt, 3) == 0); // not found
|
||||
EXPECT_TRUE(packet_filter_lookup(filter, &pkt, 4) == 0); // not found
|
||||
EXPECT_TRUE(packet_dabloom_lookup(filter, &pkt, 1) == 0); // no found
|
||||
packet_dabloom_add(filter, &pkt, 1); // add
|
||||
EXPECT_TRUE(packet_dabloom_lookup(filter, &pkt, 1) == 1); // found
|
||||
EXPECT_TRUE(packet_dabloom_lookup(filter, &pkt, 2) == 1); // found
|
||||
EXPECT_TRUE(packet_dabloom_lookup(filter, &pkt, 3) == 0); // not found
|
||||
EXPECT_TRUE(packet_dabloom_lookup(filter, &pkt, 4) == 0); // not found
|
||||
|
||||
packet_filter_free(filter);
|
||||
packet_dabloom_free(filter);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
Reference in New Issue
Block a user