X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=job.h;h=481f625a129787a0033f8a3bde5addda0dd38520;hb=59c1f51ef38081d87885a37873545154c7a23e2d;hp=7a638298c5ea594476699c7aa07a15f606acf048;hpb=dd4df3834d9d0175c7ee4fc19061945d1968581b;p=apps%2Fpfixtools.git diff --git a/job.h b/job.h index 7a63829..481f625 100644 --- a/job.h +++ b/job.h @@ -38,11 +38,11 @@ #include "mem.h" -enum job_state { +enum job_mode { JOB_IDLE = 0x00, JOB_READ = 0x01, JOB_WRITE = 0x02, - JOB_RDWR = 0x03, + JOB_RDWR = JOB_READ | JOB_WRITE, JOB_LISTEN = 0x04, JOB_CONN = 0x08, }; @@ -61,9 +61,10 @@ enum smtp_state { typedef struct jpriv_t jpriv_t; typedef struct job_t { - unsigned state : 6; - unsigned done : 1; - unsigned error : 1; + unsigned mode : 6; /* 4 are enough, 2 used as padding */ + unsigned done : 1; + unsigned error : 1; + unsigned state : 24; int fd; @@ -80,8 +81,8 @@ static inline job_t *job_new(void) { } void job_delete(job_t **job); -void job_update_state(job_t *job, int state); -job_t *job_accept(job_t *listener, int state); +void job_update_mode(job_t *job, int mode); +job_t *job_accept(job_t *listener, int mode); void job_initialize(void); void job_loop(void);