This debug message indicates that the expression has been evaluated
to said value. This message is mostly useful during debugging of the
client classification expressions.
+
+% EVAL_DEBUG_VENDOR_NO_OPTION Vendor option (code %1) missing, pushing result %2
+This debug message indicates that the expression has been evaluated
+and vendor option was not found. This message is mostly useful during
+debugging of the client classification expressions.
+
+% EVAL_DEBUG_VENDOR_ENTERPRISE_ID_MISMATCH Vendor option was found, but does not have expected enterprise-id (was looking for %1, option had %2), pushing result %3
+This debug message indicates that the expression has been evaluated
+and vendor option was found, but has different enterprise-id than specified
+in the expression. This message is mostly useful during debugging of the
+client classification expressions.
+
+% EVAL_DEBUG_VENDOR_ENTERPRISE_ID Vendor option found, pushing enterprise-id %1 as result %2
+This debug message indicates that the expression has been evaluated and vendor
+option was found and its enterprise-id is being reported. This message is mostly
+useful during debugging of the client classification expressions.
+
+% EVAL_DEBUG_VENDOR_EXISTS Vendor option exists, pushing result %1
+This debug message indicates that the expression has been evaluated and vendor
+option was found. This message is mostly useful during debugging of the client
+classification expressions.
+
+% EVAL_DEBUG_VENDOR_CLASS_NO_OPTION Vendor class option (code %1) missing, pushing result %2
+This debug message indicates that the expression has been evaluated
+and vendor class option was not found. This message is mostly useful during
+debugging of the client classification expressions.
+
+% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID_MISMATCH Vendor class option was found, but does not have expected enterprise-id (was looking for %1, option had %2), pushing result %3
+This debug message indicates that the expression has been evaluated
+and vendor class option was found, but has different enterprise-id than specified
+in the expression. This message is mostly useful during debugging of the
+client classification expressions.
+
+% EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID Vendor class option found, pushing enterprise-id %1 as result %2
+This debug message indicates that the expression has been evaluated and vendor
+class option was found and its enterprise-id is being reported. This message is mostly
+useful during debugging of the client classification expressions.
+
+% EVAL_DEBUG_VENDOR_CLASS_EXISTS Vendor class option exists, pushing result %1
+This debug message indicates that the expression has been evaluated and vendor
+class option was found. This message is mostly useful during debugging of the
+client classification expressions.
+
+% EVAL_DEBUG_VENDOR_CLASS_DATA Vendor class data %1 (out of %2 received) is pushed as %3
+This debug message indicates that vendor class option was found and passed
+enterprise-id checks and has sufficient number of data chunks. Total numer
+of chunks and value pushed are reported as debugging aid.
}
}
-void
+std::string
TokenOption::pushFailure(ValueStack& values) {
+ std::string txt;
if (representation_type_ == EXISTS) {
- values.push("false");
- } else {
- values.push("");
+ txt = "false";
}
+ values.push(txt);
+ return (txt);
}
TokenRelay4Option::TokenRelay4Option(const uint16_t option_code,
OptionVendorPtr vendor = boost::dynamic_pointer_cast<OptionVendor>(opt);
if (!vendor) {
// There's no vendor option, give up.
- pushFailure(values);
+ std::string txt = pushFailure(values);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_NO_OPTION)
+ .arg(code)
+ .arg(txt);
return;
}
if (vendor_id_ && (vendor_id_ != vendor->getVendorId())) {
// There is vendor option, but it has other vendor-id value
// than we're looking for. (0 means accept any vendor-id)
- pushFailure(values);
+ std::string txt = pushFailure(values);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_ENTERPRISE_ID_MISMATCH)
+ .arg(vendor_id_)
+ .arg(vendor->getVendorId())
+ .arg(txt);
return;
}
uint32_t value = htonl(vendor->getVendorId());
memcpy(&txt[0], &value, sizeof(uint32_t));
values.push(txt);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_ENTERPRISE_ID)
+ .arg(vendor_id_)
+ .arg(util::encode::encodeHex(std::vector<uint8_t>(txt.begin(),
+ txt.end())));
return;
}
case SUBOPTION:
case EXISTS:
// We already passed all the checks: the option is there and has specified
// enterprise-id.
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_EXISTS)
+ .arg("true");
values.push("true");
return;
case DATA:
OptionPtr opt = pkt.getOption(code);
OptionVendorClassPtr vendor = boost::dynamic_pointer_cast<OptionVendorClass>(opt);
if (!vendor) {
- // There's no vendor option, give up.
- pushFailure(values);
+ // There's no vendor class option, give up.
+ std::string txt = pushFailure(values);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_NO_OPTION)
+ .arg(code)
+ .arg(txt);
return;
}
if (vendor_id_ && (vendor_id_ != vendor->getVendorId())) {
// There is vendor option, but it has other vendor-id value
// than we're looking for. (0 means accept any vendor-id)
- pushFailure(values);
+ std::string txt = pushFailure(values);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID_MISMATCH)
+ .arg(vendor_id_)
+ .arg(vendor->getVendorId())
+ .arg(txt);
return;
}
uint32_t value = htonl(vendor->getVendorId());
memcpy(&txt[0], &value, sizeof(uint32_t));
values.push(txt);
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_ENTERPRISE_ID)
+ .arg(vendor_id_)
+ .arg(util::encode::encodeHex(std::vector<uint8_t>(txt.begin(),
+ txt.end())));
return;
}
case SUBOPTION:
case EXISTS:
// We already passed all the checks: the option is there and has specified
// enterprise-id.
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_EXISTS)
+ .arg("true");
values.push("true");
return;
case DATA:
OpaqueDataTuple tuple = vendor->getTuple(index_);
OpaqueDataTuple::Buffer buf = tuple.getData();
string txt(buf.begin(), buf.end());
+
+ LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_DATA)
+ .arg(index_)
+ .arg(max)
+ .arg(util::encode::encodeHex(buf));
+
values.push(txt);
return;
}
/// Depending on the representation type, this is either "" or "false".
///
/// @param values a string representing failure will be pushed here.
- virtual void pushFailure(ValueStack& values);
+ /// @return value pushed
+ virtual std::string pushFailure(ValueStack& values);
uint16_t option_code_; ///< Code of the option to be extracted
RepresentationType representation_type_; ///< Representation type.