summaryrefslogtreecommitdiffstats
path: root/src/imap-hibernate/imap-client.h
blob: b6bb0e64699230d1b294a7b1c365829e667e1f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef IMAP_CLIENT_H
#define IMAP_CLIENT_H

#include "net.h"

struct imap_client_state {
	/* required: */
	const char *username, *mail_log_prefix;
	/* optional: */
	const char *session_id, *mailbox_vname, *userdb_fields, *stats;
	struct ip_addr local_ip, remote_ip;
	in_port_t local_port, remote_port;
	time_t session_created;

	uid_t uid;
	gid_t gid;

	dev_t peer_dev;
	ino_t peer_ino;

	char *tag;
	const unsigned char *state;
	size_t state_size;

	unsigned int imap_idle_notify_interval;
	bool idle_cmd;
	bool have_notify_fd;
	bool anvil_sent;
};

struct imap_client *
imap_client_create(int fd, const struct imap_client_state *state);
void imap_client_add_notify_fd(struct imap_client *client, int fd);
void imap_client_create_finish(struct imap_client *client);
void imap_client_destroy(struct imap_client **_client, const char *reason);

void imap_clients_init(void);
void imap_clients_deinit(void);

#endif