aboutsummaryrefslogtreecommitdiff
path: root/src/imap/ngx_imap.h
blob: d5adc184e45ca97cfa4aa3a61fc95cb286e55ec1 (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
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
#ifndef _NGX_IMAP_H_INCLUDED_
#define _NGX_IMAP_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_event_connect.h>


typedef struct {
    ngx_peer_connection_t   upstream;

    ngx_buf_t              *buffer;
} ngx_imap_proxy_ctx_t;


typedef struct {
    uint32_t                signature;         /* "IMAP" */

    ngx_connection_t       *connection;
    ngx_buf_t              *buffer;

    ngx_imap_proxy_ctx_t   *proxy;

    ngx_uint_t              command;
    ngx_array_t             args;

    /* used to parse IMAP/POP3 command */

    ngx_uint_t              state;
    u_char                 *arg_start;
    u_char                 *arg_end;
} ngx_imap_session_t;


#define NGX_POP3_USER       1
#define NGX_POP3_PASS       2
#define NGX_POP3_APOP       3
#define NGX_POP3_STAT       4
#define NGX_POP3_LIST       5
#define NGX_POP3_RETR       6
#define NGX_POP3_DELE       7
#define NGX_POP3_NOOP       8
#define NGX_POP3_RSET       9
#define NGX_POP3_TOP        10
#define NGX_POP3_UIDL       11
#define NGX_POP3_QUIT       12


#define NGX_IMAP_PARSE_INVALID_COMMAND  10


#define NGX_IMAP_PROXY_INVALID  10
#define NGX_IMAP_PROXY_ERROR    11


void ngx_imap_init_connection(ngx_connection_t *c);
void ngx_imap_close_connection(ngx_connection_t *c);

void ngx_imap_proxy_init(ngx_imap_session_t *s);

ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s);


#endif /* _NGX_IMAP_H_INCLUDED_ */