1/* $NetBSD$ */ 2 3/*++ 4/* NAME 5/* smtpd_proxy 3h 6/* SUMMARY 7/* SMTP server pass-through proxy client 8/* SYNOPSIS 9/* #include <smtpd.h> 10/* #include <smtpd_proxy.h> 11/* DESCRIPTION 12/* .nf 13 14 /* 15 * Utility library. 16 */ 17#include <vstream.h> 18#include <vstring.h> 19 20 /* 21 * Application-specific. 22 */ 23typedef int PRINTFPTRLIKE(3, 4) (*SMTPD_PROXY_CMD_FN) (SMTPD_STATE *, int, const char *,...); 24typedef int PRINTFPTRLIKE(3, 4) (*SMTPD_PROXY_REC_FPRINTF_FN) (VSTREAM *, int, const char *,...); 25typedef int (*SMTPD_PROXY_REC_PUT_FN) (VSTREAM *, int, const char *, ssize_t); 26 27typedef struct SMTPD_PROXY { 28 /* Public. */ 29 VSTREAM *stream; 30 VSTRING *request; /* proxy request buffer */ 31 VSTRING *reply; /* proxy reply buffer */ 32 SMTPD_PROXY_CMD_FN cmd; 33 SMTPD_PROXY_REC_FPRINTF_FN rec_fprintf; 34 SMTPD_PROXY_REC_PUT_FN rec_put; 35 /* Private. */ 36 int flags; 37 VSTREAM *service_stream; 38 const char *service_name; 39 int timeout; 40 const char *ehlo_name; 41 const char *mail_from; 42} SMTPD_PROXY; 43 44#define SMTPD_PROXY_FLAG_SPEED_ADJUST (1<<0) 45 46#define SMTPD_PROXY_NAME_SPEED_ADJUST "speed_adjust" 47 48#define SMTPD_PROX_WANT_BAD 0xff /* Do not use */ 49#define SMTPD_PROX_WANT_NONE '\0' /* Do not receive reply */ 50#define SMTPD_PROX_WANT_ANY '0' /* Expect any reply */ 51#define SMTPD_PROX_WANT_OK '2' /* Expect 2XX reply */ 52#define SMTPD_PROX_WANT_MORE '3' /* Expect 3XX reply */ 53 54extern int smtpd_proxy_create(SMTPD_STATE *, int, const char *, int, const char *, const char *); 55extern void smtpd_proxy_close(SMTPD_STATE *); 56extern void smtpd_proxy_free(SMTPD_STATE *); 57extern int smtpd_proxy_parse_opts(const char *, const char *); 58 59/* LICENSE 60/* .ad 61/* .fi 62/* The Secure Mailer license must be distributed with this software. 63/* AUTHOR(S) 64/* Wietse Venema 65/* IBM T.J. Watson Research 66/* P.O. Box 704 67/* Yorktown Heights, NY 10598, USA 68/*--*/ 69