1 #ifndef DSYNC_IBC_PRIVATE_H 2 #define DSYNC_IBC_PRIVATE_H 3 4 #include "dsync-ibc.h" 5 6 struct dsync_ibc_vfuncs { 7 void (*deinit)(struct dsync_ibc *ibc); 8 9 void (*send_handshake)(struct dsync_ibc *ibc, 10 const struct dsync_ibc_settings *set); 11 enum dsync_ibc_recv_ret 12 (*recv_handshake)(struct dsync_ibc *ibc, 13 const struct dsync_ibc_settings **set_r); 14 15 void (*send_end_of_list)(struct dsync_ibc *ibc, 16 enum dsync_ibc_eol_type type); 17 18 void (*send_mailbox_state)(struct dsync_ibc *ibc, 19 const struct dsync_mailbox_state *state); 20 enum dsync_ibc_recv_ret 21 (*recv_mailbox_state)(struct dsync_ibc *ibc, 22 struct dsync_mailbox_state *state_r); 23 24 void (*send_mailbox_tree_node)(struct dsync_ibc *ibc, 25 const char *const *name, 26 const struct dsync_mailbox_node *node); 27 enum dsync_ibc_recv_ret 28 (*recv_mailbox_tree_node)(struct dsync_ibc *ibc, 29 const char *const **name_r, 30 const struct dsync_mailbox_node **node_r); 31 32 void (*send_mailbox_deletes)(struct dsync_ibc *ibc, 33 const struct dsync_mailbox_delete *deletes, 34 unsigned int count, char hierarchy_sep); 35 enum dsync_ibc_recv_ret 36 (*recv_mailbox_deletes)(struct dsync_ibc *ibc, 37 const struct dsync_mailbox_delete **deletes_r, 38 unsigned int *count_r, 39 char *hierarchy_sep_r); 40 41 void (*send_mailbox)(struct dsync_ibc *ibc, 42 const struct dsync_mailbox *dsync_box); 43 enum dsync_ibc_recv_ret 44 (*recv_mailbox)(struct dsync_ibc *ibc, 45 const struct dsync_mailbox **dsync_box_r); 46 47 void (*send_mailbox_attribute)(struct dsync_ibc *ibc, 48 const struct dsync_mailbox_attribute *attr); 49 enum dsync_ibc_recv_ret 50 (*recv_mailbox_attribute)(struct dsync_ibc *ibc, 51 const struct dsync_mailbox_attribute **attr_r); 52 53 void (*send_change)(struct dsync_ibc *ibc, 54 const struct dsync_mail_change *change); 55 enum dsync_ibc_recv_ret 56 (*recv_change)(struct dsync_ibc *ibc, 57 const struct dsync_mail_change **change_r); 58 59 void (*send_mail_request)(struct dsync_ibc *ibc, 60 const struct dsync_mail_request *request); 61 enum dsync_ibc_recv_ret 62 (*recv_mail_request)(struct dsync_ibc *ibc, 63 const struct dsync_mail_request **request_r); 64 65 void (*send_mail)(struct dsync_ibc *ibc, 66 const struct dsync_mail *mail); 67 enum dsync_ibc_recv_ret 68 (*recv_mail)(struct dsync_ibc *ibc, 69 struct dsync_mail **mail_r); 70 71 void (*send_finish)(struct dsync_ibc *ibc, const char *error, 72 enum mail_error mail_error, 73 bool require_full_resync); 74 enum dsync_ibc_recv_ret 75 (*recv_finish)(struct dsync_ibc *ibc, const char **error_r, 76 enum mail_error *mail_error_r, 77 bool *require_full_resync_r); 78 79 void (*close_mail_streams)(struct dsync_ibc *ibc); 80 bool (*is_send_queue_full)(struct dsync_ibc *ibc); 81 bool (*has_pending_data)(struct dsync_ibc *ibc); 82 }; 83 84 struct dsync_ibc { 85 struct dsync_ibc_vfuncs v; 86 87 io_callback_t *io_callback; 88 void *io_context; 89 90 bool failed:1; 91 bool timeout:1; 92 }; 93 94 #endif 95