-
Notifications
You must be signed in to change notification settings - Fork 0
/
mfs_imap.h
87 lines (73 loc) · 1.51 KB
/
mfs_imap.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef _MFS_IMAP_H_
#define _MFS_IMAP_H_
#include "mfs_cmdqueue.h"
#define MAXTAG 63
#define IDLETAG 63
#define NRTAG 64
#define IMAP_TIMEOUT (msecs_to_jiffies(30000))
enum imap_cmd_id {
IMAPCMD_LOGIN,
IMAPCMD_LOGOUT,
IMAPCMD_LIST,
IMAPCMD_SELECT,
IMAPCMD_FETCHALL,
IMAPCMD_FETCHFROM,
IMAPCMD_FETCHFULLMAIL,
IMAPCMD_FETCHMAIL,
IMAPCMD_IDLE,
IMAPCMD_DONE,
IMAPCMD_NR
};
struct imap_cmd {
struct list_head next;
struct kref refcnt;
char *str;
ssize_t len;
enum imap_cmd_id id;
uint8_t cont;
};
struct imap_rcv_handle {
struct imap_msg **rcv;
wait_queue_head_t qwait;
atomic_t reserved;
atomic_t ready;
};
struct box;
struct message;
struct imap_opt {
char *login;
char *pass;
};
struct imap {
struct task_struct *rcv_thread;
struct task_struct *con_thread;
struct task_struct *snd_thread;
struct task_struct *idl_thread;
struct mfs_cmdqueue send;
struct imap_rcv_handle rcv_handle[NRTAG];
struct list_head boxes;
struct list_head fetching;
struct box *selbox;
wait_queue_head_t rcvwait;
wait_queue_head_t idlwait;
wait_queue_head_t conwait;
wait_queue_head_t sndwait;
struct imap_opt opt;
size_t mcachesz;
atomic_t next_tag;
atomic_t ctag;
atomic_t idling;
unsigned int flags;
struct msgcache *mcache[];
};
#define IMAP_CONN (1 << 0)
#define IMAP_AUTH (1 << 1)
#define IMAP_INIT (1 << 2)
#define IMAP_EXIT (1 << 3)
#define IMAP_CMD (1 << 4)
extern struct mfs_client_operations imapops;
/**
* TODO: remove put these into mfs_imap_cmd
*/
void imap_cleanup_cmd(struct imap_cmd *c);
#endif