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