summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2011-04-14 17:06:44 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2011-04-14 17:06:44 +0000
commit939b40997b1415575cf660f12a25b6413bec527c (patch)
tree49fbc509c09719d53f6d41b63374c53e3819e792 /usr.sbin/smtpd/smtpd.h
parent261dcbec2c4c9a0c15d4408e30c8034c82c44e77 (diff)
smtpd makes too many assumptions about the structure and layout of its
disk-based queue, it makes it near impossible to make changes to it without editing twenty files... how am i going to implement mongodb support ? :-) bring a new queue_backend API which hides the details of the disk-based queue to smtpd. it is not "plugged in" yet and I'm filling the holes.
Diffstat (limited to 'usr.sbin/smtpd/smtpd.h')
-rw-r--r--usr.sbin/smtpd/smtpd.h56
1 files changed, 55 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 1f112c94af9..d1d84cccc58 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.208 2011/04/13 20:53:18 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.209 2011/04/14 17:06:43 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -634,6 +634,7 @@ struct smtpd {
struct passwd *sc_pw;
char sc_hostname[MAXHOSTNAMELEN];
struct ramqueue sc_rqueue;
+ struct queue_backend *sc_queue;
TAILQ_HEAD(listenerlist, listener) *sc_listeners;
TAILQ_HEAD(maplist, map) *sc_maps, *sc_maps_reload;
@@ -901,6 +902,40 @@ struct map_virtual {
};
+/* queue structures */
+enum queue_type {
+ QT_INVALID=0,
+ QT_FS
+};
+
+enum queue_kind {
+ Q_INVALID=0,
+ Q_ENQUEUE,
+ Q_INCOMING,
+ Q_QUEUE,
+ Q_PURGE,
+ Q_OFFLINE,
+ Q_BOUNCE
+};
+
+enum queue_op {
+ QOP_INVALID=0,
+ QOP_CREATE,
+ QOP_DELETE,
+ QOP_UPDATE,
+ QOP_COMMIT,
+ QOP_LOAD,
+ QOP_FD_R,
+ QOP_FD_RW
+};
+
+struct queue_backend {
+ enum queue_type type;
+ int (*message)(struct smtpd *, enum queue_kind, enum queue_op, char *);
+ int (*envelope)(struct smtpd *, enum queue_kind, enum queue_op,
+ struct message *);
+};
+
extern void (*imsg_callback)(struct smtpd *, struct imsgev *, struct imsg *);
@@ -1017,6 +1052,25 @@ void queue_commit_envelopes(struct smtpd *, struct message*);
u_int16_t queue_hash(char *);
+/* queue_backend.c */
+struct queue_backend *queue_backend_lookup(enum queue_type);
+int queue_message_create(struct smtpd *, enum queue_kind, char *);
+int queue_message_delete(struct smtpd *, enum queue_kind, char *);
+int queue_message_commit(struct smtpd *, enum queue_kind, char *);
+int queue_message_fd_r(struct smtpd *, enum queue_kind, char *);
+int queue_message_fd_rw(struct smtpd *, enum queue_kind, char *);
+int queue_envelope_create(struct smtpd *, enum queue_kind,
+ struct message *);
+int queue_envelope_delete(struct smtpd *, enum queue_kind,
+ struct message *);
+int queue_envelope_load(struct smtpd *, enum queue_kind,
+ char *, struct message *);
+int queue_envelope_update(struct smtpd *, enum queue_kind,
+ struct message *);
+
+
+
+
/* queue_shared.c */
int queue_create_layout_message(char *, char *);
void queue_delete_layout_message(char *, char *);