pdns  4.2.0-rc1
About: PowerDNS daemon - a high performance authoritative nameserver. Release candidate.
  Fossies Dox: pdns-4.2.0-rc1.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

UeberBackend Class Reference

#include <ueberbackend.hh>

Inheritance diagram for UeberBackend:
Collaboration diagram for UeberBackend:

Classes

class  handle
 the very magic handle for UeberBackend questions More...
 
struct  Question
 

Public Member Functions

 UeberBackend (const string &pname="default")
 
 ~UeberBackend ()
 
bool superMasterBackend (const string &ip, const DNSName &domain, const vector< DNSResourceRecord > &nsset, string *nameserver, string *account, DNSBackend **db)
 
void cleanup ()
 
void lookup (const QType &, const DNSName &qdomain, DNSPacket *pkt_p=0, int zoneId=-1)
 
bool getAuth (const DNSName &target, const QType &qtype, SOAData *sd, bool cachedOk=true)
 
bool getSOA (const DNSName &domain, SOAData &sd)
 
bool getSOAUncached (const DNSName &domain, SOAData &sd)
 
bool get (DNSZoneRecord &r)
 
void getAllDomains (vector< DomainInfo > *domains, bool include_disabled=false)
 
void getUnfreshSlaveInfos (vector< DomainInfo > *domains)
 
void getUpdatedMasters (vector< DomainInfo > *domains)
 
bool getDomainInfo (const DNSName &domain, DomainInfo &di, bool getSerial=true)
 
bool createDomain (const DNSName &domain)
 
bool doesDNSSEC ()
 
bool addDomainKey (const DNSName &name, const DNSBackend::KeyData &key, int64_t &id)
 
bool getDomainKeys (const DNSName &name, std::vector< DNSBackend::KeyData > &keys)
 
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 removeDomainKey (const DNSName &name, unsigned int id)
 
bool activateDomainKey (const DNSName &name, unsigned int id)
 
bool deactivateDomainKey (const DNSName &name, unsigned int id)
 
bool getTSIGKey (const DNSName &name, DNSName *algorithm, string *content)
 
bool setTSIGKey (const DNSName &name, const DNSName &algorithm, const string &content)
 
bool deleteTSIGKey (const DNSName &name)
 
bool getTSIGKeys (std::vector< struct TSIGKey > &keys)
 
void alsoNotifies (const DNSName &domain, set< string > *ips)
 
void rediscover (string *status=0)
 
void reload ()
 
bool searchRecords (const string &pattern, int maxResults, vector< DNSResourceRecord > &result)
 
bool searchComments (const string &pattern, int maxResults, vector< Comment > &result)
 

Static Public Member Functions

static bool loadmodule (const string &name)
 Loads a module and reports it to all UeberBackend threads. More...
 
static bool loadModules (const vector< string > &modules, const string &path)
 
static void go (void)
 

Public Attributes

vector< DNSBackend * > backends
 

Static Public Attributes

static vector< UeberBackend * > instances
 
static pthread_mutex_t instances_lock =PTHREAD_MUTEX_INITIALIZER
 

Private Member Functions

int cacheHas (const Question &q, vector< DNSZoneRecord > &rrs)
 
void addNegCache (const Question &q)
 
void addCache (const Question &q, const vector< DNSZoneRecord > &rrs)
 

Private Attributes

pthread_t d_tid
 
handle d_handle
 
vector< DNSZoneRecordd_answers
 
vector< DNSZoneRecord >::const_iterator d_cachehandleiter
 
struct UeberBackend::Question d_question
 
unsigned int d_cache_ttl
 
unsigned int d_negcache_ttl
 
int d_domain_id
 
int d_ancount
 
bool d_negcached
 
bool d_cached
 
bool d_stale
 

Static Private Attributes

static pthread_mutex_t d_mut = PTHREAD_MUTEX_INITIALIZER
 
static pthread_cond_t d_cond = PTHREAD_COND_INITIALIZER
 
static bool d_go =false
 

Detailed Description

This is a very magic backend that allows us to load modules dynamically, and query them in order. This is persistent over all UeberBackend instantiations across multiple threads.

The UeberBackend is transparent for exceptions, which should fall straight through.

Definition at line 49 of file ueberbackend.hh.

Constructor & Destructor Documentation

◆ UeberBackend()

UeberBackend::UeberBackend ( const string &  pname = "default")

◆ ~UeberBackend()

UeberBackend::~UeberBackend ( )

Definition at line 530 of file ueberbackend.cc.

References cleanup(), DLOG, Logger::Error, and g_log.

Member Function Documentation

◆ activateDomainKey()

bool UeberBackend::activateDomainKey ( const DNSName name,
unsigned int  id 
)

Definition at line 175 of file ueberbackend.cc.

References backends.

◆ addCache()

void UeberBackend::addCache ( const Question q,
const vector< DNSZoneRecord > &  rrs 
)
private

◆ addDomainKey()

bool UeberBackend::addDomainKey ( const DNSName name,
const DNSBackend::KeyData key,
int64_t &  id 
)

Definition at line 130 of file ueberbackend.cc.

References backends.

◆ addNegCache()

void UeberBackend::addNegCache ( const Question q)
private

◆ alsoNotifies()

void UeberBackend::alsoNotifies ( const DNSName domain,
set< string > *  ips 
)

Definition at line 524 of file ueberbackend.cc.

References backends.

Referenced by CommunicatorClass::queueNotifyDomain().

◆ cacheHas()

int UeberBackend::cacheHas ( const Question q,
vector< DNSZoneRecord > &  rrs 
)
private

◆ cleanup()

void UeberBackend::cleanup ( )

Definition at line 463 of file ueberbackend.cc.

References backends, del(), instances, and instances_lock.

Referenced by ~UeberBackend().

◆ createDomain()

bool UeberBackend::createDomain ( const DNSName domain)

Definition at line 111 of file ueberbackend.cc.

References backends.

Referenced by apiServerZones(), createSlaveZone(), createZone(), and loadZone().

◆ deactivateDomainKey()

bool UeberBackend::deactivateDomainKey ( const DNSName name,
unsigned int  id 
)

Definition at line 184 of file ueberbackend.cc.

References backends.

◆ deleteTSIGKey()

bool UeberBackend::deleteTSIGKey ( const DNSName name)

Definition at line 222 of file ueberbackend.cc.

References backends.

Referenced by apiServerTSIGKeyDetail().

◆ doesDNSSEC()

bool UeberBackend::doesDNSSEC ( )

Definition at line 121 of file ueberbackend.cc.

References backends.

◆ get()

◆ getAllDomainMetadata()

bool UeberBackend::getAllDomainMetadata ( const DNSName name,
std::map< std::string, std::vector< std::string > > &  meta 
)

Definition at line 148 of file ueberbackend.cc.

References backends.

Referenced by apiZoneMetadata(), and showZone().

◆ getAllDomains()

void UeberBackend::getAllDomains ( vector< DomainInfo > *  domains,
bool  include_disabled = false 
)

◆ getAuth()

◆ getDomainInfo()

◆ getDomainKeys()

bool UeberBackend::getDomainKeys ( const DNSName name,
std::vector< DNSBackend::KeyData > &  keys 
)

Definition at line 139 of file ueberbackend.cc.

References backends.

Referenced by checkZone().

◆ getDomainMetadata()

◆ getSOA()

◆ getSOAUncached()

◆ getTSIGKey()

◆ getTSIGKeys()

bool UeberBackend::getTSIGKeys ( std::vector< struct TSIGKey > &  keys)

Definition at line 231 of file ueberbackend.cc.

References backends.

Referenced by apiServerTSIGKeys().

◆ getUnfreshSlaveInfos()

void UeberBackend::getUnfreshSlaveInfos ( vector< DomainInfo > *  domains)

Definition at line 260 of file ueberbackend.cc.

References backends.

Referenced by CommunicatorClass::slaveRefresh().

◆ getUpdatedMasters()

void UeberBackend::getUpdatedMasters ( vector< DomainInfo > *  domains)

Definition at line 270 of file ueberbackend.cc.

References backends.

Referenced by CommunicatorClass::masterUpdateCheck().

◆ go()

void UeberBackend::go ( void  )
static

Definition at line 95 of file ueberbackend.cc.

References d_cond, d_go, and d_mut.

Referenced by loadMainConfig(), and main().

◆ loadmodule()

bool UeberBackend::loadmodule ( const string &  name)
static

Loads a module and reports it to all UeberBackend threads.

Definition at line 61 of file ueberbackend.cc.

References Logger::Error, g_log, and Logger::Warning.

Referenced by BackendMakerClass::load(), and loadModules().

◆ loadModules()

bool UeberBackend::loadModules ( const vector< string > &  modules,
const string &  path 
)
static

Definition at line 75 of file ueberbackend.cc.

References loadmodule().

Referenced by loadMainConfig(), and main().

◆ lookup()

◆ rediscover()

void UeberBackend::rediscover ( string *  status = 0)

Definition at line 247 of file ueberbackend.cc.

References backends.

Referenced by DLRediscoverHandler().

◆ reload()

void UeberBackend::reload ( )

Definition at line 239 of file ueberbackend.cc.

References backends.

Referenced by DLReloadHandler().

◆ removeDomainKey()

bool UeberBackend::removeDomainKey ( const DNSName name,
unsigned int  id 
)

Definition at line 193 of file ueberbackend.cc.

References backends.

◆ searchComments()

bool UeberBackend::searchComments ( const string &  pattern,
int  maxResults,
vector< Comment > &  result 
)

Definition at line 643 of file ueberbackend.cc.

References backends.

Referenced by apiServerSearchData().

◆ searchRecords()

bool UeberBackend::searchRecords ( const string &  pattern,
int  maxResults,
vector< DNSResourceRecord > &  result 
)

Definition at line 635 of file ueberbackend.cc.

References backends.

Referenced by apiServerSearchData().

◆ setDomainMetadata()

bool UeberBackend::setDomainMetadata ( const DNSName name,
const std::string &  kind,
const std::vector< std::string > &  meta 
)

Definition at line 166 of file ueberbackend.cc.

References backends.

Referenced by addOrSetMeta(), apiZoneMetadata(), and apiZoneMetadataKind().

◆ setTSIGKey()

bool UeberBackend::setTSIGKey ( const DNSName name,
const DNSName algorithm,
const string &  content 
)

Definition at line 213 of file ueberbackend.cc.

References backends.

Referenced by apiServerTSIGKeyDetail(), and apiServerTSIGKeys().

◆ superMasterBackend()

bool UeberBackend::superMasterBackend ( const string &  ip,
const DNSName domain,
const vector< DNSResourceRecord > &  nsset,
string *  nameserver,
string *  account,
DNSBackend **  db 
)

Definition at line 431 of file ueberbackend.cc.

References backends.

Referenced by PacketHandler::trySuperMasterSynchronous().

Member Data Documentation

◆ backends

◆ d_ancount

int UeberBackend::d_ancount
private

Definition at line 154 of file ueberbackend.hh.

Referenced by get(), lookup(), and UeberBackend().

◆ d_answers

vector<DNSZoneRecord> UeberBackend::d_answers
private

Definition at line 139 of file ueberbackend.hh.

Referenced by get(), getAuth(), getSOA(), and lookup().

◆ d_cache_ttl

unsigned int UeberBackend::d_cache_ttl
private

Definition at line 152 of file ueberbackend.hh.

Referenced by addCache(), cacheHas(), getAuth(), getSOAUncached(), and UeberBackend().

◆ d_cached

bool UeberBackend::d_cached
private

Definition at line 157 of file ueberbackend.hh.

Referenced by get(), lookup(), and UeberBackend().

◆ d_cachehandleiter

vector<DNSZoneRecord>::const_iterator UeberBackend::d_cachehandleiter
private

Definition at line 140 of file ueberbackend.hh.

Referenced by get(), and lookup().

◆ d_cond

pthread_cond_t UeberBackend::d_cond = PTHREAD_COND_INITIALIZER
staticprivate

Definition at line 143 of file ueberbackend.hh.

Referenced by go(), and lookup().

◆ d_domain_id

int UeberBackend::d_domain_id
private

Definition at line 153 of file ueberbackend.hh.

Referenced by lookup(), and UeberBackend().

◆ d_go

bool UeberBackend::d_go =false
staticprivate

Definition at line 158 of file ueberbackend.hh.

Referenced by go(), and lookup().

◆ d_handle

handle UeberBackend::d_handle
private

Definition at line 138 of file ueberbackend.hh.

Referenced by get(), and lookup().

◆ d_mut

pthread_mutex_t UeberBackend::d_mut = PTHREAD_MUTEX_INITIALIZER
staticprivate

Definition at line 142 of file ueberbackend.hh.

Referenced by go(), and lookup().

◆ d_negcache_ttl

unsigned int UeberBackend::d_negcache_ttl
private

Definition at line 152 of file ueberbackend.hh.

Referenced by addNegCache(), cacheHas(), getAuth(), getSOAUncached(), and UeberBackend().

◆ d_negcached

bool UeberBackend::d_negcached
private

Definition at line 156 of file ueberbackend.hh.

Referenced by get(), lookup(), and UeberBackend().

◆ d_question

struct UeberBackend::Question UeberBackend::d_question
private

◆ d_stale

bool UeberBackend::d_stale
private

Definition at line 159 of file ueberbackend.hh.

Referenced by lookup(), and UeberBackend().

◆ d_tid

pthread_t UeberBackend::d_tid
private

Definition at line 137 of file ueberbackend.hh.

Referenced by UeberBackend().

◆ instances

vector< UeberBackend * > UeberBackend::instances
static

Tracks all created UeberBackend instances for us. We use this vector to notify existing threads of new modules

Definition at line 60 of file ueberbackend.hh.

Referenced by cleanup(), UeberBackend(), and UeberBackend::handle::~handle().

◆ instances_lock

pthread_mutex_t UeberBackend::instances_lock =PTHREAD_MUTEX_INITIALIZER
static

Definition at line 61 of file ueberbackend.hh.

Referenced by cleanup(), and UeberBackend().


The documentation for this class was generated from the following files: