log.h

00001 /***************************************************************************
00002 *   Copyright (C) 2005 by                                                 *
00003 *   Pedro J. Fernandez Ruiz    pedroj.fernandez@dif.um.es                 *
00004 *   Alejandro Perez Mendez     alejandro_perez@dif.um.es                  *
00005 *                                                                         *
00006 *   This library is free software; you can redistribute it and/or         *
00007 *   modify it under the terms of the GNU Lesser General Public            *
00008 *   License as published by the Free Software Foundation; either          *
00009 *   version 2.1 of the License, or (at your option) any later version.    *
00010 *                                                                         *
00011 *   This library is distributed in the hope that it will be useful,       *
00012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014 *   Lesser General Public License for more details.                       *
00015 *                                                                         *
00016 *   You should have received a copy of the GNU Lesser General Public      *
00017 *   License along with this library; if not, write to the Free Software   *
00018 *   Foundation, Inc., 51 Franklin St, Fifth Floor,                        *
00019 *   Boston, MA  02110-1301  USA                                           *
00020 ***************************************************************************/
00021 #ifndef LOG_H
00022 #define LOG_H
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include "config.h"
00026 #endif
00027 
00028 #include <iostream>
00029 #include <cstdlib>
00030 #include <stdint.h>
00031 #include <sstream>
00032 
00033 #include "mutex.h"
00034 
00035 #include <memory>
00036 
00037 using namespace std;
00038 
00039 namespace openikev2 {
00040     // Forward some classes
00041     typedef class IkeSaController;
00042     typedef class Alarm;
00043     typedef class ChildSa;
00044     typedef class IkeSaExecuter;
00045     typedef class LogImpl;
00046 
00051     class Log {
00052 
00053             /****************************** ENUMS ******************************/
00054         public:
00056             enum LOG_TYPE{
00057                 LOG_NONE = 0x0000,       
00058                 LOG_INFO = 0x0001,       
00059                 LOG_MESG = 0x0002,       
00060                 LOG_STAT = 0x0004,       
00061                 LOG_CRYP = 0x0008,       
00062                 LOG_THRD = 0x0010,       
00063                 LOG_ERRO = 0x0020,       
00064                 LOG_ALRM = 0x0040,       
00065                 LOG_DHCP = 0x0080,       
00066                 LOG_IPSC = 0x0100,       
00067                 LOG_HALF = 0x0200,       
00068                 LOG_POLI = 0x0400,       
00069                 LOG_EBUS = 0x0800,       
00070                 LOG_CONF = 0x1000,       
00071                 LOG_WARN = 0x2000,       
00072                 LOG_ALL = 0xFFFF,        
00073         };
00074 
00075             /****************************** ATTRIBUTES ******************************/
00076         protected:
00077             static auto_ptr<LogImpl> implementation;    
00078             static auto_ptr<Mutex> log_mutex;           
00080             /****************************** METHODS ******************************/
00081         public:
00087             static string LOG_TYPE_STR( uint16_t type );
00088 
00093             static void setImplementation( auto_ptr<LogImpl> implementation );
00094             
00099             static void setLogMask( uint16_t log_mask );
00100 
00105             static void showExtraInfo( bool extra );
00106 
00114             static void writeMessage( string who, string message, uint16_t type, bool main_info );
00115 
00123             static void writeLockedMessage( string who, string message, uint16_t type, bool main_info );
00124 
00129             static void open( string file_name );
00130 
00134             static void close();
00135 
00139             static void acquire();
00140 
00144             static void release();
00145             
00153             static void writeMessage( IkeSaController& ike_sa_controller, string message, uint16_t type, bool main_info );
00154             
00162             static void writeLockedMessage( IkeSaController& ike_sa_controller, string message, uint16_t type, bool main_info );
00163 
00171             static void writeMessage( Alarm& alarm, string message, uint16_t type, bool main_info );
00172             
00180             static void writeLockedMessage( Alarm& alarm, string message, uint16_t type, bool main_info );
00181 
00189             static void writeMessage( ChildSa& childsa, string message, uint16_t type, bool main_info );
00190             
00198             static void writeLockedMessage( ChildSa& childsa, string message, uint16_t type, bool main_info );
00199 
00207             static void writeMessage( IkeSaExecuter& ike_sa_executer, string message, uint16_t type, bool main_info );
00208             
00216             static void writeLockedMessage( IkeSaExecuter& command_executer, string message, uint16_t type, bool main_info );
00217     };
00218 }
00219 
00220 #endif

Generated on Fri Jul 27 11:04:44 2007 for libopenikev2 by  doxygen 1.5.1