|
|||
|
|||
|
#include <modules.h>
Inheritance diagram for ModuleManager:


Public Member Functions | |
| ModuleManager (InspIRCd *Ins) | |
| Simple, bog-standard, boring constructor. | |
| ~ModuleManager () | |
| Destructor. | |
| bool | SetPriority (Module *mod, Implementation i, PriorityState s, Module **modules=NULL, size_t sz=1) |
| Change the priority of one event in a module. | |
| bool | SetPriority (Module *mod, PriorityState s) |
| Change the priority of all events in a module. | |
| bool | Attach (Implementation i, Module *mod) |
| Attach an event to a module. | |
| bool | Detach (Implementation i, Module *mod) |
| Detatch an event from a module. | |
| void | Attach (Implementation *i, Module *mod, size_t sz) |
| Attach an array of events to a module. | |
| void | DetachAll (Module *mod) |
| Detach all events from a module (used on unload). | |
| std::string & | LastError () |
| Returns text describing the last module error. | |
| bool | Load (const char *filename) |
| Load a given module file. | |
| bool | Unload (const char *filename) |
| Unload a given module file. | |
| void | LoadAll () |
| Called by the InspIRCd constructor to load all modules from the config file. | |
| int | GetCount () |
| Get the total number of currently loaded modules. | |
| Module * | Find (const std::string &name) |
| Find a module by name, and return a Module* to it. | |
| bool | PublishFeature (const std::string &FeatureName, Module *Mod) |
| Publish a 'feature'. | |
| bool | PublishInterface (const std::string &InterfaceName, Module *Mod) |
| Publish a module to an 'interface'. | |
| std::pair< int, std::string > | GetInterfaceInstanceCount (Module *m) |
| Return a pair saying how many other modules are currently using the interfaces provided by module m. | |
| void | UseInterface (const std::string &InterfaceName) |
| Mark your module as using an interface. | |
| void | DoneWithInterface (const std::string &InterfaceName) |
| Mark your module as finished with an interface. | |
| bool | UnpublishFeature (const std::string &FeatureName) |
| Unpublish a 'feature'. | |
| bool | UnpublishInterface (const std::string &InterfaceName, Module *Mod) |
| Unpublish your module from an interface When your module exits, it must call this method for every interface it is part of so that the interfaces table is cleaned up. | |
| Module * | FindFeature (const std::string &FeatureName) |
| Find a 'feature'. | |
| modulelist * | FindInterface (const std::string &InterfaceName) |
| Find an 'interface'. | |
| bool | ModuleHasInterface (Module *mod, const std::string &InterfaceName) |
| Determine if a module has published the named interface. | |
| const std::string & | GetModuleName (Module *m) |
| Given a pointer to a Module, return its filename. | |
| const std::vector< std::string > | GetAllModuleNames (int filter) |
| Return a list of all modules matching the given filter. | |
Public Attributes | |
| IntModuleList | EventHandlers [I_END] |
| Event handler hooks. | |
Private Attributes | |
| std::string | LastModuleError |
| Holds a string describing the last module error to occur. | |
| featurelist | Features |
| The feature names published by various modules. | |
| interfacelist | Interfaces |
| The interface names published by various modules. | |
| int | ModCount |
| Total number of modules loaded into the ircd. | |
| InspIRCd * | Instance |
| Our pointer to the main insp instance. | |
| std::map< std::string, std::pair< ircd_module *, Module * > > | Modules |
| List of loaded modules and shared object/dll handles keyed by module name. | |
Definition at line 1632 of file modules.h.
|
|
Simple, bog-standard, boring constructor.
Definition at line 201 of file modules.cpp. |
|
|
Destructor.
Definition at line 205 of file modules.cpp. |
|
||||||||||||||||
|
Attach an array of events to a module.
Definition at line 229 of file modules.cpp. References Attach(). |
|
||||||||||||
|
||||||||||||
|
Detatch an event from a module. This is not required when your module unloads, as the core will automatically detatch your module from all events it is attached to.
Definition at line 218 of file modules.cpp. References EventHandlers. Referenced by DetachAll(). |
|
|
Detach all events from a module (used on unload).
Definition at line 235 of file modules.cpp. |
|
|
Mark your module as finished with an interface. If you used UseInterface() above, you should use this method when your module is finished with the interface (usually in its destructor) to allow the modules which implement the given interface to be unloaded.
Definition at line 681 of file modules.cpp. References Interfaces. Referenced by ModuleMsSQL::ModuleMsSQL(), ModuleSQL::ModuleSQL(), ModuleSQLite3::ModuleSQLite3(), FilterBase::~FilterBase(), ModuleCloaking::~ModuleCloaking(), ModuleMsSQL::~ModuleMsSQL(), ModuleOperHash::~ModuleOperHash(), ModulePgSQL::~ModulePgSQL(), ModuleRLine::~ModuleRLine(), ModuleSpanningTree::~ModuleSpanningTree(), ModuleSQL::~ModuleSQL(), ModuleSQLAuth::~ModuleSQLAuth(), ModuleSQLite3::~ModuleSQLite3(), ModuleSQLLog::~ModuleSQLLog(), and ModuleSQLOper::~ModuleSQLOper(). |
|
|
|
Find a 'feature'. There are two ways for a module to find another module it depends on. Either by name, using InspIRCd::FindModule, or by feature, using the InspIRCd::PublishFeature method. A feature is an arbitary string which identifies something this module can do. For example, if your module provides SSL support, but other modules provide SSL support too, all the modules supporting SSL should publish an identical 'SSL' feature. To find a module capable of providing the feature you want, simply call this method with the feature name you are looking for.
Definition at line 604 of file modules.cpp. References Features. Referenced by ModuleSQLOper::LookupOper(), ModuleSQLAuth::ModuleSQLAuth(), ModuleSQLLog::ModuleSQLLog(), and ModuleTestClient::OnBackgroundTimer(). |
|
|
Find an 'interface'. An interface is a list of modules which all implement the same API.
Definition at line 651 of file modules.cpp. References Interfaces. Referenced by ModuleOperHash::ModuleOperHash(), ModuleSQLOper::ModuleSQLOper(), ModuleRLine::OnRehash(), FilterBase::OnRehash(), and SpanningTreeUtilities::SpanningTreeUtilities(). |
|
|
Return a list of all modules matching the given filter.
Definition at line 801 of file modules.cpp. References Modules. Referenced by InspIRCd::Cleanup(), InitModule(), TreeSocket::Modules(), TreeSocket::MyCapabilities(), and ModuleHttpStats::OnEvent(). |
|
|
Get the total number of currently loaded modules.
|
|
|
Return a pair saying how many other modules are currently using the interfaces provided by module m.
Definition at line 688 of file modules.cpp. References Interfaces. Referenced by Unload(). |
|
|
Given a pointer to a Module, return its filename.
Definition at line 703 of file modules.cpp. References Modules. |
|
|
Returns text describing the last module error.
Definition at line 358 of file modules.cpp. References LastModuleError. Referenced by CommandGreloadmodule::Handle(), CommandGunloadmodule::Handle(), CommandGloadmodule::Handle(), and ServerConfig::Read(). |
|
|
Load a given module file.
Definition at line 363 of file modules.cpp. References Version::API, API_VERSION, InspIRCd::BuildISupport(), DLLFactory< ReturnType >::CallInit(), InspIRCd::Config, ConvToStr(), DEFAULT, DetachAll(), ServerConfig::DirValid(), ServerConfig::FileExists(), Version::Flags, FOREACH_MOD_I, CoreException::GetReason(), Module::GetVersion(), I_OnLoadModule, Instance, LastModuleError, LogManager::Log(), InspIRCd::Logs, InspIRCd::Match(), MAXBUF, ModCount, ServerConfig::ModPath, Modules, Version::version, and VF_VENDOR. Referenced by CommandGreloadmodule::Handle(), CommandGloadmodule::Handle(), ServerConfig::Read(), and TestSuite::TestSuite(). |
|
|
Called by the InspIRCd constructor to load all modules from the config file.
Definition at line 564 of file modules.cpp. References InspIRCd::Config, ServerConfig::config_data, ServerConfig::ConfValue(), ServerConfig::ConfValueEnum(), DEFAULT, InspIRCd::Exit(), EXIT_STATUS_MODULE, Instance, LogManager::Log(), InspIRCd::Logs, MAXBUF, ModCount, and printf_c. Referenced by InspIRCd::InspIRCd(). |
|
||||||||||||
|
Determine if a module has published the named interface. This could be used in, for example, OnLoadModule to pick up other modules that can be used.
Definition at line 660 of file modules.cpp. References Interfaces. Referenced by ModuleSQLOper::OnLoadModule(), ModuleRLine::OnLoadModule(), ModuleOperHash::OnLoadModule(), and FilterBase::OnLoadModule(). |
|
||||||||||||
|
Publish a 'feature'. There are two ways for a module to find another module it depends on. Either by name, using InspIRCd::FindModule, or by feature, using this function. A feature is an arbitary string which identifies something this module can do. For example, if your module provides SSL support, but other modules provide SSL support too, all the modules supporting SSL should publish an identical 'SSL' feature. This way, any module requiring use of SSL functions can just look up the 'SSL' feature using FindFeature, then use the module pointer they are given.
Definition at line 583 of file modules.cpp. References Features. Referenced by ModuleMsSQL::ModuleMsSQL(), ModulePgSQL::ModulePgSQL(), ModuleSQL::ModuleSQL(), and ModuleSQLite3::ModuleSQLite3(). |
|
||||||||||||
|
Publish a module to an 'interface'. Modules which implement the same interface (the same way of communicating with other modules) can publish themselves to an interface, using this method. When they do so, they become part of a list of related or compatible modules, and a third module may then query for that list and know that all modules within that list offer the same API. A prime example of this is the hashing modules, which all accept the same types of Request class. Consider this to be similar to PublishFeature, except for that multiple modules may publish the same 'feature'.
Definition at line 614 of file modules.cpp. References Interfaces. Referenced by ModuleBanException::ModuleBanException(), ModuleChanFilter::ModuleChanFilter(), ModuleInviteException::ModuleInviteException(), ModuleMD5::ModuleMD5(), ModuleMsSQL::ModuleMsSQL(), ModulePgSQL::ModulePgSQL(), ModuleRegexGlob::ModuleRegexGlob(), ModuleRegexPCRE::ModuleRegexPCRE(), ModuleRegexPOSIX::ModuleRegexPOSIX(), ModuleRegexTRE::ModuleRegexTRE(), ModuleRIPEMD160::ModuleRIPEMD160(), ModuleRpcJson::ModuleRpcJson(), ModuleSHA256::ModuleSHA256(), ModuleSQL::ModuleSQL(), ModuleSQLite3::ModuleSQLite3(), ModuleSQLutils::ModuleSQLutils(), ModuleSSLGnuTLS::ModuleSSLGnuTLS(), ModuleSSLOpenSSL::ModuleSSLOpenSSL(), and ModuleZLib::ModuleZLib(). |
|
||||||||||||
|
Change the priority of all events in a module.
Definition at line 241 of file modules.cpp. References I_BEGIN, I_END, and SetPriority(). |
|
||||||||||||||||||||||||
|
Change the priority of one event in a module. Each module event has a list of modules which are attached to that event type. If you wish to be called before or after other specific modules, you may use this method (usually within void Module::Prioritize()) to set your events priority. You may use this call in other methods too, however, this is not supported behaviour for a module.
Definition at line 249 of file modules.cpp. References EventHandlers, PRIO_AFTER, PRIO_BEFORE, PRIO_DONTCARE, PRIO_FIRST, and PRIO_LAST. Referenced by ModuleAbbreviation::ModuleAbbreviation(), ModuleModesOnConnect::ModuleModesOnConnect(), ModuleSpanningTree::Prioritize(), ModuleSSLOpenSSL::Prioritize(), ModuleSSLGnuTLS::Prioritize(), ModuleSpy::Prioritize(), ModuleSecureList::Prioritize(), ModuleHostChange::Prioritize(), ModuleConnJoin::Prioritize(), ModuleCloaking::Prioritize(), ModuleCgiIRC::Prioritize(), ModuleBanRedirect::Prioritize(), and SetPriority(). |
|
|
Unload a given module file.
Definition at line 507 of file modules.cpp. References InspIRCd::BuildISupport(), InspIRCd::chanlist, DNS::CleanResolvers(), UserManager::clientlist, ConvToStr(), DEFAULT, DetachAll(), FOREACH_MOD_I, GetInterfaceInstanceCount(), I_OnUnloadModule, Instance, LastModuleError, LogManager::Log(), InspIRCd::Logs, ModCount, Modules, InspIRCd::Parser, CommandParser::RemoveCommands(), InspIRCd::Res, TYPE_CHANNEL, TYPE_USER, InspIRCd::Users, and VF_STATIC. Referenced by InspIRCd::Cleanup(), CommandGreloadmodule::Handle(), CommandGunloadmodule::Handle(), ServerConfig::Read(), and TestSuite::TestSuite(). |
|
|
Unpublish a 'feature'. When your module exits, it must call this method for every feature it is providing so that the feature table is cleaned up.
Definition at line 593 of file modules.cpp. References Features. Referenced by ModuleMsSQL::~ModuleMsSQL(), ModulePgSQL::~ModulePgSQL(), ModuleSQL::~ModuleSQL(), and ModuleSQLite3::~ModuleSQLite3(). |
|
||||||||||||
|
Unpublish your module from an interface When your module exits, it must call this method for every interface it is part of so that the interfaces table is cleaned up. Only when the last item is deleted from an interface does the interface get removed.
Definition at line 631 of file modules.cpp. References Interfaces. Referenced by ModuleBanException::~ModuleBanException(), ModuleChanFilter::~ModuleChanFilter(), ModuleInviteException::~ModuleInviteException(), ModuleMD5::~ModuleMD5(), ModuleMsSQL::~ModuleMsSQL(), ModulePgSQL::~ModulePgSQL(), ModuleRegexGlob::~ModuleRegexGlob(), ModuleRegexPCRE::~ModuleRegexPCRE(), ModuleRegexPOSIX::~ModuleRegexPOSIX(), ModuleRegexTRE::~ModuleRegexTRE(), ModuleRIPEMD160::~ModuleRIPEMD160(), ModuleRpcJson::~ModuleRpcJson(), ModuleSHA256::~ModuleSHA256(), ModuleSQL::~ModuleSQL(), ModuleSQLite3::~ModuleSQLite3(), ModuleSQLutils::~ModuleSQLutils(), ModuleSSLGnuTLS::~ModuleSSLGnuTLS(), ModuleSSLOpenSSL::~ModuleSSLOpenSSL(), and ModuleZLib::~ModuleZLib(). |
|
|
Mark your module as using an interface. If you mark your module as using an interface, then that interface module may not unload until your module has unloaded first. This can be used to prevent crashes by ensuring code you depend on is always in memory while your module is active.
Definition at line 673 of file modules.cpp. References Interfaces. Referenced by FilterBase::FilterBase(), ModuleCloaking::ModuleCloaking(), ModuleMsSQL::ModuleMsSQL(), ModuleOperHash::ModuleOperHash(), ModulePgSQL::ModulePgSQL(), ModuleRLine::ModuleRLine(), ModuleSpanningTree::ModuleSpanningTree(), ModuleSQL::ModuleSQL(), ModuleSQLAuth::ModuleSQLAuth(), ModuleSQLite3::ModuleSQLite3(), ModuleSQLLog::ModuleSQLLog(), ModuleSQLOper::ModuleSQLOper(), ModuleSQLOper::OnLoadModule(), and ModuleOperHash::OnLoadModule(). |
|
|
Event handler hooks. This needs to be public to be used by FOREACH_MOD and friends. Definition at line 1665 of file modules.h. Referenced by InspIRCd::AllModulesReportReady(), Attach(), Detach(), and SetPriority(). |
|
|
The feature names published by various modules.
Definition at line 1641 of file modules.h. Referenced by FindFeature(), PublishFeature(), and UnpublishFeature(). |
|
|
Our pointer to the main insp instance.
|
|
|
The interface names published by various modules.
Definition at line 1645 of file modules.h. Referenced by DoneWithInterface(), FindInterface(), GetInterfaceInstanceCount(), ModuleHasInterface(), PublishInterface(), UnpublishInterface(), and UseInterface(). |
|
|
Holds a string describing the last module error to occur.
Definition at line 1637 of file modules.h. Referenced by LastError(), Load(), and Unload(). |
|
|
Total number of modules loaded into the ircd.
|
|
|
List of loaded modules and shared object/dll handles keyed by module name.
Definition at line 1658 of file modules.h. Referenced by Find(), GetAllModuleNames(), GetModuleName(), Load(), and Unload(). |