Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

DbAdmin.h

00001 /* -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */
00002 /*
00003  * DbAdmin.h
00004  *   Class for database interaction from the CGI and the admin tool.
00005  *
00006  * $Id: DbAdmin.h,v 1.12 2002/03/30 22:21:17 benoit Exp $
00007  *
00008  * Copyright (c) 2000-2001 Remi Lefebvre <remi@ddts.org>
00009  * Copyright (c) 2000 Benoit Joly <benoit@dhis.net>
00010  *
00011  * Licensed under the GPLv2
00012  */
00013 
00014 #ifndef DBADMIN_H
00015 #define DBADMIN_H
00016 
00017 #include <opt.h>
00018 #include <openssl/md5.h>
00019 #include <arpa/inet.h> // for string to ip conversion
00020 
00021 // general defines
00022 #include "global.h"
00023 
00024 #include "Exception.h"
00025 #include "Logger.h"
00026 
00027 #include "DdtManager.h"
00028 #include "Validate.h"
00029 
00030 #define CONF_FILE "cgi.conf"
00031 
00032 class DbAdmin
00033 {
00034 public:
00035 
00036     // default constructor
00037     DbAdmin(Logger *, char *, char *, char *, char *, char *, char *);
00038 
00039     // destructor
00040     ~DbAdmin();
00041 
00042     /* These are for the CGI exclusively */
00043     
00044     // verify password
00045     int checkPasswd(int id, char *aPass, char *aPassMd5);
00046 
00047     // hash password and verify confirmation
00048     int hashPassword(const char *Pass, const char *PassConfirm, 
00049                      char *PassMd5);
00050 
00051     /**************************************/
00052 
00053     /* These are for the admn tool exclusively */
00054 
00055     // dump information concerning given uid
00056     int dumpInfo(int id);
00057 
00058     /*****************************************/
00059 
00060     /* The rest is for both */
00061     
00062     // add an account
00063     bool addAccount(userAccount *newAccount, const char *baseDomain);
00064 
00065     // update an account
00066     bool updateAccount(userAccount *newAccount, const char *baseDomain);
00067 
00068     // remove an account
00069     int removeAccount(int id);
00070 
00071     // records operations
00072     int addDnsRecord(int id, const char *dname, DnsRecordType type, 
00073                      const char *data, const char *baseDomain);
00074 
00075     int delDnsRecord(int id, const char *dname, DnsRecordType type,
00076                      const char *data);
00077 
00078     // fetch account information
00079     bool getAcctInfo(int id, userAccount *account);
00080 
00081 
00082     
00083 private:
00084     Logger *log;
00085     Db *db;
00086     Dns *dns;
00087     DdtManager *manager;
00088     Validate *check;
00089 
00090 //    regex_t *reg;
00091 };
00092 
00093 
00094 #endif // DBADMIN_H

Generated on Tue Sep 13 01:32:46 2005 for DDT Project by  doxygen 1.4.4