dmlite
0.6
|
C wrapper for DMLite. More...
#include "dmlite/common/config.h"
#include "dmlite/common/errno.h"
#include "any.h"
#include <stdlib.h>
#include <sys/stat.h>
#include <utime.h>
Go to the source code of this file.
Classes | |
struct | dmlite_credentials |
Security credentials. More... | |
struct | dmlite_security_ent |
Used to handle user and group information. More... | |
struct | dmlite_security_context |
Security context. More... | |
Typedefs | |
typedef struct dmlite_manager | dmlite_manager |
Handle for the plugin manager. More... | |
typedef struct dmlite_context | dmlite_context |
Handle for a initialized context. More... | |
typedef struct dmlite_credentials | dmlite_credentials |
Security credentials. More... | |
typedef struct dmlite_security_ent | dmlite_security_ent |
Used to handle user and group information. More... | |
typedef struct dmlite_security_context | dmlite_security_context |
Security context. More... | |
Functions | |
unsigned | dmlite_api_version (void) |
Gets the API version. More... | |
dmlite_manager * | dmlite_manager_new (void) |
Initializes a dmlite_manager. More... | |
int | dmlite_manager_free (dmlite_manager *manager) |
Destroys the manager. More... | |
int | dmlite_manager_load_plugin (dmlite_manager *manager, const char *lib, const char *id) |
Loads a library. More... | |
int | dmlite_manager_set (dmlite_manager *manager, const char *key, const char *value) |
Sets a configuration parameter. More... | |
int | dmlite_manager_load_configuration (dmlite_manager *manager, const char *file) |
Loads a configuration file. More... | |
int | dmlite_manager_get (dmlite_manager *handle, const char *key, char *buffer, size_t bufsize) |
Returns the associated value with the given key. More... | |
int | dmlite_manager_errno (dmlite_manager *manager) |
Returns the last error code. More... | |
int | dmlite_manager_errtype (dmlite_manager *manager) |
Returns the type of the last error. More... | |
const char * | dmlite_manager_error (dmlite_manager *manager) |
Returns the string that describes the last error. More... | |
dmlite_context * | dmlite_context_new (dmlite_manager *manager) |
Returns a usable context from the loaded libraries. More... | |
int | dmlite_context_free (dmlite_context *context) |
Destroys the context. More... | |
int | dmlite_errno (dmlite_context *context) |
Returns the error code from the last failure. More... | |
int | dmlite_errtype (dmlite_context *context) |
Returns the type of the last error. More... | |
const char * | dmlite_error (dmlite_context *context) |
Error string from the last failed function. More... | |
int | dmlite_setcredentials (dmlite_context *context, const dmlite_credentials *cred) |
Sets the user security credentials. More... | |
const dmlite_security_context * | dmlite_get_security_context (dmlite_context *context) |
Returns the security context. There is no need to free. More... | |
int | dmlite_set (dmlite_context *context, const char *k, const dmlite_any *v) |
Sets a configuration parameter tied to a context. More... | |
int | dmlite_set_array (dmlite_context *context, const char *k, unsigned n, dmlite_any *const *v) |
Sets a configuration parameter tied to a context (array version). More... | |
int | dmlite_unset (dmlite_context *context, const char *k) |
Removes a configuration parameter. More... | |
int | dmlite_unset_all (dmlite_context *context) |
Removes all configuration parameters previously set. More... | |
C wrapper for DMLite.
typedef struct dmlite_context dmlite_context |
Handle for a initialized context.
typedef struct dmlite_credentials dmlite_credentials |
Security credentials.
It is up to the caller to allocate and free this pointers. DMLite will keep a copy internaly. Non used values MUST be NULL.
typedef struct dmlite_manager dmlite_manager |
Handle for the plugin manager.
typedef struct dmlite_security_context dmlite_security_context |
Security context.
typedef struct dmlite_security_ent dmlite_security_ent |
Used to handle user and group information.
unsigned dmlite_api_version | ( | void | ) |
Gets the API version.
int dmlite_context_free | ( | dmlite_context * | context | ) |
Destroys the context.
context | The context to free. |
dmlite_context* dmlite_context_new | ( | dmlite_manager * | manager | ) |
Returns a usable context from the loaded libraries.
manager | The plugin manager. |
int dmlite_errno | ( | dmlite_context * | context | ) |
Returns the error code from the last failure.
context | The context that was used in the failed function. |
const char* dmlite_error | ( | dmlite_context * | context | ) |
Error string from the last failed function.
context | The context that was used in the failed function. |
int dmlite_errtype | ( | dmlite_context * | context | ) |
Returns the type of the last error.
context | The context that was used in the failed function. |
const dmlite_security_context* dmlite_get_security_context | ( | dmlite_context * | context | ) |
Returns the security context. There is no need to free.
context | The DM context. |
int dmlite_manager_errno | ( | dmlite_manager * | manager | ) |
Returns the last error code.
manager | The plugin manager used in the failing function. |
const char* dmlite_manager_error | ( | dmlite_manager * | manager | ) |
Returns the string that describes the last error.
manager | The plugin manager used in the failing function. |
int dmlite_manager_errtype | ( | dmlite_manager * | manager | ) |
Returns the type of the last error.
manager | The plugin manager used in the failing function. |
int dmlite_manager_free | ( | dmlite_manager * | manager | ) |
Destroys the manager.
manager | The manager to be destroyed. |
int dmlite_manager_get | ( | dmlite_manager * | handle, |
const char * | key, | ||
char * | buffer, | ||
size_t | bufsize | ||
) |
Returns the associated value with the given key.
manager | The plugin manager. |
key | The configuration parameter. |
buffer | Where to leave the string. |
bufsize | The buffer size. |
int dmlite_manager_load_configuration | ( | dmlite_manager * | manager, |
const char * | file | ||
) |
Loads a configuration file.
manager | The plugin manager. |
file | The configuration file |
int dmlite_manager_load_plugin | ( | dmlite_manager * | manager, |
const char * | lib, | ||
const char * | id | ||
) |
Loads a library.
manager | The plugin manager. |
lib | The .so file. Usually, (path)/plugin_name.so. |
id | The plugin ID. Usually, plugin_name. |
dmlite_manager* dmlite_manager_new | ( | void | ) |
Initializes a dmlite_manager.
int dmlite_manager_set | ( | dmlite_manager * | manager, |
const char * | key, | ||
const char * | value | ||
) |
Sets a configuration parameter.
manager | The plugin manager. |
key | The parameter to set. |
value | The value. |
int dmlite_set | ( | dmlite_context * | context, |
const char * | k, | ||
const dmlite_any * | v | ||
) |
Sets a configuration parameter tied to a context.
This can be used to pass advanced parameters to a plugin.
context | The DM context. |
k | The configuration key. |
v | Value. |
int dmlite_set_array | ( | dmlite_context * | context, |
const char * | k, | ||
unsigned | n, | ||
dmlite_any *const * | v | ||
) |
Sets a configuration parameter tied to a context (array version).
context | The DM context. |
k | The configuration key. |
n | The configuration key. |
v | Array of values. |
int dmlite_setcredentials | ( | dmlite_context * | context, |
const dmlite_credentials * | cred | ||
) |
Sets the user security credentials.
context | The DM context. |
cred | The security credentials. |
int dmlite_unset | ( | dmlite_context * | context, |
const char * | k | ||
) |
Removes a configuration parameter.
context | The DM context. |
k | The configuration key. |
int dmlite_unset_all | ( | dmlite_context * | context | ) |
Removes all configuration parameters previously set.
context | The DM context. |