7#include "uniconfdaemon.h"
8#include "uniconfdaemonconn.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();
32UniConfDaemon::~UniConfDaemon()
43 debug(
"Saving changes.\n");
45 debug(
"Done saving changes.\n");
52void UniConfDaemon::accept(
WvStream *stream)
67void 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");
An abstract data container that backs a UniConf tree.
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.
Retains all state and behavior related to a single UniConf daemon connection.
void listen(WvStringParm lmoniker)
Start listening on a socket described by the given WvListener moniker.
UniConfDaemon(const UniConf &cfg, bool auth, IUniConfGen *permgen)
Create a UniConfDaemon to serve the Uniconf tree cfg.
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
UniConf instances function as handles to subtrees of a UniConf tree and expose a high-level interface...
void commit() const
Commits information about this key recursively.
A generator that is always empty and rejects changes.
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...
virtual int geterr() const
If isok() is false, return the system error number corresponding to the error, -1 for a special error...
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
WvStreamClone simply forwards all requests to the "cloned" stream.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
virtual void close()
Close the stream if it is open; isok() becomes false from now on.