xref: /openbsd/usr.sbin/smtpd/scheduler_null.c (revision 274d7c50)
1 /*	$OpenBSD: scheduler_null.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $	*/
2 
3 /*
4  * Copyright (c) 2012 Eric Faurot <eric@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/socket.h>
23 
24 #include <ctype.h>
25 #include <err.h>
26 #include <event.h>
27 #include <fcntl.h>
28 #include <imsg.h>
29 #include <stdio.h>
30 #include <limits.h>
31 
32 #include "smtpd.h"
33 
34 static int scheduler_null_init(const char *);
35 static int scheduler_null_insert(struct scheduler_info *);
36 static size_t scheduler_null_commit(uint32_t);
37 static size_t scheduler_null_rollback(uint32_t);
38 static int scheduler_null_update(struct scheduler_info *);
39 static int scheduler_null_delete(uint64_t);
40 static int scheduler_null_hold(uint64_t, uint64_t);
41 static int scheduler_null_release(int, uint64_t, int);
42 static int scheduler_null_batch(int, int*, size_t*, uint64_t*, int*);
43 static size_t scheduler_null_messages(uint32_t, uint32_t *, size_t);
44 static size_t scheduler_null_envelopes(uint64_t, struct evpstate *, size_t);
45 static int scheduler_null_schedule(uint64_t);
46 static int scheduler_null_remove(uint64_t);
47 static int scheduler_null_suspend(uint64_t);
48 static int scheduler_null_resume(uint64_t);
49 
50 struct scheduler_backend scheduler_backend_null = {
51 	scheduler_null_init,
52 
53 	scheduler_null_insert,
54 	scheduler_null_commit,
55 	scheduler_null_rollback,
56 
57 	scheduler_null_update,
58 	scheduler_null_delete,
59 	scheduler_null_hold,
60 	scheduler_null_release,
61 
62 	scheduler_null_batch,
63 
64 	scheduler_null_messages,
65 	scheduler_null_envelopes,
66 	scheduler_null_schedule,
67 	scheduler_null_remove,
68 	scheduler_null_suspend,
69 	scheduler_null_resume,
70 };
71 
72 static int
73 scheduler_null_init(const char *arg)
74 {
75 	return (1);
76 }
77 
78 static int
79 scheduler_null_insert(struct scheduler_info *si)
80 {
81 	return (0);
82 }
83 
84 static size_t
85 scheduler_null_commit(uint32_t msgid)
86 {
87 	return (0);
88 }
89 
90 static size_t
91 scheduler_null_rollback(uint32_t msgid)
92 {
93 	return (0);
94 }
95 
96 static int
97 scheduler_null_update(struct scheduler_info *si)
98 {
99 	return (0);
100 }
101 
102 static int
103 scheduler_null_delete(uint64_t evpid)
104 {
105 	return (0);
106 }
107 
108 static int
109 scheduler_null_hold(uint64_t evpid, uint64_t holdq)
110 {
111 	return (0);
112 }
113 
114 static int
115 scheduler_null_release(int type, uint64_t holdq, int n)
116 {
117 	return (0);
118 }
119 
120 static int
121 scheduler_null_batch(int typemask, int *delay, size_t *count, uint64_t *evpids, int *types)
122 {
123 	*delay = 0;
124 
125 	return (0);
126 }
127 
128 static int
129 scheduler_null_schedule(uint64_t evpid)
130 {
131 	return (0);
132 }
133 
134 static int
135 scheduler_null_remove(uint64_t evpid)
136 {
137 	return (0);
138 }
139 
140 static int
141 scheduler_null_suspend(uint64_t evpid)
142 {
143 	return (0);
144 }
145 
146 static int
147 scheduler_null_resume(uint64_t evpid)
148 {
149 	return (0);
150 }
151 
152 static size_t
153 scheduler_null_messages(uint32_t from, uint32_t *dst, size_t size)
154 {
155 	return (0);
156 }
157 
158 static size_t
159 scheduler_null_envelopes(uint64_t from, struct evpstate *dst, size_t size)
160 {
161 	return (0);
162 }
163