view src/lmtp/lmtp-proxy.h @ 22656:1789bf2a1e01

director: Make sure HOST-RESET-USERS isn't used with max_moving_users=0 The reset command would just hang in that case. doveadm would never have sent this, so this is just an extra sanity check.
author Timo Sirainen <>
date Sun, 05 Nov 2017 23:51:56 +0200
parents 425ee3581927
line wrap: on
line source

#ifndef LMTP_PROXY_H
#define LMTP_PROXY_H

#include "net.h"
#include "lmtp-client.h"


struct lmtp_proxy_settings {
	const char *my_hostname;
	const char *dns_client_socket_path;
	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 {
	const char *host;
	struct ip_addr hostip;
	in_port_t port;
	unsigned int timeout_msecs;
	enum lmtp_client_protocol protocol;
	struct lmtp_recipient_params params;

typedef void lmtp_proxy_finish_callback_t(void *context);

struct lmtp_proxy *
lmtp_proxy_init(const struct lmtp_proxy_settings *set,
		struct ostream *client_output);
void lmtp_proxy_deinit(struct lmtp_proxy **proxy);

/* Set the "MAIL FROM:" line, including <> and options */
void lmtp_proxy_mail_from(struct lmtp_proxy *proxy, const char *value);
/* 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 char *address,
			const struct lmtp_proxy_rcpt_settings *set);
/* Start proxying */
void lmtp_proxy_start(struct lmtp_proxy *proxy, struct istream *data_input,
		      lmtp_proxy_finish_callback_t *callback, void *context)