lmtp-proxy.h revision 11bb1153a62c952a080b2ba6950477c328b06235
#ifndef LMTP_PROXY_H
#define LMTP_PROXY_H
#include "net.h"
#include "smtp-address.h"
#include "smtp-params.h"
#include "smtp-client.h"
#define LMTP_PROXY_DEFAULT_TTL 5
struct smtp_address;
struct lmtp_proxy;
struct client;
struct lmtp_proxy_settings {
const char *my_hostname;
const char *session_id;
/* the original client's IP/port that connected to the proxy */
struct ip_addr source_ip;
in_port_t source_port;
unsigned int proxy_ttl;
};
struct lmtp_proxy_rcpt_settings {
enum smtp_protocol protocol;
const char *host;
struct ip_addr hostip;
in_port_t port;
unsigned int timeout_msecs;
struct smtp_params_rcpt params;
};
typedef void lmtp_proxy_finish_callback_t(void *context);
void lmtp_proxy_deinit(struct lmtp_proxy **proxy);
unsigned int lmtp_proxy_rcpt_count(struct client *client);
/* Add a new recipient. Returns -1 if we already know that the destination
host can't be reached. */
int lmtp_proxy_add_rcpt(struct lmtp_proxy *proxy,
const struct smtp_address *address,
const struct lmtp_proxy_rcpt_settings *set);
int lmtp_proxy_rcpt(struct client *client,
struct smtp_address *address,
const char *username, const char *detail, char delim,
struct smtp_params_rcpt *params);
/* Start proxying */
void lmtp_proxy_start(struct lmtp_proxy *proxy, struct istream *data_input,
lmtp_proxy_finish_callback_t *callback, void *context)
ATTR_NULL(3);
#endif