diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:27 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:44:27 +0000 |
commit | 355b17f151fe8258a025a3db3240339ab7cea445 (patch) | |
tree | 46774e8284ffa297f51196b7954c80d4363ffcaa | |
parent | 6ff7e3bae02a466e10006908565dfb606970ede2 (diff) |
Update documentation and remove unused classes/functions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11938 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | conf/links.conf.example | 57 | ||||
-rw-r--r-- | include/configreader.h | 23 | ||||
-rw-r--r-- | include/dns.h | 2 | ||||
-rw-r--r-- | include/inspircd.h | 24 | ||||
-rw-r--r-- | include/xline.h | 94 | ||||
-rw-r--r-- | src/user_resolver.cpp | 4 | ||||
-rw-r--r-- | src/xline.cpp | 106 |
7 files changed, 133 insertions, 177 deletions
diff --git a/conf/links.conf.example b/conf/links.conf.example index 1b85d6d2b..2357220f9 100644 --- a/conf/links.conf.example +++ b/conf/links.conf.example @@ -2,10 +2,7 @@ # # # Defines which servers can link to this one, and which servers this # # server may create outbound links to. # -# # -# If you would like more detailed options, but a slightly more # -# painful configuration, please see inspircd.conf.example.old # -# # +# # # ____ _ _____ _ _ ____ _ _ _ # # | _ \ ___ __ _ __| | |_ _| |__ (_)___ | __ )(_) |_| | # # | |_) / _ \/ _` |/ _` | | | | '_ \| / __| | _ \| | __| | # @@ -36,33 +33,29 @@ # Can be a CIDR (see example). allowmask="69.58.44.0/24" - # autoconnect: Time to wait to attempt to autoconnect - # to remote server (in seconds). - autoconnect="300" - - # failover: If defined, if this link fails, - # what is the next link that is tried. - failover="hub.other.net" - # timeout: If defined, this option defines how long the server # will wait to consider the connect attempt failed and try the # failover (see above). timeout="300" - # fingerprint: If defined, this option will force servers to be - # authenticated using SSL Fingerprints. For more information, - # see http://wiki.inspircd.org/SSL - #fingerprint="" - - # ssl: If defined, this states extra modules that can be - # used in the connection. Options are: "openssl" and "gnutls" - # for encryption (they are compatible with each other) and - # "ziplinks" for compression. You must use the same (or a - # compatible) transport on both sides of the link. + # ssl: If defined, this states extra modules that will be used when + # making an outbound connection to the server. Options are: "openssl" + # and "gnutls" for encryption (they are compatible with each other) and + # "ziplinks" for compression. You must use the same (or a compatible) + # transport on both sides of the link. + # # You will need to load the m_ssl_openssl.so module for openssl, - # m_ssl_gnutls.so for gnutls or m_ziplinks.so for ziplinks. + # m_ssl_gnutls.so for gnutls or m_ziplinks.so for ziplinks. The server + # port that you connect to must be capable of accepting this type of + # connection. ssl="gnutls" + # fingerprint: If defined, this option will force servers to be + # authenticated using SSL Fingerprints. See http://wiki.inspircd.org/SSL + # for more information. This will require an SSL link for both inbound + # and outbound connections. + #fingerprint="" + # bind: Local IP address to bind to. bind="1.2.3.4" @@ -70,11 +63,11 @@ # /stats c is invoked. statshidden="no" - # hidden: If this is set to yes, this server and it's "child" + # hidden: If this is set to yes, this server and its "child" # servers will not be shown when users do a /map or /links hidden="no" - # passwords: the passwords we send and recieve. + # passwords: the passwords we send and receive. # The remote server will have these passwords reversed. sendpass="outgoing!password" recvpass="incoming!password"> @@ -85,8 +78,6 @@ ipaddr="penguin.box.com" port="7000" allowmask="69.58.44.0/24" - autoconnect="300" - failover="hub.other.net" timeout="300" ssl="gnutls" bind="1.2.3.4" @@ -104,6 +95,18 @@ sendpass="penguins" recvpass="polarbears"> +# Simple autoconnect block. This enables automatic connection of a server +# Recommended setup is to have leaves connect to the hub, and have no +# automatic connections started by the hub. +<autoconnect period="300" server="hub.penguin.org"> + +# Failover autoconnect block. If you have multiple hubs, or want your network +# to automatically link even if the hub is down, you can specify multiple +# servers to autoconnect; they will be tried in a round robin fashion until +# one succeeds. Period defines the time for restarting a single loop. +<autoconnect period="120" + server="hub.us.penguin.org hub.eu.penguin.org leaf.eu.penguin.org"> + #-#-#-#-#-#-#-#-#-#-#-#- ULINES CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-# # This tag defines a ulined server. A U-Lined server has special # diff --git a/include/configreader.h b/include/configreader.h index 402f984e8..3ec4ca826 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -124,6 +124,13 @@ class CoreExport ServerConfig void CrossCheckConnectBlocks(ServerConfig* current); public: + + /** Get a configuration tag + * @param tag The name of the tag to get + * @param offset get the Nth occurance of the tag + */ + ConfigTag* ConfValue(const std::string& tag, int offset = 0); + /** Error stream, contains error output from any failed configuration parsing. */ std::stringstream errstr; @@ -134,10 +141,6 @@ class CoreExport ServerConfig /** 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 }; - /** Not used any more as it is named, can probably be removed or renamed. - */ - int DoDownloads(); - /** This holds all the information in the config file, * it's indexed by tag name to a vector of key/values. */ @@ -565,18 +568,6 @@ class CoreExport ServerConfig */ bool StartsWithWindowsDriveLetter(const std::string &path); - /** Load 'filename' into 'target', with the new config parser everything is parsed into - * tag/key/value at load-time rather than at read-value time. - */ - bool LoadConf(FILE* &conf, const char* filename, bool allowexeinc); - - /** Load 'filename' into 'target', with the new config parser everything is parsed into - * tag/key/value at load-time rather than at read-value time. - */ - bool LoadConf(FILE* &conf, const std::string &filename, bool allowexeinc); - - ConfigTag* ConfValue(const std::string& tag, int offset = 0); - bool ApplyDisabledCommands(const std::string& data); /** Clean a filename, stripping the directories (and drives) from string. diff --git a/include/dns.h b/include/dns.h index eeaad4ef8..e2f151d61 100644 --- a/include/dns.h +++ b/include/dns.h @@ -251,7 +251,7 @@ class CoreExport Resolver * whilst lookups are in progress, they can be safely removed and your module will not * crash the server. */ - Resolver(const std::string &source, QueryType qt, bool &cached, Module* creator = NULL); + Resolver(const std::string &source, QueryType qt, bool &cached, Module* creator); /** * The default destructor does nothing. diff --git a/include/inspircd.h b/include/inspircd.h index f185104ae..b4f73d571 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -179,29 +179,7 @@ template<typename T> inline long ConvToInt(const T &in) { std::stringstream tmp; if (!(tmp << in)) return 0; - return atoi(tmp.str().c_str()); -} - -/** Template function to convert integer to char, storing result in *res and - * also returning the pointer to res. Based on Stuart Lowe's C/C++ Pages. - * @param T input value - * @param V result value - * @param R base to convert to - */ -template<typename T, typename V, typename R> inline char* itoa(const T &in, V *res, R base) -{ - if (base < 2 || base > 16) { *res = 0; return res; } - char* out = res; - int quotient = in; - while (quotient) { - *out = "0123456789abcdef"[ std::abs( quotient % base ) ]; - ++out; - quotient /= base; - } - if ( in < 0 && base == 10) *out++ = '-'; - std::reverse( res, out ); - *out = 0; - return res; + return atol(tmp.str().c_str()); } /** This class contains various STATS counters diff --git a/include/xline.h b/include/xline.h index e349c28d7..4ad1c63be 100644 --- a/include/xline.h +++ b/include/xline.h @@ -406,12 +406,6 @@ class CoreExport XLineFactory */ class ServerConfig; -class GLineFactory; -class ELineFactory; -class QLineFactory; -class ZLineFactory; -class KLineFactory; - /** A map of xline factories */ typedef std::map<std::string, XLineFactory*> XLineFactMap; @@ -447,16 +441,6 @@ class CoreExport XLineManager */ XLineFactMap line_factory; - /** Core xline factories for G/E/K/Q/Z lines - * (These generate GLine, ELine, KLine, QLine and ZLine - * respectively) - */ - GLineFactory* GFact; - ELineFactory* EFact; - KLineFactory* KFact; - QLineFactory* QFact; - ZLineFactory* ZFact; - /** Container of all lines, this is a map of maps which * allows for fast lookup for add/remove of a line, and * the shortest possible timed O(n) for checking a user @@ -577,82 +561,4 @@ class CoreExport XLineManager void InvokeStats(const std::string &type, int numeric, User* user, string_list &results); }; -/** An XLineFactory specialized to generate GLine* pointers - */ -class CoreExport GLineFactory : public XLineFactory -{ - public: - GLineFactory() : XLineFactory("G") { } - - /** Generate a GLine - */ - XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) - { - IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new GLine(set_time, duration, source, reason, ih.first, ih.second); - } -}; - -/** An XLineFactory specialized to generate ELine* pointers - */ -class CoreExport ELineFactory : public XLineFactory -{ - public: - ELineFactory() : XLineFactory("E") { } - - /** Generate an ELine - */ - XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) - { - IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new ELine(set_time, duration, source, reason, ih.first, ih.second); - } -}; - -/** An XLineFactory specialized to generate KLine* pointers - */ -class CoreExport KLineFactory : public XLineFactory -{ - public: - KLineFactory() : XLineFactory("K") { } - - /** Generate a KLine - */ - XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) - { - IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); - return new KLine(set_time, duration, source, reason, ih.first, ih.second); - } -}; - -/** An XLineFactory specialized to generate QLine* pointers - */ -class CoreExport QLineFactory : public XLineFactory -{ - public: - QLineFactory() : XLineFactory("Q") { } - - /** Generate a QLine - */ - XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) - { - return new QLine(set_time, duration, source, reason, xline_specific_mask); - } -}; - -/** An XLineFactory specialized to generate ZLine* pointers - */ -class CoreExport ZLineFactory : public XLineFactory -{ - public: - ZLineFactory() : XLineFactory("Z") { } - - /** Generate a ZLine - */ - XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) - { - return new ZLine(set_time, duration, source, reason, xline_specific_mask); - } -}; - #endif diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index db8d065f1..bcf8a6aa3 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -11,11 +11,9 @@ * --------------------------------------------------- */ -/* $Core */ - #include "inspircd.h" UserResolver::UserResolver(User* user, std::string to_resolve, QueryType qt, bool &cache) : - Resolver(to_resolve, qt, cache), bound_user(user) + Resolver(to_resolve, qt, cache, NULL), bound_user(user) { this->fwd = (qt == DNS_QUERY_A || qt == DNS_QUERY_AAAA); this->bound_fd = user->GetFd(); diff --git a/src/xline.cpp b/src/xline.cpp index 5df0281c9..b101237a3 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -11,12 +11,89 @@ * --------------------------------------------------- */ -/* $Core */ - #include "inspircd.h" #include "xline.h" #include "bancache.h" +/** An XLineFactory specialized to generate GLine* pointers + */ +class GLineFactory : public XLineFactory +{ + public: + GLineFactory() : XLineFactory("G") { } + + /** Generate a GLine + */ + XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) + { + IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); + return new GLine(set_time, duration, source, reason, ih.first, ih.second); + } +}; + +/** An XLineFactory specialized to generate ELine* pointers + */ +class ELineFactory : public XLineFactory +{ + public: + ELineFactory() : XLineFactory("E") { } + + /** Generate an ELine + */ + XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) + { + IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); + return new ELine(set_time, duration, source, reason, ih.first, ih.second); + } +}; + +/** An XLineFactory specialized to generate KLine* pointers + */ +class KLineFactory : public XLineFactory +{ + public: + KLineFactory() : XLineFactory("K") { } + + /** Generate a KLine + */ + XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) + { + IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask); + return new KLine(set_time, duration, source, reason, ih.first, ih.second); + } +}; + +/** An XLineFactory specialized to generate QLine* pointers + */ +class QLineFactory : public XLineFactory +{ + public: + QLineFactory() : XLineFactory("Q") { } + + /** Generate a QLine + */ + XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) + { + return new QLine(set_time, duration, source, reason, xline_specific_mask); + } +}; + +/** An XLineFactory specialized to generate ZLine* pointers + */ +class ZLineFactory : public XLineFactory +{ + public: + ZLineFactory() : XLineFactory("Z") { } + + /** Generate a ZLine + */ + XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) + { + return new ZLine(set_time, duration, source, reason, xline_specific_mask); + } +}; + + /* * This is now version 3 of the XLine subsystem, let's see if we can get it as nice and * efficient as we can this time so we can close this file and never ever touch it again .. @@ -391,6 +468,13 @@ void XLineManager::InvokeStats(const std::string &type, int numeric, User* user, XLineManager::XLineManager() { + GLineFactory* GFact; + ELineFactory* EFact; + KLineFactory* KFact; + QLineFactory* QFact; + ZLineFactory* ZFact; + + GFact = new GLineFactory; EFact = new ELineFactory; KFact = new KLineFactory; @@ -406,17 +490,13 @@ XLineManager::XLineManager() XLineManager::~XLineManager() { - UnregisterFactory(GFact); - UnregisterFactory(EFact); - UnregisterFactory(KFact); - UnregisterFactory(QFact); - UnregisterFactory(ZFact); - - delete GFact; - delete EFact; - delete KFact; - delete QFact; - delete ZFact; + const char gekqz[] = "GEKQZ"; + for(unsigned int i=0; i < sizeof(gekqz); i++) + { + XLineFactory* xlf = GetFactory(std::string(1, gekqz[i])); + UnregisterFactory(xlf); + delete xlf; + } // Delete all existing XLines for (XLineContainer::iterator i = lookup_lines.begin(); i != lookup_lines.end(); i++) |