]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4036: appid: Support to get correct http session based on stream_id
authorKaushal Bhandankar (kbhandan) <kbhandan@cisco.com>
Tue, 3 Oct 2023 07:12:49 +0000 (07:12 +0000)
committerKaushal Bhandankar (kbhandan) <kbhandan@cisco.com>
Tue, 3 Oct 2023 07:12:49 +0000 (07:12 +0000)
Merge in SNORT/snort3 from ~KBHANDAN/snort3:file_concurrent to master

Squashed commit of the following:

commit 0ff38afdada8f56ad977b9acb68eb96cad4e0e56
Author: Kaushal Bhandankar <kbhandan@cisco.com>
Date:   Mon Oct 2 14:08:21 2023 +0530

    appid: Support to get correct http session based on stream_id

src/network_inspectors/appid/appid_session_api.cc
src/network_inspectors/appid/appid_session_api.h

index 09137735164a7bab8472ee3dfa6dcff92cad562b..ce761e35d21ec0950c8e9b32f74c5433b9b269cb 100644 (file)
@@ -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())
index c79b0e6a0a250fb9409ecb08942c2bca9100a8a4..4582745137d5bb2d8ebcfd3a8dbd8df712dcfd5b 100644 (file)
@@ -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;