* 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,
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);
ParseDNSAnswerCb DNS_CB;
IO_CallBack PostDNS;
+ const char *QueryTYPE;
+ const char *QStr;
int DNSStatus;
void *VParsedDNSReply;
FreeDNSReply DNSReplyFree;
/* 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 {
eNextState NextDBOperation(AsyncIO *IO, IO_CallBack CB);
eNextState QueueDBOperation(AsyncIO *IO, IO_CallBack CB);
+void StopDBWatchers(AsyncIO *IO);
eNextState QueueEventContext(AsyncIO *IO, IO_CallBack CB);
eNextState QueueCurlContext(AsyncIO *IO);
void StopClient(AsyncIO *IO);
-void StopClientWatchers(AsyncIO *IO);
+void StopClientWatchers(AsyncIO *IO, int CloseFD);
void SetNextTimeout(AsyncIO *IO, double timeout);
IO_CallBack Terminate,
IO_CallBack DBTerminate,
IO_CallBack ShutdownAbort);
+void KillAsyncIOContext(AsyncIO *IO);
+void StopCurlWatchers(AsyncIO *IO);
+
eNextState ReAttachIO(AsyncIO *IO,
void *pData,