14 #ifndef __WVDBUSCONN_H
15 #define __WVDBUSCONN_H
17 #include "wvstreamclone.h"
19 #include "wvdbusmsg.h"
20 #include "wvhashtable.h"
23 #define WVDBUS_DEFAULT_TIMEOUT (300*1000)
32 typedef wv::function<bool(WvDBusMsg&)> WvDBusCallback;
51 virtual wvuid_t get_uid() = 0;
61 virtual wvuid_t get_uid();
67 bool client, authorized, in_post_select;
106 wvuid_t get_uid() {
return auth ? auth->get_uid() : WVUID_INVALID; }
109 void out(WVSTRING_FORMAT_DECL)
110 {
return out(
WvString(WVSTRING_FORMAT_CALL)); }
120 time_t msec_timeout = WVDBUS_DEFAULT_TIMEOUT);
132 virtual void close();
145 time_t msec_timeout = WVDBUS_DEFAULT_TIMEOUT);
163 time_t msec_timeout = WVDBUS_DEFAULT_TIMEOUT,
164 wv::function<
void(uint32_t)> serial_cb = 0);
220 time_t mintimeout_msec();
221 virtual bool post_select(SelectInfo &si);
230 Pending(
WvDBusMsg &_msg,
const WvDBusCallback &_cb,
234 serial = msg.get_serial();
235 if (msec_timeout < 0)
236 msec_timeout = 5*3600*1000;
237 valid_until = msecadd(wvstime(), msec_timeout);
240 DeclareWvDict(Pending, uint32_t, serial);
245 void expire_pending(Pending *p);
246 void cancel_pending(uint32_t serial);
247 void add_pending(
WvDBusMsg &msg, WvDBusCallback cb,
248 time_t msec_timeout);
258 const WvDBusCallback &_cb,
void *_cookie)
260 { pri = _pri; cookie = _cookie; }
262 static int priority_order(
const CallbackInfo *a,
const CallbackInfo *b);
264 DeclareWvList(CallbackInfo);
265 CallbackInfoList callbacks;
269 #endif // __WVDBUSCONN_H