X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Finspircd.h;h=48718a668e7dfc15778ed8c5563e698f48d462af;hb=c84ad4cc16452b86bb444a22a55203afa4fa5454;hp=fb6b313a2d4c4b866d22db57f95ac42dd7e585e4;hpb=20bea3078d67a090ebcca64bf3cdbd7e6ab6adb6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/inspircd.h b/include/inspircd.h index fb6b313a2..48718a668 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -25,23 +25,31 @@ #undef ERROR #endif +// Required system headers. #include -#include -#include -#include +#include + #include "inspircd_config.h" #include "uid.h" #include "users.h" -#include "usermanager.h" #include "channels.h" +#include "timer.h" +#include "hashcomp.h" +#include "typedefs.h" +#include "logger.h" +#include "usermanager.h" #include "socket.h" +#include "ctables.h" +#include "command_parse.h" #include "mode.h" #include "socketengine.h" -#include "command_parse.h" #include "snomasks.h" #include "cull_list.h" #include "filelogger.h" #include "caller.h" +#include "modules.h" +#include "configreader.h" +#include "inspstring.h" /** * Used to define the maximum number of parameters a command may have. @@ -224,6 +232,23 @@ DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); class XLineManager; class BanCacheManager; +class CoreExport ConfigReaderThread : public Thread +{ + InspIRCd* ServerInstance; + bool do_bail; + User* TheUser; + public: + ConfigReaderThread(InspIRCd* Instance, bool bail, User* user) : Thread(), ServerInstance(Instance), do_bail(bail), TheUser(user) + { + } + + virtual ~ConfigReaderThread() + { + } + + void Run(); +}; + /** The main class of the irc server. * This class contains instances of all the other classes * in this software, with the exception of the base class, @@ -290,21 +315,12 @@ class CoreExport InspIRCd : public classbase /** Used when connecting clients */ - insp_sockaddr client, server; + irc::sockets::insp_sockaddr client, server; /** Used when connecting clients */ socklen_t length; - /** Nonblocking file writer - */ - FileLogger* Logger; - - /** Time offset in seconds - * This offset is added to all calls to Time(). Use SetTimeDelta() to update - */ - int time_delta; - #ifdef WIN32 IPC* WindowsIPC; #endif @@ -358,11 +374,6 @@ class CoreExport InspIRCd : public classbase */ void BuildISupport(); - /** Number of unregistered users online right now. - * (Unregistered means before USER/NICK/dns) - */ - int unregistered_count; - /** List of server names we've seen. */ servernamelist servernames; @@ -386,6 +397,18 @@ class CoreExport InspIRCd : public classbase /** Socket engine, handles socket activity events */ SocketEngine* SE; + + /** Thread engine, Handles threading where required + */ + ThreadEngine* Threads; + + /** The thread/class used to read config files in REHASH and on startup + */ + ConfigReaderThread* ConfigThread; + + /** LogManager handles logging. + */ + LogManager *Logs; /** ModuleManager contains everything related to loading/unloading * modules. @@ -410,27 +433,6 @@ class CoreExport InspIRCd : public classbase */ SnomaskManager* SNO; - /** Client list, a hash_map containing all clients, local and remote - */ - user_hash* clientlist; - - /** Client list stored by UUID. Contains all clients, and is updated - * automatically by the constructor and destructor of User. - */ - user_hash* uuidlist; - - /** Channel list, a hash_map containing all channels - */ - chan_hash* chanlist; - - /** Local client list, a vector containing only local clients - */ - std::vector local_users; - - /** Oper list, a vector containing all local and remote opered users - */ - std::list all_opers; - /** DNS class, provides resolver facilities to the core and modules */ DNS* Res; @@ -447,6 +449,10 @@ class CoreExport InspIRCd : public classbase */ UserManager *Users; + /** Channel list, a hash_map containing all channels XXX move to channel manager class + */ + chan_hash* chanlist; + /** Set to the current signal recieved */ int s_signal; @@ -454,27 +460,9 @@ class CoreExport InspIRCd : public classbase /** Get the current time * Because this only calls time() once every time around the mainloop, * it is much faster than calling time() directly. - * @param delta True to use the delta as an offset, false otherwise * @return The current time as an epoch value (time_t) */ - time_t Time(bool delta = false); - - /** Set the time offset in seconds - * This offset is added to Time() to offset the system time by the specified - * number of seconds. - * @param delta The number of seconds to offset - * @return The old time delta - */ - int SetTimeDelta(int delta); - - /** Number of users with a certain mode set on them - */ - int ModeCount(const char mode); - - /** Get the time offset in seconds - * @return The current time delta (in seconds) - */ - int GetTimeDelta(); + time_t Time(); /** Process a user whos socket has been flagged as active * @param cu The user to process @@ -496,7 +484,7 @@ class CoreExport InspIRCd : public classbase * @param addr The address to bind to (IP only) * @return True if the port was bound successfully */ - bool BindSocket(int sockfd, int port, char* addr, bool dolisten = true); + bool BindSocket(int sockfd, int port, const char* addr, bool dolisten = true); /** Adds a server name to the list of servers we've seen * @param The servername to add @@ -576,32 +564,6 @@ class CoreExport InspIRCd : public classbase */ bool OpenLog(char** argv, int argc); - /** Close the currently open log file - */ - void CloseLog(); - - /** Send a server notice to all local users - * @param text The text format string to send - * @param ... The format arguments - */ - void ServerNoticeAll(char* text, ...); - - /** Send a server message (PRIVMSG) to all local users - * @param text The text format string to send - * @param ... The format arguments - */ - void ServerPrivmsgAll(char* text, ...); - - /** Send text to all users with a specific set of modes - * @param modes The modes to check against, without a +, e.g. 'og' - * @param flags one of WM_OR or WM_AND. If you specify WM_OR, any one of the - * mode characters in the first parameter causes receipt of the message, and - * if you specify WM_OR, all the modes must be present. - * @param text The text format string to send - * @param ... The format arguments - */ - void WriteMode(const char* modes, int flags, const char* text, ...); - /** Return true if a channel name is valid * @param chname A channel name to verify * @return True if the name is valid @@ -700,7 +662,7 @@ class CoreExport InspIRCd : public classbase * @param pcnt The number of items you have given in the first parameter * @param user The user to send error messages to */ - void SendMode(const char **parameters, int pcnt, User *user); + void SendMode(const char* const* parameters, int pcnt, User *user); /** Match two strings using pattern matching. * This operates identically to the global function match(), @@ -718,7 +680,7 @@ class CoreExport InspIRCd : public classbase * @param user The user to execute the command as * @return True if the command handler was called successfully */ - CmdResult CallCommandHandler(const std::string &commandname, const char** parameters, int pcnt, User* user); + CmdResult CallCommandHandler(const std::string &commandname, const char* const* parameters, int pcnt, User* user); /** Return true if the command is a module-implemented command and the given parameters are valid for it * @param parameters The mode parameters @@ -749,7 +711,7 @@ class CoreExport InspIRCd : public classbase * @param LinePrefix text to prefix each complete line with * @param TextStream the text to send to the user */ - void DumpText(User* User, const std::string &LinePrefix, stringstream &TextStream); + void DumpText(User* User, const std::string &LinePrefix, std::stringstream &TextStream); /** Check if the given nickmask matches too many users, send errors to the given user * @param nick A nickmask to match against