("Bad/missing Server Cookie")
;
-std::string RCode::to_s(unsigned short rcode) {
+std::string RCode::to_s(uint8_t rcode) {
if (rcode > RCode::rcodes_s.size()-1 )
return std::string("Err#")+std::to_string(rcode);
return RCode::rcodes_s[rcode];
}
-std::string ERCode::to_s(unsigned short rcode) {
+std::string ERCode::to_s(uint8_t rcode) {
return RCode::to_s(rcode);
}
{
public:
enum rcodes_ { NoError=0, FormErr=1, ServFail=2, NXDomain=3, NotImp=4, Refused=5, YXDomain=6, YXRRSet=7, NXRRSet=8, NotAuth=9, NotZone=10};
- static std::string to_s(unsigned short rcode);
+ static std::string to_s(uint8_t rcode);
static std::vector<std::string> rcodes_s;
};
{
public:
enum rcodes_ { BADVERS=16, BADSIG=16, BADKEY=17, BADTIME=18, BADMODE=19, BADNAME=20, BADALG=21, BADTRUNC=22, BADCOOKIE=23 };
- static std::string to_s(unsigned short rcode);
+ static std::string to_s(uint8_t rcode);
};
class Opcode
class RCodeAction : public DNSAction
{
public:
- RCodeAction(int rcode) : d_rcode(rcode) {}
+ RCodeAction(uint8_t rcode) : d_rcode(rcode) {}
DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
{
dq->dh->rcode = d_rcode;
}
private:
- int d_rcode;
+ uint8_t d_rcode;
};
class TCAction : public DNSAction
return std::shared_ptr<DNSAction>(new LogAction(fname, binary ? *binary : true, append ? *append : false, buffered ? *buffered : false));
});
- g_lua.writeFunction("RCodeAction", [](int rcode) {
+ g_lua.writeFunction("RCodeAction", [](uint8_t rcode) {
return std::shared_ptr<DNSAction>(new RCodeAction(rcode));
});
class RCodeRule : public DNSRule
{
public:
- RCodeRule(int rcode) : d_rcode(rcode)
+ RCodeRule(uint8_t rcode) : d_rcode(rcode)
{
}
bool matches(const DNSQuestion* dq) const override
return "rcode=="+RCode::to_s(d_rcode);
}
private:
- int d_rcode;
+ uint8_t d_rcode;
};
class ERCodeRule : public DNSRule
{
public:
- ERCodeRule(int rcode) : d_rcode(rcode & 0xF), d_extrcode(rcode >> 4)
+ ERCodeRule(uint8_t rcode) : d_rcode(rcode & 0xF), d_extrcode(rcode >> 4)
{
}
bool matches(const DNSQuestion* dq) const override
return "ercode=="+ERCode::to_s(d_rcode | (d_extrcode << 4));
}
private:
- int d_rcode; // plain DNS Rcode
- int d_extrcode; // upper bits in EDNS0 record
+ uint8_t d_rcode; // plain DNS Rcode
+ uint8_t d_extrcode; // upper bits in EDNS0 record
};
class RDRule : public DNSRule
return std::shared_ptr<DNSRule>(new QNameWireLengthRule(min, max));
});
- g_lua.writeFunction("RCodeRule", [](int rcode) {
+ g_lua.writeFunction("RCodeRule", [](uint8_t rcode) {
return std::shared_ptr<DNSRule>(new RCodeRule(rcode));
});
- g_lua.writeFunction("ERCodeRule", [](int rcode) {
+ g_lua.writeFunction("ERCodeRule", [](uint8_t rcode) {
return std::shared_ptr<DNSRule>(new ERCodeRule(rcode));
});