#include "rdata_soa.h"
RDataSOA::RDataSOA() {
m_llpMName = NULL;
m_llpRName = NULL;
m_uSerial = 0;
m_uRefresh = 0;
m_uRetry = 0;
m_uExpire = 0;
m_uMinimum = 0;
}
RDataPtr RDataSOA::Clone() const {
RDataSOA *rdpOut = new RDataSOA;
rdpOut->m_llpMName = new LabelList(*m_llpMName);
rdpOut->m_llpRName = new LabelList(*m_llpRName);
rdpOut->m_uSerial = m_uSerial;
rdpOut->m_uRefresh = m_uRefresh;
rdpOut->m_uRetry = m_uRetry;
rdpOut->m_uExpire = m_uExpire;
rdpOut->m_uMinimum = m_uMinimum;
return (RDataPtr)rdpOut;
}
bool RDataSOA::Compare(const RData &ci_rdr) const {
const RDataSOA *c_rdp = ci_rdr.As<RDataSOA>();
if (c_rdp->m_uSerial!=m_uSerial) return false;
if (c_rdp->m_uRefresh!=m_uRefresh) return false;
if (c_rdp->m_uRetry!=m_uRetry) return false;
if (c_rdp->m_uExpire!=m_uExpire) return false;
if (c_rdp->m_uMinimum!=m_uMinimum) return false;
if ((*c_rdp->m_llpMName)!=(*m_llpMName)) return false;
if ((*c_rdp->m_llpRName)!=(*m_llpRName)) return false;
return true;
}
void RDataSOA::Dump(ostream &io_smr) const {
io_smr << m_llpMName << " " << m_llpRName << " ( "
<< m_uSerial << " " << m_uRefresh << " "
<< m_uRetry << " " << m_uExpire << " " << m_uMinimum << ")";
}
bool RDataSOA::IsMatch(RRType i_ty, RRClass i_cl) {
return (i_ty==TY_SOA);
}
void RDataSOA::ReadRData(BufferConstPtr ci_dpp) {
unsigned short us;
ci_dpp->ReadNBO(us);
ci_dpp->ReadLabelList(m_llpMName,true);
ci_dpp->ReadLabelList(m_llpRName,true);
ci_dpp->ReadNBO(m_uSerial);
ci_dpp->ReadNBO(m_uRefresh);
ci_dpp->ReadNBO(m_uRetry);
ci_dpp->ReadNBO(m_uExpire);
ci_dpp->ReadNBO(m_uMinimum);
}
void RDataSOA::SetRData(const char *ci_strRData) {
EX_MIND("RDataSOA::SetRData: I am too lazy to do this.");
}
void RDataSOA::WriteRData(BufferPtr io_dpp) const {
unsigned short us;
off_t ofSave;
ofSave = io_dpp->GetPos();
io_dpp->WriteNBO((unsigned short)0);
io_dpp->WriteLabelList(m_llpMName,true);
io_dpp->WriteLabelList(m_llpRName,true);
io_dpp->WriteNBO(m_uSerial);
io_dpp->WriteNBO(m_uRefresh);
io_dpp->WriteNBO(m_uRetry);
io_dpp->WriteNBO(m_uExpire);
io_dpp->WriteNBO(m_uMinimum);
us = (unsigned short)(io_dpp->GetPos() - ofSave - 2);
io_dpp->PWriteNBO(us,ofSave);
}
RDataSOA::~RDataSOA() {
SoftDelete(m_llpMName);
SoftDelete(m_llpRName);
}