return "";
}
-bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat, double& lon,
+static bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat, double& lon,
boost::optional<int>& alt, boost::optional<int>& prec)
{
for(auto const& gi: s_geoip_files) {
}
-std::string serializeContent(uint16_t qtype, const DNSName& domain, const std::string& content)
+static std::string serializeContent(uint16_t qtype, const DNSName& domain, const std::string& content)
{
auto drc = DNSRecordContent::mastermake(qtype, 1, content);
return drc->serialize(domain, false);
}
-std::shared_ptr<DNSRecordContent> deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content)
+static std::shared_ptr<DNSRecordContent> deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content)
{
if(qtype == QType::A && content.size() == 4) {
return std::make_shared<ARecordContent>(*((uint32_t*)content.c_str()));
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "auth-caches.hh"
#include "auth-querycache.hh"
#include "auth-packetcache.hh"
/* based on freebsd:src/contrib/opie/libopie/btoe.c extract: get bit ranges from a char* */
/* NOTE: length should not exceed 8; all callers inside PowerDNS only pass length=5 though */
-unsigned char extract_bits(const char *s, int start, int length)
+static unsigned char extract_bits(const char *s, int start, int length)
{
uint16_t x;
unsigned char cl, cc;
int yyparse(void);
int yylex(void);
void yyrestart(FILE *);
- int yywrap()
+ int yywrap(void);
+ int yywrap(void)
{
return 1;
}
extern vector<std::shared_ptr<UDPNameserver> > g_udpReceivers;
extern int avg_latency;
extern std::unique_ptr<TCPNameserver> TN;
-extern ArgvMap & arg( void );
extern void declareArguments();
extern void declareStats();
extern void mainthread();
unsigned int d_receiveds, d_receiveerrors, d_senderrors;
};
-void usage(po::options_description &desc) {
+static void usage(po::options_description &desc) {
cerr << "Usage: dnsbulktest [OPTION].. IPADDRESS PORTNUMBER [LIMIT]"<<endl;
cerr << desc << "\n";
}
StatBag S;
-struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm)
+static struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm)
{
time_t t = *then;
int32_t g_clientQuestions, g_clientResponses, g_serverQuestions, g_serverResponses, g_skipped;
struct pdns_timeval g_lastanswerTime, g_lastquestionTime;
-void makeReport(const struct pdns_timeval& tv)
+
+static void makeReport(const struct pdns_timeval& tv)
{
int64_t clientdiff = g_clientQuestions - g_clientResponses;
int64_t serverdiff = g_serverQuestions - g_serverResponses;
g_skipped=0;
}
-void usage() {
+static void usage() {
cerr<<"syntax: dnsgram INFILE..."<<endl;
}
#include <string>
#include "dnsname.hh"
#include "namespaces.hh"
+#include "dnswriter.hh"
namespace {
void appendSplit(vector<string>& ret, string& segment, char c)
po::variables_map g_vm;
-const struct timeval operator*(float fact, const struct timeval& rhs)
+static const struct timeval operator*(float fact, const struct timeval& rhs)
{
// cout<<"In: "<<rhs.tv_sec<<" + "<<rhs.tv_usec<<"\n";
struct timeval ret;
}
bool g_pleaseQuit;
-void pleaseQuitHandler(int)
+static void pleaseQuitHandler(int)
{
g_pleaseQuit=true;
}
} s_idmanager;
-void setSocketBuffer(int fd, int optname, uint32_t size)
+static void setSocketBuffer(int fd, int optname, uint32_t size)
{
uint32_t psize=0;
socklen_t len=sizeof(psize);
-void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlow, int& origSlow)
+static void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlow, int& origSlow)
{
struct timeval now;
gettimeofday(&now, 0);
}
}
-void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& compacted)
+static void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& compacted)
{
for(MOADNSParser::answers_t::const_iterator i=orig.begin(); i != orig.end(); ++i)
if(i->first.d_place==DNSResourceRecord::ANSWER)
compacted.insert(i->first);
}
-bool isRcodeOk(int rcode)
+static bool isRcodeOk(int rcode)
{
return rcode==0 || rcode==3;
}
set<pair<DNSName,uint16_t> > s_origbetterset;
-bool isRootReferral(const MOADNSParser::answers_t& answers)
+static bool isRootReferral(const MOADNSParser::answers_t& answers)
{
if(answers.empty())
return false;
}
vector<uint32_t> flightTimes;
-void accountFlightTime(qids_t::const_iterator iter)
+static void accountFlightTime(qids_t::const_iterator iter)
{
if(flightTimes.empty())
flightTimes.resize(2050);
flightTimes[mdiff]++;
}
-uint64_t countLessThan(unsigned int msec)
+static uint64_t countLessThan(unsigned int msec)
{
uint64_t ret=0;
for(unsigned int i = 0 ; i < msec && i < flightTimes.size() ; ++i) {
return ret;
}
-void emitFlightTimes()
+static void emitFlightTimes()
{
uint64_t totals = countLessThan(flightTimes.size());
unsigned int limits[]={1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100, 200, 500, 1000, (unsigned int) flightTimes.size()};
}
}
-void measureResultAndClean(qids_t::const_iterator iter)
+static void measureResultAndClean(qids_t::const_iterator iter)
{
const QuestionData& qd=*iter;
accountFlightTime(iter);
std::unique_ptr<Socket> s_socket = nullptr;
-void receiveFromReference()
+static void receiveFromReference()
try
{
string packet;
exit(1);
}
-void pruneQids()
+static void pruneQids()
{
struct timeval now;
gettimeofday(&now, 0);
}
}
-void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0)
+static void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0)
{
format headerfmt ("%|9t|Questions - Pend. - Drop = Answers = (On time + Late) = (Err + Ok)\n");
format datafmt("%s%|9t|%d %|21t|%d %|29t|%d %|36t|%d %|47t|%d %|57t|%d %|66t|%d %|72t|%d\n");
}
-void houseKeeping()
+static void houseKeeping()
{
static timeval last;
return sent;
}
-void usage(po::options_description &desc) {
+static void usage(po::options_description &desc) {
cerr << "Usage: dnsreplay [OPTIONS] FILENAME [IP-ADDRESS] [PORT]"<<endl;
cerr << desc << "\n";
}
#include "namespaces.hh"
StatBag S;
-void usage() {
+static void usage() {
cerr<<"syntax: dnsscan INFILE ..."<<endl;
}
typedef map<QuestionIdentifier, QuestionData> statmap_t;
statmap_t statmap;
-unsigned int liveQuestions()
+static unsigned int liveQuestions()
{
unsigned int ret=0;
for(statmap_t::value_type& val : statmap) {
}
};
-void visitor(const StatNode* node, const StatNode::Stat& selfstat, const StatNode::Stat& childstat)
+static void visitor(const StatNode* node, const StatNode::Stat& selfstat, const StatNode::Stat& childstat)
{
// 20% servfails, >100 children, on average less than 2 copies of a query
// >100 different subqueries
}
}
-const struct timeval operator-(const struct pdns_timeval& lhs, const struct pdns_timeval& rhs)
+static const struct timeval operator-(const struct pdns_timeval& lhs, const struct pdns_timeval& rhs)
{
struct timeval a{lhs.tv_sec, static_cast<suseconds_t>(lhs.tv_usec)}, b{rhs.tv_sec, static_cast<suseconds_t>(rhs.tv_usec)};
return operator-(a,b);
AtomicCounter g_networkErrors, g_otherErrors, g_OK, g_truncates, g_authAnswers, g_timeOuts;
ComboAddress g_dest;
-unsigned int makeUsec(const struct timeval& tv)
+static unsigned int makeUsec(const struct timeval& tv)
{
return 1000000*tv.tv_sec + tv.tv_usec;
}
time_t answerSecond;
};
-void doQuery(BenchQuery* q)
+static void doQuery(BenchQuery* q)
try
{
vector<uint8_t> packet;
return 0;
}
-void usage(po::options_description &desc) {
+static void usage(po::options_description &desc) {
cerr<<"Syntax: dnstcpbench REMOTE [PORT] < QUERIES"<<endl;
cerr<<"Where QUERIES is one query per line, format: qname qtype, just 1 space"<<endl;
cerr<<desc<<endl;
};
-void usage() {
+static void usage() {
cerr<<"Syntax: dnswasher INFILE1 [INFILE2..] OUTFILE"<<endl;
}
string DLCurrentConfigHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLListZones(const vector<string>&parts, Utility::pid_t ppid);
string DLTokenLogin(const vector<string>&parts, Utility::pid_t ppid);
-uint64_t udpErrorStats(const std::string& str);
#include "dnsdist-cache.hh"
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size > std::numeric_limits<uint16_t>::max()) {
reportAllTypes();
}
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static bool initialized = false;
StatBag S;
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size > std::numeric_limits<uint16_t>::max()) {
#include "proxy-protocol.hh"
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::vector<ProxyProtocolValue> values;
reportAllTypes();
}
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static bool initialized = false;
return ret;
};
};
+
+extern string doGetStats();
#include "iputils.hh"
#include "ixfrdist-stats.hh"
-string doGetStats();
-
IXFRDistWebServer::IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl, const string &loglevel) :
d_ws(std::unique_ptr<WebServer>(new WebServer(listenAddress.toString(), listenAddress.getPort())))
{
// FIXME: also report zone size?
}
-void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry, const uint32_t axfrMaxRecords) {
+static void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry, const uint32_t axfrMaxRecords) {
setThreadName("ixfrdist/update");
std::map<DNSName, time_t> lastCheck;
return theArg;
}
-void usage() {
+static void usage() {
cerr<<"Syntax: ixplore diff ZONE BEFORE_FILE AFTER_FILE"<<endl;
cerr<<"Syntax: ixplore track IP-ADDRESS PORT ZONE DIRECTORY [TSIGKEY TSIGALGO TSIGSECRET]"<<endl;
}
}
-std::string getGeo(const std::string& ip, GeoIPInterface::GeoIPQueryAttribute qa)
+static std::string getGeo(const std::string& ip, GeoIPInterface::GeoIPQueryAttribute qa)
{
static bool initialized;
extern std::function<std::string(const std::string& ip, int)> g_getGeo;
static thread_local unique_ptr<lua_record_ctx_t> s_lua_record_ctx;
-void setupLuaRecords()
+static void setupLuaRecords()
{
LuaContext& lua = *s_LUA->getLua();
return arg;
}
-void usage() {
+static void usage() {
cerr<<"Syntax: pdns_notify IP_ADDRESS/HOSTNAME[:PORT] DOMAIN"<<endl;
}
typedef map<uint16_t, NotificationInFlight> nifs_t;
nifs_t g_nifs;
-void syslogFmt(const boost::format& fmt)
+static void syslogFmt(const boost::format& fmt)
{
cerr<<"nproxy: "<<fmt<<endl;
syslog(LOG_WARNING, "%s", str(fmt).c_str());
}
-void handleOutsideUDPPacket(int fd, boost::any&)
+static void handleOutsideUDPPacket(int fd, boost::any&)
try
{
char buffer[1500];
}
-void handleInsideUDPPacket(int fd, boost::any&)
+static void handleInsideUDPPacket(int fd, boost::any&)
try
{
char buffer[1500];
syslogFmt(boost::format("Error parsing packet from internal nameserver: %s") % e.what());
}
-void expireOldNotifications()
+static void expireOldNotifications()
{
time_t limit = time(0) - 10;
for(nifs_t::iterator iter = g_nifs.begin(); iter != g_nifs.end(); ) {
}
}
-void daemonize(int null_fd);
+static void daemonize(int null_fd)
+{
+ if(fork())
+ exit(0); // bye bye
-void usage(po::options_description &desc) {
+ setsid();
+
+ dup2(null_fd,0); /* stdin */
+ dup2(null_fd,1); /* stderr */
+ dup2(null_fd,2); /* stderr */
+}
+
+static void usage(po::options_description &desc) {
cerr<<"nproxy"<<endl;
cerr<<desc<<endl;
}
{
syslogFmt(boost::format("Fatal: %s") % e.reason);
}
-
-void daemonize(int null_fd)
-{
- if(fork())
- exit(0); // bye bye
-
- setsid();
-
- dup2(null_fd,0); /* stdin */
- dup2(null_fd,1); /* stderr */
- dup2(null_fd,2); /* stderr */
-}
typedef std::pair<string,string> nsec3;
typedef set<nsec3> nsec3set;
-string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters)
+static string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters)
{
NSEC3PARAMRecordContent ns3prc;
ns3prc.d_iterations = iters;
return toBase32Hex(hashQNameWithSalt(ns3prc, qname));
}
-void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &salt, unsigned int iters, set<DNSName> &proven, set<DNSName> &denied)
+static void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &salt, unsigned int iters, set<DNSName> &proven, set<DNSName> &denied)
{
string hashed = nsec3Hash(qname, salt, iters);
}
}
-void usage() {
+static void usage() {
cerr<<"nsec3dig"<<endl;
cerr<<"Syntax: nsec3dig IP-ADDRESS PORT QUESTION QUESTION-TYPE [recurse]\n";
}
DNSSECKeeper d_dk; // B is shared with DNSSECKeeper
};
-std::shared_ptr<DNSRecordContent> makeSOAContent(const SOAData& sd);
return t_id;
}
-int getMTaskerTID()
-{
- return MT->getTid();
-}
-
static bool isDistributorThread()
{
if (t_id == 0) {
return func();
}
-vector<ComboAddress>& operator+=(vector<ComboAddress>&a, const vector<ComboAddress>& b)
-{
- a.insert(a.end(), b.begin(), b.end());
- return a;
-}
-
-vector<pair<string, uint16_t> >& operator+=(vector<pair<string, uint16_t> >&a, const vector<pair<string, uint16_t> >& b)
+static vector<ComboAddress>& operator+=(vector<ComboAddress>&a, const vector<ComboAddress>& b)
{
a.insert(a.end(), b.begin(), b.end());
return a;
}
-vector<pair<DNSName, uint16_t> >& operator+=(vector<pair<DNSName, uint16_t> >&a, const vector<pair<DNSName, uint16_t> >& b)
+static vector<pair<DNSName, uint16_t> >& operator+=(vector<pair<DNSName, uint16_t> >&a, const vector<pair<DNSName, uint16_t> >& b)
{
a.insert(a.end(), b.begin(), b.end());
return a;
}
}
-FDMultiplexer* getMultiplexer()
+static FDMultiplexer* getMultiplexer()
{
FDMultiplexer* ret;
for(const auto& i : FDMultiplexer::getMultiplexerMap()) {
}
}
-void parseNODWhitelist(const std::string& wlist)
+static void parseNODWhitelist(const std::string& wlist)
{
vector<string> parts;
stringtok(parts, wlist, ",; ");
return arg;
}
-void loadMainConfig(const std::string& configdir)
+static void loadMainConfig(const std::string& configdir)
{
::arg().set("config-dir","Location of configuration directory (pdns.conf)")=configdir;
::arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600";
UeberBackend::go();
}
-bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true)
+static bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true)
{
string output;
string error;
return ret;
}
-void dbBench(const std::string& fname)
+static void dbBench(const std::string& fname)
{
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
cout<<"Packet cache reports: "<<S.read("query-cache-hit")<<" hits (should be 0) and "<<S.read("query-cache-miss") <<" misses"<<endl;
}
-bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false)
+static bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false)
{
UeberBackend B("default");
vector<DomainInfo> domainInfo;
return result;
}
-int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector<DNSResourceRecord>* suppliedrecords=0)
+static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector<DNSResourceRecord>* suppliedrecords=0)
{
uint64_t numerrors=0, numwarnings=0;
return EXIT_FAILURE;
}
-int checkAllZones(DNSSECKeeper &dk, bool exitOnError)
+static int checkAllZones(DNSSECKeeper &dk, bool exitOnError)
{
UeberBackend B("default");
vector<DomainInfo> domainInfo;
return EXIT_FAILURE;
}
-int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
+static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
{
UeberBackend B("default");
SOAData sd;
return 0;
}
-int deleteZone(const DNSName &zone) {
+static int deleteZone(const DNSName &zone) {
UeberBackend B;
DomainInfo di;
if (! B.getDomainInfo(zone, di)) {
return EXIT_FAILURE;
}
-void listKey(DomainInfo const &di, DNSSECKeeper& dk, bool printHeader = true) {
+static void listKey(DomainInfo const &di, DNSSECKeeper& dk, bool printHeader = true) {
if (printHeader) {
cout<<"Zone Type Size Algorithm ID Location Keytag"<<endl;
cout<<"----------------------------------------------------------------------------------"<<endl;
}
}
-int listKeys(const string &zname, DNSSECKeeper& dk){
+static int listKeys(const string &zname, DNSSECKeeper& dk){
UeberBackend B("default");
if (zname != "all") {
return EXIT_SUCCESS;
}
-int listZone(const DNSName &zone) {
+static int listZone(const DNSName &zone) {
UeberBackend B;
DomainInfo di;
}
// lovingly copied from http://stackoverflow.com/questions/1798511/how-to-avoid-press-enter-with-any-getchar
-int read1char(){
+static int read1char(){
int c;
static struct termios oldt, newt;
return c;
}
-int clearZone(DNSSECKeeper& dk, const DNSName &zone) {
+static int clearZone(DNSSECKeeper& dk, const DNSName &zone) {
UeberBackend B;
DomainInfo di;
return EXIT_SUCCESS;
}
-int editZone(const DNSName &zone) {
+static int editZone(const DNSName &zone) {
UeberBackend B;
DomainInfo di;
DNSSECKeeper dk(&B);
}
-int loadZone(DNSName zone, const string& fname) {
+static int loadZone(DNSName zone, const string& fname) {
UeberBackend B;
DomainInfo di;
return EXIT_SUCCESS;
}
-int createZone(const DNSName &zone, const DNSName& nsname) {
+static int createZone(const DNSName &zone, const DNSName& nsname) {
UeberBackend B;
DomainInfo di;
if (B.getDomainInfo(zone, di)) {
return EXIT_SUCCESS;
}
-int createSlaveZone(const vector<string>& cmds) {
+static int createSlaveZone(const vector<string>& cmds) {
UeberBackend B;
DomainInfo di;
DNSName zone(cmds[1]);
return EXIT_SUCCESS;
}
-int changeSlaveZoneMaster(const vector<string>& cmds) {
+static int changeSlaveZoneMaster(const vector<string>& cmds) {
UeberBackend B;
DomainInfo di;
DNSName zone(cmds[1]);
}
// add-record ZONE name type [ttl] "content" ["content"]
-int addOrReplaceRecord(bool addOrReplace, const vector<string>& cmds) {
+static int addOrReplaceRecord(bool addOrReplace, const vector<string>& cmds) {
DNSResourceRecord rr;
vector<DNSResourceRecord> newrrs;
DNSName zone(cmds[1]);
}
// delete-rrset zone name type
-int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_)
+static int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_)
{
UeberBackend B;
DomainInfo di;
return EXIT_SUCCESS;
}
-int listAllZones(const string &type="") {
+static int listAllZones(const string &type="") {
int kindFilter = -1;
if (type.size()) {
return 0;
}
-bool testAlgorithm(int algo)
+static bool testAlgorithm(int algo)
{
return DNSCryptoKeyEngine::testOne(algo);
}
-bool testAlgorithms()
+static bool testAlgorithms()
{
return DNSCryptoKeyEngine::testAll();
}
-void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cores)
+static void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cores)
{
DNSResourceRecord rr;
rr.qname=DNSName("blah")+zone;
cerr<<"Net speed: "<<csp.d_signed/ (dt.udiff()/1000000.0) << " sigs/s"<<endl;
}
-void verifyCrypto(const string& zone)
+static void verifyCrypto(const string& zone)
{
ZoneParserTNG zpt(zone);
zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
cerr<<"Original DS: "<<apex.toString()<<" IN DS "<<dsrc.getZoneRepresentation()<<endl;
}
}
-bool disableDNSSECOnZone(DNSSECKeeper& dk, const DNSName& zone)
+
+static bool disableDNSSECOnZone(DNSSECKeeper& dk, const DNSName& zone)
{
UeberBackend B("default");
DomainInfo di;
return ret;
}
-int setZoneAccount(const DNSName& zone, const string &account)
+static int setZoneAccount(const DNSName& zone, const string &account)
{
UeberBackend B("default");
DomainInfo di;
return EXIT_SUCCESS;
}
-int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind)
+static int setZoneKind(const DNSName& zone, const DomainInfo::DomainKind kind)
{
UeberBackend B("default");
DomainInfo di;
return EXIT_SUCCESS;
}
-bool showZone(DNSSECKeeper& dk, const DNSName& zone, bool exportDS = false)
+static bool showZone(DNSSECKeeper& dk, const DNSName& zone, bool exportDS = false)
{
UeberBackend B("default");
DomainInfo di;
return true;
}
-bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
+static bool secureZone(DNSSECKeeper& dk, const DNSName& zone)
{
// parse attribute
int k_size;
return true;
}
-void testSchema(DNSSECKeeper& dk, const DNSName& zone)
+static void testSchema(DNSSECKeeper& dk, const DNSName& zone)
{
cout<<"Note: test-schema will try to create the zone, but it will not remove it."<<endl;
cout<<"Please clean up after this."<<endl;
cout<<"End of tests, please remove "<<zone<<" from domains+records"<<endl;
}
-int addOrSetMeta(const DNSName& zone, const string& kind, const vector<string>& values, bool clobber) {
+static int addOrSetMeta(const DNSName& zone, const string& kind, const vector<string>& values, bool clobber) {
UeberBackend B("default");
DomainInfo di;
}
-void HEXDecode(const char* begin, const char* end, string& out)
+static void HEXDecode(const char* begin, const char* end, string& out)
{
if(end - begin == 1 && *begin=='-') {
out.clear();
return ret;
}
-string doGenericTopRemotes(pleaseremotefunc_t func)
+static string doGenericTopRemotes(pleaseremotefunc_t func)
{
typedef map<ComboAddress, int, ComboAddress::addressOnlyLessThan> counts_t;
counts_t counts;
return name;
}
-string doGenericTopQueries(pleasequeryfunc_t func, boost::function<DNSName(const DNSName&)> filter=nopFilter)
+static string doGenericTopQueries(pleasequeryfunc_t func, boost::function<DNSName(const DNSName&)> filter=nopFilter)
{
typedef pair<DNSName,uint16_t> query_t;
typedef map<query_t, int> counts_t;
This file is where it all happens - main is here, as are the two pivotal threads qthread() and athread()
*/
-void daemonize(void)
+static void daemonize(void)
{
if(fork())
exit(0); // bye bye
BOOST_AUTO_TEST_SUITE(nod_cc)
-bool pdns_exception(PDNSException const& ex) { return true; }
+static bool pdns_exception(PDNSException const& ex) { return true; }
BOOST_AUTO_TEST_CASE(test_basic)
{
#endif
#include "rpzloader.hh"
+#include "syncres.hh"
+
#include <boost/test/unit_test.hpp>
// Provide stubs for some symbols
BOOST_AUTO_TEST_SUITE(test_secpoll_cc)
-bool checkBasicMessage1(const PDNSException& ex)
+static bool checkBasicMessage1(const PDNSException& ex)
{
BOOST_CHECK_EQUAL(ex.reason, "Had empty answer on NOERROR RCODE");
return true;
}
-bool checkBasicMessage2(const PDNSException& ex)
+static bool checkBasicMessage2(const PDNSException& ex)
{
BOOST_CHECK_EQUAL(ex.reason, "RCODE was not NOERROR but " + RCode::to_s(1));
return true;
}
-bool checkBasicMessage3(const PDNSException& ex)
+static bool checkBasicMessage3(const PDNSException& ex)
{
BOOST_CHECK_EQUAL(ex.reason, "No TXT record found in response");
return true;
}
-bool checkBasicMessage4(const PDNSException& ex)
+static bool checkBasicMessage4(const PDNSException& ex)
{
BOOST_CHECK(ex.reason.find("Could not parse status number: stoi") == 0);
return true;
}
-bool checkBasicMessage5(const PDNSException& ex)
+static bool checkBasicMessage5(const PDNSException& ex)
{
BOOST_CHECK(ex.reason.find("Could not parse status number: stoi") == 0);
return true;
return theArg;
}
-int getMTaskerTID()
-{
- return 0;
-}
-
void primeRootNSZones(bool)
{
}
extern GlobalStateHolder<LuaConfigItems> g_luaconfs;
-ArgvMap& arg();
-int getMTaskerTID();
-
-void primeHints(void);
-
void initSR(bool debug = false);
void initSR(std::unique_ptr<SyncRes>& sr, bool dnssec = false, bool debug = false, time_t fakeNow = 0);
BOOST_AUTO_TEST_SUITE(syncres_cc2)
-void do_test_referral_depth(bool limited)
+static void do_test_referral_depth(bool limited)
{
std::unique_ptr<SyncRes> sr;
initSR(sr);
#include <iostream>
#include <dnsrecords.hh>
-bool init_unit_test()
+static bool init_unit_test()
{
reportAllTypes();
return true;
}
-void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, const char* sepa, bool verbose=true)
+static void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, const char* sepa, bool verbose=true)
{
vector<string> servers;
stringtok(servers, input, sepa);
g_log<<endl;
}
-void* pleaseWipeNegCache()
-{
- SyncRes::clearNegCache();
- return 0;
-}
-
-void* pleaseUseNewSDomainsMap(std::shared_ptr<SyncRes::domainmap_t> newmap)
+static void* pleaseUseNewSDomainsMap(std::shared_ptr<SyncRes::domainmap_t> newmap)
{
SyncRes::setDomainMap(newmap);
return 0;
<< endl;
}
-const string nameForClass(uint16_t qclass, uint16_t qtype)
+static const string nameForClass(uint16_t qclass, uint16_t qtype)
{
if (qtype == QType::OPT)
return "IN";
}
}
-void fillPacket(vector<uint8_t>& packet, const string& q, const string& t,
+static void fillPacket(vector<uint8_t>& packet, const string& q, const string& t,
bool dnssec, const boost::optional<Netmask> ednsnm,
bool recurse, uint16_t xpfcode, uint16_t xpfversion,
uint64_t xpfproto, char* xpfsrc, char* xpfdst,
}
}
-void printReply(const string& reply, bool showflags, bool hidesoadetails)
+static void printReply(const string& reply, bool showflags, bool hidesoadetails)
{
MOADNSParser mdp(false, reply);
cout << "Reply to question for qname='" << mdp.d_qname.toString()
#include "dnsrecords.hh"
#include "pdnsexception.hh"
#include "misc.hh"
+#include "secpoll.hh"
bool isReleaseVersion(const std::string &version) {
return std::count(version.begin(), version.end(), '.') == 2;
}
-void setSecPollToUnknownOnOK(int &secPollStatus) {
+static void setSecPollToUnknownOnOK(int &secPollStatus) {
if(secPollStatus == 1) // it was ok, now it is unknown
secPollStatus = 0;
}
*
* copied from sqlite 3.3.6 // cmouse
*/
-int pdns_sqlite3_clear_bindings(sqlite3_stmt *pStmt){
+#if SQLITE_VERSION_NUMBER < 3003009
+static int pdns_sqlite3_clear_bindings(sqlite3_stmt *pStmt){
int i;
int rc = SQLITE_OK;
for(i=1; rc==SQLITE_OK && i<=sqlite3_bind_parameter_count(pStmt); i++){
}
return rc;
}
+#endif
static string SSQLite3ErrorString(sqlite3 *db)
{
return theArg;
}
-void usage() {
+static void usage() {
cerr<<"stubquery"<<endl;
cerr<<"Syntax: stubquery QUESTION [QUESTION-TYPE]"<<endl;
}
}
}
-void connectWithTimeout(int fd, struct sockaddr* remote, size_t socklen)
-{
- int err;
- Utility::socklen_t len=sizeof(err);
-
- if((err=connect(fd, remote, socklen))<0 && errno!=EINPROGRESS)
- throw NetworkError("connect: "+stringerror());
-
- if(!err)
- goto done;
-
- err=waitForRWData(fd, false, 5, 0);
- if(err == 0)
- throw NetworkError("Timeout connecting to remote");
- if(err < 0)
- throw NetworkError("Error connecting to remote");
-
- if(getsockopt(fd, SOL_SOCKET,SO_ERROR,(char *)&err,&len)<0)
- throw NetworkError("Error connecting to remote: "+stringerror()); // Solaris
-
- if(err)
- throw NetworkError("Error connecting to remote: "+string(strerror(err)));
-
- done:
- ;
-}
-
void TCPNameserver::sendPacket(std::unique_ptr<DNSPacket>& p, int outsock)
{
g_rs.submitResponse(*p, false);
}
}
-bool test_dnsrecords_cc_predicate( std::exception const &ex ) { return true; }
+static bool test_dnsrecords_cc_predicate( std::exception const &ex ) { return true; }
// these *MUST NOT* parse properly!
BOOST_AUTO_TEST_CASE(test_record_types_bad_values) {
}
-bool init_unit_test() {
+static bool init_unit_test() {
reportAllTypes();
return true;
}
#include "dns_random.hh"
#include "misc.hh"
#include "pdnsexception.hh"
+#include "tsigutils.hh"
#include <string>
/*
backends=BackendMakers().all(pname=="key-only");
}
-void del(DNSBackend* d)
+static void del(DNSBackend* d)
{
delete d;
}
return result;
}
-void printtable(ostringstream &ret, const string &ringname, const string &title, int limit=10)
+static void printtable(ostringstream &ret, const string &ringname, const string &title, int limit=10)
{
int tot=0;
int entries=0;
resp->setBody(doc);
}
-void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) {
+static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) {
if(req->method != "PUT")
throw HttpMethodNotAllowedException();
map<DNSName,bool> g_recorddata;
map<DNSName, map<string, bool> > g_recordttl;
-std::string encode_non_ascii( const std::string &input ) {
+static std::string encode_non_ascii( const std::string &input ) {
std::ostringstream out;
for ( auto i : input ) {
return true;
}
-void chopComment(string& line)
+static void chopComment(string& line)
{
if(line.find(';')==string::npos)
return;
line.resize(pos);
}
-bool findAndElide(string& line, char c)
+static bool findAndElide(string& line, char c)
{
string::size_type pos, len = line.length();
bool inQuote=false;