~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/doveadm/dsync/dsync-ibc.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-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/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.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
 
2
 
 
3
#include "lib.h"
 
4
#include "dsync-mail.h"
 
5
#include "dsync-ibc-private.h"
 
6
 
 
7
void dsync_ibc_deinit(struct dsync_ibc **_ibc)
 
8
{
 
9
        struct dsync_ibc *ibc = *_ibc;
 
10
 
 
11
        *_ibc = NULL;
 
12
        ibc->v.deinit(ibc);
 
13
}
 
14
 
 
15
void dsync_ibc_set_io_callback(struct dsync_ibc *ibc,
 
16
                               io_callback_t *callback, void *context)
 
17
{
 
18
        ibc->io_callback = callback;
 
19
        ibc->io_context = context;
 
20
}
 
21
 
 
22
void dsync_ibc_send_handshake(struct dsync_ibc *ibc,
 
23
                              const struct dsync_ibc_settings *set)
 
24
{
 
25
        ibc->v.send_handshake(ibc, set);
 
26
}
 
27
 
 
28
enum dsync_ibc_recv_ret
 
29
dsync_ibc_recv_handshake(struct dsync_ibc *ibc,
 
30
                         const struct dsync_ibc_settings **set_r)
 
31
{
 
32
        return ibc->v.recv_handshake(ibc, set_r);
 
33
}
 
34
 
 
35
static enum dsync_ibc_send_ret
 
36
dsync_ibc_send_ret(struct dsync_ibc *ibc)
 
37
{
 
38
        return ibc->v.is_send_queue_full(ibc) ?
 
39
                DSYNC_IBC_SEND_RET_FULL :
 
40
                DSYNC_IBC_SEND_RET_OK;
 
41
}
 
42
 
 
43
enum dsync_ibc_send_ret
 
44
dsync_ibc_send_end_of_list(struct dsync_ibc *ibc, enum dsync_ibc_eol_type type)
 
45
{
 
46
        ibc->v.send_end_of_list(ibc, type);
 
47
        return dsync_ibc_send_ret(ibc);
 
48
}
 
49
 
 
50
enum dsync_ibc_send_ret
 
51
dsync_ibc_send_mailbox_state(struct dsync_ibc *ibc,
 
52
                             const struct dsync_mailbox_state *state)
 
53
{
 
54
        T_BEGIN {
 
55
                ibc->v.send_mailbox_state(ibc, state);
 
56
        } T_END;
 
57
        return dsync_ibc_send_ret(ibc);
 
58
}
 
59
 
 
60
enum dsync_ibc_recv_ret
 
61
dsync_ibc_recv_mailbox_state(struct dsync_ibc *ibc,
 
62
                             struct dsync_mailbox_state *state_r)
 
63
{
 
64
        return ibc->v.recv_mailbox_state(ibc, state_r);
 
65
}
 
66
 
 
67
enum dsync_ibc_send_ret
 
68
dsync_ibc_send_mailbox_tree_node(struct dsync_ibc *ibc,
 
69
                                 const char *const *name,
 
70
                                 const struct dsync_mailbox_node *node)
 
71
{
 
72
        i_assert(*name != NULL);
 
73
 
 
74
        T_BEGIN {
 
75
                ibc->v.send_mailbox_tree_node(ibc, name, node);
 
76
        } T_END;
 
77
        return dsync_ibc_send_ret(ibc);
 
78
}
 
79
 
 
80
enum dsync_ibc_recv_ret
 
81
dsync_ibc_recv_mailbox_tree_node(struct dsync_ibc *ibc,
 
82
                                 const char *const **name_r,
 
83
                                 const struct dsync_mailbox_node **node_r)
 
84
{
 
85
        return ibc->v.recv_mailbox_tree_node(ibc, name_r, node_r);
 
86
}
 
87
 
 
88
enum dsync_ibc_send_ret
 
89
dsync_ibc_send_mailbox_deletes(struct dsync_ibc *ibc,
 
90
                               const struct dsync_mailbox_delete *deletes,
 
91
                               unsigned int count, char hierarchy_sep)
 
92
{
 
93
        T_BEGIN {
 
94
                ibc->v.send_mailbox_deletes(ibc, deletes, count,
 
95
                                              hierarchy_sep);
 
96
        } T_END;
 
97
        return dsync_ibc_send_ret(ibc);
 
98
}
 
99
 
 
100
enum dsync_ibc_recv_ret
 
101
dsync_ibc_recv_mailbox_deletes(struct dsync_ibc *ibc,
 
102
                               const struct dsync_mailbox_delete **deletes_r,
 
103
                               unsigned int *count_r, char *hierarchy_sep_r)
 
104
{
 
105
        return ibc->v.recv_mailbox_deletes(ibc, deletes_r, count_r,
 
106
                                             hierarchy_sep_r);
 
107
}
 
108
 
 
109
enum dsync_ibc_send_ret
 
110
dsync_ibc_send_mailbox(struct dsync_ibc *ibc,
 
111
                       const struct dsync_mailbox *dsync_box)
 
112
{
 
113
        T_BEGIN {
 
114
                ibc->v.send_mailbox(ibc, dsync_box);
 
115
        } T_END;
 
116
        return dsync_ibc_send_ret(ibc);
 
117
}
 
118
 
 
119
enum dsync_ibc_recv_ret
 
120
dsync_ibc_recv_mailbox(struct dsync_ibc *ibc,
 
121
                       const struct dsync_mailbox **dsync_box_r)
 
122
{
 
123
        return ibc->v.recv_mailbox(ibc, dsync_box_r);
 
124
}
 
125
 
 
126
enum dsync_ibc_send_ret ATTR_NOWARN_UNUSED_RESULT
 
127
dsync_ibc_send_mailbox_attribute(struct dsync_ibc *ibc,
 
128
                                 const struct dsync_mailbox_attribute *attr)
 
129
{
 
130
        T_BEGIN {
 
131
                ibc->v.send_mailbox_attribute(ibc, attr);
 
132
        } T_END;
 
133
        return dsync_ibc_send_ret(ibc);
 
134
}
 
135
 
 
136
enum dsync_ibc_recv_ret
 
137
dsync_ibc_recv_mailbox_attribute(struct dsync_ibc *ibc,
 
138
                                 const struct dsync_mailbox_attribute **attr_r)
 
139
{
 
140
        return ibc->v.recv_mailbox_attribute(ibc, attr_r);
 
141
}
 
142
 
 
143
enum dsync_ibc_send_ret
 
144
dsync_ibc_send_change(struct dsync_ibc *ibc,
 
145
                      const struct dsync_mail_change *change)
 
146
{
 
147
        i_assert(change->uid > 0);
 
148
 
 
149
        T_BEGIN {
 
150
                ibc->v.send_change(ibc, change);
 
151
        } T_END;
 
152
        return dsync_ibc_send_ret(ibc);
 
153
}
 
154
 
 
155
enum dsync_ibc_recv_ret
 
156
dsync_ibc_recv_change(struct dsync_ibc *ibc,
 
157
                      const struct dsync_mail_change **change_r)
 
158
{
 
159
        return ibc->v.recv_change(ibc, change_r);
 
160
}
 
161
 
 
162
enum dsync_ibc_send_ret
 
163
dsync_ibc_send_mail_request(struct dsync_ibc *ibc,
 
164
                            const struct dsync_mail_request *request)
 
165
{
 
166
        i_assert(request->guid != NULL || request->uid != 0);
 
167
 
 
168
        T_BEGIN {
 
169
                ibc->v.send_mail_request(ibc, request);
 
170
        } T_END;
 
171
        return dsync_ibc_send_ret(ibc);
 
172
}
 
173
 
 
174
enum dsync_ibc_recv_ret
 
175
dsync_ibc_recv_mail_request(struct dsync_ibc *ibc,
 
176
                            const struct dsync_mail_request **request_r)
 
177
{
 
178
        return ibc->v.recv_mail_request(ibc, request_r);
 
179
}
 
180
 
 
181
enum dsync_ibc_send_ret
 
182
dsync_ibc_send_mail(struct dsync_ibc *ibc, const struct dsync_mail *mail)
 
183
{
 
184
        i_assert(*mail->guid != '\0' || mail->uid != 0);
 
185
 
 
186
        T_BEGIN {
 
187
                ibc->v.send_mail(ibc, mail);
 
188
        } T_END;
 
189
        return dsync_ibc_send_ret(ibc);
 
190
}
 
191
 
 
192
enum dsync_ibc_recv_ret
 
193
dsync_ibc_recv_mail(struct dsync_ibc *ibc, struct dsync_mail **mail_r)
 
194
{
 
195
        return ibc->v.recv_mail(ibc, mail_r);
 
196
}
 
197
 
 
198
void dsync_ibc_close_mail_streams(struct dsync_ibc *ibc)
 
199
{
 
200
        ibc->v.close_mail_streams(ibc);
 
201
}
 
202
 
 
203
bool dsync_ibc_has_failed(struct dsync_ibc *ibc)
 
204
{
 
205
        return ibc->failed;
 
206
}
 
207
 
 
208
bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc)
 
209
{
 
210
        return ibc->timeout;
 
211
}
 
212
 
 
213
bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc)
 
214
{
 
215
        return ibc->v.is_send_queue_full(ibc);
 
216
}
 
217
 
 
218
bool dsync_ibc_has_pending_data(struct dsync_ibc *ibc)
 
219
{
 
220
        return ibc->v.has_pending_data(ibc);
 
221
}