75 lines
1.4 KiB
C++
75 lines
1.4 KiB
C++
//
|
|
// Log Daemon
|
|
// Neal Probert
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __LogDaemon__
|
|
#define __LogDaemon__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "UdpDaemon.h"
|
|
#include "LogData.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
#define LOGD_NAME "logd"
|
|
#define LOGD_SERVICE "logd"
|
|
#ifndef LOGD_PORT
|
|
#define LOGD_PORT "2940"
|
|
#endif
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
//
|
|
// Listens to OBE HeartBeat messages
|
|
//
|
|
class LogDaemon : public UdpDaemon {
|
|
// public data
|
|
public:
|
|
|
|
// private data
|
|
private:
|
|
// Logging output
|
|
LogData Log;
|
|
|
|
// log playback
|
|
char logbuf[512];
|
|
timeval loglast;
|
|
unsigned int logcount;
|
|
|
|
// private methods
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
LogDaemon();
|
|
|
|
// destructor
|
|
virtual ~LogDaemon();
|
|
|
|
// virtual functions
|
|
int ClientInOut( char *buf, int n, int max );
|
|
|
|
// public methods
|
|
int LogOpen( const char *uri );
|
|
int LogWrite( const char *log ) { return Log.LogWrite(log,strlen(log)); };
|
|
void SetBinary(void) { Log.SetBinary(); };
|
|
|
|
int LogPlayback( void );
|
|
|
|
// static methods
|
|
|
|
// private methods
|
|
private:
|
|
};
|
|
|
|
#endif
|