]> granicus.if.org Git - pdns/commitdiff
heap of solaris work
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 9 Dec 2002 16:24:17 +0000 (16:24 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 9 Dec 2002 16:24:17 +0000 (16:24 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@61 d19b8d6e-7fed-0310-83ef-9ca221ded41b

28 files changed:
acconfig.h [deleted file]
configure.in
modules/gmysqlbackend/Makefile.in
modules/mysqlbackend/Makefile.am
modules/pdnsbackend/Makefile.am
modules/pdnsbackend/pdnsbackend.cc
modules/pdnsbackend/pdnsbackend.hh
modules/pipebackend/Makefile.am
modules/pipebackend/coprocess.hh
modules/pipebackend/pipebackend.cc
pdns/Makefile.am
pdns/backends/bind/Makefile.am
pdns/backends/bind/bindbackend.cc
pdns/communicator.hh
pdns/distributor.hh
pdns/dnspacket.cc
pdns/dnspacket.hh
pdns/dnsproxy.hh
pdns/docs/pdns.sgml
pdns/extra/Makefile [deleted file]
pdns/extra/null.c [deleted file]
pdns/misc.cc
pdns/nameserver.cc
pdns/pdns.in
pdns/tcpreceiver.cc
pdns/unix_utility.cc
pdns/utility.hh
pdns/ws.cc

diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644 (file)
index 5122365..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Define when extra posix typedefs are needed (solaris2.6) */
-#undef NEED_POSIX_TYPEDEF
-#undef VERBOSELOG
index 9be7eaabe5881d488157fe2513d2b07ed7dc6243..34cb77c491b2b00d37707d81258358f4da744cef 100644 (file)
@@ -3,7 +3,9 @@ AC_INIT(pdns/receiver.cc)
 AM_INIT_AUTOMAKE(pdns, 2.9.1)
 AC_CANONICAL_HOST
 AM_CONFIG_HEADER(config.h)
-CXXFLAGS="-Wall -pthread -O2"
+AC_C_BIGENDIAN 
+AC_PREREQ(2.52)
+CXXFLAGS="$CXXFLAGS -Wall"
 
 AC_PREFIX_DEFAULT(/usr/local)
 AC_PROG_CC
@@ -25,11 +27,16 @@ AC_HEADER_TIME
 AC_STRUCT_TM
 
 dnl Checks for library functions.
-AC_FUNC_SETVBUF_REVERSED
 AC_TYPE_SIGNAL
-AC_FUNC_STRFTIME
 AC_CHECK_FUNCS(gethostname gettimeofday mkdir mktime select socket strerror)
 
+AC_CHECK_LIB(resolv, inet_ntop)
+
+dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
+
+AC_CHECK_FUNCS(inet_ntop, , AC_LIBOBJ(lib/inet_ntop)) 
+AC_CHECK_FUNCS(inet_pton, , AC_LIBOBJ(lib/inet_pton))
+
 
 #
 # Check for libdl
@@ -89,9 +96,20 @@ fi
 
 case "$host_os" in
 solaris2*) 
-       AC_DEFINE(NEED_POSIX_TYPEDEF)
+       AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined])
+       AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype])
+       LIBS="-lposix4 -lnsl -lsocket -lpthread $LIBS"
+       CXXFLAGS="-D_REENTRANT $CXXFLAGS"
+       ;;
+linux*)
+       AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
+       LDFLAGS="-pthread $LDFLAGS"
+       CXXFLAGS="-pthread -D_GNU_SOURCE $CXXFLAGS"
        ;;
 *)
+       AC_DEFINE(HAVE_IPV6,1,[If the host operating system understands IPv6])
+       LDFLAGS="-pthread $LDFLAGS"
+       CXXFLAGS="-pthread $CXXFLAGS"
        ;;
 esac
 
@@ -99,7 +117,7 @@ AC_MSG_CHECKING(whether we will be doing verbose logging)
 AC_ARG_ENABLE(verbose-logging, 
  [  --enable-verbose-logging   Do verbose logging],enable_verbose_logging=yes ,enable_verbose_logging=no)
 
-if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1) 
+if test $enable_verbose_logging = yes; then AC_DEFINE(VERBOSELOG, 1, [If verbose logging should be enabled]
 fi
 AC_MSG_RESULT($enable_verbose_logging)
 
@@ -245,7 +263,7 @@ then
            [PGSQL_lib_check="$withval/lib/pgsql $with_pgsql/lib"
        PGSQL_inc_check="$withval/include/pgsql"],
            [PGSQL_lib_check="/usr/local/pgsql/lib/pgsql /usr/local/lib/pgsql /opt/pgsql/lib/pgsql /usr/lib/pgsql /usr/local/pgsql/lib /usr/local/lib /opt/pgsql/lib /usr/lib"
-       PGSQL_inc_check="/usr/local/pgsql/include/pgsql /usr/local/include/pgsql /opt/pgsql/include/pgsql /opt/pgsql/include /usr/include/postgresql"])
+       PGSQL_inc_check="/usr/local/pgsql/include/pgsql /usr/local/include/postgresql/ /usr/local/include /opt/pgsql/include/pgsql /opt/pgsql/include /usr/include/postgresql"])
                AC_ARG_WITH(pgsql-lib,
            [  --with-pgsql-lib=<path> directory path of PgSQL library installation],
            [PGSQL_lib_check="$withval/lib/pgsql $withval/pgsql $withval"])
@@ -283,7 +301,7 @@ then
                fi
        done
                if test -z "$PGSQL_incdir"; then
-               AC_MSG_ERROR([Didn't find the mysql include dir in '$PGSQL_inc_check'])
+               AC_MSG_ERROR([Didn't find the PgSQL include dir in '$PGSQL_inc_check'])
        fi
                case "$PGSQL_incdir" in
          /* ) ;;
index 9fac8e919ebb08a8fcc43bee2c2990f0d4126c29..8298ec631be97922598267b24dd198e4d7b23c4c 100644 (file)
@@ -15,7 +15,7 @@ PGSQL_INCLUDES        = @PGSQL_incdir@
 PGSQL_LIB            = @PGSQL_lib@
 PGSQL_LIBS           = -Wl,-Bstatic  -lpq++ -lpq -Wl,-Bdynamic -lssl -lcrypt -lcrypto
 
-CXXFLAGS:=-I$(PDNS_HOME) $(CXXFLAGS)
+INCLUDES=-I$(PDNS_HOME) -I../..
 
 dopgsql=@dopgsql@
 domysql=@domysql@
@@ -70,12 +70,12 @@ distdir: $(DISTFILES)
 
        
 deps:
-       -g++ -MM -g -c $(CXXFLAGS) $(CPPFLAGS) gmysqlbackend.cc smysql.cc  > deps
+       -g++ -MM -g -c $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) gmysqlbackend.cc smysql.cc  > deps
 
 -include deps
 
 .cc.o:
-       g++ -MD -g -c $(CXXFLAGS) $(CPPFLAGS) $<
+       g++ -MD -g -c $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $<
 
 
 install:
index 4ebb5188b0988ba4a9bf66d2b1e94dbad9e9bd3b..2378103e1bccf5c7ac1e8cd08fb8dbc755456ee3 100644 (file)
@@ -1,4 +1,4 @@
-CXXFLAGS:=-I@MYSQL_incdir@ $(CXXFLAGS) 
+INCLUDES=-I@MYSQL_incdir@ 
 lib_LTLIBRARIES = libmysqlbackend.la 
 EXTRA_DIST=OBJECTFILES OBJECTLIBS
 libmysqlbackend_la_SOURCES=mysqlcbackend.cc mysqlcbackend.hh 
index ca3e8a225eacaa8c78486f7441c98d62d44cf777..1d33b85d62f68b9068660153157bb3c5b9a826a6 100644 (file)
@@ -1,3 +1,4 @@
+INCLUDES=-I@MYSQL_incdir@
 lib_LTLIBRARIES = libpdnsbackend.la 
 EXTRA_DIST=OBJECTFILES OBJECTLIBS
 
index a78504bfc113d1285fd2df1783bbf276938044b0..349b77d6fdb04f23e28a34e202813b19e9a2c851 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: pdnsbackend.cc,v 1.2 2002/11/28 12:30:45 ahu Exp $ 
+// $Id: pdnsbackend.cc,v 1.3 2002/12/09 16:24:17 ahu Exp $ 
 
 #include <string>
 #include <map>
@@ -248,15 +248,15 @@ class PDNSFactory : public BackendFactory
 
 
 //! Magic class that is activated when the dynamic library is loaded
-class Loader
+class PdnsBeLoader
 {
    public:
 
-      Loader()
+      PdnsBeLoader()
       {
         BackendMakers().report(new PDNSFactory);
         L<<Logger::Notice<<backendName<<" This is the pdns module version "VERSION" ("__DATE__", "__TIME__") reporting"<<endl;
       }
 };
 
-static Loader loader;
+static PdnsBeLoader pdnsbeloader;
index 499846a53218d71c68d0a8a9b8c1b81685fc9df2..756dd6aecefa90552b6ebd636b5427d56a8a1842 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: pdnsbackend.hh,v 1.2 2002/11/28 12:30:45 ahu Exp $
+// $Id: pdnsbackend.hh,v 1.3 2002/12/09 16:24:17 ahu Exp $
 
 #ifndef PDNSBACKEND_HH
 #define PDNSBACKEND_HH
@@ -8,7 +8,7 @@
 
 using namespace std;
 
-#include <mysql/mysql.h>
+#include <mysql.h>
 
 class PdnsBackend : public DNSBackend
 {
index 1f26fa735e407e50ef52d41570b1cc3fae48757d..3abaad45e1095d66983a6abb9dd50c72c9d993ad 100644 (file)
@@ -3,6 +3,7 @@
 #      install .lib/libpipebackend.so.0.0.0 @libdir@
 #endif
 
+EXTRA_DIST=OBJECTFILES OBJECTLIBS
 lib_LTLIBRARIES = libpipebackend.la
 
 
index bb1dbd4a804e3ac1c52567050b654f17a06af4d6..231865bd4b410b5136c9065d343c8240cf623ddd 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <iostream>
 #include <stdio.h>
+#include <string>
 
 using namespace std; 
 
index 4c6055d16b7fbd1b6da3dc350f8906e921b089e6..8aa5cbc6d9d376280a8044590ab23d77ff23d0c1 100644 (file)
@@ -1,6 +1,6 @@
 // -*- sateh-c -*- 
 // File    : pdnsbackend.cc
-// Version : $Id: pipebackend.cc,v 1.2 2002/12/06 09:58:03 ahu Exp $ 
+// Version : $Id: pipebackend.cc,v 1.3 2002/12/09 16:24:17 ahu Exp $ 
 //
 
 #include <string>
@@ -223,10 +223,10 @@ class PipeFactory : public BackendFactory
       }
 };
 
-class Loader
+class PipeLoader
 {
    public:
-      Loader()
+      PipeLoader()
       {
          BackendMakers().report(new PipeFactory);
          
@@ -234,5 +234,5 @@ class Loader
       }  
 };
 
-static Loader loader;
+static PipeLoader pipeloader;
 
index 1a3d1042bdce78686274bb484578823f213b01f9..2708eceeda10d5030f2cb3cc07f43530752efd87 100644 (file)
@@ -1,10 +1,10 @@
-AM_CXXFLAGS=-D_GNU_SOURCE -DSYSCONFDIR=\"@sysconfdir@\" -DBINDIR=\"@bindir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind
+AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DBINDIR=\"@bindir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind
 AM_CPPFLAGS=-Ibackends/bind
 
 EXTRA_DIST = codedocs/Makefile codedocs/doxygen.conf docs/Makefile \
 docs/gslb-operations.sgml docs/powerdns-case.sgml docs/powerdns-install.sgml \
-docs/powerdns-overview.sgml docs/powerdns-technical.sgml extra/Makefile \
-extra/null.c pdns.spec release-scripts/ docs/pdns.sgml \
+docs/powerdns-overview.sgml docs/powerdns-technical.sgml  \
+pdns.spec release-scripts/ docs/pdns.sgml \
 choosepaths mtasker.cc 
 
 noinst_SCRIPTS = pdns
@@ -48,5 +48,5 @@ pdns_control_LDFLAGS=
 
 # binpatch_SOURCES=binpatch.cc 
 
-SUBDIRS= codedocs backends extra .
+SUBDIRS= codedocs backends .
 
index 11cb071d31c3d7893956f9420ee170044b5a2bd8..362f107c25a453a0b009c0835947f9bba7e6277c 100644 (file)
@@ -1,4 +1,4 @@
-AM_CXXFLAGS=-D_GNU_SOURCE -I../..
+INCLUDES=-I../..
 lib_LTLIBRARIES = libbindbackend.la
 
 libbindbackend_la_SOURCES=bindbackend.cc bindbackend.hh bindparser.yy \
index fe0fc3be3ebed3f0c25aff67ec55dd071cac0bbb..453d90b42ba472dadcf7777d549233dfc3f3a86c 100644 (file)
@@ -16,7 +16,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-// $Id: bindbackend.cc,v 1.1 2002/11/27 15:18:37 ahu Exp $ 
+// $Id: bindbackend.cc,v 1.2 2002/12/09 16:24:17 ahu Exp $ 
 #include <errno.h>
 #include <string>
 #include <map>
@@ -540,13 +540,13 @@ class BindFactory : public BackendFactory
 
 
 //! Magic class that is activated when the dynamic library is loaded
-class Loader
+class BindLoader
 {
 public:
-  Loader()
+  BindLoader()
   {
     BackendMakers().report(new BindFactory);
-    theL()<<Logger::Notice<<"[BindBackend] This is the bind backend version "VERSION" ("__DATE__", "__TIME__") reporting"<<endl;
+    L<<Logger::Notice<<"[BindBackend] This is the bind backend version "VERSION" ("__DATE__", "__TIME__") reporting"<<endl;
   }
 };
-static Loader loader;
+static BindLoader bindloader;
index 5fd61239156047e4832f2e139f1567e35a7a9e28..d902832caecaa321e1f779d3d0efcfd707b845ee 100644 (file)
 #include <semaphore.h>
 #include <queue>
 #include <list>
-\r
-#ifndef WIN32\r
-# include <unistd.h>\r
-# include <fcntl.h>\r
-# include <netdb.h>\r
-#endif // WIN32\r
-\r
+
+#ifndef WIN32
+# include <unistd.h>
+# include <fcntl.h>
+# include <netdb.h>
+#endif // WIN32
+
 #include "lock.hh"
 #include "packethandler.hh"
 
@@ -47,12 +47,12 @@ class NotificationQueue
 public:
   void add(const string &domain, const string &ip)
   {
-    NotificationRequest nr;\r
-    nr.domain   = domain;\r
-    nr.ip       = ip;\r
-    nr.attempts = 0;\r
-    nr.id       = Utility::random()%0xffff;\r
-    nr.next     = time(0);\r
+    NotificationRequest nr;
+    nr.domain   = domain;
+    nr.ip       = ip;
+    nr.attempts = 0;
+    nr.id       = Utility::random()%0xffff;
+    nr.next     = time(0);
 
     d_nqueue.push_back(nr);
   }
@@ -157,7 +157,7 @@ private:
   void slaveRefresh(PacketHandler *P);
   void masterUpdateCheck(PacketHandler *P);
   pthread_mutex_t d_lock;
-  queue<SuckRequest> d_suckdomains;
+  std::queue<SuckRequest> d_suckdomains;
   Semaphore d_suck_sem;
   Semaphore d_any_sem;
   int d_tickinterval;
index 5b6802043c73d9f577406f7a5db16772547beb3c..03cad418a4b0231c3636a526d2bfb56e28b5265d 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-\r
-#ifndef DISTRIBUTOR_HH\r
-#define DISTRIBUTOR_HH\r
-\r
-\r
+
+#ifndef DISTRIBUTOR_HH
+#define DISTRIBUTOR_HH
+
+
 #include <string>
 #include <deque>
 #include <queue>
 #include <vector>
 #include <pthread.h>
-#include <semaphore.h>\r
-\r
+#include <semaphore.h>
+
 #ifndef WIN32
-# include <unistd.h>\r
-#endif // WIN32\r
+# include <unistd.h>
+#endif // WIN32
 
 #include "logger.hh"
 #include "dns.hh"
@@ -72,8 +72,8 @@ public:
        sleep(1);
        int qcount, acount;
 
-  us->numquestions.getvalue( &qcount );\r
-  us->numanswers.getvalue( &acount );\r
+  us->numquestions.getvalue( &qcount );
+  us->numanswers.getvalue( &acount );
 
        L <<"queued questions: "<<qcount<<", pending answers: "<<acount<<endl;
       }
@@ -99,7 +99,7 @@ public:
   typedef pair<QuestionData, AnswerData> tuple_t;
   
 private:
-  queue<QuestionData> questions;
+  std::queue<QuestionData> questions;
   pthread_mutex_t q_lock;
 
   
@@ -166,10 +166,10 @@ template<class Answer, class Question, class Backend>void *Distributor<Answer,Qu
 
     for(;;) {
       us->d_idle_threads++;
-\r
+
       us->numquestions.getValue( &qcount );
 
-      us->numquestions.wait();\r
+      us->numquestions.wait();
 
       us->d_idle_threads--;
       pthread_mutex_lock(&us->q_lock);
@@ -278,9 +278,9 @@ template<class Answer, class Question, class Backend>int Distributor<Answer,Ques
   QD.callback=callback;
   questions.push(QD);
   pthread_mutex_unlock(&q_lock);
-\r
+
   numquestions.post();
-\r
+
   if(!(nextid%50)) {
     int val;
     numquestions.getValue( &val );
@@ -288,7 +288,7 @@ template<class Answer, class Question, class Backend>int Distributor<Answer,Ques
       L<<Logger::Error<<val<<" questions waiting for database attention. Limit is "<<arg().asNum("max-queue-length")<<", respawning"<<endl;
       exit(1);
     }
-  }\r
+  }
 
   return QD.id;
 }
@@ -329,8 +329,8 @@ template<class Answer, class Question,class Backend>Answer* Distributor<Answer,Q
 }
 
 template<class Answer, class Question,class Backend>void Distributor<Answer,Question,Backend>::getQueueSizes(int &questions, int &answers)
-{\r
-  numquestions.getValue( &questions );\r
+{
+  numquestions.getValue( &questions );
   numanswers.getValue( &answers );
 }
 
@@ -441,6 +441,6 @@ template<class Answer, class Question,class Backend>int Distributor<Answer,Quest
   // FIXME: write this
 }
 
-\r
-#endif // DISTRIBUTOR_HH\r
+
+#endif // DISTRIBUTOR_HH
 
index b86f30c0e171a18a7fb1e2e1fdfee307a92198a0..7342eebf749fdaa89d898c9bea77864681e41f7a 100644 (file)
@@ -16,7 +16,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-// $Id: dnspacket.cc,v 1.2 2002/11/29 22:02:33 ahu Exp $
+// $Id: dnspacket.cc,v 1.3 2002/12/09 16:24:17 ahu Exp $
 #include "utility.hh"
 #include <cstdio>
 
@@ -273,9 +273,11 @@ void DNSPacket::addAAAARecord(const DNSResourceRecord &rr)
   DLOG(L<<"Adding an AAAA record to the packet!"<<endl);
   unsigned char addr[16];
 
+#ifdef HAVE_IPV6
   if( Utility::inet_pton( AF_INET6, rr.content.c_str(), static_cast< void * >( addr )))
     addAAAARecord(rr.qname, addr, rr.ttl);
   else
+#endif
     L<<Logger::Error<<"Unable to convert IPv6 TEXT '"<<rr.content<<"' into binary for record '"<<rr.qname<<"': "
      <<endl;
 }
@@ -1258,8 +1260,9 @@ vector<DNSResourceRecord> DNSPacket::getAnswers()
       if(length!=16)
        throw AhuException("Wrong length AAAA record returned from remote");
       char tmp[128];
-       
+#ifdef AF_INET6        
       if(!Utility::inet_ntop(AF_INET6, datapos, tmp, sizeof(tmp)-1))
+#endif
        throw AhuException("Unable to translate record of type AAAA in resolver");
 
       rr.content=tmp;
index 6bb5f98a88fe3c7a06230e760366758f3d323981..ae83dc61456aef5fd4899956c35bc6917b7caa0b 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-// $Id: dnspacket.hh,v 1.3 2002/12/06 09:58:03 ahu Exp $
+// $Id: dnspacket.hh,v 1.4 2002/12/09 16:24:17 ahu Exp $
 #ifndef DNSPACKET_HH
 #define DNSPACKET_HH
 
 #include <cstdio>
 #include <cstring>
 #include <cstdlib>
-#include <sys/types.h>\r
-\r
+#include <sys/types.h>
+
 #ifndef WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/time.h>
-#include <unistd.h>\r
-#include <arpa/inet.h>\r
-\r
+#include <unistd.h>
+#include <arpa/inet.h>
+
 #endif // WIN32
 
 #include <iostream>
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif // HAVE_CONFIG_H
-
-
+ #endif // HAVE_CONFIG_H
 
-#ifdef NEED_POSIX_TYPEDEF
-typedef unsigned short int u_int16_t;
-typedef unsigned int u_int32_t;
-#endif
 
 #ifdef WIN32
 # ifdef BYTE_ORDER
@@ -80,7 +74,7 @@ public:
   struct dnsheader 
   {
     unsigned int id:16;  //!< id of this query/response
-#if BYTE_ORDER == BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN     // ultrasparc
     unsigned int qr:1;      //!< 1 if this is a query, 0 if response
     unsigned int opcode:4;  //!< the opcode
     unsigned int aa:1;   //!< packet contains authoritative data
@@ -301,13 +295,8 @@ int DNSPacket::parse(const char *mesg, int length)
     d_qlen=offset+4; // this points to the start of any answers
   }
 
-
-  const char *p=(stringbuffer.c_str()+12+offset);
-  const unsigned short int *i=(const unsigned short int *)p;
-  qtype=ntohs(*i++);
-  qclass=ntohs(*i);
-
-
+  qtype=stringbuffer[12+offset]*256+stringbuffer[13+offset];
+  qclass=stringbuffer[14+offset]*256+stringbuffer[15+offset];
   return 0;
 }
 
index 6ec2605514c068c4975d252f303dc410748958ac..60c15766c3b2c6b7230ec7d5c0e26e32ec54cfb8 100644 (file)
 #define PDNS_DNSPROXY
 #include <pthread.h>
 #include <map>
-\r
-#ifndef WIN32\r
-# include <sys/socket.h>\r
-# include <netinet/in.h>\r
-# include <arpa/inet.h>\r
-#endif // WIN32\r
-\r
+
+#ifndef WIN32
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+#endif // WIN32
+
 #include "dnspacket.hh"
 #include "lock.hh"
 #include "iputils.hh"
@@ -76,7 +76,7 @@ private:
   struct ConntrackEntry
   {
     u_int16_t id;
-    struct sockaddr_in6 remote;
+    char remote[28];
     Utility::socklen_t addrlen;
     int outsock;
     time_t created;
index 278ce5e5a93dcad60ecbf774138017a5a8f94088..4784e5b837aaeb5036ae716b3da73911421e8239 100644 (file)
@@ -15,7 +15,7 @@
       </affiliation>
     </author>
     
-    <PubDate>v2.1 $Date: 2002/11/28 14:38:00 $</PubDate>
+    <PubDate>v2.1 $Date: 2002/12/09 16:24:17 $</PubDate>
     
     <Abstract>
        <para>  
@@ -6543,23 +6543,489 @@ static RandomLoader randomloader;
   </appendix>
   <appendix id="compiling-powerdns"><title>Compiling PowerDNS</title>
     <para>
-      The PowerDNS source is separated from many of its modules. The main PowerDNS source tree however is able
-      to pull in certain files for creating packaged releases.
+      For now, see <ulink url="http://www.powerdns.org">the Open Source PowerDNS site</ulink>. 
+      <command>./configure --enable-mysql ; make ; make install</command> will do The Right Thing for most people.
     </para>
-    <para>
-      First download the source or retrieve from anoncvs.powerdns.com (module 'powerdns'). If from cvs, you need to execute 
-      <filename>./bootstrap</filename> to have the GNU autotools build the configure script and the Makefiles.
-    </para>
-    <para>
-      The run ./configure, followed by 'make'. PowerDNS prefers being compiled with GCC 3.2 but 2.95.4 and 3.0.4 will also work on most systems.
-      It will not compile on Debian Potato because that lacks the <filename>sstream</filename> include file.
-    </para>
-    <para>
-      After compiling, the <filename>./installer</filename> script can be used to install. 
-    </para>
-    <sect1><title>Configuring external modules with PowerDNS</title>
+    <sect1 id="on-windows"><title>Compiling PowerDNS on Windows</title>
+      <para>
+       By Michael Stol (<email>michael@physos.info</email>).
+      <sect2><title>Assumptions</title>
+        <para>
+         I will assume these things from you:      
+       </para>
+       <variablelist>
+          <varlistentry>
+           <term>
+             You have the PowerDNS sources.
+           </term>
+           <listitem>        
+             <para>
+               There's not much to compile without the source files, eh? :)
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>      
+           <term>
+             You are using Microsoft Visual C++. If you get it to compile using a free compiler, please let us know!
+           </term>
+           <listitem>        
+             <para>
+               From the day that we began porting the <acronym>UNIX</acronym> PowerDNS sources to Microsoft Windows
+               we used Microsoft Visual C++ as our development environment of choice.            
+             </para>
+             
+             <para>
+               We used Visual C++ 6.0 to compile all sources (both standard version and SP5). Other versions
+               (including Visual C++ .NET) are untested.
+             </para>
+           </listitem>
+         </varlistentry>
+         
+         <varlistentry>
+           <term>
+             You are using Microsoft Windows NT, 2000 or XP
+           </term>
+           <listitem>        
+             <para>
+               I will assume that the system where you want to compile the sources on is running
+               Microsoft Windows NT, 2000 or XP. These are the operating systems that where found
+               running PowerDNS for Windows.
+               
+             </para>          
+             
+             <note>
+               <para>
+                 You probably can compile the sources on other Windows versions too, but that is currently untested.
+               </para>
+             </note>
+           </listitem>
+         </varlistentry>
+         
+         <varlistentry>      
+           <term>
+             You are using an English Windows version.
+           </term>
+           <listitem>        
+             <para>
+               Troughout this document I will use the English names for menu items, names etc., so if you are
+               running a non-English Windows or <acronym>MSVC</acronym> version you have to translate those things yourself. But 
+               I don't think that would be a big problem.
+             </para>          
+           </listitem>
+         </varlistentry>
+         
+       </variablelist>
+       
+      </sect2>
+      
+      <sect2>
+       <title>Prequisites</title>
+       
+       <para>
+         Although we tried to keep PowerDNS for Windows' dependencies down to a minimum, you will still need some
+         programs and libraries to be able to compile the sources.
+       </para>
+       
+      <sect3>
+       <title>pthreads for Windows</title>
+       
+       <para>
+         The pthreads for Windows library is a Windows implementation of the <acronym>POSIX</acronym> threads
+         specification, which is used a lot in <acronym>UNIX</acronym> programs.
+       </para>
+       
+       <para>
+         PowerDNS uses pthreads too, and to ease the porting process we decided not to reinvent the wheel,
+         but to use pthreads for Windows instead.
+       </para>
+       
+       <sect4>
+         <title>Getting pthreads for Windows</title>
+         
+         <para>
+           Pthreads for Windows is available from anonymous ftp at <ulink url="ftp://sources.redhat.com/pub/pthreads-win32/">ftp://sources.redhat.com/pub/pthreads-win32/</ulink>.
+           You should download the latest <filename>pthreads-YYYY-MM-DD.exe</filename> file.
+         </para>
+         
+         <note>
+           <para>
+             PowerDNS for Windows was tested with the snapshot of 2002-03-02 of the library.
+           </para>
+         </note>
+         
+         <para>
+           For more information you can visit the pthreads for Windows homepage at <ulink url="http://sources.redhat.com/pthreads-win32/">http://sources.redhat.com/pthreads-win32/</ulink>
+         </para>          
+       </sect4>
+       
+       <sect3>
+         <title>Installing pthreads for Windows</title>
+         
+         <para>
+           To install the pthreads for Windows library you have to locate your <filename>pthreads-YYYY-MM-DD.exe</filename> 
+           file and start it.
+         </para>
+         
+         <para>
+           After starting the executable a self-extractor dialog will show up where you can specify where to extract
+           the contents of the file. When you selected a location you can press the <guibutton>Extract</guibutton> button
+           to extract all content to the target directory.
+         </para>
+         
+         <para>
+           The library is now installed, we still have to tell Visual C++ where it's located though, more
+           on that later.
+         </para>        
+       </sect3>
+       
+      </sect2>
+      
+      <sect2>
+       <title>Nullsoft Installer</title>
+       
+       <para>
+         For our installation program we used Nullsoft's Installer System (<acronym>NSIS</acronym>). We used 
+         <acronym>NSIS</acronym> because it's easy to use, versatile and free (and it uses <acronym><trademark>SuperPiMP</trademark></acronym> technology, but
+         they refuse to tell us what it is ;)). If the name Nullsoft rings a bell, it's because they're the guys who made
+         <ulink url="http://www.winamp.com/">winamp</ulink>.
+       </para>
+       
+       <sect3>
+         <title>Getting the Nullsoft Installer</title>
+         
+         <para>
+           The Nullsoft Installer can be downloaded at their website, which is
+           located at <ulink url="http://www.nullsoft.com/free/nsis/">http://www.nullsoft.com/free/nsis/</ulink>.
+           The file that you should download is called <filename>nsisXXX.exe</filename> (where XXX is the latest version).
+         </para>
+         
+         <note>
+           <para>
+             You can find the <acronym>NSIS</acronym> documentation at that website too.
+           </para>
+         </note>
+       </sect3>
+       
+       <sect3>
+         <title> Installing the Nullsoft Installer</title>
+         
+         <para>
+           Installing <acronym>NSIS</acronym> is easy. All there is to it is locating the installer and execute it.
+           Then just follow the installation steps.
+         </para>
+       </sect3>
+       
+      </sect2>
+      
+    <sect2>
+      <title>Setting up the build-environment</title>
+      
+      <para>
+       Before starting Microsoft Visual C++ and compile PowerDNS for Windows, you first
+       have to set up your build environment.
+      </para>
+      
+      <sect3>
+       <title>Make Microsoft Visual C++ recognize <filename>*.cc</filename> and <filename>*.hh</filename> (optional)</title>
+       
+        <para>
+          All PowerDNS source files are in the form <filename>name.cc</filename>, and all header files in the form
+          <filename>name.hh</filename>. These extensions aren't recognized by <acronym>MSVC</acronym> by default, so
+          you might want to change that first.
+        </para>
+        
+        <note>
+          <para>
+            Only perform this step if you want to be able to edit the <filename>*.cc</filename> 
+            and <filename>*.hh</filename> files in <acronym>MSVC</acronym>.
+          </para>
+        </note>
+        
+        <caution>
+          <para>
+            If you decide to perform this step, remember that it requires modification of the Windows registry, 
+            always make a backup before modifying!
+          </para>
+        </caution>
+        
+        <para>
+          Ok, after that word of caution we can now proceed. You have to follow these steps:
+        </para>
+
+        <orderedlist>
+         
+          <listitem>
+            <para>
+              Start the registry editor by entering <filename>regedit.exe</filename> in the run prompt
+              (<guimenu>Start-&gt;Run...</guimenu>).
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              Right click on <filename>HKEY_CLASSES_ROOT</filename> and select <guimenu>New-&gt;Key</guimenu>. 
+              A new key will appear, change that key to <quote><filename>.cc</filename></quote>, then change the default
+              value to <quote>cppfile</quote>
+            </para>
+
+            <para>
+              Then perform the same step for <quote><filename>.hh</filename></quote> (use <quote>hfile</quote> instead of <quote>cppfile</quote>).
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              Go to <filename>HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Tools\32-bit C/C++ Compiler for 80x86</filename>. And
+              add <quote>;*.cc</quote> to the <filename>Input_Spec</filename> value (so that it becomes <quote>*.c;*.cpp;*.cxx;*.cc</quote>).
+            </para>
+
+            <note>
+              <para>
+                If you happen to use another platform (like alpha) to compile the sources, you have to do the step above for that platform.
+              </para>
+            </note>
+          </listitem>
+
+          <listitem>
+            <para>
+              Go to <filename>HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Search</filename>. And
+              add <quote>;*.cc;*.hh</quote> to the <filename>FIF_Filter</filename> value (so that it becomes <quote>*.c;*.cpp;*.cxx;*.tli;*.h;*.tlh;*.inl;*.rc;*.cc;*.hh</quote>).
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              Finally change <filename>HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++</filename>. And
+              add <quote>;cc;hh</quote> to the <filename>FileExtensions</filename> value (so that it becomes <quote>cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2;hh;cc</quote>).
+            </para>
+          </listitem>
+          
+          <listitem>
+            <para>
+              Close the registry editor.
+            </para>
+          </listitem>
+          
+        </orderedlist>       
+        
+        <para>
+          Now should <acronym>MSVC</acronym> properly recognize the files as being C++.
+        </para>
+       
+      </sect3>
+      
+      <sect3>
+       <title>Setting Microsoft Visual C++'s directories</title>
+       
+       <para>
+         <acronym>MSVC</acronym> needs to locate some include files, libraries and executables
+         when it has to build PowerDNS for Windows. We are now going to tell <acronym>MSVC</acronym> where
+         to find those.
+       </para>
+       
+       <para>
+         To enter the directory dialog you have to go to <guimenu>Tools-&gt;Options...-&gt;Directories</guimenu>.
+       </para>
+       
+       <sect4>
+         <title>Setting the pthreads directories</title>
+         
+         <para>
+           When you are in the directory dialog you can add the pthreads for Windows directory.
+         </para>
+         
+         <para>
+           First add the include directory, to do this you have to select <guilabel>Include files</guilabel>
+           from the <guilabel>Show directories for:</guilabel> combobox. Then press the <guibutton>New</guibutton>
+           button and browse to the <emphasis>include</emphasis> directory of pthreads (ie. <filename>C:\pthreads\include</filename>).
+         </para>
+         
+         <para>
+           Then switch to <guilabel>Library files</guilabel> and add the <emphasis>library</emphasis> directory
+           (ie. <filename>C:\pthreads\lib</filename>) using the same method as above.
+         </para>        
+       </sect4>
+       
+       <sect4>
+         <title>Setting the Nullsoft Installer directory</title>
+         
+         <para>
+           While still being in the directory dialog, switch to <guilabel>Executable files</guilabel>
+           and add the Nullsoft Installer directory (ie. <filename>C:\Program Files\NSIS</filename>) to the list.
+         </para>
+       </sect4>
+       
+      
+    </sect3>
+      </sect2>
+    
+    <sect2>
+      <title>Compilation</title>
+      
+      <para>
+       Finally, after all the reading, installing and configuring we are ready to start compiling
+       PowerDNS for Windows.
+      </para>
+      
+      <sect3>
+       <title>Starting the compilation</title>  
+       
+       <para>
+         To start the compilation you first have to open the PowerDNS workspace (<filename>powerdns.dsw</filename>) using explorer or
+         from the <guimenu>File-&gt;Open Workspace...</guimenu> menu in <acronym>MSVC</acronym>.
+       </para>
+       
+       <para>
+         After you opened the workspace you can start compiling. Check all the checkboxes in the
+         <guimenu>Build-&gt;Batch Build...</guimenu> menu and press the <guibutton>Build</guibutton> button.
+       </para>
+       
+       <para>
+         Now cross your fingers and go make some coffee or tea while compiling PowerDNS for Windows. :)
+       </para>
+       
+      </sect3>
+      
+      <sect3>
+       <title>Yay! It compiled</title>
+       
+       <para>
+         Congratulations, you have now compiled PowerDNS for Windows!
+       </para>
+       
        <para>
-       A module needs to see the PowerDNS sources. See the INSTALL file of a module on how to configure this.
+         All the release builds of the binaries are in the <filename>Release</filename> directory (including the
+         generated installer). The debug builds are in the, guess what, <filename>Debug</filename> directory.
        </para>
+       
+       <para>
+         Now you can start installing PowerDNS, but that's beyond the scope of this document. See
+         the <ulink url="http://downloads.powerdns.com/documentation/html/">online documentation</ulink> for
+         more information about that.
+       </para>
+      </sect3>
+      
+      <sect3>
+       <title>What if it went wrong?</title>
+       
+       <para>
+         If the compilation fails, then try reading this article again, and again to see if you did something wrong.
+       </para>
+       
+       <para>
+         If you are pretty sure that it's a bug, either in the PowerDNS sources, the build
+         system or in this article, then please send an e-mail to <email>powerdns-dev@mailman.powerdns.com</email> describing your
+         problem. We will then try to fix it.
+       </para>
+       
+      </sect3>
+      
+    </sect2>
+    
+    <sect2>
+      <title>Miscellaneous</title>
+
+      <para>
+       Some miscellaneous information.
+      </para>
+      
+      <sect3>
+       <title>Credits</title>
+
+       <variablelist>
+         <title>Michel Stol would like to thank these people:</title>
+         
+         <varlistentry>
+           <term>
+             Bert Hubert
+           </term>
+           <listitem>
+             <para>
+               For writing the wonderfull PowerDNS software and learning me stuff
+               that I'd otherwise never had learned.
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             PowerDNS B.V.
+           </term>
+           <listitem>
+             <para>
+               For being great colleagues.
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             The pthreads-win32 crew (see the pthreads-win32 <filename>CONTRIBUTORS</filename> file).
+           </term>
+           <listitem>
+             <para>
+               For easing our porting process by writing a great Windows implementation of pthreads.
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             The guys over at Nullsoft.
+           </term>
+           <listitem>
+             <para>
+               For creating the Nullsoft Installer System (<acronym>NSIS</acronym>), and Winamp, the program we use every
+               day to make a lot of noise in the office.
+             </para>
+           </listitem>
+         </varlistentry>
+         
+       </variablelist>
+       
+      </sect3>
+      
+      <sect3>
+       <title>Contact information</title>
+       
+       <para>
+         If you have a comment, or a bug report concerning either this document or the PowerDNS sources
+         you can contact <email>powerdns-dev@mailman.powerdns.com</email>
+       </para>
+       
+       <para>
+         For general information about PowerDNS, the pdns server, express, documentation etc. I advice you to visit
+         <ulink url="http://www.powerdns.com/">http://www.powerdns.com/</ulink>
+       </para>
+
+       <para>
+         If you are interested in buying PowerDNS you can send a mail to <email>sales@powerdns.com</email>
+         or you can visit the PowerDNS website at <ulink url="http://www.powerdns.com/pdns/">http://www.powerdns.com/pdns/</ulink>
+       </para>      
+       
+       <para>
+         If you want to praise my work, ask me to marry you, deposit $1.000.000 on my bank account or flame me to death, then 
+         you can mail me at <email>michel@physos.info</email> :)
+       </para>
+       
+      </sect3>
+      
+      <sect3>
+       <title>Legal information</title>
+       
+       <para>
+         Microsoft, Visual C++, Windows, Windows NT, Windows 2000, Windows XP and Win32 are 
+         either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries.
+       </para>
+       
+       <para>
+         Other product and company names mentioned herein may be the trademarks of their respective owners.
+       </para>
+       
+       </sect3>
+      
+      </sect2>
     </sect1>
+
   </book>
diff --git a/pdns/extra/Makefile b/pdns/extra/Makefile
deleted file mode 100644 (file)
index 5c2f699..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id: Makefile,v 1.1 2002/11/27 15:18:37 ahu Exp $ 
-
-all:  null.o
-
-install:
-
-distdir: 
-
-distclean: clean
-
-clean:
-       rm -f null.o *.o *.so
diff --git a/pdns/extra/null.c b/pdns/extra/null.c
deleted file mode 100644 (file)
index e69de29..0000000
index 34604ad94c2070e1b196da23e97d54779ac93f47..6c43b81cd39e3760d1b4325061868c2ff6889bb7 100644 (file)
 #include <sstream>
 #include <errno.h>
 #include <sys/param.h>
-#include <cstring>\r
-\r
+#include <cstring>
+
 #include <iomanip>
 #include <sys/types.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
-\r
-#ifndef WIN32\r
-# include <sys/time.h>\r
-# include <time.h>\r
+#include <netdb.h>
+
+#ifndef WIN32
+# include <sys/time.h>
+# include <time.h>
 # include <netinet/in.h>
 # include <unistd.h>
-#endif // WIN32\r
+#endif // WIN32
 
 #include "utility.hh"
 
@@ -83,8 +84,8 @@ int matchNetmask(const char *address, const char *omask)
     *sep=0;
   }
 
-  if(!Utility::inet_aton(address, &a) || !Utility::inet_aton(mask, &m))\r
-  {\r
+  if(!Utility::inet_aton(address, &a) || !Utility::inet_aton(mask, &m))
+  {
     free(mask);
     return -1;
   }
@@ -107,23 +108,23 @@ int matchNetmask(const char *address, const char *omask)
 
 int waitForData(int fd, int seconds)
 {
-  struct timeval tv;\r
-  int ret;\r
-\r
-  tv.tv_sec   = seconds;\r
-  tv.tv_usec  = 0;\r
-\r
-  fd_set readfds;\r
-  FD_ZERO( &readfds );\r
-  FD_SET( fd, &readfds );\r
-\r
-  ret = select( fd + 1, &readfds, NULL, NULL, &tv );\r
-  if ( ret == -1 )\r
-  {\r
-    ret = -1;\r
-    errno = ETIMEDOUT;\r
-  }\r
-\r
+  struct timeval tv;
+  int ret;
+
+  tv.tv_sec   = seconds;
+  tv.tv_usec  = 0;
+
+  fd_set readfds;
+  FD_ZERO( &readfds );
+  FD_SET( fd, &readfds );
+
+  ret = select( fd + 1, &readfds, NULL, NULL, &tv );
+  if ( ret == -1 )
+  {
+    ret = -1;
+    errno = ETIMEDOUT;
+  }
+
   return ret;
 }
 
@@ -238,8 +239,7 @@ const string sockAddrToString(struct sockaddr_in *remote, Utility::socklen_t soc
 {    
   if(socklen==sizeof(struct sockaddr_in))
      return inet_ntoa(((struct sockaddr_in *)remote)->sin_addr);
-
-  // TODO: Add ipv6 support here.
+#ifdef HAVE_IPV6
   else {
     char tmp[128];
     
@@ -248,6 +248,7 @@ const string sockAddrToString(struct sockaddr_in *remote, Utility::socklen_t soc
 
     return tmp;
   }
+#endif
 
   return "untranslateable";
 }
index dc215d590f6f70589642bf920a6e9cdcc994ca13..f8d1e2fe7fe2fcae4e598ffa1b614f85e799344a 100644 (file)
@@ -1,5 +1,4 @@
 /*
-    PowerDNS Versatile Database Driven Nameserver
     Copyright (C) 2002  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-/*
-    Copyright (C) 2002  PowerDNS.COM BV
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-// $Id: nameserver.cc,v 1.1 2002/11/27 15:18:31 ahu Exp $ \r
+// $Id: nameserver.cc,v 1.2 2002/12/09 16:24:17 ahu Exp $ 
 #include "utility.hh"
 #include <cstdio>
 #include <cstring>
@@ -155,8 +137,7 @@ void UDPNameserver::bindIPv4()
 
 void UDPNameserver::bindIPv6()
 {
-  // TODO: Add Windows ipv6 support.
-#ifndef WIN32
+#if !WIN32 && HAVE_IPV6
   vector<string>locals;
   stringtok(locals,arg()["local-ipv6"]," ,");
 
index fc223c291ea5ee6a107f975c2ae2a2435a10ea3c..b80c5d07ce4f2a81db05fc550d14e99da6c73574 100755 (executable)
@@ -5,6 +5,7 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 BINARYPATH=@bindir@
+SBINARYPATH=@sbindir@
 SOCKETPATH=@socketdir@
 
 cd $SOCKETPATH
@@ -17,7 +18,7 @@ else
        PROGNAME=pdns
 fi
 
-pdns_server="$BINARYPATH/pdns_server $EXTRAOPTS"
+pdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS"
 
 doPC()
 {
index 0d5bd21fbd53058b87d9e82334d4d62579e734b3..0909308be4e4df5b15be407f312f61a2a14dc0ed 100644 (file)
@@ -16,7 +16,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-#include "utility.hh"\r
+#include "utility.hh"
 #include <cstdio>
 #include <cstring>
 #include <cstdlib>
@@ -24,7 +24,7 @@
 #include <iostream>
 #include <string>
 #include "tcpreceiver.hh"
-\r
+
 #include <errno.h>
 #include <signal.h>
 
@@ -436,7 +436,7 @@ TCPNameserver::TCPNameserver()
   }
 
   // TODO: Implement ipv6
-#ifndef WIN32
+#if !WIN32 && HAVE_IPV6
   for(vector<string>::const_iterator laddr=locals6.begin();laddr!=locals6.end();++laddr) {
     struct sockaddr_in6 local;
     int s=socket(AF_INET6,SOCK_STREAM,0); 
index 7f2ccaef82377154416669cacbd611be367afec4..dba1caedf854dffc5c5c78c79fdb912dab8ee824 100644 (file)
@@ -16,7 +16,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-// Utility class win32 implementation.
+
 
 #include "utility.hh"
 #include <cstring>
 #include <grp.h>
 #include <sys/types.h>
 
+#ifdef NEED_INET_NTOP_PROTO
+extern "C" {
+const char *inet_ntop(int af, const void *src, char *dst, size_t cnt);
+}
+#endif
+
+
 using namespace std;
 
 // Closes a socket.
@@ -56,7 +63,7 @@ bool Utility::setBlocking(sock_t sock)
 
 const char *Utility::inet_ntop(int af, const char *src, char *dst, size_t size)
 {
-  return const_cast<char *>(::inet_ntop(af,src,dst,size));
+  return ::inet_ntop(af,src,dst,size);
 }
 
 unsigned int Utility::sleep(unsigned int sec)
index b2285003c93d4429eff5c8693cd55bcb37462463..18cedf7c803b742b40b10033527dc03e0b23d51c 100644 (file)
 #ifndef UTILITY_HH
 #define UTILITY_HH
 
+#include "config.h"
+#ifdef NEED_POSIX_TYPEDEF
+typedef unsigned short int u_int16_t;
+typedef unsigned int u_int32_t;
+#endif
+
+
 #ifndef WIN32
 # include <arpa/inet.h>
 # include <netinet/in.h>
index 8696cfe011987ea0dfc3f87e12974314e3d64201..bd1d72b6df909c0443af6dd92aaf1e3e1ebafeb2 100644 (file)
@@ -1,21 +1,4 @@
-/*
-    PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2002  PowerDNS.COM BV
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
 /*
     Copyright (C) 2002  PowerDNS.COM BV
 
@@ -32,7 +15,7 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/#include "utility.hh"\r
+*/#include "utility.hh"
 #include "ws.hh"
 #include "webserver.hh"
 #include "logger.hh"