"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/network_inspectors/appid/test/appid_eve_process_event_handler_test.cc" between
snort3-3.1.28.0.tar.gz and snort3-3.1.29.0.tar.gz

About: Snort 3 is a network intrusion prevention and detection system (IDS/IPS) combining the benefits of signature, protocol and anomaly-based inspection.

appid_eve_process_event_handler_test.cc  (snort3-3.1.28.0):appid_eve_process_event_handler_test.cc  (snort3-3.1.29.0)
skipping to change at line 63 skipping to change at line 63
Packet::Packet(bool) { } Packet::Packet(bool) { }
Packet::~Packet() = default; Packet::~Packet() = default;
Packet* DetectionEngine::get_current_packet() Packet* DetectionEngine::get_current_packet()
{ {
static Packet p; static Packet p;
return &p; return &p;
} }
} }
AppIdSession* AppIdSession::allocate_session(const Packet*, IpProtocol,
AppidSessionDirection, AppIdInspector&, OdpContext&)
{
return nullptr;
}
void AppIdSession::publish_appid_event(AppidChangeBits&, const Packet&, bool, ui nt32_t) void AppIdSession::publish_appid_event(AppidChangeBits&, const Packet&, bool, ui nt32_t)
{ {
return; return;
} }
bool SslPatternMatchers::scan_hostname(const uint8_t*, size_t, AppId&, AppId&) bool SslPatternMatchers::scan_hostname(const uint8_t*, size_t, AppId&, AppId& pa yload)
{ {
payload = APPID_UT_ID + 1;
return true; return true;
} }
void AppIdSession::set_ss_application_ids_payload(AppId, AppidChangeBits&) void AppIdSession::set_ss_application_ids_payload(AppId, AppidChangeBits&)
{ {
return; return;
} }
void AppIdSession::set_client_appid_data(AppId, AppidChangeBits&, char*)
{
set_client_id(APPID_UT_ID);
return;
}
void ApplicationDescriptor::set_id(const Packet&, AppIdSession&, AppidSessionDir ection, void ApplicationDescriptor::set_id(const Packet&, AppIdSession&, AppidSessionDir ection,
AppId, AppidChangeBits&) { } AppId, AppidChangeBits&) { }
void AppIdModule::reset_stats() { } void AppIdModule::reset_stats() { }
void AppIdDebug::activate(snort::Flow const*, AppIdSession const*, bool) { } void AppIdDebug::activate(snort::Flow const*, AppIdSession const*, bool) { }
void AppIdSession::update_encrypted_app_id(AppId) {}
void HttpPatternMatchers::identify_user_agent(const char*, int, AppId&, AppId& c
lient, char**)
{
client = APPID_UT_ID;
}
void AppIdSession::set_service_appid_data(AppId, AppidChangeBits&, char*)
{
}
AppId AlpnPatternMatchers::match_alpn_pattern(const string& str)
{
if (!str.compare("h3"))
return APPID_UT_ID + 2;
else
return APP_ID_NONE;
}
AppId EveCaPatternMatchers::match_eve_ca_pattern(const string&, uint8_t) AppId EveCaPatternMatchers::match_eve_ca_pattern(const string&, uint8_t)
{ {
return APPID_UT_ID; return APPID_UT_ID;
} }
TEST_GROUP(appid_eve_process_event_handler_tests) TEST_GROUP(appid_eve_process_event_handler_tests)
{ {
void setup() override void setup() override
{ {
SfIp ip; SfIp ip;
skipping to change at line 111 skipping to change at line 142
delete &session->get_api(); delete &session->get_api();
delete session; delete session;
delete appidDebug; delete appidDebug;
} }
}; };
TEST(appid_eve_process_event_handler_tests, eve_process_event_handler) TEST(appid_eve_process_event_handler_tests, eve_process_event_handler)
{ {
Packet p; Packet p;
EveProcessEvent event(p, "firefox", 90); EveProcessEvent event(p, "firefox", 90);
AppIdEveProcessEventHandler event_handler; AppIdEveProcessEventHandler event_handler(dummy_appid_inspector);
Flow* flow = new Flow(); Flow* flow = new Flow();
event_handler.handle(event, flow); event_handler.handle(event, flow);
CHECK(session->get_eve_client_app_id() == APPID_UT_ID); CHECK(session->get_eve_client_app_id() == APPID_UT_ID);
delete flow; delete flow;
} }
TEST(appid_eve_process_event_handler_tests, eve_user_agent_event_handler)
{
Packet p;
EveProcessEvent event(p, "firefox", 90);
event.set_user_agent("chrome");
AppIdEveProcessEventHandler event_handler(dummy_appid_inspector);
Flow* flow = new Flow();
event_handler.handle(event, flow);
CHECK(session->get_client_id() == APPID_UT_ID);
delete flow;
}
TEST(appid_eve_process_event_handler_tests, eve_server_name_event_handler)
{
Packet p;
EveProcessEvent event(p, "firefox", 90);
event.set_server_name("www.google.com");
AppIdEveProcessEventHandler event_handler(dummy_appid_inspector);
Flow* flow = new Flow();
event_handler.handle(event, flow);
CHECK(session->get_payload_id() == APPID_UT_ID + 1);
delete flow;
}
TEST(appid_eve_process_event_handler_tests, eve_alpn_event_handler)
{
Packet p;
vector<string> alpn = {"h3"};
EveProcessEvent event(p, "firefox", 90);
event.set_alpn(alpn);
event.set_quic(true);
AppIdEveProcessEventHandler event_handler(dummy_appid_inspector);
Flow* flow = new Flow();
event_handler.handle(event, flow);
CHECK(session->get_alpn_service_app_id() == APPID_UT_ID + 2);
delete flow;
}
TEST(appid_eve_process_event_handler_tests, eve_unknown_alpn_event_handler)
{
Packet p;
vector<string> alpn = {"smb"};
EveProcessEvent event(p, "firefox", 90);
event.set_alpn(alpn);
event.set_quic(true);
AppIdEveProcessEventHandler event_handler(dummy_appid_inspector);
Flow* flow = new Flow();
event_handler.handle(event, flow);
CHECK(session->get_alpn_service_app_id() == APP_ID_NONE);
delete flow;
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int return_value = CommandLineTestRunner::RunAllTests(argc, argv); int return_value = CommandLineTestRunner::RunAllTests(argc, argv);
return return_value; return return_value;
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 86 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)