return res;
}
-int DNSCryptContext::encryptQuery(char* query, uint16_t queryLen, uint16_t querySize, const unsigned char clientPublicKey[DNSCRYPT_PUBLIC_KEY_SIZE], const DNSCryptPrivateKey& clientPrivateKey, const unsigned char clientNonce[DNSCRYPT_NONCE_SIZE / 2], bool tcp, uint16_t* encryptedResponseLen, const std::shared_ptr<DNSCryptCert> cert) const
+int DNSCryptContext::encryptQuery(char* query, uint16_t queryLen, uint16_t querySize, const unsigned char clientPublicKey[DNSCRYPT_PUBLIC_KEY_SIZE], const DNSCryptPrivateKey& clientPrivateKey, const unsigned char clientNonce[DNSCRYPT_NONCE_SIZE / 2], bool tcp, uint16_t* encryptedResponseLen, const std::shared_ptr<DNSCryptCert>& cert) const
{
assert(query != nullptr);
assert(queryLen > 0);
class DNSCryptQuery
{
public:
- DNSCryptQuery(std::shared_ptr<DNSCryptContext> ctx): d_ctx(ctx)
+ DNSCryptQuery(const std::shared_ptr<DNSCryptContext>& ctx): d_ctx(ctx)
{
}
~DNSCryptQuery();
return d_encrypted;
}
- void setCertificatePair(std::shared_ptr<DNSCryptCertificatePair> pair)
+ void setCertificatePair(const std::shared_ptr<DNSCryptCertificatePair>& pair)
{
d_pair = pair;
}
std::shared_ptr<DNSCryptCertificatePair> d_pair{nullptr};
uint16_t d_id{0};
uint16_t d_len{0};
- uint16_t d_paddedLen;
+ uint16_t d_paddedLen{0};
bool d_encrypted{false};
bool d_valid{false};
std::vector<std::shared_ptr<DNSCryptCertificatePair>> getCertificates() { return certs; };
const DNSName& getProviderName() const { return providerName; }
- int encryptQuery(char* query, uint16_t queryLen, uint16_t querySize, const unsigned char clientPublicKey[DNSCRYPT_PUBLIC_KEY_SIZE], const DNSCryptPrivateKey& clientPrivateKey, const unsigned char clientNonce[DNSCRYPT_NONCE_SIZE / 2], bool tcp, uint16_t* encryptedResponseLen, const std::shared_ptr<DNSCryptCert> cert) const;
+ int encryptQuery(char* query, uint16_t queryLen, uint16_t querySize, const unsigned char clientPublicKey[DNSCRYPT_PUBLIC_KEY_SIZE], const DNSCryptPrivateKey& clientPrivateKey, const unsigned char clientNonce[DNSCRYPT_NONCE_SIZE / 2], bool tcp, uint16_t* encryptedResponseLen, const std::shared_ptr<DNSCryptCert>& cert) const;
bool magicMatchesAPublicKey(DNSCryptQuery& query, time_t now);
void getCertificateResponse(time_t now, const DNSName& qname, uint16_t qid, std::vector<uint8_t>& response);
class DynBPFFilter
{
public:
- DynBPFFilter(std::shared_ptr<BPFFilter> bpf): d_bpf(bpf)
+ DynBPFFilter(std::shared_ptr<BPFFilter>& bpf): d_bpf(bpf)
{
}
~DynBPFFilter()
class DnstapLogAction : public DNSAction, public boost::noncopyable
{
public:
- DnstapLogAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface> logger, boost::optional<std::function<void(const DNSQuestion&, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
+ DnstapLogAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(const DNSQuestion&, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
{
}
DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
class RemoteLogAction : public DNSAction, public boost::noncopyable
{
public:
- RemoteLogAction(std::shared_ptr<RemoteLoggerInterface> logger, boost::optional<std::function<void(const DNSQuestion&, DNSDistProtoBufMessage*)> > alterFunc): d_logger(logger), d_alterFunc(alterFunc)
+ RemoteLogAction(std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(const DNSQuestion&, DNSDistProtoBufMessage*)> > alterFunc): d_logger(logger), d_alterFunc(alterFunc)
{
}
DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
class TagAction : public DNSAction
{
public:
- TagAction(const std::string tag, const std::string value): d_tag(tag), d_value(value)
+ TagAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
{
}
DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
class DnstapLogResponseAction : public DNSResponseAction, public boost::noncopyable
{
public:
- DnstapLogResponseAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface> logger, boost::optional<std::function<void(const DNSResponse&, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
+ DnstapLogResponseAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(const DNSResponse&, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
{
}
DNSResponseAction::Action operator()(DNSResponse* dr, string* ruleresult) const override
class RemoteLogResponseAction : public DNSResponseAction, public boost::noncopyable
{
public:
- RemoteLogResponseAction(std::shared_ptr<RemoteLoggerInterface> logger, boost::optional<std::function<void(const DNSResponse&, DNSDistProtoBufMessage*)> > alterFunc, bool includeCNAME): d_logger(logger), d_alterFunc(alterFunc), d_includeCNAME(includeCNAME)
+ RemoteLogResponseAction(std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(const DNSResponse&, DNSDistProtoBufMessage*)> > alterFunc, bool includeCNAME): d_logger(logger), d_alterFunc(alterFunc), d_includeCNAME(includeCNAME)
{
}
DNSResponseAction::Action operator()(DNSResponse* dr, string* ruleresult) const override
class TagResponseAction : public DNSResponseAction
{
public:
- TagResponseAction(const std::string tag, const std::string value): d_tag(tag), d_value(value)
+ TagResponseAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
{
}
DNSResponseAction::Action operator()(DNSResponse* dr, string* ruleresult) const override
class TagRule : public DNSRule
{
public:
- TagRule(std::string tag, boost::optional<std::string> value) : d_value(value), d_tag(tag)
+ TagRule(const std::string& tag, boost::optional<std::string> value) : d_value(value), d_tag(tag)
{
}
bool matches(const DNSQuestion* dq) const override
{
public:
typedef std::function<std::tuple<int, boost::optional<string> >(DNSQuestion* dq)> func_t;
- LuaAction(LuaAction::func_t func) : d_func(func)
+ LuaAction(LuaAction::func_t& func) : d_func(func)
{}
Action operator()(DNSQuestion* dq, string* ruleresult) const override;
string toString() const override
{
public:
typedef std::function<std::tuple<int, boost::optional<string> >(DNSResponse* dr)> func_t;
- LuaResponseAction(LuaResponseAction::func_t func) : d_func(func)
+ LuaResponseAction(LuaResponseAction::func_t& func) : d_func(func)
{}
Action operator()(DNSResponse* dr, string* ruleresult) const override;
string toString() const override
}
#endif /* HAVE_NET_SNMP */
-bool DNSDistSNMPAgent::sendBackendStatusChangeTrap(const std::shared_ptr<DownstreamState> dss)
+bool DNSDistSNMPAgent::sendBackendStatusChangeTrap(const std::shared_ptr<DownstreamState>& dss)
{
#ifdef HAVE_NET_SNMP
const string backendAddress = dss->remote.toStringWithPort();
{
public:
DNSDistSNMPAgent(const std::string& name, const std::string& masterSocket);
- bool sendBackendStatusChangeTrap(const std::shared_ptr<DownstreamState>);
+ bool sendBackendStatusChangeTrap(const std::shared_ptr<DownstreamState>&);
bool sendCustomTrap(const std::string& reason);
bool sendDNSTrap(const DNSQuestion&, const std::string& reason="");
};
{
public:
- GnuTLSConnection(int socket, unsigned int timeout, const gnutls_certificate_credentials_t creds, const gnutls_priority_t priorityCache, std::shared_ptr<GnuTLSTicketsKey> ticketsKey): d_ticketsKey(ticketsKey)
+ GnuTLSConnection(int socket, unsigned int timeout, const gnutls_certificate_credentials_t creds, const gnutls_priority_t priorityCache, std::shared_ptr<GnuTLSTicketsKey>& ticketsKey): d_ticketsKey(ticketsKey)
{
d_socket = socket;