#include <sstream>
#include <vector>
#include <deque>
-#include <sched.h>
#ifdef THREADED_DNS
#include <pthread.h>
#endif
#include "socketengine.h"
#include "userprocess.h"
#include "socket.h"
-#include "dns.h"
#include "typedefs.h"
#include "command_parse.h"
int openSockfd[MAXSOCKS];
sockaddr_in client,server;
socklen_t length;
-extern Module* IOHookModule;
extern InspSocket* socket_ref[65535];
// by an integer, meaning there is no need for a scan/search operation.
userrec* fd_ref_table[65536];
-serverstats* stats = new serverstats;
Server* MyServer = new Server;
ServerConfig *Config = new ServerConfig;
user_hash clientlist;
chan_hash chanlist;
whowas_hash whowas;
-command_table cmdlist;
servernamelist servernames;
char lowermap[255];
return single;
}
-
+void InspIRCd::MakeLowerMap()
+{
+ // initialize the lowercase mapping table
+ for (unsigned int cn = 0; cn < 256; cn++)
+ lowermap[cn] = cn;
+ // lowercase the uppercase chars
+ for (unsigned int cn = 65; cn < 91; cn++)
+ lowermap[cn] = tolower(cn);
+ // now replace the specific chars for scandanavian comparison
+ lowermap[(unsigned)'['] = '{';
+ lowermap[(unsigned)']'] = '}';
+ lowermap[(unsigned)'\\'] = '|';
+}
InspIRCd::InspIRCd(int argc, char** argv)
{
}
strlcpy(Config->MyExecutable,argv[0],MAXBUF);
-
- // initialize the lowercase mapping table
- for (unsigned int cn = 0; cn < 256; cn++)
- lowermap[cn] = cn;
- // lowercase the uppercase chars
- for (unsigned int cn = 65; cn < 91; cn++)
- lowermap[cn] = tolower(cn);
- // now replace the specific chars for scandanavian comparison
- lowermap[(unsigned)'['] = '{';
- lowermap[(unsigned)']'] = '}';
- lowermap[(unsigned)'\\'] = '|';
+ this->MakeLowerMap();
OpenLog(argv, argc);
Config->ClearStack();
Config->Read(true,NULL);
CheckRoot();
- SetupCommandTable();
+ this->ModeGrok = new ModeParser();
+ this->Parser = new CommandParser();
+ this->stats = new serverstats();
AddServerName(Config->ServerName);
CheckDie();
stats->BoundPortCount = BindPorts();
SE = new SocketEngine();
/* We must load the modules AFTER initializing the socket engine, now */
- LoadAllModules();
-
- printf("\nInspIRCd is now running!\n");
return;
}
log(DEBUG,"Erasing module entry...");
erase_factory(j);
log(DEBUG,"Removing dependent commands...");
- remove_commands(filename);
+ Parser->RemoveCommands(filename);
log(DEFAULT,"Module %s unloaded",filename);
MODCOUNT--;
return true;
char* target;
unsigned int numberactive;
sockaddr_in sock_us; // our port number
- socklen_t uslen; // length of our port number
+ socklen_t uslen; // length of our port number
+ /* Until THIS point, ServerInstance == NULL */
+
+ LoadAllModules(this);
+
+ printf("\nInspIRCd is now running!\n");
+
if (!Config->nofork)
{
freopen("/dev/null","w",stdout);
*/
if (incomingSockfd >= 0)
{
- if (IOHookModule)
+ if (Config->GetIOHook(in_port))
{
- IOHookModule->OnRawSocketAccept(incomingSockfd, target, in_port);
+ Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, target, in_port);
}
stats->statsAccept++;
AddClient(incomingSockfd, target, in_port, false, target);