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

CoreAccess.h

00001 // tacppd acl core layer
00002 // (c) Copyright 2000-2005 by tacppd team and contributors
00003 // see http://tacppd.org for more information
00004 //
00005 //  This program is free software; you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program; if not, write to the Free Software
00017 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // all comments which start from /**<CR> - this is comments for KDoc
00020 //  for classes
00021 //    @short [short description of the class]
00022 //    @author [class author]
00023 //    @version [class version]
00024 //    @see [references to other classes or methods]
00025 //  for methods
00026 //    @see [references]
00027 //    @return [sentence describing the return value]
00028 //    @exception [list the exeptions that could be thrown]
00029 //    @param [name id] [description] - can be multiple
00030 
00031 #ifndef __CORE_ACCESS_H__
00032 #define __CORE_ACCESS_H__
00033 
00034 #include "global.h"
00035 
00036 namespace tacpp {
00037 
00043 class Acl_entry {
00046   string permit_;
00049   string deny_;
00052   pthread_mutex_t Mutex_;
00055   void lock();
00058   void unlock();
00059  public:
00062   string getPermit();
00065   void setPermit(const string);
00068   string getDeny();
00071   void setDeny(const string);
00074   bool checkPermit(const string);
00077   bool checkDeny(const string);
00080   Acl_entry(const string,const string);
00083   ~Acl_entry();
00084 };
00085 
00091 class Acl_data {
00094   list<Acl_entry*> acl_;
00097   pthread_mutex_t Mutex_;
00100   void lock();
00103   void unlock();
00106   int number_;
00107  public:
00110   int getNumber();
00113   Acl_data(const int);
00116   ~Acl_data();
00119   bool check(const char*);
00122   string buildcfstr();
00125   bool add_permit(const char*);
00128   bool add_deny(const char*);
00131   bool del_permit(const char*);
00134   bool del_deny(const char*);
00135 };
00136 
00142 class CoreAccess : public Core_data {
00145   list<Acl_data*> acl_;
00148   pthread_mutex_t Mutex_;
00151   void lock();
00154   void unlock();
00155  public:
00158   CoreAccess(const string,const string);
00161   ~CoreAccess();
00164   bool add_permit(int,const char*);
00167   bool add_deny(int,const char*);
00170   void add(int);
00173   bool del(int);
00176   bool del_permit(int,const char*);
00179   bool del_deny(int,const char*);
00182   bool check(int,const char*);
00185   string buildcfstr(int);
00188   string applycf(char * const*mask,const string cmdname,const list<string>paramList,Command * cmd=NULL)throw (CmdErr);
00189 };
00190 
00191 };
00192 
00193 #endif // __CORE_ACCESS_H__

Generated on Thu Jul 21 23:09:45 2005 for tacppd.kdevelop by doxygen 1.3.5