Main Page | Data Structures | File List | Globals

include/userdb.h

00001 /*
00002 ** mouse:~ppr/src/include/userdb.h
00003 ** Copyright 1995, 1996, 1997, 1998, Trinity College Computing Center.
00004 ** Writen by David Chappell.
00005 **
00006 ** Permission to use, copy, modify, and distribute this software and its
00007 ** documentation for any purpose and without fee is hereby granted, provided
00008 ** that the above copyright notice appear in all copies and that both that
00009 ** copyright notice and this permission notice appear in supporting
00010 ** documentation.  This software is provided "as is" without express or
00011 ** implied warranty.
00012 **
00013 ** Last modified 13 October 1998.
00014 */
00015 
00016 /*
00017 ** The is a header file for modules which use the user account charge
00018 ** routines.  There are no configuration parameters in this file.
00019 */
00020 
00021 #include <time.h>
00022 
00023 enum USERDB_RESULT {
00024                 USER_ERROR = -2,                /* database error */
00025                 USER_ISNT = -1,                 /* user not found */
00026                 USER_OK = 0,                    /* user exists, action sucessful */
00027                 USER_OVERDRAWN = 1              /* user exists and is overdrawn */
00028                 } ;
00029 
00030 enum TRANSACTION {
00031                 TRANSACTION_CHARGE = 0,
00032                 TRANSACTION_DEPOSIT = 1,
00033                 TRANSACTION_WITHDRAWAL = 2,
00034                 TRANSACTION_CORRECTION = 3
00035                 } ;
00036 
00037 #define MAX_AUTHCODE 16
00038 #define MAX_FULLNAME 32
00039 
00040 struct userdb
00041         {
00042         char authcode[MAX_AUTHCODE+1];          /* 16 characters and one null */
00043         char fullname[MAX_FULLNAME+1];          /* 32 characters and one null */
00044         int balance;                    /* balance x 100 */
00045         int cutoff;                             /* credit cutoff point x 100 */
00046         char revoked;                   /* TRUE or FALSE, credit revoked */
00047         time_t last_mod;                /* date of last modification */
00048         int lifetime;                   /* days of inactivity allowed before delete */
00049         } ;
00050 
00051 char *dbstrlower(const char *s);
00052 enum USERDB_RESULT db_auth(struct userdb *user, const char *username);
00053 enum USERDB_RESULT db_add_user(const char *username, struct userdb *user);
00054 enum USERDB_RESULT db_delete_user(const char *username);
00055 enum USERDB_RESULT db_transaction(const char *username, int amount, enum TRANSACTION transaction_type);
00056 enum USERDB_RESULT db_new_authcode(const char *username, const char *newauthcode);
00057 
00058 /* end of file */
00059 

Generated on Fri Feb 20 15:17:49 2004 for PPR Libraries by doxygen 1.3.5