UniSet  2.0.0
LogReader.h
00001 #ifndef LogReader_H_
00002 #define LogReader_H_
00003 // -------------------------------------------------------------------------
00004 #include <string>
00005 #include <queue>
00006 #include <cc++/socket.h>
00007 #include "UTCPStream.h"
00008 #include "DebugStream.h"
00009 #include "LogServerTypes.h"
00010 // -------------------------------------------------------------------------
00011 class LogReader
00012 {
00013     public:
00014 
00015         LogReader();
00016         ~LogReader();
00017 
00018         void readlogs( const std::string& addr, ost::tpport_t port, 
00019                        LogServerTypes::Command c = LogServerTypes::cmdNOP, 
00020                        int data = 0, 
00021                        const std::string& logname="", 
00022                        bool verbose = false );
00023 
00024         void readlogs( const std::string& addr, ost::tpport_t port, LogServerTypes::lsMessage& m, bool verbose = false );
00025 
00026         bool isConnection();
00027 
00028         inline void setCommandOnlyMode( bool s ){ cmdonly = s; }
00029 
00030     protected:
00031 
00032         void connect( const std::string& addr, ost::tpport_t port, timeout_t tout=TIMEOUT_INF );
00033         void connect( ost::InetAddress addr, ost::tpport_t port, timeout_t tout=TIMEOUT_INF );
00034         void disconnect();
00035 
00036     private:
00037         UTCPStream* tcp;
00038         std::string iaddr;
00039         ost::tpport_t port;
00040         bool cmdonly;
00041 
00042         DebugStream rlog;
00043 };
00044 // -------------------------------------------------------------------------
00045 #endif // LogReader_H_
00046 // -------------------------------------------------------------------------