00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * UniClientGen is a UniConfGen for retrieving data from the 00006 * UniConfDaemon. 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 00027 class UniClientGen : public UniConfGen 00028 { 00029 UniClientConn *conn; 00030 00031 WvLog log; 00032 00033 WvString result_key; 00034 WvString result; 00036 UniListIter *result_list; 00038 bool cmdinprogress; 00039 bool cmdsuccess; 00041 static const int TIMEOUT = 60000; // command timeout in ms 00042 time_t timeout_activity; // last time something happened relative to uptime 00043 00044 int version; 00046 public: 00052 UniClientGen(IWvStream *stream, WvStringParm dst = WvString::null); 00053 00054 virtual ~UniClientGen(); 00055 00056 /***** Overridden members *****/ 00057 00058 virtual bool isok(); 00059 00060 virtual bool refresh(); 00061 virtual void flush_buffers(); 00062 virtual void commit(); 00063 virtual WvString get(const UniConfKey &key); 00064 virtual void set(const UniConfKey &key, WvStringParm value); 00065 virtual void setv(const UniConfPairList &pairs); 00066 virtual bool haschildren(const UniConfKey &key); 00067 virtual Iter *iterator(const UniConfKey &key); 00068 virtual Iter *recursiveiterator(const UniConfKey &key); 00069 00070 protected: 00071 virtual Iter *do_iterator(const UniConfKey &key, bool recursive); 00072 void conncallback(WvStream &s, void *userdata); 00073 bool do_select(); 00074 }; 00075 00076 00077 #endif // __UNICONFCLIENT_H