X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Finspircd.h;h=ef19c6d2677555cba05a2da021d718b71333ffff;hb=e0e1becc2f9129203966e69b2919582c11ab86f7;hp=3909b1328d2863f748fd9c3e80db2f3fa9a30ba4;hpb=86092ec5919a5b08391ea7291b9338b3745b6e0a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/inspircd.h b/include/inspircd.h index 3909b1328..ef19c6d26 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -44,7 +44,9 @@ #include #include "intrusive_list.h" +#include "flat_map.h" #include "compat.h" +#include "aligned_storage.h" #include "typedefs.h" #include "stdalgo.h" @@ -90,6 +92,7 @@ struct fakederef #include "inspstring.h" #include "protocol.h" #include "bancache.h" +#include "isupportmanager.h" /** Template function to convert any input type to std::string */ @@ -241,27 +244,6 @@ class serverstats } }; -/** This class manages the generation and transmission of ISUPPORT. */ -class CoreExport ISupportManager -{ -private: - /** The generated lines which are sent to clients. */ - std::vector Lines; - -public: - /** (Re)build the ISUPPORT vector. */ - void Build(); - - /** Returns the std::vector of ISUPPORT lines. */ - const std::vector& GetLines() - { - return this->Lines; - } - - /** Send the 005 numerics (ISUPPORT) to a user. */ - void SendTo(LocalUser* user); -}; - DEFINE_HANDLER1(IsNickHandler, bool, const std::string&); DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&); @@ -397,7 +379,7 @@ class CoreExport InspIRCd /** User manager. Various methods and data associated with users. */ - UserManager *Users; + UserManager Users; /** Channel list, a hash_map containing all channels XXX move to channel manager class */ @@ -456,15 +438,6 @@ class CoreExport InspIRCd */ int BindPorts(FailedPortList &failed_ports); - /** Binds a socket on an already open file descriptor - * @param sockfd A valid file descriptor of an open socket - * @param port The port number to bind to - * @param addr The address to bind to (IP only) - * @param dolisten Should this port be listened on? - * @return True if the port was bound successfully - */ - bool BindSocket(int sockfd, int port, const char* addr, bool dolisten = true); - /** 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 @@ -662,8 +635,21 @@ class CoreExport InspIRCd void Cleanup(); /** Return a time_t as a human-readable string. + * @param format The format to retrieve the date/time in. See `man 3 strftime` + * for more information. If NULL, "%a %b %d %T %Y" is assumed. + * @param utc True to convert the time to string as-is, false to convert it to local time first. + * @return A string representing the given date/time. + */ + static std::string TimeString(time_t curtime, const char* format = NULL, bool utc = false); + + /** Compare two strings in a timing-safe way. If the lengths of the strings differ, the function + * returns false immediately (leaking information about the length), otherwise it compares each + * character and only returns after all characters have been compared. + * @param one First string + * @param two Second string + * @return True if the strings match, false if they don't */ - static std::string TimeString(time_t curtime); + static bool TimingSafeCompare(const std::string& one, const std::string& two); /** Begin execution of the server. * NOTE: this function NEVER returns. Internally,