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

global.h

00001 // This is part of tacppd project (extended tacacs++ daemon)
00002 // (c) Copyright in 2000-2004 by tacppd team and contributors
00003 // see http://tacppd.org for more information
00004 //
00005 // file: global.h
00006 // description: some common definitions
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 #ifndef __global_H__
00026 #define __global_H__
00027 
00028 //#include "../version.h"
00029 
00030 #ifndef _PTHREADS
00031   #define   _PTHREADS   // enable STL pthread-safe code
00032 #endif //_PTHREADS
00033 
00034 // set pthread-safe stdlibs
00035 #ifndef _REENTRANT
00036   #define       _REENTRANT    
00037 #endif //_REENTRANT
00038 
00039 // set posix threads safe code in glibc
00040 //#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
00041 //#define _POSIX_THREAD_SAFE_FUNCTIONS
00042 //#endif // _POSIX_THREAD_SAFE_FUNCTIONS
00043 
00044 
00045 //#ifdef __linux__
00046 //  #define _GNU_SOURCE
00047 //  #include <features.h>
00048 //#endif __linux__
00049 
00050 #ifdef FREEBSD
00051   typedef int socken_t;    // FreeBSD use int for socket
00052   #include <sys/param.h>
00053 #endif //FREEBSD
00054 
00055 #define MAINDIR_LEN     200
00056 
00057 #ifndef MAINDIR_DEF
00058   #define MAINDIR_DEF      "."
00059 #endif //MAINDIR_DEF
00060 
00061 #define DEF_CONFIG_FILE     "etc/tacpp.conf"
00062 #define DEF_ERROR_FILE      "log/debug.log"
00063 
00064 #define PATH_TO_DB_MODULES  "db"
00065 #define PATH_TO_TMP         "tmp"
00066 
00067 const int MAX_AVP = 100;   // max number of avpairs
00068 
00069 const int USERNAME_LEN = 32;    // max username length
00070 const int AUTHTYPE_LEN = 5;     // authen type str len
00071 const int PASSWORD_LEN = 50;    // max password length
00072 const int PORT_LEN = 32;        // max portname length
00073 const int REM_ADDR_LEN = 32;    // max rem_addr length (AS5300 store user phone)
00074 const int DATA_LEN = 254;   // data field in tacacs+ length
00075 const int IP_LEN = 16;    // ip addr len
00076 const int SERVICE_LEN = 15;    // service len
00077 const int PROTOCOL_LEN = 15;    // protocol len
00078 const int TIMECHECK_LEN = 50;    // timecheck (cron style)
00079 const int MAX_FROM = 32;    // rules number in from check
00080 const int RESATTR_LEN = 32;    // длина аттрибута ресурса
00081 const int RESVAL_LEN = 32;    // длина char* значения ресурса
00082 const int CRYPTOKEY_LEN = 32;    // crypto key length
00083 
00084 //#define UNKNOWN_IP      "0.0.0.0"
00085 
00086 #include <cstdio>
00087 #include <locale.h>
00088 #include <pthread.h>
00089 #include <iostream>
00090 //using std::cout;
00091 //using std::endl;
00092 #include <string>
00093 
00094 #include <fstream>
00095 //#include <strstream>
00096 
00097 #ifdef HAVE_SSTREAM
00098 #include <sstream>
00099 #else
00100 #include <strstream>
00101 #endif
00102 
00103 #ifdef SOLARIS
00104   #include <strings.h>
00105   #include <netinet/in.h>
00106   #include <netinet/ip.h>
00107   #include <netinet/in_systm.h>
00108 #endif
00109 
00110 #ifdef WITH_XMLRPC
00111   #include <XmlRpc.h>
00112   using namespace XmlRpc;
00113 #endif //WITH_XMLRPC
00114 
00115 #include <vector>
00116 #include <stack>
00117 #include <list>
00118 #include <map>
00119 
00120 namespace tacpp {};       // do next string happy
00121 using namespace tacpp;
00122 //using namespace std;
00123 using std::list;
00124 using std::cerr;
00125 using std::cout;
00126 using std::endl;
00127 using std::string;
00128 using std::vector;
00129 using std::less;
00130 using std::map;
00131 using std::ifstream;
00132 using std::istringstream;
00133 
00134 #include "ipaddr.h"
00135 
00136 #include <sys/stat.h>
00137 #include <ctype.h>
00138 #include <fcntl.h>
00139 #include <signal.h>
00140 #include <sys/types.h>
00141 #include <sys/wait.h>
00142 #include <errno.h>
00143 #include <sys/time.h>
00144 #include <cstdarg>
00145 #include <netinet/in.h>
00146 
00147 #ifdef FREEBSD
00148 #include <netinet/in_systm.h>
00149 #include <netinet/ip.h>
00150 #endif //FREEBSD
00151 
00152 #include <netinet/ip_icmp.h>
00153 #include <netdb.h>
00154 #include <sys/socket.h>
00155 #include <arpa/inet.h>
00156 #include <dlfcn.h>
00157 #include <regex.h>
00158 #include <syslog.h>
00159 
00160 #ifdef FREEBSD
00161 #include <sys/types.h>
00162 #include <netinet/in_systm.h>
00163 #include <netinet/in.h>
00164 #include <netinet/ip.h>
00165 #endif //FREEBSD
00166 
00167 //#ifndef USE_OPENSSL
00168 //#include "md5.h"
00169 //#else
00170 #define MD5_LEN 16
00171 #include <openssl/md5.h>
00172 //#endif // USE_OPENSSL
00173 
00174 #ifdef WITH_CCARD
00175 #ifdef HAVE_DES_H
00176 #include <des.h>
00177 #else
00178 #include <unistd.h>
00179 #endif //HAVE_DES_H
00180 #endif //WITH_CCARD
00181 
00182 #include <expat.h>
00183 
00184 #include "Errors.h"
00185 #include "Utils.h"
00186 #include "Debug.h"
00187 #include "Packet.h"
00188 #include "ServerTrack.h"
00189 #include "Logging.h"
00190 #include "LogTerm.h"
00191 #include "Vty.h"
00192 #include "Command.h"
00193 #include "Terminal.h"
00194 #include "Cli.h"
00195 #include "LogFile.h"
00196 #include "LogSyslog.h"
00197 #include "DLoad.h"
00198 #include "db_module.h"
00199 //#include "DbModule.h"
00200 #include "NetFlow.h"
00201 #include "TacDb.h"
00202 #include "AAA.h"
00203 #include "Tacacs.h"
00204 #include "Tci.h"
00205 #include "App.h"
00206 #include "Listener.h"
00207 #include "CoreData.h"
00208 #include "CoreAccess.h"
00209 #include "CorePool.h"
00210 #include "CoreDb.h"
00211 #include "CoreDebug.h"
00212 #include "CoreManager.h"
00213 #include "CoreDevice.h"
00214 #include "CoreListener.h"
00215 #include "CorePeer.h"
00216 #include "CoreBundle.h"
00217 #include "CoreBilling.h"
00218 #include "Daemon.h"
00219 #include "Icmp.h"
00220 #include "Snmp.h"
00221 #include "Http.h"
00222 #include "XmlServer.h"
00223 #include "UserTrack.h"
00224 #include "AModify.h"
00225 #include "Tiep.h"
00226 
00227 typedef char* char_ptr;
00228 
00229 namespace tacpp {
00230   extern CoreData *coreData;
00231   extern char MAINDIR[MAINDIR_LEN];
00232   extern Logging logSystem;
00233   extern LogFile *logFileSystem;
00234   extern LogSyslog *logSyslogSystem;
00235   extern LogTerm *logTermSystem;
00236   extern Snmp snmpSystem;
00237   extern UserTrack userTrack;
00238 //extern DeviceTrack deviceTrack;
00239 //extern pthread_mutex_t AbsMutex;
00240   extern ServerTrack serverTrack;
00241   extern NfAggregator nfAggregator;
00242 };
00243 
00244 #define TLOG      ::logSystem.log
00245 #define TLOG2     ::logSystem
00246 #define endlog    ::logSystem.Logging_end_endlog()
00247 #define setlog(a) ::logSystem.Logging_set_setlog(a)
00248 #define startlog(a) TLOG2<<setlog(a)
00249 
00250 #endif //__global_H__

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