+++ /dev/null
-/* Define when extra posix typedefs are needed (solaris2.6) */
-#undef NEED_POSIX_TYPEDEF
-#undef VERBOSELOG
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
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
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
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)
[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"])
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
/* ) ;;
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@
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:
-CXXFLAGS:=-I@MYSQL_incdir@ $(CXXFLAGS)
+INCLUDES=-I@MYSQL_incdir@
lib_LTLIBRARIES = libmysqlbackend.la
EXTRA_DIST=OBJECTFILES OBJECTLIBS
libmysqlbackend_la_SOURCES=mysqlcbackend.cc mysqlcbackend.hh
+INCLUDES=-I@MYSQL_incdir@
lib_LTLIBRARIES = libpdnsbackend.la
EXTRA_DIST=OBJECTFILES OBJECTLIBS
-// $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>
//! 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;
-// $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
using namespace std;
-#include <mysql/mysql.h>
+#include <mysql.h>
class PdnsBackend : public DNSBackend
{
# install .lib/libpipebackend.so.0.0.0 @libdir@
#endif
+EXTRA_DIST=OBJECTFILES OBJECTLIBS
lib_LTLIBRARIES = libpipebackend.la
#include <iostream>
#include <stdio.h>
+#include <string>
using namespace std;
// -*- 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>
}
};
-class Loader
+class PipeLoader
{
public:
- Loader()
+ PipeLoader()
{
BackendMakers().report(new PipeFactory);
}
};
-static Loader loader;
+static PipeLoader pipeloader;
-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
# binpatch_SOURCES=binpatch.cc
-SUBDIRS= codedocs backends extra .
+SUBDIRS= codedocs backends .
-AM_CXXFLAGS=-D_GNU_SOURCE -I../..
+INCLUDES=-I../..
lib_LTLIBRARIES = libbindbackend.la
libbindbackend_la_SOURCES=bindbackend.cc bindbackend.hh bindparser.yy \
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>
//! 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;
#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"
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);
}
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;
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"
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;
}
typedef pair<QuestionData, AnswerData> tuple_t;
private:
- queue<QuestionData> questions;
+ std::queue<QuestionData> questions;
pthread_mutex_t q_lock;
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);
QD.callback=callback;
questions.push(QD);
pthread_mutex_unlock(&q_lock);
-\r
+
numquestions.post();
-\r
+
if(!(nextid%50)) {
int val;
numquestions.getValue( &val );
L<<Logger::Error<<val<<" questions waiting for database attention. Limit is "<<arg().asNum("max-queue-length")<<", respawning"<<endl;
exit(1);
}
- }\r
+ }
return QD.id;
}
}
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 );
}
// FIXME: write this
}
-\r
-#endif // DISTRIBUTOR_HH\r
+
+#endif // DISTRIBUTOR_HH
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>
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;
}
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;
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
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
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;
}
#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"
struct ConntrackEntry
{
u_int16_t id;
- struct sockaddr_in6 remote;
+ char remote[28];
Utility::socklen_t addrlen;
int outsock;
time_t created;
</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>
</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->Run...</guimenu>).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Right click on <filename>HKEY_CLASSES_ROOT</filename> and select <guimenu>New->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->Options...->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->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->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>
+++ /dev/null
-# $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
#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"
*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;
}
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;
}
{
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];
return tmp;
}
+#endif
return "untranslateable";
}
/*
- 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>
void UDPNameserver::bindIPv6()
{
- // TODO: Add Windows ipv6 support.
-#ifndef WIN32
+#if !WIN32 && HAVE_IPV6
vector<string>locals;
stringtok(locals,arg()["local-ipv6"]," ,");
prefix=@prefix@
exec_prefix=@exec_prefix@
BINARYPATH=@bindir@
+SBINARYPATH=@sbindir@
SOCKETPATH=@socketdir@
cd $SOCKETPATH
PROGNAME=pdns
fi
-pdns_server="$BINARYPATH/pdns_server $EXTRAOPTS"
+pdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS"
doPC()
{
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>
#include <iostream>
#include <string>
#include "tcpreceiver.hh"
-\r
+
#include <errno.h>
#include <signal.h>
}
// 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);
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.
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)
#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>
-/*
- 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
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"