EV: expose current event queue state to the RWHO command
[citadel.git] / citadel / event_client.h
index 320beb746cb3a6e7d72e53e6a399050261030ef2..1dce3d9cc721b469594693ef706e03cc1122a28e 100644 (file)
@@ -3,18 +3,12 @@
  * Copyright (c) 1998-2012 by the citadel.org team
  *
  *  This program is open source software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License, version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #ifndef __EVENT_CLIENT_H__
 #include <ares.h>
 #include <curl/curl.h>
 
+#ifndef __ASYNCIO__
+#define __ASYNCIO__
 typedef struct AsyncIO AsyncIO;
+#endif
+#ifndef __CIT_CONTEXT__
+#define __CIT_CONTEXT__
+typedef struct CitContext CitContext;
+#endif
+
+typedef enum __eIOState { 
+       eDBQ,
+       eQDBNext,
+       eDBAttach,
+       eDBNext,
+       eDBStop,
+       eDBX,
+       eDBTerm,
+       eIOQ,
+       eIOAttach,
+       eIOConnectSock,
+       eIOAbort,
+       eIOTimeout,
+       eIOConnfail,
+       eIOConnfailNow,
+       eIOConnNow,
+       eIOConnWait,
+       eCurlQ,
+       eCurlStart,
+       eCurlShutdown,
+       eCurlNewIO,
+       eCurlGotIO,
+       eCurlGotData,
+       eCurlGotStatus,
+       eCaresStart,
+       eCaresDoneIO,
+       eCaresFinished,
+       eCaresX,
+       eKill,
+       eExit
+}eIOState;
 
 typedef enum _eNextState {
        eSendDNSQuery,
@@ -51,6 +84,8 @@ typedef enum _eNextState {
        eAbort
 }eNextState;
 
+void SetEVState(AsyncIO *IO, eIOState State);
+
 typedef eNextState (*IO_CallBack)(AsyncIO *IO);
 typedef eReadState (*IO_LineReaderCallback)(AsyncIO *IO);
 typedef void (*ParseDNSAnswerCb)(AsyncIO*, unsigned char*, int);
@@ -76,6 +111,8 @@ typedef struct _DNSQueryParts {
        ParseDNSAnswerCb DNS_CB;
        IO_CallBack PostDNS;
 
+       const char *QueryTYPE;
+       const char *QStr;
        int DNSStatus;
        void *VParsedDNSReply;
        FreeDNSReply DNSReplyFree;
@@ -170,7 +207,7 @@ struct AsyncIO {
 
        /* Context specific data; Hint: put AsyncIO in there */
        void *Data;        /* application specific data */
-       void *CitContext;  /* Citadel Session context... */
+       CitContext *CitContext;  /* Citadel Session context... */
 };
 
 typedef struct _IOAddHandler {
@@ -302,7 +339,7 @@ int InitcURLIOStruct(AsyncIO *IO,
                     IO_CallBack Terminate,
                     IO_CallBack DBTerminate,
                     IO_CallBack ShutdownAbort);
-
+void KillAsyncIOContext(AsyncIO *IO);
 void StopCurlWatchers(AsyncIO *IO);