mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
cleanup: localize and avoid using temporary variables as much as possible
git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@564 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
@@ -143,40 +143,41 @@ ParkingLot::processMessage() {
|
|||||||
|
|
||||||
msg.makeResponse();
|
msg.makeResponse();
|
||||||
msg.setHeaderFlag(MessageFlag::AA());
|
msg.setHeaderFlag(MessageFlag::AA());
|
||||||
RRTTL default_ttl = RRTTL(3600);
|
|
||||||
|
|
||||||
Name zname("."); // ugly, but should work for now
|
Name zname("."); // ugly, but should work for now
|
||||||
Name name = query->getName();
|
|
||||||
RRClass qclass = query->getClass();
|
|
||||||
RRType qtype = query->getType();
|
|
||||||
SearchResult::status_type status;
|
|
||||||
bool included_ns = false;
|
|
||||||
msg.setRcode(Rcode::NOERROR());
|
msg.setRcode(Rcode::NOERROR());
|
||||||
if (qtype == RRType::TXT() && qclass == RRClass::CH() &&
|
if (query->getType() == RRType::TXT() &&
|
||||||
name == authors_name) {
|
query->getClass() == RRClass::CH() &&
|
||||||
|
query->getName() == authors_name) {
|
||||||
msg.addRRset(Section::ANSWER(), getBuiltinAuthors().getAnswer());
|
msg.addRRset(Section::ANSWER(), getBuiltinAuthors().getAnswer());
|
||||||
msg.addRRset(Section::AUTHORITY(),
|
msg.addRRset(Section::AUTHORITY(),
|
||||||
getBuiltinAuthors().getAuthority());
|
getBuiltinAuthors().getAuthority());
|
||||||
} else if (qtype == RRType::TXT() && qclass == RRClass::CH() &&
|
} else if (query->getType() == RRType::TXT() &&
|
||||||
name == version_name) {
|
query->getClass() == RRClass::CH() &&
|
||||||
|
query->getName() == version_name) {
|
||||||
msg.addRRset(Section::ANSWER(), getBuiltinVersion().getAnswer());
|
msg.addRRset(Section::ANSWER(), getBuiltinVersion().getAnswer());
|
||||||
msg.addRRset(Section::AUTHORITY(),
|
msg.addRRset(Section::AUTHORITY(),
|
||||||
getBuiltinVersion().getAuthority());
|
getBuiltinVersion().getAuthority());
|
||||||
} else if (data_source.hasZoneFor(query->getName(), zname)) {
|
} else if (data_source.hasZoneFor(query->getName(), zname)) {
|
||||||
status = data_source.addToMessage(msg, Section::ANSWER(), zname,
|
SearchResult::status_type status =
|
||||||
name, qclass, qtype);
|
data_source.addToMessage(msg, Section::ANSWER(), zname,
|
||||||
|
query->getName(), query->getClass(),
|
||||||
|
query->getType());
|
||||||
|
bool included_ns = false;
|
||||||
|
|
||||||
// rcode is based on this result?
|
// rcode is based on this result?
|
||||||
if (status == SearchResult::name_not_found) {
|
if (status == SearchResult::name_not_found) {
|
||||||
msg.setRcode(Rcode::NXDOMAIN());
|
msg.setRcode(Rcode::NXDOMAIN());
|
||||||
if (qtype != RRType::NS()) {
|
if (query->getType() != RRType::NS()) {
|
||||||
status = data_source.addToMessage(msg, Section::AUTHORITY(),
|
status = data_source.addToMessage(msg, Section::AUTHORITY(),
|
||||||
zname, zname, qclass,
|
zname, zname,
|
||||||
|
query->getClass(),
|
||||||
RRType::SOA());
|
RRType::SOA());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (qtype != RRType::NS()) {
|
if (query->getType() != RRType::NS()) {
|
||||||
status = data_source.addToMessage(msg, Section::AUTHORITY(),
|
status = data_source.addToMessage(msg, Section::AUTHORITY(),
|
||||||
zname, zname, qclass,
|
zname, zname,
|
||||||
|
query->getClass(),
|
||||||
RRType::NS());
|
RRType::NS());
|
||||||
}
|
}
|
||||||
included_ns = true;
|
included_ns = true;
|
||||||
@@ -185,10 +186,12 @@ ParkingLot::processMessage() {
|
|||||||
if (included_ns) {
|
if (included_ns) {
|
||||||
for_each(msg.beginSection(Section::ANSWER()),
|
for_each(msg.beginSection(Section::ANSWER()),
|
||||||
msg.endSection(Section::ANSWER()),
|
msg.endSection(Section::ANSWER()),
|
||||||
GlueInserter(data_source, zname, qclass, msg));
|
GlueInserter(data_source, zname, query->getClass(),
|
||||||
|
msg));
|
||||||
for_each(msg.beginSection(Section::AUTHORITY()),
|
for_each(msg.beginSection(Section::AUTHORITY()),
|
||||||
msg.endSection(Section::AUTHORITY()),
|
msg.endSection(Section::AUTHORITY()),
|
||||||
GlueInserter(data_source, zname, qclass, msg));
|
GlueInserter(data_source, zname, query->getClass(),
|
||||||
|
msg));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.setRcode(Rcode::SERVFAIL());
|
msg.setRcode(Rcode::SERVFAIL());
|
||||||
|
Reference in New Issue
Block a user