diff options
Diffstat (limited to 'Master/Masterarbeit/src/XorayaLogPlugin/CXorayaLogPlugin.h')
| -rw-r--r-- | Master/Masterarbeit/src/XorayaLogPlugin/CXorayaLogPlugin.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Master/Masterarbeit/src/XorayaLogPlugin/CXorayaLogPlugin.h b/Master/Masterarbeit/src/XorayaLogPlugin/CXorayaLogPlugin.h new file mode 100644 index 0000000..da97fd1 --- /dev/null +++ b/Master/Masterarbeit/src/XorayaLogPlugin/CXorayaLogPlugin.h @@ -0,0 +1,67 @@ +/*
+ * CXorayaLogPlugin.h
+ *
+ * Created on: 25.10.2011
+ * Author: Eisenhauer
+ */
+
+#ifndef CXORAYALOGPLUGIN_H_
+#define CXORAYALOGPLUGIN_H_
+
+#include <boost/thread.hpp>
+#include <x2e/sys/Mutex.hpp>
+#include "bounded_buffer.hpp"
+#include "global.h"
+#include "plugin_api.h"
+
+#define nLOG_MSG_BUFFER_SIZE 8192
+#define nINT_BUFF_SIZE 4096
+#define nLOGFILENAME_LENGTH 256
+
+class IInterfaceManager;
+class IPluginExecutor;
+
+class CXorayaLogPlugin: public IPlugin {
+public:
+ CXorayaLogPlugin();
+ virtual ~CXorayaLogPlugin();
+ virtual void vRun();
+ virtual tpstCanTxMessage pxGetCanTxMessage( const uint32_t u32MsgIndex )
+ {
+ return NULL;
+ }
+ virtual uint32_t u32GetNumOfCanTxMessages( void )
+ {
+ return 0;
+ }
+ virtual bool boIsLogger( void ) { return true; }
+ virtual bool boAutoload( void ) { return true; }
+ virtual int32_t i32GetCanInterfaceHandle( void );
+ virtual tenRetCodes enGetLog(const char*, char*);
+ virtual void vInit(void* pvExecutor, void* pvIfMan, int32_t i32Interface,uint32_t u32PluginId);
+ void vStopIOThread();
+ void vStop();
+ virtual void vLogMessage(const tstLogMessage& stLogMessage);
+
+private:
+ IInterfaceManager* m_pxIfMan;
+ IPluginExecutor* m_pxExec;
+ uint32_t m_u32PluginId;
+ bool m_boStopIOThread;
+ x2e::Mutex m_xStopIOFlagMutex;
+ x2e::Mutex m_xLogBufferMutex;
+ int m_iFd;
+ char m_acLogBuffer[nINT_BUFF_SIZE];
+ char m_acLogfileName[nLOGFILENAME_LENGTH];
+ uint32_t m_u32LogMsgBufferCounter;
+
+ bounded_buffer<tstLogMessage> m_xLogMsgBuffer;
+ boost::function<void()> m_fctThreadProc;
+ boost::thread m_xIoThread;
+
+ void vIoThreadProc();
+ void vInitLogfile();
+ tenRetCodes enRotateLogfile();
+};
+
+#endif /* CXORAYALOGPLUGIN_H_ */
|
