return d_eco.isWellFormed();
}
-bool DNSPacket::hasValidEDNSCookie()
+bool DNSPacket::hasValidEDNSCookie() const
{
if (!hasWellFormedEDNSCookie()) {
return false;
bool hasEDNS() const;
bool hasEDNSCookie() const;
bool hasWellFormedEDNSCookie() const;
- bool hasValidEDNSCookie(); // Not const, some cookie params might be set
+ bool hasValidEDNSCookie() const;
uint8_t getEDNSVersion() const { return d_ednsversion; };
void setEDNSRcode(uint16_t extRCode)
{
}
}
-bool EDNSCookiesOpt::isValid(const string& secret, const ComboAddress& source)
+bool EDNSCookiesOpt::isValid(const string& secret, const ComboAddress& source) const
{
#ifdef HAVE_CRYPTO_SHORTHASH
if (server.length() != 16 || client.length() != 8) {
#endif
}
-bool EDNSCookiesOpt::shouldRefresh()
+bool EDNSCookiesOpt::shouldRefresh() const
{
if (server.size() < 16) {
return true;
client.size() == 8 && (server.size() == 0 || (server.size() >= 8 && server.size() <= 32)));
}
- bool isValid(const string& secret, const ComboAddress& source);
+ bool isValid(const string& secret, const ComboAddress& source) const;
bool makeServerCookie(const string& secret, const ComboAddress& source);
string makeOptString() const;
string getServer() const
}
private:
- bool shouldRefresh();
+ bool shouldRefresh() const;
// the client cookie
string client;
// the server cookie
string server;
- // Checks if the server cookie is correct
- // 1. Checks the sizes of the client and server cookie
- // 2. checks if the timestamp is still good (now - 3600 < ts < now + 300)
- // 3. Whether or not the hash is correct
- bool check(const string& secret, const ComboAddress& source);
-
void getEDNSCookiesOptFromString(const char* option, unsigned int len);
};