summaryrefslogtreecommitdiffstats
path: root/database/eurephiadb.c
diff options
context:
space:
mode:
Diffstat (limited to 'database/eurephiadb.c')
-rw-r--r--database/eurephiadb.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/database/eurephiadb.c b/database/eurephiadb.c
index 88e3ac1..235716c 100644
--- a/database/eurephiadb.c
+++ b/database/eurephiadb.c
@@ -19,6 +19,15 @@
*
*/
+/**
+ * @file eurephiadb.c
+ * @author David Sommerseth <dazo@users.sourceforge.net>
+ * @date 2008-08-06
+ *
+ * @brief Handles loading and initialising of the database drivers
+ *
+ */
+
#include <stdio.h>
#include <dlfcn.h>
@@ -28,6 +37,13 @@
#include "eurephia_getsym.h"
+/**
+ * Unloads the database driver
+ *
+ * @param ctx eurephiaCTX
+ *
+ * @return Returns always 1.
+ */
int eDBlink_close(eurephiaCTX *ctx)
{
if( ctx == NULL ) {
@@ -43,18 +59,27 @@ int eDBlink_close(eurephiaCTX *ctx)
}
-int eDBlink_init(eurephiaCTX *ctx, const char *dbl, const int minver)
+/**
+ * Loads and initialises the database driver.
+ *
+ * @param ctx eurephiaCTX to which the database driver will be associated with
+ * @param dbdriver Full path to the driver file (.so)
+ * @param minver The required minimum API level of the driver
+ *
+ * @return Returns 1 on success, otherwise 0.
+ */
+int eDBlink_init(eurephiaCTX *ctx, const char *dbdriver, const int minver)
{
- if( dbl == NULL ) {
+ if( dbdriver == NULL ) {
eurephia_log(ctx, LOG_FATAL, 0, "No eurephia eDBlink driver given. "
"eurephia authentication will not be available");
return 0;
}
- eurephia_log(ctx, LOG_INFO, 2, "Loading eurephiaDB driver: %s", dbl);
+ eurephia_log(ctx, LOG_INFO, 2, "Loading eurephiaDB driver: %s", dbdriver);
- ctx->eurephia_driver = dlopen(dbl, RTLD_NOW);
+ ctx->eurephia_driver = dlopen(dbdriver, RTLD_NOW);
if( ctx->eurephia_driver == NULL ) {
- eurephia_log(ctx, LOG_FATAL, 0, "Could not open the eurephia eDBlink driver (%s)", dbl);
+ eurephia_log(ctx, LOG_FATAL, 0, "Could not open the eurephia eDBlink driver (%s)", dbdriver);
eurephia_log(ctx, LOG_FATAL, 1, "dlopen error: %s", dlerror());
return 0;
}
@@ -80,7 +105,7 @@ int eDBlink_init(eurephiaCTX *ctx, const char *dbl, const int minver)
default:
eurephia_log(ctx, LOG_WARNING, 0,
"eurephiaDB driver API is newer than the running eurephia version. Consider "
- "to upgrade eurphia to take advantage of newer features in the eurephiaDB driver.");
+ "to upgrade eurephia to take advantage of newer features in the eurephiaDB driver.");
case 2:
#ifdef ENABLE_EUREPHIADM
eDBadminAuth = eGetSym(ctx, ctx->eurephia_driver, "eDBadminAuth");