From 7d7250484c352c13830e63ae41ee8faae40a9bd5 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 25 May 2008 17:30:43 +0000 Subject: First phase of conversion to dynamic limits on all the lengths, configured via the tag (the tag isnt there yet, these all just run on defaults in the class constructor) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9802 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/configreader.h | 29 ++++++++++++++++++++++++----- include/hashcomp.h | 3 ++- include/inspircd.h | 8 ++++---- 3 files changed, 30 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/configreader.h b/include/configreader.h index 7fc60203d..56a2ee698 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -226,6 +226,28 @@ struct operclass_data : public Extensible typedef std::map operclass_t; +class ServerLimits : public Extensible +{ + public: + size_t NickMax; + size_t ChanMax; + size_t MaxModes; + size_t IdentMax; + size_t MaxQuit; + size_t MaxTopic; + size_t MaxKick; + size_t MaxGecos; + size_t MaxAway; + + /* Creating the class initialises it to the defaults + * as in 1.1's ./configure script. Reading other values + * from the config will change these values. + */ + ServerLimits() : NickMax(31), ChanMax(64), MaxModes(20), IdentMax(12), MaxQuit(255), MaxTopic(307), MaxKick(255), MaxGecos(128), MaxAway(200) + { + } +}; + /** This class holds the bulk of the runtime configuration for the ircd. * It allows for reading new config values, accessing configuration files, * and storage of the configuration data needed to run the ircd, such as @@ -275,11 +297,6 @@ class CoreExport ServerConfig : public Extensible std::map IncludedFiles; - std::map CompletedFiles; - - size_t TotalDownloaded; - size_t FileErrors; - /** Used to indicate who we announce invites to on a channel */ enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC }; @@ -295,6 +312,8 @@ class CoreExport ServerConfig : public Extensible */ ConfigDataHash config_data; + ServerLimits Limits; + /** Max number of WhoWas entries per user. */ int WhoWasGroupSize; diff --git a/include/hashcomp.h b/include/hashcomp.h index 4eb65823d..928abe809 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -174,6 +174,7 @@ namespace irc class CoreExport modestacker : public classbase { private: + InspIRCd* ServerInstance; /** The mode sequence and its parameters */ std::deque sequence; @@ -187,7 +188,7 @@ namespace irc * @param add True if the stack is adding modes, * false if it is removing them */ - modestacker(bool add); + modestacker(InspIRCd* Instance, bool add); /** Push a modeletter and its parameter onto the stack. * No checking is performed as to if this mode actually * requires a parameter. If you stack invalid mode diff --git a/include/inspircd.h b/include/inspircd.h index e729a0b2a..9d7c8e6e1 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -230,11 +230,11 @@ typedef std::vector > FailedPortList; class InspIRCd; DEFINE_HANDLER1(ProcessUserHandler, void, User*); -DEFINE_HANDLER1(IsNickHandler, bool, const char*); +DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const char*); DEFINE_HANDLER1(FindDescriptorHandler, User*, int); DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); -DEFINE_HANDLER1(IsChannelHandler, bool, const char*); +DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t); DEFINE_HANDLER1(IsSIDHandler, bool, const std::string&); DEFINE_HANDLER1(RehashHandler, void, const std::string&); @@ -585,7 +585,7 @@ class CoreExport InspIRCd : public classbase * @param chname A channel name to verify * @return True if the name is valid */ - caller1 IsChannel; + caller2 IsChannel; /** Return true if str looks like a server ID * @param string to check against @@ -633,7 +633,7 @@ class CoreExport InspIRCd : public classbase * @param n A nickname to verify * @return True if the nick is valid */ - caller1 IsNick; + caller2 IsNick; /** Return true if an ident is valid * @param An ident to verify -- cgit v1.2.3