X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Finspircd.h;h=fb6b313a2d4c4b866d22db57f95ac42dd7e585e4;hb=db90a4e900119da63316eeaa184da04f51bb7c6f;hp=afa4db7f4c39023afe947d7ff1d08e89213bde25;hpb=b57c7f4e466f72fdd2ac3deca42caa1ea7748338;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/inspircd.h b/include/inspircd.h index afa4db7f4..fb6b313a2 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -32,6 +32,7 @@ #include "inspircd_config.h" #include "uid.h" #include "users.h" +#include "usermanager.h" #include "channels.h" #include "socket.h" #include "mode.h" @@ -56,14 +57,6 @@ */ #define ETIREDHAMSTERS EAGAIN -/** Delete a pointer, and NULL its value - */ -template inline void DELETE(T* x) -{ - delete x; - x = NULL; -} - /** Template function to convert any input type to std::string */ template inline std::string ConvNumeric(const T &in) @@ -77,7 +70,7 @@ template inline std::string ConvNumeric(const T &in) ++out; quotient /= 10; } - if ( in < 0) + if (in < 0) *out++ = '-'; *out = 0; std::reverse(res,out); @@ -98,13 +91,6 @@ inline std::string ConvToStr(const long in) return ConvNumeric(in); } -/** Template function to convert any input type to std::string - */ -inline std::string ConvToStr(const unsigned long in) -{ - return ConvNumeric(in); -} - /** Template function to convert any input type to std::string */ inline std::string ConvToStr(const char* in) @@ -226,9 +212,6 @@ class serverstats : public classbase /** A list of failed port bindings, used for informational purposes on startup */ typedef std::vector > FailedPortList; -/** A list of ip addresses cross referenced against clone counts */ -typedef std::map clonemap; - class InspIRCd; DEFINE_HANDLER1(ProcessUserHandler, void, User*); @@ -239,6 +222,7 @@ DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); /* Forward declaration - required */ class XLineManager; +class BanCacheManager; /** The main class of the irc server. * This class contains instances of all the other classes @@ -269,7 +253,7 @@ class CoreExport InspIRCd : public classbase */ bool DaemonSeed(); - /** Iterate the list of InspSocket objects, removing ones which have timed out + /** Iterate the list of BufferedSocket objects, removing ones which have timed out * @param TIME the current time */ void DoSocketTimeouts(time_t TIME); @@ -279,9 +263,8 @@ class CoreExport InspIRCd : public classbase void InitialiseUID(); /** Perform background user events such as PING checks - * @param TIME the current time */ - void DoBackgroundUserStuff(time_t TIME); + void DoBackgroundUserStuff(); /** Returns true when all modules have done pre-registration checks on a user * @param user The user to verify @@ -340,10 +323,10 @@ class CoreExport InspIRCd : public classbase FindDescriptorHandler HandleFindDescriptor; FloodQuitUserHandler HandleFloodQuitUser; - /** InspSocket classes pending deletion after being closed. + /** BufferedSocket classes pending deletion after being closed. * We don't delete these immediately as this may cause a segmentation fault. */ - std::map SocketCull; + std::map SocketCull; /** Globally accessible fake user record. This is used to force mode changes etc across s2s, etc.. bit ugly, but.. better than how this was done in 1.1 * Reason for it: @@ -409,6 +392,11 @@ class CoreExport InspIRCd : public classbase */ ModuleManager* Modules; + /** BanCacheManager is used to speed up checking of restrictions on connection + * to the IRCd. + */ + BanCacheManager *BanCache; + /** Stats class, holds miscellaneous stats counters */ serverstats* stats; @@ -443,19 +431,11 @@ class CoreExport InspIRCd : public classbase */ std::list all_opers; - /** Map of local ip addresses for clone counting - */ - clonemap local_clones; - - /** Map of global ip addresses for clone counting - */ - clonemap global_clones; - /** DNS class, provides resolver facilities to the core and modules */ DNS* Res; - /** Timer manager class, triggers InspTimer timer events + /** Timer manager class, triggers Timer timer events */ TimerManager* Timers; @@ -463,9 +443,9 @@ class CoreExport InspIRCd : public classbase */ XLineManager* XLines; - /** The time we next call our ping timeout and reg timeout checks + /** User manager. Various methods and data associated with users. */ - time_t next_call; + UserManager *Users; /** Set to the current signal recieved */ @@ -486,16 +466,6 @@ class CoreExport InspIRCd : public classbase * @return The old time delta */ int SetTimeDelta(int delta); - - /** Add a user to the local clone map - * @param user The user to add - */ - void AddLocalClone(User* user); - - /** Add a user to the global clone map - * @param user The user to add - */ - void AddGlobalClone(User* user); /** Number of users with a certain mode set on them */ @@ -555,17 +525,6 @@ class CoreExport InspIRCd : public classbase */ std::string GetServerDescription(const char* servername); - /** Write text to all opers connected to this server - * @param text The text format string - * @param ... Format args - */ - void WriteOpers(const char* text, ...); - - /** Write text to all opers connected to this server - * @param text The text to send - */ - void WriteOpers(const std::string &text); - /** Find a user in the nick hash. * If the user cant be found in the nick hash check the uuid hash * @param nick The nickname to find @@ -649,6 +608,11 @@ class CoreExport InspIRCd : public classbase */ bool IsChannel(const char *chname); + /** Return true if str looks like a server ID + * @param string to check against + */ + bool IsSID(const std::string &str); + /** Rehash the local server */ void Rehash(); @@ -676,41 +640,11 @@ class CoreExport InspIRCd : public classbase */ static void QuickExit(int status); - /** Return a count of users, unknown and known connections - * @return The number of users - */ - int UserCount(); - - /** Return a count of fully registered connections only - * @return The number of registered users - */ - int RegisteredUserCount(); - - /** Return a count of invisible (umode +i) users only - * @return The number of invisible users - */ - int InvisibleUserCount(); - - /** Return a count of opered (umode +o) users only - * @return The number of opers - */ - int OperCount(); - - /** Return a count of unregistered (before NICK/USER) users only - * @return The number of unregistered (unknown) connections - */ - int UnregisteredUserCount(); - /** Return a count of channels on the network * @return The number of channels */ long ChannelCount(); - /** Return a count of local users on this server only - * @return The number of local users - */ - long LocalUserCount(); - /** Send an error notice to all local users, opered and unopered * @param s The error string to send */ @@ -735,25 +669,6 @@ class CoreExport InspIRCd : public classbase */ caller1 FindDescriptor; - /** Add a new mode to this server's mode parser - * @param mh The modehandler to add - * @param modechar The mode character this modehandler handles - * @return True if the mode handler was added - */ - bool AddMode(ModeHandler* mh, const unsigned char modechar); - - /** Add a new mode watcher to this server's mode parser - * @param mw The modewatcher to add - * @return True if the modewatcher was added - */ - bool AddModeWatcher(ModeWatcher* mw); - - /** Delete a mode watcher from this server's mode parser - * @param mw The modewatcher to delete - * @return True if the modewatcher was deleted - */ - bool DelModeWatcher(ModeWatcher* mw); - /** Add a dns Resolver class to this server's active set * @param r The resolver to add * @param cached If this value is true, then the cache will @@ -813,76 +728,6 @@ class CoreExport InspIRCd : public classbase */ bool IsValidModuleCommand(const std::string &commandname, int pcnt, User* user); - /** Add a gline and apply it - * @param duration How long the line should last - * @param source Who set the line - * @param reason The reason for the line - * @param hostmask The hostmask to set the line against - */ - void AddGLine(long duration, const std::string &source, const std::string &reason, const std::string &hostmask); - - /** Add a qline and apply it - * @param duration How long the line should last - * @param source Who set the line - * @param reason The reason for the line - * @param nickname The nickmask to set the line against - */ - void AddQLine(long duration, const std::string &source, const std::string &reason, const std::string &nickname); - - /** Add a zline and apply it - * @param duration How long the line should last - * @param source Who set the line - * @param reason The reason for the line - * @param ipaddr The ip-mask to set the line against - */ - void AddZLine(long duration, const std::string &source, const std::string &reason, const std::string &ipaddr); - - /** Add a kline and apply it - * @param duration How long the line should last - * @param source Who set the line - * @param reason The reason for the line - * @param hostmask The hostmask to set the line against - */ - void AddKLine(long duration, const std::string &source, const std::string &reason, const std::string &hostmask); - - /** Add an eline - * @param duration How long the line should last - * @param source Who set the line - * @param reason The reason for the line - * @param hostmask The hostmask to set the line against - */ - void AddELine(long duration, const std::string &source, const std::string &reason, const std::string &hostmask); - - /** Delete a gline - * @param hostmask The gline to delete - * @return True if the item was removed - */ - bool DelGLine(const std::string &hostmask); - - /** Delete a qline - * @param nickname The qline to delete - * @return True if the item was removed - */ - bool DelQLine(const std::string &nickname); - - /** Delete a zline - * @param ipaddr The zline to delete - * @return True if the item was removed - */ - bool DelZLine(const std::string &ipaddr); - - /** Delete a kline - * @param hostmask The kline to delete - * @return True if the item was removed - */ - bool DelKLine(const std::string &hostmask); - - /** Delete an eline - * @param hostmask The kline to delete - * @return True if the item was removed - */ - bool DelELine(const std::string &hostmask); - /** Return true if the given parameter is a valid nick!user\@host mask * @param mask A nick!user\@host masak to match against * @return True i the mask is valid @@ -934,15 +779,16 @@ class CoreExport InspIRCd : public classbase */ long Duration(const std::string &str); - /** Attempt to compare an oper password to a string from the config file. + /** Attempt to compare a password to a string from the config file. * This will be passed to handling modules which will compare the data * against possible hashed equivalents in the input string. + * @param ex The object (user, server, whatever) causing the comparison. * @param data The data from the config file * @param input The data input by the oper - * @param tagnum the tag number of the oper's tag in the config file + * @param hashtype The hash from the config file * @return 0 if the strings match, 1 or -1 if they do not */ - int OperPassCompare(const char* data,const char* input, int tagnum); + int PassCompare(Extensible* ex, const char* data,const char* input, const char* hashtype); /** Check if a given server is a uline. * An empty string returns true, this is by design. @@ -1057,10 +903,10 @@ class CoreExport InspIRCd : public classbase */ int Run(); - /** Force all InspSockets to be removed which are due to + /** Force all BufferedSockets to be removed which are due to * be culled. */ - void InspSocketCull(); + void BufferedSocketCull(); char* GetReadBuffer() {