summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-02 13:30:24 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-02 13:30:24 +0100
commit860f5cbf1ea159d7d1c3fce2364747a822c50461 (patch)
treecc4f7e8bb3efc944b8ce101c5db46162b31f2834 /include
parent44b5a8fa89d8c2bda767c0d5fe77c4d31061ce2b (diff)
parent90ab8cf4258a25e8403465ed86296fc74405620d (diff)
Merge branch 'master+serviceinit'
Diffstat (limited to 'include')
-rw-r--r--include/base.h8
-rw-r--r--include/ctables.h4
-rw-r--r--include/extensible.h4
-rw-r--r--include/mode.h5
-rw-r--r--include/modules.h11
5 files changed, 31 insertions, 1 deletions
diff --git a/include/base.h b/include/base.h
index dcbb2e5c7..c378afc1c 100644
--- a/include/base.h
+++ b/include/base.h
@@ -235,7 +235,9 @@ enum ServiceType {
/** is a data processing provider (MD5, SQL) */
SERVICE_DATA,
/** is an I/O hook provider (SSL) */
- SERVICE_IOHOOK
+ SERVICE_IOHOOK,
+ /** Service managed by a module */
+ SERVICE_CUSTOM
};
/** A structure defining something that a module can provide */
@@ -251,6 +253,10 @@ class CoreExport ServiceProvider : public classbase
ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type);
virtual ~ServiceProvider();
+ /** Register this service in the appropriate registrar
+ */
+ virtual void RegisterService();
+
/** If called, this ServiceProvider won't be registered automatically
*/
void DisableAutoRegister();
diff --git a/include/ctables.h b/include/ctables.h
index abf65f561..bc4226ea9 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -218,6 +218,10 @@ class CoreExport Command : public CommandBase
*/
virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user) = 0;
+ /** Register this object in the CommandParser
+ */
+ void RegisterService() CXX11_OVERRIDE;
+
/** Destructor
* Removes this command from the command parser
*/
diff --git a/include/extensible.h b/include/extensible.h
index 5ac4fa9da..1a51fdaaf 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -69,6 +69,10 @@ class CoreExport ExtensionItem : public ServiceProvider, public usecountbase
/** Free the item */
virtual void free(void* item) = 0;
+ /** Register this object in the ExtensionManager
+ */
+ void RegisterService() CXX11_OVERRIDE;
+
protected:
/** Get the item from the internal map */
void* get_raw(const Extensible* container) const;
diff --git a/include/mode.h b/include/mode.h
index eebfbedd6..d8884bf9f 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -168,6 +168,11 @@ class CoreExport ModeHandler : public ServiceProvider
ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER);
virtual CullResult cull();
virtual ~ModeHandler();
+
+ /** Register this object in the ModeParser
+ */
+ void RegisterService() CXX11_OVERRIDE;
+
/**
* Returns true if the mode is a list mode
*/
diff --git a/include/modules.h b/include/modules.h
index f86f88087..93e5c05a0 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1213,6 +1213,17 @@ class CoreExport ModuleManager : public fakederef<ModuleManager>
* @return A ModuleMap containing all loaded modules
*/
const ModuleMap& GetModules() const { return Modules; }
+
+ /** Make a service referenceable by dynamic_references
+ * @param name Name that will be used by dynamic_references to find the object
+ * @param service Service to make referenceable by dynamic_references
+ */
+ void AddReferent(const std::string& name, ServiceProvider* service);
+
+ /** Make a service no longer referenceable by dynamic_references
+ * @param service Service to make no longer referenceable by dynamic_references
+ */
+ void DelReferent(ServiceProvider* service);
};
/** Do not mess with these functions unless you know the C preprocessor