|  |  |  | Libdexter Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <dexter.h> #define DEXTER_TLS_ENABLED #define DEXTER_ERROR enum DexterError; enum DexterState; gboolean dexter_init (const gchar *config,GError **error); void dexter_exit (void); gint dexter_get_state (void);
Libdexter must be initialized with dexter_init() prior to use.
This function causes Libdexter to read the configuration file; load the specified plugins and register authorized services; initialize the thread pool and set up the interfaces needed for plugins to interact with the library.
When you are done using Libdexter, you should issue dexter_exit()
to free up the resources it uses; shutdown its thread pool, etc.
Example of how to initialize and shutdown Libdexter:
#include <dexter.h>
GError    *local_error = NULL;
/* Init the library from a default configuration file. */
dexter_init (NULL, &local_error);
if (local_error) {
    /* deal with error */
    g_error ("failed to init libdexter: %s", local_error->message);
}
/* ----------------
   Use the library.
   ---------------- */
...
/* Release library resources. */
dexter_exit();
...
#define DEXTER_TLS_ENABLED
This macro is defined if TLS is enabled on this installation of Libdexter.
Since 0.2.0
#define DEXTER_ERROR dexter_error_quark()
The error domain of the libdexter initialization subsystem.
typedef enum {
  DEXTER_ERROR_NO_CONFIG_FILE,
  DEXTER_ERROR_MODULES_NOT_SUPPORTED,
  DEXTER_ERROR_NOT_ABSOLUTE_PATH,
  DEXTER_ERROR_FAILED
} DexterError;
Error codes for dexter operations.
typedef enum {
  DEXTER_STATE_UP,
  DEXTER_STATE_STARTING,
  DEXTER_STATE_STOPPING,
  DEXTER_STATE_DOWN
} DexterState;
All possible states for the Libdexter library.
| the library is up and available for use. | |
| the library is starting, i.e. dexter_init()is in progress. | |
| the library is shutting down, i.e. dexter_exit()is in progress. | |
| the library is down and not available for use. | 
gboolean dexter_init (const gchar *config,GError **error);
Initialize libdexter using the indicated config file.
If NULL is specified for config, the library will try to use:
$HOME/.dexterrc or /etc/libdexter/dexter.conf, in that order.
void                dexter_exit                         (void);
Shuts down libdexter and frees its resources.
Note: Do not issue dexter_exit() from within any asynchronous callback generated by the library.
gint                dexter_get_state                    (void);
Returns the current state of the Libdexter library.
| Returns : | gint from DexterState indicating current state of the library. | 
Since 0.1.3