summaryrefslogtreecommitdiffstats
path: root/src/smtpd/smtpd_proxy.h
blob: 3d35d07c4a7382496fa951db379d97bec405794e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*++
/* NAME
/*	smtpd_proxy 3h
/* SUMMARY
/*	SMTP server pass-through proxy client
/* SYNOPSIS
/*	#include <smtpd.h>
/*	#include <smtpd_proxy.h>
/* DESCRIPTION
/* .nf

 /*
  * Utility library.
  */
#include <vstream.h>
#include <vstring.h>

 /*
  * Application-specific.
  */
typedef int PRINTFPTRLIKE(3, 4) (*SMTPD_PROXY_CMD_FN) (SMTPD_STATE *, int, const char *,...);
typedef int PRINTFPTRLIKE(3, 4) (*SMTPD_PROXY_REC_FPRINTF_FN) (VSTREAM *, int, const char *,...);
typedef int (*SMTPD_PROXY_REC_PUT_FN) (VSTREAM *, int, const char *, ssize_t);

typedef struct SMTPD_PROXY {
    /* Public. */
    VSTREAM *stream;
    VSTRING *request;			/* proxy request buffer */
    VSTRING *reply;			/* proxy reply buffer */
    SMTPD_PROXY_CMD_FN cmd;
    SMTPD_PROXY_REC_FPRINTF_FN rec_fprintf;
    SMTPD_PROXY_REC_PUT_FN rec_put;
    /* Private. */
    int     flags;
    VSTREAM *service_stream;
    const char *service_name;
    int     timeout;
    const char *ehlo_name;
    const char *mail_from;
} SMTPD_PROXY;

#define SMTPD_PROXY_FLAG_SPEED_ADJUST	(1<<0)

#define SMTPD_PROXY_NAME_SPEED_ADJUST	"speed_adjust"

#define SMTPD_PROX_WANT_BAD	0xff	/* Do not use */
#define SMTPD_PROX_WANT_NONE	'\0'	/* Do not receive reply */
#define SMTPD_PROX_WANT_ANY	'0'	/* Expect any reply */
#define SMTPD_PROX_WANT_OK	'2'	/* Expect 2XX reply */
#define SMTPD_PROX_WANT_MORE	'3'	/* Expect 3XX reply */

extern int smtpd_proxy_create(SMTPD_STATE *, int, const char *, int, const char *, const char *);
extern void smtpd_proxy_close(SMTPD_STATE *);
extern void smtpd_proxy_free(SMTPD_STATE *);
extern int smtpd_proxy_parse_opts(const char *, const char *);

/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/