1313 *
1414 */
1515
16- #ifdef __cplusplus
17- #include < stack>
18- #include < vector>
19- #include < string>
20- #include < list>
21- #include < cstring>
22- #endif
23-
2416#ifndef HEADERS_MODSECURITY_RULE_MESSAGE_H_
2517#define HEADERS_MODSECURITY_RULE_MESSAGE_H_
2618
3123
3224#ifdef __cplusplus
3325
34- namespace modsecurity {
26+ #include < string>
27+ #include < list>
3528
29+ namespace modsecurity {
3630
3731
3832class RuleMessage {
@@ -45,43 +39,51 @@ class RuleMessage {
4539 RuleMessage (const RuleWithActions &rule, const Transaction &trans) :
4640 m_rule (rule),
4741 m_transaction (trans)
48- { }
42+ {
43+ reset (true );
44+ }
4945
5046 RuleMessage (const RuleMessage &ruleMessage) = default ;
5147 RuleMessage &operator =(const RuleMessage &ruleMessage) = delete ;
5248
53- void clean () {
54- m_data = " " ;
55- m_match = " " ;
49+ void reset ( const bool resetSaveMessage)
50+ {
51+ m_data. clear () ;
5652 m_isDisruptive = false ;
57- m_reference = " " ;
53+ m_match.clear ();
54+ m_message.clear ();
55+ m_noAuditLog = false ;
56+ m_reference.clear ();
57+ if (resetSaveMessage == true )
58+ m_saveMessage = true ;
5859 m_severity = 0 ;
60+ m_tags.clear ();
5961 }
6062
61- std::string log () {
62- return log (this , 0 );
63+ std::string log () const {
64+ return log (* this , 0 );
6365 }
64- std::string log (int props) {
65- return log (this , props);
66+ std::string log (int props) const {
67+ return log (* this , props);
6668 }
67- std::string log (int props, int responseCode) {
68- return log (this , props, responseCode);
69+ std::string log (int props, int responseCode) const {
70+ return log (* this , props, responseCode);
6971 }
70- std::string errorLog () {
71- return log (this ,
72- ClientLogMessageInfo | ErrorLogTailLogMessageInfo);
72+ std::string errorLog () const {
73+ return log (* this ,
74+ ClientLogMessageInfo | ErrorLogTailLogMessageInfo);
7375 }
7476
75- static std::string log (const RuleMessage * rm, int props, int code);
76- static std::string log (const RuleMessage * rm, int props) {
77+ static std::string log (const RuleMessage & rm, int props, int code);
78+ static std::string log (const RuleMessage & rm, int props) {
7779 return log (rm, props, -1 );
7880 }
79- static std::string log (const RuleMessage * rm) {
81+ static std::string log (const RuleMessage & rm) {
8082 return log (rm, 0 );
8183 }
8284
83- static std::string _details (const RuleMessage * rm);
84- static std::string _errorLogTail (const RuleMessage * rm);
85+ static std::string _details (const RuleMessage & rm);
86+ static std::string _errorLogTail (const RuleMessage & rm);
8587
8688 int getPhase () const { return m_rule.getPhase () - 1 ; }
8789
0 commit comments