diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2009-11-04 17:30:06 +0100 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-11-12 23:31:47 +0100 |
| commit | d2c9a8dac8f11b2a0df3a8b325fda51a8912afed (patch) | |
| tree | f4ae737c58817907d0705f7748d3a4c23cf8b461 /database | |
| parent | 7599aeb4f3eb631fbe66817e992290dcf9122189 (diff) | |
| download | eurephia-d2c9a8dac8f11b2a0df3a8b325fda51a8912afed.tar.gz eurephia-d2c9a8dac8f11b2a0df3a8b325fda51a8912afed.tar.xz eurephia-d2c9a8dac8f11b2a0df3a8b325fda51a8912afed.zip | |
Cleaned up the driver/interface API for database and firewall
Diffstat (limited to 'database')
| -rw-r--r-- | database/eurephiadb_driver.h | 85 |
1 files changed, 45 insertions, 40 deletions
diff --git a/database/eurephiadb_driver.h b/database/eurephiadb_driver.h index c7c6505..b8553cc 100644 --- a/database/eurephiadb_driver.h +++ b/database/eurephiadb_driver.h @@ -28,6 +28,7 @@ * */ +#include <eurephia_driverapi.h> #include <eurephia_context.h> #include <eurephiadb_session_struct.h> #include <eurephia_values_struct.h> @@ -52,14 +53,12 @@ #define USERINFO_attempts 0x08 /**< flag for extracting information from attempts log */ #define USERINFO_blacklist 0x10 /**< flag for extracting information from blacklist log */ -#ifndef DRIVER_MODE - /** * Mandatory function. Retrieves driver version information * * @return Returns string (const char *) containing driver version information. */ -const char *(*eDB_DriverVersion) (void); +const char * EUREPHIA_DRIVERAPI_FUNC(eDB_DriverVersion)(void); /** @@ -67,7 +66,7 @@ const char *(*eDB_DriverVersion) (void); * * @return Returns integer value with API level supported by driver. */ -int (*eDB_DriverAPIVersion) (void); +int EUREPHIA_DRIVERAPI_FUNC(eDB_DriverAPIVersion)(void); /* * functions which needs to exists in the API level 1 @@ -84,7 +83,7 @@ int (*eDB_DriverAPIVersion) (void); * * @return Returns 1 on success, otherwise 0. */ -int (*eDBconnect) (eurephiaCTX *ctx, const int argc, const char **argv); +int EUREPHIA_DRIVERAPI_FUNC(eDBconnect)(eurephiaCTX *ctx, const int argc, const char **argv); /** * Disconnects from a database @@ -93,7 +92,7 @@ int (*eDBconnect) (eurephiaCTX *ctx, const int argc, const char **argv); * @param ctx eurephiaCTX - context with the database connection to disconnect from. * */ -void (*eDBdisconnect) (eurephiaCTX *ctx); +void EUREPHIA_DRIVERAPI_FUNC(eDBdisconnect) (eurephiaCTX *ctx); /** * Authenticates a certificate against the database. @@ -110,8 +109,9 @@ void (*eDBdisconnect) (eurephiaCTX *ctx); * @return Returns certid (certificate ID) on success. 0 is returned if certificate is not found, * or -1 if the certificate is blacklisted. */ -int (*eDBauth_TLS) (eurephiaCTX *ctx, const char *org, const char *cname, const char *email, - const char *digest, const unsigned int depth); +int EUREPHIA_DRIVERAPI_FUNC(eDBauth_TLS)(eurephiaCTX *ctx, const char *org, const char *cname, + const char *email, + const char *digest, const unsigned int depth); /** * Authenticates a client against the database, with users certificate ID, username and password. @@ -125,7 +125,8 @@ int (*eDBauth_TLS) (eurephiaCTX *ctx, const char *org, const char *cname, const * @return Returns uicid (user-certs ID) to the user on success. 0 if user account is not * found and -1 on authentication failure. */ -int (*eDBauth_user) (eurephiaCTX *ctx, const int certid, const char *username, const char *passwd); +int EUREPHIA_DRIVERAPI_FUNC(eDBauth_user)(eurephiaCTX *ctx, const int certid, + const char *username, const char *passwd); /** @@ -138,7 +139,7 @@ int (*eDBauth_user) (eurephiaCTX *ctx, const int certid, const char *username, c * * @return Returns uid of user on success, 0 if user account is not found, otherwise -1 on errors. */ -int (*eDBget_uid) (eurephiaCTX *ctx, const int certid, const char *username); +int EUREPHIA_DRIVERAPI_FUNC(eDBget_uid)(eurephiaCTX *ctx, const int certid, const char *username); /** @@ -154,7 +155,7 @@ int (*eDBget_uid) (eurephiaCTX *ctx, const int certid, const char *username); * * @see attempt_IPADDR, attempt_CERTIFICATE, attempt_USERNAME */ -int (*eDBblacklist_check) (eurephiaCTX *ctx, const int type, const char *val); +int EUREPHIA_DRIVERAPI_FUNC(eDBblacklist_check)(eurephiaCTX *ctx, const int type, const char *val); /** @@ -170,7 +171,7 @@ int (*eDBblacklist_check) (eurephiaCTX *ctx, const int type, const char *val); * * @see ATTEMPT_REGISTER, ATTEMPT_RESET, attempt_IPADDR, attempt_CERTIFICATE, attempt_USERNAME */ -void (*eDBregister_attempt) (eurephiaCTX *ctx, int type, int mode, const char *value); +void EUREPHIA_DRIVERAPI_FUNC(eDBregister_attempt)(eurephiaCTX *ctx, int type, int mode, const char *value); /** @@ -190,9 +191,10 @@ void (*eDBregister_attempt) (eurephiaCTX *ctx, int type, int mode, const char *v * * @return Returns 1 on success, otherwise 0. */ -int (*eDBregister_login) (eurephiaCTX *ctx, eurephiaSESSION *skey, const int certid, const int uid, - const char *proto, const char *remipaddr, const char *remport, - const char *vpnipaddr, const char *vpnipmask); +int EUREPHIA_DRIVERAPI_FUNC(eDBregister_login)(eurephiaCTX *ctx, eurephiaSESSION *skey, + const int certid, const int uid, + const char *proto, const char *remipaddr, const char *remport, + const char *vpnipaddr, const char *vpnipmask); /** @@ -206,7 +208,8 @@ int (*eDBregister_login) (eurephiaCTX *ctx, eurephiaSESSION *skey, const int cer * * @return Returns 1 on success, otherwise 0. */ -int (*eDBregister_vpnmacaddr) (eurephiaCTX *ctx, eurephiaSESSION *session, const char *macaddr); +int EUREPHIA_DRIVERAPI_FUNC(eDBregister_vpnmacaddr)(eurephiaCTX *ctx, eurephiaSESSION *session, + const char *macaddr); /** @@ -222,8 +225,9 @@ int (*eDBregister_vpnmacaddr) (eurephiaCTX *ctx, eurephiaSESSION *session, const * * @return Returns 1 on success, otherwise 0. */ -int (*eDBregister_logout) (eurephiaCTX *ctx, eurephiaSESSION *skey, - const char *bytes_sent, const char *bytes_received, const char *duration); +int EUREPHIA_DRIVERAPI_FUNC(eDBregister_logout)(eurephiaCTX *ctx, eurephiaSESSION *skey, + const char *bytes_sent, const char *bytes_received, + const char *duration); /* firewall functions */ @@ -238,7 +242,7 @@ int (*eDBregister_logout) (eurephiaCTX *ctx, eurephiaSESSION *skey, * @return Returns a char pointer to a buffer with the name of the firewall profile. This buffer * must be freed when no longer needed. */ -char *(*eDBget_firewall_profile) (eurephiaCTX *ctx, eurephiaSESSION *session); +char * EUREPHIA_DRIVERAPI_FUNC(eDBget_firewall_profile) (eurephiaCTX *ctx, eurephiaSESSION *session); /** * Retrieve a list of IP addresses found in the IP address blacklist table. @@ -249,7 +253,7 @@ char *(*eDBget_firewall_profile) (eurephiaCTX *ctx, eurephiaSESSION *session); * @return Returns an eurephiaVALUES chain with all blacklisted IP addresses on success, otherwise * NULL is returned */ -eurephiaVALUES *(*eDBget_blacklisted_ip) (eurephiaCTX *ctx); +eurephiaVALUES * EUREPHIA_DRIVERAPI_FUNC(eDBget_blacklisted_ip)(eurephiaCTX *ctx); /* The following functions is also declared in eurephia_session_values.c - for local internal usage. */ /** @@ -264,7 +268,8 @@ eurephiaVALUES *(*eDBget_blacklisted_ip) (eurephiaCTX *ctx); * @return Returns the unique session key string (char *) on success, otherwise NULL. The session key * string must be freed when no longer needed. */ -char *(*eDBget_sessionkey_seed) (eurephiaCTX *ctx, sessionType type, const char *sessionseed); +char * EUREPHIA_DRIVERAPI_FUNC(eDBget_sessionkey_seed)(eurephiaCTX *ctx, sessionType type, + const char *sessionseed); /** @@ -278,7 +283,7 @@ char *(*eDBget_sessionkey_seed) (eurephiaCTX *ctx, sessionType type, const char * @return Returns the unique session key string (char *) on success, otherwise NULL. The session key * string must be freed when no longer needed. */ -char *(*eDBget_sessionkey_macaddr) (eurephiaCTX *ctx, const char *macaddr); +char * EUREPHIA_DRIVERAPI_FUNC(eDBget_sessionkey_macaddr)(eurephiaCTX *ctx, const char *macaddr); /** @@ -291,7 +296,7 @@ char *(*eDBget_sessionkey_macaddr) (eurephiaCTX *ctx, const char *macaddr); * * @return Returns 1 if the session key is unique and not been used earlier. */ -int (*eDBcheck_sessionkey_uniqueness) (eurephiaCTX *ctx, const char *seskey); +int EUREPHIA_DRIVERAPI_FUNC(eDBcheck_sessionkey_uniqueness)(eurephiaCTX *ctx, const char *seskey); /** @@ -304,7 +309,7 @@ int (*eDBcheck_sessionkey_uniqueness) (eurephiaCTX *ctx, const char *seskey); * * @return Returns 1 on success, otherwise 0 */ -int (*eDBregister_sessionkey) (eurephiaCTX *ctx, const char *seed, const char *seskey); +int EUREPHIA_DRIVERAPI_FUNC(eDBregister_sessionkey)(eurephiaCTX *ctx, const char *seed, const char *seskey); /** @@ -318,7 +323,7 @@ int (*eDBregister_sessionkey) (eurephiaCTX *ctx, const char *seed, const char *s * @return Returns a pointer to an eurephiaVALUES pointer chain with all the variables available * for the given session. On errors, it will return an empty eurephiaVALUES chain. */ -eurephiaVALUES *(*eDBload_sessiondata) (eurephiaCTX *ctx, const char *sesskey); +eurephiaVALUES * EUREPHIA_DRIVERAPI_FUNC(eDBload_sessiondata)(eurephiaCTX *ctx, const char *sesskey); /** @@ -331,7 +336,7 @@ eurephiaVALUES *(*eDBload_sessiondata) (eurephiaCTX *ctx, const char *sesskey); * * @return Returns 1 on success, otherwise 0. */ -int (*eDBdestroy_session) (eurephiaCTX *ctx, eurephiaSESSION *session); +int EUREPHIA_DRIVERAPI_FUNC(eDBdestroy_session)(eurephiaCTX *ctx, eurephiaSESSION *session); /** @@ -348,8 +353,9 @@ int (*eDBdestroy_session) (eurephiaCTX *ctx, eurephiaSESSION *session); * @return Returns 1 on success, otherwise 0 * @see SESSVAL_NEW, SESSVAL_UPDATE, SESSVAL_DELETE */ -int (*eDBstore_session_value)(eurephiaCTX *ctx, eurephiaSESSION *session, int mode, - const char *key, const char *val); +int EUREPHIA_DRIVERAPI_FUNC(eDBstore_session_value)(eurephiaCTX *ctx, eurephiaSESSION *session, int mode, + const char *key, const char *val); + /* * functions which needs to exists in the API level 2 @@ -403,7 +409,7 @@ int (*eDBstore_session_value)(eurephiaCTX *ctx, eurephiaSESSION *session, int mo * user will be returned in the details part of the ResultMsg. * */ -xmlDoc *(*eDBadminAuthenticate) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminAuthenticate)(eurephiaCTX *ctx, xmlDoc *qryxml); /** @@ -427,7 +433,7 @@ xmlDoc *(*eDBadminAuthenticate) (eurephiaCTX *ctx, xmlDoc *qryxml); * @return Returns a valid XML document with information about the operation, or NULL on fatal errors. * @see eurephiaXML_CreateDoc() */ -xmlDoc *(*eDBadminConfiguration)(eurephiaCTX *ctx, xmlDoc *cfgxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminConfiguration)(eurephiaCTX *ctx, xmlDoc *cfgxml); /** @@ -471,7 +477,7 @@ xmlDoc *(*eDBadminConfiguration)(eurephiaCTX *ctx, xmlDoc *cfgxml); * * @see eurephiaXML_CreateDoc(), eurephiaXML_ParseResultMsg(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminUserAccount) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminUserAccount)(eurephiaCTX *ctx, xmlDoc *qryxml); /** @@ -521,7 +527,7 @@ xmlDoc *(*eDBadminUserAccount) (eurephiaCTX *ctx, xmlDoc *qryxml); * * @see eurephiaXML_CreateDoc(), eurephiaXML_ParseResultMsg(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminCertificate) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminCertificate)(eurephiaCTX *ctx, xmlDoc *qryxml); /** @@ -550,7 +556,7 @@ xmlDoc *(*eDBadminCertificate) (eurephiaCTX *ctx, xmlDoc *qryxml); * with an error message will be returned or NULL. * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminUserCertsLink) (eurephiaCTX *ctx, xmlDoc *usrcrt_xml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminUserCertsLink)(eurephiaCTX *ctx, xmlDoc *usrcrt_xml); /** @@ -597,7 +603,7 @@ xmlDoc *(*eDBadminUserCertsLink) (eurephiaCTX *ctx, xmlDoc *usrcrt_xml); * On fatal errors NULL is returned. * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminAccessLevel) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminAccessLevel)(eurephiaCTX *ctx, xmlDoc *qryxml); /** @@ -624,7 +630,7 @@ xmlDoc *(*eDBadminAccessLevel) (eurephiaCTX *ctx, xmlDoc *qryxml); * NULL or an XML error document is returned. * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminFirewallProfiles) (eurephiaCTX *ctx, xmlDoc *xmlqry); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminFirewallProfiles)(eurephiaCTX *ctx, xmlDoc *xmlqry); /** @@ -650,7 +656,8 @@ xmlDoc *(*eDBadminFirewallProfiles) (eurephiaCTX *ctx, xmlDoc *xmlqry); * @return Returns a valid XML document on success, otherwise NULL * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminGetLastlog) (eurephiaCTX *ctx, xmlDoc *srch_xml, const char *sortkeys); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminGetLastlog)(eurephiaCTX *ctx, xmlDoc *srch_xml, + const char *sortkeys); /** @@ -676,7 +683,7 @@ xmlDoc *(*eDBadminGetLastlog) (eurephiaCTX *ctx, xmlDoc *srch_xml, const char *s * with an error message. * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminAttemptsLog) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminAttemptsLog)(eurephiaCTX *ctx, xmlDoc *qryxml); /** @@ -703,9 +710,7 @@ xmlDoc *(*eDBadminAttemptsLog) (eurephiaCTX *ctx, xmlDoc *qryxml); * with an error message. * @see eurephiaXML_CreateDoc(), eurephiaXML_getRoot() */ -xmlDoc *(*eDBadminBlacklist) (eurephiaCTX *ctx, xmlDoc *qryxml); +xmlDoc * EUREPHIA_DRIVERAPI_FUNC(eDBadminBlacklist)(eurephiaCTX *ctx, xmlDoc *qryxml); #endif /* HAVE_LIBXML2 */ -#endif /* !DRIVER_MODE */ - #endif /* !EUREPHIADB_DRIVER_H_ */ |
