scheduler_null.c revision 1.6
1/*	$OpenBSD: scheduler_null.c,v 1.6 2013/11/20 09:22:42 eric 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
31#include "smtpd.h"
32
33static int scheduler_null_init(void);
34static int scheduler_null_insert(struct scheduler_info *);
35static size_t scheduler_null_commit(uint32_t);
36static size_t scheduler_null_rollback(uint32_t);
37static int scheduler_null_update(struct scheduler_info *);
38static int scheduler_null_delete(uint64_t);
39static int scheduler_null_hold(uint64_t, uint64_t);
40static int scheduler_null_release(int, uint64_t, int);
41static int scheduler_null_batch(int, struct scheduler_batch *);
42static size_t scheduler_null_messages(uint32_t, uint32_t *, size_t);
43static size_t scheduler_null_envelopes(uint64_t, struct evpstate *, size_t);
44static int scheduler_null_schedule(uint64_t);
45static int scheduler_null_remove(uint64_t);
46static int scheduler_null_suspend(uint64_t);
47static int scheduler_null_resume(uint64_t);
48
49struct scheduler_backend scheduler_backend_null = {
50	scheduler_null_init,
51
52	scheduler_null_insert,
53	scheduler_null_commit,
54	scheduler_null_rollback,
55
56	scheduler_null_update,
57	scheduler_null_delete,
58	scheduler_null_hold,
59	scheduler_null_release,
60
61	scheduler_null_batch,
62
63	scheduler_null_messages,
64	scheduler_null_envelopes,
65	scheduler_null_schedule,
66	scheduler_null_remove,
67	scheduler_null_suspend,
68	scheduler_null_resume,
69};
70
71static int
72scheduler_null_init(void)
73{
74	return (1);
75}
76
77static int
78scheduler_null_insert(struct scheduler_info *si)
79{
80	return (0);
81}
82
83static size_t
84scheduler_null_commit(uint32_t msgid)
85{
86	return (0);
87}
88
89static size_t
90scheduler_null_rollback(uint32_t msgid)
91{
92	return (0);
93}
94
95static int
96scheduler_null_update(struct scheduler_info *si)
97{
98	return (0);
99}
100
101static int
102scheduler_null_delete(uint64_t evpid)
103{
104	return (0);
105}
106
107static int
108scheduler_null_hold(uint64_t evpid, uint64_t holdq)
109{
110	return (0);
111}
112
113static int
114scheduler_null_release(int type, uint64_t holdq, int n)
115{
116	return (0);
117}
118
119static int
120scheduler_null_batch(int typemask, struct scheduler_batch *ret)
121{
122	ret->type = SCHED_NONE;
123	ret->evpcount = 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