]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #631 in SNORT/snort3 from stream to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 22 Sep 2016 15:07:28 +0000 (11:07 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 22 Sep 2016 15:07:28 +0000 (11:07 -0400)
Squashed commit of the following:

commit ae3452ee7aa1acfbd370e1385046986d0553da83
Author: Russ Combs <rucombs@cisco.com>
Date:   Wed Sep 21 21:04:38 2016 -0400

    move flow purge at shutdown ahead of plugin termination
    fix --dirty-pig
    refactor use of flow_con for better encapsulation
    make all Stream methods static and hide stream implementation

123 files changed:
extra/src/inspectors/http_server/hi_main.cc
extra/src/inspectors/http_server/hi_main.h
extra/src/inspectors/http_server/hi_si.cc
extra/src/inspectors/http_server/hi_stream_splitter.cc
extra/src/inspectors/http_server/hi_stream_splitter.h
extra/src/inspectors/http_server/hi_util.h
extra/src/inspectors/http_server/http_inspect.cc
src/codecs/ip/cd_ipv4.cc
src/codecs/ip/cd_ipv6.cc
src/detection/detect.cc
src/detection/fp_detect.cc
src/file_api/file_api.h
src/file_api/file_flows.cc
src/file_api/file_policy.h
src/file_api/file_service.cc
src/flow/expect_cache.cc
src/flow/flow_control.cc
src/flow/ha.cc
src/flow/session.h
src/flow/test/ha_test.cc
src/host_tracker/host_tracker_module.cc
src/ips_options/ips_file_type.cc
src/ips_options/ips_flow.cc
src/ips_options/ips_flowbits.cc
src/loggers/log_pcap.cc
src/loggers/unified2.cc
src/main/modules.cc
src/main/snort.cc
src/memory/prune_handler.cc
src/network_inspectors/appid/appid_session.cc
src/network_inspectors/appid/detector_plugins/detector_imap.cc
src/network_inspectors/appid/detector_plugins/detector_kerberos.cc
src/network_inspectors/appid/detector_plugins/detector_pop3.cc
src/network_inspectors/appid/fw_appid.cc
src/network_inspectors/appid/ips_appid_option.cc
src/network_inspectors/binder/binder.cc
src/network_inspectors/binder/test/binder_test.cc
src/network_inspectors/normalize/norm.cc
src/network_inspectors/normalize/norm_module.cc
src/network_inspectors/port_scan/ps_detect.cc
src/network_inspectors/reputation/reputation_inspect.cc
src/network_inspectors/reputation/reputation_inspect.h
src/packet_io/active.cc
src/protocols/packet_manager.cc
src/service_inspectors/dce_rpc/dce_smb_paf.h
src/service_inspectors/dce_rpc/dce_tcp_paf.h
src/service_inspectors/dnp3/dnp3_paf.h
src/service_inspectors/dns/dns.cc
src/service_inspectors/dns/dns.h
src/service_inspectors/ftp_telnet/ftp.cc
src/service_inspectors/ftp_telnet/ftp_data.cc
src/service_inspectors/ftp_telnet/ftpp_si.cc
src/service_inspectors/ftp_telnet/ftpp_si.h
src/service_inspectors/ftp_telnet/pp_ftp.cc
src/service_inspectors/ftp_telnet/pp_telnet.cc
src/service_inspectors/http_inspect/http_flow_data.h
src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/http_inspect/http_msg_section.h
src/service_inspectors/imap/imap.cc
src/service_inspectors/imap/imap.h
src/service_inspectors/imap/imap_paf.cc
src/service_inspectors/imap/imap_paf.h
src/service_inspectors/modbus/modbus_decode.cc
src/service_inspectors/pop/pop.cc
src/service_inspectors/pop/pop.h
src/service_inspectors/pop/pop_paf.cc
src/service_inspectors/pop/pop_paf.h
src/service_inspectors/rpc_decode/rpc_decode.cc
src/service_inspectors/sip/sip.cc
src/service_inspectors/sip/sip.h
src/service_inspectors/sip/sip_dialog.cc
src/service_inspectors/smtp/smtp.cc
src/service_inspectors/smtp/smtp.h
src/service_inspectors/smtp/smtp_paf.cc
src/service_inspectors/smtp/smtp_paf.h
src/service_inspectors/smtp/smtp_util.cc
src/service_inspectors/ssh/ssh.cc
src/service_inspectors/ssh/ssh.h
src/service_inspectors/ssl/ssl_inspector.cc
src/service_inspectors/ssl/ssl_inspector.h
src/stream/CMakeLists.txt
src/stream/Makefile.am
src/stream/base/stream_base.cc
src/stream/base/stream_ha.cc
src/stream/base/stream_module.cc
src/stream/base/stream_module.h
src/stream/file/file_module.cc
src/stream/file/file_module.h
src/stream/icmp/icmp_ha.cc
src/stream/icmp/icmp_module.h
src/stream/icmp/icmp_session.cc
src/stream/ip/ip_ha.cc
src/stream/ip/ip_module.h
src/stream/ip/ip_session.cc
src/stream/ip/stream_ip.h
src/stream/libtcp/tcp_stream_tracker.cc
src/stream/paf.cc
src/stream/paf.h
src/stream/stream.cc [moved from src/stream/stream_api.cc with 86% similarity]
src/stream/stream.h
src/stream/stream_api.h [deleted file]
src/stream/tcp/ips_stream_reassemble.cc
src/stream/tcp/segment_overlap_editor.h
src/stream/tcp/stream_tcp.h
src/stream/tcp/tcp_defs.h
src/stream/tcp/tcp_ha.cc
src/stream/tcp/tcp_module.cc
src/stream/tcp/tcp_module.h
src/stream/tcp/tcp_reassembler.cc
src/stream/tcp/tcp_reassembler.h
src/stream/tcp/tcp_session.cc
src/stream/tcp/tcp_state_closed.cc
src/stream/tcp/tcp_state_none.cc
src/stream/tcp/tcp_stream_config.h
src/stream/udp/udp_ha.cc
src/stream/udp/udp_module.h
src/stream/udp/udp_session.cc
src/stream/user/user_module.cc
src/stream/user/user_session.cc
src/target_based/snort_protocols.cc
src/utils/util.cc
tools/snort2lua/config_states/config_one_int_option.cc
tools/snort2lua/config_states/config_one_string_option.cc

index 8f75795f3a358590f24472095d9a2097379f8a46..ad4e97f80dff8a7f7c12eb83200d9fcfd2f4d522 100644 (file)
@@ -71,7 +71,7 @@
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
 #include "search_engines/search_tool.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "utils/util.h"
 #include "utils/util_utf.h"
 #include "utils/sfsnprintfappend.h"
@@ -158,11 +158,11 @@ static HttpSessionData* get_session_data(Flow* flow)
 
 void HttpInspectRegisterXtraDataFuncs()
 {
-    xtra_trueip_id = stream.reg_xtra_data_cb(GetHttpTrueIP);
-    xtra_uri_id = stream.reg_xtra_data_cb(GetHttpUriData);
-    xtra_hname_id = stream.reg_xtra_data_cb(GetHttpHostnameData);
-    xtra_gzip_id = stream.reg_xtra_data_cb(GetHttpGzipData);
-    xtra_jsnorm_id = stream.reg_xtra_data_cb(GetHttpJSNormData);
+    xtra_trueip_id = Stream::reg_xtra_data_cb(GetHttpTrueIP);
+    xtra_uri_id = Stream::reg_xtra_data_cb(GetHttpUriData);
+    xtra_hname_id = Stream::reg_xtra_data_cb(GetHttpHostnameData);
+    xtra_gzip_id = Stream::reg_xtra_data_cb(GetHttpGzipData);
+    xtra_jsnorm_id = Stream::reg_xtra_data_cb(GetHttpJSNormData);
 }
 
 static void PrintFileDecompOpt(HTTPINSPECT_CONF* ServerConf)
@@ -369,7 +369,7 @@ static inline int SetSiInput(HI_SI_INPUT* SiInput, Packet* p)
     /*
     **  We now set the packet direction
     */
-    if (p->flow && stream.is_midstream(p->flow))
+    if (p->flow && Stream::is_midstream(p->flow))
     {
         SiInput->pdir = HI_SI_NO_MODE;
     }
@@ -449,24 +449,24 @@ static inline void HttpLogFuncs(
 
     /* for pipelined HTTP requests */
     if ( !iCallDetect )
-        stream.clear_extra_data(p->flow, p, 0);
+        Stream::clear_extra_data(p->flow, p, 0);
 
     if (hsd->true_ip)
     {
         if (!(p->packet_flags & PKT_STREAM_INSERT) && !(p->packet_flags & PKT_REBUILT_STREAM))
             SetExtraData(p, xtra_trueip_id);
         else
-            stream.set_extra_data(p->flow, p, xtra_trueip_id);
+            Stream::set_extra_data(p->flow, p, xtra_trueip_id);
     }
 
     if (hsd->log_flags & HTTP_LOG_URI)
     {
-        stream.set_extra_data(p->flow, p, xtra_uri_id);
+        Stream::set_extra_data(p->flow, p, xtra_uri_id);
     }
 
     if (hsd->log_flags & HTTP_LOG_HOSTNAME)
     {
-        stream.set_extra_data(p->flow, p, xtra_hname_id);
+        Stream::set_extra_data(p->flow, p, xtra_hname_id);
     }
 
     if (hsd->log_flags & HTTP_LOG_JSNORM_DATA)
index 276833eda74289bcadf248511bcae3be6cfece44..25f1bc0ce1e8b90a525f7fb5a91c5bdb416367a5 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "detection/detection_util.h"
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 #include "utils/util_jsnorm.h"
 #include "utils/util_utf.h"
 #include "hi_ui_config.h"
index 4f0ed3654e1b214c3c3873d2e618acd0e6c43205..826b442d4a9ea69c0585cd6a2653e797c1024410 100644 (file)
@@ -51,7 +51,6 @@
 #include "hi_ui_config.h"
 #include "hi_ad.h"
 #include "hi_main.h"
-#include "stream/stream_api.h"
 
 /*
 **  NAME
index 89625202c47cab5324a323e1484ab9eeae5abab7..e6d9f406ffbc7bd9812c37e08ae02a3180bf2856 100644 (file)
@@ -60,7 +60,7 @@
 #include "main/snort_debug.h"
 #include "events/event_queue.h"
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "utils/util.h"
 
 #ifdef DEBUG_MSGS
@@ -780,7 +780,7 @@ static inline Hi5State* get_state(Flow* flow, bool c2s)
     if ( !flow )
         return nullptr;
 
-    HttpSplitter* s = (HttpSplitter*)stream.get_splitter(flow, c2s);
+    HttpSplitter* s = (HttpSplitter*)Stream::get_splitter(flow, c2s);
     return s ? &s->state : nullptr;
 }
 
@@ -806,7 +806,7 @@ static void hi_pipe_push(Hi5State* s_req, Flow* ssn)
 
     if ( nreq == MAX_PIPELINE )
     {
-        if ( stream.is_paf_active(ssn, 0) )
+        if ( Stream::is_paf_active(ssn, 0) )
             hi_paf_event_pipe();
     }
     else if ( nreq < MAX_PIPELINE )
index 64e3938603551dd9ceabbf1ab22edd659a4e177e..b8199c945201c02a35898a4625207bb2248e2766 100644 (file)
@@ -28,7 +28,6 @@
 #define HI_STREAM_SPLITTER_H
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 
 bool hi_paf_init(uint32_t cap);
index fe0f604c0fec34cef943f1e53fd4ef79a54d4aed..e9ba0da11d807a6aa20610579308e3ff13d8c5e5 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef HI_UTIL_H
 #define HI_UTIL_H
 
+#include <strings.h>
 #include "hi_include.h"
 
 /*
index 11766ebea673e8521f79d9bbac0bb3838dce67f2..9f65a356fab689bda109dcb5e1f402c2f50f8b4c 100644 (file)
@@ -45,7 +45,6 @@
 #include "main/snort_debug.h"
 #include "decompress/file_decomp.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "file_api/file_api.h"
 #include "file_api/file_service.h"
 #include "mime/decode_base.h"
index f762a97f9f688c8c337ff90e6df0547f019c4780..4b7849e5d39c667cf1aa127294bbbb60cfe28d0a 100644 (file)
@@ -36,7 +36,6 @@
 #include "packet_io/active.h"
 #include "codecs/ip/checksum.h"
 #include "main/thread.h"
-#include "stream/stream_api.h"
 #include "codecs/codec_module.h"
 #include "protocols/ip.h"
 #include "protocols/ipv4_options.h"
index 8d8edf67046577cd0f203e51a2bf1704579d64a7..28e1a0306045a5b64c2abe778b4a07f2041bb4de 100644 (file)
@@ -28,7 +28,6 @@
 #include "protocols/ipv6.h"
 #include "codecs/codec_module.h"
 #include "framework/codec.h"
-#include "stream/stream_api.h"
 #include "main/snort_config.h"
 #include "packet_io/active.h"
 #include "protocols/protocol_ids.h"
index 8da04fa0d3f87b96641ad5fecefbe2b04ccaf939..268340763d347194d34abf7f18415610fd0ac1c3 100644 (file)
@@ -46,6 +46,7 @@
 #include "ports/port_object.h"
 #include "profiler/profiler_defs.h"
 #include "sfip/sf_ipvar.h"
+#include "stream/stream.h"
 #include "utils/stats.h"
 
 #define CHECK_SRC_IP         0x01
@@ -112,7 +113,7 @@ void snort_inspect(Packet* p)
         // FIXIT-H but this result in double clearing?  should normal
         // clear_session() calls be deleted from stream?  this is a
         // performance hit on short-lived flows
-        stream.check_session_closed(p);
+        Stream::check_flow_closed(p);
 
         /*
         ** By checking tagging here, we make sure that we log the
index edaf00780532c02c246f59aba2e85ec426e37ea0..d90f72698a5e92bd2319825643b768616584e149 100644 (file)
@@ -67,7 +67,6 @@
 #include "events/event_wrapper.h"
 #include "packet_io/active.h"
 #include "parser/parser.h"
-#include "stream/stream_api.h"
 #include "utils/sflsq.h"
 #include "utils/util.h"
 #include "profiler/profiler.h"
@@ -79,6 +78,7 @@
 #include "protocols/udp.h"
 #include "protocols/icmp4.h"
 #include "search_engines/pat_stats.h"
+#include "stream/stream.h"
 #include "utils/stats.h"
 
 THREAD_LOCAL ProfileStats rulePerfStats;
@@ -562,7 +562,7 @@ static inline int fpAddSessionAlert(Packet* p, const OptTreeNode* otn)
     if ( !otn )
         return 0;
 
-    return !stream.add_session_alert(
+    return !Stream::add_flow_alert(
         p->flow, p, otn->sigInfo.generator, otn->sigInfo.id);
 }
 
@@ -588,7 +588,7 @@ static inline int fpSessionAlerted(Packet* p, const OptTreeNode* otn)
 {
     const SigInfo* si = &otn->sigInfo;
 
-    if (!stream.check_session_alerted(p->flow, p, si->generator, si->id))
+    if (!Stream::check_flow_alerted(p->flow, p, si->generator, si->id))
         return 0;
     else
         return 1;
index 31e8be73f841772777271d8ff8637d383351f46c..58f02efc2a3a5e735e7933e0c6cdd42d26af9e28 100644 (file)
@@ -27,8 +27,8 @@
 // and configurations.
 
 #include <sys/types.h>
+#include <string>
 
-#include "stream/stream_api.h"
 #include "main/snort_types.h"
 
 #define     ENABLE_FILE_TYPE_IDENTIFICATION      0x1
@@ -139,8 +139,8 @@ inline bool isFileEnd(FilePosition position)
     return ((position == SNORT_FILE_END) || (position == SNORT_FILE_FULL));
 }
 
-SO_PUBLIC uint64_t get_file_processed_size(Flow* flow);
-FilePosition get_file_position(Packet* pkt);
+SO_PUBLIC uint64_t get_file_processed_size(class Flow* flow);
+FilePosition get_file_position(struct Packet* pkt);
 
 #endif
 
index e65d85b0079e6a39f0183ea5b1217edc24a035d9..aa2edcf1850e032e5eb7274d611a8d9d098a8513 100644 (file)
@@ -43,7 +43,6 @@
 #include "file_config.h"
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "packet_io/active.h"
 
 int64_t FileConfig::show_data_depth = DEFAULT_FILE_SHOW_DATA_DEPTH;
index 5c700d7ad86176a9c77d35bfcce98a6959246497..0123d3966f289e28ed72e9098de339bd246d37f7 100644 (file)
 #ifndef FILE_POLICY_H
 #define FILE_POLICY_H
 
-#include "file_api.h"
 #include <map>
+#include <vector>
+
+#include "file_api.h"
 
 struct FileVerdictWhen
 {
index 346b66472ab6f31edf7f8a20283ec465ae8fe5d3..01954ffc1bb0c78fd9df06a3fd8d206af4e4bc6d 100644 (file)
@@ -45,7 +45,6 @@
 #include "mime/file_mime_process.h"
 #include "main/snort_types.h"
 #include "managers/action_manager.h"
-#include "stream/stream_api.h"
 #include "detection/detect.h"
 #include "detection/detection_util.h"
 #include "packet_io/active.h"
index d2e7c0ae436b4cf62bfaa97361a97c13a9fd1e70..af59cc876d2d28366b76110d004e1950cd9992cb 100644 (file)
@@ -22,8 +22,9 @@
 #include <assert.h>
 
 #include "time/packet_time.h"
-#include "stream/stream_api.h"  // FIXIT-M bad dependency
 #include "hash/zhash.h"
+#include "protocols/packet.h"
+#include "stream/stream.h"
 #include "sfip/sf_ip.h"
 
 /* Reasonably small, and prime */
index 1433e242cb3ef3eb7460598480edc334de116a64..8fbfda84775ea7997c793906e066e2e6129f51af 100644 (file)
@@ -34,6 +34,7 @@
 #include "protocols/udp.h"
 #include "protocols/vlan.h"
 #include "sfip/sf_ip.h"
+#include "stream/stream.h"
 
 #include "expect_cache.h"
 #include "flow_cache.h"
@@ -446,7 +447,7 @@ unsigned FlowControl::process(Flow* flow, Packet* p)
 
     case Flow::FlowState::ALLOW:
         if ( news )
-            stream.stop_inspection(flow, p, SSN_DIR_BOTH, -1, 0);
+            Stream::stop_inspection(flow, p, SSN_DIR_BOTH, -1, 0);
         else
             DisableInspection();
 
@@ -455,7 +456,7 @@ unsigned FlowControl::process(Flow* flow, Packet* p)
 
     case Flow::FlowState::BLOCK:
         if ( news )
-            stream.drop_traffic(flow, SSN_DIR_BOTH);
+            Stream::drop_traffic(flow, SSN_DIR_BOTH);
         else
             Active::block_again();
 
@@ -464,11 +465,11 @@ unsigned FlowControl::process(Flow* flow, Packet* p)
 
     case Flow::FlowState::RESET:
         if ( news )
-            stream.drop_traffic(flow, SSN_DIR_BOTH);
+            Stream::drop_traffic(flow, SSN_DIR_BOTH);
         else
             Active::reset_again();
 
-        stream.blocked_session(flow, p);
+        Stream::blocked_flow(flow, p);
         DisableInspection();
         break;
     }
index 24664c11ed1b68b43fa1553f8aaee07d0a8e1d85..cb4098067c9fbdc9aaa40f4b19001df86b69c4db 100644 (file)
@@ -31,7 +31,7 @@
 #include "packet_io/sfdaq.h"
 #include "profiler/profiler.h"
 #include "side_channel/side_channel.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "time/packet_time.h"
 
 static const uint8_t HA_MESSAGE_VERSION = 3;
@@ -343,7 +343,7 @@ static void consume_receive_delete_message(HAMessage* msg)
 {
     FlowKey key;
     (void)read_flow_key(&key, msg);
-    stream.delete_session(&key);
+    Stream::delete_flow(&key);
 }
 
 static void consume_receive_update_message(HAMessage* msg)
@@ -351,7 +351,7 @@ static void consume_receive_update_message(HAMessage* msg)
     FlowKey key;
     (void)read_flow_key(&key, msg);
     // flow will be nullptr if/when the session does not exist in the caches
-    Flow* flow = stream.get_session(&key);
+    Flow* flow = Stream::get_flow(&key);
 
     assert(s_client_map);
 
index 2125fbb78146df6899b52a40a17fa474f1219203..745c3822675159903ace5d99747de0b37676ae21 100644 (file)
@@ -24,7 +24,7 @@
 // the subclasses do the actual work of tracking, reassembly, etc.
 
 #include "sfip/sfip_t.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 
 struct Packet;
 class Flow;
index 4eeab4a6d6a7b7e6254484621056911fac14039d..81ece5f41e1c23948e7043772db4a08b6e97cf9d 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "flow/flow.h"
 #include "main/snort_debug.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 
 #include <CppUTest/CommandLineTestRunner.h>
 #include <CppUTest/TestHarness.h>
@@ -132,14 +132,14 @@ public:
 private:
 };
 
-Flow*  Stream::get_session(const FlowKey* flowkey)
+Flow*  Stream::get_flow(const FlowKey* flowkey)
 {
     s_flowkey = *flowkey;
     s_get_session_called = true;
     return &s_flow;
 }
 
-void Stream::delete_session(const FlowKey* flowkey)
+void Stream::delete_flow(const FlowKey* flowkey)
 {
     s_flowkey = *flowkey;
     s_delete_session_called = true;
index 05a24deae622a48104ecbdcaa00a1818f6d2d6af..8a7fd2f4cd4952f617a261f51e97a50b7351841c 100644 (file)
 
 // host_tracker_module.cc author Steve Chew <stechew@cisco.com>
 
-#include "host_tracker/host_tracker_module.h"
+#include "host_tracker_module.h"
 
-#include "host_tracker/host_cache.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "target_based/snort_protocols.h"
+#include "host_cache.h"
 
 const PegInfo host_tracker_pegs[] =
 {
index 738b7452cfbf7abca4cd13fa8a8a7b966cc7fc56..543bf6bc1c0c24d5283f944a71c5d0617ee29f33 100644 (file)
 
 #include <bitset>
 
-#include "profiler/profiler.h"
 #include "detection/detection_defines.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "file_api/file_identifier.h"
 #include "file_api/file_flows.h"
+#include "profiler/profiler.h"
+#include "protocols/packet.h"
 
 typedef std::bitset<FILE_ID_MAX> TypeBitSet;
 
index b7ead0f3bcc0c8b820d6ce03143835ead733fa04..988268b068f2e7dd2103aafdb0345a30477d1852 100644 (file)
@@ -36,7 +36,6 @@
 #include "parser/parser.h"
 #include "utils/util.h"
 #include "hash/sfhashfcn.h"
-#include "stream/stream_api.h"
 #include "profiler/profiler.h"
 #include "detection/detection_defines.h"
 #include "framework/ips_option.h"
index 6e6c4f5f43035ed4feba630dc590e953dbc58fcb..1cbe2c285125c97d12798458b88ca859127c2571 100644 (file)
@@ -61,7 +61,6 @@ using namespace std;
 #include "utils/bitop.h"
 #include "hash/sfghash.h"
 #include "parser/mstring.h"
-#include "stream/stream_api.h"
 #include "profiler/profiler.h"
 #include "hash/sfhashfcn.h"
 #include "detection/detection_defines.h"
index 3524e8f37c17fef67555e6467a4959bef6a56ff8..89aab1acc4ba357d3cebbf74098018686afba50b 100644 (file)
@@ -45,7 +45,6 @@ extern "C" {
 #include "events/event.h"
 #include "parser/parser.h"
 #include "packet_io/sfdaq.h"
-#include "stream/stream_api.h"
 #include "utils/util.h"
 #include "utils/stats.h"
 
index add0980ea7aca47c0924cbaae2ff6258151f23bc..680e70d09ae54788ea9d50d195af7b85b81e145b 100644 (file)
 #include "detection/detect.h"
 #include "parser/parser.h"
 #include "events/event.h"
-#include "utils/util.h"
+#include "log/obfuscator.h"
 #include "packet_io/active.h"
 #include "packet_io/sfdaq.h"
-#include "stream/stream_api.h"
 #include "protocols/layer.h"
 #include "protocols/vlan.h"
 #include "protocols/icmp4.h"
-#include "log/obfuscator.h"
+#include "stream/stream.h"
 #include "utils/safec.h"
+#include "utils/util.h"
 
 using namespace std;
 
@@ -878,7 +878,7 @@ void U2Logger::open()
 
     Unified2InitFile(&config);
 
-    stream.reg_xtra_data_log(AlertExtraData, &config);
+    Stream::reg_xtra_data_log(AlertExtraData, &config);
 }
 
 void U2Logger::close()
@@ -910,14 +910,14 @@ void U2Logger::alert(Packet* p, const char* msg, Event* event)
     }
 
     if ( p->flow )
-        stream.update_session_alert(
+        Stream::update_flow_alert(
             p->flow, p, event->sig_info->generator, event->sig_info->id,
             event->event_id, event->ref_time.tv_sec);
 
     if ( p->xtradata_mask )
     {
         LogFunction* log_funcs;
-        uint32_t max_count = stream.get_xtra_data_map(&log_funcs);
+        uint32_t max_count = Stream::get_xtra_data_map(&log_funcs);
 
         if ( max_count > 0 )
             AlertExtraData(
index a913477639bcf9628a32c5fe1dcf577f7b985c20..ed3c4f4c063268079438cb1917ddc98b6214ba81 100644 (file)
@@ -54,6 +54,7 @@
 #include "side_channel/side_channel_module.h"
 #include "sfip/sf_ip.h"
 #include "sfip/sf_ipvar.h"
+#include "stream/stream.h"
 #include "target_based/sftarget_data.h"
 #include "target_based/snort_protocols.h"
 
index 0963d1dcbf3207de636b6ced7c0771ab38af16ab..85910103dc4e791982b958214db6339bba723d21 100644 (file)
@@ -45,7 +45,6 @@
 #include "filters/detection_filter.h"
 #include "filters/rate_filter.h"
 #include "filters/sfthreshold.h"
-#include "flow/flow_control.h"
 #include "flow/ha.h"
 #include "framework/mpse.h"
 #include "helpers/process.h"
@@ -601,10 +600,7 @@ void Snort::capture_packet()
 
 void Snort::thread_idle()
 {
-    if ( flow_con )
-        // FIXIT-M batch here or loop vs looping over idle?
-        flow_con->timeout_flows(time(NULL));
-
+    Stream::timeout_flows(time(nullptr));
     perf_monitor_idle_process();
     aux_counts.idle++;
     HighAvailabilityManager::process_receive();
@@ -668,9 +664,11 @@ void Snort::thread_init_unprivileged()
 void Snort::thread_term()
 {
     HighAvailabilityManager::thread_term_beginning();
+
     if ( !snort_conf->dirty_pig )
-        InspectorManager::thread_stop(snort_conf);
+        Stream::purge_flows();
 
+    InspectorManager::thread_stop(snort_conf);
     ModuleManager::accumulate(snort_conf);
     InspectorManager::thread_term(snort_conf);
     ActionManager::thread_term(snort_conf);
@@ -852,10 +850,7 @@ DAQ_Verdict Snort::packet_callback(
 
     Active::reset();
     PacketManager::encode_reset();
-
-    if ( flow_con ) // FIXIT-M always instantiate
-        flow_con->timeout_flows(pkthdr->ts.tv_sec);
-
+    Stream::timeout_flows(pkthdr->ts.tv_sec);
     HighAvailabilityManager::process_receive();
 
     s_packet->pkth = nullptr;  // no longer avail upon sig segv
index 967b940d5cf8aad1321eaa1ded0db6699d6aba31..e19b4bb1d8beb123e1706d0e39de287c4311f2b5 100644 (file)
@@ -19,9 +19,6 @@
 // prune_handler.cc author Joel Cornett <jocornet@cisco.com>
 
 #include "prune_handler.h"
-
-#include "flow/flow_cache.h"
-#include "flow/flow_control.h"
 #include "stream/stream.h"
 
 namespace memory
@@ -29,9 +26,7 @@ namespace memory
 
 void prune_handler()
 {
-    // assert(flow_con);
-    if ( flow_con )
-        flow_con->prune_one(PruneReason::MEMCAP, false);
+    Stream::prune_flows();
 }
 
 } // namespace memory
index e0364c4861623892f496fbd618eab1828b08f697..973b4ed0b7d95ea868f2bfa4bb8329fa38222eaa 100644 (file)
 
 // appid_flow_data.cc author Sourcefire Inc.
 
+#include "log/messages.h"
 #include "protocols/tcp.h"
 #include "profiler/profiler.h"
 #include "target_based/snort_protocols.h"
+#include "sfip/sf_ip.h"
+#include "stream/stream.h"
+#include "time/packet_time.h"
+#include "utils/util.h"
 
-#include "appid_session.h"
-#include "appid_module.h"
-#include "fw_appid.h"
-#include "appid_stats.h"
-#include "app_forecast.h"
-#include "host_port_app_cache.h"
-#include "lua_detector_module.h"
+#include "appid_utils/ip_funcs.h"
 #include "client_plugins/client_app_base.h"
 #include "detector_plugins/detector_http.h"
 #include "detector_plugins/detector_dns.h"
 #include "service_plugins/service_ssl.h"
 #include "service_plugins/service_util.h"
 
-#include "log/messages.h"
-#include "stream/stream_api.h"
-#include "sfip/sf_ip.h"
-#include "utils/util.h"
-#include "appid_utils/ip_funcs.h"
-#include "time/packet_time.h"
+#include "appid_session.h"
+#include "appid_module.h"
+#include "fw_appid.h"
+#include "appid_stats.h"
+#include "app_forecast.h"
+#include "host_port_app_cache.h"
+#include "lua_detector_module.h"
 
 ProfileStats tpPerfStats;
 ProfileStats tpLibPerfStats;
@@ -469,8 +469,8 @@ AppIdSession* AppIdSession::create_future_session(const Packet* /*ctrlPkt*/, con
 
     // FIXIT - 2.9.x set_application_protocol_id_expected has several new parameters, need to look
     // into what is required to support those here.
-    if (stream.set_application_protocol_id_expected(/*crtlPkt,*/ cliIp, cliPort, srvIp, srvPort,
-        protocol, app_id, session) )
+    if ( Stream::set_application_protocol_id_expected(
+        /*crtlPkt,*/ cliIp, cliPort, srvIp, srvPort, protocol, app_id, session) )
     {
         if (app_id_debug_session_flag)
             LogMessage("AppIdDbg %s failed to create a related flow for %s-%u -> %s-%u %u\n",
@@ -1256,7 +1256,8 @@ bool AppIdSession::do_third_party_discovery(IpProtocol protocol, const sfip_t* i
                 thirdparty_appid_module->disable_flags(tpsession,
                         TP_SESSION_FLAG_ATTRIBUTE | TP_SESSION_FLAG_TUNNELING | TP_SESSION_FLAG_FUTUREFLOW);
             }
-            if (tp_app_id == APP_ID_SSL && (stream.get_application_protocol_id(p->flow) == snortId_for_ftp_data))
+            if (tp_app_id == APP_ID_SSL &&
+                (Stream::get_application_protocol_id(p->flow) == snortId_for_ftp_data))
             {
                 //  If we see SSL on an FTP data channel set tpAppId back
                 //  to APP_ID_NONE so the FTP preprocessor picks up the flow.
index 76d898275613b17106ee6a6539afd2077192cac8..d0869452dd618a702cf8c01a1727bd9964490791 100644 (file)
@@ -713,7 +713,7 @@ static CLIENT_APP_RETCODE validate(const uint8_t* data, uint16_t size, const int
         (SearchTool*)( ( AppIdConfig*)pConfig)->find_generic_config_element(client_app_mod.name);
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     if (!size)
@@ -990,7 +990,7 @@ static int imap_validate(ServiceValidationArgs* args)
         goto inprocess;
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     if (!size)
index 4326d483a1e0627ab09afc576fd7190f57a50dab..4879a0c385e310fb13de742f6326afe6f3479c3e 100644 (file)
@@ -973,7 +973,7 @@ static CLIENT_APP_RETCODE krb_client_validate(const uint8_t* data, uint16_t size
 #endif
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     if (!size)
@@ -1046,7 +1046,7 @@ static int krb_server_validate(ServiceValidationArgs* args)
         goto inprocess;
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     if (!size)
index 9b28db892081586cb2d409205ff9827b4a35cc2c..0baa1256994024dcac7535d53eab04fc3aa09e7b 100644 (file)
@@ -686,7 +686,7 @@ static CLIENT_APP_RETCODE pop3_ca_validate(const uint8_t* data, uint16_t size, c
         return CLIENT_APP_INPROCESS;
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     dd = (POP3DetectorData*)pop3_detector_mod.api->data_get(flowp,
@@ -893,7 +893,7 @@ static int pop3_validate(ServiceValidationArgs* args)
         goto inprocess;
 
 #ifdef APP_ID_USES_REASSEMBLED
-    stream.flush_response_flush(pkt);
+    Stream::flush_response_flush(pkt);
 #endif
 
     if (dir != APP_ID_FROM_RESPONDER)
index 862aa4ac62a952369171778f3a72571a45e69269..52dd5d84b0eec992964680cc7b34d1572f3280e2 100644 (file)
@@ -44,7 +44,6 @@
 #include "appid_utils/network_set.h"
 #include "time/packet_time.h"
 #include "sfip/sf_ip.h"
-#include "stream/stream_api.h"
 
 #define HTTP_PATTERN_MAX_LEN    1024
 #define PORT_MAX 65535
index 41023158d495049cb2d9926374a9377ad2bd8265..dc6245d457069b092a3a88cd4e3ebee3e1bf82aa 100644 (file)
@@ -38,8 +38,8 @@
 #include "hash/sfhashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
+#include "stream/stream.h"
 #include "utils/util.h"
-#include "stream/stream_api.h"
 
 //-------------------------------------------------------------------------
 // appid option
index 831a9aebed8d5a6d28001dc488c3c371702372c7..06685b034cb041ad470759884b7cf461116fe8a3 100644 (file)
@@ -32,7 +32,6 @@ using namespace std;
 #include "protocols/packet.h"
 #include "protocols/vlan.h"
 #include "protocols/layer.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "profiler/profiler.h"
 #include "utils/stats.h"
@@ -207,7 +206,7 @@ static void set_session(Flow* flow)
 
 static void set_service(Flow* flow, const HostAttributeEntry* host)
 {
-    stream.set_application_protocol_id(flow, host, FROM_SERVER);
+    Stream::set_application_protocol_id(flow, host, FROM_SERVER);
 }
 
 static Inspector* get_gadget(Flow* flow)
@@ -472,13 +471,13 @@ int Binder::exec_handle_gadget( void* pv )
 
     if ( ins )
     {
-        stream.set_splitter(flow, true, ins->get_splitter(true));
-        stream.set_splitter(flow, false, ins->get_splitter(false));
+        Stream::set_splitter(flow, true, ins->get_splitter(true));
+        Stream::set_splitter(flow, false, ins->get_splitter(false));
     }
     else
     {
-        stream.set_splitter(flow, true, new AtomSplitter(true));
-        stream.set_splitter(flow, false, new AtomSplitter(false));
+        Stream::set_splitter(flow, true, new AtomSplitter(true));
+        Stream::set_splitter(flow, false, new AtomSplitter(false));
     }
 
     return 0;
index f7c37d73a04d44e225df84c4967099a9f606a71a..105fb2a84757c62b0319abe1fe91da22b76ff628 100644 (file)
@@ -30,7 +30,6 @@
 #include "managers/inspector_manager.h"
 #include "main/policy.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "utils/stats.h"
 
index 881fec962bf9e18bd7ccb2f90db398787a416866..7e268045795cc96fdf53ce9e9814607bd6254945 100644 (file)
@@ -33,7 +33,6 @@
 #include "protocols/tcp_options.h"
 #include "protocols/icmp4.h"
 #include "protocols/icmp6.h"
-#include "stream/stream.h"
 #include "stream/tcp/tcp_normalizer.h"
 #include "utils/stats.h"
 
index e03bd8a5364c92882f069b809901a2ad17dc7e1a..273ac05a8e3153e7dd3c45351dba278f3961a8cd 100644 (file)
@@ -24,7 +24,6 @@
 #include <sstream>
 #include <vector>
 
-#include "stream/stream.h"
 #include "stream/tcp/tcp_normalizer.h"
 
 using namespace std;
index ea88f18fcab90476362e2074404188974cd7b611..1f20ece735aa530aa3bbd242589516883e1a0cb7 100644 (file)
 #include "protocols/packet.h"
 #include "time/packet_time.h"
 #include "hash/sfxhash.h"
-#include "stream/stream_api.h"
-#include "sfip/sf_ip.h"
 #include "protocols/tcp.h"
 #include "protocols/udp.h"
 #include "protocols/icmp4.h"
 #include "protocols/icmp6.h"
 #include "protocols/eth.h"
+#include "sfip/sf_ip.h"
+#include "stream/stream.h"
 
 typedef struct s_PS_HASH_KEY
 {
@@ -343,7 +343,7 @@ int PortScan::ps_filter_ignore(PS_PKT* ps_pkt)
     }
     else if (p->ptrs.udph && p->flow)
     {
-        if (stream.get_packet_direction(p) & PKT_FROM_SERVER)
+        if (Stream::get_packet_direction(p) & PKT_FROM_SERVER)
             reverse_pkt = 1;
     }
 
@@ -996,7 +996,7 @@ int PortScan::ps_tracker_update_udp(PS_PKT* ps_pkt, PS_TRACKER* scanner,
     {
         if ( p->flow )
         {
-            uint32_t direction = stream.get_packet_direction(p);
+            uint32_t direction = Stream::get_packet_direction(p);
 
             if (direction == PKT_FROM_CLIENT)
             {
index 229278e193581784b7088b0d3d477accac356259..6214911437270091bb4f05151f3ec8a1fcf349d4 100644 (file)
@@ -39,7 +39,6 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "file_api/file_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
index 42ec3a28da1db2691054c67c6fc9fcabec1f404e..ecadd3e58f4aa2240091a14925a14f2e18da393c 100644 (file)
@@ -20,7 +20,6 @@
 #define REPUTATION_INSPECT_H
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 
 // Per-session data block containing current state
 // of the Reputation preprocessor for the session.
index 600a687c72b4aab75bd02dea8925241eee2e4634..43011ee29f04c257ee8646f1a877687dd0297e7e 100644 (file)
@@ -28,6 +28,7 @@
 #include "managers/action_manager.h"
 #include "packet_io/sfdaq.h"
 #include "protocols/tcp.h"
+#include "stream/stream.h"
 #include "utils/dnet_header.h"
 
 #define MAX_ATTEMPTS 20
@@ -415,7 +416,7 @@ void Active::block_session(const Packet* p, bool force)
     active_action = ACT_BLOCK;
 
     if ( force or SnortConfig::inline_mode() or SnortConfig::treat_drop_as_ignore() )
-        stream.drop_session(p);
+        Stream::drop_flow(p);
 }
 
 void Active::reset_session(const Packet* p, bool force)
@@ -424,7 +425,7 @@ void Active::reset_session(const Packet* p, bool force)
     active_action = ACT_RESET;
 
     if ( force or SnortConfig::inline_mode() or SnortConfig::treat_drop_as_ignore() )
-        stream.drop_session(p);
+        Stream::drop_flow(p);
 
     if ( s_enabled and snort_conf->max_responses )
     {
@@ -432,7 +433,7 @@ void Active::reset_session(const Packet* p, bool force)
 
         if ( p->flow )
         {
-            stream.init_active_response(p, p->flow);
+            Stream::init_active_response(p, p->flow);
             p->flow->set_state(Flow::FlowState::RESET);
         }
     }
index 01daf9277bd313958cc2e49a83f37431d027a3ec..bb562d40dbd0b566047730cbf9b4b587afe3ec2c 100644 (file)
@@ -46,9 +46,9 @@
 #include "utils/stats.h"
 #include "log/text_log.h"
 #include "main/snort_debug.h"
-#include "stream/stream_api.h"
 #include "packet_io/sfdaq.h"
 #include "packet_io/active.h"
+#include "stream/stream.h"
 
 THREAD_LOCAL ProfileStats decodePerfStats;
 
@@ -347,11 +347,11 @@ static inline uint8_t GetTTL(const Packet* const p, bool forward)
 
     // outermost ip is considered to be outer here,
     // even if it is the only ip layer ...
-    ttl = stream.get_session_ttl(p->flow, dir, outer);
+    ttl = Stream::get_flow_ttl(p->flow, dir, outer);
 
     // if we don't get outer, we use inner
     if ( 0 == ttl && outer )
-        ttl = stream.get_session_ttl(p->flow, dir, false);
+        ttl = Stream::get_flow_ttl(p->flow, dir, false);
 
     return ttl;
 }
index 0f783ad75d3a4c10c921f7337c7b420b0eaf6b12..ba5f16f7215e397d38f9f2720dfc66a2aae6aa09 100644 (file)
@@ -23,7 +23,6 @@
 #define DCE_SMB_PAF_H
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 
 #define DCE2_SMB_PAF_SHIFT(x64, x8) { x64 <<= 8; x64 |= (uint64_t)x8; }
index 8a10bfe4cb7a15e592619d1b74042fc5321b7a39..9f6c775afbae241893004dc49c3a06af3403d802 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "dce_common.h"
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 
 #define DCE2_DEBUG__PAF_START_MSG_TCP  "DCE/RPC over TCP PAF ====================================="
index 012ca885c3c6413e0c286445a532205d5378a127..6ef0533c1dcd5d2145d8debc5614bdd421b89b6b 100644 (file)
@@ -25,7 +25,6 @@
 // Protocol aware flushing for DNP3.
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 
 enum dnp3_paf_state
index 3b5ad91a62834e178d8a9d7ea03018cc9fef52b7..734eb396d9ac7083e40d944d267299f74b49bb03 100644 (file)
@@ -37,9 +37,9 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
+#include "stream/stream.h"
 #include "utils/sfsnprintfappend.h"
 
 #include "dns_module.h"
@@ -1034,7 +1034,7 @@ static void snort_dns(Packet* p)
             return;
         }
 
-        if ( !stream.is_stream_sequenced(p->flow, SSN_DIR_FROM_CLIENT) )
+        if ( !Stream::is_stream_sequenced(p->flow, SSN_DIR_FROM_CLIENT) )
         {
             return;
         }
index e9869a3521b4537aabe465dc0e2ef848392fb625..0eae5dcf6c7d96c980a4c18df2ebe4dbab369d94 100644 (file)
@@ -23,7 +23,6 @@
 #define DNS_H
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 
 // Implementation header with definitions, datatypes and flowdata class for
 // DNS service inspector.
index e781d8c266dd35617269dd997b1bfa2f6e22a196..f6483565e5d522fa6ac85e0c10a9e1456062a3e6 100644 (file)
@@ -84,7 +84,7 @@ static int SnortFTP(
         // FIXIT-L breaks target-based non-standard ports
         //if ( !ScPafEnabled() )
         /* Force flush of client side of stream  */
-        stream.flush_response(p);
+        Stream::flush_response(p);
     }
     else
     {
index 1eb04fe410899542a3c03573f7f6ceda00be8213..024a9717abb97a00b9e021da4dbd92f6caf416b7 100644 (file)
@@ -100,7 +100,7 @@ static int SnortFTPData(Packet* p)
         /* FTP-Data session is in limbo, we need to lookup the control session
          * to figure out what to do. */
 
-        FtpFlowData* fd = (FtpFlowData*)stream.get_flow_data(
+        FtpFlowData* fd = (FtpFlowData*)Stream::get_flow_data(
             &data_ssn->ftp_key, FtpFlowData::flow_id);
 
         FTP_SESSION* ftp_ssn = fd ? &fd->session : NULL;
@@ -167,7 +167,7 @@ FtpDataFlowData::FtpDataFlowData(Packet* p) : FlowData(flow_id)
     memset(&session, 0, sizeof(session));
 
     session.ft_ssn.proto = FTPP_SI_PROTO_FTP_DATA;
-    stream.populate_session_key(p, &session.ftp_key);
+    Stream::populate_flow_key(p, &session.ftp_key);
 }
 
 FtpDataFlowData::~FtpDataFlowData()
@@ -186,7 +186,7 @@ void FtpDataFlowData::handle_eof(Packet* p)
     initFilePosition(&data_ssn->position, get_file_processed_size(p->flow));
     finalFilePosition(&data_ssn->position);
 
-    stream.flush_request(p);
+    Stream::flush_request(p);
 
     if (!(data_ssn->packet_flags & FTPDATA_FLG_STOP))
     {
index 9080c3eb3fe6a0118d546c4119d1d4a8bddbf6dc..7c27934db60acfbd5bb3d23ee6c53526baf8701f 100644 (file)
@@ -48,6 +48,7 @@
 #include "ftpp_return_codes.h"
 
 #include "sfip/sf_ip.h"
+#include "stream/stream.h"
 #include "utils/util.h"
 
 unsigned FtpFlowData::flow_id = 0;
@@ -340,7 +341,7 @@ void FTPFreesession(FTP_SESSION* ssn)
 bool FTPDataDirection(Packet* p, FTP_DATA_SESSION* ftpdata)
 {
     uint32_t direction;
-    uint32_t pktdir = stream.get_packet_direction(p);
+    uint32_t pktdir = Stream::get_packet_direction(p);
 
     if (ftpdata->mode == FTPP_XFER_ACTIVE)
         direction = ftpdata->direction ?  PKT_FROM_SERVER : PKT_FROM_CLIENT;
@@ -493,7 +494,7 @@ int SetSiInput(FTPP_SI_INPUT* SiInput, Packet* p)
     /*
      * We now set the packet direction
      */
-    if (p->flow && stream.is_midstream(p->flow))
+    if (p->flow && Stream::is_midstream(p->flow))
     {
         SiInput->pdir = FTPP_SI_NO_MODE;
     }
index b0b36639f85abaf7d548a4d7f738a5a332f249d4..c3c0d691a3a0b944f0c90644d22b5342349454c1 100644 (file)
@@ -43,8 +43,8 @@
 #include "ftp_server.h"
 #include "protocols/packet.h"
 #include "file_api/file_api.h"
-#include "stream/stream_api.h"
 #include "flow/flow.h"
+#include "stream/stream.h"
 
 /*
  * These are the defines for the different types of
index 988e1e2dc2997372a1f20881d633bfd818ff2ab6..33194a8b25cafbfb1f93c505e0a09d37a2da36a8 100644 (file)
@@ -1068,7 +1068,7 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                                 ftpdata->data_chan = session->server_conf->data_chan;
 
                                 /* Call into Streams to mark data channel as ftp-data */
-                                result = stream.set_application_protocol_id_expected(
+                                result = Stream::set_application_protocol_id_expected(
                                     &session->clientIP, session->clientPort,
                                     &session->serverIP, session->serverPort,
                                     p->type(), ftp_data_app_id, fd);
@@ -1080,7 +1080,7 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                             {
                                 /* Call into Streams to mark data channel as something
                                  * to ignore. */
-                                stream.ignore_session(
+                                Stream::ignore_flow(
                                     &session->clientIP, session->clientPort,
                                     &session->serverIP, session->serverPort,
                                     p->type(), SSN_DIR_BOTH,
@@ -1140,7 +1140,7 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                             ftpdata->data_chan = session->server_conf->data_chan;
 
                             /* Call into Streams to mark data channel as ftp-data */
-                            result = stream.set_application_protocol_id_expected(
+                            result = Stream::set_application_protocol_id_expected(
                                 &session->clientIP, session->clientPort,
                                 &session->serverIP, session->serverPort,
                                 p->type(), ftp_data_app_id, fd);
@@ -1152,7 +1152,7 @@ static int do_stateful_checks(FTP_SESSION* session, Packet* p,
                         {
                             /* Call into Streams to mark data channel as something
                              * to ignore. */
-                            stream.ignore_session(
+                            Stream::ignore_flow(
                                 &session->clientIP, session->clientPort,
                                 &session->serverIP, session->serverPort,
                                 p->type(), SSN_DIR_BOTH,
@@ -1381,7 +1381,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                     if (!ftpssn->server_conf->check_encrypted_data)
                     {
                         /* Mark this session & packet as one to ignore */
-                        stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                        Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                     }
                     DebugMessage(DEBUG_FTPTELNET,
                         "FTP client stream is now encrypted\n");
@@ -1460,7 +1460,7 @@ int check_ftp(FTP_SESSION* ftpssn, Packet* p, int iMode)
                     if (!ftpssn->server_conf->check_encrypted_data)
                     {
                         /* Mark this session & packet as one to ignore */
-                        stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                        Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                     }
                     DebugMessage(DEBUG_FTPTELNET,
                         "FTP server stream is now encrypted\n");
index 9148190fe80dbf48e039c753952a880a425735a3..fa7aec791fd24f9704fc3da6cf3bea37783a2b35 100644 (file)
@@ -127,7 +127,7 @@ int normalize_telnet(
         else
         {
             /* Okay, it wasn't an IAC also its a midstream pickup */
-            if (*read_ptr > 0x7F && stream.is_midstream(p->flow))
+            if (*read_ptr > 0x7F && Stream::is_midstream(p->flow))
             {
                 consec_8bit_chars++;
                 if (consec_8bit_chars > CONSECUTIVE_8BIT_THRESHOLD)
@@ -145,7 +145,7 @@ int normalize_telnet(
                         if (!tnssn->telnet_conf->check_encrypted_data)
                         {
                             /* Mark this session & packet as one to ignore */
-                            stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                            Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                             /* No point to do further normalization */
                             return FTPP_ALERT;
                         }
@@ -342,7 +342,7 @@ int normalize_telnet(
                         if (!tnssn->telnet_conf->check_encrypted_data)
                         {
                             /* Mark this session & packet as one to ignore */
-                            stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                            Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                             /* No point to do further normalization */
                             return FTPP_ALERT;
                         }
index 2a48d58ac66996cd696cba216eef3e6e03872671..86546db08e1c5884a65349ada91bc2412a64c27d 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdio.h>
 #include <zlib.h>
 
-#include "stream/stream_api.h"
+#include "flow/flow.h"
 #include "mime/file_mime_process.h"
 #include "utils/util_utf.h"
 
index 1c6d7c933d918df5640fad3e19d5883f6e5b5c55..0112179f4d9a1bf98d1aa7b7dd28b8e7aa46bf54 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdio.h>
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 
 #include "http_enum.h"
 #include "http_msg_request.h"
index bc42421a5c31c6dead175b8d4d4affbd007e712d..02c5e610e75d5c82b3a3b3b3fdc224a29af2cca6 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef HTTP_MSG_SECTION_H
 #define HTTP_MSG_SECTION_H
 
-#include "stream/stream_api.h"
 #include "detection/detection_util.h"
 
 #include "http_field.h"
index 8d88c6e363305e9651a6f75e060aefa4f14cd5ba..4085a3fe5d292db031e1c672aa6fbbe46ea4b48d 100644 (file)
@@ -34,7 +34,6 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "file_api/file_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
@@ -44,6 +43,7 @@
 #include "utils/util.h"
 #include "protocols/ssl.h"
 #include "mime/file_mime_process.h"
+#include "stream/stream.h"
 
 #include "imap_paf.h"
 #include "imap_module.h"
@@ -298,7 +298,7 @@ static int IMAP_Setup(Packet* p, IMAPData* ssn)
         (p->packet_flags & PKT_REBUILT_STREAM))
     {
         int missing_in_rebuilt =
-            stream.missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
+            Stream::missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
 
         if (ssn->session_flags & IMAP_FLAG_NEXT_STATE_UNKNOWN)
         {
@@ -645,7 +645,7 @@ static void snort_imap(IMAP_PROTO_CONF* config, Packet* p)
                 imap_ssn->state = STATE_TLS_DATA;
             }
             else if (!(p->flow->get_session_flags() & SSNFLAG_MIDSTREAM)
-                && !stream.missed_packets(p->flow, SSN_DIR_BOTH))
+                && !Stream::missed_packets(p->flow, SSN_DIR_BOTH))
             {
                 /* revert back to command state - assume server didn't accept STARTTLS */
                 imap_ssn->state = STATE_UNKNOWN;
index f4e08314d7d6c93ac68d82683a84df1152b38cea..0fddd3bead89e77808936b3404e880869a9d0499 100644 (file)
@@ -25,7 +25,7 @@
 // IMAP service inspector.
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "imap_config.h"
 
 // Direction packet is coming from, if we can figure it out
index d5b21b0f94a7932c82164b26a09ffd6e502bc7b6..69cfa76790516d74a1095e6b634bf11590c95238 100644 (file)
@@ -31,7 +31,7 @@ static inline ImapPafData* get_state(Flow* flow, bool c2s)
     if ( !flow )
         return nullptr;
 
-    ImapSplitter* s = (ImapSplitter*)stream.get_splitter(flow, c2s);
+    ImapSplitter* s = (ImapSplitter*)Stream::get_splitter(flow, c2s);
     return s ? &s->state : nullptr;
 }
 
index 88bffd2ab3f4fbdbda6fcb2ac6dc0025ba57be54..6f34e73bd62ad249ef545deb0a4d93f6dfc658bb 100644 (file)
@@ -25,7 +25,6 @@
 // Protocol aware flushing for IMAP
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "mime/file_mime_paf.h"
 
index c04d89607f7b4361d225daf475541ec8b4618093..444d58ad98d4be337eb60bd9c523fe0e2b8bcd63 100644 (file)
@@ -24,7 +24,6 @@
 #include "modbus.h"
 #include "modbus_module.h"
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 #include "events/event_queue.h"
 
 // FIXIT-L convert this stuff to a table and make configurable
index bf5fbda39d21b2e28808475df884afaa36721de9..78db7a5dfb163092b0951e8ed6d86953e0173e12 100644 (file)
@@ -34,7 +34,6 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
 #include "target_based/snort_protocols.h"
@@ -255,7 +254,7 @@ static int POP_Setup(Packet* p, POPData* ssn)
         (p->packet_flags & PKT_REBUILT_STREAM))
     {
         int missing_in_rebuilt =
-            stream.missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
+            Stream::missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
 
         if (ssn->session_flags & POP_FLAG_NEXT_STATE_UNKNOWN)
         {
@@ -583,7 +582,7 @@ static void snort_pop(POP_PROTO_CONF* config, Packet* p)
                 pop_ssn->state = STATE_TLS_DATA;
             }
             else if (!(p->flow->get_session_flags() & SSNFLAG_MIDSTREAM)
-                && !stream.missed_packets(p->flow, SSN_DIR_BOTH))
+                && !Stream::missed_packets(p->flow, SSN_DIR_BOTH))
             {
                 /* revert back to command state - assume server didn't accept STARTTLS */
                 pop_ssn->state = STATE_UNKNOWN;
index 602a84d621ff5800929a144a0e58162abb9f55d1..ee91f18fad37d50223b67edc7ed789ee06192961 100644 (file)
@@ -25,7 +25,7 @@
 // POP service inspector.
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "pop_config.h"
 
 // Direction packet is coming from, if we can figure it out
index 2211c3d4776576cae91a4634c8188994a4097b45..650f35e3bb96fd5898ae971c2b250942d269140d 100644 (file)
@@ -32,7 +32,7 @@ static inline PopPafData* get_state(Flow* flow, bool c2s)
     if ( !flow )
         return nullptr;
 
-    PopSplitter* s = (PopSplitter*)stream.get_splitter(flow, c2s);
+    PopSplitter* s = (PopSplitter*)Stream::get_splitter(flow, c2s);
     return s ? &s->state : nullptr;
 }
 
index f7cc3f76d6cb8f4acb6194f8183264abadb69351..b611e6d24b073dd6d086d42b3a8086f59159fa06 100644 (file)
@@ -25,7 +25,6 @@
 // Protocol aware flushing for POP.
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "mime/file_mime_paf.h"
 
index fdca04384c3783de2d96092e7aeb4ba5d6aca938..110c7daf7c48e6bc9cc651a6b8ca073fdbd580e3 100644 (file)
 #include "profiler/profiler.h"
 #include "utils/util.h"
 #include "detection/detection_util.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "target_based/snort_protocols.h"
 #include "protocols/tcp.h"
 #include "protocols/packet.h"
 #include "framework/data_bus.h"
 #include "framework/inspector.h"
+#include "stream/stream.h"
 #include "utils/safec.h"
 
 #include "rpc_module.h"
@@ -993,7 +993,7 @@ void RpcDecode::eval(Packet* p)
 
     ++rdstats.total_packets;
 
-    if ( !rsdata && p->flow && !stream.is_midstream(p->flow) )
+    if ( !rsdata && p->flow && !Stream::is_midstream(p->flow) )
         rsdata = RpcSsnDataNew(p);
 
     if ( RpcSsnIsActive(rsdata) and (p->packet_flags & PKT_REBUILT_STREAM) )
index d8e5abec6f8919ebe47ac5932d6b2c8cffb3e737..f181b6c9003e86c5730eeb53fc938b82e7fc6e6a 100644 (file)
@@ -32,7 +32,6 @@
 #include "main/snort_debug.h"
 #include "main/snort_config.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "file_api/file_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
index 881ca9c9babac50585c58b90a687dbf11ad8659d..91374e3a5f3617656de6199aae7feedd8a829629 100644 (file)
@@ -22,7 +22,6 @@
 // Implementation header with definitions, datatypes and flowdata class for SIP service inspector.
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 #include "sip_config.h"
 #include "sip_dialog.h"
 #include "sip_parser.h"
index 07022c9419dabd898ece79f02ac1ae47a0e406e3..63c82be625b7b3e9f6fcab178b79a261546167eb 100644 (file)
 
 #include <assert.h>
 
+#include "framework/data_bus.h"
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "main/snort_config.h"
+#include "stream/stream.h"
 #include "sfip/sf_ip.h"
-#include "stream/stream_api.h"
-#include "framework/data_bus.h"
 
 #include "sip_module.h"
 #include "sip.h"
@@ -408,7 +408,7 @@ static int SIP_ignoreChannels(SIP_DialogData* dialog, Packet* p, SIP_PROTO_CONF*
             sfip_to_str(&mdataB->maddress), mdataB->mport);
 
         /* Call into Streams to mark data channel as something to ignore. */
-        FlowData* fd = stream.get_flow_data(
+        FlowData* fd = Stream::get_flow_data(
             PktType::UDP, IpProtocol::UDP, &mdataA->maddress,mdataA->mport,
             &mdataB->maddress, mdataB->mport, 0, 0, p->pkth->address_space_id,
             SipFlowData::flow_id);
@@ -418,7 +418,7 @@ static int SIP_ignoreChannels(SIP_DialogData* dialog, Packet* p, SIP_PROTO_CONF*
         }
         else
         {
-            stream.ignore_session(&mdataA->maddress, mdataA->mport, &mdataB->maddress,
+            Stream::ignore_flow(&mdataA->maddress, mdataA->mport, &mdataB->maddress,
                 mdataB->mport, p->type(), SSN_DIR_BOTH, SipFlowData::flow_id);
         }
         sip_stats.ignoreChannels++;
@@ -694,7 +694,7 @@ static void sip_update_appid(const Packet* p, const SIPMsg* sipMsg, const SIP_Di
 
     sipEventData.packet = p;
 
-    if (stream.service_event_publish(PP_SIP, p->flow, SIP_EVENT_TYPE_SIP_DIALOG, &sipEventData)
+    if (Stream::service_event_publish(PP_SIP, p->flow, SIP_EVENT_TYPE_SIP_DIALOG, &sipEventData)
      == false)
      ErrorMessage("failed to publish to SIP_DIALOG\n");
 }
index 25cc4955469a8bb72e2043af60210d4301aa4fb4..f0d132480693cc500482764c84fec1c21a34f829 100644 (file)
@@ -29,7 +29,6 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "file_api/file_api.h"
 #include "mime/file_mime_process.h"
 #include "parser/parser.h"
@@ -221,7 +220,7 @@ static SMTPData* SetNewSMTPData(SMTP_PROTO_CONF* config, Packet* p)
     smtp_ssn->mime_ssn->config = config;
     smtp_ssn->mime_ssn->set_mime_stats(&(smtpstats.mime_stats));
 
-    if(stream.is_midstream(p->flow))
+    if(Stream::is_midstream(p->flow))
     {
         DebugMessage(DEBUG_SMTP, "Got midstream packet - "
             "setting state to unknown\n");
@@ -546,7 +545,7 @@ static int SMTP_Setup(Packet* p, SMTPData* ssn)
         (p->packet_flags & PKT_REBUILT_STREAM))
     {
         int missing_in_rebuilt =
-            stream.missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
+            Stream::missing_in_reassembled(p->flow, SSN_DIR_FROM_CLIENT);
 
         if (ssn->session_flags & SMTP_FLAG_NEXT_STATE_UNKNOWN)
         {
@@ -1095,7 +1094,7 @@ static void SMTP_ProcessServerPacket(SMTP_PROTO_CONF* config, Packet* p, SMTPDat
             smtp_ssn->state = STATE_TLS_DATA;
         }
         else if (!(p->flow->get_session_flags() & SSNFLAG_MIDSTREAM)
-            && !stream.missed_packets(p->flow, SSN_DIR_BOTH))
+            && !Stream::missed_packets(p->flow, SSN_DIR_BOTH))
         {
             /* Check to see if the raw packet is in order */
             if (p->packet_flags & PKT_STREAM_ORDER_OK)
@@ -1285,7 +1284,7 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
             /* if we're ignoring tls data, set a zero length alt buffer */
             if (config->ignore_tls_data)
             {
-                stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                 return;
             }
         }
@@ -1390,10 +1389,10 @@ static int SMTP_GetEmailHdrs(Flow* flow, uint8_t** buf, uint32_t* len, uint32_t*
 
 static void SMTP_RegXtraDataFuncs(SMTP_PROTO_CONF* config)
 {
-    config->xtra_filename_id = stream.reg_xtra_data_cb(SMTP_GetFilename);
-    config->xtra_mfrom_id = stream.reg_xtra_data_cb(SMTP_GetMailFrom);
-    config->xtra_rcptto_id = stream.reg_xtra_data_cb(SMTP_GetRcptTo);
-    config->xtra_ehdrs_id = stream.reg_xtra_data_cb(SMTP_GetEmailHdrs);
+    config->xtra_filename_id = Stream::reg_xtra_data_cb(SMTP_GetFilename);
+    config->xtra_mfrom_id = Stream::reg_xtra_data_cb(SMTP_GetMailFrom);
+    config->xtra_rcptto_id = Stream::reg_xtra_data_cb(SMTP_GetRcptTo);
+    config->xtra_ehdrs_id = Stream::reg_xtra_data_cb(SMTP_GetEmailHdrs);
 }
 
 int SmtpMime::handle_header_line(const uint8_t* ptr, const uint8_t* eol,
index 46275851b2a37dd03652edac3972dec3443b6522..5cb6c0cf132afcb316db6df65105d2f607107c18 100644 (file)
@@ -24,9 +24,9 @@
 // Implementation header with definitions, datatypes and flowdata class for
 // SMTP service inspector.
 
-#include "protocols/packet.h"
-#include "stream/stream_api.h"
 #include "main/thread.h"
+#include "protocols/packet.h"
+#include "stream/stream.h"
 #include "smtp_config.h"
 
 // Direction packet is coming from, if we can figure it out
index 7d1902b61cb995bbefa57702c05608858976fedf..729c9afaf3f4f0fa2821f16beae28a84831313c1 100644 (file)
@@ -66,7 +66,7 @@ static inline SmtpPafData* get_state(Flow* flow, bool c2s)
     if ( !flow )
         return nullptr;
 
-    SmtpSplitter* s = (SmtpSplitter*)stream.get_splitter(flow, c2s);
+    SmtpSplitter* s = (SmtpSplitter*)Stream::get_splitter(flow, c2s);
     return s ? &s->state : nullptr;
 }
 
index 5ec6dc58f1451e65e0a0238e066288fcf79d95b9..53aad5abda3e377b9b5753ec9c9b185d11b77b97 100644 (file)
@@ -24,7 +24,6 @@
 // Protocol aware flushing for SMTP
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 #include "mime/file_mime_paf.h"
 
index 15d181798b02e00ff88c31ee4c73bb82eb89ad8e..9bb4536c7b6b28182a0c10c51974c7e7c2fc79a7 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "smtp.h"
 #include "smtp_config.h"
-#include "stream/stream_api.h"
 #include "detection/detection_util.h"
 #include "utils/safec.h"
 
@@ -129,22 +128,22 @@ void SMTP_LogFuncs(SMTP_PROTO_CONF* config, Packet* p, MimeSession* mime_ssn)
 
     if (log->is_file_name_present())
     {
-        stream.set_extra_data(p->flow, p, config->xtra_filename_id);
+        Stream::set_extra_data(p->flow, p, config->xtra_filename_id);
     }
 
     if (log->is_email_from_present())
     {
-        stream.set_extra_data(p->flow, p, config->xtra_mfrom_id);
+        Stream::set_extra_data(p->flow, p, config->xtra_mfrom_id);
     }
 
     if (log->is_email_to_present())
     {
-        stream.set_extra_data(p->flow, p, config->xtra_rcptto_id);
+        Stream::set_extra_data(p->flow, p, config->xtra_rcptto_id);
     }
 
     if (log->is_email_hdrs_present())
     {
-        stream.set_extra_data(p->flow, p, config->xtra_ehdrs_id);
+        Stream::set_extra_data(p->flow, p, config->xtra_ehdrs_id);
     }
 }
 
index 2a7988ff993d7c066ce82b6b3c295bbcc0e3f480..2bd8fdfe7102cf8724aa2079e750fb25f09abf89 100644 (file)
 #include <sys/types.h>
 
 #include "events/event_queue.h"
+#include "file_api/file_api.h"
+#include "framework/inspector.h"
 #include "log/messages.h"
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
-#include "profiler/profiler.h"
-#include "stream/stream_api.h"
-#include "file_api/file_api.h"
 #include "parser/parser.h"
-#include "framework/inspector.h"
+#include "profiler/profiler.h"
 #include "utils/sfsnprintfappend.h"
 #include "target_based/snort_protocols.h"
 
@@ -173,7 +172,7 @@ static void snort_ssh(SSH_PROTO_CONF* config, Packet* p)
     // means we've already missed packets) set missed packets flag and make
     // sure we don't do any more reassembly on this session
     if ((p->flow->get_session_flags() & SSNFLAG_MIDSTREAM)
-        || stream.missed_packets(p->flow, SSN_DIR_BOTH))
+        || Stream::missed_packets(p->flow, SSN_DIR_BOTH))
     {
         // Order only matters if the packets are not encrypted
         if ( !(sessp->state_flags & SSH_FLG_SESS_ENCRYPTED ))
@@ -270,7 +269,7 @@ static void snort_ssh(SSH_PROTO_CONF* config, Packet* p)
                     else
                         SnortEventqAdd(GID_SSH, SSH_EVENT_RESPOVERFLOW);
 
-                    stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+                    Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
                 }
             }
 
@@ -290,7 +289,7 @@ static void snort_ssh(SSH_PROTO_CONF* config, Packet* p)
             // and therefore cannot be used late in an
             // encrypted session. For performance purposes,
             // stop examining this session.
-            stream.stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
+            Stream::stop_inspection(p->flow, p, SSN_DIR_BOTH, -1, 0);
         }
     }
 }
index 464e763e53bff868e31a38d36e7ea11fc8e28543..c6e41433aafa1e226d12d8f720f211d3800c1646 100644 (file)
@@ -31,7 +31,7 @@
 // packets appear malformed/spoofed.
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
+#include "stream/stream.h"
 #include "ssh_config.h"
 
 // Per-session data block containing current state
index d921c7ea69f785cba9203d02d9202a1aaf31286a..61bfa0063c51abef44c22c5607f87d78da4f21ae 100644 (file)
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "profiler/profiler.h"
-#include "stream/stream_api.h"
 #include "parser/parser.h"
 #include "framework/inspector.h"
 #include "utils/sfsnprintfappend.h"
 #include "target_based/snort_protocols.h"
 #include "detection/detect.h"
 #include "protocols/ssl.h"
+#include "stream/stream.h"
 
 #include "ssl_module.h"
 
@@ -163,7 +163,7 @@ static inline bool SSLPP_is_encrypted(SSL_PROTO_CONF* config, uint32_t ssl_flags
         /* Check if we're either midstream or if packets were missed after the
          *          * connection was established */
         else if ((packet->flow->get_session_flags() & SSNFLAG_MIDSTREAM) ||
-            (stream.missed_packets(packet->flow, SSN_DIR_BOTH)))
+            (Stream::missed_packets(packet->flow, SSN_DIR_BOTH)))
         {
             if ((ssl_flags & (SSL_CAPP_FLAG | SSL_SAPP_FLAG)) == (SSL_CAPP_FLAG | SSL_SAPP_FLAG))
             {
@@ -236,7 +236,7 @@ static inline uint32_t SSLPP_process_app(SSL_PROTO_CONF* config, uint32_t ssn_fl
         if (!config->max_heartbeat_len)
         {
             DebugMessage(DEBUG_SSL, "STOPPING INSPECTION (process_app)\n");
-            stream.stop_inspection(packet->flow, packet, SSN_DIR_BOTH, -1, 0);
+            Stream::stop_inspection(packet->flow, packet, SSN_DIR_BOTH, -1, 0);
             sslstats.stopped++;
         }
         else if (!(new_flags & SSL_HEARTBEAT_SEEN))
@@ -264,7 +264,7 @@ static inline void SSLPP_process_other(SSL_PROTO_CONF* config, SSLData* sd, uint
         if (!config->max_heartbeat_len)
         {
             DebugMessage(DEBUG_SSL, "STOPPING INSPECTION (process_other)\n");
-            stream.stop_inspection(packet->flow, packet, SSN_DIR_BOTH, -1, 0);
+            Stream::stop_inspection(packet->flow, packet, SSN_DIR_BOTH, -1, 0);
         }
         else if (!(new_flags & SSL_HEARTBEAT_SEEN))
         {
@@ -374,7 +374,7 @@ static void snort_ssl(SSL_PROTO_CONF* config, Packet* p)
     {
         if ( (SSL_IS_SHELLO(new_flags) && !SSL_IS_CHELLO(sd->ssn_flags) ))
         {
-            if (!(stream.missed_packets(p->flow, SSN_DIR_FROM_CLIENT)))
+            if (!(Stream::missed_packets(p->flow, SSN_DIR_FROM_CLIENT)))
                 SnortEventqAdd(GID_SSL, SSL_INVALID_SERVER_HELLO);
         }
     }
index 95b6af4f2d5d7b644d5448abc20750c737dfe0a3..eabbe4bb87e72407415099f94ee91319faa28a24 100644 (file)
@@ -22,7 +22,6 @@
 // Implementation header with definitions, datatypes and flowdata class for SSL service inspector.
 
 #include "protocols/packet.h"
-#include "stream/stream_api.h"
 #include "ssl_config.h"
 
 #define SSLPP_ENCRYPTED_FLAGS \
index 5e08120e2453ab6a3947856526dc40e56d401a2e..d702f362b01479690b2b1eb08d1db32d7d0f1e09 100644 (file)
@@ -10,13 +10,12 @@ add_subdirectory(file)
 
 set (STREAM_INCLUDES
     paf.h
-    stream_api.h
+    stream.h
     stream_splitter.h
 )
 
 add_library( stream STATIC
-    stream.h
-    stream_api.cc
+    stream.cc
     stream_inspectors.cc
     stream_inspectors.h
     stream_splitter.cc
index 72bda49cc51082fe744a3237a666455996c2feb6..684abd27199b16a0361e8f41b3ee554b811382f0 100644 (file)
@@ -7,12 +7,11 @@ x_includedir = $(pkgincludedir)/stream
 
 x_include_HEADERS = \
 paf.h \
-stream_api.h \
+stream.h \
 stream_splitter.h
 
 libstream_a_SOURCES = \
-stream.h \
-stream_api.cc \
+stream.cc \
 stream_inspectors.cc \
 stream_inspectors.h \
 stream_splitter.cc
index fe63d3a00bf78e62c82bcc686c0c7d37ed991cf2..a4e9b4f47724b96d34da84dd2bf52b466d725ae4 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "stream/stream.h"
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <assert.h>
 
-#include "stream_module.h"
-#include "stream_ha.h"
-#include "main/snort_debug.h"
-#include "managers/inspector_manager.h"
 #include "flow/flow_control.h"
 #include "flow/prune_stats.h"
-#include "stream/stream_api.h"
+#include "main/snort_debug.h"
+#include "managers/inspector_manager.h"
 #include "profiler/profiler.h"
+
 #include "stream/tcp/tcp_session.h"
+#include "stream_module.h"
+#include "stream_ha.h"
 
 //-------------------------------------------------------------------------
 // stats
@@ -203,13 +201,6 @@ void StreamBase::tinit()
 
 void StreamBase::tterm()
 {
-    flow_con->purge_flows(PktType::IP);
-    flow_con->purge_flows(PktType::ICMP);
-    flow_con->purge_flows(PktType::TCP);
-    flow_con->purge_flows(PktType::UDP);
-    flow_con->purge_flows(PktType::PDU);
-    flow_con->purge_flows(PktType::FILE);
-
     StreamHAManager::tterm();
 }
 
index 1f681ed99061ca1943c353185afa104f1450540b..22fc140f5278e7b8a85d091f8b3ccf2dfaef3124 100644 (file)
@@ -25,8 +25,8 @@
 #include "binder/binder.h"
 #include "main/snort_debug.h"
 #include "managers/inspector_manager.h"
+#include "stream/stream.h"
 #include "sfip/sf_ip.h"
-#include "stream/stream_api.h"
 
 // HA Session flags helper macros
 #define HA_IGNORED_SESSION_FLAGS \
index 8237ffaca1462493b1f932610e2921792ddc7e33..295380b499bd0bf3803f567bbfa3b45de6473d1a 100644 (file)
@@ -20,8 +20,6 @@
 
 #include "stream_module.h"
 
-#include "stream/stream.h"
-
 #include <string>
 
 using namespace std;
index ebfb9f0aef80ebdcd9cd9a2bdcc63c62434462da..4e4d28f0f1b62ff5e25e5b785fc2dfe6940a9b1a 100644 (file)
@@ -55,6 +55,8 @@ struct BaseStats
     PROTO_FIELDS(file);
 };
 
+extern const PegInfo base_pegs[];
+
 extern THREAD_LOCAL BaseStats stream_base_stats;
 
 struct StreamModuleConfig
index 99509ef6f4263b035885f7fb5b39907829a1eef8..f55b240614559ce95762f6bd35415b5859c164a4 100644 (file)
@@ -24,7 +24,6 @@ using namespace std;
 
 #include "stream_file.h"
 #include "main/snort_config.h"
-#include "stream/stream.h"
 
 //-------------------------------------------------------------------------
 // stream_file module
index 39014a897f34017ef6869c06fc96b3208efdc2e0..81e9f4f5dc239384872127650c6329c08a4331aa 100644 (file)
@@ -23,7 +23,6 @@
 #include "main/snort_types.h"
 #include "main/thread.h"
 #include "framework/module.h"
-#include "stream/stream.h"
 
 struct SnortConfig;
 
index a8864f6d2e69ca93f716c96c879758a154d0f342..61271c06d7e3321a03ee1c3be0367ee7670032da 100644 (file)
 
 Flow* IcmpHA::create_session(FlowKey* key)
 {
-    DebugMessage(DEBUG_HA,"IcmpHA::create_session\n");
-
-    assert ( key );
-
-    Flow* flow = flow_con->new_flow(key);
+    assert(key);
+    Flow* flow = Stream::new_flow(key);
 
     if ( (flow != nullptr ) && (flow->session == nullptr) )
     {
index 712d2f5369a00c42238acaf82de60e42eca7d9e2..eb664c0e65648f48bc4983c12aa76cb1b7ae9e6a 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "main/snort_types.h"
 #include "main/thread.h"
+#include "flow/session.h"
 #include "framework/module.h"
-#include "stream/stream.h"
 
 extern const PegInfo icmp_pegs[];
 extern THREAD_LOCAL struct IcmpStats icmpStats;
index f397f022b4253ec1ce4bb68e2a049a5e076aadaa..718eb3d32e9e3ad23bb5c46fb4e7ddf90bece58c 100644 (file)
@@ -158,15 +158,15 @@ static int ProcessIcmpUnreach(Packet* p)
     {
     case PktType::TCP:
         /* Lookup a TCP session */
-        ssn = Stream::get_session(&skey);
+        ssn = Stream::get_flow(&skey);
         break;
     case PktType::UDP:
         /* Lookup a UDP session */
-        ssn = Stream::get_session(&skey);
+        ssn = Stream::get_flow(&skey);
         break;
     case PktType::ICMP:
         /* Lookup a ICMP session */
-        ssn = Stream::get_session(&skey);
+        ssn = Stream::get_flow(&skey);
         break;
     default:
         break;
index c88d26374b4bcfc6a22bede99bcdd6afa1b5d202..d2d3cbe3351b7a04ce154080a52b951aac5108e3 100644 (file)
 
 #include "ip_ha.h"
 
-#include "flow/flow_control.h"
 #include "main/snort_debug.h"
-#include "stream/ip/ip_session.h"
+#include "stream/stream.h"
+#include "ip_session.h"
 
 Flow* IpHA::create_session(FlowKey* key)
 {
-    DebugMessage(DEBUG_HA,"IpHA::create_session\n");
+    assert(key);
 
-    assert ( key );
-
-    Flow* flow = flow_con->new_flow(key);
+    Flow* flow = Stream::new_flow(key);
 
     if ( (flow != nullptr ) && (flow->session == nullptr) )
     {
index 14b3e720681f202c62bffd0f1af1e2a563e189fa..1aa5215f95ce5b2e18833667b9745a250009ffec 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "main/snort_types.h"
 #include "main/thread.h"
+#include "flow/session.h"
 #include "framework/module.h"
-#include "stream/stream.h"
 
 struct SnortConfig;
 
index eb3607a6d8e0e8181776ca2167431998e8ab620d..abcb85e94a2b13d9bb93add66bef48925f0ea18d 100644 (file)
@@ -28,7 +28,6 @@
 #include "ip_defrag.h"
 #include "ip_ha.h"
 #include "stream/stream.h"
-#include "flow/flow_control.h"
 #include "sfip/sf_ip.h"
 #include "profiler/profiler.h"
 
@@ -152,7 +151,7 @@ bool IpSession::setup(Packet*)
     ip_stats.current++;
 
 #ifdef ENABLE_EXPECTED_IP
-    if ( flow_con->expected_session(flow, p))
+    if ( Stream::expected_flow(flow, p) )
     {
         ip_stats.sessions--; // Incremented in SESSION_STATS_ADD
         MODULE_PROFILE_END(ip_perf_stats);
@@ -165,18 +164,18 @@ int IpSession::process(Packet* p)
 {
     Profile profile(ip_perf_stats);
 
-    if ( stream.expired_session(flow, p) )
+    if ( Stream::expired_flow(flow, p) )
     {
         IpSessionCleanup(flow, &tracker);
 
 #ifdef ENABLE_EXPECTED_IP
-        if ( flow_con->expected_session(flow, p))
+        if ( Stream::expected_flow(flow, p) )
             return 0;
 #endif
         IpHAManager::process_deletion(flow);
     }
 
-    if ( stream.blocked_session(flow, p) || stream.ignored_session(flow, p) )
+    if ( Stream::blocked_flow(flow, p) || Stream::ignored_flow(flow, p) )
         return 0;
 
     if ( p->ptrs.decode_flags & DECODE_FRAG )
index 502002b7df474248272f32e1057c6cefc8e11dfb..80ed54548be7d0b8ee1faa81815f711afe78a7fa 100644 (file)
@@ -25,7 +25,7 @@
 #include "flow/flow.h"
 
 /* engine-based defragmentation policy enums */
-// must update stream_api.h::IP_POLICIES if this changes
+// must update stream.h::IP_POLICIES if this changes
 enum
 {
     FRAG_POLICY_FIRST = 1,
index ac0348f0ff75a3e3716c5509c2f1ee4375ac847c..866fdae4e90094dc4eca50f3ccea0d6791338e92 100644 (file)
 // tcp_stream_tracker.cpp author davis mcpherson <davmcphe@@cisco.com>
 // Created on: Jun 24, 2015
 
-#include "protocols/tcp_options.h"
-#include "protocols/tcp.h"
-#include "protocols/eth.h"
-#include "profiler/profiler.h"
+#include "tcp_stream_tracker.h"
 
+#include "profiler/profiler.h"
+#include "protocols/eth.h"
+#include "protocols/tcp.h"
+#include "protocols/tcp_options.h"
 #include "stream/stream.h"
-#include "tcp_stream_tracker.h"
 
 const char* tcp_state_names[] =
-{ "TCP_LISTEN", "TCP_SYN_SENT", "TCP_SYN_RECV", "TCP_ESTABLISHED","TCP_FIN_WAIT1",
-  "TCP_FIN_WAIT2", "TCP_CLOSE_WAIT", "TCP_CLOSING", "TCP_LAST_ACK",
-  "TCP_TIME_WAIT", "TCP_CLOSED", "TCP_STATE_NONE",};
-
-const char* tcp_event_names[] = { "TCP_SYN_SENT_EVENT", "TCP_SYN_RECV_EVENT",
-                                  "TCP_SYN_ACK_SENT_EVENT", "TCP_SYN_ACK_RECV_EVENT",
-                                  "TCP_ACK_SENT_EVENT",
-                                  "TCP_ACK_RECV_EVENT", "TCP_DATA_SEG_SENT_EVENT",
-                                  "TCP_DATA_SEG_RECV_EVENT",
-                                  "TCP_FIN_SENT_EVENT", "TCP_FIN_RECV_EVENT", "TCP_RST_SENT_EVENT",
-                                  "TCP_RST_RECV_EVENT" };
+{
+    "TCP_LISTEN", "TCP_SYN_SENT", "TCP_SYN_RECV",
+    "TCP_ESTABLISHED",
+    "TCP_FIN_WAIT1", "TCP_FIN_WAIT2", "TCP_CLOSE_WAIT", "TCP_CLOSING",
+    "TCP_LAST_ACK", "TCP_TIME_WAIT", "TCP_CLOSED",
+    "TCP_STATE_NONE"
+};
+
+const char* tcp_event_names[] = {
+    "TCP_SYN_SENT_EVENT", "TCP_SYN_RECV_EVENT",
+    "TCP_SYN_ACK_SENT_EVENT", "TCP_SYN_ACK_RECV_EVENT",
+    "TCP_ACK_SENT_EVENT", "TCP_ACK_RECV_EVENT",
+    "TCP_DATA_SEG_SENT_EVENT", "TCP_DATA_SEG_RECV_EVENT",
+    "TCP_FIN_SENT_EVENT", "TCP_FIN_RECV_EVENT",
+    "TCP_RST_SENT_EVENT", "TCP_RST_RECV_EVENT"
+};
 
 TcpStreamTracker::TcpStreamTracker(bool client) :
     client_tracker(client), tcp_state(client ? TCP_STATE_NONE : TCP_LISTEN)
index 93da110123b79564f1f122e0d5a6881e5eddeeef..d49911dbcbacbab999c23c2addfb9fa827253dca 100644 (file)
@@ -34,8 +34,7 @@
 
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
-#include "stream/stream.h"
-#include "stream/stream_api.h"
+#include "protocols/packet.h"
 
 //--------------------------------------------------------------------
 // private state
index 4192f544e4162d18836284808c101bc4b5be77cd..799638bd9cbdca87020c972ddde289d0f719d0c8 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdint.h>
 
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
 #include "stream/stream_splitter.h"
 
 struct SnortConfig;
similarity index 86%
rename from src/stream/stream_api.cc
rename to src/stream/stream.cc
index a424760ca62892f740081e32e8ef75702758a57a..94b029c282ba26d58eca69e105e8836a7ce2eb45 100644 (file)
@@ -17,7 +17,7 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#include "stream_api.h"
+#include "stream.h"
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -34,6 +34,7 @@
 #include "flow/flow_control.h"
 #include "flow/flow_cache.h"
 #include "flow/ha.h"
+#include "flow/prune_stats.h"
 #include "flow/session.h"
 #include "stream/stream.h"
 #include "stream/paf.h"
 #include "stream/libtcp/stream_tcp_unit_test.h"
 #endif
 
-Stream stream;  // FIXIT-L global for SnortContext
+// this should not be publicly accessible
+extern THREAD_LOCAL class FlowControl* flow_con;
 
-Stream::Stream()
+struct StreamImpl
 {
-    xtradata_func_count = 0;
-    extra_data_log = NULL;
-    extra_data_config = NULL;
-}
+public:
+    uint32_t xtradata_func_count = 0;
+    LogFunction xtradata_map[MAX_LOG_FN];
+    LogExtraData extra_data_log = nullptr;
+    void* extra_data_config = nullptr;
+};
 
-Stream::~Stream() { }
+static StreamImpl stream;
 
 //-------------------------------------------------------------------------
 // session foo
 //-------------------------------------------------------------------------
 
-Flow* Stream::get_session(const FlowKey* key)
+Flow* Stream::get_flow(const FlowKey* key)
 { return flow_con->find_flow(key); }
 
-Flow* Stream::new_session(const FlowKey* key)
+Flow* Stream::new_flow(const FlowKey* key)
 { return flow_con->new_flow(key); }
 
-void Stream::delete_session(const FlowKey* key)
+Flow* Stream::new_flow(FlowKey* key)
+{
+    return flow_con ? flow_con->new_flow(key) : nullptr;
+}
+
+void Stream::delete_flow(const FlowKey* key)
 { flow_con->delete_flow(key); }
 
 //-------------------------------------------------------------------------
 // key foo
 //-------------------------------------------------------------------------
 
-Flow* Stream::get_session_ptr(
+Flow* Stream::get_flow(
     PktType type, IpProtocol proto,
     const sfip_t* srcIP, uint16_t srcPort,
     const sfip_t* dstIP, uint16_t dstPort,
     uint16_t vlan, uint32_t mplsId, uint16_t addressSpaceId)
 {
     FlowKey key;
-
     key.init(type, proto, srcIP, srcPort, dstIP, dstPort, vlan, mplsId, addressSpaceId);
-
-    return get_session(&key);
+    return get_flow(&key);
 }
 
-void Stream::populate_session_key(Packet* p, FlowKey* key)
+void Stream::populate_flow_key(Packet* p, FlowKey* key)
 {
     if (!key || !p)
         return;
@@ -115,10 +122,10 @@ void Stream::populate_session_key(Packet* p, FlowKey* key)
         p->pkth->address_space_id);
 }
 
-FlowKey* Stream::get_session_key(Packet* p)
+FlowKey* Stream::get_flow_key(Packet* p)
 {
     FlowKey* key = (FlowKey*)snort_calloc(sizeof(*key));
-    populate_session_key(p, key);
+    populate_flow_key(p, key);
     return key;
 }
 
@@ -129,7 +136,7 @@ FlowKey* Stream::get_session_key(Packet* p)
 FlowData* Stream::get_flow_data(
     const FlowKey* key, unsigned flow_id)
 {
-    Flow* flow = get_session(key);
+    Flow* flow = get_flow(key);
     return flow->get_flow_data(flow_id);
 }
 
@@ -140,9 +147,7 @@ FlowData* Stream::get_flow_data(
     uint16_t vlan, uint32_t mplsId,
     uint16_t addressSpaceID, unsigned flow_id)
 {
-    Flow* flow;
-
-    flow = get_session_ptr(
+    Flow* flow = get_flow(
         type, proto,
         srcIP, srcPort, dstIP, dstPort,
         vlan, mplsId, addressSpaceID);
@@ -157,7 +162,7 @@ FlowData* Stream::get_flow_data(
 // session status
 //-------------------------------------------------------------------------
 
-void Stream::check_session_closed(Packet* p)
+void Stream::check_flow_closed(Packet* p)
 {
     Flow* flow = p->flow;
 
@@ -173,18 +178,15 @@ void Stream::check_session_closed(Packet* p)
     }
 }
 
-int Stream::ignore_session(
+int Stream::ignore_flow(
     const sfip_t* srcIP, uint16_t srcPort,
     const sfip_t* dstIP, uint16_t dstPort,
     PktType protocol, char direction,
     uint32_t flow_id)
 {
     assert(flow_con);
-
     FlowData* fd = new FlowData(flow_id);
-
-    return flow_con->add_expected(
-        srcIP, srcPort, dstIP, dstPort, protocol, direction, fd);
+    return flow_con->add_expected(srcIP, srcPort, dstIP, dstPort, protocol, direction, fd);
 }
 
 void Stream::proxy_started(Flow* flow, unsigned dir)
@@ -196,10 +198,10 @@ void Stream::proxy_started(Flow* flow, unsigned dir)
     tcpssn->flush();
 
     if ( dir & SSN_DIR_FROM_SERVER )
-        stream.set_splitter(flow, true, new LogSplitter(true));
+        set_splitter(flow, true, new LogSplitter(true));
 
     if ( dir & SSN_DIR_FROM_CLIENT )
-        stream.set_splitter(flow, false, new LogSplitter(false));
+        set_splitter(flow, false, new LogSplitter(false));
 
     tcpssn->start_proxy();
     flow->set_proxied();
@@ -296,7 +298,7 @@ void Stream::drop_traffic(Flow* flow, char dir)
     }
 }
 
-void Stream::drop_session(const Packet* p)
+void Stream::drop_flow(const Packet* p)
 {
     Flow* flow = p->flow;
 
@@ -306,7 +308,7 @@ void Stream::drop_session(const Packet* p)
     flow->session->clear();
     flow->set_state(Flow::FlowState::BLOCK);
 
-    if (!(p->packet_flags & PKT_STATELESS))
+    if ( !(p->packet_flags & PKT_STATELESS) )
         drop_traffic(flow, SSN_DIR_BOTH);
 }
 
@@ -325,6 +327,37 @@ void Stream::init_active_response(const Packet* p, Flow* flow)
         flow->set_expire(p, snort_conf->min_interval);
 }
 
+void Stream::purge_flows()
+{
+    if ( !flow_con )
+        return;
+
+    flow_con->purge_flows(PktType::IP);
+    flow_con->purge_flows(PktType::ICMP);
+    flow_con->purge_flows(PktType::TCP);
+    flow_con->purge_flows(PktType::UDP);
+    flow_con->purge_flows(PktType::PDU);
+    flow_con->purge_flows(PktType::FILE);
+}
+
+void Stream::timeout_flows(time_t cur_time)
+{
+    if ( flow_con )
+        // FIXIT-M batch here or loop vs looping over idle?
+        flow_con->timeout_flows(cur_time);
+}
+
+void Stream::prune_flows()
+{
+    if ( flow_con )
+        flow_con->prune_one(PruneReason::MEMCAP, false);
+}
+
+bool Stream::expected_flow(Flow* f, Packet* p)
+{
+    return flow_con->expected_flow(f, p) != SSN_DIR_NONE;
+}
+
 //-------------------------------------------------------------------------
 // app proto id foo
 //-------------------------------------------------------------------------
@@ -382,7 +415,6 @@ int16_t Stream::get_application_protocol_id(Flow* flow)
     /* Not caching the source and dest host_entry in the session so we can
      * swap the table out after processing this packet if we need
      * to.  */
-    HostAttributeEntry* host_entry = NULL;
     int16_t protocol = 0;
 
     if (!flow)
@@ -399,30 +431,23 @@ int16_t Stream::get_application_protocol_id(Flow* flow)
         set_ip_protocol(flow);
     }
 
-    host_entry = SFAT_LookupHostEntryByIP(&flow->server_ip);
-    if (host_entry)
+    if ( HostAttributeEntry* host_entry = SFAT_LookupHostEntryByIP(&flow->server_ip) )
     {
         set_application_protocol_id(flow, host_entry, FROM_SERVER);
 
         if (flow->ssn_state.application_protocol != 0)
-        {
             return flow->ssn_state.application_protocol;
-        }
     }
 
-    host_entry = SFAT_LookupHostEntryByIP(&flow->client_ip);
-    if (host_entry)
+    if ( HostAttributeEntry* host_entry = SFAT_LookupHostEntryByIP(&flow->client_ip) )
     {
         set_application_protocol_id(flow, host_entry, FROM_CLIENT);
 
         if (flow->ssn_state.application_protocol != 0)
-        {
             return flow->ssn_state.application_protocol;
-        }
     }
 
     flow->ssn_state.application_protocol = -1;
-
     return 0;
 }
 
@@ -479,52 +504,50 @@ bool Stream::is_paf_active(Flow* flow, bool to_server)
 void Stream::log_extra_data(
     Flow* flow, uint32_t mask, uint32_t id, uint32_t sec)
 {
-    if ( mask && extra_data_log )
+    if ( mask && stream.extra_data_log )
     {
-        extra_data_log(
-            flow, extra_data_config, xtradata_map,
-            xtradata_func_count, mask, id, sec);
+        stream.extra_data_log(
+            flow, stream.extra_data_config, stream.xtradata_map,
+            stream.xtradata_func_count, mask, id, sec);
     }
 }
 
 uint32_t Stream::reg_xtra_data_cb(LogFunction f)
 {
     uint32_t i = 0;
-    while (i < xtradata_func_count)
+    while (i < stream.xtradata_func_count)
     {
-        if (xtradata_map[i++] == f)
-        {
+        if (stream.xtradata_map[i++] == f)
             return i;
-        }
     }
-    if ( xtradata_func_count == MAX_LOG_FN)
+    if ( stream.xtradata_func_count == MAX_LOG_FN)
         return 0;
-    xtradata_map[xtradata_func_count++] = f;
-    return xtradata_func_count;
+
+    stream.xtradata_map[stream.xtradata_func_count++] = f;
+    return stream.xtradata_func_count;
 }
 
 uint32_t Stream::get_xtra_data_map(LogFunction** f)
 {
     if (f)
     {
-        *f = xtradata_map;
-        return xtradata_func_count;
+        *f = stream.xtradata_map;
+        return stream.xtradata_func_count;
     }
-    else
-        return 0;
+    return 0;
 }
 
 void Stream::reg_xtra_data_log(LogExtraData f, void* config)
 {
-    extra_data_log = f;
-    extra_data_config = config;
+    stream.extra_data_log = f;
+    stream.extra_data_config = config;
 }
 
 //-------------------------------------------------------------------------
 // other foo
 //-------------------------------------------------------------------------
 
-uint8_t Stream::get_session_ttl(Flow* flow, char dir, bool outer)
+uint8_t Stream::get_flow_ttl(Flow* flow, char dir, bool outer)
 {
     if ( !flow )
         return 0;
@@ -567,7 +590,7 @@ static void active_response(Packet* p, Flow* lwssn)
     }
 }
 
-bool Stream::blocked_session(Flow* flow, Packet* p)
+bool Stream::blocked_flow(Flow* flow, Packet* p)
 {
     if ( !(flow->ssn_state.session_flags & (SSNFLAG_DROP_CLIENT|SSNFLAG_DROP_SERVER)) )
         return false;
@@ -591,7 +614,7 @@ bool Stream::blocked_session(Flow* flow, Packet* p)
     return false;
 }
 
-bool Stream::ignored_session(Flow* flow, Packet* p)
+bool Stream::ignored_flow(Flow* flow, Packet* p)
 {
     if (((p->is_from_server()) &&
         (flow->ssn_state.ignore_direction & SSN_DIR_FROM_CLIENT)) ||
@@ -623,7 +646,7 @@ static int StreamExpire(Packet* p, Flow* lwssn)
     return 1;
 }
 
-bool Stream::expired_session(Flow* flow, Packet* p)
+bool Stream::expired_flow(Flow* flow, Packet* p)
 {
     if ( (flow->session_state & STREAM_STATE_TIMEDOUT)
         || StreamExpire(p, flow) )
@@ -697,7 +720,7 @@ void Stream::flush_response(Packet* p)
 }
 
 // return true if added
-bool Stream::add_session_alert(
+bool Stream::add_flow_alert(
     Flow* flow, Packet* p, uint32_t gid, uint32_t sid)
 {
     if ( !flow )
@@ -707,7 +730,7 @@ bool Stream::add_session_alert(
 }
 
 // return true if gid/sid have already been seen
-bool Stream::check_session_alerted(
+bool Stream::check_flow_alerted(
     Flow* flow, Packet* p, uint32_t gid, uint32_t sid)
 {
     if ( !flow )
@@ -716,7 +739,7 @@ bool Stream::check_session_alerted(
     return flow->session->check_alerted(p, gid, sid);
 }
 
-int Stream::update_session_alert(
+int Stream::update_flow_alert(
     Flow* flow, Packet* p,
     uint32_t gid, uint32_t sid,
     uint32_t event_id, uint32_t event_second)
@@ -766,8 +789,6 @@ bool Stream::missed_packets(Flow* flow, uint8_t dir)
 
 #ifdef UNIT_TEST
 
-#include "framework/cursor.h"
-
 TEST_CASE("Stream API", "[stream_api][stream]")
 {
     // initialization code here
@@ -822,7 +843,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(ignored);
 
         delete pkt->flow->session;
@@ -835,7 +856,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(!ignored);
         delete pkt->flow->session;
         delete pkt;
@@ -847,7 +868,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(!ignored);
 
         delete pkt->flow->session;
@@ -860,7 +881,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(ignored);
         delete pkt->flow->session;
         delete pkt;
@@ -872,7 +893,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(ignored);
 
         delete pkt->flow->session;
@@ -885,7 +906,7 @@ TEST_CASE("Stream API", "[stream_api][stream]")
         pkt->flow->session = new TcpSession(flow);
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
-        bool ignored = Stream::ignored_session(flow, pkt);
+        bool ignored = Stream::ignored_flow(flow, pkt);
         CHECK(ignored);
         delete pkt->flow->session;
         delete pkt;
index d615938d0b7eda65530e7dfc23e4a46bf65ce09d..a55085c54d5a73150ce8d4de18c0b18d322525f0 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
+// stream.h author Steven Sturges
+
 #ifndef STREAM_H
 #define STREAM_H
 
+// provides a common flow management interface
+
 #include <sys/types.h>
-#include <netinet/in.h>
 
+#include "sfip/sfip_t.h"
+#include "protocols/packet.h"
+#include "flow/flow.h"
 #include "main/snort_types.h"
-#include "stream/stream_api.h"
-#include "network_inspectors/normalize/norm.h"
-#include "flow/session.h"
-
-#define STREAM_DEFAULT_SSN_TIMEOUT  30        /* seconds to timeout a session */
-#define STREAM_MAX_SSN_TIMEOUT      3600*24   /* max timeout (approx 1 day) */
-#define STREAM_MIN_SSN_TIMEOUT      1         /* min timeout (1 second) */
-
-#define STREAM_TRACK_YES            1
-#define STREAM_TRACK_NO             0
-
-// FIXIT-L move to proto specific where possible
-#define STREAM_CONFIG_STATEFUL_INSPECTION      0x00000001
-#define STREAM_CONFIG_LOG_STREAMS              0x00000004
-#define STREAM_CONFIG_REASS_CLIENT             0x00000008
-#define STREAM_CONFIG_REASS_SERVER             0x00000010
-#define STREAM_CONFIG_ASYNC                    0x00000020
-#define STREAM_CONFIG_SHOW_PACKETS             0x00000040
-#define STREAM_CONFIG_MIDSTREAM_DROP_NOALERT   0x00000080
-#define STREAM_CONFIG_IGNORE_ANY               0x00000100
-#define STREAM_CONFIG_STATIC_FLUSHPOINTS       0x00000200
-#define STREAM_CONFIG_IPS                      0x00000400
-#define STREAM_CONFIG_NO_ASYNC_REASSEMBLY      0x00000800
-
-// shared stream state
-extern THREAD_LOCAL class FlowControl* flow_con;
-extern const PegInfo base_pegs[];
-
-const PegInfo* Stream_GetNormPegs();
-NormPegs Stream_GetNormCounts(unsigned&);
+
+/* traffic direction identification */
+#define FROM_SERVER     0
+#define FROM_CLIENT     1
+
+#define SSN_MISSING_NONE   0x00
+#define SSN_MISSING_BEFORE 0x01
+#define SSN_MISSING_AFTER  0x02
+#define SSN_MISSING_BOTH   (SSN_MISSING_BEFORE | SSN_MISSING_AFTER)
+
+#define SSN_DIR_NONE           0x00
+#define SSN_DIR_FROM_CLIENT    0x01
+#define SSN_DIR_FROM_SERVER    0x02
+#define SSN_DIR_BOTH           0x03
+
+// sequence must match FRAG_POLICY_* enum in stream_ip.h (1-based)
+#define IP_POLICIES  \
+     "first | linux | bsd | bsd_right | last | windows | solaris"
+
+// sequence must match STREAM_POLICY_* defines in tcp_session.cc (1-based)
+#define TCP_POLICIES \
+    "first | last | linux | old_linux | bsd | macos | solaris | irix | " \
+    "hpux11 | hpux10 | windows | win_2003 | vista | proxy"
+
+class Flow;
+
+typedef int (* LogFunction)(Flow*, uint8_t** buf, uint32_t* len, uint32_t* type);
+typedef void (* LogExtraData)(Flow*, void* config, LogFunction* funcs,
+    uint32_t max_count, uint32_t xtradata_mask, uint32_t id, uint32_t sec);
+
+#define MAX_LOG_FN 32
+
+//-------------------------------------------------------------------------
+
+class SO_PUBLIC Stream
+{
+public:
+    // for shutdown only
+    static void purge_flows();
+
+    static void timeout_flows(time_t cur_time);
+    static void prune_flows();
+    static bool expected_flow(Flow*, Packet*);
+    static Flow* new_flow(FlowKey*);
+
+    // Looks in the flow cache for flow session with specified key and returns
+    // pointer to flow session oject if found, otherwise null.
+    static Flow* get_flow(const FlowKey*);
+
+    // Allocates a flow session object from the flow cache table for the protocol
+    // type of the specified key.  If no cache exists for that protocol type null is
+    // returned.  If a flow already exists for the key a pointer to that session
+    // object is returned.
+    // If a new session object can not be allocated the program is terminated.
+    static Flow* new_flow(const FlowKey*);
+
+    // Removes the flow session object from the flow cache table and returns
+    // the resources allocated to that flow to the free list.
+    static void delete_flow(const FlowKey*);
+
+    // Examines the source and destination ip addresses and ports to determine if the
+    // packet is from the client or server side of the flow and sets bits in the
+    // packet_flags field of the Packet struct to indicate the direction determined.
+    static uint32_t get_packet_direction(Packet*);
+
+    // Sets the stream session into proxy mode.
+    static void proxy_started(Flow*, unsigned dir);  // FIXIT-L method name is misleading
+
+    // Stop inspection on a flow for up to count bytes (-1 to ignore for life or until resume).
+    // If response flag is set, automatically resume inspection up to count bytes when a data
+    // packet in the other direction is seen.  Also marks the packet to be ignored
+    // FIXIT-L stop_inspection() does not currently support the bytes/response parameters
+    static void stop_inspection(Flow*, Packet*, char dir, int32_t bytes, int rspFlag);
+
+    // Adds entry to the expected session cache with a flow key generated from the network
+    // n-tuple parameters specified.  Inspection will be turned off for this expected session
+    // when it arrives.
+    static int ignore_flow(
+        const sfip_t *addr1, uint16_t p1, const sfip_t *addr2, uint16_t p2,
+        PktType, char dir, uint32_t ppId);
+
+    // Resume inspection for flow.
+    // FIXIT-L does resume work only for a flow that has been stopped by call to stop_inspection?
+    static void resume_inspection(Flow*, char dir);
+
+    // Set Active status to force drop the current packet and set flow state to drop
+    // subsequent packets arriving from the direction specified.
+    static void drop_traffic(Flow*, char dir);
+
+    // Mark a flow as dropped, release allocated resources, and set flow state such that any
+    // subsequent packets received on this flow are dropped.
+    static void drop_flow(const Packet*);
+
+    // FIXIT-L flush_request() / flush_response() are misnomers in ips mode and may cause errors
+
+    // Flush queued data on the listener side of a stream flow.  The listener is the side of the
+    // connection the packet is destined, so if the Packet is from the client, then the
+    // server side tracker is flushed.
+    static void flush_request(Packet*);  // flush listener
+
+    // Flush queued data on the talker side of a stream flow.  The talker is the side of the
+    // connection the packet originated from, so if the Packet is from the client, then the
+    // client side tracker is flushed.
+     static void flush_response(Packet*);  // flush talker
+
+    // Add session alert - true if added
+    static bool add_flow_alert(Flow*, Packet*, uint32_t gid, uint32_t sid);
+
+    // Check session alert - true if previously alerted
+    static bool check_flow_alerted(Flow*, Packet* p, uint32_t gid, uint32_t sid);
+
+    // Set Extra Data Logging
+    static int update_flow_alert(
+        Flow*, Packet* p, uint32_t gid, uint32_t sid,
+        uint32_t eventId, uint32_t eventSecond);
+
+    // Get reassembly direction for given session
+    static char get_reassembly_direction(Flow*);
+
+    // Returns true if stream data for the flow is in sequence, otherwise return false.
+    static bool is_stream_sequenced(Flow*, uint8_t dir);
+
+    // Get state of missing packets for the flow.
+    //      SSN_MISSING_BOTH if missing before and after
+    //      SSN_MISSING_BEFORE if missing before
+    //      SSN_MISSING_AFTER if missing after
+    //      SSN_MISSING_NONE if none missing
+    static int missing_in_reassembled(Flow*, uint8_t dir);
+
+    // Returns true if packets were missed on the stream, otherwise returns false.
+    static bool missed_packets(Flow*, uint8_t dir);
+
+    // Get the protocol identifier from a stream
+    static int16_t get_application_protocol_id(Flow*);
+
+    // Set the protocol identifier for a stream
+    static int16_t set_application_protocol_id(Flow*, int16_t appId);
+
+    // initialize response count and expiration time
+    static void init_active_response(const Packet*, Flow*);
+
+    static void set_splitter(Flow*, bool toServer, class StreamSplitter* = nullptr);
+    static StreamSplitter* get_splitter(Flow*, bool toServer);
+    static bool is_paf_active(Flow*, bool toServer);
+
+    // Turn off inspection for potential session. Adds session identifiers to a hash table.
+    // TCP only.
+    static int set_application_protocol_id_expected(
+        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2, PktType,
+        int16_t appId, FlowData*);
+
+    // Get pointer to application data for a flow based on the lookup tuples for cases where
+    // Snort does not have an active packet that is relevant.
+    static FlowData* get_flow_data(
+        PktType type, IpProtocol proto,
+        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2,
+        uint16_t vlanId, uint32_t mplsId, uint16_t addrSpaceId, unsigned flow_id);
+
+    // Get pointer to application data for a flow using the FlowKey as the lookup criteria
+    static FlowData* get_flow_data(const FlowKey*, unsigned flow_id);
+
+    // Get pointer to a session flow instance for a flow based on the lookup tuples for
+    // cases where Snort does not have an active packet that is relevant.
+    static Flow* get_flow(
+        PktType type, IpProtocol proto,
+        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2,
+        uint16_t vlanId, uint32_t mplsId, uint16_t addrSpaceId);
+
+    // Delete the session if it is in the closed session state.
+    static void check_flow_closed(Packet*);
+
+    //  Create a session key from the Packet
+    static FlowKey* get_flow_key(Packet*);
+
+    //  Populate a session key from the Packet
+    static void populate_flow_key(Packet*, FlowKey*);
+
+    static void update_direction(Flow*, char dir, const sfip_t* ip, uint16_t port);
+
+    static void set_application_protocol_id(
+        Flow*, const struct HostAttributeEntry*, int direction);
+
+    static bool is_midstream(Flow* flow)
+    { return flow->ssn_state.session_flags & SSNFLAG_MIDSTREAM; }
+
+    // Get the TTL value used at session setup
+    // Set outer=false to get inner ip ttl for ip in ip; else outer=true
+    static uint8_t get_flow_ttl(Flow*, char dir, bool outer);
+
+    static bool expired_flow(Flow*, Packet*);
+    static bool ignored_flow(Flow*, Packet*);
+    static bool blocked_flow(Flow*, Packet*);
+
+    // extra data methods
+    static void set_extra_data(Flow*, Packet*, uint32_t);
+    static void clear_extra_data(Flow*, Packet*, uint32_t);
+    static void log_extra_data(Flow*, uint32_t mask, uint32_t id, uint32_t sec);
+
+    static uint32_t reg_xtra_data_cb(LogFunction);
+    static void reg_xtra_data_log(LogExtraData, void*);
+    static uint32_t get_xtra_data_map(LogFunction**);
+
+private:
+    static void set_ip_protocol(Flow*);
+};
 
 #endif
 
diff --git a/src/stream/stream_api.h b/src/stream/stream_api.h
deleted file mode 100644 (file)
index de32ce0..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-//--------------------------------------------------------------------------
-// Copyright (C) 2014-2016 Cisco and/or its affiliates. All rights reserved.
-// Copyright (C) 2005-2013 Sourcefire, Inc.
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License Version 2 as published
-// by the Free Software Foundation.  You may not use, modify or distribute
-// this program under any other version of the GNU General Public License.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-//--------------------------------------------------------------------------
-
-// stream_api.h author Steven Sturges
-
-#ifndef STREAM_API_H
-#define STREAM_API_H
-
-/*
- * Purpose: Definition of the StreamAPI.  To be used as a common interface
- *          for TCP (and later UDP & ICMP) Stream access for other
- *          preprocessors and detection plugins.
- */
-
-#include <sys/types.h>
-
-#include "sfip/sfip_t.h"
-#include "protocols/packet.h"
-#include "flow/flow.h"
-#include "main/snort_types.h"
-
-/* traffic direction identification */
-#define FROM_SERVER     0
-#define FROM_CLIENT     1
-
-#define SSN_MISSING_NONE   0x00
-#define SSN_MISSING_BEFORE 0x01
-#define SSN_MISSING_AFTER  0x02
-#define SSN_MISSING_BOTH   (SSN_MISSING_BEFORE | SSN_MISSING_AFTER)
-
-#define SSN_DIR_NONE           0x00
-#define SSN_DIR_FROM_CLIENT    0x01
-#define SSN_DIR_FROM_SERVER    0x02
-#define SSN_DIR_BOTH           0x03
-
-// sequence must match FRAG_POLICY_* enum in stream_ip.h (1-based)
-#define IP_POLICIES  \
-     "first | linux | bsd | bsd_right | last | windows | solaris"
-
-// sequence must match STREAM_POLICY_* defines in tcp_session.cc (1-based)
-#define TCP_POLICIES \
-    "first | last | linux | old_linux | bsd | macos | solaris | irix | " \
-    "hpux11 | hpux10 | windows | win_2003 | vista | proxy"
-
-class Flow;
-
-typedef int (* LogFunction)(Flow*, uint8_t** buf, uint32_t* len, uint32_t* type);
-typedef void (* LogExtraData)(Flow*, void* config, LogFunction* funcs,
-    uint32_t max_count, uint32_t xtradata_mask, uint32_t id, uint32_t sec);
-
-typedef int (* PacketIterator)
-(
-    DAQ_PktHdr_t*,
-    uint8_t*,    /* pkt pointer */
-    void*        /* user-defined data pointer */
-);
-
-typedef int (* StreamSegmentIterator)
-(
-    DAQ_PktHdr_t*,
-    uint8_t*,    /* pkt pointer */
-    uint8_t*,    /* payload pointer */
-    uint32_t,    /* sequence number */
-    void*        /* user-defined data pointer */
-);
-
-#define MAX_LOG_FN 32
-
-//-------------------------------------------------------------------------
-// public methods other than ctor / dtor must all be declared SO_PUBLIC
-//-------------------------------------------------------------------------
-
-class SO_PUBLIC Stream
-{
-public:
-    SO_PRIVATE Stream();
-    SO_PRIVATE ~Stream();
-
-    // Looks in the flow cache for flow session with specified key and returns
-    // pointer to flow session oject if found, otherwise null.
-    static Flow* get_session(const FlowKey*);
-
-    // Allocates a flow session object from the flow cache table for the protocol
-    // type of the specified key.  If no cache exists for that protocol type null is
-    // returned.  If a flow already exists for the key a pointer to that session
-    // object is returned.
-    // If a new session object can not be allocated the program is terminated.
-    static Flow* new_session(const FlowKey*);
-
-    // Removes the flow session object from the flow cache table and returns
-    // the resources allocated to that flow to the free list.
-    static void delete_session(const FlowKey*);
-
-    // Examines the source and destination ip addresses and ports to determine if the
-    // packet is from the client or server side of the flow and sets bits in the
-    // packet_flags field of the Packet struct to indicate the direction determined.
-    static uint32_t get_packet_direction(Packet*);
-
-    // Sets the stream session into proxy mode.
-    static void proxy_started(Flow*, unsigned dir);  // FIXIT-L method name is misleading
-
-    // Stop inspection on a flow for up to count bytes (-1 to ignore for life or until resume).
-    // If response flag is set, automatically resume inspection up to count bytes when a data
-    // packet in the other direction is seen.  Also marks the packet to be ignored
-    // FIXIT-L stop_inspection() does not currently support the bytes/response parameters
-    static void stop_inspection(Flow*, Packet*, char dir, int32_t bytes, int rspFlag);
-
-    // Adds entry to the expected session cache with a flow key generated from the network
-    // n-tuple parameters specified.  Inspection will be turned off for this expected session
-    // when it arrives.
-    int ignore_session( const sfip_t *addr1, uint16_t p1, const sfip_t *addr2, uint16_t p2,
-        PktType, char dir, uint32_t ppId);
-
-    // Resume inspection for flow.
-    // FIXIT-L does resume work only for a flow that has been stopped by call to stop_inspection?
-    static void resume_inspection(Flow*, char dir);
-
-    // Set Active status to force drop the current packet and set flow state to drop
-    // subsequent packets arriving from the direction specified.
-    static void drop_traffic(Flow*, char dir);
-
-    // Mark a flow as dropped, release allocated resources, and set flow state such that any
-    // subsequent packets received on this flow are dropped.
-    static void drop_session(const Packet*);
-
-    // FIXIT-L flush_request() / flush_response() are misnomers in ips mode and may cause errors
-
-    // Flush queued data on the listener side of a stream flow.  The listener is the side of the
-    // connection the packet is destined, so if the Packet is from the client, then the
-    // server side tracker is flushed.
-    static void flush_request(Packet*);  // flush listener
-
-    // Flush queued data on the talker side of a stream flow.  The talker is the side of the
-    // connection the packet originated from, so if the Packet is from the client, then the
-    // client side tracker is flushed.
-     static void flush_response(Packet*);  // flush talker
-
-    // Add session alert - true if added
-    static bool add_session_alert(Flow*, Packet*, uint32_t gid, uint32_t sid);
-
-    // Check session alert - true if previously alerted
-    static bool check_session_alerted(Flow*, Packet* p, uint32_t gid, uint32_t sid);
-
-    // Set Extra Data Logging
-    static int update_session_alert(
-        Flow*, Packet* p, uint32_t gid, uint32_t sid,
-        uint32_t eventId, uint32_t eventSecond);
-
-    // Get reassembly direction for given session
-    static char get_reassembly_direction(Flow*);
-
-    // Returns true if stream data for the flow is in sequence, otherwise return false.
-    static bool is_stream_sequenced(Flow*, uint8_t dir);
-
-    // Get state of missing packets for the flow.
-    //      SSN_MISSING_BOTH if missing before and after
-    //      SSN_MISSING_BEFORE if missing before
-    //      SSN_MISSING_AFTER if missing after
-    //      SSN_MISSING_NONE if none missing
-    static int missing_in_reassembled(Flow*, uint8_t dir);
-
-    // Returns true if packets were missed on the stream, otherwise returns false.
-    static bool missed_packets(Flow*, uint8_t dir);
-
-    // Get the protocol identifier from a stream
-    static int16_t get_application_protocol_id(Flow*);
-
-    // Set the protocol identifier for a stream
-    static int16_t set_application_protocol_id(Flow*, int16_t appId);
-
-    // initialize response count and expiration time
-    static void init_active_response(const Packet*, Flow*);
-
-    static void set_splitter(Flow*, bool toServer, class StreamSplitter* = nullptr);
-    static StreamSplitter* get_splitter(Flow*, bool toServer);
-    static bool is_paf_active(Flow*, bool toServer);
-
-    // Turn off inspection for potential session. Adds session identifiers to a hash table.
-    // TCP only.
-    int set_application_protocol_id_expected(
-        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2, PktType,
-        int16_t appId, FlowData*);
-
-    // Get pointer to application data for a flow based on the lookup tuples for cases where
-    // Snort does not have an active packet that is relevant.
-    static FlowData* get_flow_data(
-        PktType type, IpProtocol proto,
-        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2,
-        uint16_t vlanId, uint32_t mplsId, uint16_t addrSpaceId, unsigned flow_id);
-
-    // Get pointer to application data for a flow using the FlowKey as the lookup criteria
-     static FlowData* get_flow_data(const FlowKey*, unsigned flow_id);
-
-    // -- extra data methods
-    uint32_t reg_xtra_data_cb(LogFunction);
-    void reg_xtra_data_log(LogExtraData, void*);
-    uint32_t get_xtra_data_map(LogFunction**);
-
-    static void set_extra_data(Flow*, Packet*, uint32_t);
-    static void clear_extra_data(Flow*, Packet*, uint32_t);
-    void log_extra_data(Flow*, uint32_t mask, uint32_t id, uint32_t sec);
-
-    // Get pointer to a session flow instance for a flow based on the lookup tuples for
-    // cases where Snort does not have an active packet that is relevant.
-     static Flow* get_session_ptr(
-        PktType type, IpProtocol proto,
-        const sfip_t *a1, uint16_t p1, const sfip_t *a2, uint16_t p2,
-        uint16_t vlanId, uint32_t mplsId, uint16_t addrSpaceId);
-
-    // Delete the session if it is in the closed session state.
-    void check_session_closed(Packet*);
-
-    //  Create a session key from the Packet
-    static FlowKey* get_session_key(Packet*);
-
-    //  Populate a session key from the Packet
-    static void populate_session_key(Packet*, FlowKey*);
-
-    void update_direction(Flow*, char dir, const sfip_t* ip, uint16_t port);
-
-    static void set_application_protocol_id(
-        Flow*, const struct HostAttributeEntry*, int direction);
-
-    static bool is_midstream(Flow* flow)
-    { return flow->ssn_state.session_flags & SSNFLAG_MIDSTREAM; }
-
-    // Get the TTL value used at session setup
-    // Set outer=false to get inner ip ttl for ip in ip; else outer=true
-    static uint8_t get_session_ttl(Flow*, char dir, bool outer);
-
-    static bool expired_session(Flow*, Packet*);
-    static bool ignored_session(Flow*, Packet*);
-    static bool blocked_session(Flow*, Packet*);
-
-private:
-    static void set_ip_protocol(Flow*);
-
-private:
-    uint32_t xtradata_func_count = 0;
-    LogFunction xtradata_map[MAX_LOG_FN];
-    LogExtraData extra_data_log = NULL;
-    void* extra_data_config = NULL;
-};
-
-SO_PUBLIC extern Stream stream;
-
-#endif
-
index f026e64b0a3f1afbfd020e8431d33515882858fe..ef0eced4c262c01b46aae9e1314b178ab03e9e3e 100644 (file)
@@ -124,13 +124,13 @@ int ReassembleOption::eval(Cursor&, Packet* pkt)
             if ( srod.direction & SSN_DIR_FROM_SERVER )
             {
                 tcpssn->server->flush_policy = STREAM_FLPOLICY_IGNORE;
-                stream.set_splitter(lwssn, true);
+                Stream::set_splitter(lwssn, true);
             }
 
             if ( srod.direction & SSN_DIR_FROM_CLIENT )
             {
                 tcpssn->client->flush_policy = STREAM_FLPOLICY_IGNORE;
-                stream.set_splitter(lwssn, false);
+                Stream::set_splitter(lwssn, false);
             }
         }
         else
@@ -140,13 +140,13 @@ int ReassembleOption::eval(Cursor&, Packet* pkt)
             if ( srod.direction & SSN_DIR_FROM_SERVER )
             {
                 tcpssn->server->flush_policy = STREAM_FLPOLICY_ON_ACK;
-                stream.set_splitter(lwssn, true, new AtomSplitter(true));
+                Stream::set_splitter(lwssn, true, new AtomSplitter(true));
             }
 
             if ( srod.direction & SSN_DIR_FROM_CLIENT )
             {
                 tcpssn->client->flush_policy = STREAM_FLPOLICY_ON_ACK;
-                stream.set_splitter(lwssn, false, new AtomSplitter(false));
+                Stream::set_splitter(lwssn, false, new AtomSplitter(false));
             }
         }
 
@@ -316,7 +316,7 @@ TEST_CASE("IPS Stream Reassemble", "[ips_stream_reassemble][stream_tcp]")
         IpsOption* ropt = reassemble_api.ctor(reassembler, nullptr);
         int rc = ropt->eval(cursor, pkt);
         CHECK( ( rc == DETECTION_OPTION_MATCH ) );
-        StreamSplitter* ss = stream.get_splitter(flow, true);
+        StreamSplitter* ss = Stream::get_splitter(flow, true);
         CHECK( ( ss != nullptr ) );
         CHECK( ( !ss->is_paf() ) );
         CHECK( ( ( ( TcpSession* )pkt->flow->session)->server.flush_policy
index e9ef45653805127dab27171cfb715de7f3b9b90f..5c557b915ee78655379131f4dfd4951f7f7bf8ee 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef SEGMENT_OVERLAP_EDITOR_H
 #define SEGMENT_OVERLAP_EDITOR_H
 
+#include "normalize/normalize.h"
 #include "tcp_defs.h"
 #include "tcp_segment_node.h"
 #include "tcp_session.h"
index 30b208cb00bee14cc245d694f811f13669bafdaa..25ad3c8e7f084e92d953587aa54945a1d170b883 100644 (file)
@@ -20,7 +20,6 @@
 #define STREAM_TCP_H
 
 #include "flow/flow.h"
-#include "stream/stream_api.h"
 #include "protocols/packet.h"
 
 #include "tcp_defs.h"
index 8bdac94ee6b970c32e54a6cb5bbabc91a94fd1dd..23233f0fb9fcb8b7a1dd3b200e0f28eb79aef149 100644 (file)
@@ -73,7 +73,7 @@
 
 #define SLAM_MAX 4
 
-// target-based policy types - changes to this enum require changes to stream_api.h::TCP_POLICIES
+// target-based policy types - changes to this enum require changes to stream.h::TCP_POLICIES
 enum class StreamPolicy
 {
     OS_INVALID = 0,
index 85b9ac2313c77bac1b02685b66d76af5203a266b..6952c16990dd988eaf113472b5dd372ee0469579 100644 (file)
 
 #include "tcp_ha.h"
 
-#include "flow/flow_control.h"
 #include "main/snort_debug.h"
-#include "stream/tcp/tcp_session.h"
+#include "stream/stream.h"
+#include "tcp_session.h"
 
 Flow* TcpHA::create_session(FlowKey* key)
 {
-    DebugMessage(DEBUG_HA,"TcpHA::create_session)\n");
+    assert(key);
 
-    assert ( key );
-
-    Flow* flow = flow_con->new_flow(key);
+    Flow* flow = Stream::new_flow(key);
 
     if ( (flow != nullptr ) && (flow->session == nullptr) )
     {
index c8beec63b333b8236e518ca61c4cde7def60b9f6..670f86e68befddda2de0ab5396b1321ce64fae7b 100644 (file)
@@ -23,8 +23,8 @@
 #include <string>
 
 #include "profiler/profiler.h"
-#include "stream_tcp.h"
 #include "stream/stream.h"
+#include "stream_tcp.h"
 
 using namespace std;
 
index b5654697521f2ecb9dc76b6ec0f550c21ff2d9bb..1dd5b18624c8114b298e859c7d46fa30cf6e638e 100644 (file)
@@ -26,8 +26,8 @@
 
 #include "main/snort_types.h"
 #include "main/thread.h"
+#include "flow/session.h"
 #include "framework/module.h"
-#include "stream/stream.h"
 #include "tcp_stream_config.h"
 
 #define GID_STREAM_TCP  129
index e1ce0c7704fc53a0815d21f7d0b4fadc80b13c11..256e32097edfa0e35d880aadd0dda0fc9bec057c 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "main/snort.h"
 #include "protocols/packet.h"
-#include "stream/stream.h"
+#include "protocols/packet_manager.h"
 #include "profiler/profiler.h"
 #include "flow/flow_control.h"
 
@@ -305,7 +305,7 @@ int TcpReassembler::purge_alerts(uint32_t /*flush_seq*/,  Flow* flow)
 
         //if (SEQ_LT(ai->seq, flush_seq) )
         {
-            stream.log_extra_data(flow, xtradata_mask, ai->event_id, ai->event_second);
+            Stream::log_extra_data(flow, xtradata_mask, ai->event_id, ai->event_second);
             memset(ai, 0, sizeof(*ai));
         }
 #if 0
index bcb5b9d5de0e2e24af995bc162fcd136d88cd66f..951aa86b14e66666c8a933c4dbe4f1a6e577df60 100644 (file)
@@ -25,7 +25,6 @@
 #include "framework/counts.h"
 #include "detection/detect.h"
 #include "normalize/normalize.h"
-#include "stream/stream_api.h"
 
 #include "segment_overlap_editor.h"
 #include "tcp_defs.h"
index a337efb753882d836ae52e0c32780c8ba42061c5..8d95c2ef376d53f8536aa8d0970682561c412bc2 100644 (file)
 #include "log/log_text.h"
 #include "stream/stream.h"
 #include "stream/stream_splitter.h"
-#include "flow/flow_control.h"
 #include "flow/session.h"
 #include "profiler/profiler.h"
 #include "file_api/file_api.h"
-#include "normalize/normalize.h"
 #include "perf_monitor/flow_tracker.h"
 #include "filters/sfrf.h"
 
@@ -606,7 +604,7 @@ void TcpSession::update_ignored_session(TcpSegmentDescriptor& tsd)
 {
     // FIXIT-L why flush here instead of just purge?
     // s5_ignored_session() may be disabling detection too soon if we really want to flush
-    if (stream.ignored_session(flow, tsd.get_pkt()))
+    if (Stream::ignored_flow(flow, tsd.get_pkt()))
     {
         if ( talker && ( talker->get_tf_flags() & TF_FORCE_FLUSH ) )
         {
@@ -1024,13 +1022,13 @@ bool TcpSession::is_flow_handling_packets(Packet* p)
         flow_ready = false;
     }
 
-    if (stream.blocked_session(flow, p) || (flow->session_state & STREAM_STATE_IGNORE))
+    if (Stream::blocked_flow(flow, p) || (flow->session_state & STREAM_STATE_IGNORE))
         flow_ready = false;
 
-    // FIXIT-L expected flow should be checked by flow_con before we get here
+    // FIXIT-L expected flow should be checked by Stream before we get here
     // harmonize this with that and the checks above
-    char ignore = flow_con->expected_flow(flow, p);
-    if (ignore)
+
+    if ( Stream::expected_flow(flow, p) )
     {
         server->flush_policy = STREAM_FLPOLICY_IGNORE;
         client->flush_policy = STREAM_FLPOLICY_IGNORE;
@@ -1044,7 +1042,7 @@ void TcpSession::cleanup_session_if_expired(Packet* p)
 {
     // Check if the session is expired. Should be done before we do something with
     // the packet...Insert a packet, or handle state change SYN, FIN, RST, etc.
-    if (stream.expired_session(flow, p))
+    if (Stream::expired_flow(flow, p))
     {
         /* Session is timed out, if also reset then restart, otherwise clear */
         if (flow->get_session_flags() & SSNFLAG_RESET)
index 0f6052488c65b667274b659b7c5b5486075dc841..69dc5b648b6e55cfc9dfff20bf82b99b91d0895a 100644 (file)
 // tcp_state_closed.cc author davis mcpherson <davmcphe@@cisco.com>
 // Created on: Jul 30, 2015
 
-#include "stream/stream.h"
+#include "tcp_state_closed.h"
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
 #include "tcp_session.h"
 #include "tcp_normalizer.h"
-#include "tcp_state_closed.h"
 
 #ifdef UNIT_TEST
 #include "catch/catch.hpp"
index 684ee1642872986eecdc50fedb433753af9d0aa5..b35acb546d13e82f1b5947b572c37eb7059df4cf 100644 (file)
 // tcp_state_none.cc author davis mcpherson <davmcphe@@cisco.com>
 // Created on: Jul 30, 2015
 
-#include "stream/stream.h"
+#include "tcp_state_none.h"
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
 #include "tcp_session.h"
 #include "tcp_normalizer.h"
-#include "tcp_state_none.h"
 
 #ifdef UNIT_TEST
 #include "catch/catch.hpp"
index a8eaab555252aee6631a62d5cb5cd0410108fe09..3727251ea1cddcea6249e1bc1e3a7e9a05cdb5ab 100644 (file)
 #define TCP_STREAM_CONFIG_H
 
 #include "time/packet_time.h"
-#include "stream/stream.h"
-
 #include "tcp_defs.h"
 
+#define STREAM_CONFIG_STATEFUL_INSPECTION      0x00000001
+#define STREAM_CONFIG_LOG_STREAMS              0x00000004
+#define STREAM_CONFIG_REASS_CLIENT             0x00000008
+#define STREAM_CONFIG_REASS_SERVER             0x00000010
+#define STREAM_CONFIG_ASYNC                    0x00000020
+#define STREAM_CONFIG_SHOW_PACKETS             0x00000040
+#define STREAM_CONFIG_MIDSTREAM_DROP_NOALERT   0x00000080
+#define STREAM_CONFIG_IGNORE_ANY               0x00000100
+#define STREAM_CONFIG_STATIC_FLUSHPOINTS       0x00000200
+#define STREAM_CONFIG_IPS                      0x00000400
+#define STREAM_CONFIG_NO_ASYNC_REASSEMBLY      0x00000800
+
+#define STREAM_DEFAULT_SSN_TIMEOUT  30
+
 class TcpStreamConfig
 {
 public:
index d2df14eb0c6309d8482fb60adf962c60e1ca41af..815278a38fdd9a140bb8112e885ca6ba24647ee1 100644 (file)
 
 #include "udp_ha.h"
 
-#include "flow/flow_control.h"
 #include "main/snort_debug.h"
-#include "stream/udp/udp_session.h"
-
-extern THREAD_LOCAL class FlowControl* flow_con;
+#include "stream/stream.h"
+#include "udp_session.h"
 
 Flow* UdpHA::create_session(FlowKey* key)
 {
-    DebugMessage(DEBUG_HA,"UdpHA::create_session\n");
-
-    assert ( key );
+    assert(key);
 
-    Flow* flow = flow_con->new_flow(key);
+    Flow* flow = Stream::new_flow(key);
 
     if ( (flow != nullptr ) && (flow->session == nullptr) )
     {
index 31847c0f889c0dbd09b7434f23903c9c9467c089..9d52f303d6ffdbc7d58ca86235d80c86fb74eb60 100644 (file)
@@ -26,8 +26,8 @@
 
 #include "main/snort_types.h"
 #include "main/thread.h"
+#include "flow/session.h"
 #include "framework/module.h"
-#include "stream/stream.h"
 
 struct SnortConfig;
 
index 4e398405358bc8d2e3eb1583dc6dbe6fc70ab4a3..cac2649a5d4e107570e776bf803136182e81a2a4 100644 (file)
 #include "config.h"
 #endif
 
-#include "stream_udp.h"
-#include "udp_module.h"
-#include "udp_ha.h"
-
 #include "stream/stream.h"
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "hash/sfxhash.h"
 #include "utils/util.h"
 #include "protocols/packet.h"
-#include "flow/flow_control.h"
 #include "flow/session.h"
 #include "packet_io/active.h"
+#include "perf_monitor/flow_ip_tracker.h"
 #include "profiler/profiler.h"
 #include "sfip/sf_ip.h"
-#include "perf_monitor/flow_ip_tracker.h"
+#include "stream/stream.h"
+
+#include "stream_udp.h"
+#include "udp_module.h"
+#include "udp_ha.h"
 
 // NOTE:  sender is assumed to be client
 //        responder is assumed to be server
@@ -74,10 +74,10 @@ static int ProcessUdp(
 {
     assert(lwssn->pkt_type == PktType::UDP);
 
-    if ( stream.blocked_session(lwssn, p) )
+    if ( Stream::blocked_flow(lwssn, p) )
         return 0;
 
-    if ( stream.ignored_session(lwssn, p) )
+    if ( Stream::ignored_flow(lwssn, p) )
         return 0;
 
     /* if both seen, mark established */
@@ -139,7 +139,7 @@ bool UdpSession::setup(Packet* p)
             &flow->server_ip, SFS_STATE_UDP_CREATED);
     }
 
-    if ( flow_con->expected_flow(flow, p) )
+    if ( Stream::expected_flow(flow, p) )
     {
         udpStats.sessions--; // incremented in SESSIONS_STATS_ADD
         return false;
@@ -194,7 +194,7 @@ int UdpSession::process(Packet* p)
     StreamUdpConfig* pc = get_udp_cfg(flow->ssn_server);
     // Check if the session is expired.
     // Should be done before we do something with the packet...
-    if ( stream.expired_session(flow, p) )
+    if ( Stream::expired_flow(flow, p) )
     {
         UdpSessionCleanup(flow);
         flow->restart();
index e3fe16c2023b2f01c615247d635bb9f61bba853d..a2afce61d8b50d9213352cbdeb20ef75c20413ee 100644 (file)
@@ -24,7 +24,6 @@ using namespace std;
 
 #include "stream_user.h"
 #include "main/snort_config.h"
-#include "stream/stream.h"
 
 //-------------------------------------------------------------------------
 // stream_user module
index 0d464f33615e2015839abfee05140997c3f79505..6d305d5ad7490598d31a7ce506b978c1be90adb9 100644 (file)
 #include "config.h"
 #endif
 
-#include "stream_user.h"
-#include "user_module.h"
-
-#include "stream/stream.h"
-#include "stream/stream_splitter.h"
-#include "stream/paf.h"
-
-#include "flow/flow_control.h"
 #include "main/snort.h"
 #include "perf_monitor/perf_monitor.h"
 #include "profiler/profiler.h"
 #include "sfip/sf_ip.h"
 #include "utils/util.h"
 
+#include "stream/stream.h"
+#include "stream/stream_splitter.h"
+#include "stream/paf.h"
+
+#include "stream_user.h"
+#include "user_module.h"
+
 THREAD_LOCAL ProfileStats user_perf_stats;
 
 // we always get exactly one copy of user data in order
@@ -427,7 +426,7 @@ bool UserSession::setup(Packet*)
     server.init();
 
 #ifdef ENABLE_EXPECTED_USER
-    if ( flow_con->expected_session(flow, p))
+    if ( Stream::expected_flow(flow, p) )
         return false;
 #endif
     return true;
@@ -463,20 +462,20 @@ int UserSession::process(Packet* p)
 {
     Profile profile(user_perf_stats);
 
-    if ( stream.expired_session(flow, p) )
+    if ( Stream::expired_flow(flow, p) )
     {
         flow->restart();
         // FIXIT-M count user session timeouts here
 
 #ifdef ENABLE_EXPECTED_USER
-        if ( flow_con->expected_session(flow, p))
+        if ( Stream::expected_flow(flow, p))
             return 0;
 #endif
     }
 
     flow->set_direction(p);
 
-    if ( stream.blocked_session(flow, p) || stream.ignored_session(flow, p) )
+    if ( Stream::blocked_flow(flow, p) || Stream::ignored_flow(flow, p) )
         return 0;
 
     update(p, flow);
index af593a60e66752bc34d8322c6f557fed1aaf3438..9bdde5a6bc0650fc04dac2eddddd5891cad7693b 100644 (file)
 #include <vector>
 using namespace std;
 
+#include "hash/sfghash.h"
+#include "main/snort_debug.h"
+#include "utils/util.h"
+#include "stream/stream.h"
+
 #include "sftarget_reader.h"
 #include "sftarget_hostentry.h"
 #include "sftarget_data.h"
 
-#include "hash/sfghash.h"
-#include "utils/util.h"
-#include "main/snort_debug.h"
-#include "stream/stream_api.h"
-
 struct SFTargetProtocolReference
 {
     char name[SFAT_BUFSZ];
@@ -177,7 +177,7 @@ int16_t GetProtocolReference(Packet* p)
         if ( p->flow )
         {
             /* Use session information via Stream API */
-            protocol = stream.get_application_protocol_id(p->flow);
+            protocol = Stream::get_application_protocol_id(p->flow);
 
             if ( protocol )
                 break;
index 4c6adf21e3255b11758b8ca1eb6b3a4bcd142f22..9f09a00af76ac89fee382389e0912b036ea70fda 100644 (file)
@@ -69,7 +69,6 @@
 #include "ips_options/ips_pcre.h"
 #include "time/packet_time.h"
 #include "time/timersub.h"
-#include "stream/stream.h"
 
 #ifdef PATH_MAX
 #define PATH_MAX_UTIL PATH_MAX
index 14de579414c7294f4af3e15d8af754e87b065bae..8e70dba2414bfea44a635c232f0f60f0bec33bf0 100644 (file)
@@ -68,8 +68,7 @@ public:
         if ((lua_option != nullptr) && snort_option->compare(*lua_option))
         {
             retval = parse_int_option(*lua_option, stream, false);
-            table_api.add_diff_option_comment("config " + *snort_option +
-                ":", *lua_option);
+            table_api.add_diff_option_comment("config " + *snort_option + ":", *lua_option);
         }
         else
         {
@@ -92,10 +91,7 @@ const std::string* lua_table,
 const std::string* lua_option = nullptr>
 static ConversionState* config_int_ctor(Converter& c)
 {
-    return new ConfigIntOption(c,
-        snort_option,
-        lua_table,
-        lua_option);
+    return new ConfigIntOption(c, snort_option, lua_table, lua_option);
 }
 } // namespace
 
index 571ad10cda78db6b6f9d3f0210f8253e96ad6dfd..6f42df40546f1fbb2fe32711da08fc6fc3f82a14 100644 (file)
@@ -111,11 +111,7 @@ const std::string* lua_option = nullptr,
 bool use_string_array = false>
 static ConversionState* config_string_ctor(Converter& c)
 {
-    return new ConfigStringOption(c,
-        snort_option,
-        lua_table,
-        lua_option,
-        use_string_array);
+    return new ConfigStringOption(c, snort_option, lua_table, lua_option, use_string_array);
 }
 } // namespace