queue_null.c revision 1.9
1/*	$OpenBSD: queue_null.c,v 1.9 2021/05/26 18:08:55 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#include <sys/stat.h>
24
25#include <ctype.h>
26#include <errno.h>
27#include <event.h>
28#include <fcntl.h>
29#include <imsg.h>
30#include <inttypes.h>
31#include <pwd.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <time.h>
36#include <unistd.h>
37#include <limits.h>
38
39#include "smtpd.h"
40#include "log.h"
41
42static int
43queue_null_message_create(uint32_t *msgid)
44{
45	*msgid = queue_generate_msgid();
46	return (1);
47}
48
49static int
50queue_null_message_commit(uint32_t msgid, const char *path)
51{
52	return (1);
53}
54
55static int
56queue_null_message_delete(uint32_t msgid)
57{
58	return (1);
59}
60
61static int
62queue_null_message_fd_r(uint32_t msgid)
63{
64	return (-1);
65}
66
67static int
68queue_null_envelope_create(uint32_t msgid, const char *buf, size_t len,
69    uint64_t *evpid)
70{
71	*evpid = queue_generate_evpid(msgid);
72	return (1);
73}
74
75static int
76queue_null_envelope_delete(uint64_t evpid)
77{
78	return (1);
79}
80
81static int
82queue_null_envelope_update(uint64_t evpid, const char *buf, size_t len)
83{
84	return (1);
85}
86
87static int
88queue_null_envelope_load(uint64_t evpid, char *buf, size_t len)
89{
90	return (0);
91}
92
93static int
94queue_null_envelope_walk(uint64_t *evpid, char *buf, size_t len)
95{
96	return (-1);
97}
98
99static int
100queue_null_init(struct passwd *pw, int server, const char *conf)
101{
102	queue_api_on_message_create(queue_null_message_create);
103	queue_api_on_message_commit(queue_null_message_commit);
104	queue_api_on_message_delete(queue_null_message_delete);
105	queue_api_on_message_fd_r(queue_null_message_fd_r);
106	queue_api_on_envelope_create(queue_null_envelope_create);
107	queue_api_on_envelope_delete(queue_null_envelope_delete);
108	queue_api_on_envelope_update(queue_null_envelope_update);
109	queue_api_on_envelope_load(queue_null_envelope_load);
110	queue_api_on_envelope_walk(queue_null_envelope_walk);
111
112	return (1);
113}
114
115struct queue_backend queue_backend_null = {
116	queue_null_init,
117};
118