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