1 /* $OpenBSD: queue_null.c,v 1.10 2021/06/14 17:58:16 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 "smtpd.h"
20
21 static int
queue_null_message_create(uint32_t * msgid)22 queue_null_message_create(uint32_t *msgid)
23 {
24 *msgid = queue_generate_msgid();
25 return (1);
26 }
27
28 static int
queue_null_message_commit(uint32_t msgid,const char * path)29 queue_null_message_commit(uint32_t msgid, const char *path)
30 {
31 return (1);
32 }
33
34 static int
queue_null_message_delete(uint32_t msgid)35 queue_null_message_delete(uint32_t msgid)
36 {
37 return (1);
38 }
39
40 static int
queue_null_message_fd_r(uint32_t msgid)41 queue_null_message_fd_r(uint32_t msgid)
42 {
43 return (-1);
44 }
45
46 static int
queue_null_envelope_create(uint32_t msgid,const char * buf,size_t len,uint64_t * evpid)47 queue_null_envelope_create(uint32_t msgid, const char *buf, size_t len,
48 uint64_t *evpid)
49 {
50 *evpid = queue_generate_evpid(msgid);
51 return (1);
52 }
53
54 static int
queue_null_envelope_delete(uint64_t evpid)55 queue_null_envelope_delete(uint64_t evpid)
56 {
57 return (1);
58 }
59
60 static int
queue_null_envelope_update(uint64_t evpid,const char * buf,size_t len)61 queue_null_envelope_update(uint64_t evpid, const char *buf, size_t len)
62 {
63 return (1);
64 }
65
66 static int
queue_null_envelope_load(uint64_t evpid,char * buf,size_t len)67 queue_null_envelope_load(uint64_t evpid, char *buf, size_t len)
68 {
69 return (0);
70 }
71
72 static int
queue_null_envelope_walk(uint64_t * evpid,char * buf,size_t len)73 queue_null_envelope_walk(uint64_t *evpid, char *buf, size_t len)
74 {
75 return (-1);
76 }
77
78 static int
queue_null_init(struct passwd * pw,int server,const char * conf)79 queue_null_init(struct passwd *pw, int server, const char *conf)
80 {
81 queue_api_on_message_create(queue_null_message_create);
82 queue_api_on_message_commit(queue_null_message_commit);
83 queue_api_on_message_delete(queue_null_message_delete);
84 queue_api_on_message_fd_r(queue_null_message_fd_r);
85 queue_api_on_envelope_create(queue_null_envelope_create);
86 queue_api_on_envelope_delete(queue_null_envelope_delete);
87 queue_api_on_envelope_update(queue_null_envelope_update);
88 queue_api_on_envelope_load(queue_null_envelope_load);
89 queue_api_on_envelope_walk(queue_null_envelope_walk);
90
91 return (1);
92 }
93
94 struct queue_backend queue_backend_null = {
95 queue_null_init,
96 };
97