Top | ![]() |
![]() |
![]() |
![]() |
InfCertificateCredentials * | credentials | Read / Write / Construct Only |
InfdDirectory * | directory | Read / Write / Construct Only |
InfinotedLog * | log | Read / Write / Construct Only |
char * | path | Read |
struct | InfinotedPluginManager |
struct | InfinotedPluginManagerClass |
struct | InfinotedPlugin |
enum | InfinotedPluginManagerError |
InfinotedPluginManager handles the loading of plugins for the infinoted server. It initializes and deinitializes plugins, and it makes callbacks when connections or sessions are added or removed. Furthermore, it provides an interface for plugins to obtain and interact with the server itself, most notable its InfdDirectory instance.
InfinotedPluginManager * infinoted_plugin_manager_new (InfdDirectory *directory
,InfinotedLog *log
,InfCertificateCredentials *creds
);
Creates a new InfinotedPluginManager with the given directory, log
and credentials. These three objects will be available for plugins
to enhance the infinoted functionality. Plugins can be loaded
with infinoted_plugin_manager_load()
.
[constructor]
directory |
The InfdDirectory on which plugins should operate. |
|
log |
The InfinotedLog to write log messages to. |
|
creds |
The InfCertificateCredentials used to secure data
transfer with the clients, or |
[allow-none] |
gboolean infinoted_plugin_manager_load (InfinotedPluginManager *manager
,const gchar *plugin_path
,const gchar * const*plugins
,GKeyFile *options
,GError **error
);
Loads all plugins specified in plugins
from the location at plugin_path
.
If loading one of the module fails the function sets error
and returns
FALSE
, and the object ends up with no plugins loaded. If plugins
is
NULL
, no plugins are loaded.
If this function is called while there are already plugins loaded, all existing plugins are unloaded first.
InfdDirectory *
infinoted_plugin_manager_get_directory
(InfinotedPluginManager *manager
);
Returns the InfdDirectory used by the plugin manager.
InfIo *
infinoted_plugin_manager_get_io (InfinotedPluginManager *manager
);
Returns the InfIo of the InfdDirectory used by the plugin manager.
InfinotedLog *
infinoted_plugin_manager_get_log (InfinotedPluginManager *manager
);
Returns the InfinotedLog that the plugin manager and the plugins do write log messages to.
InfCertificateCredentials *
infinoted_plugin_manager_get_credentials
(InfinotedPluginManager *manager
);
Returns the InfCertificateCredentials used for securing the data transfer with all clients.
gpointer infinoted_plugin_manager_get_connection_info (InfinotedPluginManager *mgr
,gpointer plugin_info
,InfXmlConnection *connection
);
Queries the connection-specfic plugin data for the plugin instance
plugin_info
. Returns NULL
if no such object exists, i.e. when the
plugin's connection_info_size
is set to 0.
mgr |
||
plugin_info |
The |
|
connection |
The InfXmlConnection for which to retrieve plugin data. |
gpointer infinoted_plugin_manager_get_session_info (InfinotedPluginManager *mgr
,gpointer plugin_info
,InfSessionProxy *proxy
);
Queries the session-specfic plugin data for the plugin instance
plugin_info
. Returns NULL
if no such object exists, i.e. when the
plugin's session_info_size
is set to 0.
mgr |
||
plugin_info |
The |
|
proxy |
The InfSessionProxy for which to retrieve plugin data. |
struct InfinotedPluginManager;
InfinotedPluginManager is an opaque data type. You should only access it via the public API functions.
struct InfinotedPluginManagerClass { };
This structure does not contain any public fields.
struct InfinotedPlugin { const gchar* name; const gchar* description; const InfinotedParameterInfo* options; gsize info_size; gsize connection_info_size; gsize session_info_size; const gchar* session_type; void(*on_info_initialize)(gpointer plugin_info); gboolean(*on_initialize)(InfinotedPluginManager* manager, gpointer plugin_info, GError** error); void(*on_deinitialize)(gpointer plugin_info); void(*on_connection_added)(InfXmlConnection* connection, gpointer plugin_info, gpointer connection_info); void(*on_connection_removed)(InfXmlConnection* connection, gpointer plugin_info, gpointer connection_info); void(*on_session_added)(const InfBrowserIter* iter, InfSessionProxy* proxy, gpointer plugin_info, gpointer session_info); void(*on_session_removed)(const InfBrowserIter* iter, InfSessionProxy* proxy, gpointer plugin_info, gpointer session_info); };
Declares a InfinotedPlugin. If an instance of this structure is called
INFINOTED_PLUGIN
and exported from a shared object, it
can be loaded as a plugin by infinoted.
The name of the plugin. The filename of the shared object should
be |
||
A human-readable description of what the plugin does. |
||
const InfinotedParameterInfo * |
A 0-terminated list of plugin parameters. The parameters are
provided to the plugin via the infinoted configuration file or the command
line. The last element of the list must have the |
|
The size of the plugin instance structure. When the plugin is instantiated, this amount of memory will be allocated for the plugin instance. This field must be different from 0. |
||
The size of the plugin's connection info structure. For each plugin instance, this amount of memory will be allocated for each connection of the server. The plugin can use it to store connection-specific data. This field can be 0. |
||
The size of the plugin's session info structure. For each plugin instance, this amount of memory will be allocated for each session that is currently active on the server. The plugin can use it to store session-specific data. This field can be 0. |
||
If non- |
||
Function called after the plugin has been instantiated. It should initialize all fields of the plugin instance to a sane default value. |
||
Function called to initialize the plugin. The function can
return |
||
Function called when the plugin is unloaded. Should clean up all resources the plugin has allocated. |
||
Function called when there is a new connection to the server. It is also called for all existing connections at the time the plugin is loaded. |
||
Function called when a client connection has been dropped. It is also called for all existing connections right before the plugin is unloaded. |
||
Function called when a new session has become active on the server. It is also called for all existing sessions at the time the plugin is loaded. |
||
Function called when a session has become inactive and the server is freeing resources allocated to it. It is also called for all existing sessions right before the plugin is unloaded. |
Error codes for the INFINOTED_PLUGIN_MANAGER_ERROR
error domain. These errors can occur when loading a plugin with
infinoted_plugin_manager_load()
.
“credentials”
property“credentials” InfCertificateCredentials *
The server's TLS credentials.
Owner: InfinotedPluginManager
Flags: Read / Write / Construct Only
“directory”
property“directory” InfdDirectory *
The infinote directory served by the server.
Owner: InfinotedPluginManager
Flags: Read / Write / Construct Only
“log”
property“log” InfinotedLog *
The log object into which to write log messages.
Owner: InfinotedPluginManager
Flags: Read / Write / Construct Only