9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekstatic pool_t dsync_ibc_pipe_get_pool(struct dsync_ibc_pipe *pipe)
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek pools = array_get_modifiable(&pipe->pools, &count);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek return pool_alloconly_create(MEMPOOL_GROWING"pipe item pool", 1024);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekdsync_ibc_pipe_push_item(struct dsync_ibc_pipe *pipe, enum item_type type)
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekstatic struct item *
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekdsync_ibc_pipe_pop_item(struct dsync_ibc_pipe *pipe, enum item_type type)
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item = array_idx_modifiable(&pipe->item_queue, 0);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekstatic bool dsync_ibc_pipe_try_pop_eol(struct dsync_ibc_pipe *pipe)
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekstatic void dsync_ibc_pipe_deinit(struct dsync_ibc *ibc)
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek struct dsync_ibc_pipe *pipe = (struct dsync_ibc_pipe *)ibc;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek array_foreach_modifiable(&pipe->item_queue, item) {
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekdsync_ibc_pipe_send_handshake(struct dsync_ibc *ibc,
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek struct dsync_ibc_pipe *pipe = (struct dsync_ibc_pipe *)ibc;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item = dsync_ibc_pipe_push_item(pipe->remote, ITEM_HANDSHAKE);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.sync_box = p_strdup(item->pool, set->sync_box);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.virtual_all_box = p_strdup(item->pool, set->virtual_all_box);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.exclude_mailboxes = set->exclude_mailboxes == NULL ? NULL :
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek p_strarray_dup(item->pool, set->exclude_mailboxes);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek memcpy(item->u.set.sync_box_guid, set->sync_box_guid,
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.sync_since_timestamp = set->sync_since_timestamp;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.sync_until_timestamp = set->sync_until_timestamp;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.sync_max_size = set->sync_max_size;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item->u.set.sync_flags = p_strdup(item->pool, set->sync_flags);
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozekdsync_ibc_pipe_recv_handshake(struct dsync_ibc *ibc,
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek struct dsync_ibc_pipe *pipe = (struct dsync_ibc_pipe *)ibc;
9a9b5e115b079751422be22fd252c0b283611c62Jakub Hrozek item = dsync_ibc_pipe_pop_item(pipe, ITEM_HANDSHAKE);
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
const char *const *name,
static enum dsync_ibc_recv_ret
const char *const **name_r,
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
unsigned int *count_r,
char *hierarchy_sep_r)
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static enum dsync_ibc_recv_ret
return DSYNC_IBC_RECV_RET_FINISHED;
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
bool require_full_resync)
static enum dsync_ibc_recv_ret
bool *require_full_resync_r)
return DSYNC_IBC_RECV_RET_TRYAGAIN;
return DSYNC_IBC_RECV_RET_OK;
static struct dsync_ibc_pipe *
return pipe;