eurephiadb_driver.h

Go to the documentation of this file.
00001 /* eurephiadb_driver.h  --  API provided by the database driver
00002  *
00003  *  GPLv2 only - Copyright (C) 2008 - 2010
00004  *               David Sommerseth <dazo@users.sourceforge.net>
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; version 2
00009  *  of the License.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 */
00020 
00031 #include <eurephia_context.h>
00032 #include <eurephiadb_session_struct.h>
00033 #include <eurephia_values_struct.h>
00034 
00035 #ifdef HAVE_LIBXML2
00036 #include <libxml/tree.h>
00037 #endif
00038 
00039 #ifndef EUREPHIADB_DRIVER_H_
00040 #define EUREPHIADB_DRIVER_H_
00041 
00042 #define attempt_IPADDR      1   
00043 #define attempt_CERTIFICATE 2   
00044 #define attempt_USERNAME    3   
00046 #define ATTEMPT_RESET    0x0A   
00047 #define ATTEMPT_REGISTER 0x0B   
00049 #define USERINFO_user       0x01 
00050 #define USERINFO_certs      0x02 
00051 #define USERINFO_lastlog    0x04 
00052 #define USERINFO_attempts   0x08 
00053 #define USERINFO_blacklist  0x10 
00055 #ifndef DRIVER_MODE
00056 
00062 const char *(*eDB_DriverVersion) (void);
00063 
00064 
00070 int (*eDB_DriverAPIVersion) (void);
00071 
00072 /*
00073  *    functions which needs to exists in the API level 1
00074  */
00075 
00087 int (*eDBconnect) (eurephiaCTX *ctx, const int argc, const char **argv);
00088 
00096 void (*eDBdisconnect) (eurephiaCTX *ctx);
00097 
00113 int (*eDBauth_TLS) (eurephiaCTX *ctx, const char *org, const char *cname, const char *email,
00114                     const char *digest, const unsigned int depth);
00115 
00128 int (*eDBauth_user) (eurephiaCTX *ctx, const int certid, const char *username, const char *passwd);
00129 
00130 
00141 int (*eDBget_uid) (eurephiaCTX *ctx, const int certid, const char *username);
00142 
00143 
00157 int (*eDBblacklist_check) (eurephiaCTX *ctx, const int type, const char *val);
00158 
00159 
00173 void (*eDBregister_attempt) (eurephiaCTX *ctx, int type, int mode, const char *value);
00174 
00175 
00193 int (*eDBregister_login) (eurephiaCTX *ctx, eurephiaSESSION *skey, const int certid, const int uid,
00194                           const char *proto, const char *remipaddr, const char *remport,
00195                           const char *vpnipaddr, const char *vpnipmask);
00196 
00197 
00209 int (*eDBregister_vpnmacaddr) (eurephiaCTX *ctx, eurephiaSESSION *session, const char *macaddr);
00210 
00211 
00225 int (*eDBregister_logout) (eurephiaCTX *ctx, eurephiaSESSION *skey,
00226                            const char *bytes_sent, const char *bytes_received, const char *duration);
00227 
00228 
00229 /* firewall functions */
00241 char *(*eDBget_firewall_profile) (eurephiaCTX *ctx, eurephiaSESSION *session);
00242 
00252 eurephiaVALUES *(*eDBget_blacklisted_ip) (eurephiaCTX *ctx);
00253 
00254 /* The following functions is also declared in eurephia_session_values.c - for local internal usage. */
00267 char *(*eDBget_sessionkey_seed) (eurephiaCTX *ctx, sessionType type, const char *sessionseed);
00268 
00269 
00281 char *(*eDBget_sessionkey_macaddr) (eurephiaCTX *ctx, const char *macaddr);
00282 
00283 
00294 int (*eDBcheck_sessionkey_uniqueness) (eurephiaCTX *ctx, const char *seskey);
00295 
00296 
00307 int (*eDBregister_sessionkey) (eurephiaCTX *ctx, const char *seed, const char *seskey);
00308 
00309 
00321 eurephiaVALUES *(*eDBload_sessiondata) (eurephiaCTX *ctx, const char *sesskey);
00322 
00323 
00334 int (*eDBdestroy_session) (eurephiaCTX *ctx, eurephiaSESSION *session);
00335 
00336 
00351 int (*eDBstore_session_value)(eurephiaCTX *ctx, eurephiaSESSION *session, int mode,
00352                               const char *key, const char *val);
00353 
00354 /*
00355  *    functions which needs to exists in the API level 2
00356  */
00357 #ifdef HAVE_LIBXML2
00358 
00406 xmlDoc *(*eDBadminAuthenticate) (eurephiaCTX *ctx, xmlDoc *qryxml);
00407 
00408 
00430 xmlDoc *(*eDBadminConfiguration)(eurephiaCTX *ctx, xmlDoc *cfgxml);
00431 
00432 
00474 xmlDoc *(*eDBadminUserAccount) (eurephiaCTX *ctx, xmlDoc *qryxml);
00475 
00476 
00524 xmlDoc *(*eDBadminCertificate) (eurephiaCTX *ctx, xmlDoc *qryxml);
00525 
00526 
00553 xmlDoc *(*eDBadminUserCertsLink) (eurephiaCTX *ctx, xmlDoc *usrcrt_xml);
00554 
00555 
00600 xmlDoc *(*eDBadminAccessLevel) (eurephiaCTX *ctx, xmlDoc *qryxml);
00601 
00602 
00627 xmlDoc *(*eDBadminFirewallProfiles) (eurephiaCTX *ctx, xmlDoc *xmlqry);
00628 
00629 
00653 xmlDoc *(*eDBadminGetLastlog) (eurephiaCTX *ctx, xmlDoc *srch_xml, const char *sortkeys);
00654 
00655 
00679 xmlDoc *(*eDBadminAttemptsLog) (eurephiaCTX *ctx, xmlDoc *qryxml);
00680 
00681 
00706 xmlDoc *(*eDBadminBlacklist) (eurephiaCTX *ctx, xmlDoc *qryxml);
00707 #endif /* HAVE_LIBXML2 */
00708 
00709 #endif /* !DRIVER_MODE */
00710 
00711 #endif /* !EUREPHIADB_DRIVER_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines