7 #include "uniconfdaemon.h"
8 #include "uniconfdaemonconn.h"
9 #include "wvlistener.h"
10 #include "uninullgen.h"
13 #include "uniconfpamconn.h"
19 : cfg(_cfg), log(
"UniConf Daemon"), debug(log.split(
WvLog::Debug1))
24 assert(!authenticate);
27 permgen = _permgen ? _permgen :
new UniNullGen();
32 UniConfDaemon::~UniConfDaemon()
43 debug(
"Saving changes.\n");
45 debug(
"Done saving changes.\n");
52 void UniConfDaemon::accept(
WvStream *stream)
67 void UniConfDaemon::listencallback(
IWvStream *s)
69 const WvAddr *a = s->src();
71 debug(
"Incoming connection from %s.\n", *a);
73 debug(
"Incoming connection from UNKNOWN.\n");
76 debug(
"Error: %s\n", s->errstr());
87 debug(
"Listening on %s.\n", *l->src());
90 log(WvLog::Error,
"Can't listen: %s\n", l->errstr());
91 seterr_both(l->
geterr(), l->errstr());
96 l->
onaccept(wv::bind(&UniConfDaemon::listencallback,
this, _1));
97 append(l,
true,
"listener");
void commit() const
Commits information about this key recursively.
virtual int geterr() const
If isok() is false, return the system error number corresponding to the error, -1 for a special error...
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
Retains all state and behavior related to a single UniConf daemon connection.
A generator that is always empty and rejects changes.
UniConf instances function as handles to subtrees of a UniConf tree and expose a high-level interface...
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
void listen(WvStringParm lmoniker)
Start listening on a socket described by the given WvListener moniker.
An abstract data container that backs a UniConf tree.
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
UniPermGen wraps a tree encoding Unix-style permissions, and provides an API for setting and checking...
Base class for different address types, each of which will have the ability to convert itself to/from...
WvStreamClone simply forwards all requests to the "cloned" stream.
virtual IWvListenerCallback onaccept(IWvListenerCallback _cb)=0
Set a user-defined function to be called when a new connection is available.
virtual bool isok() const =0
By default, returns true if geterr() == 0.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
UniConfDaemon(const UniConf &cfg, bool auth, IUniConfGen *permgen)
Create a UniConfDaemon to serve the Uniconf tree cfg.