1 /* 2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the OpenBeOS License. 4 */ 5 #ifndef _SYSLOG_DAEMON_H_ 6 #define _SYSLOG_DAEMON_H_ 7 8 9 #include <Application.h> 10 #include <Locker.h> 11 #include <List.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 BApplication { 21 public: 22 SyslogDaemon(); 23 24 virtual void ReadyToRun(); 25 virtual void AboutRequested(); 26 virtual bool QuitRequested(); 27 virtual void MessageReceived(BMessage *msg); 28 29 void AddHandler(handler_func function); 30 31 void Daemon(); 32 static int32 daemon_thread(void *data); 33 34 private: 35 thread_id fDaemon; 36 port_id fPort; 37 38 BLocker fHandlerLock; 39 BList fHandlers; 40 }; 41 42 #endif /* _SYSLOG_DAEMON_H_ */ 43