if RECURSOR
sbin_PROGRAMS = pdns_server pdns_recursor
+bin_PROGRAMS = pdns_control rec_control
else
sbin_PROGRAMS = pdns_server
+bin_PROGRAMS = pdns_control
endif
-bin_PROGRAMS = pdns_control
+
EXTRA_PROGRAMS=pdns_recursor sdig dnspbench pdns_control qgen dnsscope dnsreplay_mindex dnswasher dnsreplay
# INCLUDES=-I/usr/include/mysql
+rec_control_SOURCES=rec_channel.cc rec_channel.hh rec_control.cc
+
pdns_recursor_SOURCES=syncres.cc resolver.hh misc.cc unix_utility.cc qtype.cc \
logger.cc statbag.cc dnspacket.cc arguments.cc lwres.cc pdns_recursor.cc lwres.hh \
mtasker.hh sillyrecords.cc syncres.hh recursor_cache.cc recursor_cache.hh dnsparser.cc \
dnswriter.cc dnswriter.hh dnsrecords.cc dnsrecords.hh rcpgenerator.cc rcpgenerator.hh \
-base64.cc base64.hh zoneparser-tng.cc zoneparser-tng.hh
+base64.cc base64.hh zoneparser-tng.cc zoneparser-tng.hh rec_channel.cc rec_channel.hh
if NEDMALLOC
pdns_recursor_SOURCES += ext/nedmalloc/malloc.c
/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2002 PowerDNS.COM BV
+ Copyright (C) 2002 - 2006 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.
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// $Id$
-/* (C) Copyright 2002 PowerDNS.COM BV */
#include <cstring>
#include <string>
#include <map>
#include "zoneparser-tng.hh"
using namespace boost;
-
-
#ifdef __FreeBSD__ // see cvstrac ticket #26
#include <pthread.h>
#include <semaphore.h>
--- /dev/null
+#include "rec_channel.hh"
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <cerrno>
+#include "ahuexception.hh"
+
+using namespace std;
+
+int RecursorControlChannel::listen(const string& fname)
+{
+ struct sockaddr_un local;
+ d_fd=socket(AF_UNIX,SOCK_DGRAM,0);
+
+ if(d_fd < 0)
+ throw AhuException("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));
+
+ int err=unlink(fname.c_str());
+ if(err < 0 && errno!=ENOENT)
+ throw AhuException("Unable to remove (previous) controlsocket: "+string(strerror(errno)));
+
+ memset(&local,0,sizeof(local));
+ local.sun_family=AF_UNIX;
+ strcpy(local.sun_path, fname.c_str());
+
+ if(bind(d_fd, (sockaddr*)&local,sizeof(local))<0)
+ throw AhuException("Unable to bind to controlsocket: "+string(strerror(errno)));
+
+}
--- /dev/null
+#ifndef PDNS_REC_CHANNEL
+#define PDNS_REC_CHANNEL
+#include <string>
+#include <stdint.h>
+
+/** this class is used both to send and answer channel commands to the PowerDNS Recursor */
+class RecursorControlChannel
+{
+public:
+ int listen(const std::string& filename);
+ void connect(const std::string& filename);
+
+ uint64_t getStat(const std::string& name);
+private:
+ int d_fd;
+};
+
+#endif
--- /dev/null
+int main(int argc, char** argv)
+{
+}