#include <cassert>
#include "app_info_table.h"
+#include "appid_debug.h"
#include "appid_http_session.h"
#include "appid_session.h"
#include "utils/util.h"
if (!asd)
return;
+ if (appidDebug->is_active())
+ LogMessage("AppIdDbg %s Processing HTTP metadata from HTTP Inspector\n",
+ appidDebug->get_debug_session());
+
direction = event_type == REQUEST_EVENT ? APP_ID_FROM_INITIATOR : APP_ID_FROM_RESPONDER;
AppIdHttpSession* hsession = asd->get_http_session();
hsession->process_http_packet(direction);
if (asd->service.get_id() == APP_ID_HTTP)
{
- asd->set_session_flags(APPID_SESSION_SERVICE_DETECTED | APPID_SESSION_HTTP_SESSION);
asd->set_application_ids(asd->pick_service_app_id(), asd->pick_client_app_id(),
asd->pick_payload_app_id(), asd->pick_misc_app_id());
- asd->service_disco_state = APPID_DISCO_STATE_FINISHED;
}
}
}
if (asd.service.get_id() == APP_ID_NONE)
+ {
asd.service.set_id(APP_ID_HTTP);
+ asd.set_session_flags(APPID_SESSION_SERVICE_DETECTED | APPID_SESSION_HTTP_SESSION);
+ asd.service_disco_state = APPID_DISCO_STATE_FINISHED;
+ }
if (appidDebug->is_active())
LogMessage("AppIdDbg %s chp_finished %d chp_hold_flow %d\n",
active_config = new AppIdConfig(const_cast<AppIdModuleConfig*>(config));
- DataBus::subscribe(HTTP_REQUEST_HEADER_EVENT_KEY, new HttpEventHandler(
- HttpEventHandler::REQUEST_EVENT));
-
- DataBus::subscribe(HTTP_RESPONSE_HEADER_EVENT_KEY, new HttpEventHandler(
- HttpEventHandler::RESPONSE_EVENT));
-
my_seh = SipEventHandler::create();
my_seh->subscribe();
active_config->init_appid(sc);
+
+#ifdef ENABLE_APPID_THIRD_PARTY
+ if (!TPLibHandler::have_tp())
+#endif
+ {
+ DataBus::subscribe(HTTP_REQUEST_HEADER_EVENT_KEY, new HttpEventHandler(
+ HttpEventHandler::REQUEST_EVENT));
+
+ DataBus::subscribe(HTTP_RESPONSE_HEADER_EVENT_KEY, new HttpEventHandler(
+ HttpEventHandler::RESPONSE_EVENT));
+ }
+
return true;
// FIXIT-M some of this stuff may be needed in some fashion...
#include <CppUTest/TestHarness.h>
#include <CppUTestExt/MockSupport.h>
+// Stubs for AppIdDebug
+THREAD_LOCAL AppIdDebug* appidDebug = nullptr;
+void AppIdDebug::activate(const Flow*, const AppIdSession*, bool) { active = true; }
+
using namespace snort;
namespace snort
flow = new Flow;
mock_session = new AppIdSession(IpProtocol::TCP, nullptr, 1492, appid_inspector);
flow->set_flow_data(mock_session);
+ appidDebug = new AppIdDebug();
+ appidDebug->activate(nullptr, nullptr, 0);
}
void teardown() override
delete mock_session;
delete flow;
mock().clear();
+ delete appidDebug;
MemoryLeakWarningPlugin::turnOnNewDeleteOverloads();
}
};