From: Kaushal Bhandankar (kbhandan) Date: Tue, 3 Oct 2023 07:12:49 +0000 (+0000) Subject: Pull request #4036: appid: Support to get correct http session based on stream_id X-Git-Tag: 3.1.72.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ef75f265a5ca8da31cb4a17ca929fcd5c1a9eba;p=thirdparty%2Fsnort3.git Pull request #4036: appid: Support to get correct http session based on stream_id Merge in SNORT/snort3 from ~KBHANDAN/snort3:file_concurrent to master Squashed commit of the following: commit 0ff38afdada8f56ad977b9acb68eb96cad4e0e56 Author: Kaushal Bhandankar Date: Mon Oct 2 14:08:21 2023 +0530 appid: Support to get correct http session based on stream_id --- diff --git a/src/network_inspectors/appid/appid_session_api.cc b/src/network_inspectors/appid/appid_session_api.cc index 091377351..ce761e35d 100644 --- a/src/network_inspectors/appid/appid_session_api.cc +++ b/src/network_inspectors/appid/appid_session_api.cc @@ -523,6 +523,16 @@ const AppIdHttpSession* AppIdSessionApi::get_http_session(uint32_t stream_index) return get_hsession(stream_index); } +const AppIdHttpSession* AppIdSessionApi::get_matching_http_session(int64_t stream_id) const +{ + for (uint32_t stream_index=0; stream_index < hsessions.size(); stream_index++) + { + if(stream_id == hsessions[stream_index]->get_httpx_stream_id()) + return hsessions[stream_index]; + } + return nullptr; +} + AppIdHttpSession* AppIdSessionApi::get_hsession(uint32_t stream_index) const { if (stream_index < hsessions.size()) diff --git a/src/network_inspectors/appid/appid_session_api.h b/src/network_inspectors/appid/appid_session_api.h index c79b0e6a0..458274513 100644 --- a/src/network_inspectors/appid/appid_session_api.h +++ b/src/network_inspectors/appid/appid_session_api.h @@ -126,6 +126,7 @@ public: uint16_t get_service_port() const; const AppIdDnsSession* get_dns_session() const; const AppIdHttpSession* get_http_session(uint32_t stream_index = 0) const; + const AppIdHttpSession* get_matching_http_session(int64_t stream_id) const; const char* get_tls_host() const; bool is_http_inspection_done() const; const char* get_netbios_name() const;