From 9cf56d917d92959701694477f7944d45ad2c38ed Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 19 May 2007 15:56:42 +0000 Subject: Windows support. Tested and working to compile on freebsd and linux. Next step is to make sure it actually works in windows too. ;p. Add Burlex to contributors. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7043 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/dns.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/dns.cpp') diff --git a/src/dns.cpp b/src/dns.cpp index c04ab4cc1..df79eba24 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -21,11 +21,16 @@ Please do not assume that firedns works like this, looks like this, walks like this or tastes like this. */ +#ifndef WIN32 #include #include #include #include #include +#else +#include "inspircd_win32wrapper.h" +#endif + #include "dns.h" #include "inspircd.h" #include "socketengine.h" @@ -238,7 +243,7 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp memcpy(&addr.sin_addr.s_addr, &dnsobj->myserver4, sizeof(addr.sin_addr)); addr.sin_family = AF_INET; addr.sin_port = htons(DNS::QUERY_PORT); - if (sendto(dnsobj->GetFd(), payload, length + 12, 0, (sockaddr *) &addr, sizeof(addr)) != length+12) + if (sendto(dnsobj->GetFd(), (const char*)payload, length + 12, 0, (sockaddr *) &addr, sizeof(addr)) != length+12) return -1; #endif @@ -619,7 +624,7 @@ DNSResult DNS::GetResult() const char* ipaddr_from; unsigned short int port_from = 0; - int length = recvfrom(this->GetFd(),buffer,sizeof(DNSHeader),0,from,&x); + int length = recvfrom(this->GetFd(),(char*)buffer,sizeof(DNSHeader),0,from,&x); /* Did we get the whole header? */ if (length < 12) @@ -1146,6 +1151,7 @@ void DNS::CleanResolvers(Module* module) /** Generate pseudo-random number */ unsigned long DNS::PRNG() { +#ifndef WIN32 unsigned long val = 0; timeval n; serverstats* s = ServerInstance->stats; @@ -1154,5 +1160,13 @@ unsigned long DNS::PRNG() val = val + s->statsCollisions ^ s->statsDnsGood - s->statsDnsBad; val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv) - ServerInstance->Config->ports.size(); return val; +#else + unsigned long val = 0; + serverstats* s = ServerInstance->stats; + val = (time(NULL) ^ GetCurrentProcessId() ^ GetCurrentThreadId() ^ (this->currid++)) ^ s->statsAccept + time(NULL); + val = val + s->statsCollisions ^ s->statsDnsGood - s->statsDnsBad; + val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv); + return val; +#endif } -- cgit v1.2.3