]> code.citadel.org Git - citadel.git/blobdiff - citadel/event_client.h
work on errorhandling for the smtp event client
[citadel.git] / citadel / event_client.h
index a8534b1486b8df7d6baa981bd1e994ba2169be57..52e3de5ac9f132ddc01d24f78a8c2199cbd31298 100644 (file)
@@ -8,6 +8,9 @@
 typedef struct AsyncIO AsyncIO;
 
 typedef enum _eNextState {
+       eSendDNSQuery,
+       eReadDNSReply,
+       eConnect,
        eSendReply, 
        eSendMore,
        eReadMessage, 
@@ -32,33 +35,27 @@ typedef struct _DNSQueryParts {
 
 
 struct AsyncIO {
+               eNextState NextState;
 
        /* connection related */
        ParsedURL *ConnectMe;
-/*
-       int IP6;
-       struct sockaddr_in6 *Addr;
-       unsigned short dport;
-
-*/
-       int sock;
-               eNextState NextState;
        
-       ev_cleanup abort_by_shutdown;
-
-       ev_timer conn_fail, 
-               rw_timeout;
-       ev_idle unwind_stack;
-       ev_io recv_event, 
-               send_event, 
-               conn_event;
-       StrBuf *ErrMsg; /* if we fail to connect, or lookup, error goes here. */
-
        /* read/send related... */
        StrBuf *IOBuf;
        IOBuffer SendBuf, 
                RecvBuf;
 
+       /* our events... */
+       ev_cleanup abort_by_shutdown; /* server wants to go down... */
+       ev_timer conn_fail,           /* connection establishing timed out */
+               rw_timeout;           /* timeout while sending data */
+       ev_idle unwind_stack;         /* get c-ares out of the stack */
+       ev_io recv_event,             /* receive data from the client */
+               send_event,           /* send more data to the client */
+               conn_event;           /* Connection successfully established */
+
+       StrBuf *ErrMsg; /* if we fail to connect, or lookup, error goes here. */
+
        /* Citadel application callbacks... */
        IO_CallBack ReadDone, /* Theres new data to read... */
                SendDone,     /* we may send more data */
@@ -69,6 +66,7 @@ struct AsyncIO {
 
        IO_LineReaderCallback LineReader; /* if we have linereaders, maybe we want to read more lines before the real application logic is called? */
 
+       /* DNS Related */
        ev_io dns_recv_event, 
                dns_send_event;
        struct ares_options DNSOptions;
@@ -76,8 +74,8 @@ struct AsyncIO {
        DNSQueryParts *DNSQuery;
 
        /* Custom data; its expected to contain  AsyncIO so we can save malloc()s... */
-       DeleteHashDataFunc DeleteData; /* so if we have to destroy you, what to do... */
-       void *Data; /* application specific data */
+       void *Data;        /* application specific data */
+       void *CitContext;  /* Citadel Session context... */
 };
 
 typedef struct _IOAddHandler {
@@ -104,6 +102,8 @@ void QueryCbDone(AsyncIO *IO);
 
 void StopClient(AsyncIO *IO);
 
+void StopClientWatchers(AsyncIO *IO);
+
 void SetNextTimeout(AsyncIO *IO, double timeout);
 
 void InitC_ares_dns(AsyncIO *IO);