]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
we still love ahu, but the AhuException had to go. Welcome to the PDNSException.
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 12 Jul 2013 14:23:43 +0000 (16:23 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 12 Jul 2013 14:23:43 +0000 (16:23 +0200)
75 files changed:
modules/db2backend/DB2Backend.cc
modules/geobackend/geobackend.cc
modules/gmysqlbackend/gmysqlbackend.cc
modules/godbcbackend/godbcbackend.cc
modules/goraclebackend/goraclebackend.cc
modules/gpgsqlbackend/gpgsqlbackend.cc
modules/gsqlite3backend/gsqlite3backend.cc
modules/ldapbackend/ldapbackend.cc
modules/luabackend/minimal.cc
modules/mydnsbackend/mydnsbackend.cc
modules/opendbxbackend/odbxbackend.cc
modules/opendbxbackend/odbxprivate.cc
modules/pipebackend/coprocess.cc
modules/pipebackend/pipebackend.cc
modules/remotebackend/pipeconnector.cc
modules/remotebackend/remotebackend.cc
modules/remotebackend/test-remotebackend-http.cc
modules/remotebackend/test-remotebackend-json.cc
modules/remotebackend/test-remotebackend-pipe.cc
modules/remotebackend/test-remotebackend-post.cc
modules/remotebackend/test-remotebackend-unix.cc
modules/remotebackend/unixconnector.cc
modules/tinydnsbackend/cdb.cc
modules/tinydnsbackend/tinydnsbackend.cc
modules/xdbbackend/xdbbackend.cc
pdns/ahuexception.hh
pdns/arguments.hh
pdns/backends/bind/bindbackend2.cc
pdns/backends/bind/binddnssec.cc
pdns/backends/bind/zone2json.cc
pdns/backends/bind/zone2ldap.cc
pdns/backends/bind/zone2sql.cc
pdns/backends/gsql/gsqlbackend.cc
pdns/communicator.cc
pdns/distributor.hh
pdns/dnsbackend.cc
pdns/dnsbackend.hh
pdns/dnsdist.cc
pdns/dnsproxy.cc
pdns/dnstcpbench.cc
pdns/dynhandler.cc
pdns/dynlistener.cc
pdns/dynloader.cc
pdns/dynmessenger.cc
pdns/iputils.hh
pdns/lock.hh
pdns/lwres.hh
pdns/misc.cc
pdns/nameserver.cc
pdns/nproxy.cc
pdns/nsec3dig.cc
pdns/packethandler.cc
pdns/pdns_recursor.cc
pdns/pdnssec.cc
pdns/pdnsservice.cc
pdns/rec_channel.cc
pdns/rec_channel_rec.cc
pdns/rec_control.cc
pdns/receiver.cc
pdns/reczones.cc
pdns/resolver.cc
pdns/resolver.hh
pdns/sdig.cc
pdns/session.hh
pdns/slavecommunicator.cc
pdns/statbag.cc
pdns/tcpreceiver.cc
pdns/tsig-tests.cc
pdns/ueberbackend.cc
pdns/unix_semaphore.cc
pdns/unix_utility.cc
pdns/win32_dynlistener.cc
pdns/win32_dynloader.cc
pdns/win32_dynmessenger.cc
pdns/win32_pdns_recursor.cc

index ead3deaa05484d2e08090caf4a1701fc582609f7..4839f2cfa55a50f235de39556787dbb40563a9b7 100644 (file)
@@ -249,7 +249,7 @@ DB2Backend::DB2Backend(const string &suffix)
       }
       
       this->Cleanup();
-      throw AhuException("DB2Backend Failed to Start");
+      throw PDNSException("DB2Backend Failed to Start");
    }
    
    L << Logger::Warning << kBackendName << " Connection succeeded" << endl;
@@ -387,7 +387,7 @@ void DB2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pkt_
       // Rethrow for the nameserver
       //
       
-      throw AhuException("Execute failed");
+      throw PDNSException("Execute failed");
    }
 }
 
@@ -430,7 +430,7 @@ bool DB2Backend::list(int inZoneId)
 
    catch (DB2Exception& theException)
    {
-      throw AhuException("List failed");
+      throw PDNSException("List failed");
    }
 
    return theResult;
@@ -494,7 +494,7 @@ bool DB2Backend::get(DNSResourceRecord& outRecord)
       // Rethrow for the nameserver
       //
       
-      throw AhuException("Fetch failed");
+      throw PDNSException("Fetch failed");
    }
    
    return theResult;
@@ -568,7 +568,7 @@ bool DB2Backend::getSOA(const string& inZoneName, SOAData& outSoaData)
       // Rethrow for the nameserver
       //
       
-      throw AhuException("GetSOA failed");
+      throw PDNSException("GetSOA failed");
    }
    
    return theResult;
index a339297343741ae3d9d8b58cd96565cf343fab09..095d88d235a8c15189f6274cacfe7169da8947d9 100644 (file)
@@ -286,7 +286,7 @@ const string GeoBackend::resolveTarget(const GeoRecord &gr, short isocode) const
 void GeoBackend::loadZoneName() {
         zoneName = getArg("zone");
         if (zoneName.empty())
-               throw AhuException("zone parameter must be set");       
+               throw PDNSException("zone parameter must be set");      
 }
 
 void GeoBackend::loadTTLValues() {
@@ -303,7 +303,7 @@ void GeoBackend::loadSOAValues() {
                return;
         
         if (values.size() != 2)
-               throw AhuException("Invalid number of soa-values specified in configuration");
+               throw PDNSException("Invalid number of soa-values specified in configuration");
         
         soaMasterServer = values[0];
         soaHostmaster = values[1];     
@@ -317,14 +317,14 @@ void GeoBackend::loadIPLocationMap() {
         string filename = getArg("ip-map-zonefile");
         
         if (filename.empty())
-               throw AhuException("No IP map zonefile specified in configuration");
+               throw PDNSException("No IP map zonefile specified in configuration");
         
         // Stat file to see if it has changed since last read
         struct stat stbuf;
         if (stat(filename.c_str(), &stbuf) != 0 || !S_ISREG(stbuf.st_mode)) {
                const string errormsg = "stat() failed, or " + filename + " is no regular file.";
                if (lastDiscoverTime == 0)      // We have no older map, bail out
-                       throw AhuException(errormsg);
+                       throw PDNSException(errormsg);
                else {
                        // Log, but continue
                        L << Logger::Error << logprefix << errormsg;
@@ -337,7 +337,7 @@ void GeoBackend::loadIPLocationMap() {
         
         std::ifstream ifs(filename.c_str(), std::ios::in);
         if (!ifs)
-               throw AhuException("Unable to open IP map zonefile for read: " + stringerror());
+               throw PDNSException("Unable to open IP map zonefile for read: " + stringerror());
                
         L << Logger::Info << logprefix << "Parsing IP map zonefile" << endl;
         
@@ -463,9 +463,9 @@ void GeoBackend::loadDirectorMaps(const vector<GeoRecord*> &newgrs) {
                                mapcount++;
                        }
                        else
-                               throw AhuException("duplicate georecord " + gr->qname + ", skipping");
+                               throw PDNSException("duplicate georecord " + gr->qname + ", skipping");
                }
-               catch(AhuException &e) {
+               catch(PDNSException &e) {
                        L << Logger::Error << logprefix << "Error occured while reading director file "
                                << gr->directorfile << ": " << e.reason << endl;
                        delete gr;
@@ -488,7 +488,7 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
         
         std::ifstream ifs(gr.directorfile.c_str(), std::ios::in);
         if (!ifs)
-               throw AhuException("Error opening file.");
+               throw PDNSException("Error opening file.");
         
         string line;
         while(getline(ifs, line)) {
@@ -507,7 +507,7 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
                                gr.qname.resize(gr.qname.size()-1);
                                // Check whether zoneName is a prefix of this FQDN
                                if (gr.qname.rfind(zoneName) == string::npos)
-                                       throw AhuException("georecord " + gr.qname + " is out of zone " + zoneName);
+                                       throw PDNSException("georecord " + gr.qname + " is out of zone " + zoneName);
                        }
                        continue;
                }
@@ -531,8 +531,8 @@ void GeoBackend::loadDirectorMap(GeoRecord &gr) {
         // Do some checks on the validness of this director map / georecord
         
         if (gr.qname.empty())
-               throw AhuException("$RECORD line empty or missing, georecord qname unknown");
+               throw PDNSException("$RECORD line empty or missing, georecord qname unknown");
         
         if (gr.dirmap.count(0) == 0)
-               throw AhuException("No default (0) director map entry");
+               throw PDNSException("No default (0) director map entry");
 }
index ce270b712dbea32c8d611522e735fadca63e36c9..f223e8668154c1ab6e96781b850cf72f282df3f0 100644 (file)
@@ -28,7 +28,7 @@ gMySQLBackend::gMySQLBackend(const string &mode, const string &suffix)  : GSQLBa
   
   catch(SSqlException &e) {
     L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
-    throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
+    throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
   L<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<getArg("host")<<"'."<<endl;
 }
index fc35f65d2f7bc36e5b457eb34ee06b3900e07c74..0c2f8f76e1e5010b7463567ff0e303aecc00daa6 100644 (file)
@@ -27,7 +27,7 @@ gODBCBackend::gODBCBackend (const std::string & mode, const std::string & suffix
   catch( SSqlException & e ) 
   {
     L<<Logger::Error<< mode << " Connection failed: " << e.txtReason() << std::endl;
-    throw AhuException( "Unable to launch " + mode + " connection: " + e.txtReason());
+    throw PDNSException( "Unable to launch " + mode + " connection: " + e.txtReason());
   }
 
   L << Logger::Warning << mode << " Connection successful" << std::endl;
index a7d4694637962eb9871eb47503e219a2746ae135..0dc3407ae4e8e814b4c40a6a923f6696b380cab3 100644 (file)
@@ -33,7 +33,7 @@ gOracleBackend::gOracleBackend(const string &mode, const string &suffix)  : GSQL
   
   catch(SSqlException &e) {
     L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
-    throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
+    throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
   L<<Logger::Warning<<mode<<" Connection successful"<<endl;
 }
index 49f432122ff5eeda46918ba8274e0aa142a90df1..803ba11db644b39ecead525425debe2b1ab1f671 100644 (file)
@@ -28,7 +28,7 @@ gPgSQLBackend::gPgSQLBackend(const string &mode, const string &suffix)  : GSQLBa
   
   catch(SSqlException &e) {
     L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
-    throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
+    throw PDNSException("Unable to launch "+mode+" connection: "+e.txtReason());
   }
   L<<Logger::Info<<mode<<" Connection successful. Connected to database '"<<getArg("dbname")<<"' on '"<<getArg("host")<<"'."<<endl;
 }
index 02dc4fee100081c4f796ad7d5c0de9304dab4117..6fde3e4fce23b1fa8c927336c4dae17134b79e95 100644 (file)
@@ -36,7 +36,7 @@ gSQLite3Backend::gSQLite3Backend( const std::string & mode, const std::string &
   catch( SSqlException & e ) 
   {
     L << Logger::Error << mode << ": connection failed: " << e.txtReason() << std::endl;
-    throw AhuException( "Unable to launch " + mode + " connection: " + e.txtReason());
+    throw PDNSException( "Unable to launch " + mode + " connection: " + e.txtReason());
   }
 
   L << Logger::Info << mode << ": connection to '"<<getArg("database")<<"' successful" << std::endl;
index b9e8db78fe455e32783b1bb640b2eb2aebe888f0..8dc3c204d730981bd6525a2c88067f511dc28db0 100644 (file)
@@ -73,7 +73,7 @@ LdapBackend::LdapBackend( const string &suffix )
         }
 
         if( m_pldap != NULL ) { delete( m_pldap ); }
-        throw( AhuException( "Unable to connect to ldap server" ) );
+        throw( PDNSException( "Unable to connect to ldap server" ) );
 }
 
 
@@ -104,7 +104,7 @@ bool LdapBackend::list( const string& target, int domain_id )
         catch( LDAPException &le )
         {
                L << Logger::Error << m_myname << " Unable to get zone " + target + " from LDAP directory: " << le.what() << endl;
-               throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
+               throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
         }
         catch( std::exception &e )
         {
@@ -184,7 +184,7 @@ void LdapBackend::lookup( const QType &qtype, const string &qname, DNSPacket *dn
         catch( LDAPException &le )
         {
                L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
-               throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
+               throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
         }
         catch( std::exception &e )
         {
@@ -474,7 +474,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
         catch( LDAPException &le )
         {
                L << Logger::Error << m_myname << " Search failed: " << le.what() << endl;
-               throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
+               throw( PDNSException( "LDAP server unreachable" ) );   // try to reconnect to another server
         }
         catch( std::exception &e )
         {
index 1bf9cfed2242e02957873488419a9e8807049309..f3b27bd32dab2cf3f608ace7d445b00b846aab34 100644 (file)
@@ -47,7 +47,7 @@ LUABackend::LUABackend(const string &suffix) {
 
     catch(LUAException &e) {
         L<<Logger::Error<<backend_name<<"Error: "<<e.what<<endl;
-        throw AhuException(e.what);
+        throw PDNSException(e.what);
     }
 
 }
index 29616d50d8eecaced773b40287bf973dd35d3360..9df88cd15b7e68b75715dfd284ee3b1b33015cfd 100644 (file)
@@ -54,7 +54,7 @@ MyDNSBackend::MyDNSBackend(const string &suffix) {
         }
         catch(SSqlException &e) {
                L<<Logger::Error<<backendName<<" Connection failed: "<<e.txtReason()<<endl;
-               throw AhuException(backendName+"Unable to launch connection: "+e.txtReason());
+               throw PDNSException(backendName+"Unable to launch connection: "+e.txtReason());
         }
 
         d_rrtable=getArg("rr-table");
@@ -76,7 +76,7 @@ void MyDNSBackend::Query(const string &query) {
         try {
                d_db->doQuery(query);
         } catch (SSqlException &e) {
-               throw AhuException("Query failed: "+e.txtReason());
+               throw PDNSException("Query failed: "+e.txtReason());
         }
 }
 
@@ -225,7 +225,7 @@ void MyDNSBackend::lookup(const QType &qtype, const string &qname, DNSPacket *p,
                this->Query(query);
 
                if(!d_db->getRow(rrow)) {
-                       throw AhuException("lookup() passed zoneId = "+zoneIdStr+" but no such zone!");
+                       throw PDNSException("lookup() passed zoneId = "+zoneIdStr+" but no such zone!");
                }
                
                found = true;
index f02df7f73c87586018d4b8cc6796b67b8a15841f..e2d8a0df6278fdedbc4fa91e56a4fca12d3dbc54 100644 (file)
@@ -57,13 +57,13 @@ OdbxBackend::OdbxBackend( const string& suffix )
                        stringtok( m_hosts[WRITE], getArg( "host-write" ), ", " );
                }
 
-               if( !connectTo( m_hosts[READ], READ ) ) { throw( AhuException( "Fatal: Connecting to server for reading failed" ) ); }
-               if( !connectTo( m_hosts[WRITE], WRITE ) ) { throw( AhuException( "Fatal: Connecting to server for writing failed" ) ); }
+               if( !connectTo( m_hosts[READ], READ ) ) { throw( PDNSException( "Fatal: Connecting to server for reading failed" ) ); }
+               if( !connectTo( m_hosts[WRITE], WRITE ) ) { throw( PDNSException( "Fatal: Connecting to server for writing failed" ) ); }
         }
         catch( std::exception& e )
         {
                L.log( m_myname + " OdbxBackend(): Caught STL exception - " + e.what(),  Logger::Error );
-               throw( AhuException( "Fatal: STL exception" ) );
+               throw( PDNSException( "Fatal: STL exception" ) );
         }
 }
 
index 998580c12d10d2c38f76be5d4b56f6bfc35ee592..a5f1bec8555d6f09252cdcda0851893f85aa02ce 100644 (file)
@@ -89,7 +89,7 @@ bool OdbxBackend::getRecord( QueryType type )
                if( err < 0 )
                {
                        L.log( m_myname + " getRecord: Unable to get next result - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
-                       throw( AhuException( "Error: odbx_result() failed" ) );
+                       throw( PDNSException( "Error: odbx_result() failed" ) );
                }
 
                if( m_result != NULL )
@@ -99,7 +99,7 @@ bool OdbxBackend::getRecord( QueryType type )
                                if( ( err = odbx_row_fetch( m_result ) ) < 0 )
                                {
                                        L.log( m_myname + " getRecord: Unable to get next row - " + string( odbx_error( m_handle[type], err ) ),  Logger::Error );
-                                       throw( AhuException( "Error: odbx_row_fetch() failed" ) );
+                                       throw( PDNSException( "Error: odbx_row_fetch() failed" ) );
                                }
 
                                if( err > 0 )
index 8f9f454f620e877990607fc61509a7fa21ce8b91..c117ec9d7978f8cacebd9043a44f4bb395c5d6d4 100644 (file)
@@ -38,20 +38,20 @@ void CoProcess::launch(const char **argv, int timeout, int infd, int outfd)
   signal(SIGPIPE, SIG_IGN);
 
   if(access(argv[0],X_OK)) // check before fork so we can throw
-    throw AhuException("Command '"+string(argv[0])+"' cannot be executed: "+stringerror());
+    throw PDNSException("Command '"+string(argv[0])+"' cannot be executed: "+stringerror());
 
   if(pipe(d_fd1)<0 || pipe(d_fd2)<0)
-    throw AhuException("Unable to open pipe for coprocess: "+string(strerror(errno)));
+    throw PDNSException("Unable to open pipe for coprocess: "+string(strerror(errno)));
 
   if((d_pid=fork())<0)
-    throw AhuException("Unable to fork for coprocess: "+stringerror());
+    throw PDNSException("Unable to fork for coprocess: "+stringerror());
   else if(d_pid>0) { // parent speaking
     close(d_fd1[0]);
     Utility::setCloseOnExec(d_fd1[1]);
     close(d_fd2[1]);
     Utility::setCloseOnExec(d_fd2[0]);
     if(!(d_fp=fdopen(d_fd2[0],"r")))
-      throw AhuException("Unable to associate a file pointer with pipe: "+stringerror());
+      throw PDNSException("Unable to associate a file pointer with pipe: "+stringerror());
     setbuf(d_fp,0); // no buffering please, confuses select
   }
   else if(!d_pid) { // child
@@ -96,11 +96,11 @@ void CoProcess::checkStatus()
   int status;
   int ret=waitpid(d_pid, &status, WNOHANG);
   if(ret<0) 
-    throw AhuException("Unable to ascertain status of coprocess "+itoa(d_pid)+" from "+itoa(getpid())+": "+string(strerror(errno)));
+    throw PDNSException("Unable to ascertain status of coprocess "+itoa(d_pid)+" from "+itoa(getpid())+": "+string(strerror(errno)));
   else if(ret) {
     if(WIFEXITED(status)) {
       int ret=WEXITSTATUS(status);
-      throw AhuException("Coprocess exited with code "+itoa(ret));
+      throw PDNSException("Coprocess exited with code "+itoa(ret));
     }
     if(WIFSIGNALED(status)) {
       int sig=WTERMSIG(status);
@@ -110,7 +110,7 @@ void CoProcess::checkStatus()
         reason+=". Dumped core";
 #endif
       
-      throw AhuException(reason);
+      throw PDNSException(reason);
     }
   }
 }
@@ -128,7 +128,7 @@ void CoProcess::send(const string &snd)
   while(sent<line.size()) {
     bytes=write(d_fd1[1],line.c_str()+sent,line.length()-sent);
     if(bytes<0)
-      throw AhuException("Writing to coprocess failed: "+string(strerror(errno)));
+      throw PDNSException("Writing to coprocess failed: "+string(strerror(errno)));
 
     sent+=bytes;
   }
@@ -145,13 +145,13 @@ void CoProcess::receive(string &receive)
     FD_SET(fileno(d_fp),&rds);
     int ret=select(fileno(d_fp)+1,&rds,0,0,&tv);
     if(ret<0)
-      throw AhuException("Error waiting on data from coprocess: "+stringerror());
+      throw PDNSException("Error waiting on data from coprocess: "+stringerror());
     if(!ret)
-      throw AhuException("Timeout waiting for data from coprocess");
+      throw PDNSException("Timeout waiting for data from coprocess");
   }
 
   if(!stringfgets(d_fp, receive))
-    throw AhuException("Child closed pipe");
+    throw PDNSException("Child closed pipe");
   
   trim_right(receive);
 }
@@ -168,7 +168,7 @@ UnixRemote::UnixRemote(const string& path, int timeout)
 {
   d_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
   if(d_fd < 0)
-    throw AhuException("Unable to create UNIX domain socket: "+string(strerror(errno)));
+    throw PDNSException("Unable to create UNIX domain socket: "+string(strerror(errno)));
 
   struct sockaddr_un remote;
   memset(&remote, 0, sizeof(remote));
@@ -229,7 +229,7 @@ main()
     cp.sendReceive("www.trilab.com", reply);
     cout<<"Answered: '"<<reply<<"'"<<endl;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     cerr<<ae.reason<<endl;
   }
   
index daf3876dbe5b2b575d9278fdd52bd41ba6073dc4..0ac908211b4b276d1ae7c17bc1ec51df9f5b855d 100644 (file)
@@ -65,7 +65,7 @@ void CoWrapper::send(const string &line)
       d_cp->send(line);
       return;
    }
-   catch(AhuException &ae) {
+   catch(PDNSException &ae) {
       delete d_cp;
       d_cp=0;
       throw;
@@ -78,7 +78,7 @@ void CoWrapper::receive(string &line)
       d_cp->receive(line);
       return;
    }
-   catch(AhuException &ae) {
+   catch(PDNSException &ae) {
       L<<Logger::Warning<<kBackendId<<" unable to receive data from coprocess. "<<ae.reason<<endl;
       delete d_cp;
       d_cp=0;
@@ -138,7 +138,7 @@ void PipeBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_
          d_coproc->send(query.str());
       }
    }
-   catch(AhuException &ae) {
+   catch(PDNSException &ae) {
       L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
       throw; // hop
    }
@@ -159,7 +159,7 @@ bool PipeBackend::list(const string &target, int inZoneId)
 
       d_coproc->send(query.str());
    }
-   catch(AhuException &ae) {
+   catch(PDNSException &ae) {
       L<<Logger::Error<<kBackendId<<" Error from coprocess: "<<ae.reason<<endl;
       throw;
    }
@@ -204,7 +204,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
       stringtok(parts,line,"\t");
       if(parts.empty()) {
          L<<Logger::Error<<kBackendId<<" coprocess returned emtpy line in query for "<<d_qname<<endl;
-         throw AhuException("Format error communicating with coprocess");
+         throw PDNSException("Format error communicating with coprocess");
       }
       else if(parts[0]=="FAIL") {
          throw DBException("coprocess returned a FAIL");
@@ -219,7 +219,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
       else if(parts[0]=="DATA") { // yay
          if(parts.size() < 7 + extraFields) {
             L<<Logger::Error<<kBackendId<<" coprocess returned incomplete or empty line in data section for query for "<<d_qname<<endl;
-            throw AhuException("Format error communicating with coprocess in data section");
+            throw PDNSException("Format error communicating with coprocess in data section");
             // now what?
          }
          
@@ -246,7 +246,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
          else {
            if(parts.size()< 8 + extraFields) {
             L<<Logger::Error<<kBackendId<<" coprocess returned incomplete MX/SRV line in data section for query for "<<d_qname<<endl;
-            throw AhuException("Format error communicating with coprocess in data section of MX/SRV record");
+            throw PDNSException("Format error communicating with coprocess in data section of MX/SRV record");
            }
            
            r.priority=atoi(parts[6+extraFields].c_str());
@@ -255,7 +255,7 @@ bool PipeBackend::get(DNSResourceRecord &r)
          break;
       }
       else
-         throw AhuException("Coprocess backend sent incorrect response '"+line+"'");
+         throw PDNSException("Coprocess backend sent incorrect response '"+line+"'");
    }   
    return true;
 }
index f86fd28c863a1575aaa1b564e1cab5f6c9142f3e..36cf3110ce499c52a795ebdb8795901f7b20a5af 100644 (file)
@@ -5,7 +5,7 @@
 PipeConnector::PipeConnector(std::map<std::string,std::string> options) {
   if (options.count("command") == 0) {
     L<<Logger::Error<<"Cannot find 'command' option in connection string"<<endl;
-    throw new AhuException();
+    throw new PDNSException();
   }
   this->command = options.find("command")->second;
   this->options = options;
@@ -50,20 +50,20 @@ void PipeConnector::launch() {
   signal(SIGPIPE, SIG_IGN);
 
   if(access(argv[0],X_OK)) // check before fork so we can throw
-    throw AhuException("Command '"+string(argv[0])+"' cannot be executed: "+stringerror());
+    throw PDNSException("Command '"+string(argv[0])+"' cannot be executed: "+stringerror());
 
   if(pipe(d_fd1)<0 || pipe(d_fd2)<0)
-    throw AhuException("Unable to open pipe for coprocess: "+string(strerror(errno)));
+    throw PDNSException("Unable to open pipe for coprocess: "+string(strerror(errno)));
 
   if((d_pid=fork())<0)
-    throw AhuException("Unable to fork for coprocess: "+stringerror());
+    throw PDNSException("Unable to fork for coprocess: "+stringerror());
   else if(d_pid>0) { // parent speaking
     close(d_fd1[0]);
     Utility::setCloseOnExec(d_fd1[1]);
     close(d_fd2[1]);
     Utility::setCloseOnExec(d_fd2[0]);
     if(!(d_fp=fdopen(d_fd2[0],"r")))
-      throw AhuException("Unable to associate a file pointer with pipe: "+stringerror());
+      throw PDNSException("Unable to associate a file pointer with pipe: "+stringerror());
     setbuf(d_fp,0); // no buffering please, confuses select
   }
   else if(!d_pid) { // child
@@ -125,7 +125,7 @@ int PipeConnector::send_message(const rapidjson::Document &input)
    while(sent<line.size()) {
      bytes=write(d_fd1[1],line.c_str()+sent,line.length()-sent);
      if(bytes<0)
-       throw AhuException("Writing to coprocess failed: "+std::string(strerror(errno)));
+       throw PDNSException("Writing to coprocess failed: "+std::string(strerror(errno)));
 
      sent+=bytes;
    }
@@ -151,13 +151,13 @@ int PipeConnector::recv_message(rapidjson::Document &output)
        FD_SET(fileno(d_fp),&rds);
        int ret=select(fileno(d_fp)+1,&rds,0,0,&tv);
        if(ret<0) 
-         throw AhuException("Error waiting on data from coprocess: "+stringerror());
+         throw PDNSException("Error waiting on data from coprocess: "+stringerror());
        if(!ret)
-         throw AhuException("Timeout waiting for data from coprocess");
+         throw PDNSException("Timeout waiting for data from coprocess");
      }
 
      if(!stringfgets(d_fp, receive))
-       throw AhuException("Child closed pipe");
+       throw PDNSException("Child closed pipe");
   
       s_output.append(receive);
       rapidjson::StringStream ss(s_output.c_str());
@@ -173,11 +173,11 @@ bool PipeConnector::checkStatus()
   int status;
   int ret=waitpid(d_pid, &status, WNOHANG);
   if(ret<0)
-    throw AhuException("Unable to ascertain status of coprocess "+itoa(d_pid)+" from "+itoa(getpid())+": "+string(strerror(errno)));
+    throw PDNSException("Unable to ascertain status of coprocess "+itoa(d_pid)+" from "+itoa(getpid())+": "+string(strerror(errno)));
   else if(ret) {
     if(WIFEXITED(status)) {
       int ret=WEXITSTATUS(status);
-      throw AhuException("Coprocess exited with code "+itoa(ret));
+      throw PDNSException("Coprocess exited with code "+itoa(ret));
     }
     if(WIFSIGNALED(status)) {
       int sig=WTERMSIG(status);
@@ -187,7 +187,7 @@ bool PipeConnector::checkStatus()
         reason+=". Dumped core";
 #endif
 
-      throw AhuException(reason);
+      throw PDNSException(reason);
     }
   }
   return true;
index 7adedf43047a578f0a04bafc2f65b8cf59cb99a9..1039d12a1505d4a40376052545a34599910e74da 100644 (file)
@@ -68,7 +68,7 @@ RemoteBackend::~RemoteBackend() {
 bool RemoteBackend::send(rapidjson::Document &value) {
    try {
      return connector->send(value);
-   } catch (AhuException &ex) {
+   } catch (PDNSException &ex) {
      L<<Logger::Error<<"Exception caught when sending: "<<ex.reason<<std::endl;
    } catch (...) {
      L<<Logger::Error<<"Exception caught when sending"<<std::endl;
@@ -82,7 +82,7 @@ bool RemoteBackend::send(rapidjson::Document &value) {
 bool RemoteBackend::recv(rapidjson::Document &value) {
    try {
      return connector->recv(value);
-   } catch (AhuException &ex) {
+   } catch (PDNSException &ex) {
      L<<Logger::Error<<"Exception caught when receiving: "<<ex.reason<<std::endl;
    } catch (...) {
      L<<Logger::Error<<"Exception caught when receiving"<<std::endl;;
@@ -108,7 +108,7 @@ int RemoteBackend::build() {
       size_t pos;
       pos = d_connstr.find_first_of(":");
       if (pos == std::string::npos)
-         throw AhuException("Invalid connection string: malformed");
+         throw PDNSException("Invalid connection string: malformed");
 
       type = d_connstr.substr(0, pos);
       opts = d_connstr.substr(pos+1);
@@ -142,12 +142,12 @@ int RemoteBackend::build() {
 #ifdef REMOTEBACKEND_HTTP
         this->connector = new HTTPConnector(options);
 #else
-       throw AhuException("Invalid connection string: http connector support not enabled. Recompile with --enable-remotebackend-http");
+       throw PDNSException("Invalid connection string: http connector support not enabled. Recompile with --enable-remotebackend-http");
 #endif
       } else if (type == "pipe") {
         this->connector = new PipeConnector(options);
       } else {
-        throw AhuException("Invalid connection string: unknown connector");
+        throw PDNSException("Invalid connection string: unknown connector");
       }
 
       return -1;
@@ -162,7 +162,7 @@ void RemoteBackend::lookup(const QType &qtype, const std::string &qdomain, DNSPa
    rapidjson::Value parameters;
 
    if (d_index != -1) 
-      throw AhuException("Attempt to lookup while one running");
+      throw PDNSException("Attempt to lookup while one running");
 
    query.SetObject();
    JSON_ADD_MEMBER(query, "method", "lookup", query.GetAllocator())
@@ -206,7 +206,7 @@ bool RemoteBackend::list(const std::string &target, int domain_id) {
    rapidjson::Value parameters;
 
    if (d_index != -1)
-      throw AhuException("Attempt to lookup while one running");
+      throw PDNSException("Attempt to lookup while one running");
 
    query.SetObject();
    JSON_ADD_MEMBER(query, "method", "list", query.GetAllocator());
@@ -497,7 +497,7 @@ bool RemoteBackend::getDomainInfo(const string &domain, DomainInfo &di) {
    // make sure we got zone & kind
    if (!answer["result"].HasMember("zone")) {
       L<<Logger::Error<<kBackendId<<"Missing zone in getDomainInfo return value"<<endl;
-      throw AhuException();
+      throw PDNSException();
    }
    value = -1;
    // parse return value. we need at least zone,serial,kind
@@ -810,7 +810,7 @@ bool RemoteBackend::getBool(rapidjson::Value &value) {
      if (boost::iequals(tmp, "0") || boost::iequals(tmp, "false")) return false;
    }
    std::cerr << value.GetType() << endl;
-   throw new AhuException("Cannot convert rapidjson value into boolean");
+   throw new PDNSException("Cannot convert rapidjson value into boolean");
 }
 
 bool Connector::getBool(rapidjson::Value &value) {
@@ -846,7 +846,7 @@ int RemoteBackend::getInt(rapidjson::Value &value) {
      std::string tmp = value.GetString();
      return boost::lexical_cast<int>(tmp);
    }
-   throw new AhuException("Cannot convert rapidjson value into integer");
+   throw new PDNSException("Cannot convert rapidjson value into integer");
 }
 
 unsigned int RemoteBackend::getUInt(rapidjson::Value &value) {
@@ -858,7 +858,7 @@ unsigned int RemoteBackend::getUInt(rapidjson::Value &value) {
      std::string tmp = value.GetString();
      return boost::lexical_cast<unsigned int>(tmp);
    }
-   throw new AhuException("Cannot convert rapidjson value into integer");
+   throw new PDNSException("Cannot convert rapidjson value into integer");
 }
 
 int64_t RemoteBackend::getInt64(rapidjson::Value &value) {
@@ -870,7 +870,7 @@ int64_t RemoteBackend::getInt64(rapidjson::Value &value) {
      std::string tmp = value.GetString();
      return boost::lexical_cast<int64_t>(tmp);
    }
-   throw new AhuException("Cannot convert rapidjson value into integer");
+   throw new PDNSException("Cannot convert rapidjson value into integer");
 }
 
 std::string RemoteBackend::getString(rapidjson::Value &value) {
@@ -879,7 +879,7 @@ std::string RemoteBackend::getString(rapidjson::Value &value) {
    if (value.IsInt64()) return boost::lexical_cast<std::string>(value.GetInt64());
    if (value.IsInt()) return boost::lexical_cast<std::string>(value.GetInt());
    if (value.IsDouble()) return boost::lexical_cast<std::string>(value.GetDouble());
-   throw new AhuException("Cannot convert rapidjson value into std::string");
+   throw new PDNSException("Cannot convert rapidjson value into std::string");
 }
 
 double RemoteBackend::getDouble(rapidjson::Value &value) {
@@ -891,7 +891,7 @@ double RemoteBackend::getDouble(rapidjson::Value &value) {
      std::string tmp = value.GetString();
      return boost::lexical_cast<double>(tmp);
    }
-   throw new AhuException("Cannot convert rapidjson value into double");
+   throw new PDNSException("Cannot convert rapidjson value into double");
 }
 
 DNSBackend *RemoteBackend::maker()
index f91d05ad9ff4ae77dd53b6bff71487164961962a..7fa1be8b47f5d6a798243e8b494763f83ae62eb6 100644 (file)
@@ -52,7 +52,7 @@ struct RemotebackendSetup {
                 ::arg().set("remote-connection-string")="http:url=http://localhost:62434/dns";
                 ::arg().set("remote-dnssec")="yes";
                 be = BackendMakers().all()[0];
-       } catch (AhuException &ex) {
+       } catch (PDNSException &ex) {
                BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
        };
     }
index 1522d52ab75b7ff3b695881d63a101ef6a5677cf..04b3966b8e99b454fd01a6414e9dd833fe67194b 100644 (file)
@@ -52,7 +52,7 @@ struct RemotebackendSetup {
                 ::arg().set("remote-connection-string")="http:url=http://localhost:62434/dns/endpoint.json,post=1,post_json=1";
                 ::arg().set("remote-dnssec")="yes";
                 be = BackendMakers().all()[0];
-       } catch (AhuException &ex) {
+       } catch (PDNSException &ex) {
                BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
        };
     }
index 9a4eb15547011f9dbbb07ae631989f1756a42ff8..3b0d55ee1f95d2ae8551eb2cc39bc3f9cc0e95c1 100644 (file)
@@ -54,7 +54,7 @@ struct RemotebackendSetup {
                SOARecordContent::report();
                NSRecordContent::report();
                 ARecordContent::report();
-       } catch (AhuException &ex) {
+       } catch (PDNSException &ex) {
                BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
        };
     }
index 754e7a9afdbd1070c16290b062af1a2d9091cd43..8326e5a85597c94b567cd7b661150c353b8b9f94 100644 (file)
@@ -52,7 +52,7 @@ struct RemotebackendSetup {
                 ::arg().set("remote-connection-string")="http:url=http://localhost:62434/dns,post=1";
                 ::arg().set("remote-dnssec")="yes";
                 be = BackendMakers().all()[0];
-       } catch (AhuException &ex) {
+       } catch (PDNSException &ex) {
                BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
        };
     }
index 823da3be39390f0244307138bd45bc6c15568435..b2f9ca09e8768ea2b75aa383b6f74cd789906ec8 100644 (file)
@@ -54,7 +54,7 @@ struct RemotebackendSetup {
                SOARecordContent::report();
                NSRecordContent::report();
                 ARecordContent::report();
-       } catch (AhuException &ex) {
+       } catch (PDNSException &ex) {
                BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
        };
     }
index bd7320d535c005f4d3d2905cd34d5af233fabeec..e0871a741285c8ef8202b3f350213188e701194c 100644 (file)
@@ -10,7 +10,7 @@
 UnixsocketConnector::UnixsocketConnector(std::map<std::string,std::string> options) {
    if (options.count("path") == 0) {
      L<<Logger::Error<<"Cannot find 'path' option in connection string"<<endl;
-     throw new AhuException();
+     throw new PDNSException();
    } 
    this->timeout = 2000;
    if (options.find("timeout") != options.end()) { 
index 3105c68b8307dbdecd9bfaadb7c2bf6b35661b4d..69b9cc6cb502e6f0fa6b75cf2ea2b72aef359775 100644 (file)
@@ -12,14 +12,14 @@ CDB::CDB(const string &cdbfile)
        if (d_fd < 0)
        {
                L<<Logger::Error<<"Failed to open cdb database file '"<<cdbfile<<"'. Error: "<<stringerror()<<endl;
-               throw new AhuException("Failed to open cdb database file '"+cdbfile+"'. Error: " + stringerror());
+               throw new PDNSException("Failed to open cdb database file '"+cdbfile+"'. Error: " + stringerror());
        }
 
        int cdbinit = cdb_init(&d_cdb, d_fd);
        if (cdbinit < 0) 
        {
                L<<Logger::Error<<"Failed to initialize cdb structure. ErrorNr: '"<<cdbinit<<endl;
-               throw new AhuException("Failed to initialize cdb structure.");
+               throw new PDNSException("Failed to initialize cdb structure.");
        }
 }
 
index 640f1b803b09e04ac61ba844a1b5c3a71130c724..34091386ec4cb19082c1d440bb3c43aa58e4ff63 100644 (file)
@@ -112,7 +112,7 @@ void TinyDNSBackend::getUpdatedMasters(vector<DomainInfo>* retDomains) {
 void TinyDNSBackend::setNotified(uint32_t id, uint32_t serial) {
        Lock l(&s_domainInfoLock);
        if (!s_domainInfo.count(d_suffix)) {
-               throw new AhuException("Can't get list of domains to set the serial.");
+               throw new PDNSException("Can't get list of domains to set the serial.");
        }
        TDI_t *domains = &s_domainInfo[d_suffix];
        TDIById_t& domain_index = domains->get<tag_domainid>();
index 3f55db2bbe3e20be0ef0a2e8ded9284c7d0e38be..560b964970e455c2490fd8c4ddf031ff471d86fa 100644 (file)
@@ -20,7 +20,7 @@ public:
     }
     catch(XDBException &e) {
       L<<Logger::Error<<"[XDBBackend] Error: "<<e.what<<endl;
-      throw AhuException(e.what);
+      throw PDNSException(e.what);
     }
     L<<Logger::Error<<"[XDBBackend] Open"<<endl;
   }
index 57bd2aa6587d47a6bd61a575c35424e6b923ee88..53a20fc9fac6a649ddee68327ab68b3fed8197c0 100644 (file)
 #include "namespaces.hh"
 
 //! Generic Exception thrown 
-class AhuException
+class PDNSException
 {
 public:
-  AhuException(){reason="Unspecified";};
-  AhuException(string r){reason=r;};
+  PDNSException(){reason="Unspecified";};
+  PDNSException(string r){reason=r;};
   
   string reason; //! Print this to tell the user what went wrong
 };
 
-class TimeoutException : public AhuException
+class TimeoutException : public PDNSException
 {};
 
 #endif
index 865239337c72f0502de1966efc54d4af5afb9a9b..b4331c2524c01a1a31d9dc16da068e8d9518bfbe 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "namespaces.hh"
 
-typedef AhuException ArgException;
+typedef PDNSException ArgException;
 
 /** This class helps parsing argc and argv into a map of parameters. We have 3 kinds of formats:
 
index 07e2f1c238e90c09cdfcbb2d61d6d20485e40c4f..76c061f69c57da0c045ef9b713b85f032dc64871 100644 (file)
@@ -426,7 +426,7 @@ void Bind2Backend::insert(shared_ptr<State> stage, int id, const string &qnameu,
   else if(bdr.qname.length() > bb2.d_name.length() && dottedEndsOn(bdr.qname, bb2.d_name))
     bdr.qname.resize(bdr.qname.length() - (bb2.d_name.length() + 1));
   else
-    throw AhuException("Trying to insert non-zone data, name='"+bdr.qname+"', qtype="+qtype.getName()+", zone='"+bb2.d_name+"'");
+    throw PDNSException("Trying to insert non-zone data, name='"+bdr.qname+"', qtype="+qtype.getName()+", zone='"+bb2.d_name+"'");
 
   bdr.qname.swap(bdr.qname);
 
@@ -657,7 +657,7 @@ void Bind2Backend::loadConfig(string* status)
     try {
       BP.parse(getArg("config"));
     }
-    catch(AhuException &ae) {
+    catch(PDNSException &ae) {
       L<<Logger::Error<<"Error parsing bind configuration: "<<ae.reason<<endl;
       throw;
     }
@@ -759,7 +759,7 @@ void Bind2Backend::loadConfig(string* status)
             
             //  s_stage->id_zone_map[bbd->d_id].d_records->swap(*s_staging_zone_map[bbd->d_id].d_records);
           }
-          catch(AhuException &ae) {
+          catch(PDNSException &ae) {
             ostringstream msg;
             msg<<" error at "+nowTime()+" parsing '"<<i->name<<"' from file '"<<i->filename<<"': "<<ae.reason;
 
@@ -895,7 +895,7 @@ void Bind2Backend::queueReload(BB2DomainInfo *bbd)
     bbd->d_status="parsed into memory at "+nowTime();
     L<<Logger::Warning<<"Zone '"<<bbd->d_name<<"' ("<<bbd->d_filename<<") reloaded"<<endl;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     ostringstream msg;
     msg<<" error at "+nowTime()+" parsing '"<<bbd->d_name<<"' from file '"<<bbd->d_filename<<"': "<<ae.reason;
     bbd->d_status=msg.str();
index 6bea89479edf7a124f663a511f4e57e48b06d107..715dc8ca990917184dbe5c7dca91cba409099047 100644 (file)
@@ -91,7 +91,7 @@ void Bind2Backend::createDNSSECDB(const string& fname)
       db.doCommand(statement);
   }
   catch(SSqlException& se) {
-    throw AhuException("Error creating database in BIND backend: "+se.txtReason());
+    throw PDNSException("Error creating database in BIND backend: "+se.txtReason());
   }
 }
 
@@ -137,7 +137,7 @@ bool Bind2Backend::getDomainMetadata(const string& name, const std::string& kind
     }
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
   }
   return true;
 }
@@ -155,7 +155,7 @@ bool Bind2Backend::setDomainMetadata(const string& name, const std::string& kind
       d_dnssecdb->doCommand((fmt2 % d_dnssecdb->escape(name) % d_dnssecdb->escape(kind) % d_dnssecdb->escape(meta.begin()->c_str())).str());
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
   }
   return true;
 
@@ -180,7 +180,7 @@ bool Bind2Backend::getDomainKeys(const string& name, unsigned int kind, std::vec
     }
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
   }
   
   return true;
@@ -216,7 +216,7 @@ int Bind2Backend::addDomainKey(const string& name, const KeyData& key)
     d_dnssecdb->doCommand((fmt % d_dnssecdb->escape(name) % key.flags % key.active % d_dnssecdb->escape(key.content)).str());
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());    
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());    
   }
   
   return true;
@@ -233,7 +233,7 @@ bool Bind2Backend::activateDomainKey(const string& name, unsigned int id)
     d_dnssecdb->doCommand((fmt % d_dnssecdb->escape(name) % id).str());
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());    
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());    
   }
   
   return true;
@@ -250,7 +250,7 @@ bool Bind2Backend::deactivateDomainKey(const string& name, unsigned int id)
     d_dnssecdb->doCommand((fmt % d_dnssecdb->escape(name) % id).str());
   }
   catch(SSqlException& se) {
-    throw AhuException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
+    throw PDNSException("Error accessing DNSSEC database in BIND backend: "+se.txtReason());
   }
   
   return true;
@@ -266,7 +266,7 @@ bool Bind2Backend::getTSIGKey(const string& name, string* algorithm, string* con
     d_dnssecdb->doQuery( (fmt % d_dnssecdb->escape(name)).str());
   }
   catch (SSqlException &e) {
-    throw AhuException("BindBackend unable to retrieve named TSIG key: "+e.txtReason());
+    throw PDNSException("BindBackend unable to retrieve named TSIG key: "+e.txtReason());
   }
   
   SSql::row_t row;
index 3de2ec556f90d10d40618704d7f09437520a7c3c..3b8488b5817fe771a2b6c7b4b06d7e33b46fc232 100644 (file)
@@ -208,7 +208,7 @@ int main(int argc, char **argv)
             else
               cerr<<endl<<ae.what()<<endl;
           }
-          catch(AhuException &ae) {
+          catch(PDNSException &ae) {
             if(!::arg().mustDo("on-error-resume-next"))
               throw;
             else
@@ -234,7 +234,7 @@ int main(int argc, char **argv)
     cerr<<num_domainsdone<<" domains were fully parsed, containing "<<g_numRecords<<" records\n";
     
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     cerr<<"\nFatal error: "<<ae.reason<<endl;
     return 0;
   }
index 4cf88eb9e7fd4f03065c60ecf9db5324fda1bc25..cc69d0aea8fdc866f093283022a3a102790fdf16 100644 (file)
@@ -210,7 +210,7 @@ int main( int argc, char* argv[] )
                                                        callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority);
                                        }
                                }
-                               catch( AhuException &ae )
+                               catch( PDNSException &ae )
                                {
                                        cerr << "Fatal error: " << ae.reason << endl;
                                        if( !args.mustDo( "resume" ) )
@@ -235,7 +235,7 @@ int main( int argc, char* argv[] )
                                callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority);
                }
         }
-        catch( AhuException &ae )
+        catch( PDNSException &ae )
         {
                cerr << "Fatal error: " << ae.reason << endl;
                return 1;
index 0519697bc61941b3f3da36dbd4417d1611120981..ff43f3d557594599077577da43b8ab71e2f34a9c 100644 (file)
@@ -354,7 +354,7 @@ int main(int argc, char **argv)
             else
               cerr<<endl<<ae.what()<<endl;
           }
-          catch(AhuException &ae) {
+          catch(PDNSException &ae) {
             if(!::arg().mustDo("on-error-resume-next"))
               throw;
             else
@@ -380,7 +380,7 @@ int main(int argc, char **argv)
     cerr<<num_domainsdone<<" domains were fully parsed, containing "<<g_numRecords<<" records\n";
     
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     cerr<<"\nFatal error: "<<ae.reason<<endl;
     return 0;
   }
index 81058096918111ed97e88508c770bd5970ef9e33..91cc4fc10151e9b4b3356d5538c6ee83dd622409 100644 (file)
@@ -54,7 +54,7 @@ void GSQLBackend::setNotified(uint32_t domain_id, uint32_t serial)
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to refresh domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to refresh domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
 }
 
@@ -69,7 +69,7 @@ void GSQLBackend::setFresh(uint32_t domain_id)
     d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to refresh domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to refresh domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
 }
 
@@ -83,7 +83,7 @@ bool GSQLBackend::isMaster(const string &domain, const string &ip)
     d_db->doQuery(output, d_result);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
   }
 
   if(d_result.empty())
@@ -116,7 +116,7 @@ bool GSQLBackend::getDomainInfo(const string &domain, DomainInfo &di)
     d_db->doQuery(output,d_result);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
   }
 
   int numanswers=d_result.size();
@@ -139,7 +139,7 @@ bool GSQLBackend::getDomainInfo(const string &domain, DomainInfo &di)
       else
         di.serial=sd.serial;
     }
-    catch(AhuException &ae){
+    catch(PDNSException &ae){
       L<<Logger::Error<<"Error retrieving serial for '"<<domain<<"': "<<ae.reason<<endl;
     }
     
@@ -161,7 +161,7 @@ void GSQLBackend::getUnfreshSlaveInfos(vector<DomainInfo> *unfreshDomains)
     d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
   }
 
   vector<DomainInfo> allSlaves;
@@ -197,7 +197,7 @@ void GSQLBackend::getUpdatedMasters(vector<DomainInfo> *updatedDomains)
     d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
   }
 
   vector<DomainInfo> allMasters;
@@ -336,7 +336,7 @@ bool GSQLBackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const std
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to update ordername/auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to update ordername/auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
   return true;
 }
@@ -352,7 +352,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndUpdateAuth(uint32_t domain_id, const
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to nullify ordername and update auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to nullify ordername and update auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
   return true;
 }
@@ -368,7 +368,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndAuth(uint32_t domain_id, const std::s
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to nullify ordername/auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to nullify ordername/auth for domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
   return true;
 }
@@ -384,7 +384,7 @@ bool GSQLBackend::setDNSSECAuthOnDsRecord(uint32_t domain_id, const std::string&
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to set auth on DS record "+qname+" for domain_id "+itoa(domain_id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to set auth on DS record "+qname+" for domain_id "+itoa(domain_id)+": "+e.txtReason());
   }
   return true;
 }
@@ -399,7 +399,7 @@ bool GSQLBackend::updateEmptyNonTerminals(uint32_t domain_id, const std::string&
       d_db->doCommand(output);
     }
     catch (SSqlException &e) {
-      throw AhuException("GSQLBackend unable to delete empty non-terminal records from domain_id "+itoa(domain_id)+": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to delete empty non-terminal records from domain_id "+itoa(domain_id)+": "+e.txtReason());
       return false;
     }
   }
@@ -411,7 +411,7 @@ bool GSQLBackend::updateEmptyNonTerminals(uint32_t domain_id, const std::string&
         d_db->doCommand(output);
       }
       catch (SSqlException &e) {
-        throw AhuException("GSQLBackend unable to delete empty non-terminal rr "+qname+" from domain_id "+itoa(domain_id)+": "+e.txtReason());
+        throw PDNSException("GSQLBackend unable to delete empty non-terminal rr "+qname+" from domain_id "+itoa(domain_id)+": "+e.txtReason());
         return false;
       }
     }
@@ -423,7 +423,7 @@ bool GSQLBackend::updateEmptyNonTerminals(uint32_t domain_id, const std::string&
       d_db->doCommand(output);
     }
     catch (SSqlException &e) {
-      throw AhuException("GSQLBackend unable to insert empty non-terminal rr "+qname+" in domain_id "+itoa(domain_id)+": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to insert empty non-terminal rr "+qname+" in domain_id "+itoa(domain_id)+": "+e.txtReason());
       return false;
     }
   }
@@ -453,7 +453,7 @@ bool GSQLBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string&
     d_db->doQuery(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend unable to find before/after (after) for domain_id "+itoa(id)+": "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to find before/after (after) for domain_id "+itoa(id)+": "+e.txtReason());
   }
   while(d_db->getRow(row)) {
     after=row[0];
@@ -465,7 +465,7 @@ bool GSQLBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string&
       d_db->doQuery(output);
     }
     catch(SSqlException &e) {
-      throw AhuException("GSQLBackend unable to find before/after (first) for domain_id "+itoa(id)+": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to find before/after (first) for domain_id "+itoa(id)+": "+e.txtReason());
     }
     while(d_db->getRow(row)) {
       after=row[0];
@@ -480,7 +480,7 @@ bool GSQLBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string&
       d_db->doQuery(output);
     }
     catch(SSqlException &e) {
-      throw AhuException("GSQLBackend unable to find before/after (before) for domain_id "+itoa(id)+": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to find before/after (before) for domain_id "+itoa(id)+": "+e.txtReason());
     }
     while(d_db->getRow(row)) {
       before=row[0];
@@ -498,7 +498,7 @@ bool GSQLBackend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string&
       d_db->doQuery(output);
     }
     catch(SSqlException &e) {
-      throw AhuException("GSQLBackend unable to find before/after (last) for domain_id "+itoa(id)+": "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to find before/after (last) for domain_id "+itoa(id)+": "+e.txtReason());
     }
     while(d_db->getRow(row)) {
       before=row[0];
@@ -523,7 +523,7 @@ int GSQLBackend::addDomainKey(const string& name, const KeyData& key)
     d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to store key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to store key: "+e.txtReason());
   }
   return 1; // XXX FIXME, no idea how to get the id
 }
@@ -539,7 +539,7 @@ bool GSQLBackend::activateDomainKey(const string& name, unsigned int id)
     d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to activate key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to activate key: "+e.txtReason());
   }
   return true;
 }
@@ -555,7 +555,7 @@ bool GSQLBackend::deactivateDomainKey(const string& name, unsigned int id)
     d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to deactivate key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to deactivate key: "+e.txtReason());
   }
   return true;
 }
@@ -571,7 +571,7 @@ bool GSQLBackend::removeDomainKey(const string& name, unsigned int id)
     d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to remove key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to remove key: "+e.txtReason());
   }
   return true;
 }
@@ -588,7 +588,7 @@ bool GSQLBackend::getTSIGKey(const string& name, string* algorithm, string* cont
     d_db->doQuery(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to retrieve named TSIG key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to retrieve named TSIG key: "+e.txtReason());
   }
   
   SSql::row_t row;
@@ -613,7 +613,7 @@ bool GSQLBackend::getDomainKeys(const string& name, unsigned int kind, std::vect
     d_db->doQuery(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to list keys: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to list keys: "+e.txtReason());
   }
   
   SSql::row_t row;
@@ -655,7 +655,7 @@ bool GSQLBackend::getDomainMetadata(const string& name, const std::string& kind,
     d_db->doQuery(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to list metadata: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to list metadata: "+e.txtReason());
   }
   
   SSql::row_t row;
@@ -684,7 +684,7 @@ bool GSQLBackend::setDomainMetadata(const string& name, const std::string& kind,
       d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to store metadata key: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to store metadata key: "+e.txtReason());
   }
   
   return true;
@@ -744,7 +744,7 @@ void GSQLBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_
     d_db->doQuery(output);
   }
   catch(SSqlException &e) {
-    throw AhuException(e.txtReason());
+    throw PDNSException(e.txtReason());
   }
 
   d_qname=qname;
@@ -762,7 +762,7 @@ bool GSQLBackend::list(const string &target, int domain_id )
     d_db->doQuery(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("GSQLBackend list query: "+e.txtReason());
+    throw PDNSException("GSQLBackend list query: "+e.txtReason());
   }
 
   d_qname="";
@@ -782,7 +782,7 @@ bool GSQLBackend::superMasterBackend(const string &ip, const string &domain, con
       d_db->doQuery(output, d_result);
     }
     catch (SSqlException &e) {
-      throw AhuException("GSQLBackend unable to search for a domain: "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to search for a domain: "+e.txtReason());
     }
 
     if(!d_result.empty()) {
@@ -804,7 +804,7 @@ bool GSQLBackend::createSlaveDomain(const string &ip, const string &domain, cons
     d_db->doCommand(output);
   }
   catch(SSqlException &e) {
-    throw AhuException("Database error trying to insert new slave '"+domain+"': "+ e.txtReason());
+    throw PDNSException("Database error trying to insert new slave '"+domain+"': "+ e.txtReason());
   }
   return true;
 }
@@ -817,7 +817,7 @@ void GSQLBackend::getAllDomains(vector<DomainInfo> *domains)
     d_db->doQuery(d_getAllDomainsQuery.c_str()); 
   }
   catch (SSqlException &e) {
-    throw AhuException("Database error trying to retrieve all domains:" + e.txtReason());
+    throw PDNSException("Database error trying to retrieve all domains:" + e.txtReason());
   }
 
   SSql::row_t row;
@@ -909,7 +909,7 @@ bool GSQLBackend::feedRecord(const DNSResourceRecord &r, string *ordername)
     d_db->doCommand(output.c_str());
   }
   catch (SSqlException &e) {
-    throw AhuException("GSQLBackend unable to feed record: "+e.txtReason());
+    throw PDNSException("GSQLBackend unable to feed record: "+e.txtReason());
   }
   return true; // XXX FIXME this API should not return 'true' I think -ahu 
 }
@@ -924,7 +924,7 @@ bool GSQLBackend::feedEnts(int domain_id, set<string>& nonterm)
       d_db->doCommand(output.c_str());
     }
     catch (SSqlException &e) {
-      throw AhuException("GSQLBackend unable to feed empty non-terminal: "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to feed empty non-terminal: "+e.txtReason());
     }
   }
   return true;
@@ -948,7 +948,7 @@ bool GSQLBackend::feedEnts3(int domain_id, const string &domain, set<string> &no
       d_db->doCommand(output.c_str());
     }
     catch (SSqlException &e) {
-      throw AhuException("GSQLBackend unable to feed empty non-terminal: "+e.txtReason());
+      throw PDNSException("GSQLBackend unable to feed empty non-terminal: "+e.txtReason());
     }
   }
   return true;
@@ -965,7 +965,7 @@ bool GSQLBackend::startTransaction(const string &domain, int domain_id)
      d_db->doCommand(output);
   }
   catch (SSqlException &e) {
-    throw AhuException("Database failed to start transaction: "+e.txtReason());
+    throw PDNSException("Database failed to start transaction: "+e.txtReason());
   }
 
   return true;
@@ -977,7 +977,7 @@ bool GSQLBackend::commitTransaction()
     d_db->doCommand("commit");
   }
   catch (SSqlException &e) {
-    throw AhuException("Database failed to commit transaction: "+e.txtReason());
+    throw PDNSException("Database failed to commit transaction: "+e.txtReason());
   }
   return true;
 }
@@ -988,7 +988,7 @@ bool GSQLBackend::abortTransaction()
     d_db->doCommand("rollback");
   }
   catch(SSqlException &e) {
-    throw AhuException("Database failed to abort transaction: "+string(e.txtReason()));
+    throw PDNSException("Database failed to abort transaction: "+string(e.txtReason()));
   }
   return true;
 }
index 4f2038e79b02f4867b6c3c741fa7785467dae117..fbe9f167d0456528f474b3bbf4c6d4c710f091fc 100644 (file)
@@ -97,7 +97,7 @@ void CommunicatorClass::mainloop(void)
       }
     }
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Exiting because communicator thread died with error: "<<ae.reason<<endl;
     Utility::sleep(1);
     exit(0);
index 38784e0d5c5d3f1ee077343d6cbcc984f5081520..76067a7dfedf989914817971fcd63a1df118829d 100644 (file)
@@ -195,7 +195,7 @@ template<class Answer, class Question, class Backend>void *Distributor<Answer,Qu
         a=b->question(q); // a can be NULL!
         delete q;
       }
-      catch(const AhuException &e) {
+      catch(const PDNSException &e) {
         L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
         delete b;
         return 0;
@@ -232,7 +232,7 @@ template<class Answer, class Question, class Backend>void *Distributor<Answer,Qu
     
     delete b;
   }
-  catch(const AhuException &AE) {
+  catch(const PDNSException &AE) {
     L<<Logger::Error<<Logger::NTLog<<"Distributor caught fatal exception: "<<AE.reason<<endl;
   }
   catch(...) {
@@ -253,7 +253,7 @@ template<class Answer, class Question, class Backend>int Distributor<Answer,Ques
     try {
       a=b->question(q); // a can be NULL!
     }
-    catch(const AhuException &e) {
+    catch(const PDNSException &e) {
       L<<Logger::Error<<"Backend error: "<<e.reason<<endl;
       delete b;
       b=0;
index 270c0639e9633b322ecc8c232ac1c637d8ac4f4e..42641da4532427d7146a889bcf7087b0dd70b35c 100644 (file)
@@ -168,7 +168,7 @@ vector<DNSBackend *>BackendMakerClass::all(bool metadataOnly)
 {
   vector<DNSBackend *>ret;
   if(d_instances.empty())
-    throw AhuException("No database backends configured for launch, unable to function");
+    throw PDNSException("No database backends configured for launch, unable to function");
 
   try {
     for(vector<pair<string,string> >::const_iterator i=d_instances.begin();i!=d_instances.end();++i) {
@@ -178,12 +178,12 @@ vector<DNSBackend *>BackendMakerClass::all(bool metadataOnly)
       else 
         made = d_repository[i->first]->make(i->second);
       if(!made)
-        throw AhuException("Unable to launch backend '"+i->first+"'");
+        throw PDNSException("Unable to launch backend '"+i->first+"'");
 
       ret.push_back(made);
     }
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Caught an exception instantiating a backend: "<<ae.reason<<endl;
     L<<Logger::Error<<"Cleaning up"<<endl;
     for(vector<DNSBackend *>::const_iterator i=ret.begin();i!=ret.end();++i)
index 2dae53cba0ce2b2d09e9528dd869d22f79c1d24e..7bc4185daedd6af9043a91b73483ce2217f6a851 100644 (file)
@@ -70,7 +70,7 @@ class DNSPacket;
     issues should lead to DBExceptions.
 
     More serious errors, which may indicate that the database connection is hosed, or a configuration error occurred, should
-    lead to the throwing of an AhuException. This exception will fall straight through the UeberBackend and the PacketHandler
+    lead to the throwing of an PDNSException. This exception will fall straight through the UeberBackend and the PacketHandler
     and be caught by the Distributor, which will delete your DNSBackend instance and spawn a new one.
 */
 class DNSBackend
@@ -310,10 +310,10 @@ private:
 extern BackendMakerClass &BackendMakers();
 
 //! Exception that can be thrown by a DNSBackend to indicate a failure
-class DBException : public AhuException
+class DBException : public PDNSException
 {
 public:
-  DBException(const string &reason) : AhuException(reason){}
+  DBException(const string &reason) : PDNSException(reason){}
 };
 
 
index ce02ab4e11a3104ac838e7a6534c34274c533bc4..5509637fec4f1c09b3301761435cdf700c2acf76 100644 (file)
@@ -551,7 +551,7 @@ catch(std::exception &e)
 {
   errlog("Fatal: %s", e.what());
 }
-catch(AhuException &ae)
+catch(PDNSException &ae)
 {
   errlog("Fatal: %s", ae.reason);
 }
index 09f49f68e89a663099a2d72359966dc49f4941a2..afa114ffaad67fcb0e2cc1612f6ac9a00d796f0f 100644 (file)
@@ -38,7 +38,7 @@ DNSProxy::DNSProxy(const string &remote)
   ComboAddress remaddr(remote, 53);
   
   if((d_sock=socket(remaddr.sin4.sin_family, SOCK_DGRAM,0))<0)
-    throw AhuException(string("socket: ")+strerror(errno));
+    throw PDNSException(string("socket: ")+strerror(errno));
  
   ComboAddress local;
   if(remaddr.sin4.sin_family==AF_INET)
@@ -56,11 +56,11 @@ DNSProxy::DNSProxy(const string &remote)
   if(n==10) {
     Utility::closesocket(d_sock);
     d_sock=-1;
-    throw AhuException(string("binding dnsproxy socket: ")+strerror(errno));
+    throw PDNSException(string("binding dnsproxy socket: ")+strerror(errno));
   }
 
   if(connect(d_sock, (sockaddr *)&remaddr, remaddr.getSocklen())<0) 
-    throw AhuException("Unable to UDP connect to remote nameserver "+remaddr.toStringWithPort()+": "+stringerror());
+    throw PDNSException("Unable to UDP connect to remote nameserver "+remaddr.toStringWithPort()+": "+stringerror());
 
   d_xor=Utility::random()&0xffff;
   L<<Logger::Error<<"DNS Proxy launched, local port "<<ntohs(local.sin4.sin_port)<<", remote "<<remaddr.toStringWithPort()<<endl;
@@ -197,7 +197,7 @@ void DNSProxy::mainloop(void)
       }
     }
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Fatal error in DNS proxy: "<<ae.reason<<endl;
   }
   catch(std::exception &e) {
index 34754abf2895d08ef3e81cfa9bb8eeba099ba5d0..ec887b9caaf784e4a89f028511ce5b936aec8828 100644 (file)
@@ -121,7 +121,7 @@ try
   }
   
   if(sock.read((char *) &len, 2) != 2)
-    throw AhuException("tcp read failed");
+    throw PDNSException("tcp read failed");
   
   len=ntohs(len);
   char *creply = new char[len];
@@ -130,7 +130,7 @@ try
   while(n<len) {
     numread=sock.read(creply+n, len-n);
     if(numread<0)
-      throw AhuException("tcp read failed");
+      throw PDNSException("tcp read failed");
     n+=numread;
   }
   
index 141ed1bec28cfdcc9e3d5b77faa4941f320546fe..dde9d89041ca3996045b80e10d384f6f4ad82fbd 100644 (file)
@@ -252,7 +252,7 @@ string DLRediscoverHandler(const vector<string>&parts, Utility::pid_t ppid)
     P.getBackend()->rediscover(&status);
     return status;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     return ae.reason;
   }
 
index 32e526da1cdb56b40c30a509a87c98ae30fa4a60..597eadd5089ba2a7843e1714c5524b1898472786 100644 (file)
@@ -72,7 +72,7 @@ void DynListener::createSocketAndBind(int family, struct sockaddr*local, size_t
   
   int tmp=1;
   if(setsockopt(d_s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0)
-    throw AhuException(string("Setsockopt failed on control socket: ")+strerror(errno));
+    throw PDNSException(string("Setsockopt failed on control socket: ")+strerror(errno));
     
   if(bind(d_s, local, len) < 0) {
     if (family == AF_UNIX)
@@ -262,14 +262,14 @@ string DynListener::getLine()
   else {
     if(isatty(0))
       if(write(1, "% ", 2) !=2)
-        throw AhuException("Writing to console: "+stringerror());
+        throw PDNSException("Writing to console: "+stringerror());
     if((len=read(0, &mesg[0], mesg.size())) < 0) 
-      throw AhuException("Reading from the control pipe: "+stringerror());
+      throw PDNSException("Reading from the control pipe: "+stringerror());
     else if(len==0)
-      throw AhuException("Guardian exited - going down as well");
+      throw PDNSException("Guardian exited - going down as well");
 
     if(len == (int)mesg.size()) {
-      throw AhuException("Line on control console was too long");
+      throw PDNSException("Line on control console was too long");
     }
     mesg[len]=0;
   }
@@ -346,7 +346,7 @@ void DynListener::theListener()
       sendLine((*(s_funcdb[parts[0]].func))(parts,d_ppid));
     }
   }
-  catch(AhuException &AE)
+  catch(PDNSException &AE)
     {
       L<<Logger::Error<<"Fatal error in control listener: "<<AE.reason<<endl;
     }
index ed25e2909b808e6dbd2ee067895104418ecbe647..943165e13814f5a0d09652cd0bed5d3bbcce3dcd 100644 (file)
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
     
     cout<<resp<<endl;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     cerr<<"Fatal error: "<<ae.reason<<endl;
     return 1;
   }
index 7200e279a5d45defa6246ba9fe982ed4e6ea72c1..d11d44995665e5109da93599504ebd8e6a6bf192 100644 (file)
@@ -31,7 +31,7 @@ DynMessenger::DynMessenger(const string &localdir, const string &fname)
   Utility::setCloseOnExec(d_s);
   
   if(d_s<0) {
-    throw AhuException(string("socket")+strerror(errno));
+    throw PDNSException(string("socket")+strerror(errno));
   }
   
   memset(&d_local,0,sizeof(d_local));
@@ -43,13 +43,13 @@ DynMessenger::DynMessenger(const string &localdir, const string &fname)
   strcpy(d_local.sun_path,localname.c_str());
 
   if(mkstemp(d_local.sun_path)<0)
-    throw AhuException("Unable to generate local temporary file: "+string(strerror(errno)));
+    throw PDNSException("Unable to generate local temporary file: "+string(strerror(errno)));
   
   unlink(d_local.sun_path);
   
   if(bind(d_s, (sockaddr*)&d_local,sizeof(d_local))<0) {
     unlink(d_local.sun_path);
-    throw AhuException("Unable to bind to local temporary file: "+string(strerror(errno)));
+    throw PDNSException("Unable to bind to local temporary file: "+string(strerror(errno)));
   }
   
   if(chmod(d_local.sun_path,0666)<0) { // make sure that pdns can reply!
@@ -64,7 +64,7 @@ DynMessenger::DynMessenger(const string &localdir, const string &fname)
   strcpy(d_remote.sun_path,fname.c_str());
   if(connect(d_s,(sockaddr*)&d_remote,sizeof(d_remote))<0) {
     unlink(d_local.sun_path);
-    throw AhuException("Unable to connect to remote '"+fname+"': "+string(strerror(errno)));
+    throw PDNSException("Unable to connect to remote '"+fname+"': "+string(strerror(errno)));
   }
   
 }
@@ -76,12 +76,12 @@ DynMessenger::DynMessenger(const ComboAddress& remote, const string &secret)
   Utility::setCloseOnExec(d_s);
  
   if(d_s<0) {
-    throw AhuException(string("socket")+strerror(errno));
+    throw PDNSException(string("socket")+strerror(errno));
   }
   
   if(connect(d_s, (sockaddr*)&remote, remote.getSocklen())<0) {
     close(d_s);
-    throw AhuException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+string(strerror(errno)));
+    throw PDNSException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+string(strerror(errno)));
   }
 
   string login=secret+"\n";
@@ -113,7 +113,7 @@ string DynMessenger::receive() const
   for(;;) {
     retlen=recv(d_s,buffer,sizeof(buffer),0);
     if(retlen<0)
-      throw AhuException("Error from remote: "+string(strerror(errno)));
+      throw PDNSException("Error from remote: "+string(strerror(errno)));
 
     answer.append(buffer,retlen);
     if(retlen!=sizeof(buffer))
index 17e563dba8173864e3fa9eddaaec03cf84a57f8c..14844dfb858766f4e9a9e210055c2e83acb15e53 100644 (file)
@@ -120,7 +120,7 @@ union ComboAddress {
     if(makeIPv4sockaddr(str, &sin4)) {
       sin6.sin6_family = AF_INET6;
       if(makeIPv6sockaddr(str, &sin6) < 0)
-        throw AhuException("Unable to convert presentation address '"+ str +"'"); 
+        throw PDNSException("Unable to convert presentation address '"+ str +"'"); 
       
     }
     if(!sin4.sin_port) // 'str' overrides port!
@@ -148,7 +148,7 @@ union ComboAddress {
   ComboAddress mapToIPv4() const
   {
     if(!isMappedIPv4())
-      throw AhuException("ComboAddress can't map non-mapped IPv6 address back to IPv4");
+      throw PDNSException("ComboAddress can't map non-mapped IPv6 address back to IPv4");
     ComboAddress ret;
     ret.sin4.sin_family=AF_INET;
     ret.sin4.sin_port=sin4.sin_port;
@@ -177,10 +177,10 @@ union ComboAddress {
 };
 
 /** This exception is thrown by the Netmask class and by extension by the NetmaskGroup class */
-class NetmaskException: public AhuException 
+class NetmaskException: public PDNSException 
 {
 public:
-  NetmaskException(const string &a) : AhuException(a) {}
+  NetmaskException(const string &a) : PDNSException(a) {}
 };
 
 inline ComboAddress makeComboAddress(const string& str)
index b98b69e7f0b289ea5ffec6f1f9d3cea1bb350b0c..749ec7aa1d319d91064dfd42d527d5bba851b86a 100644 (file)
@@ -36,7 +36,7 @@ public:
     if(g_singleThreaded)
       return;
     if((errno=pthread_mutex_lock(d_lock)))
-      throw AhuException("error acquiring lock: "+stringerror());
+      throw PDNSException("error acquiring lock: "+stringerror());
   }
   ~Lock()
   {
@@ -58,7 +58,7 @@ public:
       return;
 
     if((errno=pthread_rwlock_wrlock(d_lock))) {
-      throw AhuException("error acquiring rwlock wrlock: "+stringerror());
+      throw PDNSException("error acquiring rwlock wrlock: "+stringerror());
     }
   }
   ~WriteLock()
@@ -85,7 +85,7 @@ public:
 
     d_havelock=false;
     if((errno=pthread_rwlock_trywrlock(d_lock)) && errno!=EBUSY)
-      throw AhuException("error acquiring rwlock tryrwlock: "+stringerror());
+      throw PDNSException("error acquiring rwlock tryrwlock: "+stringerror());
     d_havelock=(errno==0);
   }
   ~TryWriteLock()
@@ -119,7 +119,7 @@ public:
     }
 
     if((errno=pthread_rwlock_tryrdlock(d_lock)) && errno!=EBUSY)
-      throw AhuException("error acquiring rwlock tryrdlock: "+stringerror());
+      throw PDNSException("error acquiring rwlock tryrdlock: "+stringerror());
     d_havelock=(errno==0);
   }
   ~TryReadLock()
@@ -151,7 +151,7 @@ public:
       return;
 
     if((errno=pthread_rwlock_rdlock(d_lock)))
-      throw AhuException("error acquiring rwlock tryrwlock: "+stringerror());
+      throw PDNSException("error acquiring rwlock tryrwlock: "+stringerror());
   }
   ~ReadLock()
   {
index 75da5f62e0ccbc4006a2fbca33f7e0b0683e777a..045e0c8cec740e2049fb4bf3abb0948c0adcdc03 100644 (file)
@@ -45,10 +45,10 @@ int asendto(const char *data, int len, int flags, const ComboAddress& ip, uint16
 int arecvfrom(char *data, int len, int flags, const ComboAddress& ip, int *d_len, uint16_t id, 
               const string& domain, uint16_t, int fd, struct timeval* now);
 
-class LWResException : public AhuException
+class LWResException : public PDNSException
 {
 public:
-  LWResException(const string &reason) : AhuException(reason){}
+  LWResException(const string &reason) : PDNSException(reason){}
 };
 
 //! LWRes class 
index 08375617a2bb427d133f06ba9af97ef68e977f58..52844603be38a8ff4077d37bd6afec809babf53b 100644 (file)
@@ -282,7 +282,7 @@ static void parseService4(const string &descr, ServiceTuple &st)
   vector<string>parts;
   stringtok(parts,descr,":");
   if(parts.empty())
-    throw AhuException("Unable to parse '"+descr+"' as a service");
+    throw PDNSException("Unable to parse '"+descr+"' as a service");
   st.host=parts[0];
   if(parts.size()>1)
     st.port=atoi(parts[1].c_str());
@@ -292,7 +292,7 @@ static void parseService6(const string &descr, ServiceTuple &st)
 {
   string::size_type pos=descr.find(']');
   if(pos == string::npos)
-    throw AhuException("Unable to parse '"+descr+"' as an IPv6 service");
+    throw PDNSException("Unable to parse '"+descr+"' as an IPv6 service");
 
   st.host=descr.substr(1, pos-1);
   if(pos + 2 < descr.length())
@@ -303,7 +303,7 @@ static void parseService6(const string &descr, ServiceTuple &st)
 void parseService(const string &descr, ServiceTuple &st)
 {
   if(descr.empty())
-    throw AhuException("Unable to parse '"+descr+"' as a service");
+    throw PDNSException("Unable to parse '"+descr+"' as a service");
 
   vector<string> parts;
   stringtok(parts, descr, ":");
@@ -804,5 +804,5 @@ bool stringfgets(FILE* fp, std::string& line)
 Regex::Regex(const string &expr)
 {
   if(regcomp(&d_preg, expr.c_str(), REG_ICASE|REG_NOSUB|REG_EXTENDED))
-    throw AhuException("Regular expression did not compile");
+    throw PDNSException("Regular expression did not compile");
 }
index da25beca0db3a9db2812b6d8bdfe6e437ec9514a..a1bf64edf02f2e6294bf7456cfcca34ac7be1712 100644 (file)
@@ -47,7 +47,7 @@ extern StatBag S;
     \section overview High level overview
 
     The Distributor contains a configurable number of PacketHandler instances, each in its own thread, for connection pooling. 
-    PacketHandler instances are recycled of they let escape an AhuException.
+    PacketHandler instances are recycled of they let escape an PDNSException.
 
     The PacketHandler implements the RFC1034 algorithm and converts question packets into DNSBackend queries.
 
@@ -91,7 +91,7 @@ void UDPNameserver::bindIPv4()
   stringtok(locals,::arg()["local-address"]," ,");
 
   if(locals.empty())
-    throw AhuException("No local address specified");
+    throw PDNSException("No local address specified");
 
   int s;
   for(vector<string>::const_iterator i=locals.begin();i!=locals.end();++i) {
@@ -101,12 +101,12 @@ void UDPNameserver::bindIPv4()
     s=socket(AF_INET,SOCK_DGRAM,0);
 
     if(s<0)
-      throw AhuException("Unable to acquire a UDP socket: "+string(strerror(errno)));
+      throw PDNSException("Unable to acquire a UDP socket: "+string(strerror(errno)));
   
     Utility::setCloseOnExec(s);
   
     if(!Utility::setNonBlocking(s))
-      throw AhuException("Unable to set UDP socket to non-blocking: "+stringerror());
+      throw PDNSException("Unable to set UDP socket to non-blocking: "+stringerror());
   
     memset(&locala,0,sizeof(locala));
     locala.sin4.sin_family=AF_INET;
@@ -117,12 +117,12 @@ void UDPNameserver::bindIPv4()
     }
     locala=ComboAddress(localname, ::arg().asNum("local-port"));
     if(locala.sin4.sin_family != AF_INET) 
-      throw AhuException("Attempting to bind IPv4 socket to IPv6 address");
+      throw PDNSException("Attempting to bind IPv4 socket to IPv6 address");
 
     g_localaddresses.push_back(locala);
     if(::bind(s, (sockaddr*)&locala, locala.getSocklen()) < 0) {
       L<<Logger::Error<<"binding UDP socket to '"+locala.toStringWithPort()+": "<<strerror(errno)<<endl;
-      throw AhuException("Unable to bind to UDP socket");
+      throw PDNSException("Unable to bind to UDP socket");
     }
     d_sockets.push_back(s);
     L<<Logger::Error<<"UDP server bound to "<<locala.toStringWithPort()<<endl;
@@ -193,11 +193,11 @@ void UDPNameserver::bindIPv6()
 
     s=socket(AF_INET6,SOCK_DGRAM,0);
     if(s<0)
-      throw AhuException("Unable to acquire a UDPv6 socket: "+string(strerror(errno)));
+      throw PDNSException("Unable to acquire a UDPv6 socket: "+string(strerror(errno)));
 
     Utility::setCloseOnExec(s);
     if(!Utility::setNonBlocking(s))
-      throw AhuException("Unable to set UDPv6 socket to non-blocking: "+stringerror());
+      throw PDNSException("Unable to set UDPv6 socket to non-blocking: "+stringerror());
 
 
     ComboAddress locala(localname, ::arg().asNum("local-port"));
@@ -211,7 +211,7 @@ void UDPNameserver::bindIPv6()
     g_localaddresses.push_back(locala);
     if(::bind(s, (sockaddr*)&locala, sizeof(locala))<0) {
       L<<Logger::Error<<"binding to UDP ipv6 socket: "<<strerror(errno)<<endl;
-      throw AhuException("Unable to bind to UDP ipv6 socket");
+      throw PDNSException("Unable to bind to UDP ipv6 socket");
     }
     d_sockets.push_back(s);
     struct pollfd pfd;
@@ -402,7 +402,7 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled)
     }
   }
   if(sock==-1)
-    throw AhuException("poll betrayed us! (should not happen)");
+    throw PDNSException("poll betrayed us! (should not happen)");
   
 
   DLOG(L<<"Received a packet " << len <<" bytes long from "<< remote.toString()<<endl);
index 4d92871e04acd30919d1bdb86a07139dfdc592dd..2d1b6c5d56eb192bb0fb042db881edf5975c8cca 100644 (file)
@@ -304,7 +304,7 @@ catch(std::exception& e)
 {
   syslogFmt(boost::format("Fatal: %s") % e.what());
 }
-catch(AhuException& e)
+catch(PDNSException& e)
 {
   syslogFmt(boost::format("Fatal: %s") % e.reason);
 }
index dd5c58da7909a953151011c8fe9adcdf4d3d2fc1..f7540109ced27b083d9b1db399ca80a09d07b3a0 100644 (file)
@@ -88,12 +88,12 @@ try
   uint16_t len;
   len = htons(packet.size());
   if(sock.write((char *) &len, 2) != 2)
-    throw AhuException("tcp write failed");
+    throw PDNSException("tcp write failed");
 
   sock.writen(string((char*)&*packet.begin(), (char*)&*packet.end()));
   
   if(sock.read((char *) &len, 2) != 2)
-    throw AhuException("tcp read failed");
+    throw PDNSException("tcp read failed");
 
   len=ntohs(len);
   char *creply = new char[len];
@@ -102,7 +102,7 @@ try
   while(n<len) {
     numread=sock.read(creply+n, len-n);
     if(numread<0)
-      throw AhuException("tcp read failed");
+      throw PDNSException("tcp read failed");
     n+=numread;
   }
 
index 80f9088cae61385a4af4cf97a921762e82f2b53d..d852f39b00fa62985250aa1bd45f221dde5ad044 100644 (file)
@@ -751,7 +751,7 @@ int PacketHandler::trySuperMasterSynchronous(DNSPacket *p)
   try {
     db->createSlaveDomain(p->getRemote(),p->qdomain,account);
   }
-  catch(AhuException& ae) {
+  catch(PDNSException& ae) {
     L<<Logger::Error<<"Database error trying to create "<<p->qdomain<<" for potential supermaster "<<p->getRemote()<<": "<<ae.reason<<endl;
     return RCode::ServFail;
   }
@@ -1413,7 +1413,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
     S.inc("servfail-packets");
     S.ringAccount("servfail-queries",p->qdomain);
   }
-  catch(AhuException &e) {
+  catch(PDNSException &e) {
     L<<Logger::Error<<"Backend reported permanent error which prevented lookup ("+e.reason+") sending out servfail"<<endl;
     throw; // we WANT to die at this point
   }
index a3339921b144946185476947f114df21d1b33bbb..33a569f83bea6f1341de7e8c88055b313c588128 100644 (file)
@@ -298,7 +298,7 @@ public:
   {
     socks_t::iterator i=d_socks.find(fd);
     if(i==d_socks.end()) {
-      throw AhuException("Trying to return a socket (fd="+lexical_cast<string>(fd)+") not in the pool");
+      throw PDNSException("Trying to return a socket (fd="+lexical_cast<string>(fd)+") not in the pool");
     }
     returnSocketLocked(i);
   }
@@ -307,7 +307,7 @@ public:
   void returnSocketLocked(socks_t::iterator& i)
   {
     if(i==d_socks.end()) {
-      throw AhuException("Trying to return a socket not in the pool");
+      throw PDNSException("Trying to return a socket not in the pool");
     }
     try {
       t_fdm->removeReadFD(*i);
@@ -330,7 +330,7 @@ public:
       return ret;
     
     if(ret<0) 
-      throw AhuException("Making a socket for resolver (family = "+lexical_cast<string>(family)+"): "+stringerror());
+      throw PDNSException("Making a socket for resolver (family = "+lexical_cast<string>(family)+"): "+stringerror());
 
     Utility::setCloseOnExec(ret);
 
@@ -349,7 +349,7 @@ public:
         break;
     }
     if(!tries)
-      throw AhuException("Resolver binding to local query client socket: "+stringerror());
+      throw PDNSException("Resolver binding to local query client socket: "+stringerror());
     
     Utility::setNonBlocking(ret);
     return ret;
@@ -674,7 +674,7 @@ void startDoResolve(void *p)
     delete dc;
     dc=0;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"startDoResolve problem"<<loginfo<<": "<<ae.reason<<endl;
     delete dc;
   }
@@ -938,7 +938,7 @@ void makeTCPServerSockets()
   stringtok(locals,::arg()["local-address"]," ,");
 
   if(locals.empty())
-    throw AhuException("No local address specified");
+    throw PDNSException("No local address specified");
   
   for(vector<string>::const_iterator i=locals.begin();i!=locals.end();++i) {
     ServiceTuple st;
@@ -952,14 +952,14 @@ void makeTCPServerSockets()
     if(!IpToU32(st.host, (uint32_t*)&sin.sin4.sin_addr.s_addr)) {
       sin.sin6.sin6_family = AF_INET6;
       if(makeIPv6sockaddr(st.host, &sin.sin6) < 0)
-        throw AhuException("Unable to resolve local address for TCP server on '"+ st.host +"'"); 
+        throw PDNSException("Unable to resolve local address for TCP server on '"+ st.host +"'"); 
     }
 
     fd=socket(sin.sin6.sin6_family, SOCK_STREAM, 0);
     Utility::setCloseOnExec(fd);
 
     if(fd<0) 
-      throw AhuException("Making a TCP server socket for resolver: "+stringerror());
+      throw PDNSException("Making a TCP server socket for resolver: "+stringerror());
 
     int tmp=1;
     if(setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
@@ -977,7 +977,7 @@ void makeTCPServerSockets()
     sin.sin4.sin_port = htons(st.port);
     int socklen=sin.sin4.sin_family==AF_INET ? sizeof(sin.sin4) : sizeof(sin.sin6);
     if (::bind(fd, (struct sockaddr *)&sin, socklen )<0) 
-      throw AhuException("Binding TCP server socket for "+ st.host +": "+stringerror());
+      throw PDNSException("Binding TCP server socket for "+ st.host +": "+stringerror());
     
     Utility::setNonBlocking(fd);
     setSocketSendBuffer(fd, 65000);
@@ -1000,7 +1000,7 @@ void makeUDPServerSockets()
   stringtok(locals,::arg()["local-address"]," ,");
 
   if(locals.empty())
-    throw AhuException("No local address specified");
+    throw PDNSException("No local address specified");
   
   if(::arg()["local-address"]=="0.0.0.0") {
     L<<Logger::Warning<<"It is advised to bind to explicit addresses with the --local-address option"<<endl;
@@ -1018,14 +1018,14 @@ void makeUDPServerSockets()
     if(!IpToU32(st.host.c_str() , (uint32_t*)&sin.sin4.sin_addr.s_addr)) {
       sin.sin6.sin6_family = AF_INET6;
       if(makeIPv6sockaddr(st.host, &sin.sin6) < 0)
-        throw AhuException("Unable to resolve local address for UDP server on '"+ st.host +"'"); 
+        throw PDNSException("Unable to resolve local address for UDP server on '"+ st.host +"'"); 
     }
     
     int fd=socket(sin.sin4.sin_family, SOCK_DGRAM, 0);
     Utility::setCloseOnExec(fd);
 
     if(fd < 0) {
-      throw AhuException("Making a UDP server socket for resolver: "+netstringerror());
+      throw PDNSException("Making a UDP server socket for resolver: "+netstringerror());
     }
 
     setSocketReceiveBuffer(fd, 200000);
@@ -1033,7 +1033,7 @@ void makeUDPServerSockets()
 
     int socklen=sin.sin4.sin_family==AF_INET ? sizeof(sin.sin4) : sizeof(sin.sin6);
     if (::bind(fd, (struct sockaddr *)&sin, socklen)<0) 
-      throw AhuException("Resolver binding to server socket on port "+ lexical_cast<string>(st.port) +" for "+ st.host+": "+stringerror());
+      throw PDNSException("Resolver binding to server socket on port "+ lexical_cast<string>(st.port) +" for "+ st.host+": "+stringerror());
     
     Utility::setNonBlocking(fd);
 
@@ -1177,7 +1177,7 @@ try
       L<<Logger::Error<<"Failed to update . records, RCODE="<<res<<endl;
   }
 }
-catch(AhuException& ae)
+catch(PDNSException& ae)
 {
   L<<Logger::Error<<"Fatal error: "<<ae.reason<<endl;
   throw;
@@ -1341,7 +1341,7 @@ void handleRCC(int fd, FDMultiplexer::funcparam_t& var)
   catch(std::exception& e) {
     L<<Logger::Error<<"Error dealing with control socket request: "<<e.what()<<endl;
   }
-  catch(AhuException& ae) {
+  catch(PDNSException& ae) {
     L<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
   }
 }
@@ -1571,7 +1571,7 @@ try
     return new string("ok\n");
   }
 }
-catch(AhuException& ae)
+catch(PDNSException& ae)
 {
   return new string(ae.reason+"\n");
 }
@@ -1948,7 +1948,7 @@ try
     }
   }
 }
-catch(AhuException &ae) {
+catch(PDNSException &ae) {
   L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
   return 0;
 }
@@ -2118,7 +2118,7 @@ int main(int argc, char **argv)
 #endif
 
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
     ret=EXIT_FAILURE;
   }
index 63906ec3c8a0b4a83e093bc6ec6c4b7d06374a6b..142deb0e415d3a3159d5ae57b508cd9c6fd52486 100644 (file)
@@ -989,7 +989,7 @@ try
     try {
       Bind2Backend::createDNSSECDB(cmds[1]);
     }
-    catch (AhuException& ae) {
+    catch (PDNSException& ae) {
       cerr<<"Error: "<<ae.reason<<endl;
       return 1;
     }
@@ -1451,7 +1451,7 @@ try
   }
   return 0;
 }
-catch(AhuException& ae) {
+catch(PDNSException& ae) {
   cerr<<"Error: "<<ae.reason<<endl;
 }
 catch(std::exception& e) {
index 76b890a137ca4cafdbd6a5562e5fbfd58971c048..89f11e9fbc7517edec30f4f469cebee9feef2637 100644 (file)
@@ -65,7 +65,7 @@ int PDNSService::main( int argc, char *argv[] )
     L << Logger::Info << Logger::NTLog << "PowerDNS " << VERSION << " (C) 2001-2003 PowerDNS.COM BV (" << __DATE__ ", " __TIME__<< ") starting up" << endl;
     mainthread();
   }
-  catch(AhuException &AE) {
+  catch(PDNSException &AE) {
     if(!PDNSService::isRunningAsService())
       cerr<<"Exiting because: "<<AE.reason<<endl;
     L<<Logger::Error<<Logger::NTLog<<"Exiting because: "<<AE.reason<<endl;
index 31f42226ca9149befd1c1b6c148610f406963d01..56ab81d19689c3fe40670d772cda434b2e79bc69 100644 (file)
@@ -33,22 +33,22 @@ int RecursorControlChannel::listen(const string& fname)
   Utility::setCloseOnExec(d_fd);
 
   if(d_fd < 0) 
-    throw AhuException("Creating UNIX domain socket: "+string(strerror(errno)));
+    throw PDNSException("Creating UNIX domain socket: "+string(strerror(errno)));
   
   int tmp=1;
   if(setsockopt(d_fd, SOL_SOCKET, SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0)
-    throw AhuException(string("Setsockopt failed: ")+strerror(errno));
+    throw PDNSException(string("Setsockopt failed: ")+strerror(errno));
   
   int err=unlink(fname.c_str());
   if(err < 0 && errno!=ENOENT)
-    throw AhuException("Can't remove (previous) controlsocket '"+fname+"': "+string(strerror(errno)) + " (try --socket-dir)");
+    throw PDNSException("Can't remove (previous) controlsocket '"+fname+"': "+string(strerror(errno)) + " (try --socket-dir)");
 
   memset(&d_local,0,sizeof(d_local));
   d_local.sun_family=AF_UNIX;
   strcpy(d_local.sun_path, fname.c_str());
     
   if(bind(d_fd, (sockaddr*)&d_local,sizeof(d_local))<0) 
-    throw AhuException("Unable to bind to controlsocket '"+fname+"': "+string(strerror(errno)));
+    throw PDNSException("Unable to bind to controlsocket '"+fname+"': "+string(strerror(errno)));
 
   return d_fd;
 }
@@ -61,13 +61,13 @@ void RecursorControlChannel::connect(const string& path, const string& fname)
   Utility::setCloseOnExec(d_fd);
 
   if(d_fd < 0) 
-    throw AhuException("Creating UNIX domain socket: "+string(strerror(errno)));
+    throw PDNSException("Creating UNIX domain socket: "+string(strerror(errno)));
   
   int tmp=1;
   if(setsockopt(d_fd, SOL_SOCKET, SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
     close(d_fd);
     d_fd=-1;
-    throw AhuException(string("Setsockopt failed: ")+strerror(errno));
+    throw PDNSException(string("Setsockopt failed: ")+strerror(errno));
   }
   
   string localname=path+"/lsockXXXXXX";
@@ -77,25 +77,25 @@ void RecursorControlChannel::connect(const string& path, const string& fname)
     close(d_fd);
     d_fd=-1;
     d_local.sun_path[0]=0;
-    throw AhuException("Unable to generate local temporary file in directory '"+path+"': "+string(strerror(errno)));
+    throw PDNSException("Unable to generate local temporary file in directory '"+path+"': "+string(strerror(errno)));
   }
 
   d_local.sun_family=AF_UNIX;
 
   int err=unlink(d_local.sun_path);
   if(err < 0 && errno!=ENOENT)
-    throw AhuException("Unable to remove local controlsocket: "+string(strerror(errno)));
+    throw PDNSException("Unable to remove local controlsocket: "+string(strerror(errno)));
 
   if(bind(d_fd, (sockaddr*)&d_local,sizeof(d_local))<0) {
     unlink(d_local.sun_path);
     close(d_fd);
     d_fd=-1;
-    throw AhuException("Unable to bind to local temporary file: "+string(strerror(errno)));
+    throw PDNSException("Unable to bind to local temporary file: "+string(strerror(errno)));
   }
 
   if(chmod(d_local.sun_path,0666)<0) { // make sure that pdns can reply!
     unlink(d_local.sun_path);
-    throw AhuException("Unable to chmnod local temporary socket: "+string(strerror(errno)));
+    throw PDNSException("Unable to chmnod local temporary socket: "+string(strerror(errno)));
   }
 
   memset(&remote,0,sizeof(remote));
@@ -104,7 +104,7 @@ void RecursorControlChannel::connect(const string& path, const string& fname)
   strcpy(remote.sun_path,(path+"/"+fname).c_str());
   if(::connect(d_fd, (sockaddr*)&remote, sizeof(remote)) < 0) {
     unlink(d_local.sun_path);
-    throw AhuException("Unable to connect to remote '"+path+fname+"': "+string(strerror(errno)));
+    throw PDNSException("Unable to connect to remote '"+path+fname+"': "+string(strerror(errno)));
   }
 }
 
@@ -118,10 +118,10 @@ void RecursorControlChannel::send(const std::string& msg, const std::string* rem
     strcpy(remoteaddr.sun_path, remote->c_str());
 
     if(::sendto(d_fd, msg.c_str(), msg.length(), 0, (struct sockaddr*) &remoteaddr, sizeof(remoteaddr) ) < 0)
-      throw AhuException("Unable to send message over control channel '"+*remote+"': "+string(strerror(errno)));
+      throw PDNSException("Unable to send message over control channel '"+*remote+"': "+string(strerror(errno)));
   }
   else if(::send(d_fd, msg.c_str(), msg.length(), 0) < 0)
-    throw AhuException("Unable to send message over control channel: "+string(strerror(errno)));
+    throw PDNSException("Unable to send message over control channel: "+string(strerror(errno)));
 }
 
 string RecursorControlChannel::recv(std::string* remote, unsigned int timeout)
@@ -132,7 +132,7 @@ string RecursorControlChannel::recv(std::string* remote, unsigned int timeout)
   socklen_t addrlen=sizeof(remoteaddr);
     
   if((waitForData(d_fd, timeout, 0 ) != 1) || (len=::recvfrom(d_fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&remoteaddr, &addrlen)) < 0)
-    throw AhuException("Unable to receive message over control channel: "+string(strerror(errno)));
+    throw PDNSException("Unable to receive message over control channel: "+string(strerror(errno)));
 
   if(remote)
     *remote=remoteaddr.sun_path;
index 8afa9356e7ab58766f2e6dc038542f95e724a52c..2fd181d05d6297b74a78cbb1f021fcfa3b3270d2 100644 (file)
@@ -660,9 +660,9 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
       L<<Logger::Error<<"reloading ACLs failed (Exception: "<<e.what()<<")"<<endl;
       return e.what() + string("\n");
     }
-    catch(AhuException& ae)
+    catch(PDNSException& ae)
     {
-      L<<Logger::Error<<"reloading ACLs failed (AhuException: "<<ae.reason<<")"<<endl;
+      L<<Logger::Error<<"reloading ACLs failed (PDNSException: "<<ae.reason<<")"<<endl;
       return ae.reason + string("\n");
     }
     return "ok\n";
index 6d232c4d225261b44f21c5f892f01a1fd0ff545e..a97cbbbef1266e38ee6fa6074ec19465e02e4d7c 100644 (file)
@@ -82,7 +82,7 @@ try
   cout<<receive;
   return 0;
 }
-catch(AhuException& ae)
+catch(PDNSException& ae)
 {
   cerr<<"Fatal: "<<ae.reason<<"\n";
   return 1;
index 730981a5fbeaba33be9ae5aeb6af08dda0c1a329..2048978a2fc64ea17aec41699547113febc32f35 100644 (file)
@@ -152,7 +152,7 @@ static string DLRestHandler(const vector<string>&parts, pid_t ppid)
   try {
     writen2(g_fd1[1],line.c_str(),line.size()+1);
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     return "Error communicating with instance: "+ae.reason;
   }
   char mesg[512];
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
   try {
     mainthread();
   }
-  catch(AhuException &AE) {
+  catch(PDNSException &AE) {
     if(!::arg().mustDo("daemon"))
       cerr<<"Exiting because: "<<AE.reason<<endl;
     L<<Logger::Error<<"Exiting because: "<<AE.reason<<endl;
index 07abbc7eb165746b5644e8102a3b509d4d57e496..9d49279df17264da60dfbc1650ff7c40c18be58b 100644 (file)
@@ -265,7 +265,7 @@ string reloadAuthAndForwards()
   catch(std::exception& e) {
     L<<Logger::Error<<"Had error reloading zones, keeping original data: "<<e.what()<<endl;
   }
-  catch(AhuException& ae) {
+  catch(PDNSException& ae) {
     L<<Logger::Error<<"Encountered error reloading zones, keeping original data: "<<ae.reason<<endl;
   }
   catch(...) {
@@ -304,11 +304,11 @@ SyncRes::domainmap_t* parseAuthAndForwards()
           }
           catch(std::exception &e) {
             delete newMap;
-            throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what());
+            throw PDNSException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what());
           }
           catch(...) {
             delete newMap;
-            throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'");
+            throw PDNSException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'");
           }
 
           ad.d_records.insert(rr);
@@ -340,7 +340,7 @@ SyncRes::domainmap_t* parseAuthAndForwards()
 
     if(!rfp) {
       delete newMap;
-      throw AhuException("Error opening forward-zones-file '"+::arg()["forward-zones-file"]+"': "+stringerror());
+      throw PDNSException("Error opening forward-zones-file '"+::arg()["forward-zones-file"]+"': "+stringerror());
     }
 
     shared_ptr<FILE> fp=shared_ptr<FILE>(rfp, fclose);
@@ -364,7 +364,7 @@ SyncRes::domainmap_t* parseAuthAndForwards()
         ad.d_rdForward = false;
       if(domain.empty()) {
         delete newMap;
-        throw AhuException("Error parsing line "+lexical_cast<string>(linenum)+" of " +::arg()["forward-zones-file"]);
+        throw PDNSException("Error parsing line "+lexical_cast<string>(linenum)+" of " +::arg()["forward-zones-file"]);
       }
 
       try {
@@ -372,7 +372,7 @@ SyncRes::domainmap_t* parseAuthAndForwards()
       }
       catch(...) {
         delete newMap;
-        throw AhuException("Conversion error parsing line "+lexical_cast<string>(linenum)+" of " +::arg()["forward-zones-file"]);
+        throw PDNSException("Conversion error parsing line "+lexical_cast<string>(linenum)+" of " +::arg()["forward-zones-file"]);
       }
 
       (*newMap)[toCanonic("", domain)]=ad;
index 13043c1ff8348b098b2f12ec917ba6c8764adee0..7ceb9288d92162aa956b4cc726e7c705e5da0821 100644 (file)
@@ -68,7 +68,7 @@ int makeQuerySocket(const ComboAddress& local, bool udpOrTCP)
 
     if(!tries) {
       Utility::closesocket(sock);
-      throw AhuException("Resolver binding to local UDP socket on "+ourLocal.toString()+": "+stringerror());
+      throw PDNSException("Resolver binding to local UDP socket on "+ourLocal.toString()+": "+stringerror());
     }
   }
   else {
@@ -76,7 +76,7 @@ int makeQuerySocket(const ComboAddress& local, bool udpOrTCP)
     // cerr<<"letting kernel pick TCP port"<<endl;
     ourLocal.sin4.sin_port = 0;
     if(::bind(sock, (struct sockaddr *)&ourLocal, ourLocal.getSocklen()) < 0)
-      throw AhuException("Resolver binding to local TCP socket on "+ourLocal.toString()+": "+stringerror());
+      throw PDNSException("Resolver binding to local TCP socket on "+ourLocal.toString()+": "+stringerror());
   }
   return sock;
 }
index 3633bf2ddc12e40a00be966b9ed376135cb89c50..6877e6a0562e1e7cb62824eae1f36dcdc69aa010 100644 (file)
 #include "namespaces.hh"
 #include "dnsbackend.hh"
 
-class ResolverException : public AhuException
+class ResolverException : public PDNSException
 {
 public:
-  ResolverException(const string &reason) : AhuException(reason){}
+  ResolverException(const string &reason) : PDNSException(reason){}
 };
 
 // make an IPv4 or IPv6 query socket 
index f610d0036a8705df2fbebbb29c10836a571911a0..77caef15dd6a3098634df47b840faa74c9600720 100644 (file)
@@ -95,12 +95,12 @@ try
     uint16_t len;
     len = htons(packet.size());
     if(sock.write((char *) &len, 2) != 2)
-      throw AhuException("tcp write failed");
+      throw PDNSException("tcp write failed");
 
     sock.writen(string((char*)&*packet.begin(), (char*)&*packet.end()));
     
     if(sock.read((char *) &len, 2) != 2)
-      throw AhuException("tcp read failed");
+      throw PDNSException("tcp read failed");
 
     len=ntohs(len);
     char *creply = new char[len];
@@ -109,7 +109,7 @@ try
     while(n<len) {
       numread=sock.read(creply+n, len-n);
       if(numread<0)
-        throw AhuException("tcp read failed");
+        throw PDNSException("tcp read failed");
       n+=numread;
     }
 
index 91ff6aab4c695f3b7f5de86adccb97e579051878..8e61e019187e44a31c63c5209da7d02cff1f207c 100644 (file)
 #include "iputils.hh"
 #include "ahuexception.hh"
 
-class SessionException: public AhuException
+class SessionException: public PDNSException
 {
 public:
-  SessionException(const string &reason) : AhuException(reason){}
+  SessionException(const string &reason) : PDNSException(reason){}
 };
 
 class SessionTimeoutException: public SessionException
index 9d9433411df5b12a839d656d281475b63710a7b3..7d9e12db2c72ecc2747cd7ece8e4efb869b81254 100644 (file)
@@ -374,8 +374,8 @@ void CommunicatorClass::suck(const string &domain,const string &remote)
       di.backend->abortTransaction();
     }
   }
-  catch(AhuException &ae) {
-    L<<Logger::Error<<"Unable to AXFR zone '"+domain+"' from remote '"<<remote<<"' (AhuException): "<<ae.reason<<endl;
+  catch(PDNSException &ae) {
+    L<<Logger::Error<<"Unable to AXFR zone '"+domain+"' from remote '"<<remote<<"' (PDNSException): "<<ae.reason<<endl;
     if(di.backend && !first) {
       L<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();
@@ -430,7 +430,7 @@ struct SlaveSenderReceiver
           dni.dnssecOk, dni.tsigkeyname, dni.tsigalgname, dni.tsigsecret)
       );
     }
-    catch(AhuException& e) {
+    catch(PDNSException& e) {
       throw runtime_error("While attempting to query freshness of '"+dni.di.zone+"': "+e.reason);
     }
   }
@@ -556,7 +556,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
     catch(std::exception& e) {
       L<<Logger::Error<<"While checking domain freshness: " << e.what()<<endl;
     }
-    catch(AhuException &re) {  
+    catch(PDNSException &re) {  
       L<<Logger::Error<<"While checking domain freshness: " << re.reason<<endl;
     }
   }
index a5e55c73e7b08886bcd04aaece31bac2c5d61cb3..b63e3d63d192e32fedd08027cbce625a772a4781 100644 (file)
@@ -42,7 +42,7 @@ void StatBag::exists(const string &key)
   if(!d_stats.count(key))
     {
       unlock(); // it's the details that count
-      throw AhuException("Trying to deposit into unknown StatBag key '"+key+"'");
+      throw PDNSException("Trying to deposit into unknown StatBag key '"+key+"'");
     }
 }
 
index 4d1be5f08ef07037062478eafe35d6acad028f2b..cd9aaaa2b841f709f4179ae436322fda0d779162 100644 (file)
@@ -67,7 +67,7 @@ void TCPNameserver::go()
   try {
     s_P=new PacketHandler;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<Logger::NTLog<<"TCP server is unable to launch backends - will try again when questions come in"<<endl;
     L<<Logger::Error<<"TCP server is unable to launch backends - will try again when questions come in: "<<ae.reason<<endl;
   }
@@ -80,7 +80,7 @@ void *TCPNameserver::launcher(void *data)
   return 0;
 }
 
-// throws AhuException if things didn't go according to plan, returns 0 if really 0 bytes were read
+// throws PDNSException if things didn't go according to plan, returns 0 if really 0 bytes were read
 int readnWithTimeout(int fd, void* buffer, unsigned int n, bool throwOnEOF=true)
 {
   unsigned int bytes=n;
@@ -349,7 +349,7 @@ void *TCPNameserver::doConnection(void *data)
 
     L<<Logger::Error<<"TCP Connection Thread unable to answer a question because of a backend error, cycling"<<endl;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     Lock l(&s_plock);
     delete s_P;
     s_P = 0; // on next call, backend will be recycled
@@ -851,7 +851,7 @@ TCPNameserver::TCPNameserver()
   stringtok(locals6,::arg()["local-ipv6"]," ,");
 
   if(locals.empty() && locals6.empty())
-    throw AhuException("No local address specified");
+    throw PDNSException("No local address specified");
 
   vector<string> parts;
   stringtok( parts, ::arg()["allow-axfr-ips"], ", \t" ); // is this IP on the guestlist?
@@ -867,7 +867,7 @@ TCPNameserver::TCPNameserver()
     int s=socket(AF_INET,SOCK_STREAM,0); 
     
     if(s<0) 
-      throw AhuException("Unable to acquire TCP socket: "+stringerror());
+      throw PDNSException("Unable to acquire TCP socket: "+stringerror());
 
     Utility::setCloseOnExec(s);
 
@@ -881,7 +881,7 @@ TCPNameserver::TCPNameserver()
     
     if(::bind(s, (sockaddr*)&local, local.getSocklen())<0) {
       L<<Logger::Error<<"binding to TCP socket: "<<strerror(errno)<<endl;
-      throw AhuException("Unable to bind to TCP socket");
+      throw PDNSException("Unable to bind to TCP socket");
     }
     
     listen(s,128);
@@ -900,7 +900,7 @@ TCPNameserver::TCPNameserver()
     int s=socket(AF_INET6,SOCK_STREAM,0); 
 
     if(s<0) 
-      throw AhuException("Unable to acquire TCPv6 socket: "+stringerror());
+      throw PDNSException("Unable to acquire TCPv6 socket: "+stringerror());
 
     Utility::setCloseOnExec(s);
 
@@ -916,7 +916,7 @@ TCPNameserver::TCPNameserver()
     }
     if(bind(s, (const sockaddr*)&local, local.getSocklen())<0) {
       L<<Logger::Error<<"binding to TCP socket: "<<strerror(errno)<<endl;
-      throw AhuException("Unable to bind to TCPv6 socket");
+      throw PDNSException("Unable to bind to TCPv6 socket");
     }
     
     listen(s,128);
@@ -979,7 +979,7 @@ void TCPNameserver::thread()
       }
     }
   }
-  catch(AhuException &AE) {
+  catch(PDNSException &AE) {
     L<<Logger::Error<<"TCP Nameserver thread dying because of fatal error: "<<AE.reason<<endl;
   }
   catch(...) {
index 6a3e17ef975236559a4c413d63613dc4e72bcb20..b52e603928651ebd1007fb2fc7fa03e420749e6e 100644 (file)
@@ -101,7 +101,7 @@ catch(std::exception &e)
   cerr<<"Fatal: "<<e.what()<<endl;
   return 1;
 }
-catch(AhuException& ae)
+catch(PDNSException& ae)
 {
   cerr<<"Fatal 2: "<<ae.reason<<endl;
   return 1;
index 9d2a35ac25caca16ad8100b1ba97a0d8440e86ff..84122ca005040300dc68588d424a5fce7c1e5ddf 100644 (file)
@@ -393,7 +393,7 @@ void UeberBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt
 {
   if(stale) {
     L<<Logger::Error<<"Stale ueberbackend received question, signalling that we want to be recycled"<<endl;
-    throw AhuException("We are stale, please recycle");
+    throw PDNSException("We are stale, please recycle");
   }
 
   DLOG(L<<"UeberBackend received question for "<<qtype.getName()<<" of "<<qname<<endl);
@@ -418,7 +418,7 @@ void UeberBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt
   if(!backends.size()) {
     L<<Logger::Error<<Logger::NTLog<<"No database backends available - unable to answer questions."<<endl;
     stale=true; // please recycle us! 
-    throw AhuException("We are stale, please recycle");
+    throw PDNSException("We are stale, please recycle");
   }
   else {
     d_question.qtype=qtype;
index bad06dd695513f59fec654e1b26c3ee2bb995468..02b1e93d05362cf6f32d04fcc4a1ee7c30f5b3c9 100644 (file)
 Semaphore::Semaphore(unsigned int value)
 {
   if (value > SEM_VALUE_MAX) {
-    throw AhuException("Cannot create semaphore: value too large");
+    throw PDNSException("Cannot create semaphore: value too large");
   }
 
   // Initialize
   
   if (pthread_mutex_init(&m_lock, NULL) != 0) {
-    throw AhuException("Cannot create semaphore: cannot allocate mutex");
+    throw PDNSException("Cannot create semaphore: cannot allocate mutex");
   }
 
   if (pthread_cond_init(&m_gtzero, NULL) != 0) {
     pthread_mutex_destroy(&m_lock);
-    throw AhuException("Cannot create semaphore: cannot allocate condition");
+    throw PDNSException("Cannot create semaphore: cannot allocate condition");
   }
 
   m_count = (uint32_t) value;
index 862e0587d853ff87c99536f703c870ee07979e8f..987a40552905dd7c5076c08dcd81493e26bb37f9 100644 (file)
@@ -44,7 +44,7 @@ int Utility::closesocket( Utility::sock_t socket )
   if(ret < 0 && errno == ECONNRESET) // see ticket 192, odd BSD behaviour
     return 0;
   if(ret < 0) 
-    throw AhuException("Error closing socket: "+stringerror());
+    throw PDNSException("Error closing socket: "+stringerror());
   return ret;
 }
 
index 4222f036621352006431db733205f0c4c90c7cc6..b24030fba7eadbffa513041e811c13f3dc85ac61 100644 (file)
@@ -101,10 +101,10 @@ string DynListener::getLine()
   DWORD bytesRead;
 
   if ( !ConnectNamedPipe( m_pipeHandle, NULL ))
-    throw AhuException( "Reading from named pipe failed." );
+    throw PDNSException( "Reading from named pipe failed." );
 
   if ( !ReadFile( m_pipeHandle, mesg, sizeof( mesg ), &bytesRead, NULL ))
-    throw AhuException( "Reading from named pipe failed." );  
+    throw PDNSException( "Reading from named pipe failed." );  
 
   return mesg;
 }
@@ -160,7 +160,7 @@ void DynListener::theListener()
       sendLine((*d_funcdb[parts[0]])(parts,d_ppid));
     }
   }
-  catch(AhuException &AE)
+  catch(PDNSException &AE)
     {
       L<<Logger::Error<<"Fatal: "<<AE.reason<<endl;
     }
index e65855a2d6382b4f4084fdc4ecf5e420e706a8aa..dea837c785636f9224ff41b2b72b8b61bcfacffe 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
     
     cout<<resp<<endl;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     cerr<<"Fatal error: "<<ae.reason<<endl;
     return 1;
   }
index bad3926aeedccdb1da7f468f8a832b355c1900a4..da49ad834e8baf8424eee45553fbec3163a9cbf1 100644 (file)
@@ -32,7 +32,7 @@ DynMessenger::DynMessenger(const string &dname, const string &fname)
 
   m_pipeHandle = CreateFile( pipename.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
   if ( m_pipeHandle == INVALID_HANDLE_VALUE )
-    throw AhuException( "Could not create named pipe (are you on Windows NT, 2000 or XP? 98 doesn't work!)" );
+    throw PDNSException( "Could not create named pipe (are you on Windows NT, 2000 or XP? 98 doesn't work!)" );
 }
 
 DynMessenger::~DynMessenger()
index 561f7012712ffeec1e57f5c55f1c70a6e14475ae..fd79a279bff0191172849adb3ce090703ccbb5c5 100644 (file)
@@ -249,7 +249,7 @@ void startDoResolve(void *p)
 
     delete R;
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"startDoResolve problem: "<<ae.reason<<endl;
   }
   catch(...) {
@@ -263,7 +263,7 @@ void makeClientSocket()
   Utility::setCloseOnExec(d_clientsock);
 
   if(d_clientsock<0) 
-    throw AhuException("Making a socket for resolver: "+stringerror());
+    throw PDNSException("Making a socket for resolver: "+stringerror());
   
   struct sockaddr_in sin;
   memset((char *)&sin,0, sizeof(sin));
@@ -281,7 +281,7 @@ void makeClientSocket()
     
   }
   if(!tries)
-    throw AhuException("Resolver binding to local socket: "+stringerror());
+    throw PDNSException("Resolver binding to local socket: "+stringerror());
 }
 
 void makeTCPServerSocket()
@@ -290,7 +290,7 @@ void makeTCPServerSocket()
   Utility::setCloseOnExec(d_tcpserversock);
 
   if(d_tcpserversock<0) 
-    throw AhuException("Making a server socket for resolver: "+stringerror());
+    throw PDNSException("Making a server socket for resolver: "+stringerror());
   
   struct sockaddr_in sin;
   memset((char *)&sin,0, sizeof(sin));
@@ -302,13 +302,13 @@ void makeTCPServerSocket()
   }
   else {
     if(!IpToU32(arg()["local-address"], &sin.sin_addr.s_addr))
-      throw AhuException("Unable to resolve local address"); 
+      throw PDNSException("Unable to resolve local address"); 
   }
 
   sin.sin_port = htons(arg().asNum("local-port")); 
     
   if (bind(d_tcpserversock, (struct sockaddr *)&sin, sizeof(sin))<0) 
-    throw AhuException("TCP Resolver binding to server socket: "+stringerror());
+    throw PDNSException("TCP Resolver binding to server socket: "+stringerror());
   
   int tmp=1;
   if(setsockopt(d_tcpserversock,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) {
@@ -324,7 +324,7 @@ void makeServerSocket()
   d_serversock=socket(AF_INET, SOCK_DGRAM,0);
   Utility::setCloseOnExec(d_serversock);
   if(d_serversock<0) 
-    throw AhuException("Making a server socket for resolver: "+stringerror());
+    throw PDNSException("Making a server socket for resolver: "+stringerror());
   
   struct sockaddr_in sin;
   memset((char *)&sin,0, sizeof(sin));
@@ -338,14 +338,14 @@ void makeServerSocket()
   else {
     
     if(!IpToU32(arg()["local-address"], &sin.sin_addr.s_addr))
-      throw AhuException("Unable to resolve local address"); 
+      throw PDNSException("Unable to resolve local address"); 
 
   }
 
   sin.sin_port = htons(arg().asNum("local-port")); 
     
   if (bind(d_serversock, (struct sockaddr *)&sin, sizeof(sin))<0) 
-    throw AhuException("Resolver binding to server socket: "+stringerror());
+    throw PDNSException("Resolver binding to server socket: "+stringerror());
   L<<Logger::Error<<"Incoming query source port: "<<arg().asNum("local-port")<<endl;
 }
 
@@ -468,7 +468,7 @@ int serviceMain( int argc, char *argv[] )
       int selret = select(  fdmax + 1, &readfds, NULL, NULL, &tv );
       if(selret<=0) 
         if (selret == -1 && errno!=EINTR) 
-          throw AhuException("Select returned: "+stringerror());
+          throw PDNSException("Select returned: "+stringerror());
         else
           continue;
 
@@ -598,7 +598,7 @@ int serviceMain( int argc, char *argv[] )
       }
     }
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
   }
   catch(std::exception &e) {
@@ -719,7 +719,7 @@ int main(int argc, char **argv)
     RecursorService::instance()->start( argc, argv, arg().mustDo( "ntservice" )); 
 
   }
-  catch(AhuException &ae) {
+  catch(PDNSException &ae) {
     L<<Logger::Error<<"Exception: "<<ae.reason<<endl;
   }
   catch(std::exception &e) {