Commit cdbcf6b6 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

[1601] Eliminate bunch of shared pointers

They are replaced by references, as the server is synchronous, they
should not be preserved outside from the call anyway.
parent 3e173f46
......@@ -87,14 +87,14 @@ public:
~AuthSrvImpl();
isc::data::ConstElementPtr setDbFile(isc::data::ConstElementPtr config);
bool processNormalQuery(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
bool processNormalQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context);
bool processXfrQuery(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
bool processXfrQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context);
bool processNotify(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
bool processNotify(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context);
IOService io_service_;
......@@ -142,7 +142,7 @@ public:
/// \param done If true, the Rcode from the given message is counted,
/// this value is then passed to server->resume(bool)
void resumeServer(isc::asiodns::DNSServer* server,
isc::dns::MessagePtr message,
isc::dns::Message& message,
bool done);
private:
std::string db_file_;
......@@ -205,7 +205,7 @@ public:
DNSServer* server) const
{
(void) answer_message;
server_->processMessage(io_message, message, buffer, server);
server_->processMessage(io_message, *message, *buffer, server);
}
private:
AuthSrv* server_;
......@@ -266,55 +266,55 @@ AuthSrv::~AuthSrv() {
namespace {
class QuestionInserter {
public:
QuestionInserter(MessagePtr message) : message_(message) {}
QuestionInserter(Message& message) : message_(message) {}
void operator()(const QuestionPtr question) {
message_->addQuestion(question);
message_.addQuestion(question);
}
MessagePtr message_;
Message& message_;
};
void
makeErrorMessage(MessagePtr message, OutputBufferPtr buffer,
const Rcode& rcode,
makeErrorMessage(Message& message, OutputBuffer& buffer,
const Rcode& rcode,
std::auto_ptr<TSIGContext> tsig_context =
std::auto_ptr<TSIGContext>())
{
// extract the parameters that should be kept.
// XXX: with the current implementation, it's not easy to set EDNS0
// depending on whether the query had it. So we'll simply omit it.
const qid_t qid = message->getQid();
const bool rd = message->getHeaderFlag(Message::HEADERFLAG_RD);
const bool cd = message->getHeaderFlag(Message::HEADERFLAG_CD);
const Opcode& opcode = message->getOpcode();
const qid_t qid = message.getQid();
const bool rd = message.getHeaderFlag(Message::HEADERFLAG_RD);
const bool cd = message.getHeaderFlag(Message::HEADERFLAG_CD);
const Opcode& opcode = message.getOpcode();
vector<QuestionPtr> questions;
// If this is an error to a query or notify, we should also copy the
// question section.
if (opcode == Opcode::QUERY() || opcode == Opcode::NOTIFY()) {
questions.assign(message->beginQuestion(), message->endQuestion());
questions.assign(message.beginQuestion(), message.endQuestion());
}
message->clear(Message::RENDER);
message->setQid(qid);
message->setOpcode(opcode);
message->setHeaderFlag(Message::HEADERFLAG_QR);
message.clear(Message::RENDER);
message.setQid(qid);
message.setOpcode(opcode);
message.setHeaderFlag(Message::HEADERFLAG_QR);
if (rd) {
message->setHeaderFlag(Message::HEADERFLAG_RD);
message.setHeaderFlag(Message::HEADERFLAG_RD);
}
if (cd) {
message->setHeaderFlag(Message::HEADERFLAG_CD);
message.setHeaderFlag(Message::HEADERFLAG_CD);
}
for_each(questions.begin(), questions.end(), QuestionInserter(message));
message->setRcode(rcode);
message.setRcode(rcode);
MessageRenderer renderer(*buffer);
MessageRenderer renderer(buffer);
if (tsig_context.get() != NULL) {
message->toWire(renderer, *tsig_context);
message.toWire(renderer, *tsig_context);
} else {
message->toWire(renderer);
message.toWire(renderer);
}
LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_ERROR_RESPONSE)
.arg(renderer.getLength()).arg(*message);
.arg(renderer.getLength()).arg(message);
}
}
......@@ -412,18 +412,18 @@ AuthSrv::setStatisticsTimerInterval(uint32_t interval) {
}
void
AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer, DNSServer* server)
AuthSrv::processMessage(const IOMessage& io_message, Message& message,
OutputBuffer& buffer, DNSServer* server)
{
InputBuffer request_buffer(io_message.getData(), io_message.getDataSize());
// First, check the header part. If we fail even for the base header,
// just drop the message.
try {
message->parseHeader(request_buffer);
message.parseHeader(request_buffer);
// Ignore all responses.
if (message->getHeaderFlag(Message::HEADERFLAG_QR)) {
if (message.getHeaderFlag(Message::HEADERFLAG_QR)) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_RESPONSE_RECEIVED);
impl_->resumeServer(server, message, false);
return;
......@@ -437,7 +437,7 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message,
try {
// Parse the message.
message->fromWire(request_buffer);
message.fromWire(request_buffer);
} catch (const DNSProtocolError& error) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_PACKET_PROTOCOL_ERROR)
.arg(error.getRcode().toText()).arg(error.what());
......@@ -453,13 +453,13 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message,
} // other exceptions will be handled at a higher layer.
LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_PACKET_RECEIVED)
.arg(message->toText());
.arg(message);
// Perform further protocol-level validation.
// TSIG first
// If this is set to something, we know we need to answer with TSIG as well
std::auto_ptr<TSIGContext> tsig_context;
const TSIGRecord* tsig_record(message->getTSIGRecord());
const TSIGRecord* tsig_record(message.getTSIGRecord());
TSIGError tsig_error(TSIGError::NOERROR());
// Do we do TSIG?
......@@ -481,20 +481,20 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message,
// update per opcode statistics counter. This can only be reliable after
// TSIG check succeeds.
impl_->counters_.inc(message->getOpcode());
impl_->counters_.inc(message.getOpcode());
bool send_answer = true;
if (message->getOpcode() == Opcode::NOTIFY()) {
if (message.getOpcode() == Opcode::NOTIFY()) {
send_answer = impl_->processNotify(io_message, message, buffer,
tsig_context);
} else if (message->getOpcode() != Opcode::QUERY()) {
} else if (message.getOpcode() != Opcode::QUERY()) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_UNSUPPORTED_OPCODE)
.arg(message->getOpcode().toText());
.arg(message.getOpcode().toText());
makeErrorMessage(message, buffer, Rcode::NOTIMP(), tsig_context);
} else if (message->getRRCount(Message::SECTION_QUESTION) != 1) {
} else if (message.getRRCount(Message::SECTION_QUESTION) != 1) {
makeErrorMessage(message, buffer, Rcode::FORMERR(), tsig_context);
} else {
ConstQuestionPtr question = *message->beginQuestion();
ConstQuestionPtr question = *message.beginQuestion();
const RRType &qtype = question->getType();
if (qtype == RRType::AXFR()) {
send_answer = impl_->processXfrQuery(io_message, message, buffer,
......@@ -512,18 +512,18 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message,
}
bool
AuthSrvImpl::processNormalQuery(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context)
{
ConstEDNSPtr remote_edns = message->getEDNS();
ConstEDNSPtr remote_edns = message.getEDNS();
const bool dnssec_ok = remote_edns && remote_edns->getDNSSECAwareness();
const uint16_t remote_bufsize = remote_edns ? remote_edns->getUDPSize() :
Message::DEFAULT_MAX_UDPSIZE;
message->makeResponse();
message->setHeaderFlag(Message::HEADERFLAG_AA);
message->setRcode(Rcode::NOERROR());
message.makeResponse();
message.setHeaderFlag(Message::HEADERFLAG_AA);
message.setRcode(Rcode::NOERROR());
// Increment query counter.
incCounter(io_message.getSocket().getProtocol());
......@@ -532,20 +532,20 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, MessagePtr message,
EDNSPtr local_edns = EDNSPtr(new EDNS());
local_edns->setDNSSECAwareness(dnssec_ok);
local_edns->setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
message->setEDNS(local_edns);
message.setEDNS(local_edns);
}
try {
// If a memory data source is configured call the separate
// Query::process()
const ConstQuestionPtr question = *message->beginQuestion();
const ConstQuestionPtr question = *message.beginQuestion();
if (memory_client_ && memory_client_class_ == question->getClass()) {
const RRType& qtype = question->getType();
const Name& qname = question->getName();
auth::Query(*memory_client_, qname, qtype, *message,
auth::Query(*memory_client_, qname, qtype, message,
dnssec_ok).process();
} else {
datasrc::Query query(*message, cache_, dnssec_ok);
datasrc::Query query(message, cache_, dnssec_ok);
data_sources_.doQuery(query);
}
} catch (const Exception& ex) {
......@@ -554,24 +554,24 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, MessagePtr message,
return (true);
}
MessageRenderer renderer(*buffer);
MessageRenderer renderer(buffer);
const bool udp_buffer =
(io_message.getSocket().getProtocol() == IPPROTO_UDP);
renderer.setLengthLimit(udp_buffer ? remote_bufsize : 65535);
if (tsig_context.get() != NULL) {
message->toWire(renderer, *tsig_context);
message.toWire(renderer, *tsig_context);
} else {
message->toWire(renderer);
message.toWire(renderer);
}
LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_NORMAL_RESPONSE)
.arg(renderer.getLength()).arg(message->toText());
.arg(renderer.getLength()).arg(message);
return (true);
}
bool
AuthSrvImpl::processXfrQuery(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
AuthSrvImpl::processXfrQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
auto_ptr<TSIGContext> tsig_context)
{
// Increment query counter.
......@@ -612,19 +612,19 @@ AuthSrvImpl::processXfrQuery(const IOMessage& io_message, MessagePtr message,
}
bool
AuthSrvImpl::processNotify(const IOMessage& io_message, MessagePtr message,
OutputBufferPtr buffer,
AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
std::auto_ptr<TSIGContext> tsig_context)
{
// The incoming notify must contain exactly one question for SOA of the
// zone name.
if (message->getRRCount(Message::SECTION_QUESTION) != 1) {
if (message.getRRCount(Message::SECTION_QUESTION) != 1) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_NOTIFY_QUESTIONS)
.arg(message->getRRCount(Message::SECTION_QUESTION));
.arg(message.getRRCount(Message::SECTION_QUESTION));
makeErrorMessage(message, buffer, Rcode::FORMERR(), tsig_context);
return (true);
}
ConstQuestionPtr question = *message->beginQuestion();
ConstQuestionPtr question = *message.beginQuestion();
if (question->getType() != RRType::SOA()) {
LOG_DEBUG(auth_logger, DBG_AUTH_DETAIL, AUTH_NOTIFY_RRTYPE)
.arg(question->getType().toText());
......@@ -679,15 +679,15 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, MessagePtr message,
return (false);
}
message->makeResponse();
message->setHeaderFlag(Message::HEADERFLAG_AA);
message->setRcode(Rcode::NOERROR());
message.makeResponse();
message.setHeaderFlag(Message::HEADERFLAG_AA);
message.setRcode(Rcode::NOERROR());
MessageRenderer renderer(*buffer);
MessageRenderer renderer(buffer);
if (tsig_context.get() != NULL) {
message->toWire(renderer, *tsig_context);
message.toWire(renderer, *tsig_context);
} else {
message->toWire(renderer);
message.toWire(renderer);
}
return (true);
}
......@@ -772,9 +772,9 @@ AuthSrvImpl::setDbFile(ConstElementPtr config) {
}
void
AuthSrvImpl::resumeServer(DNSServer* server, MessagePtr message, bool done) {
AuthSrvImpl::resumeServer(DNSServer* server, Message& message, bool done) {
if (done) {
counters_.inc(message->getRcode());
counters_.inc(message.getRcode());
}
server->resume(done);
}
......
......@@ -115,14 +115,14 @@ public:
/// send the reply.
///
/// \param io_message The raw message received
/// \param message Pointer to the \c Message object
/// \param buffer Pointer to an \c OutputBuffer for the resposne
/// \param message the \c Message object
/// \param buffer an \c OutputBuffer for the resposne
/// \param server Pointer to the \c DNSServer
///
/// \throw isc::Unexpected Protocol type of \a message is unexpected
void processMessage(const isc::asiolink::IOMessage& io_message,
isc::dns::MessagePtr message,
isc::util::OutputBufferPtr buffer,
isc::dns::Message& message,
isc::util::OutputBuffer& buffer,
isc::asiodns::DNSServer* server);
/// \brief Updates the data source for the \c AuthSrv object.
......
......@@ -97,7 +97,7 @@ public:
*dummy_endpoint);
query_message_->clear(Message::PARSE);
buffer_->clear();
server_->processMessage(io_message, query_message_, buffer_,
server_->processMessage(io_message, *query_message_, *buffer_,
&server);
}
......
......@@ -88,7 +88,7 @@ protected:
server.setStatisticsSession(&statistics_session);
}
virtual void processMessage() {
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
}
......@@ -174,7 +174,7 @@ TEST_F(AuthSrvTest, builtInQuery) {
default_qid, Name("version.bind"),
RRClass::CH(), RRType::TXT());
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
createBuiltinVersionResponse(default_qid, response_data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
......@@ -286,7 +286,8 @@ TEST_F(AuthSrvTest, AXFRSuccess) {
createRequestPacket(request_message, IPPROTO_TCP);
// On success, the AXFR query has been passed to a separate process,
// so we shouldn't have to respond.
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
EXPECT_TRUE(xfrout.isConnected());
checkAllRcodeCountersZero();
......@@ -307,7 +308,7 @@ TEST_F(AuthSrvTest, TSIGSigned) {
boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(key);
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
// What did we get?
......@@ -342,7 +343,7 @@ TEST_F(AuthSrvTest, TSIGSignedBadKey) {
// Process the message, but use a different key there
boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
......@@ -377,7 +378,7 @@ TEST_F(AuthSrvTest, TSIGBadSig) {
boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(TSIGKey("key:QkFECg==:hmac-sha1"));
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
......@@ -415,7 +416,7 @@ TEST_F(AuthSrvTest, TSIGCheckFirst) {
boost::shared_ptr<TSIGKeyRing> keyring(new TSIGKeyRing);
keyring->add(TSIGKey("key:QkFECg==:hmac-sha1"));
server.setTSIGKeyRing(&keyring);
server.processMessage(*io_message, parse_message, response_obuffer,
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
......@@ -446,7 +447,8 @@ TEST_F(AuthSrvTest, AXFRConnectFail) {
Name("example.com"), RRClass::IN(),
RRType::AXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::SERVFAIL(),
opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -460,7 +462,8 @@ TEST_F(AuthSrvTest, AXFRSendFail) {
Name("example.com"), RRClass::IN(),
RRType::AXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(xfrout.isConnected());
xfrout.disableSend();
......@@ -470,7 +473,8 @@ TEST_F(AuthSrvTest, AXFRSendFail) {
Name("example.com"), RRClass::IN(),
RRType::AXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::SERVFAIL(),
opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -488,8 +492,8 @@ TEST_F(AuthSrvTest, AXFRDisconnectFail) {
Name("example.com"), RRClass::IN(),
RRType::AXFR());
createRequestPacket(request_message, IPPROTO_TCP);
EXPECT_THROW(server.processMessage(*io_message, parse_message,
response_obuffer, &dnsserv),
EXPECT_THROW(server.processMessage(*io_message, *parse_message,
*response_obuffer, &dnsserv),
XfroutError);
EXPECT_TRUE(xfrout.isConnected());
// XXX: we need to re-enable disconnect. otherwise an exception would be
......@@ -504,7 +508,8 @@ TEST_F(AuthSrvTest, IXFRConnectFail) {
Name("example.com"), RRClass::IN(),
RRType::IXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::SERVFAIL(),
opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -518,7 +523,8 @@ TEST_F(AuthSrvTest, IXFRSendFail) {
Name("example.com"), RRClass::IN(),
RRType::IXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(xfrout.isConnected());
xfrout.disableSend();
......@@ -528,7 +534,8 @@ TEST_F(AuthSrvTest, IXFRSendFail) {
Name("example.com"), RRClass::IN(),
RRType::IXFR());
createRequestPacket(request_message, IPPROTO_TCP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::SERVFAIL(),
opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -546,8 +553,8 @@ TEST_F(AuthSrvTest, IXFRDisconnectFail) {
Name("example.com"), RRClass::IN(),
RRType::IXFR());
createRequestPacket(request_message, IPPROTO_TCP);
EXPECT_THROW(server.processMessage(*io_message, parse_message,
response_obuffer, &dnsserv),
EXPECT_THROW(server.processMessage(*io_message, *parse_message,
*response_obuffer, &dnsserv),
XfroutError);
EXPECT_TRUE(xfrout.isConnected());
// XXX: we need to re-enable disconnect. otherwise an exception would be
......@@ -561,7 +568,8 @@ TEST_F(AuthSrvTest, notify) {
RRClass::IN(), RRType::SOA());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
// An internal command message should have been created and sent to an
......@@ -596,7 +604,8 @@ TEST_F(AuthSrvTest, notifyForCHClass) {
RRClass::CH(), RRType::SOA());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
// Other conditions should be the same, so simply confirm the RR class is
......@@ -614,7 +623,8 @@ TEST_F(AuthSrvTest, notifyEmptyQuestion) {
request_message.setQid(default_qid);
request_message.toWire(request_renderer);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::FORMERR(),
Opcode::NOTIFY().getCode(), QR_FLAG, 0, 0, 0, 0);
......@@ -629,7 +639,8 @@ TEST_F(AuthSrvTest, notifyMultiQuestions) {
RRType::SOA()));
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::FORMERR(),
Opcode::NOTIFY().getCode(), QR_FLAG, 2, 0, 0, 0);
......@@ -641,7 +652,8 @@ TEST_F(AuthSrvTest, notifyNonSOAQuestion) {
RRClass::IN(), RRType::NS());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::FORMERR(),
Opcode::NOTIFY().getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -653,7 +665,8 @@ TEST_F(AuthSrvTest, notifyWithoutAA) {
default_qid, Name("example.com"),
RRClass::IN(), RRType::SOA());
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::NOERROR(),
Opcode::NOTIFY().getCode(), QR_FLAG | AA_FLAG, 1, 0, 0, 0);
......@@ -666,7 +679,8 @@ TEST_F(AuthSrvTest, notifyWithErrorRcode) {
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
request_message.setRcode(Rcode::SERVFAIL());
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::NOERROR(),
Opcode::NOTIFY().getCode(), QR_FLAG | AA_FLAG, 1, 0, 0, 0);
......@@ -683,7 +697,8 @@ TEST_F(AuthSrvTest, notifyWithoutSession) {
// we simply ignore the notify and let it be resent if an internal error
// happens.
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
}
......@@ -696,7 +711,8 @@ TEST_F(AuthSrvTest, notifySendFail) {
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
}
......@@ -708,7 +724,8 @@ TEST_F(AuthSrvTest, notifyReceiveFail) {
RRClass::IN(), RRType::SOA());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
}
......@@ -720,7 +737,8 @@ TEST_F(AuthSrvTest, notifyWithBogusSessionMessage) {
RRClass::IN(), RRType::SOA());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
}
......@@ -733,7 +751,8 @@ TEST_F(AuthSrvTest, notifyWithSessionMessageError) {
RRClass::IN(), RRType::SOA());
request_message.setHeaderFlag(Message::HEADERFLAG_AA);
createRequestPacket(request_message, IPPROTO_UDP);
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_FALSE(dnsserv.hasAnswer());
}
......@@ -759,7 +778,8 @@ TEST_F(AuthSrvTest, updateConfig) {
// response should have the AA flag on, and have an RR in each answer
// and authority section.
createDataFromFile("examplequery_fromWire.wire");
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::NOERROR(), opcode.getCode(),
QR_FLAG | AA_FLAG, 1, 1, 1, 0);
......@@ -773,7 +793,8 @@ TEST_F(AuthSrvTest, datasourceFail) {
// in a SERVFAIL response, and the answer and authority sections should
// be empty.
createDataFromFile("badExampleQuery_fromWire.wire");
server.processMessage(*io_message, parse_message, response_obuffer, &dnsserv);
server.processMessage(*io_message, *parse_message, *response_obuffer,
&dnsserv);
EXPECT_TRUE(dnsserv.hasAnswer());
headerCheck(*parse_message, default_qid, Rcode::SERVFAIL(),
opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
......@@ -788,7 +809,8 @@ TEST_F(AuthSrvTest, updateConfigFail) {