UniSet  2.0.0
LogServerTypes.h
00001 // -------------------------------------------------------------------------
00002 #ifndef LogServerTypes_H_
00003 #define LogServerTypes_H_
00004 // -------------------------------------------------------------------------
00005 #include <ostream>
00006 #include <cstring>
00007 // -------------------------------------------------------------------------
00008 namespace LogServerTypes
00009 {
00010     const unsigned int MAGICNUM = 0x20140904;
00011     enum Command
00012     {
00013         cmdNOP,            
00014         cmdSetLevel,    
00015         cmdAddLevel,    
00016         cmdDelLevel,    
00017         cmdRotate,        
00018         cmdOffLogFile,    
00019         cmdOnLogFile    
00020         // cmdSetLogFile
00021     };
00022 
00023     std::ostream& operator<<(std::ostream& os, Command c );
00024 
00025     struct lsMessage
00026     {
00027         lsMessage():magic(MAGICNUM),cmd(cmdNOP),data(0){ std::memset(logname,0,sizeof(logname)); }
00028         unsigned int magic;
00029         Command cmd;
00030         unsigned int data;
00031 
00032         static const size_t MAXLOGNAME = 20;
00033         char logname[MAXLOGNAME+1]; // +1 reserverd for '\0'
00034 
00035         void setLogName( const std::string& name );
00036 
00037         // для команды 'cmdSetLogFile'
00038         // static const size_t MAXLOGFILENAME = 200;
00039         // char logfile[MAXLOGFILENAME];
00040     }__attribute__((packed));
00041 
00042     std::ostream& operator<<(std::ostream& os, lsMessage& m );
00043 }
00044 // -------------------------------------------------------------------------
00045 #endif // LogServerTypes_H_
00046 // -------------------------------------------------------------------------