|
reSIProcate/rutil
9694
|
#include <RRList.hxx>


Classes | |
| class | Protocol |
| struct | RecordItem |
Public Types | |
| typedef std::vector < DnsResourceRecord * > | Records |
| typedef IntrusiveListElement < RRList * > | LruList |
| typedef std::vector< RROverlay > ::const_iterator | Itr |
| typedef std::vector< Data > | DataArr |
Public Member Functions | |
| RRList () | |
| RRList (const Data &key, const int rrtype, int ttl, int status) | |
| RRList (const Data &key, int rrtype) | |
| ~RRList () | |
| RRList (const RRFactoryBase *factory, const Data &key, const int rrType, Itr begin, Itr end, int ttl) | |
| RRList (const DnsHostRecord &record, int ttl) | |
| void | update (const DnsHostRecord &record, int ttl) |
| void | update (const RRFactoryBase *factory, Itr begin, Itr end, int ttl) |
| Records | records (const int protocol) |
| const Data & | key () const |
| int | status () const |
| int | rrType () const |
| UInt64 | absoluteExpiry () const |
| UInt64 & | absoluteExpiry () |
| void | log () |
| EncodeStream & | encodeRRList (EncodeStream &strm) |
Private Types | |
| typedef std::vector< RecordItem > | RecordArr |
| typedef RecordArr::iterator | RecordItr |
Private Member Functions | |
| RecordItr | find (const Data &) |
| void | clear () |
| EncodeStream & | encodeRecordItem (RRList::RecordItem &item, EncodeStream &strm) |
Private Attributes | |
| RecordArr | mRecords |
| Data | mKey |
| int | mRRType |
| int | mStatus |
| UInt64 | mAbsoluteExpiry |
Definition at line 14 of file RRList.hxx.
| typedef std::vector<Data> resip::RRList::DataArr |
Definition at line 31 of file RRList.hxx.
| typedef std::vector<RROverlay>::const_iterator resip::RRList::Itr |
Definition at line 30 of file RRList.hxx.
| typedef IntrusiveListElement<RRList*> resip::RRList::LruList |
Definition at line 29 of file RRList.hxx.
typedef std::vector<RecordItem> resip::RRList::RecordArr [private] |
Definition at line 66 of file RRList.hxx.
typedef RecordArr::iterator resip::RRList::RecordItr [private] |
Definition at line 67 of file RRList.hxx.
| typedef std::vector<DnsResourceRecord*> resip::RRList::Records |
Definition at line 28 of file RRList.hxx.
| RRList::RRList | ( | ) |
Definition at line 39 of file RRList.cxx.
: mRRType(0), mStatus(0), mAbsoluteExpiry(ULONG_MAX) {}
| RRList::RRList | ( | const Data & | key, |
| const int | rrtype, | ||
| int | ttl, | ||
| int | status | ||
| ) | [explicit] |
Definition at line 41 of file RRList.cxx.
References resip::Timer::getTimeSecs(), and mAbsoluteExpiry.
: mKey(key), mRRType(rrtype), mStatus(status) { mAbsoluteExpiry = ttl + Timer::getTimeSecs(); }

| RRList::RRList | ( | const Data & | key, |
| int | rrtype | ||
| ) | [explicit] |
Definition at line 66 of file RRList.cxx.
: mKey(key), mRRType(rrtype), mStatus(0), mAbsoluteExpiry(ULONG_MAX) {}
| RRList::~RRList | ( | ) |
Definition at line 70 of file RRList.cxx.
References clear().
{
this->clear();
}

| RRList::RRList | ( | const RRFactoryBase * | factory, |
| const Data & | key, | ||
| const int | rrType, | ||
| Itr | begin, | ||
| Itr | end, | ||
| int | ttl | ||
| ) |
| RRList::RRList | ( | const DnsHostRecord & | record, |
| int | ttl | ||
| ) |
Definition at line 50 of file RRList.cxx.
References update().
: mKey(record.name()), mRRType(T_A), mStatus(0), mAbsoluteExpiry(ULONG_MAX) { update(record, ttl); }

| UInt64 resip::RRList::absoluteExpiry | ( | ) | const [inline] |
| UInt64& resip::RRList::absoluteExpiry | ( | ) | [inline] |
| void RRList::clear | ( | ) | [private] |
| EncodeStream & RRList::encodeRecordItem | ( | RRList::RecordItem & | item, |
| EncodeStream & | strm | ||
| ) | [private] |
Definition at line 151 of file RRList.cxx.
References resip::DnsCnameRecord::cname(), resip::DnsNaptrRecord::flags(), resip::Timer::getTimeSecs(), resip::DnsHostRecord::host(), resip::DnsUtil::inet_ntop(), mAbsoluteExpiry, mKey, mRRType, mStatus, resip::DnsResourceRecord::name(), resip::DnsHostRecord::name(), resip::DnsAAAARecord::name(), resip::DnsCnameRecord::name(), resip::DnsSrvRecord::name(), resip::DnsNaptrRecord::name(), resip::DnsNaptrRecord::order(), resip::DnsSrvRecord::port(), resip::DnsNaptrRecord::preference(), resip::DnsSrvRecord::priority(), resip::RRList::RecordItem::record, resip::DnsNaptrRecord::regexp(), resip::DnsNaptrRecord::replacement(), resip::DnsNaptrRecord::service(), T_A, T_AAAA, T_NAPTR, T_SRV, resip::DnsSrvRecord::target(), and resip::DnsSrvRecord::weight().
Referenced by encodeRRList(), and log().
{
strm << "DNSCACHE: Type=";
switch(mRRType)
{
case T_CNAME:
{
DnsCnameRecord* record = dynamic_cast<DnsCnameRecord*>(item.record);
assert(record);
strm << "CNAME: " << record->name() << " -> " << record->cname();
break;
}
case T_NAPTR:
{
DnsNaptrRecord* record = dynamic_cast<DnsNaptrRecord*>(item.record);
assert(record);
strm << "NAPTR: " << record->name() << " -> repl=" << record->replacement() << " service=" << record->service()
<< " order=" << record->order() << " pref=" << record->preference() << " flags=" << record->flags()
<< " regexp=" << record->regexp().regexp();
break;
}
case T_SRV:
{
DnsSrvRecord* record = dynamic_cast<DnsSrvRecord*>(item.record);
assert(record);
strm << "SRV: " << record->name() << " -> " << record->target() << ":" << record->port()
<< " priority=" << record->priority() << " weight=" << record->weight();
break;
}
#ifdef USE_IPV6
case T_AAAA:
{
DnsAAAARecord* record = dynamic_cast<DnsAAAARecord*>(item.record);
assert(record);
strm << "AAAA(Host): " << record->name() << " -> " << DnsUtil::inet_ntop(record->v6Address());
break;
}
#endif
case T_A:
{
DnsHostRecord* record = dynamic_cast<DnsHostRecord*>(item.record);
assert(record);
strm << "A(Host): " << record->name() << " -> " << record->host();
break;
}
default:
strm << "UNKNOWN(" << mRRType << ")" << " key=" << mKey << " name=" << item.record->name();
break;
}
strm << " secsToExpirey=" << (mAbsoluteExpiry - Timer::getTimeSecs()) << " status=" << mStatus;
strm.flush();
return strm;
}

| EncodeStream & RRList::encodeRRList | ( | EncodeStream & | strm | ) |
Definition at line 224 of file RRList.cxx.
References encodeRecordItem(), and mRecords.
{
for (RecordArr::iterator it = mRecords.begin(); it != mRecords.end(); ++it)
{
encodeRecordItem(*it, strm);
strm << endl;
}
return strm;
}

| RRList::RecordItr RRList::find | ( | const Data & | value | ) | [private] |
| const Data& resip::RRList::key | ( | ) | const [inline] |
Definition at line 50 of file RRList.hxx.
References mKey.
Referenced by resip::RRCache::CompareT::operator()().
{ return mKey; }
| void RRList::log | ( | ) |
Definition at line 211 of file RRList.cxx.
References encodeRecordItem(), mRecords, and WarningLog.
{
for (RecordArr::iterator it = mRecords.begin(); it != mRecords.end(); ++it)
{
Data buffer;
DataStream strm(buffer);
encodeRecordItem(*it, strm);
WarningLog( << buffer);
}
}

| RRList::Records RRList::records | ( | const int | protocol | ) |
| int resip::RRList::rrType | ( | ) | const [inline] |
Definition at line 52 of file RRList.hxx.
References mRRType.
Referenced by resip::RRCache::CompareT::operator()().
{ return mRRType; }
| int resip::RRList::status | ( | ) | const [inline] |
| void RRList::update | ( | const DnsHostRecord & | record, |
| int | ttl | ||
| ) |
Definition at line 56 of file RRList.cxx.
References clear(), resip::Timer::getTimeSecs(), mAbsoluteExpiry, mRecords, and resip::RRList::RecordItem::record.
Referenced by RRList().
{
this->clear();
RecordItem item;
item.record = new DnsHostRecord(record);
mRecords.push_back(item);
mAbsoluteExpiry = Timer::getTimeSecs() + ttl;
}

| void RRList::update | ( | const RRFactoryBase * | factory, |
| Itr | begin, | ||
| Itr | end, | ||
| int | ttl | ||
| ) |
Definition at line 86 of file RRList.cxx.
References clear(), resip::RRFactoryBase::create(), resip::IntrusiveListElement< RRList * >::end(), ErrLog, resip::BaseException::getMessage(), resip::Timer::getTimeSecs(), mAbsoluteExpiry, mRecords, and resip::RRList::RecordItem::record.
{
this->clear();
mAbsoluteExpiry = ULONG_MAX;
for (Itr it = begin; it != end; it++)
{
try
{
RecordItem item;
item.record = factory->create(*it);
mRecords.push_back(item);
if ((UInt64)it->ttl() < mAbsoluteExpiry)
{
mAbsoluteExpiry = it->ttl();
}
}
catch (BaseException& e)
{
ErrLog(<< e.getMessage() << endl);
}
}
if (mAbsoluteExpiry < (UInt64)ttl)
{
mAbsoluteExpiry = ttl;
}
mAbsoluteExpiry += Timer::getTimeSecs();
}

UInt64 resip::RRList::mAbsoluteExpiry [private] |
Definition at line 75 of file RRList.hxx.
Referenced by absoluteExpiry(), encodeRecordItem(), RRList(), and update().
Data resip::RRList::mKey [private] |
Definition at line 71 of file RRList.hxx.
Referenced by encodeRecordItem(), and key().
RecordArr resip::RRList::mRecords [private] |
Definition at line 69 of file RRList.hxx.
Referenced by clear(), encodeRRList(), find(), log(), records(), and update().
int resip::RRList::mRRType [private] |
Definition at line 72 of file RRList.hxx.
Referenced by encodeRecordItem(), and rrType().
int resip::RRList::mStatus [private] |
Definition at line 74 of file RRList.hxx.
Referenced by encodeRecordItem(), and status().
1.7.5.1