xref: /openbsd-src/usr.sbin/smtpd/scheduler_backend.c (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
1 /*	$OpenBSD: scheduler_backend.c,v 1.1 2012/07/09 09:57:53 gilles Exp $	*/
2 
3 /*
4  * Copyright (c) 2012 Gilles Chehade <gilles@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include <sys/types.h>
20 #include <sys/queue.h>
21 #include <sys/tree.h>
22 #include <sys/param.h>
23 #include <sys/socket.h>
24 
25 #include <ctype.h>
26 #include <err.h>
27 #include <event.h>
28 #include <fcntl.h>
29 #include <imsg.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 
34 #include "smtpd.h"
35 #include "log.h"
36 
37 extern struct scheduler_backend scheduler_backend_ramqueue;
38 
39 struct scheduler_backend *
40 scheduler_backend_lookup(const char *name)
41 {
42 	if (!strcmp(name, "ramqueue"))
43 		return &scheduler_backend_ramqueue;
44 
45 	return NULL;
46 }
47 
48 void
49 scheduler_info(struct scheduler_info *sched, struct envelope *evp)
50 {
51 	strlcpy(sched->destination, evp->dest.domain, sizeof sched->destination);
52 
53 	sched->evpid = evp->id;
54 	sched->creation = evp->creation;
55 	sched->lasttry  = evp->lasttry;
56 	sched->expire   = evp->expire;
57 	sched->retry    = evp->retry;
58 }
59