Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

syslogfilter.h

Go to the documentation of this file.
00001 // ========================================================================
00002 // copyright (C) 1999-2003 by Tobias Erbsland <te@profzone.ch>
00003 // ------------------------------------------------------------------------
00004 // This program is free software; you can redistribute it and/or modify it
00005 // under the terms of the GNU General Public License as published by the
00006 // Free Software Foundation; either version 2 of the License, or (at your
00007 // option) any later version.
00008 // ========================================================================
00009 
00010 #ifndef SYSLOGFILTER_H
00011 #define SYSLOGFILTER_H
00012 #ifdef HAVE_CONFIG_H
00013 #include <config.h>
00014 #endif
00015 
00016 #include <fstream>
00017 #include <string>
00018 #include <filter.h>
00019 
00025 class syslogFilter : public Filter
00026 {
00027 
00028 private:
00029 
00030   const char * const strPrefix;
00031   const char * const strName;
00032   const char * const strVersion;
00033   const char * const strAuthor;
00034   const char * const strHelp;
00035 
00036   const char * const intern_mail_suffix;
00037 
00038   struct logline_t
00039   {
00040     time_t time;
00041     std::string host;
00042     std::string command;
00043     long pid;
00044     std::string message;
00045   };
00046 
00047   class endOfLog { };
00048 
00049   std::map< std::string, std::string > transtable;
00050 
00051   int intYear; // Store current Year.
00052 
00053   int readTwoChars( std::istream &streamin );
00054   logline_t getLogLine( std::istream &streamin );
00055   void sendmail( const time_t time, const std::string &line );
00056   std::string translate( const std::string &email );
00057   sendmail_t splitup( std::string line );
00058 
00059 public:
00060 
00061   syslogFilter();
00062 
00063   virtual const char * Prefix( void ) const { return strPrefix; };
00064   virtual const char * Name( void ) const { return strName; };
00065   virtual const char * Version( void ) const { return strVersion; };
00066   virtual const char * Author( void ) const { return strAuthor; };
00067   virtual const char * Help( void ) const { return strHelp; };
00068 
00069   virtual bool run( void );
00070 
00071   virtual ~syslogFilter() { };
00072 };
00073 
00074 #endif

Generated on Wed Oct 15 13:54:51 2003 for Anteater.kdevelop by doxygen1.2.18