Commit 406ff425 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac551] Method for changing name of rrset

parent 2db67df7
......@@ -351,6 +351,31 @@ struct MemoryZone::MemoryZoneImpl {
return (false);
}
/*
* Prepares a rrset to be return as a result.
*
* If rename is false, it returns the one provided. If it is true, it
* creates a new rrset with the same data but with provided name.
* It is designed for wildcard case, where we create the rrsets
* dynamically.
*/
static ConstRRsetPtr prepareRRset(const Name& name, const ConstRRsetPtr&
rrset, bool rename)
{
if (rename) {
// TODO What about signatures? If we change the name, it would be
// wrong anyway...
RRsetPtr result(new RRset(name, rrset->getClass(),
rrset->getType(), rrset->getTTL()));
for (RdataIteratorPtr i(rrset->getRdataIterator()); !i->isLast();
i->next()) {
result->addRdata(i->getCurrent());
}
return (result);
} else {
return (rrset);
}
}
// Implementation of MemoryZone::find
FindResult find(const Name& name, RRType type,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment