]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2295 in SNORT/snort3 from ~MIALTIZE/snort3:cppcheck to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Sat, 27 Jun 2020 18:24:01 +0000 (18:24 +0000)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Sat, 27 Jun 2020 18:24:01 +0000 (18:24 +0000)
Squashed commit of the following:

commit b0a6542cf89eb02f16c71c8447332c0437249896
Author: Michael Altizer <mialtize@cisco.com>
Date:   Sat Jun 27 12:15:19 2020 -0400

    build: Fix various cppcheck warnings about constness

40 files changed:
src/detection/rules.cc
src/detection/rules.h
src/file_api/file_policy.cc
src/helpers/test/bitop_test.cc
src/ips_options/ips_base64.cc
src/ips_options/ips_content.cc
src/latency/latency_module.cc
src/network_inspectors/appid/app_info_table.cc
src/network_inspectors/appid/app_info_table.h
src/network_inspectors/appid/appid_api.cc
src/network_inspectors/appid/appid_api.h
src/network_inspectors/appid/appid_config.cc
src/network_inspectors/appid/appid_config.h
src/network_inspectors/appid/appid_data_decrypt_event_handler.h
src/network_inspectors/appid/appid_stats.cc
src/network_inspectors/appid/appid_stats.h
src/network_inspectors/appid/detector_plugins/detector_dns.cc
src/network_inspectors/appid/detector_plugins/detector_dns.h
src/network_inspectors/appid/detector_plugins/test/detector_plugins_mock.h
src/network_inspectors/appid/host_port_app_cache.cc
src/network_inspectors/appid/host_port_app_cache.h
src/network_inspectors/appid/service_plugins/test/service_plugin_mock.h
src/network_inspectors/appid/test/appid_discovery_test.cc
src/network_inspectors/appid/test/appid_http_session_test.cc
src/network_inspectors/appid/test/appid_mock_session.h
src/network_inspectors/appid/test/tp_lib_handler_test.cc
src/network_inspectors/appid/tp_appid_session_api.h
src/network_inspectors/normalize/norm_module.cc
src/network_inspectors/normalize/norm_module.h
src/service_inspectors/dce_rpc/dce_common.cc
src/service_inspectors/dce_rpc/dce_common.h
src/service_inspectors/dce_rpc/dce_expected_session.cc
src/service_inspectors/dce_rpc/dce_expected_session.h
src/service_inspectors/dce_rpc/dce_http_proxy_splitter.cc
src/service_inspectors/dce_rpc/dce_http_proxy_splitter.h
src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/http_inspect/http_inspect.h
src/service_inspectors/http_inspect/http_msg_section.cc
src/service_inspectors/http_inspect/http_msg_section.h
src/stream/tcp/tcp_stream_session.cc

index 1795229bc517ad75c9ee510e0be67735a1143255..4690a8c4187dcd5891879b1b76fe4e9a4af21e9e 100644 (file)
@@ -83,7 +83,7 @@ void RuleStateMap::apply(SnortConfig* sc)
 }
 
 void RuleStateMap::apply(
-    SnortConfig* sc, OptTreeNode* otn, unsigned ips_num, RuleState& s)
+    SnortConfig* sc, OptTreeNode* otn, unsigned ips_num, const RuleState& s)
 {
     IpsPolicy* policy = nullptr;
     RuleTreeNode* rtn = getRtnFromOtn(otn, ips_num);
index e0521cfe4706f82a22b0d24e81634cbcca2cd1ba..8ff47e270ab0f9c74af8cfcfdcd5d3765b3465db 100644 (file)
@@ -98,7 +98,7 @@ public:
 private:
     RuleTreeNode* dup_rtn(RuleTreeNode*);
     void update_rtn(RuleTreeNode*, const RuleState&);
-    void apply(snort::SnortConfig*, OptTreeNode*, unsigned ips_num, RuleState&);
+    void apply(snort::SnortConfig*, OptTreeNode*, unsigned ips_num, const RuleState&);
 
 private:
     std::map<RuleKey, RuleState> map;
index b7958720499d7f4414645673786c52ce46f5b40a..15f069e2ff548eb82caabf6e5e8fdd551382610a 100644 (file)
@@ -184,7 +184,7 @@ FileVerdict FilePolicy::type_lookup(Packet*, FileInfo* file)
 
 FileVerdict FilePolicy::signature_lookup(Packet*, FileInfo* file)
 {
-    FileRule& rule = match_file_rule(nullptr, file);
+    const FileRule& rule = match_file_rule(nullptr, file);
 
     if (rule.use.capture_enabled)
     {
index b8acf7be106b020008ad1f1d7a4089c8f60b1e70..f5be7c711cf3240cf9d132877b9c076913ab419d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "../bitop.h"
 
-static unsigned num_set(BitOp& bitop, size_t max)
+static unsigned num_set(const BitOp& bitop, size_t max)
 {
     unsigned c = 0;
 
@@ -37,7 +37,7 @@ static unsigned num_set(BitOp& bitop, size_t max)
     return c;
 }
 
-static bool is_clear(BitOp& bitop, size_t max)
+static bool is_clear(const BitOp& bitop, size_t max)
 { return num_set(bitop, max) == 0; }
 
 TEST_CASE( "bitop", "[bitop]" )
index 765118da0edf8090372b51486e697850e06f5991..b2f5014c98bb8237f6d6a20a429ef1c4db0577fa 100644 (file)
@@ -286,7 +286,7 @@ public:
 IpsOption::EvalStatus Base64DataOption::eval(Cursor& c, Packet* p)
 {
     RuleProfile profile(base64PerfStats);
-    DataBuffer& base64_decode_buffer = DetectionEngine::get_alt_buffer(p);
+    const DataBuffer& base64_decode_buffer = DetectionEngine::get_alt_buffer(p);
 
     if ( !base64_decode_buffer.len )
         return NO_MATCH;
index 30183a6e7c5d2dadd3b79149888680e0fd70a9e3..378e60b187d08422bdeb1f8feef3548f18175d5b 100644 (file)
@@ -244,7 +244,7 @@ bool ContentOption::operator==(const IpsOption& ips) const
     if ( !IpsOption::operator==(ips) )
         return false;
 
-    ContentOption& rhs = (ContentOption&)ips;
+    const ContentOption& rhs = (const ContentOption&)ips;
     const ContentData& left = *config;
     const ContentData& right = *rhs.config;
 
index 0007dccf60d98db911e53b1eeb9540de9db43e7a..577b6dc09e802230663eda6ee93215bc65782c61 100644 (file)
@@ -123,7 +123,7 @@ static const PegInfo latency_pegs[] =
 // latency module
 // -----------------------------------------------------------------------------
 
-static inline bool latency_set(Value& v, PacketLatencyConfig& config)
+static inline bool latency_set(const Value& v, PacketLatencyConfig& config)
 {
     if ( v.is("max_time") )
     {
@@ -143,7 +143,7 @@ static inline bool latency_set(Value& v, PacketLatencyConfig& config)
     return true;
 }
 
-static inline bool latency_set(Value& v, RuleLatencyConfig& config)
+static inline bool latency_set(const Value& v, RuleLatencyConfig& config)
 {
     if ( v.is("max_time") )
     {
index b9cef01c05a261ae8518ae6e2f3b8aba0c40929c..58b3ef081f93f9b98faaa063f5c97c7d6dcd75cd 100644 (file)
@@ -623,7 +623,7 @@ SnortProtocolId AppInfoManager::add_appid_protocol_reference(const char* protoco
     return snort_protocol_id;
 }
 
-void AppInfoManager::init_appid_info_table(AppIdConfig& config,
+void AppInfoManager::init_appid_info_table(const AppIdConfig& config,
     SnortConfig* sc, OdpContext& odp_ctxt)
 {
     if (!config.app_detector_dir)
index 51b950b8c5f424a1c78c7107fcabf640e1d08bec..f3c0c53916f7a9b86cc0e5bf09bd018e6e37695f 100644 (file)
@@ -134,7 +134,7 @@ public:
         return entry ? entry->priority : 0;
     }
 
-    void init_appid_info_table(AppIdConfig&, snort::SnortConfig*, OdpContext& odp_ctxt);
+    void init_appid_info_table(const AppIdConfig&, snort::SnortConfig*, OdpContext& odp_ctxt);
     void cleanup_appid_info_table();
     void dump_app_info_table();
     SnortProtocolId add_appid_protocol_reference(const char* protocol, snort::SnortConfig*);
index e62c0538c7c0decb555aed8d0b3e220f68d71859..1fcd8141f0a03a3b85dc64c45ac57c8ff531fe25 100644 (file)
@@ -51,7 +51,7 @@ AppIdSession* AppIdApi::get_appid_session(const Flow& flow)
     return asd;
 }
 
-const char* AppIdApi::get_application_name(AppId app_id, AppIdContext& ctxt)
+const char* AppIdApi::get_application_name(AppId app_id, const AppIdContext& ctxt)
 {
     return ctxt.get_odp_ctxt().get_app_info_mgr().get_app_name(app_id);
 }
@@ -85,7 +85,7 @@ const char* AppIdApi::get_application_name(const Flow& flow, bool from_client)
     return app_name;
 }
 
-AppId AppIdApi::get_application_id(const char* appName, AppIdContext& ctxt)
+AppId AppIdApi::get_application_id(const char* appName, const AppIdContext& ctxt)
 {
     return ctxt.get_odp_ctxt().get_app_info_mgr().get_appid_by_name(appName);
 }
index 56472c16dcad9785cbb777ee4d904e91f145c8b8..1291f528081e1578187e3408554c6153e95a320f 100644 (file)
@@ -53,9 +53,9 @@ public:
     SO_PRIVATE AppIdApi() = default;
 
     AppIdSession* get_appid_session(const Flow& flow);
-    const char* get_application_name(AppId app_id, AppIdContext& ctxt);
+    const char* get_application_name(AppId app_id, const AppIdContext& ctxt);
     const char* get_application_name(const Flow& flow, bool from_client);
-    AppId get_application_id(const char* appName, AppIdContext& ctxt);
+    AppId get_application_id(const char* appName, const AppIdContext& ctxt);
     uint32_t produce_ha_state(const Flow& flow, uint8_t* buf);
     uint32_t consume_ha_state(Flow& flow, const uint8_t* buf, uint8_t length, IpProtocol,
         SfIp*, uint16_t initiatorPort);
index ce5b5ff8a2e3671e139513505f3a95e443e2908b..9ffb9c454cf5dcd761ca78cd156e765e49dc1c1d 100644 (file)
@@ -133,7 +133,7 @@ void AppIdContext::show() const
     config.show();
 }
 
-OdpContext::OdpContext(AppIdConfig& config, SnortConfig* sc)
+OdpContext::OdpContext(const AppIdConfig& config, SnortConfig* sc)
 {
     app_info_mgr.init_appid_info_table(config, sc, *this);
     client_pattern_detector = new PatternClientDetector(&client_disco_mgr);
index 8617fbcfb6f5d9cb5fe14b2df413a9e9318f0dfb..8b06d9f3c3a937d73b30dbbacef883c9a686f541 100644 (file)
@@ -101,7 +101,7 @@ public:
     uint16_t max_packet_before_service_fail = MIN_MAX_PKTS_BEFORE_SERVICE_FAIL;
     uint16_t max_packet_service_fail_ignore_bytes = MIN_MAX_PKT_BEFORE_SERVICE_FAIL_IGNORE_BYTES;
 
-    OdpContext(AppIdConfig&, snort::SnortConfig*);
+    OdpContext(const AppIdConfig&, snort::SnortConfig*);
     void initialize();
 
     AppInfoManager& get_app_info_mgr()
index b2043081e3055f446d6bbaa956fd1d03de9a9347..3f9633bcc3293145142864f33f0cedaac0e35c9d 100644 (file)
@@ -38,7 +38,7 @@ public:
         AppIdSession* asd = snort::appid_api.get_appid_session(*flow);
         if (!asd)
             return;
-        DataDecryptEvent& data_decrypt_event = static_cast<DataDecryptEvent&>(event);
+        const DataDecryptEvent& data_decrypt_event = static_cast<DataDecryptEvent&>(event);
         if (data_decrypt_event.get_type() == DataDecryptEvent::DATA_DECRYPT_MONITOR_EVENT)
         {
             asd->set_session_flags(APPID_SESSION_DECRYPT_MONITOR);
index 0d3590f7a3cbd8701b67e05c9d18d1265b41300a..5d3bdbd2257def29873829a0a4eedeb165948487 100644 (file)
@@ -251,7 +251,7 @@ static void update_stats(const AppIdSession& asd, AppId app_id, StatsBucket* buc
     }
 }
 
-void AppIdStatistics::update(AppIdSession& asd)
+void AppIdStatistics::update(const AppIdSession& asd)
 {
     time_t now = get_time();
 
index b45a6b0eebbe521b9778bbc329f5679fa72b1586..51faeb89cde95e33c6f11e66adb117fe64e555b1 100644 (file)
@@ -51,7 +51,7 @@ public:
     static AppIdStatistics* initialize_manager(const AppIdConfig&);
     static AppIdStatistics* get_stats_manager();
     static void cleanup();
-    void update(AppIdSession&);
+    void update(const AppIdSession&);
     void flush();
 
 private:
index 167d12351b5a99d0f5e5883ab18c9946bb8c51d2..adc53a230cd9f44c67303101a4065abe379b4f65 100644 (file)
@@ -431,7 +431,7 @@ int DnsValidator::dns_validate_answer(const uint8_t* data, uint16_t* offset, uin
 }
 
 int DnsValidator::dns_validate_header(const AppidSessionDirection dir, const DNSHeader* hdr,
-    bool host_reporting, AppIdSession& asd)
+    bool host_reporting, const AppIdSession& asd)
 {
     if (hdr->Opcode > MAX_OPCODE || hdr->Opcode == INVALID_OPCODE)
         return APPID_NOMATCH;
index c623c71f3a00e1e42dd36bb0b29ee34612c22d50..8ccecb20b8c61af36bfcf9e56d06e827485a0d4b 100644 (file)
@@ -41,7 +41,8 @@ public:
         uint16_t id, bool host_reporting, AppIdSession&);
     int dns_validate_answer(const uint8_t* data, uint16_t* offset, uint16_t size,
         uint16_t id, uint8_t rcode, bool host_reporting, AppIdSession&);
-    int dns_validate_header(const AppidSessionDirection dir, const DNSHeader*, bool host_reporting, AppIdSession&);
+    int dns_validate_header(const AppidSessionDirection dir, const DNSHeader*, bool host_reporting,
+        const AppIdSession&);
     int validate_packet(const uint8_t* data, uint16_t size, const int,
         bool host_reporting, AppIdSession&);
 };
index 855df582c7a99dd4feade697253b93c58ed5cf5a..27ac396b1ce1f010e54f864edca2e181c4c55e06 100644 (file)
@@ -220,7 +220,7 @@ void ServiceDiscovery::initialize()
 int ServiceDiscovery::add_service_port(AppIdDetector*, const ServiceDetectorPort&)
 { return 0; }
 
-OdpContext::OdpContext(AppIdConfig&, snort::SnortConfig*)
+OdpContext::OdpContext(const AppIdConfig&, snort::SnortConfig*)
 { }
 
 #endif
index 0e875be8b33f4afa6430f45f0741a77d9f16df02..08139d6095310ab64069eebf205e3d7ff12d2fa3 100644 (file)
@@ -35,7 +35,7 @@
 using namespace snort;
 
 HostPortVal* HostPortCache::find(const SfIp* ip, uint16_t port, IpProtocol protocol,
-    OdpContext& odp_ctxt)
+    const OdpContext& odp_ctxt)
 {
     HostPortKey hk;
 
@@ -60,7 +60,7 @@ bool HostPortCache::add(const SfIp* ip, uint16_t port, IpProtocol proto, unsigne
     hk.ip = *ip;
     AppIdInspector* inspector = (AppIdInspector*) InspectorManager::get_inspector(MOD_NAME);
     assert(inspector);
-    AppIdContext& ctxt = inspector->get_ctxt();
+    const AppIdContext& ctxt = inspector->get_ctxt();
     hk.port = (ctxt.get_odp_ctxt().allow_port_wildcard_host_cache)? 0 : port;
     hk.proto = proto;
 
index 864e477d6f072e0fe8ae97c51a0d87bb90437b6c..de49bce537c69b9440a4abb2c376c780b32ecf56 100644 (file)
@@ -63,7 +63,7 @@ struct HostPortVal
 class HostPortCache
 {
 public:
-    HostPortVal* find(const snort::SfIp*, uint16_t port, IpProtocol, OdpContext&);
+    HostPortVal* find(const snort::SfIp*, uint16_t port, IpProtocol, const OdpContext&);
     bool add(const snort::SfIp*, uint16_t port, IpProtocol, unsigned type, AppId);
     void dump();
 
index 40c0564797eb58dac499f5a71c1b4c3e481880cd..c7f49494f482e1674d2e2354e02de4e28e150110 100644 (file)
@@ -204,7 +204,7 @@ void ServiceDiscoveryState::set_service_id_valid(ServiceDetector*) { }
 static OdpContext stub_odp_ctxt(stub_config, nullptr);
 OdpContext* AppIdContext::odp_ctxt = &stub_odp_ctxt;
 
-OdpContext::OdpContext(AppIdConfig&, snort::SnortConfig*)
+OdpContext::OdpContext(const AppIdConfig&, snort::SnortConfig*)
 { }
 
 #endif
index 0f7c040a2afd2222f2d1ae032be869645ad21a93..dfbcf20714089e09f54ef597318b36d26ea1c401 100644 (file)
@@ -250,7 +250,7 @@ bool ClientDiscovery::do_client_discovery(AppIdSession&, Packet*,
 }
 
 // Stubs for misc items
-HostPortVal* HostPortCache::find(const SfIp*, uint16_t, IpProtocol, OdpContext&)
+HostPortVal* HostPortCache::find(const SfIp*, uint16_t, IpProtocol, const OdpContext&)
 {
     return nullptr;
 }
index ad24c4be61543df8f127d726caf76da0937d3e3a..6d4646cd8ddbab950b6588053974867c051b2827 100644 (file)
@@ -155,7 +155,7 @@ MemoryContext::~MemoryContext() { }
 void memory::MemoryCap::update_allocations(unsigned long) { }
 void memory::MemoryCap::update_deallocations(unsigned long) { }
 
-OdpContext::OdpContext(AppIdConfig&, snort::SnortConfig*) { }
+OdpContext::OdpContext(const AppIdConfig&, snort::SnortConfig*) { }
 AppIdConfig::~AppIdConfig() { }
 
 unsigned AppIdSession::inspector_id = 0;
index 91be114d75777105d1d4f103da8f1182d225c114..7f014b36e31eb6d92900d9361235a30d01875a9a 100644 (file)
@@ -71,7 +71,7 @@ public:
 };
 
 AppIdConfig::~AppIdConfig() { }
-OdpContext::OdpContext(AppIdConfig&, snort::SnortConfig*) { }
+OdpContext::OdpContext(const AppIdConfig&, snort::SnortConfig*) { }
 
 static AppIdConfig stub_config;
 static AppIdContext stub_ctxt(stub_config);
index 350a4b16b3db7bf2a26fb963f8f6fefe104bd268..1a427e9b06ca8c758ec8d54766fb30724e654624 100644 (file)
@@ -59,7 +59,7 @@ HttpPatternMatchers::~HttpPatternMatchers() { }
 SipPatternMatchers::~SipPatternMatchers() { }
 SslPatternMatchers::~SslPatternMatchers() { }
 AppIdConfig::~AppIdConfig() { }
-OdpContext::OdpContext(AppIdConfig&, snort::SnortConfig*) { }
+OdpContext::OdpContext(const AppIdConfig&, snort::SnortConfig*) { }
 void ServiceDiscovery::initialize() { }
 int ServiceDiscovery::add_service_port(AppIdDetector*, const ServiceDetectorPort&)
 { return 0; }
index 0f6cbebb2e24233631897edb07e7e811527a9e3b..521a5c1f00dc50cc774310e936133b4a60541e4f 100644 (file)
@@ -37,7 +37,7 @@ class ThirdPartyAppIdContext;
 class ThirdPartyAppIdSession
 {
 public:
-    ThirdPartyAppIdSession(ThirdPartyAppIdContext& ctxt)
+    ThirdPartyAppIdSession(const ThirdPartyAppIdContext& ctxt)
         : appid(APP_ID_NONE), confidence(100), state(TP_STATE_INIT), ctxt(ctxt) { }
     virtual ~ThirdPartyAppIdSession() { }
 
index 30335ac16c9c95bf57089faa073d4817d4687338..40d622585acd003af765b221c637ef8c2b79c0ec 100644 (file)
@@ -213,7 +213,7 @@ NormalizeModule::~NormalizeModule()
 ProfileStats* NormalizeModule::get_profile() const
 { return &norm_perf_stats; }
 
-bool NormalizeModule::set_ip4(const char*, Value& v, SnortConfig*)
+bool NormalizeModule::set_ip4(const char*, const Value& v, SnortConfig*)
 {
     if ( v.is("base") )
         Norm_Set(&config, NORM_IP4_BASE, v.get_bool());
@@ -236,7 +236,7 @@ bool NormalizeModule::set_ip4(const char*, Value& v, SnortConfig*)
     return true;
 }
 
-bool NormalizeModule::set_tcp(const char*, Value& v, SnortConfig*)
+bool NormalizeModule::set_tcp(const char*, const Value& v, SnortConfig*)
 {
     if ( v.is("base") )
     {
index 213c90ed28e3e9517a01bad316277659c3db9a44..8e185684f452a2e4664742b5365b04c2900a3276 100644 (file)
@@ -50,8 +50,8 @@ public:
     { return INSPECT; }
 
 private:
-    bool set_ip4(const char*, snort::Value&, snort::SnortConfig*);
-    bool set_tcp(const char*, snort::Value&, snort::SnortConfig*);
+    bool set_ip4(const char*, const snort::Value&, snort::SnortConfig*);
+    bool set_tcp(const char*, const snort::Value&, snort::SnortConfig*);
 
     void add_test_peg(const PegInfo&) const;
 
index a687227ca72185114667f832e818bd424840646f..c1a6f0b8c4195dd0f8f95d6b4f154408fb4dc026 100644 (file)
@@ -82,7 +82,7 @@ static const char* dce2_get_policy_name(DCE2_Policy policy)
     return policyStr;
 }
 
-bool dce2_set_common_config(Value& v, dce2CommonProtoConf& common)
+bool dce2_set_common_config(const Value& v, dce2CommonProtoConf& common)
 {
     if ( v.is("limit_alerts") )
         common.limit_alerts = v.get_bool();
@@ -99,7 +99,7 @@ bool dce2_set_common_config(Value& v, dce2CommonProtoConf& common)
     return true;
 }
 
-bool dce2_set_co_config(Value& v, dce2CoProtoConf& co)
+bool dce2_set_co_config(const Value& v, dce2CoProtoConf& co)
 {
     if (dce2_set_common_config(v, co.common))
         return true;
index 6b8bad3b5d1ad395f8f391e4f5f87144089ac8b2..90d8c19d84bc5ea10a31c945493088841252ca34 100644 (file)
@@ -395,9 +395,9 @@ inline void dce_alert(uint32_t gid, uint32_t sid, dce2CommonStats* stats, DCE2_S
     stats->events++;
 }
 
-bool dce2_set_common_config(snort::Value&, dce2CommonProtoConf&);
+bool dce2_set_common_config(const snort::Value&, dce2CommonProtoConf&);
 void print_dce2_common_config(const dce2CommonProtoConf&);
-bool dce2_set_co_config(snort::Value&, dce2CoProtoConf&);
+bool dce2_set_co_config(const snort::Value&, dce2CoProtoConf&);
 void print_dce2_co_config(const dce2CoProtoConf&);
 bool dce2_paf_abort(DCE2_SsnData*);
 void DCE2_Detect(DCE2_SsnData*);
index e6a58fe913ad273e5dda89164312d9c694c225fc..a4c61eef9832326ff5afb0288233b83e7dde9dfc 100644 (file)
@@ -61,7 +61,7 @@ void DceExpSsnManager::create_expected_session(const SfIp* ept_ip,
     DataBus::publish(DCERPC_EXP_SESSION_EVENT_KEY, map_resp_event, pkt->flow);
 }
 
-DceTcpExpSsnManager::DceTcpExpSsnManager(dce2TcpProtoConf& config) :
+DceTcpExpSsnManager::DceTcpExpSsnManager(const dce2TcpProtoConf& config) :
     DceExpSsnManager("dce-tcp", IpProtocol::TCP, PktType::TCP),
     pc(config) { }
 
index 0db9bd29ec766bae472c25514890ae1687814230..1da899102245b2c6a92134e69c2d2ba538a68282 100644 (file)
@@ -65,7 +65,7 @@ class DceTcpExpSsnManager : public DceExpSsnManager
 {
 public:
     DceTcpExpSsnManager() = delete;
-    DceTcpExpSsnManager(dce2TcpProtoConf&);
+    DceTcpExpSsnManager(const dce2TcpProtoConf&);
     DceTcpExpSsnManager(const DceTcpExpSsnManager&) = delete;
     DceTcpExpSsnManager& operator=(const DceTcpExpSsnManager&) =delete;
 
index 5e0335334be5a4786dcbec7c2d61322481a08dc3..a3d3cf65821d0c6ddac5706bf696e9018ad8b98f 100644 (file)
@@ -113,7 +113,7 @@ StreamSplitter::Status DceHttpProxySplitter::match_response_head(const uint8_t*
 
 /* match_request() is only used by the s2c splitter instance. */
 StreamSplitter::Status
-    DceHttpProxySplitter::match_response(const uint8_t* data, uint32_t& len)
+    DceHttpProxySplitter::match_response(const uint8_t* data, const uint32_t& len)
 {
     uint32_t starting_index = 0;
 
index abf1801d1d62ce94e0e721477ba75cf4703de19d..bb4abd41c99ddffb645e14d88668a7f16cfbb79a 100644 (file)
@@ -45,7 +45,7 @@ public:
 private:
     Status match_request_head(const uint8_t* data, uint32_t& len);
     Status match_response_head(const uint8_t* data, uint32_t& len);
-    Status match_response(const uint8_t* data, uint32_t& len);
+    Status match_response(const uint8_t* data, const uint32_t& len);
 
     enum DceHttpProxyState
     {
index de3cb008f64b075b2b62fa854c0242630e85d2de..73c532c05b8c4710c172385325d436ffcfc6dbf7 100644 (file)
@@ -232,7 +232,7 @@ bool HttpInspect::get_buf(unsigned id, Packet* p, InspectionBuffer& b)
 }
 
 const Field& HttpInspect::http_get_buf(Cursor& c, Packet* p,
-    HttpBufferInfo& buffer_info)
+    const HttpBufferInfo& buffer_info)
 {
     HttpMsgSection* current_section = HttpContextData::get_snapshot(p);
 
index 24e15e99ba7d7c2001fc6618cae3d5e51b2a98aa..cf5995567b173edff646e17c134d4c27ab9269e5 100644 (file)
@@ -47,7 +47,7 @@ public:
         snort::InspectionBuffer& b) override;
     bool get_buf(unsigned id, snort::Packet* p, snort::InspectionBuffer& b) override;
     const Field& http_get_buf(Cursor& c, snort::Packet* p,
-        HttpBufferInfo& buffer_info);
+        const HttpBufferInfo& buffer_info);
     bool get_fp_buf(snort::InspectionBuffer::Type ibt, snort::Packet* p,
         snort::InspectionBuffer& b) override;
     bool configure(snort::SnortConfig*) override;
index 43b4be6c5f92c7bfa15eac0503e38de4dfb61b1f..b403369a345ec8eb09f690884e02479249b67d1e 100644 (file)
@@ -156,7 +156,7 @@ const Field& HttpMsgSection::get_classic_buffer(unsigned id, uint64_t sub_id, ui
     return get_classic_buffer(c, buffer_info);
 }
 
-const Field& HttpMsgSection::get_classic_buffer(Cursor& c, HttpBufferInfo& buf)
+const Field& HttpMsgSection::get_classic_buffer(Cursor& c, const HttpBufferInfo& buf)
 {
     // buffer_side replaces source_id for buffers that support the request option
     const SourceId buffer_side = (buf.form & FORM_REQUEST) ? SRC_CLIENT : source_id;
index 97e698d89ae817ead46226de46fa1bd68f42e9cc..660d745115d4d2cc2d60419721a117405a5102eb 100644 (file)
@@ -67,7 +67,7 @@ public:
     virtual void update_flow() = 0;
 
     const Field& get_classic_buffer(unsigned id, uint64_t sub_id, uint64_t form);
-    const Field& get_classic_buffer(Cursor& c, HttpBufferInfo& buf);
+    const Field& get_classic_buffer(Cursor& c, const HttpBufferInfo& buf);
 
     HttpEnums::MethodId get_method_id() const { return method_id; }
 
index db3ec77aa878bbbbbeabd46c61950dba12918ffd..9c9026bb3a038f82d7730d5eb79b266c4964c0f2 100644 (file)
@@ -255,7 +255,7 @@ bool TcpStreamSession::check_alerted(Packet* p, uint32_t gid, uint32_t sid)
     if (!(p->packet_flags & PKT_REBUILT_STREAM))
         return false;
 
-    TcpStreamTracker& st = p->ptrs.ip_api.get_src()->equals(flow->client_ip) ? server : client;
+    const TcpStreamTracker& st = p->ptrs.ip_api.get_src()->equals(flow->client_ip) ? server : client;
     for (int i = 0; i < st.alert_count; i++)
     {
         /*  This is a rebuilt packet and if we've seen this alert before,
@@ -276,7 +276,7 @@ int TcpStreamSession::update_alert(Packet* p, uint32_t gid, uint32_t sid,
 
     for (unsigned i = 0; i < st.alert_count; i++)
     {
-        StreamAlertInfo* ai = st.alerts + i;
+        StreamAlertInfo* ai = &st.alerts[i];
 
         if (ai->gid == gid && ai->sid == sid && SEQ_EQ(ai->seq, seq_num))
         {