wvstreamsdaemon.h

00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Tunnel Vision Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * High-level abstraction for creating daemon processes that do
00006  * nothing but listen on a list of WvStreams and add connections
00007  * to the global list.
00008  */
00009 #ifndef __WVSTREAMSDAEMON_H
00010 #define __WVSTREAMSDAEMON_H
00011 
00012 #include "wvdaemon.h"
00013 #include "iwvstream.h"
00014 #include "wvistreamlist.h"
00015 
00016 class WvStreamsDaemon;
00017 
00018 typedef WvCallback<void, WvStreamsDaemon &, void *> WvStreamsDaemonCallback;
00019 
00061 class WvStreamsDaemon : public WvDaemon
00062 {
00063 private:
00064 
00065     WvStreamsDaemonCallback callback;
00066     void *userdata;
00067 
00068     WvIStreamList streams;
00069 
00070     void start_cb(WvDaemon &daemon, void *);
00071     void run_cb(WvDaemon &daemon, void *);
00072     void stop_cb(WvDaemon &daemon, void *);
00073     void stop_full_close_cb(WvDaemon &daemon, void *);
00074 
00075     void restart_close_cb(const char *, WvStream &);
00076     void die_close_cb(const char *, WvStream &);
00077 
00078 public:
00079 
00082     WvStreamsDaemon(WvStringParm name, WvStringParm version,
00083                     WvStreamsDaemonCallback cb, void *ud = NULL);
00084 
00088     void add_stream(IWvStream *istream,
00089                     bool auto_free, const char *id = NULL);
00095     void add_restart_stream(IWvStream *istream,
00096                             bool auto_free, const char *id = NULL);
00101     void add_die_stream(IWvStream *istream,
00102                         bool auto_free, const char *id = NULL);
00103 
00107     void close_existing_connections_on_restart();
00108 
00110     void setcallback(WvStreamsDaemonCallback cb, void *ud = NULL);
00111 };
00112 #endif // __WVSTREAMSDAEMON_H

Generated on Mon Feb 5 10:54:30 2007 for WvStreams by  doxygen 1.5.1