X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-sys%2Fevtloop.h;h=c96f0c2585348fe2a0bcb5b4a1a586cbf0064f7a;hp=7c46bf676f5725a72c327e606a7ee5a7f8d674e8;hb=f8d1899d44b259a0920a52bd7290f15e39fd0d47;hpb=38f368de05a21ba6cbef6d48f4f89225d0d71c6e;ds=sidebyside diff --git a/lib-sys/evtloop.h b/lib-sys/evtloop.h index 7c46bf6..c96f0c2 100644 --- a/lib-sys/evtloop.h +++ b/lib-sys/evtloop.h @@ -22,6 +22,8 @@ #define MUTT_LIB_SYS_EVTLOOP_H #include +#include +#include typedef enum el_state { EL_LLP_INIT, @@ -54,6 +56,10 @@ 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; @@ -64,21 +70,27 @@ typedef struct job_t { 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; +#define EL_JOB_CHECK(expr) \ + do { if ((expr) < 0) return -1; } while (0) + __must_check__ int el_job_setmode(job_t *w, el_mode); __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(); @@ -87,5 +99,7 @@ static inline job_t *el_job_start(const machine_t *m, void *cfg) { } int el_dispatch(int timeout); +void el_initialize(void); +void el_shutdown(void); #endif