1 /* 2 * Copyright 2003-2015, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SYSLOG_DAEMON_H_ 6 #define _SYSLOG_DAEMON_H_ 7 8 9 #include <Locker.h> 10 #include <List.h> 11 #include <Server.h> 12 #include <OS.h> 13 14 #include <syslog_daemon.h> 15 16 17 typedef void (*handler_func)(syslog_message&); 18 19 20 class SyslogDaemon : public BServer { 21 public: 22 SyslogDaemon(); 23 24 virtual void ReadyToRun(); 25 virtual void AboutRequested(); 26 virtual bool QuitRequested(); 27 virtual void MessageReceived(BMessage* message); 28 29 void AddHandler(handler_func function); 30 31 private: 32 void _Daemon(); 33 static int32 _DaemonThread(void* data); 34 35 private: 36 thread_id fDaemon; 37 port_id fPort; 38 39 BLocker fHandlerLock; 40 BList fHandlers; 41 }; 42 43 44 #endif /* _SYSLOG_DAEMON_H_ */ 45