head 1.12; access; symbols SOURCE_RESTRUCTURING_BEFORE:1.11 LMTP2NNTP_1_2a1:1.11 LMTP2NNTP_1_1_1:1.11 LMTP2NNTP_1_1_0:1.11 LMTP2NNTP_1_1b4:1.11 LMTP2NNTP_1_1b3:1.11 LMTP2NNTP_1_1b2:1.11 LMTP2NNTP_1_1b1:1.11 LMTP2NNTP_1_0_0:1.10 LMTP2NNTP_0_9_7:1.10 LMTP2NNTP_0_9_6:1.10 LMTP2NNTP_0_9_5:1.10 LMTP2NNTP_0_9_4:1.8 LMTP2NNTP_0_9_3:1.8 LMTP2NNTP_0_9_2:1.8 LMTP2NNTP_0_9_1:1.8 LMTP2NNTP_0_9_0:1.8; locks; strict; comment @ * @; 1.12 date 2001.12.31.11.09.52; author thl; state dead; branches; next 1.11; 1.11 date 2001.10.08.13.40.22; author rse; state Exp; branches; next 1.10; 1.10 date 2001.09.07.15.02.08; author thl; state Exp; branches; next 1.9; 1.9 date 2001.09.04.09.46.06; author rse; state Exp; branches; next 1.8; 1.8 date 2001.08.14.14.42.41; author thl; state Exp; branches; next 1.7; 1.7 date 2001.08.14.08.15.25; author thl; state Exp; branches; next 1.6; 1.6 date 2001.07.25.19.51.12; author rse; state Exp; branches; next 1.5; 1.5 date 2001.07.25.15.02.57; author thl; state Exp; branches; next 1.4; 1.4 date 2001.07.25.11.29.38; author thl; state Exp; branches; next 1.3; 1.3 date 2001.07.24.11.32.07; author thl; state Exp; branches; next 1.2; 1.2 date 2001.07.23.12.14.06; author thl; state Exp; branches; next 1.1; 1.1 date 2001.07.17.12.40.07; author thl; state Exp; branches; next ; desc @@ 1.12 log @Mega-Commit: Finally restructure the lmtp2nntp source tree in order to clean it up. We especially use a consistent prefix for all inlined sources. @ text @/* ** Copyright (c) 2001 The OSSP Project ** Copyright (c) 2001 Cable & Wireless Deutschland ** ** This file is part of OSSP lmtp2nntp, an LMTP speaking local ** mailer which forwards mails as Usenet news articles via NNTP. ** It can be found at http://www.ossp.org/pkg/lmtp2nntp/. ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version ** 2.0 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this file; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 ** USA, or contact the OSSP project . ** ** lmtp.h: Local Mail Transfer Protocol (LMTP) server library (API) */ #ifndef __LMTP_H__ #define __LMTP_H__ #include #include #include #include struct lmtp_st; typedef struct lmtp_st lmtp_t; typedef struct { void *ctx; int (*select)(void *, fd_set *, fd_set *, fd_set *, struct timeval *); ssize_t (*read)(void *, void *, size_t); ssize_t (*write)(void *, const void *, size_t); } lmtp_io_t; typedef struct { char *verb; char *msg; } lmtp_req_t; typedef struct { char *statuscode; char *dsncode; char *statusmsg; } lmtp_res_t; typedef enum { LMTP_OK, LMTP_EOF, LMTP_ERR_SYSTEM, LMTP_ERR_MEM, LMTP_ERR_OVERFLOW, LMTP_ERR_ARG, LMTP_ERR_UNKNOWN } lmtp_rc_t; typedef struct { int fd; } lmtp_fd_t; typedef lmtp_rc_t (*lmtp_cb_t)(lmtp_t *, lmtp_io_t *, lmtp_req_t *, void *); lmtp_t *lmtp_create (lmtp_io_t *); void lmtp_destroy (lmtp_t *); lmtp_rc_t lmtp_readline(lmtp_t *, char *, size_t); lmtp_rc_t lmtp_readmsg (lmtp_t *, char **, size_t); lmtp_rc_t lmtp_request (lmtp_t *, lmtp_req_t *); lmtp_rc_t lmtp_response(lmtp_t *, lmtp_res_t *); char *lmtp_error (lmtp_rc_t); lmtp_rc_t lmtp_register(lmtp_t *, char *, lmtp_cb_t, void *, lmtp_cb_t *, void **); lmtp_rc_t lmtp_loop (lmtp_t *); ssize_t lmtp_fd_read (void *, void *, size_t); ssize_t lmtp_fd_write(void *, const void *, size_t); #endif /* __LMTP_H__ */ @ 1.11 log @Change LMTP library from using a file-descriptor (int) to using a opaque handle (void *) and use this new feature to support STDIN/STDOUT and SA. @ text @@ 1.10 log @Replace ad-hoc tracing with L2_LEVEL_TRACE based approach. @ text @d40 3 a42 3 int (*select)(void *, int, fd_set *, fd_set *, fd_set *, struct timeval *); ssize_t (*read)(void *, int, void *, size_t); ssize_t (*write)(void *, int, const void *, size_t); d66 4 d72 1 a72 1 lmtp_t *lmtp_create (int, int, lmtp_io_t *); d81 2 @ 1.9 log @Finally apply GNU General Public License (GPL) to OSSP lmtp2nntp. @ text @d39 4 a42 3 int (*select)(int, fd_set *, fd_set *, fd_set *, struct timeval *); ssize_t (*read)(int, void *, size_t); ssize_t (*write)(int, const void *, size_t); @ 1.8 log @connected LMTP and NNTP side, now featuring all three -g groupmodes, added post1000 articles burn-in @ text @d2 24 a25 27 * lmtp.h: LMTP library (API definition) * * Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) * Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) * * This file is part of OSSP lmtp2nntp, an LMTP speaking local * mailer which forwards mails as Usenet news articles via NNTP. * It can be found at http://www.ossp.com/pkg/lmtp2nntp/. * * Permission to use, copy, modify, and distribute this software for * any purpose with or without fee is hereby granted, provided that * the above copyright notice and this permission notice appear in all * copies. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ @ 1.7 log @cleanup msg.[ch], moved tracing to trace.[ch], added target to Makefile, added -t switch in lmtp2nntp.[c|pod], incorporated tracing into lmtp.[ch] and nntp.[ch], run.sh now using new tracing option @ text @d76 1 a76 1 char *lmtp_error (lmtp_t *, lmtp_rc_t); @ 1.6 log @Full-metal jacket cleanup ;) Hopefully Thomas does not kill me... @ text @d42 1 @ 1.5 log @added argz library and first inter-callback functionality @ text @d1 28 d42 2 a43 2 ssize_t (*read) (int fd, void *buf, size_t nbytes); ssize_t (*write) (int fd, const void *buf, size_t nbytes); d47 2 a48 2 char *verb; /* verb found */ char *msg; /* wholly message including verb */ d52 3 a54 3 char *statuscode; /* digit digit digit NUL */ char *dsncode; /* digit dot digit dot digit NUL */ char *statusmsg; /* message with >=0*NLs, not terminating with NL. NUL */ d59 6 a64 6 LMTP_EOF, /* eof */ LMTP_ERR_SYSTEM, /* see errno */ LMTP_ERR_MEM, /* dynamic memory allocation failed */ LMTP_ERR_OVERFLOW, /* static allocated memory exhausted */ LMTP_ERR_ARG, /* invalid arg was passed to function */ LMTP_ERR_UNKNOWN /* guru meditation */ d67 1 a67 1 typedef lmtp_rc_t (*lmtp_cb_t)(lmtp_t *lmtp, lmtp_io_t *io, lmtp_req_t *req, void *ctx); d69 9 a77 9 lmtp_t *lmtp_create (int rfd, int wfd, lmtp_io_t *io); void lmtp_destroy (lmtp_t *lmtp); lmtp_rc_t lmtp_readline(lmtp_t *lmtp, char *buf, size_t buflen); lmtp_rc_t lmtp_readmsg (lmtp_t *lmtp, char **buf, size_t maxlen); lmtp_rc_t lmtp_request (lmtp_t *lmtp, lmtp_req_t *req); lmtp_rc_t lmtp_response(lmtp_t *lmtp, lmtp_res_t *res); char *lmtp_error (lmtp_t *lmtp, lmtp_rc_t rc); lmtp_rc_t lmtp_register(lmtp_t *lmtp, char *verb, lmtp_cb_t cb, void *ctx, lmtp_cb_t *oldcb, void **oldctx); lmtp_rc_t lmtp_loop (lmtp_t *lmtp); d80 1 @ 1.4 log @shortly before lmtp_message/lmtp_reset are vanished @ text @a13 1 int (*select)(int nfds, fd_set *rfds, fd_set *wrfds, fd_set *efds, struct timeval *t); a28 6 struct lmtp_msg_st { struct lmtp_msg_st *next; char *msg; }; typedef struct lmtp_msg_st lmtp_msg_t; a46 2 lmtp_msg_t *lmtp_message (lmtp_t *lmtp, char *verb); void lmtp_reset (lmtp_t *lmtp); @ 1.3 log @first time working with sendmail @ text @d30 6 a41 1 LMTP_ERR_VERB, /* search for verb failed */ d54 1 a54 1 char **lmtp_message (lmtp_t *lmtp, char *verb); @ 1.2 log @first successful loop() @ text @d41 1 a41 1 typedef lmtp_rc_t (*lmtp_cb_t)(lmtp_io_t *io, lmtp_req_t *req, lmtp_res_t *res, void *ctx); d46 1 a46 1 lmtp_rc_t lmtp_readmsg (lmtp_t *lmtp, char *buf, size_t buflen); @ 1.1 log @ralf s. engelschall first api draft @ text @d1 1 d20 2 a21 2 char *verb; char *msg; d25 3 a27 3 int rc; char *dsn; char *msg; d32 7 a38 2 LMTP_ERR_SYSTEM, /* see errno */ LMTP_ERR_INVALID_VERB a40 5 typedef enum { LMTP_TYPE_SINGLELINE, LMTP_TYPE_MULTILINE } lmtp_type_t; d45 2 d48 1 a48 1 lmtp_rc_t lmtp_result (lmtp_t *lmtp, lmtp_res_t *res); d52 1 a52 1 lmtp_cb_t lmtp_register(lmtp_t *lmtp, char *verb, lmtp_type_t type, lmtp_cb_t *cb, void *ctx); @