7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#ifndef DSYNC_MAILBOX_TREE_PRIVATE_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#define DSYNC_MAILBOX_TREE_PRIVATE_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#include "dsync-mailbox-tree.h"
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenstruct dsync_mailbox_tree {
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen pool_t pool;
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen char sep, sep_str[2], remote_sep, alt_char;
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen /* root node isn't part of the real mailbox tree. its name is "" and
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen it has no siblings */
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen struct dsync_mailbox_node root;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen unsigned int iter_count;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct dsync_mailbox_delete) deletes;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen /* guid_128_t => struct dsync_mailbox_node */
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) name128_hash;
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) name128_remotesep_hash;
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen HASH_TABLE(uint8_t *, struct dsync_mailbox_node *) guid_hash;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen};
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenvoid dsync_mailbox_tree_build_name128_hash(struct dsync_mailbox_tree *tree);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainenint dsync_mailbox_node_name_cmp(struct dsync_mailbox_node *const *n1,
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen struct dsync_mailbox_node *const *n2);
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainenvoid dsync_mailbox_tree_node_attach(struct dsync_mailbox_node *node,
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen struct dsync_mailbox_node *parent);
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainenvoid dsync_mailbox_tree_node_detach(struct dsync_mailbox_node *node);
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainenstruct dsync_mailbox_tree *
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainendsync_mailbox_tree_dup(const struct dsync_mailbox_tree *src);
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainenbool dsync_mailbox_trees_equal(struct dsync_mailbox_tree *tree1,
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen struct dsync_mailbox_tree *tree2);
39ee82dad4d4fa61e3ed074d191afc6a9b82e249Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#endif