cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen#ifndef DSYNC_CLIENT_H
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen#define DSYNC_CLIENT_H
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainenstruct dsync_client;
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainenenum dsync_reply {
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen DSYNC_REPLY_OK,
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen DSYNC_REPLY_FAIL,
c62d29c66b504ad3676deaefdf9e95f54e4f8eecAki Tuomi DSYNC_REPLY_NOUSER,
c62d29c66b504ad3676deaefdf9e95f54e4f8eecAki Tuomi DSYNC_REPLY_NOREPLICATE,
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen};
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainenenum dsync_type {
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen DSYNC_TYPE_FULL,
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen DSYNC_TYPE_NORMAL,
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen DSYNC_TYPE_INCREMENTAL
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen};
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo SirainenARRAY_DEFINE_TYPE(dsync_client, struct dsync_client *);
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainentypedef void dsync_callback_t(enum dsync_reply reply,
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen const char *state, void *context);
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen
36757b426f4761dbd837bdddc8998e22d09dc869Timo Sirainenstruct dsync_client *
36757b426f4761dbd837bdddc8998e22d09dc869Timo Sirainendsync_client_init(const char *path, const char *dsync_params);
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainenvoid dsync_client_deinit(struct dsync_client **conn);
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainenvoid dsync_client_sync(struct dsync_client *conn,
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen const char *username, const char *state, bool full,
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen dsync_callback_t *callback, void *context);
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainenbool dsync_client_is_busy(struct dsync_client *conn);
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainenconst char *dsync_client_get_username(struct dsync_client *conn);
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainenenum dsync_type dsync_client_get_type(struct dsync_client *conn);
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainenconst char *dsync_client_get_state(struct dsync_client *conn);
2e08b126fd1a168c993b1c8c0d1211da236ff604Timo Sirainen
cc116e6d7a2515f0089a449c22a3d61d9ec14642Timo Sirainen#endif