00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __UNICONFCLIENT_H
00009 #define __UNICONFCLIENT_H
00010
00011 #include "uniconfgen.h"
00012 #include "wvlog.h"
00013 #include "wvstringlist.h"
00014 #include "uniclientconn.h"
00015
00016
00028 class UniClientGen : public UniConfGen
00029 {
00030 class RemoteKeyIter;
00031
00032 UniClientConn *conn;
00033
00034 struct KeyVal
00035 {
00036 UniConfKey key;
00037 WvString val;
00038
00039 KeyVal(const UniConfKey &_key, WvStringParm _val)
00040 : key(_key), val(_val)
00041 { }
00042 };
00043 DeclareWvList(KeyVal);
00044
00045 WvLog log;
00046
00047 WvString result_key;
00048 WvString result;
00050 KeyValList *result_list;
00052 bool cmdinprogress;
00053 bool cmdsuccess;
00055 static const int TIMEOUT = 30000;
00056
00057 public:
00063 UniClientGen(IWvStream *stream, WvStringParm dst = WvString::null);
00064
00065 virtual ~UniClientGen();
00066
00067
00068
00069 virtual bool isok();
00070
00071 virtual bool refresh();
00072 virtual void flush_buffers();
00073 virtual void commit();
00074 virtual WvString get(const UniConfKey &key);
00075 virtual void set(const UniConfKey &key, WvStringParm value);
00076 virtual bool haschildren(const UniConfKey &key);
00077 virtual Iter *iterator(const UniConfKey &key);
00078 virtual Iter *recursiveiterator(const UniConfKey &key);
00079
00080 protected:
00081 virtual Iter *do_iterator(const UniConfKey &key, bool recursive);
00082 void conncallback(WvStream &s, void *userdata);
00083 bool do_select();
00084 };
00085
00086
00087 #endif // __UNICONFCLIENT_H