]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
added const qualifiers to OptTreeNode structs in fp_detect
authorJoel Cornett <joel.cornett@gmail.com>
Thu, 27 Aug 2015 20:06:04 +0000 (16:06 -0400)
committerJoel Cornett <joel.cornett@gmail.com>
Thu, 27 Aug 2015 20:06:04 +0000 (16:06 -0400)
15 files changed:
src/actions/actions.cc
src/actions/actions.h
src/detection/detection_util.cc
src/detection/detection_util.h
src/detection/fp_detect.cc
src/detection/fp_detect.h
src/detection/tag.cc
src/detection/tag.h
src/detection/treenodes.cc
src/detection/treenodes.h
src/events/event_queue.cc
src/events/event_queue.h
src/filters/rate_filter.cc
src/filters/rate_filter.h
src/network_inspectors/perf_monitor/perf_base.h

index d656eeab902cc6d49662081b8a5cb948bdf3340d..db99ab0807ee18320a7d3fd6f1b008197bec82be 100644 (file)
@@ -101,7 +101,8 @@ RuleType get_action_type(const char* s)
     return RULE_TYPE__NONE;
 }
 
-void action_execute(RuleType action, Packet* p, OptTreeNode* otn, uint16_t event_id)
+void action_execute(RuleType action, Packet* p, const OptTreeNode* otn,
+    uint16_t event_id)
 {
     switch (action)
     {
index 189ed61b8d9c1bbc68fee22b8be887d5a94d165f..11e686e446d74e2cf984764fca2b8fe664d5cebd 100644 (file)
@@ -50,7 +50,9 @@ enum RuleType
 const char* get_action_string(RuleType);
 RuleType get_action_type(const char*);
 
-void action_execute(RuleType, struct Packet*, struct OptTreeNode*, uint16_t event_id);
+void action_execute(RuleType, struct Packet*, const struct OptTreeNode*,
+    uint16_t event_id);
+
 void action_apply(RuleType, struct Packet*);
 
 static inline bool pass_action(RuleType a)
index d49fcc8eac092aa3b34adafa8b495acc06e3de1a..99da64f51bbb4773843eb930d04cf8868d65bd84 100644 (file)
@@ -84,7 +84,7 @@ static void LogBuffer(const char* s, const uint8_t* p, unsigned n)
     }
 }
 
-void EventTrace_Log(const Packet* p, OptTreeNode* otn, int action)
+void EventTrace_Log(const Packet* p, const OptTreeNode* otn, int action)
 {
     const char* acts = get_action_string((RuleType)action);
 
index 0eb700f932b79c3ee5f5ed60cfdb527eceb811d9..33a0281356d46db223b87562d6217bbcf1d977cf 100644 (file)
@@ -95,7 +95,7 @@ static inline void set_file_data(uint8_t* p, unsigned n)
 void EventTrace_Init(void);
 void EventTrace_Term(void);
 
-void EventTrace_Log(const Packet*, OptTreeNode*, int action);
+void EventTrace_Log(const Packet*, const OptTreeNode*, int action);
 
 static inline int EventTrace_IsEnabled(void)
 {
index d098a9c31a62f713fcbe1aa34cc8b6ce71d7ab06..69217e7f443f7d402941652a247fef47678eb7da 100644 (file)
@@ -57,8 +57,8 @@
 #include "framework/inspector.h"
 #include "framework/ips_action.h"
 #include "framework/mpse.h"
-#include "perf_monitor/perf.h"
-#include "perf_monitor/perf_event.h"
+#include "network_inspectors/perf_monitor/perf.h"
+#include "network_inspectors/perf_monitor/perf_event.h"
 #include "filters/sfthreshold.h"
 #include "filters/rate_filter.h"
 #include "events/event_wrapper.h"
@@ -135,7 +135,7 @@ static inline void InitMatchInfo(OTNX_MATCH_DATA* o)
 // called by fpLogEvent(), which does the filtering etc.
 // this handles the non-rule-actions (responses).
 static inline void fpLogOther(
-    Packet* p, RuleTreeNode* rtn, OptTreeNode* otn, int action)
+    Packet* p, const RuleTreeNode* rtn, const OptTreeNode* otn, int action)
 {
     if ( EventTrace_IsEnabled() )
         EventTrace_Log(p, otn, action);
@@ -154,7 +154,7 @@ static inline void fpLogOther(
 **    function was pulled out of fpEvalSomething, so now we can log an
 **    event no matter where we are.
 */
-int fpLogEvent(RuleTreeNode* rtn, OptTreeNode* otn, Packet* p)
+int fpLogEvent(const RuleTreeNode* rtn, const OptTreeNode* otn, Packet* p)
 {
     int action = -1, rateAction = -1;
     int override, filterEvent = 0;
@@ -280,7 +280,7 @@ int fpLogEvent(RuleTreeNode* rtn, OptTreeNode* otn, Packet* p)
 **    int - 1 max_events variable hit, 0 successful.
 **
 */
-int fpAddMatch(OTNX_MATCH_DATA* omd_local, int pLen, OptTreeNode* otn)
+int fpAddMatch(OTNX_MATCH_DATA* omd_local, int pLen, const OptTreeNode* otn)
 {
     MATCH_INFO* pmi;
     int evalIndex;
@@ -643,7 +643,7 @@ static int sortOrderByContentLength(const void* e1, const void* e2)
 **          1 if flagged
 **
 */
-static inline int fpAddSessionAlert(Packet* p, OptTreeNode* otn)
+static inline int fpAddSessionAlert(Packet* p, const OptTreeNode* otn)
 {
     if ( !p->flow )
         return 0;
@@ -673,9 +673,9 @@ static inline int fpAddSessionAlert(Packet* p, OptTreeNode* otn)
 **          1 if alert previously generated
 **
 */
-static inline int fpSessionAlerted(Packet* p, OptTreeNode* otn)
+static inline int fpSessionAlerted(Packet* p, const OptTreeNode* otn)
 {
-    SigInfo* si = &otn->sigInfo;
+    const SigInfo* si = &otn->sigInfo;
 
     if (!stream.check_session_alerted(p->flow, p, si->generator, si->id))
         return 0;
@@ -761,7 +761,7 @@ static inline int fpFinalSelectEvent(OTNX_MATCH_DATA* o, Packet* p)
     int i;
     int j;
     int k;
-    OptTreeNode* otn;
+    const OptTreeNode* otn;
     int tcnt = 0;
     EventQueueConfig* eq = snort_conf->event_queue_config;
     RuleTreeNode* rtn;
index 0e7b26a08e7fe6e93979b29894ee35add3c1055d..cbd23edd6942cef0cbef4ead9431d0237f15f6ea 100644 (file)
@@ -54,7 +54,7 @@ extern THREAD_LOCAL ProfileStats ruleOTNEvalPerfStats;
 */
 int fpEvalPacket(Packet* p);
 
-int fpLogEvent(RuleTreeNode* rtn, OptTreeNode* otn, Packet* p);
+int fpLogEvent(const RuleTreeNode* rtn, const OptTreeNode* otn, Packet* p);
 int fpEvalRTN(RuleTreeNode* rtn, Packet* p, int check_ports);
 
 /*
@@ -72,7 +72,7 @@ int fpEvalRTN(RuleTreeNode* rtn, Packet* p, int check_ports);
 */
 struct MATCH_INFO
 {
-    OptTreeNode* MatchArray[MAX_EVENT_MATCH];
+    const OptTreeNode* MatchArray[MAX_EVENT_MATCH];
     int iMatchCount;
     int iMatchIndex;
     int iMatchMaxLen;
@@ -100,7 +100,7 @@ struct OTNX_MATCH_DATA
 void otnx_match_data_init(int);
 void otnx_match_data_term();
 
-int fpAddMatch(OTNX_MATCH_DATA* omd_local, int pLen, OptTreeNode* otn);
+int fpAddMatch(OTNX_MATCH_DATA* omd_local, int pLen, const OptTreeNode* otn);
 OptTreeNode* GetOTN(uint32_t gid, uint32_t sid);
 
 /* counter for number of times we evaluate rules.  Used to
index 2e963899235de58c06598d615402a5fe67514b0f..e4e6c92177c1ef410eb2df8984120d78aebaeb97 100644 (file)
@@ -689,7 +689,7 @@ static int PruneTime(SFXHASH* tree, uint32_t thetime)
     return pruned;
 }
 
-void SetTags(Packet* p, OptTreeNode* otn, uint16_t event_id)
+void SetTags(Packet* p, const OptTreeNode* otn, uint16_t event_id)
 {
     DebugMessage(DEBUG_FLOW, "Setting tags\n");
 
index b501753722a6e83704159f81e55c02214deb6a4e..552a8a9a1b44739dfbbac3d128a0e0e782016069 100644 (file)
@@ -57,7 +57,7 @@ struct TagData
 void InitTag(void);
 void CleanupTag(void);
 int CheckTagList(Packet*, Event*, void**);
-void SetTags(Packet*, OptTreeNode*, uint16_t);
+void SetTags(Packet*, const OptTreeNode*, uint16_t);
 void TagCacheReset(void);
 
 #endif /* TAG_H */
index fe5cd8b5bc622b5ecba76d0b48a204d417a9edff..88551823bd37cdb12f233c5dfefd583dc2cebe93 100644 (file)
@@ -86,7 +86,7 @@ bool otn_set_agent(OptTreeNode* otn, IpsOption* opt)
     return true;
 }
 
-void otn_trigger_actions(OptTreeNode* otn, Packet* p)
+void otn_trigger_actions(const OptTreeNode* otn, Packet* p)
 {
     if ( otn->agent )
         otn->agent->action(p);
index def8b356f06a9c01de9fe38fa45e54ab981b5f07..70c78608cf7ee1fcae73d340b1cd3f12897d289c 100644 (file)
@@ -177,7 +177,7 @@ static inline void otn_set_plugin(OptTreeNode* otn, int id)
 
 bool otn_set_agent(OptTreeNode*, IpsOption*);
 
-void otn_trigger_actions(OptTreeNode*, Packet*);
+void otn_trigger_actions(const OptTreeNode*, Packet*);
 
 #endif
 
index 34cb5a3fc9b8a7aad4368f9c57facb778a929ea2..0e86d834f1ecddd63e2de06432c2d60b2a46d9dc 100644 (file)
@@ -121,7 +121,7 @@ void EventQueueConfigFree(EventQueueConfig* eqc)
 
 // Return 0 if no OTN since -1 return indicates queue limit reached. See
 // fpFinalSelectEvent()
-int SnortEventqAdd(OptTreeNode* otn)
+int SnortEventqAdd(const OptTreeNode* otn)
 {
     RuleTreeNode* rtn = getRtnFromOtn(otn);
 
index dae79eb0590163b07520d6d13b16a1eb3b76c96c..3591646d12c62abb538e074385ff1b4cb56abc10 100644 (file)
@@ -39,8 +39,8 @@ struct EventQueueConfig
 
 struct EventNode
 {
-    struct OptTreeNode* otn;
-    struct RuleTreeNode* rtn;
+    const struct OptTreeNode* otn;
+    const struct RuleTreeNode* rtn;
     RuleType type;
 };
 
@@ -54,7 +54,7 @@ void SnortEventqReset(void);
 void SnortEventqResetCounts(void);
 
 SO_PUBLIC int SnortEventqLog(struct Packet*);
-SO_PUBLIC int SnortEventqAdd(struct OptTreeNode*);
+SO_PUBLIC int SnortEventqAdd(const struct OptTreeNode*);
 SO_PUBLIC int SnortEventqAdd(uint32_t gid, uint32_t sid, RuleType = RULE_TYPE__NONE);
 SO_PUBLIC bool event_is_enabled(uint32_t gid, uint32_t sid);
 
index a82d5f53fd8c316c506a0baebdd3123b967b20ed..cd6aad94111191bfaa750c7738c365534bf1ca22 100644 (file)
@@ -115,7 +115,7 @@ int RateFilter_Create(
             0 - rate threshold not reached
 */
 int RateFilter_Test(
-    OptTreeNode* otn,
+    const OptTreeNode* otn,
     Packet* p)
 {
     unsigned gid = otn->sigInfo.generator;
index 61adf5330598103b931c6cbefe745ca6930fd553..1f168d5bc3930652d4dd54e32b1a39497979b2db 100644 (file)
@@ -38,7 +38,7 @@ struct SnortConfig;
 int RateFilter_Create(SnortConfig* sc, RateFilterConfig*, tSFRFConfigNode*);
 void RateFilter_PrintConfig(RateFilterConfig*);
 
-int RateFilter_Test(OptTreeNode*, Packet*);
+int RateFilter_Test(const OptTreeNode*, Packet*);
 void RateFilter_ResetActive(void);
 
 #endif
index d59e801c7224e5a2b314dd04ac84dd0ce5d6fab2..3cc5fccb91b56d28d1df6f1d03370080e0b752c9 100644 (file)
@@ -34,7 +34,7 @@
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
 #include "protocols/packet.h"
-#include "normalize/normalize.h"
+#include "network_inspectors/normalize/normalize.h"
 #include "sfprocpidstats.h"
 
 #include <time.h>