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