}
void
-OracleBackend::lookup (const QType &qtype, const string &qname,
+OracleBackend::lookup (const QType &qtype, const DNSName& qname,
DNSPacket *p, int zoneId)
{
sword rc;
}
}
- string_to_cbuf(mQueryName, qname, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, qname.toStringNoDot(), sizeof(mQueryName));
string_to_cbuf(mQueryType, qtype.getName(), sizeof(mQueryType));
mQueryZoneId = zoneId;
bool
OracleBackend::getBeforeAndAfterNames (
- uint32_t zoneId, const string& zone,
- const string& name, string& before, string& after)
+ uint32_t zoneId, const DNSName& zone,
+ const DNSName& name, DNSName& before, DNSName& after)
{
if(!d_dnssecQueries)
return -1;
bind_str_ind(stmt, ":prev", mResultPrevName, sizeof(mResultPrevName), &mResultPrevNameInd);
bind_str_ind(stmt, ":next", mResultNextName, sizeof(mResultNextName), &mResultNextNameInd);
bind_uint32(stmt, ":zoneid", &zoneId);
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
mResultPrevNameInd = -1;
mResultNextNameInd = -1;
bool
OracleBackend::getBeforeAndAfterNamesAbsolute(uint32_t zoneId,
- const string& name, string& unhashed, string& before, string& after)
+ const string& name, DNSName& unhashed, string& before, string& after)
{
if(!d_dnssecQueries)
return -1;
}
vector<string>
-OracleBackend::getDomainMasters (const string &domain, int zoneId)
+OracleBackend::getDomainMasters (const DNSName& domain, int zoneId)
{
sword rc;
OCIStmt *stmt;
}
bool
-OracleBackend::isMaster (const string &domain, const string &master)
+OracleBackend::isMaster (const DNSName& domain, const string &master)
{
sword rc;
OCIStmt *stmt;
stmt = prepare_query(masterSvcCtx, isZoneMasterQuerySQL, isZoneMasterQueryKey);
- string_to_cbuf(mQueryZone, domain, sizeof(mQueryZone));
+ string_to_cbuf(mQueryZone, domain.toStringNoDot(), sizeof(mQueryZone));
string_to_cbuf(mQueryName, master, sizeof(mQueryName));
char res_master[512];
}
bool
-OracleBackend::getDomainInfo (const string &domain, DomainInfo &di)
+OracleBackend::getDomainInfo (const DNSName& domain, DomainInfo &di)
{
sword rc;
OCIStmt *stmt;
define_output_uint32(stmt, 5, &serial_ind, &serial);
define_output_uint32(stmt, 6, ¬ified_serial_ind, ¬ified_serial);
- string_to_cbuf(mQueryZone, domain, sizeof(mQueryZone));
+ string_to_cbuf(mQueryZone, domain.toStringNoDot(), sizeof(mQueryZone));
bind_str(stmt, ":name", mQueryZone, sizeof(mQueryZone));
rc = OCIStmtExecute(masterSvcCtx, stmt, oraerr, 1, 0, NULL, NULL, OCI_DEFAULT);
return true;
}
-void OracleBackend::alsoNotifies(const string &domain, set<string> *addrs)
+void OracleBackend::alsoNotifies(const DNSName& domain, set<string> *addrs)
{
sword rc;
OCIStmt *stmt;
bind_str_failokay(stmt, ":nsname", myServerName, sizeof(myServerName));
bind_str(stmt, ":name", mQueryZone, sizeof(mQueryZone));
- string_to_cbuf(mQueryZone, domain, sizeof(mQueryZone));
+ string_to_cbuf(mQueryZone, domain.toStringNoDot(), sizeof(mQueryZone));
define_output_str(stmt, 1, &hostaddr_ind, hostaddr, sizeof(hostaddr));
}
bool
-OracleBackend::list (const string &domain, int zoneId, bool include_disabled)
+OracleBackend::list (const DNSName& domain, int zoneId, bool include_disabled)
{
sword rc;
}
bool
-OracleBackend::startTransaction (const string &domain, int zoneId)
+OracleBackend::startTransaction (const DNSName& domain, int zoneId)
{
sword rc;
OCIStmt *stmt;
bind_str(stmt, ":content", mQueryContent, sizeof(mQueryContent));
mQueryZoneId = rr.domain_id;
- string_to_cbuf(mQueryName, rr.qname, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, rr.qname.toStringNoDot(), sizeof(mQueryName));
ttl = rr.ttl;
string_to_cbuf(mQueryType, rr.qtype.getName(), sizeof(mQueryType));
string_to_cbuf(mQueryContent, rr.content, sizeof(mQueryContent));
}
bool
-OracleBackend::superMasterBackend (const string &ip, const string &domain,
+OracleBackend::superMasterBackend (const string &ip, const DNSName& domain,
const vector<DNSResourceRecord> &nsset,
string *nameserver, string *account,
DNSBackend **backend)
}
bool
-OracleBackend::createSlaveDomain(const string &ip, const string &domain,
+OracleBackend::createSlaveDomain(const string &ip, const DNSName& domain,
const string &nameserver, const string &account)
{
sword rc;
OCIStmt *insertSlaveQueryHandle;
OCIStmt *insertMasterQueryHandle;
- string_to_cbuf(mQueryZone, domain, sizeof(mQueryZone));
+ string_to_cbuf(mQueryZone, domain.toStringNoDot(), sizeof(mQueryZone));
openMasterConnection();
}
bool
-OracleBackend::getAllDomainMetadata (const string& name, std::map<string, vector<string> >& meta)
+OracleBackend::getAllDomainMetadata (const DNSName& name, std::map<string, vector<string> >& meta)
{
DomainInfo di;
if (getDomainInfo(name, di) == false) return false;
define_output_str(stmt, 1, &mResultTypeInd, mResultType, sizeof(mResultType));
define_output_str(stmt, 2, &mResultContentInd, mResultContent, sizeof(mResultContent));
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
rc = OCIStmtExecute(pooledSvcCtx, stmt, oraerr, 1, 0, NULL, NULL, OCI_DEFAULT);
}
bool
-OracleBackend::getDomainMetadata (const string& name, const string& kind,
+OracleBackend::getDomainMetadata (const DNSName& name, const string& kind,
vector<string>& meta)
{
if(!d_dnssecQueries && isDnssecDomainMetadata(kind))
bind_str(stmt, ":kind", mQueryType, sizeof(mQueryType));
define_output_str(stmt, 1, &mResultContentInd, mResultContent, sizeof(mResultContent));
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
string_to_cbuf(mQueryType, kind, sizeof(mQueryType));
rc = OCIStmtExecute(pooledSvcCtx, stmt, oraerr, 1, 0, NULL, NULL, OCI_DEFAULT);
}
bool
-OracleBackend::setDomainMetadata(const string& name, const string& kind,
+OracleBackend::setDomainMetadata(const DNSName& name, const string& kind,
const vector<string>& meta)
{
if(!d_dnssecQueries && isDnssecDomainMetadata(kind))
throw OracleException("Oracle setDomainMetadata BEGIN", oraerr);
}
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
string_to_cbuf(mQueryType, kind, sizeof(mQueryType));
stmt = prepare_query(masterSvcCtx, delZoneMetadataQuerySQL, delZoneMetadataQueryKey);
}
bool
-OracleBackend::getTSIGKey (const string& name, string* algorithm, string* content)
+OracleBackend::getTSIGKey (const DNSName& name, DNSName* algorithm, string* content)
{
sword rc;
OCIStmt *stmt;
stmt = prepare_query(pooledSvcCtx, getTSIGKeyQuerySQL, getTSIGKeyQueryKey);
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
define_output_str(stmt, 1, &mResultTypeInd, mResultType, sizeof(mResultType));
}
bool
-OracleBackend::delTSIGKey(const string& name)
+OracleBackend::delTSIGKey(const DNSName& name)
{
sword rc;
OCIStmt *stmt;
rc = OCITransStart(masterSvcCtx, oraerr, 60, OCI_TRANS_NEW);
stmt = prepare_query(masterSvcCtx, delTSIGKeyQuerySQL, delTSIGKeyQueryKey);
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
}
bool
-OracleBackend::setTSIGKey(const string& name, const string& algorithm, const string& content)
+OracleBackend::setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content)
{
sword rc;
OCIStmt *stmt;
}
stmt = prepare_query(masterSvcCtx, delTSIGKeyQuerySQL, delTSIGKeyQueryKey);
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
release_query(stmt, delTSIGKeyQueryKey);
stmt = prepare_query(masterSvcCtx, setTSIGKeyQuerySQL, setTSIGKeyQueryKey);
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
- string_to_cbuf(mQueryType, algorithm, sizeof(mQueryType));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
+ string_to_cbuf(mQueryType, algorithm.toStringNoDot(), sizeof(mQueryType));
string_to_cbuf(mQueryContent, content, sizeof(mQueryContent));
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
}
bool
-OracleBackend::getDomainKeys (const string& name, unsigned int kind, vector<KeyData>& keys)
+OracleBackend::getDomainKeys (const DNSName& name, unsigned int kind, vector<KeyData>& keys)
{
if(!d_dnssecQueries)
return -1;
stmt = prepare_query(pooledSvcCtx, getZoneKeysQuerySQL, getZoneKeysQueryKey);
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
sb2 key_id_ind = 0;
unsigned int key_id = 0;
}
bool
-OracleBackend::removeDomainKey (const string& name, unsigned int id)
+OracleBackend::removeDomainKey (const DNSName& name, unsigned int id)
{
if(!d_dnssecQueries)
return -1;
}
int
-OracleBackend::addDomainKey (const string& name, const KeyData& key)
+OracleBackend::addDomainKey (const DNSName& name, const KeyData& key)
{
if(!d_dnssecQueries)
return -1;
throw OracleException("Oracle addDomainKey BEGIN", oraerr);
}
- string_to_cbuf(mQueryName, name, sizeof(mQueryName));
+ string_to_cbuf(mQueryName, name.toStringNoDot(), sizeof(mQueryName));
string_to_cbuf(mQueryContent, key.content, sizeof(mQueryContent));
stmt = prepare_query(masterSvcCtx, addZoneKeyQuerySQL, addZoneKeyQueryKey);
}
bool
-OracleBackend::setDomainKeyState (const string& name, unsigned int id, int active)
+OracleBackend::setDomainKeyState (const DNSName& name, unsigned int id, int active)
{
if(!d_dnssecQueries)
return -1;
}
bool
-OracleBackend::activateDomainKey (const string& name, unsigned int id)
+OracleBackend::activateDomainKey (const DNSName& name, unsigned int id)
{
return setDomainKeyState(name, id, 1);
}
bool
-OracleBackend::deactivateDomainKey (const string& name, unsigned int id)
+OracleBackend::deactivateDomainKey (const DNSName& name, unsigned int id)
{
return setDomainKeyState(name, id, 0);
}
NULL, char *poolname = NULL);
virtual ~OracleBackend();
- void lookup(const QType &qtype, const string &qname, DNSPacket *p = 0,
+ void lookup(const QType &qtype, const DNSName& qname, DNSPacket *p = 0,
int zoneId = -1);
- bool getBeforeAndAfterNames(uint32_t zoneId, const string& zone,
- const string& name,
- string& before, string& after);
+
+ bool getBeforeAndAfterNames(uint32_t zoneId, const DNSName& zone,
+ const DNSName& name,
+ DNSName& before, DNSName& after);
bool getBeforeAndAfterNamesAbsolute(uint32_t zoneId,
const string& name,
- string& unhashed,
+ DNSName& unhashed,
string& before,
string& after);
bool get(DNSResourceRecord &rr);
- vector<string> getDomainMasters(const string &domain, int zoneId);
- bool isMaster(const string &domain, const string &master);
- bool getDomainInfo(const string &domain, DomainInfo &di);
- void alsoNotifies(const string &domain, set<string> *addrs);
+ vector<string> getDomainMasters(const DNSName& domain, int zoneId);
+ bool isMaster(const DNSName& domain, const string &master);
+ bool getDomainInfo(const DNSName& domain, DomainInfo &di);
+ void alsoNotifies(const DNSName& domain, set<string> *addrs);
void getUnfreshSlaveInfos(vector<DomainInfo>* domains);
void getUpdatedMasters(vector<DomainInfo>* domains);
void setFresh(uint32_t zoneId);
void setNotified(uint32_t zoneId, uint32_t serial);
- bool list(const string &domain, int zoneId, bool include_disabled=false);
- bool startTransaction(const string &domain, int zoneId);
+ bool list(const DNSName& domain, int zoneId, bool include_disabled=false);
+ bool startTransaction(const DNSName& domain, int zoneId);
bool feedRecord(const DNSResourceRecord &rr, string* ordername);
bool commitTransaction();
bool abortTransaction();
- bool superMasterBackend(const string &ip, const string &domain,
+ bool superMasterBackend(const string &ip, const DNSName& domain,
const vector<DNSResourceRecord> &nsset,
string *account, string *nameserver,
DNSBackend **backend);
- bool createSlaveDomain(const string &ip, const string &domain,
+ bool createSlaveDomain(const string &ip, const DNSName& domain,
const string &nameserver, const string &account);
- bool getAllDomainMetadata(const string& name, std::map<std::string, std::vector<std::string> >& meta);
- bool getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta);
- bool setDomainMetadata(const string& name, const std::string& kind, const std::vector<std::string>& meta);
+ bool getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string> >& meta);
+ bool getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta);
+ bool setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta);
- bool getTSIGKey(const string& name, string* algorithm, string* content);
- bool delTSIGKey(const string& name);
- bool setTSIGKey(const string& name, const string& algorithm, const string& content);
+ bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content);
+ bool delTSIGKey(const DNSName& name);
+ bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content);
bool getTSIGKeys(std::vector< struct TSIGKey > &keys);
- bool getDomainKeys(const string& name, unsigned int kind, vector<KeyData>& keys);
- bool removeDomainKey(const string& name, unsigned int id);
- int addDomainKey(const string& name, const KeyData& key);
- bool activateDomainKey(const string& name, unsigned int id);
- bool deactivateDomainKey(const string& name, unsigned int id);
+ bool getDomainKeys(const DNSName& name, unsigned int kind, vector<KeyData>& keys);
+ bool removeDomainKey(const DNSName& name, unsigned int id);
+ int addDomainKey(const DNSName& name, const KeyData& key);
+ bool activateDomainKey(const DNSName& name, unsigned int id);
+ bool deactivateDomainKey(const DNSName& name, unsigned int id);
private:
void Cleanup();
void openMasterConnection();
- bool setDomainKeyState(const string& name, unsigned int id, int active);
+ bool setDomainKeyState(const DNSName& name, unsigned int id, int active);
OCIStmt* prepare_query (OCISvcCtx* orasvc, string& code, const char *key);
void release_query (OCIStmt *stmt, const char *key);