* Copyright © 2007 Pierre Habouzit
*/
-#ifndef POSTLICYD_JOB_H
-#define POSTLICYD_JOB_H
-
-#include "mem.h"
-
-enum job_mode {
- JOB_IDLE = 0x00,
- JOB_READ = 0x01,
- JOB_WRITE = 0x02,
- JOB_RDWR = JOB_READ | JOB_WRITE,
- JOB_LISTEN = 0x04,
- JOB_CONN = 0x08,
-};
-
-typedef struct jpriv_t jpriv_t;
-typedef struct job_t {
- unsigned mode : 6; /* 4 are enough, 2 used as padding */
- unsigned done : 1;
- unsigned error : 1;
- unsigned state : 24;
-
- int fd;
-
- void (*process)(struct job_t *);
- void (*stop)(struct job_t *);
-
- jpriv_t *jdata;
-} job_t;
-
-static inline job_t *job_new(void) {
- job_t *job = p_new(job_t, 1);
- job->fd = -1;
- return job;
-}
-void job_delete(job_t **job);
-
-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);
-void job_shutdown(void);
+#ifndef POSTLICYD_H
+#define POSTLICYD_H
+
+#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#define UNIXERR(fun) \
+ syslog(LOG_ERR, "%s:%d:%s: %s: %m", \
+ __FILE__, __LINE__, __func__, fun)
#endif