3 #include <sys/socket.h>
6 typedef struct AsyncIO AsyncIO;
8 typedef enum _eNextState {
16 typedef int (*EventContextAttach)(void *Data);
17 typedef eNextState (*IO_CallBack)(void *Data);
18 typedef eReadState (*IO_LineReaderCallback)(AsyncIO *IO);
24 /* To cycle through several possible services... */
26 struct addrinfo *curr_ai;
28 /* connection related */
35 StrBuf *ErrMsg; /* if we fail to connect, or lookup, error goes here. */
37 /* read/send related... */
42 /* Citadel application callbacks... */
43 IO_CallBack ReadDone, /* Theres new data to read... */
44 SendDone, /* we may send more data */
45 Terminate, /* shutting down... */
46 Timeout, /* Timeout handler; may also be connection timeout */
47 ConnFail, /* What to do when one connection failed? */
48 CustomDNS; /* If the application wants to do custom dns functionality like cycle through different MX-Records */
50 IO_LineReaderCallback LineReader; /* if we have linereaders, maybe we want to read more lines before the real application logic is called? */
52 /* Custom data; its expected to contain AsyncIO so we can save malloc()s... */
53 DeleteHashDataFunc DeleteData; /* so if we have to destroy you, what to do... */
54 void *Data; /* application specific data */
57 typedef struct _IOAddHandler {
59 EventContextAttach EvAttch;
62 void FreeAsyncIOContents(AsyncIO *IO);
64 int QueueEventContext(void *Ctx, AsyncIO *IO, EventContextAttach CB);
65 int ShutDownEventQueue(void);
67 void InitEventIO(AsyncIO *IO,
71 IO_CallBack Terminate,
74 IO_CallBack CustomDNS,
75 IO_LineReaderCallback LineReader,