]> code.citadel.org Git - citadel.git/blobdiff - citadel/event_client.h
libev/c-ares migration: unstack out ouf c-ares before querying new requests
[citadel.git] / citadel / event_client.h
index 208a716616a7122ca8340490d2fa2511ffcc9d15..79eda639b7726060b997d3ec43eaf23c661711c8 100644 (file)
@@ -15,7 +15,6 @@ typedef enum _eNextState {
        eAbort
 }eNextState;
 
-typedef int (*EventContextAttach)(void *Data);
 typedef eNextState (*IO_CallBack)(AsyncIO *IO);
 typedef eReadState (*IO_LineReaderCallback)(AsyncIO *IO);
 typedef void (*ParseDNSAnswerCb)(AsyncIO*, unsigned char*, int);
@@ -32,12 +31,15 @@ struct AsyncIO {
        /* connection related */
        int IP6;
        struct hostent *HEnt;
+       struct sockaddr_in6 Addr;
+
        int sock;
        unsigned short dport;
                eNextState NextState;
 
        ev_timer conn_fail, 
-               rw_timeout;
+               rw_timeout,
+               unwind_stack_timeout;
        ev_io recv_event, 
                send_event, 
                conn_event;
@@ -77,28 +79,27 @@ struct AsyncIO {
 };
 
 typedef struct _IOAddHandler {
-       void *Ctx;
-       EventContextAttach EvAttch;
+       AsyncIO *IO;
+       IO_CallBack EvAttch;
 }IOAddHandler; 
 
 void FreeAsyncIOContents(AsyncIO *IO);
 
-int QueueEventContext(void *Ctx, AsyncIO *IO, EventContextAttach CB);
+int QueueEventContext(AsyncIO *IO, IO_CallBack CB);
 int ShutDownEventQueue(void);
 
-void InitEventIO(AsyncIO *IO, 
-                void *pData, 
-                IO_CallBack ReadDone, 
-                IO_CallBack SendDone, 
-                IO_CallBack Terminate, 
-                IO_CallBack Timeout, 
-                IO_CallBack ConnFail, 
-                IO_LineReaderCallback LineReader,
-                double conn_timeout, double first_rw_timeout,
-                int ReadFirst);
+eNextState InitEventIO(AsyncIO *IO, 
+                      void *pData, 
+                      double conn_timeout, 
+                      double first_rw_timeout,
+                      int ReadFirst);
+void IO_postdns_callback(struct ev_loop *loop, ev_timer *watcher, int revents);
 
 int QueueQuery(ns_type Type, char *name, AsyncIO *IO, IO_CallBack PostDNS);
+void QueryCbDone(AsyncIO *IO);
 
 void StopClient(AsyncIO *IO);
 
 void SetNextTimeout(AsyncIO *IO, double timeout);
+
+void InitC_ares_dns(AsyncIO *IO);