scheduler_null.c revision 1.9
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
34static int scheduler_null_init(const char *);
35static int scheduler_null_insert(struct scheduler_info *);
36static size_t scheduler_null_commit(uint32_t);
37static size_t scheduler_null_rollback(uint32_t);
38static int scheduler_null_update(struct scheduler_info *);
39static int scheduler_null_delete(uint64_t);
40static int scheduler_null_hold(uint64_t, uint64_t);
41static int scheduler_null_release(int, uint64_t, int);
42static int scheduler_null_batch(int, int*, size_t*, uint64_t*, int*);
43static size_t scheduler_null_messages(uint32_t, uint32_t *, size_t);
44static size_t scheduler_null_envelopes(uint64_t, struct evpstate *, size_t);
45static int scheduler_null_schedule(uint64_t);
46static int scheduler_null_remove(uint64_t);
47static int scheduler_null_suspend(uint64_t);
48static int scheduler_null_resume(uint64_t);
49
50struct 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
72static int
73scheduler_null_init(const char *arg)
74{
75	return (1);
76}
77
78static int
79scheduler_null_insert(struct scheduler_info *si)
80{
81	return (0);
82}
83
84static size_t
85scheduler_null_commit(uint32_t msgid)
86{
87	return (0);
88}
89
90static size_t
91scheduler_null_rollback(uint32_t msgid)
92{
93	return (0);
94}
95
96static int
97scheduler_null_update(struct scheduler_info *si)
98{
99	return (0);
100}
101
102static int
103scheduler_null_delete(uint64_t evpid)
104{
105	return (0);
106}
107
108static int
109scheduler_null_hold(uint64_t evpid, uint64_t holdq)
110{
111	return (0);
112}
113
114static int
115scheduler_null_release(int type, uint64_t holdq, int n)
116{
117	return (0);
118}
119
120static int
121scheduler_null_batch(int typemask, int *delay, size_t *count, uint64_t *evpids, int *types)
122{
123	*delay = 0;
124
125	return (0);
126}
127
128static int
129scheduler_null_schedule(uint64_t evpid)
130{
131	return (0);
132}
133
134static int
135scheduler_null_remove(uint64_t evpid)
136{
137	return (0);
138}
139
140static int
141scheduler_null_suspend(uint64_t evpid)
142{
143	return (0);
144}
145
146static int
147scheduler_null_resume(uint64_t evpid)
148{
149	return (0);
150}
151
152static size_t
153scheduler_null_messages(uint32_t from, uint32_t *dst, size_t size)
154{
155	return (0);
156}
157
158static size_t
159scheduler_null_envelopes(uint64_t from, struct evpstate *dst, size_t size)
160{
161	return (0);
162}
163