]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1525 in SNORT/snort3 from ~SBAIGAL/snort3:file_capture to master
authorTom Peters (thopeter) <thopeter@cisco.com>
Tue, 26 Feb 2019 22:12:55 +0000 (17:12 -0500)
committerTom Peters (thopeter) <thopeter@cisco.com>
Tue, 26 Feb 2019 22:12:55 +0000 (17:12 -0500)
Squashed commit of the following:

commit 5d33a2096b9e5122c9f5612136b90dbe0f886bca
Author: Steven Baigal (sbaigal) <sbaigal@cisco.com>
Date:   Thu Feb 14 15:32:12 2019 -0500

    file_capture: sync with firewall changes

src/file_api/CMakeLists.txt
src/file_api/file_api.h
src/file_api/file_capture.h
src/file_api/file_lib.cc
src/file_api/file_lib.h

index d26ec94b10f5091214e3a6f126b48c244ed7816a..dadac33b04bd67d5372b7eb20c6234c3016333f0 100644 (file)
@@ -1,6 +1,7 @@
 
 set( FILE_API_INCLUDES
     file_api.h
+    file_capture.h
     file_config.h
     file_flows.h
     file_identifier.h 
@@ -16,7 +17,6 @@ add_library ( file_api OBJECT
     circular_buffer.cc 
     circular_buffer.h
     file_capture.cc
-    file_capture.h
     file_cache.cc
     file_cache.h
     file_config.cc 
index 4aac1375a0ba8dc5d11895dcef609ef224b061d8..39d3c5819407d770d02b316d77151c7561254d4f 100644 (file)
@@ -112,8 +112,6 @@ struct FileState
     FileSigState sig_state;
 };
 
-struct FileCaptureInfo;
-
 namespace snort
 {
 #define FILE_ID_MAX          1024
index 9a9ff7efb0daff5db432e3ca6dfc18f5b85f4ed5..36a3ee97c6daf46b139a9e2ee771a430893dd840 100644 (file)
@@ -50,7 +50,7 @@ struct FileCaptureBlock
     FileCaptureBlock* next;  /* next block of file data */
 };
 
-class FileCapture
+class SO_PUBLIC FileCapture
 {
 public:
     FileCapture(int64_t capture_min_size, int64_t capture_max_size);
@@ -93,6 +93,10 @@ public:
 
     snort::FileInfo* get_file_info() { return file_info; }
 
+    int64_t get_max_file_capture_size() { return capture_max_size; }
+    int64_t get_file_capture_size() { return capture_size; }
+    void get_file_reset() { current_block = head; }
+
 private:
 
     static void init_mempool(int64_t max_file_mem, int64_t block_size);
index 405d038c50f0202f240a1ac922d07a0282422368..f89a0afc3d74fb9bfabb0b7e67e5910679ffcd4e 100644 (file)
@@ -251,6 +251,11 @@ FileCaptureState FileInfo::reserve_file(FileCapture*& dest)
     return state;
 }
 
+int64_t FileInfo::get_max_file_capture_size()
+{
+    return (file_capture ? file_capture->get_max_file_capture_size() : 0);
+}
+
 FileContext::FileContext ()
 {
     file_type_context = nullptr;
index 58fdb9db2cb30dafd9c03afe2dd4ebcc89e87ed4..0d631f136334df64835077bdba1faba8c183fe7d 100644 (file)
@@ -76,6 +76,7 @@ public:
     // Preserve the file in memory until it is released
     // The file reserved will be returned and it will be detached from file context/session
     FileCaptureState reserve_file(FileCapture*& dest);
+    int64_t get_max_file_capture_size();
 
     FileState get_file_state() { return file_state; }