diff --git a/doc/4.3-object-types.md b/doc/4.3-object-types.md index 70cdf8a17..1e03e9076 100644 --- a/doc/4.3-object-types.md +++ b/doc/4.3-object-types.md @@ -582,7 +582,9 @@ Data Categories: DbCatRetention | Retention data DbCatStateHistory | Historical state data -Multiple categories can be combined using the `|` operator. +Multiple categories can be combined using the `|` operator. In addition to +the category flags listed above the `DbCatEverything` flag may be used as +a shortcut for listing all flags. ### IdoPgSqlConnection @@ -664,7 +666,9 @@ Data Categories: DbCatRetention | Retention data DbCatStateHistory | Historical state data -Multiple categories can be combined using the `|` operator. +Multiple categories can be combined using the `|` operator. In addition to +the category flags listed above the `DbCatEverything` flag may be used as +a shortcut for listing all flags. ### LiveStatusListener diff --git a/itl/constants.conf b/itl/constants.conf index 289765519..9bea23778 100644 --- a/itl/constants.conf +++ b/itl/constants.conf @@ -81,3 +81,4 @@ set DbCatProgramStatus = (1 << 11) set DbCatRetention = (1 << 12) set DbCatStateHistory = (1 << 13) +set DbCatEverything = (~0) diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 87c9fc02a..19f12564f 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -30,7 +30,7 @@ AExpression::AExpression(AOperator op, const AValue& operand1) AExpression::AExpression(AOperator op, const AValue& operand1, const AValue& operand2) : m_Operator(op), m_Operand1(operand1), m_Operand2(operand2) { - ASSERT(op == AEAdd || op == AESubtract || op == AEMultiply || op == AEDivide || + ASSERT(op == AEAdd || op == AENegate || op == AESubtract || op == AEMultiply || op == AEDivide || op == AEBinaryAnd || op == AEBinaryOr || op == AEShiftLeft || op == AEShiftRight); } @@ -44,6 +44,8 @@ Value AExpression::Evaluate(const Object::Ptr& thisRef) const switch (m_Operator) { case AEReturn: return left; + case AENegate: + return ~(long)left; case AEAdd: if (left.GetType() == ValueString || right.GetType() == ValueString) return (String)left + (String)right; diff --git a/lib/config/aexpression.h b/lib/config/aexpression.h index e9382aa2c..46258ab54 100644 --- a/lib/config/aexpression.h +++ b/lib/config/aexpression.h @@ -33,6 +33,7 @@ namespace icinga enum AOperator { AEReturn, + AENegate, AEAdd, AESubtract, AEMultiply, diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 7886bcdf3..3d0b25ec1 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -555,6 +555,10 @@ aexpression: T_STRING $$ = new Value(make_shared(AEReturn, AValue(ATVariable, $1))); free($1); } + | '~' aexpression + { + $$ = new Value(make_shared(AENegate, static_cast(*$2))); + } | aexpression '+' aexpression { $$ = new Value(make_shared(AEAdd, static_cast(*$1), static_cast(*$3)));