1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2006 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #ifndef _INCLUDE_PLUGINMANAGER_H
12 #define _INCLUDE_PLUGINMANAGER_H
15 * @brief Plugin Manager interface
16 * @file IPluginManager.h
21 #include "ISmmPlugin.h"
35 * @brief Status of a plugin at runtime
49 class ISmmPluginManager
53 * @brief Loads a plugin and returns its id. If this is called before DLLInit(),
54 * then the plugin is considered to be "hot" - it might refuse its own load later!
55 * Also, a hot plugin might not have an error message.
57 * @param file String containing file name
58 * @param source Specifies who loaded the plugin
59 * @param status Status of the plugin
60 * @param ismm Pointer to Smm API
61 * @param error String buffer for error messages
62 * @param maxlen Maximum length of buffer
63 * @return Id of plugin
65 virtual PluginId Load(const char *file, PluginId source, bool &already, char *error, size_t maxlen) =0;
68 * @brief Unloads a plugin
70 * @param id Id of plugin
71 * @param error String buffer for error messages
72 * @param maxlen Maximum length of buffer
73 * @return True on success, false otherwise
75 virtual bool Unload(PluginId id, bool force, char *error, size_t maxlen) =0;
78 * @brief Pauses a plugin
80 * @param id Id of plugin
81 * @param error String buffer for error messages
82 * @param maxlen Maximum length of buffer
83 * @return True on success, false otherwise
85 virtual bool Pause(PluginId id, char *error, size_t maxlen) =0;
88 * @brief Unpauses a plugin
90 * @param id Id of plugin
91 * @param force If true, forces the plugin to unload
92 * @param error String buffer for error messages
93 * @param maxlen Maximum length of buffer
94 * @return True on success, false otherwise
96 virtual bool Unpause(PluginId id, char *error, size_t maxlen) =0;
99 * @brief Unloads all plugins forcefully
101 * @return True on success, false otherwise
103 virtual bool UnloadAll() =0;
106 * @brief Returns information about a plugin
108 * @param id Id of plugin
109 * @param file Pointer to file string by reference
110 * @param list Pointer to factories by reference
111 * @param status By reference status of plugin
112 * @param source By reference source of plugin
113 * @return True on success, false if not found
115 virtual bool Query(PluginId id, const char *&file, Pl_Status &status, PluginId &source) =0;
118 * @brief Checks another plugin's QueryRunning() status.
120 * @param id Id of plugin
121 * @param error Message buffer
122 * @param maxlen Size of error buffer
123 * @return Status value
125 virtual bool QueryRunning(PluginId id, char *error, size_t maxlength) =0;
128 * @brief Returns the handle of a plugin (OS dependent meaning)
130 * @param id Id of plugin
131 * @param handle By reference handle of plugin, if any
132 * @return True if plugin id is valid, false otherwise
134 virtual bool QueryHandle(PluginId id, void *&handle) =0;
137 #endif //_INCLUDE_PLUGINMANAGER_H