* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
- *
- * Written by Craig Edwards, Craig McLure, and others.
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
looks like this, walks like this or tastes like this.
*/
-using namespace std;
-
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include "configreader.h"
#include "socket.h"
-using namespace std;
using irc::sockets::insp_sockaddr;
using irc::sockets::insp_inaddr;
using irc::sockets::insp_ntoa;
int curanswer, o;
ResourceRecord rr;
unsigned short ptr;
-
+
+ /* This is just to keep _FORTIFY_SOURCE happy */
+ rr.type = DNS_QUERY_NONE;
+ rr.rdlength = 0;
+
if (!(header.flags1 & FLAGS_MASK_QR))
return std::make_pair((unsigned char*)NULL,"Not a query result");
}
/** High level abstraction of dns used by application at large */
-Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt) : ServerInstance(Instance), input(source), querytype(qt)
+Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt)
{
ServerInstance->Log(DEBUG,"Instance: %08x %08x",Instance, ServerInstance);
return this->myid;
}
+Module* Resolver::GetCreator()
+{
+ return this->Creator;
+}
+
/** Process a socket read event */
void DNS::HandleEvent(EventType et, int errornum)
{
}
}
+void DNS::CleanResolvers(Module* module)
+{
+ for (int i = 0; i < MAX_REQUEST_ID; i++)
+ {
+ if (Classes[i])
+ {
+ if (Classes[i]->GetCreator() == module)
+ {
+ Classes[i]->OnError(RESLOVER_FORCEUNLOAD, "Parent module is unloading");
+ delete Classes[i];
+ Classes[i] = NULL;
+ }
+ }
+ }
+}
+
/** Generate pseudo-random number */
unsigned long DNS::PRNG()
{