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
21static int
22queue_null_message_create(uint32_t *msgid)
23{
24	*msgid = queue_generate_msgid();
25	return (1);
26}
27
28static int
29queue_null_message_commit(uint32_t msgid, const char *path)
30{
31	return (1);
32}
33
34static int
35queue_null_message_delete(uint32_t msgid)
36{
37	return (1);
38}
39
40static int
41queue_null_message_fd_r(uint32_t msgid)
42{
43	return (-1);
44}
45
46static int
47queue_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
54static int
55queue_null_envelope_delete(uint64_t evpid)
56{
57	return (1);
58}
59
60static int
61queue_null_envelope_update(uint64_t evpid, const char *buf, size_t len)
62{
63	return (1);
64}
65
66static int
67queue_null_envelope_load(uint64_t evpid, char *buf, size_t len)
68{
69	return (0);
70}
71
72static int
73queue_null_envelope_walk(uint64_t *evpid, char *buf, size_t len)
74{
75	return (-1);
76}
77
78static int
79queue_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
94struct queue_backend queue_backend_null = {
95	queue_null_init,
96};
97