~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/director/director.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/{control,rules}: enable PIE hardening.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include "network.h"
5
5
#include "director-settings.h"
6
6
 
 
7
#define DIRECTOR_VERSION_NAME "director"
 
8
#define DIRECTOR_VERSION_MAJOR 1
 
9
#define DIRECTOR_VERSION_MINOR 2
 
10
 
 
11
/* weak users supported in protocol v1.1+ */
 
12
#define DIRECTOR_VERSION_WEAK_USERS 1
 
13
/* director removes supported in v1.2+ */
 
14
#define DIRECTOR_VERSION_RING_REMOVE 2
 
15
 
 
16
/* Minimum time between even attempting to communicate with a director that
 
17
   failed due to a protocol error. */
 
18
#define DIRECTOR_PROTOCOL_FAILURE_RETRY_SECS 60
 
19
 
7
20
struct director;
8
21
struct mail_host;
9
22
struct user;
20
33
        unsigned int test_port;
21
34
 
22
35
        struct director_host *self_host;
 
36
        /* left and right connections are set only after they have finished
 
37
           handshaking. until then they're in the connections list, although
 
38
           updates are still sent to them during handshaking if the USER list
 
39
           is long. */
23
40
        struct director_connection *left, *right;
24
41
        /* all director connections */
25
 
        struct director_connection *connections;
 
42
        ARRAY_DEFINE(connections, struct director_connection *);
26
43
        struct timeout *to_reconnect;
 
44
        struct timeout *to_sync;
27
45
 
28
46
        /* current mail hosts */
29
47
        struct mail_host_list *mail_hosts;
42
60
 
43
61
        /* director hosts are sorted by IP (and port) */
44
62
        ARRAY_DEFINE(dir_hosts, struct director_host *);
 
63
        struct timeout *to_remove_dirs;
45
64
 
46
65
        struct ipc_client *ipc_proxy;
47
66
        unsigned int sync_seq;
 
67
        /* the lowest minor version supported by the ring */
 
68
        unsigned int ring_min_version;
 
69
        time_t ring_last_sync_time;
 
70
 
 
71
        time_t ring_first_alone;
48
72
 
49
73
        /* director ring handshaking is complete.
50
74
           director can start serving clients. */
65
89
              const struct ip_addr *listen_ip, unsigned int listen_port,
66
90
              director_state_change_callback_t *callback);
67
91
void director_deinit(struct director **dir);
 
92
void director_find_self(struct director *dir);
68
93
 
69
94
/* Start connecting to other directors */
70
95
void director_connect(struct director *dir);
71
96
 
72
97
void director_set_ring_handshaked(struct director *dir);
73
98
void director_set_ring_synced(struct director *dir);
 
99
void director_set_ring_unsynced(struct director *dir);
74
100
void director_set_state_changed(struct director *dir);
 
101
void director_sync_send(struct director *dir, struct director_host *host,
 
102
                        uint32_t seq, unsigned int minor_version);
 
103
bool director_resend_sync(struct director *dir);
 
104
 
 
105
void director_notify_ring_added(struct director_host *added_host,
 
106
                                struct director_host *src);
 
107
void director_ring_remove(struct director_host *removed_host,
 
108
                          struct director_host *src);
75
109
 
76
110
void director_update_host(struct director *dir, struct director_host *src,
77
111
                          struct director_host *orig_src,
84
118
                         struct mail_host *host);
85
119
void director_update_user(struct director *dir, struct director_host *src,
86
120
                          struct user *user);
 
121
void director_update_user_weak(struct director *dir, struct director_host *src,
 
122
                               struct director_host *orig_src,
 
123
                               struct user *user);
87
124
void director_move_user(struct director *dir, struct director_host *src,
88
125
                        struct director_host *orig_src,
89
126
                        unsigned int username_hash, struct mail_host *host);
92
129
                                     struct director_host *src,
93
130
                                     struct director_host *orig_src,
94
131
                                     unsigned int username_hash);
 
132
void director_user_weak(struct director *dir, struct user *user);
95
133
 
96
134
void director_sync_freeze(struct director *dir);
97
135
void director_sync_thaw(struct director *dir);
99
137
/* Send data to all directors using both left and right connections
100
138
   (unless they're the same). */
101
139
void director_update_send(struct director *dir, struct director_host *src,
102
 
                          const char *data);
 
140
                          const char *cmd);
 
141
void director_update_send_version(struct director *dir,
 
142
                                  struct director_host *src,
 
143
                                  unsigned int min_version, const char *cmd);
103
144
 
104
145
int director_connect_host(struct director *dir, struct director_host *host);
105
146