aitown-plugin is a library to facilitate working with
plug-ins in aitown. Each plug-in designed for this
framework consists of two files: a binary file
representing a shared (dynamic) library and a
text file describing the plug-in. Both must have
same base name (used as a short name for plug-in; other
plug-ins will use this name to identify the plugin),
with the shared library having a
system dependent extension (".dll", ".so", ...) and
the description file ending in ".inf".
This is the first version (1.0.0) of this implementation
As the file name is used to identify the plug-in, it should
only consist of lowercase letters, digits and
characters "_" and "-".
C interface
The shared library must export two functions:
-
func_error_t plugin__initialize (
plugin_manager *manager_,
plugin_data_t *plugin_
);
This function is called when the plug-in is loaded.
The library must respond with FUNC_OK or it will be
unloaded on return. During this
call the plug-in registers the interfaces it exposes.
-
void plugin__terminate (
plugin_manager *manager_,
plugin_data *plugin_
);
This function is called before the plug-in is unloaded.
During this
call the plug-in unregisters the interfaces it exposes.
Description file
The description file consists of [sections] and value=key entries (see
the example at the end of the section). In the list below
required, as opposed to optional,
identifies an option that, if not found, will
prevent the plug-in from being loaded, and multiple
indicates an option that, when used multiple times, adds to previos
content instead of overwriting it.
[general] section
-
- name=text [required]
-
the name to be presented to the user.
- description=text [optional]
-
a one line description.
- version=x.y.z [required]
-
the version of the binary; this exact format must be used,
with x, y and z being positive integers.
- manager=x.y.z [required]
-
the minimum version of the manager
and the version to which the
plug-in conforms; programs exposing an older
manager will ignore this plug-in. Currently,
there exists only
one valid version: "1.0.0".
- dependencies=a:x.y.z,b,c [optional, multiple]
-
The plug-ins that should be loaded before
this plug-in is loaded.
[aitown] section
-
- server=yes|no [optional, default yes]
-
the plug-in targets the server.
- client=yes|no [optional, default yes]
-
the plug-in targets the client.
Example description file:
[general]
name = Gorgeous plug-in
description = Example plug-in that does nothing, really
version = 1.0.0
manager = 1.0.0
dependencies = badabum:1.0.0, big-badabum:2.0
[aitown]
server = yes
client = yes
Plug-in search path
When a plug-in is requested for loading and no path is given
(not even a relative path), then that plug-in is searched in
following directories:
- $PROGPATH/plugins
- $env(AITOWN_PLUGIN_DIR)
- $HOME/.aitown/plugins
- $env(UNIXROOT)/usr/lib/aitown/plugins
- /usr/lib/aitown/plugins
- $env(UNIXROOT)/lib/aitown/plugins
- /lib/aitown/plugins
The directories are searched in this exact order.
If the user provides additional directories to search, those
are searched first, in same order as added.
$HOME is the user's home directory; $PROGPATH is the
path from where the prgram was started; $UNIXROOT is an
environment variable indicating a base path for a UNIX
like directory structure. AITOWN_PLUGIN_DIR is another environment
variable.
|