]> granicus.if.org Git - pdns/commitdiff
remove unreferenced files from source tree
authorKees Monshouwer <mind04@monshouwer.org>
Sun, 17 Nov 2013 19:36:23 +0000 (20:36 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 17 Nov 2013 21:20:08 +0000 (22:20 +0100)
for FILE in $(git ls-files pdns/*); do
    git grep $(basename "$FILE") > /dev/null || echo "would remove $FILE"
done

pdns/argtng.hh [deleted file]
pdns/dnslabel.cc [deleted file]
pdns/dnslabel.hh [deleted file]
pdns/dnsrecord.proto [deleted file]
pdns/rdtsc.hh [deleted file]
pdns/recursor_memcached.cc [deleted file]
pdns/recursor_memcached.hh [deleted file]
pdns/spoofpol.cc [deleted file]
pdns/spoofpol.hh [deleted file]

diff --git a/pdns/argtng.hh b/pdns/argtng.hh
deleted file mode 100644 (file)
index 45489ae..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-#include <iostream>
-#include <stdlib.h>
-#include <vector>
-#include <map>
-#include <string>
-#include <cctype>
-#include <boost/shared_ptr.hpp>
-#include <boost/regex.hpp>
-#include "namespaces.hh"
-#include "namespaces.hh"
-
-#define decl(x,y) typeof((y)) (x) = (y)
-
-struct cond
-{
-  virtual bool operator()(const string& s) const=0;
-  virtual shared_ptr<cond> copy() const=0;
-  virtual ~cond()
-  {
-  }
-};
-
-struct Ok : public cond
-{
-  bool operator()(const string& s) const
-  {
-    return true;
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Ok);
-  }
-};
-
-struct Empty : public cond
-{
-  bool operator()(const string& s) const
-  {
-    return s.empty();
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Empty);
-  }
-};
-
-struct IpAddress : public cond
-{
-  bool operator()(const string& s) const
-  {
-    static const regex r("^((25[0-5]|2[0-4]\\d|[01]\\d\\d|\\d?\\d)\\.){3}(25[0-5]|2[0-4]\\d|[01]\\d\\d|\\d?\\d)$");
-    return regex_match(s,r);
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new IpAddress);
-  }
-};
-
-struct HostName : public cond
-{
-  bool operator()(const string& s) const
-  {
-    static const regex r("^([a-zA-Z0-9_-]\\.)?([a-zA-Z0-9_-]\\.?)*$");
-    return regex_match(s,r);
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new HostName);
-  }
-};
-
-
-struct Numeric : public cond
-{
-  bool operator()(const string& s) const
-  {
-    if(s.empty())
-      return false;
-
-    for(decl(i,s.begin());i!=s.end();++i)
-      if(!isdigit(*i))
-        return false;
-    return true;
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Numeric);
-  }
-};
-
-struct Switch : public cond
-{
-  bool operator()(const string& s) const
-  {
-    return (s=="on" || s=="off");
-  }
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Switch);
-  }
-};
-
-
-
-
-struct And : public cond
-{
-  And(const cond& A, const cond& B)
-    : d_A(A.copy()), d_B(B.copy())
-  {
-  }
-
-  bool operator()(const string& s) const
-  {
-    return (*d_A)(s) && (*d_B)(s);
-  }
-
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new And(*d_A, *d_B));
-  }
-  shared_ptr<cond> d_A, d_B;
-
-};
-
-
-struct Or : public cond
-{
-  Or(const cond& A, const cond& B)
-    : d_A(A.copy()), d_B(B.copy())
-  {
-  }
-
-
-  bool operator()(const string& s) const
-  {
-    return (*d_A)(s) || (*d_B)(s);
-  }
-
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Or(*d_A, *d_B));
-  }
-  shared_ptr<cond> d_A, d_B;
-};
-
-struct Not : public cond
-{
-  Not(const cond& A)
-    : d_A(A.copy())
-  {
-  }
-
-
-  bool operator()(const string& s) const
-  {
-    return !(*d_A)(s);
-  }
-
-  shared_ptr<cond> copy() const
-  {
-    return shared_ptr<cond>(new Not(*d_A));
-  }
-  shared_ptr<cond> d_A;
-};
-
-
-const Not operator!(const cond &A)
-{
-  return Not(A);
-}
-
-const And operator&&(const cond &A, const cond& B)
-{
-  return And(A,B);
-}
-
-const Or operator||(const cond &A, const cond& B)
-{
-  return Or(A,B);
-}
-
-
-
-
-struct Argument
-{
-  Argument()
-  {}
-
-  Argument(const cond& c, const string& val="") 
-    : d_c(c.copy()), d_value(val)
-  {}
-
-  shared_ptr<cond> d_c;
-  string d_value;
-};
-
-typedef runtime_error argument_exception;
-
-class ArgTng
-{
-public:
-  void add(const string &name, const cond& c=Ok(), const string& def="")
-  {
-    d_content[name]=Argument(c,def);
-  }
-  
-  void constraints() 
-  {
-    for(decl(i,d_content.begin());i!=d_content.end();++i)
-      if(!correct(i->first))
-        throw runtime_error("variable '"+i->first+"' violates constraints with value '"+i->second.d_value+"'");
-    
-  }
-
-  void parse(int argc, char **argv)
-  {
-    for(int n=1;n<argc;++n)
-      parseString(argv[n]);
-  }
-
-  const string get(const string& var)
-  {
-    if(!d_content.count(var))
-      throw(runtime_error("trying to read unknown parameter '"+var+"'"));
-    return d_content[var].d_value;
-  }
-  int getInt(const string& var)
-  {
-    if(!d_content.count(var))
-      throw(runtime_error("trying to read unknown parameter '"+var+"'"));
-    string val=d_content[var].d_value;
-    if(!Numeric()(val))
-      throw(runtime_error("trying to convert '"+var+"' value '"+val+"' into a number"));
-    return atoi(val.c_str());
-  }
-
-private:
-  map<string, Argument> d_content;
-  bool correct(const string& s)
-  {
-    return (*d_content[s].d_c)(d_content[s].d_value);
-  }
-  void parseString(const string& s)
-  {
-    static const regex r("^--([a-z0-9-]*)=(.*)$");
-    match_results<string::const_iterator> res;
-    if(!regex_match(s,res,r))
-      throw argument_exception("argument item does not match, should be --var=val");
-
-    string var(res[1].first, res[1].second);
-    string val(res[2].first, res[2].second);
-
-    if(!d_content.count(var))
-      throw argument_exception("trying to set unknown variable '"+var+"'");
-    if(!(*d_content[var].d_c)(val))
-      throw argument_exception("trying to set variable '"+var+"' to illegal value '"+val+"'");
-
-    d_content[var].d_value=val;
-  }
-};
-
-#if 0
-
-int main(int argc, char**argv)
-try {
-  ArgTng at;
-  at.add("host", !Empty() && (IpAddress() || HostName()),"localhost");
-  at.add("number", Numeric());
-  at.parse(argc, argv);
-  at.constraints();
-
-  cout<<"Hostname="<<at.get("host")<<endl;
-  cout<<"number="<<at.getInt("number")<<endl;
-
-}
-catch(argument_exception &ae)
-{
-  cerr<<"Fatal: "<<ae.what()<<endl;
-}
-#endif
diff --git a/pdns/dnslabel.cc b/pdns/dnslabel.cc
deleted file mode 100644 (file)
index 73ad236..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
-    PowerDNS Versatile Database Driven Nameserver
-                Copyright (C) 2010 Netherlabs Computer Consulting BV
-                
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License version 2
-    as published by the Free Software Foundation    
-
-    Additionally, the license of this program contains a special
-    exception which allows to distribute the program in binary form when
-    it is linked against OpenSSL.
-
-    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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#include "dnslabel.hh"
-
-void DNSLabel::init(unsigned int len)
-{
-        d_capacity = len;
-        d_storage = new char[d_capacity]; 
-        
-        d_fulllen = 0;
-        d_offset = 0;
-}
-
-DNSLabel::DNSLabel(const DNSLabel& rhs)
-{
-        init();
-        *this=rhs;
-}
-
-DNSLabel::DNSLabel() 
-{
-        init(); 
-        appendChar(0); // "root"
-}
-
-// FIXME: this should validate if 'raw' is a valid dns label!
-DNSLabel::DNSLabel(const char*raw, unsigned int len)
-{
-        if(!validateStrict(raw, len)) 
-                throw std::range_error("invalid raw label passed to DNSLabel");
-        init(len);
-        memcpy(d_storage, raw, len);
-        d_fulllen = len;
-}
-
-DNSLabel& DNSLabel::operator=(const DNSLabel& rhs)
-{
-        unsigned int newlen = rhs.getLength();
-        if(newlen > d_capacity) {
-                delete[] d_storage;
-                d_storage = new char[newlen];
-        }
-        d_fulllen = newlen;
-        d_offset=0;
-        memcpy(d_storage, rhs.d_storage, d_fulllen);
-        
-        return *this;
-}
-
-DNSLabel::~DNSLabel()
-{
-        delete[] d_storage;
-}
-
-DNSLabel::DNSLabel(const char* human)
-{
-        // FIXME: do the escaping thing
-        init();
-        const char* labelStart=human;
-        const char* p;
-        for(p=human; *p; ++p) {
-                if(*p=='.') {
-                        char labelLen = p - labelStart;
-                        appendChar(labelLen);
-                        appendRange(labelStart, labelLen);
-                        labelStart=p+1;
-                }
-        }
-        if(labelStart != p) { // human input did not end on a trailing dot
-                char labelLen = p - labelStart;
-                appendChar(labelLen);
-                appendRange(labelStart, labelLen);
-        }
-        d_storage[d_fulllen++]=0;
-}
-
-bool DNSLabel::validateStrict(const char* raw, unsigned int len)
-{
-        int result = validateConsume(raw, len);
-        if(result < 0 || (unsigned int)result != len)
-                return false;
-        return true;        
-}
-
-int DNSLabel::validateConsume(const char* raw, unsigned int maxLen)
-{
-        if(!maxLen)
-                return -1; // shortest ok label is: '\x00'
-
-        const unsigned char* p = (const unsigned char*) raw;
-
-        for(;;) {
-                if(p > (const unsigned char*)raw + maxLen) // beyond the end
-                        return -1;
-                        
-                // cerr<<(int)*p<<endl;
-                if(*p >= 0xc0 && p + 1 < (const unsigned char*)raw + maxLen) {
-                        // unsigned int offset=(*p & ~0xc0) * 0xff + *(p+1);
-                        ++p;
-                        // cerr<<"Wants to refer to offset "<<offset<<endl;
-                        return -1;
-                }
-                if(*p > 64) // label length too long, or a compression pointer
-                        return -1;
-                
-                if(!*p) { // final label, return bytes consumed
-                        return 1 + (p - (const unsigned char*)raw);
-                }
-                
-                p += *p + 1;
-        }
-        return -1; // we should not get here, but if we do, it's bad
-}
-
-
-string DNSLabel::human() const
-{
-        // FIXME: do the escaping thing
-        const char* p = getStart();
-        char labelLen;
-        
-        if(!*p)
-                return ".";
-                
-        string ret;
-        for(;;) {        
-                labelLen = *p;
-                // cerr<<"human, labelLen: "<<(int) labelLen<<endl;
-                ++p;
-                ret.append(p, (int)labelLen);
-                
-                if(!labelLen)
-                        break;
-                ret.append(1, '.');
-                p+=labelLen;
-        }
-        
-        return ret;
-}
-
-bool DNSLabel::chopOff()
-{
-        char labelLen = *getStart();
-        d_offset += labelLen+1;
-        return labelLen;
-}
-
-bool DNSLabel::endsOn(const DNSLabel &rhs) const
-{
-        int longer = getLength() - rhs.getLength();
-        if(longer < 0) 
-                return false;
-        return !memcmp(getStart()+longer, rhs.getStart(), 
-                rhs.getLength());
-}
-
-string DNSLabel::binary() const
-{
-        return std::string(getStart(), getLength());
-}
-
-static unsigned int roundUpToNextPowerOfTwo(unsigned int x)
-{
-        x--;
-  x |= x >> 1;  // handle  2 bit numbers
-  x |= x >> 2;  // handle  4 bit numbers
-  x |= x >> 4;  // handle  8 bit numbers
-  x |= x >> 8;  // handle 16 bit numbers
-  x |= x >> 16; // handle 32 bit numbers
-  x++;
-  return x;
-}
-void DNSLabel::expandCapacity(unsigned int len)
-{
-        if(!len)
-                d_capacity *= 2;
-        else {
-                d_capacity = roundUpToNextPowerOfTwo(d_capacity + len);
-        }
-        char *newStorage = new char[d_capacity];
-        memcpy(newStorage, d_storage, d_fulllen);
-        delete[] d_storage;
-        d_storage=newStorage;
-}
-
-DNSLabel DNSLabel::createFromBuffer(const char* raw, unsigned int* len)
-{
-        int result = DNSLabel::validateConsume(raw, *len);
-        if(result < 0)
-                throw std::runtime_error("raw input to DNSLabel factory was invalid");
-        *len = (unsigned int) result;
-        return DNSLabel(raw, result);
-}
-
-void DNSLabel::chaseLabel(const char* raw, const char* beginPacket, unsigned int packetLength, unsigned int* len, bool updateLen)
-{
-        const unsigned char* p = (const unsigned char*) raw;
-
-        for(;;) {
-                if(p > (const unsigned char*)beginPacket + packetLength) // beyond the end
-                        throw std::range_error("label begins beyond end of packet");
-                        
-                if(*p >= 0xc0 && p + 1 < (const unsigned char*)beginPacket + packetLength) {
-                        unsigned int offset=(*p & ~0xc0) * 256 + *(p+1);
-                        if(offset < 12)
-                                throw std::range_error("compression pointer to before beginning of content");
-                        offset -= 12;
-                        // cerr<<"new offset: "<<offset<<endl;
-                        if((const unsigned char*)beginPacket + offset >= p) {
-                                throw std::runtime_error("looping or forward compression pointer");
-                        }
-                                
-                        p+=2;
-                        if(updateLen) {
-                                *len = (p - (const unsigned char*)raw);
-                        }
-                        
-                        chaseLabel(beginPacket + offset, beginPacket, packetLength, len, false);
-                        return;
-                }
-                if(*p > 64) // label length too long, or a compression pointer
-                        throw std::range_error("label too long");
-                
-                if(!*p) { // final label, setbytes consumed
-                        appendChar(0);
-                        if(updateLen)
-                                *len = 1 + (p - (const unsigned char*)raw);
-                        return;
-                }
-                appendChar(*p);
-                appendRange((const char*)p+1, *p);
-                p += *p + 1;
-        }
-         // we should not get here, but if we do, it's bad
-}
-
-DNSLabel::DNSLabel(const char* raw, const char* beginPacket, unsigned int packetLength, unsigned int* len)
-{
-        init();
-        if(!*len) {
-                throw std::range_error("void label"); // shortest ok label is: '\x00'
-        }
-
-        chaseLabel(raw, beginPacket, packetLength, len, true);
-}
-
-#if 0
-void endsOn(const DNSLabel& first, const DNSLabel& second)
-{
-        cerr<<"Does '"<<first.human()<<"' end on '"<<second.human()<<"': ";
-        cerr<<first.endsOn(second)<<endl;
-}
-
-string makeHexDump(const string& str)
-{
-  char tmp[5];
-  string ret;
-  ret.reserve((int)(str.size()*2.2));
-
-  for(string::size_type n=0;n<str.size();++n) {
-    snprintf(tmp,sizeof(tmp), "%02x ", (unsigned char)str[n]);
-    ret+=tmp;  
-  }
-  return ret;
-}
-
-int main()
-{        
-        DNSLabel label("www.powerdns.com"), suffix("powerdns.com"), root;
-        endsOn(label, suffix);
-        
-        suffix=root;
-        endsOn(label, suffix);
-        
-        suffix=DNSLabel("net");
-        endsOn(label, suffix);
-        
-        while(label.chopOff()) {
-                cerr<<label.human()<<endl;
-                cerr<<endl;
-        }
-        
-        DNSLabel label2("blah");
-        label = label2;
-        
-        
-        char rawLabel[]= "\003www\004ds9a\002nl";
-        DNSLabel raw(rawLabel, sizeof(rawLabel));
-        cerr<<"raw human: "<<raw.human()<<endl;
-        
-        char rawLabel2[]= "\003www\004ds9a\003nl";
-        DNSLabel raw2(rawLabel2, sizeof(rawLabel2));
-}
-#endif
diff --git a/pdns/dnslabel.hh b/pdns/dnslabel.hh
deleted file mode 100644 (file)
index 95b11d5..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-    PowerDNS Versatile Database Driven Nameserver
-               Copyright (C) 2010 Netherlabs Computer Consulting BV
-               
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License version 2
-    as published by the Free Software Foundation
-
-    Additionally, the license of this program contains a special
-    exception which allows to distribute the program in binary form when
-    it is linked against OpenSSL.
-
-    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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#include <string>
-#include <stdio.h>
-#include <iostream>
-#include <string.h>
-#include <stdexcept>
-using std::string;
-using std::cerr;
-using std::endl;
-
-
-/* the idea of dnslabel is that we guard our input, and from that point
- * onwards, trust the contents of d_storage.
- * 
- * On input we deal with escapes etc, on output we re-escape.
- * This can be slow since we hope with all our might not to be 
- * using the 'human' interfaces too much, and keep everything as a 
- * native DNS label all the time.
- * 
- * The goal for DNSLabel is to be 'holier than thou' and adhere
- * to all relevant RFCs. This means implementing the really odd DNS case
- * sensitivity rules, doing all the escaping properly and deal
- * with embedded nuls.
- * 
- * Design
- * As a special speedup, we implement 'chopping' by having an offset
- * counter. This means that the oft-repeated 'www.powerdns.com.'
- * 'powerdns.com.', 'com.', '.' sequence does not involve any mallocs.
- */
-class DNSLabel
-{
-       public:
-               explicit DNSLabel(const char* human);
-               explicit DNSLabel(const std::string& human);
-               DNSLabel(const char* raw, unsigned int length);
-               DNSLabel(const DNSLabel& rhs);
-               DNSLabel(const char* raw, const char* beginPacket, unsigned int packetLength, unsigned int* len);
-               DNSLabel();
-               ~DNSLabel();
-               string human() const;
-               string binary() const;
-               bool endsOn(const DNSLabel& rhs) const;
-               bool chopOff();
-               bool operator<(const DNSLabel& rhs) const;
-               bool operator==(const DNSLabel& rhs) const;
-               DNSLabel& operator=(const DNSLabel& rhs);
-               int project(char* target, unsigned int length);
-               static int validateConsume(const char* raw, unsigned int len);
-               static bool validateStrict(const char* raw, unsigned int len);
-               
-               static DNSLabel createFromBuffer(const char* raw, unsigned int* len);
-       private:
-               char* d_storage;
-               unsigned int d_fulllen;
-               unsigned int d_offset;
-               unsigned int d_capacity;
-               void init(unsigned int len=64);
-               unsigned int getLength() const
-               {
-                       return d_fulllen - d_offset;
-               }
-               
-               const char* getStart() const
-               {
-                       return d_storage + d_offset;
-               }
-               
-               void appendChar(char c)
-               {
-                       if(d_fulllen == d_capacity)
-                               expandCapacity();
-                       d_storage[d_fulllen++]= c;
-               }
-               void appendRange(const char* ptr, unsigned int len)
-               {
-                       if(d_fulllen + len > d_capacity)
-                               expandCapacity(len);
-                       memcpy(d_storage + d_fulllen, ptr, len);
-                       d_fulllen += len;
-               }
-
-               void expandCapacity(unsigned int len=0);
-               void chaseLabel(const char* raw, const char* beginPacket, unsigned int packetLength, unsigned int* len, bool updateLen);
-};
diff --git a/pdns/dnsrecord.proto b/pdns/dnsrecord.proto
deleted file mode 100644 (file)
index 653b951..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package DNSProtoBuf;
-
-message DNSResourceRecord {
-  required string qname = 1;
-  required int32 qtype = 2;
-  required string content = 3;
-  required int32 ttl = 4;
-  optional int32 priority = 5;
-  enum Place {
-       QUESTION = 0;
-       ANSWER = 1;
-       AUTHORITY = 2;
-       ADDITIONAL = 3;
-  }
-  required Place place = 6;
-}
-
-message DNSResourceRecordVector {
-  repeated DNSResourceRecord dnsrecord = 1;
-}
diff --git a/pdns/rdtsc.hh b/pdns/rdtsc.hh
deleted file mode 100644 (file)
index c65dee3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef PDNS_RDTSC_HH
-#define PDNS_RDTSC_HH
-
-#define rdtsc() \
-({ \
-  unsigned long lowPart, highPart;                                     \
-  __asm__ __volatile__("cpuid"); \
-  __asm__ __volatile__("rdtsc" : "=a" (lowPart), "=d" (highPart)); \
-    ((((unsigned long long) highPart) << 32) | lowPart); \
-})
-
-
-
-#define RDTSC(qp) \
-do { \
-  unsigned long lowPart, highPart;                                     \
-  __asm__ __volatile__("cpuid"); \
-  __asm__ __volatile__("rdtsc" : "=a" (lowPart), "=d" (highPart)); \
-    qp = (((unsigned long long) highPart) << 32) | lowPart; \
-} while (0)
-
-#endif
diff --git a/pdns/recursor_memcached.cc b/pdns/recursor_memcached.cc
deleted file mode 100644 (file)
index 6b3aa1d..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <string>
-#include "statbag.hh"
-#include "iputils.hh"
-#include "recursor_memcached.hh"
-#include <boost/lexical_cast.hpp>
-
-#include "namespaces.hh"
-using boost::lexical_cast;
-
-MemcachedCommunicator::MemcachedCommunicator(const std::string& servers)
-{
-  d_socket=socket(AF_INET, SOCK_DGRAM, 0);
-  Utility::setCloseOnExec(d_socket);
-
-  ComboAddress remote(servers, 11211);
-  if(connect(d_socket, (struct sockaddr*)&remote, remote.getSocklen()) < 0)
-    unixDie("connecting to remote memcached server '"+remote.toStringWithPort()+"'");
-}
-
-string MemcachedCommunicator::get(const std::string& key)
-{
-  cerr<<"Looking up: '"<<key<<"'\n";
-  string message("get "+key+"\r\n");
-  UDPHeader uh;
-  uh.totalDgrams=htons(1);
-  
-  string packet((char*)&uh, sizeof(uh));
-  packet+=message;
-  
-  if(send(d_socket, packet.c_str(), packet.length(), 0) < 0)
-    unixDie("sending packet to remote Memcached server");
-
-  char buffer[1500];
-
-  int ret=recv(d_socket, buffer, sizeof(buffer), 0);
-  if(ret <= 0) 
-    unixDie("receiving packet from Memcached server");
-  string response(buffer+sizeof(uh), ret-sizeof(uh));
-  string::size_type pos = response.find('\n');
-  if(pos == string::npos) 
-    unixDie("Invalid response from memcached, no \\n");
-  int flags, len;
-  string value;
-  if(response != "END\r\n") {
-    char tmp[21];
-    if(sscanf(response.c_str(),"VALUE %20s %d %d", tmp, &flags, &len)!=3) 
-      throw runtime_error("Unable to parse memcached response '"+response+"'");
-    
-    value=string(response.c_str()+pos+1, len);
-  }
-  cerr<<"Returning: '"<<value<<"'\n";
-  return value;
-
-}
-
-void MemcachedCommunicator::set(const std::string& key, const std::string& value)
-{
-  cerr<<"setting: '"<<key<<"' to '"<<value<<"'\n";
-  string message("set "+key+" 0 0 "+lexical_cast<string>(value.length())+"\r\n"+value+"\r\n");
-  cerr<<"Message is: '"<<message<<"'\n";
-  UDPHeader uh;
-  uh.totalDgrams=htons(1);
-  
-  string packet((char*)&uh, sizeof(uh));
-  packet+=message;
-  
-  if(send(d_socket, packet.c_str(), packet.length(), 0) < 0)
-    unixDie("sending packet to remote Memcached server");
-
-  char buffer[1500];
-
-  int ret=recv(d_socket, buffer, sizeof(buffer), 0);
-  if(ret <= 0) 
-    unixDie("receiving packet from Memcached server");
-  string response(buffer+sizeof(uh), ret-sizeof(uh));
-  cerr<<"Response: '"<<response<<"'\n";
-}
-
-
-#if 0
-int main(int argc, char** argv)
-{
-  MemcachedCommunicator mc("127.0.0.1");
-  
-  cerr<<"Looking up key '"<<argv[1]<<"': '"<<mc.get(argv[1])<<"'"<<endl;
-
-}
-#endif
diff --git a/pdns/recursor_memcached.hh b/pdns/recursor_memcached.hh
deleted file mode 100644 (file)
index 332f526..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef PDNS_RECURSOR_MEMCACHED_HH
-#define PDNS_RECURSOR_MEMCACHED_HH
-#include <string>
-
-
-class MemcachedCommunicator
-{
-public:
-  MemcachedCommunicator(const std::string& servers);
-  string get(const std::string& key);
-  void set(const std::string& key, const std::string& value);
-  struct UDPHeader 
-  {
-    UDPHeader() 
-    {
-      memset(this, 0, sizeof(*this));
-    }
-    uint16_t id;
-    uint16_t seqNo;
-    uint16_t totalDgrams;
-    uint16_t mbZero;
-  };
-
-private:
-  int d_socket;
-};
-#endif
diff --git a/pdns/spoofpol.cc b/pdns/spoofpol.cc
deleted file mode 100644 (file)
index d2d2ad1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "spoofpol.hh"
-
-void SpoofPolicy::report(const ComboAddress& remote, const std::string& auth, int policy, const struct timeval& tv)
-{
-  SpoofEntry se;
-  se.ttd = tv.tv_sec + 3600;
-  se.policy = policy;
-  d_spoofmap[make_pair(remote,auth)] = se;
-}
-
-int SpoofPolicy::getPolicy(const ComboAddress& remote, const std::string& auth, const struct timeval& tv)
-{
-  spoofmap_t::iterator iter = d_spoofmap.find(make_pair(remote,auth));
-  if(iter == d_spoofmap.end())
-    return 0;
-
-  if(iter->second.ttd > tv.tv_sec) 
-    return iter->second.policy;
-  else 
-    d_spoofmap.erase(iter);
-
-  return 0;
-}
diff --git a/pdns/spoofpol.hh b/pdns/spoofpol.hh
deleted file mode 100644 (file)
index 96f3e3c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef PDNS_SPOOFPOL_HH
-#define PDNS_SPOOFPOL_HH
-#include <string>
-#include <sys/time.h>
-#include <time.h>
-#include "iputils.hh"
-#include <map>
-
-class SpoofPolicy
-{
-public:
-  void report(const ComboAddress& remote, 
-              const std::string& auth, 
-              int policy,
-              const struct timeval& );
-  int getPolicy(const ComboAddress& remote, const std::string& aith, const struct timeval& );
-
-private:
-  struct SpoofEntry
-  {
-    time_t ttd;
-    int policy;
-  };
-  typedef std::map<std::pair<ComboAddress, string>, SpoofEntry > spoofmap_t;
-  spoofmap_t d_spoofmap;
-};
-
-#endif