summaryrefslogtreecommitdiffstats
path: root/src/submission/submission-backend-relay.h
blob: 82a600ade72b90f7249e92927b4d766f41ffce1a (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
#ifndef SUBMISSION_BACKEND_RELAY_H
#define SUBMISSION_BACKEND_RELAY_H

#include "smtp-client-connection.h"
#include "smtp-client-transaction.h"

#include "submission-backend.h"

struct client;
struct submission_backend_relay;

struct submision_backend_relay_settings {
	const char *my_hostname;

	enum smtp_protocol protocol;
	const char *path, *host;
	struct ip_addr ip; /* if empty, resolve host */
	in_port_t port;

	const char *const *extra_capabilities;

	const char *user, *master_user;
	const char *password;
	const struct dsasl_client_mech *sasl_mech;

	enum smtp_client_connection_ssl_mode ssl_mode;

	const char *rawlog_dir;
	unsigned int max_idle_time;

	unsigned int connect_timeout_msecs;
	unsigned int command_timeout_msecs;

	bool ssl_verify:1;
	bool trusted:1;
};

struct submission_backend_relay *
submission_backend_relay_create(
	struct client *client,
	const struct submision_backend_relay_settings *set);

/* Returns the base backend object for this relay backend */
struct submission_backend *
submission_backend_relay_get(struct submission_backend_relay *backend)
	ATTR_PURE;

/* Returns the client connection for this relay backend */
struct smtp_client_connection *
submission_backend_relay_get_connection(
	struct submission_backend_relay *backend) ATTR_PURE;
/* Returns the current client transaction for this relay backend */
struct smtp_client_transaction *
submission_backend_relay_get_transaction(
	struct submission_backend_relay *backend) ATTR_PURE;

/* Initializes the client transaction manually, which allows providing
   alternative transaction flags. */
struct smtp_client_transaction *
submission_backend_relay_init_transaction(
	struct submission_backend_relay *backend,
	enum smtp_client_transaction_flags flags);

#endif