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

CorePool.h

00001 // This is part of tacppd project (extended tacacs++ server)
00002 // (c) Copyright 2000-2004 by tacppd team and contributors
00003 // see http://tacppd.org for more information
00004 //
00005 // file: CorePool.h
00006 // description: ip address pool
00007 
00008 //  This program is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License as published by
00010 //  the Free Software Foundation; either version 2 of the License, or
00011 //  (at your option) any later version.
00012 //
00013 //  This program is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //  GNU General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU General Public License
00019 //  along with this program; if not, write to the Free Software
00020 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 // modifications:
00023 //
00024 
00025 // all comments which start from /** - this is comments for KDoc
00026 //  for classes
00027 //    @short [short description of the class]
00028 //    @author [class author]
00029 //    @version [class version]
00030 //    @see [references to other classes or methods]
00031 //  for methods
00032 //    @see [references]
00033 //    @return [sentence describing the return value]
00034 //    @exception [list the exeptions that could be thrown]
00035 //    @param [name id] [description]    - can be multiple
00036 
00037 #ifndef __CORE_POOL_H__
00038 #define __CORE_POOL_H__
00039 
00040 #include "global.h"
00041 
00042 namespace tacpp {
00043 
00049 class Addrpool_entry {
00052   pthread_mutex_t mutex_;
00055   void lock();
00058   void unlock();
00061   ipaddr address_;
00064   bool tag_;
00065  public:
00068   void setAddress(ipaddr);
00071   ipaddr getAddress();
00074   void setTag(bool);
00077   bool getTag();
00080   Addrpool_entry(ipaddr);
00083   ~Addrpool_entry();
00084 };
00085 
00091 class Addrpool_data {
00094   pthread_mutex_t mutex_;
00097   void lock();
00100   void unlock();
00103   list<Addrpool_entry*> ae_;
00106   int pool_;
00107  public:
00110   int getPool();
00113   void setPool(int);
00116   Addrpool_data(int);
00119   ~Addrpool_data();
00122   void add(ipaddr);
00125   void del(ipaddr);
00128   string get();
00131   void ret(ipaddr);
00134   string buildcfstr();
00137   string group();
00138 };
00139 
00145 class CorePool : public Core_data {
00148   list<Addrpool_data*> ap_;
00151   string getAddr(const char*,int);
00154   pthread_mutex_t mutex_;
00157   void lock();
00160   void unlock();
00161  public:
00164   CorePool(const string,const string);
00167   ~CorePool();
00170   void add(int,const char*);
00173   void del(int);
00176   void del(int,const char*);
00179   string get(int);
00182   void ret(ipaddr);
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_POOL_H__

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