X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-sys%2Fevtloop.h;h=961390ae7fff28a733f250adaf11b66a7d510761;hp=3e7458a20b19b6bf95d995600e52c30c176a5584;hb=5d91980585aec03b90e77d650f6853aaf9d2dfc5;hpb=bb97a3c3f2ed50a557ead340ba64413d6f014cee diff --git a/lib-sys/evtloop.h b/lib-sys/evtloop.h index 3e7458a..961390a 100644 --- a/lib-sys/evtloop.h +++ b/lib-sys/evtloop.h @@ -15,7 +15,7 @@ * MA 02110-1301, USA. */ /* - * Copyright © 2006 Pierre Habouzit + * Copyright © 2007 Pierre Habouzit */ #ifndef MUTT_LIB_SYS_EVTLOOP_H @@ -23,6 +23,7 @@ #include #include +#include typedef enum el_state { EL_LLP_INIT, @@ -55,26 +56,29 @@ typedef enum el_event { typedef struct job_t { int fd; + int ssf; gnutls_session_t session; + gnutls_certificate_credentials_t xcred; el_state state : 2; el_mode mode : 3; el_mode emode : 3; + struct timeval mru; int (*llp)(struct job_t *); const struct machine_t *m; void *ptr; } job_t; DO_INIT(job_t, job); -DO_WIPE(job_t, job); +void job_wipe(job_t *w); DO_NEW(job_t, job); DO_DELETE(job_t, job); typedef struct machine_t { const char *name; __must_check__ int (*setup)(job_t *w, void *); - int (*on_event)(job_t *w, el_event); + __must_check__ int (*on_event)(job_t *w, el_event); void (*finalize)(job_t *w, el_status); } machine_t; @@ -82,18 +86,21 @@ typedef struct machine_t { do { if ((expr) < 0) return -1; } while (0) __must_check__ int el_job_setmode(job_t *w, el_mode); +__must_check__ job_t *el_job_start(const machine_t *m, void *cfg); __must_check__ int el_job_release(job_t *j, el_status); + __must_check__ int el_job_connect(job_t *w, struct sockaddr *, socklen_t len, - int type, int proto); + int type, int proto, int ssl); +__must_check__ int el_job_starttls(job_t *w); __must_check__ ssize_t el_job_read(job_t *w, buffer_t *buf); __must_check__ ssize_t el_job_write(job_t *w, buffer_t *buf); -static inline job_t *el_job_start(const machine_t *m, void *cfg) { - job_t *w = job_new(); - w->m = m; - return m->setup(w, cfg) < 0 ? NULL : w; -} +void el_lock(void); +void el_unlock(void); int el_dispatch(int timeout); +void el_initialize(void); +void el_shutdown(void); + #endif