director.h revision 1df39b899804fd1dbc560f75382364822935c857
#ifndef DIRECTOR_H
#define DIRECTOR_H
#include "network.h"
#include "director-settings.h"
#define DIRECTOR_VERSION_NAME "director"
#define DIRECTOR_VERSION_MAJOR 1
#define DIRECTOR_VERSION_MINOR 3
/* weak users supported in protocol v1.1+ */
#define DIRECTOR_VERSION_WEAK_USERS 1
/* director removes supported in v1.2+ */
#define DIRECTOR_VERSION_RING_REMOVE 2
/* quit reason supported in v1.3+ */
#define DIRECTOR_VERSION_QUIT 3
/* Minimum time between even attempting to communicate with a director that
failed due to a protocol error. */
#define DIRECTOR_PROTOCOL_FAILURE_RETRY_SECS 60
struct director;
struct mail_host;
struct user;
struct director {
const struct director_settings *set;
unsigned int self_port;
unsigned int test_port;
struct director_host *self_host;
/* left and right connections are set only after they have finished
handshaking. until then they're in the connections list, although
updates are still sent to them during handshaking if the USER list
is long. */
/* all director connections */
struct timeout *to_reconnect;
struct timeout *to_callback;
/* current mail hosts */
struct mail_host_list *mail_hosts;
/* original mail hosts configured in config file.
this is used only for doveadm lookups */
struct mail_host_list *orig_config_hosts;
/* temporary user -> host associations */
struct user_directory *users;
/* these requests are waiting for directors to be in synced */
struct timeout *to_request;
struct timeout *to_handshake_warning;
/* director hosts are sorted by IP (and port) */
struct timeout *to_remove_dirs;
struct ipc_client *ipc_proxy;
unsigned int sync_seq;
/* the lowest minor version supported by the ring */
unsigned int ring_min_version;
/* director ring handshaking is complete.
director can start serving clients. */
unsigned int ring_handshaked:1;
unsigned int ring_handshake_warning_sent:1;
unsigned int ring_synced:1;
unsigned int sync_frozen:1;
unsigned int sync_pending:1;
};
extern bool director_debug;
/* Create a new director. If listen_ip specifies an actual IP, it's used with
listen_port for finding ourself from the director_servers setting.
listen_port is used regardless by director_host_add_from_string() for hosts
without specified port. */
struct director *
/* Start connecting to other directors */
struct director_host *src);
struct director_host *src);
struct director_host *orig_src,
struct director_host *orig_src,
struct director_host *orig_src,
struct director_host *orig_src,
struct director_host *orig_src,
struct director_host *src,
struct director_host *orig_src,
unsigned int username_hash);
/* Send data to all directors using both left and right connections
(unless they're the same). */
const char *cmd);
struct director_host *src,
unsigned int min_version, const char *cmd);
#endif