~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib-imap/imap-url.h

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef IMAP_URL_H
 
2
#define IMAP_URL_H
 
3
 
 
4
struct imap_url {
 
5
        /* server */
 
6
        const char *host_name;
 
7
        struct ip_addr host_ip;
 
8
        in_port_t port;
 
9
 
 
10
        /* user */
 
11
        const char *userid;
 
12
        const char *auth_type;
 
13
 
 
14
        /* mailbox */
 
15
        const char *mailbox;
 
16
        uint32_t uidvalidity;  /* 0 if not set */
 
17
 
 
18
        /* message part */
 
19
        uint32_t uid;
 
20
        const char *section;
 
21
        uoff_t partial_offset;
 
22
        uoff_t partial_size; /* 0 if not set */
 
23
 
 
24
        /* message list (uid == 0) */
 
25
        const char *search_program;
 
26
 
 
27
        /* urlauth */
 
28
        const char *uauth_rumpurl;
 
29
        const char *uauth_access_application;
 
30
        const char *uauth_access_user;
 
31
        const char *uauth_mechanism;
 
32
        const unsigned char *uauth_token;
 
33
        size_t uauth_token_size;
 
34
        time_t uauth_expire; /* (time_t)-1 if not set */
 
35
 
 
36
        unsigned int have_host_ip:1; /* url uses IP address */
 
37
        unsigned int have_port:1;
 
38
        unsigned int have_partial:1;
 
39
};
 
40
 
 
41
/*
 
42
 * IMAP URL parsing
 
43
 */
 
44
 
 
45
enum imap_url_parse_flags {
 
46
        /* Scheme part 'imap:' is already parsed externally. This implies that
 
47
           this is an absolute IMAP URL. */
 
48
        IMAP_URL_PARSE_SCHEME_EXTERNAL  = 0x01,
 
49
        /* Require relative URL (omitting _both_ scheme and authority), e.g.
 
50
           /MAILBOX/;UID=uid or even ;UID=uid. This flag means that an absolute
 
51
           URL makes no sense in this context. Relative URLs are allowed once a
 
52
           base URL is provided to the parser. */
 
53
        IMAP_URL_PARSE_REQUIRE_RELATIVE = 0x02,
 
54
        /* Allow URLAUTH URL */
 
55
        IMAP_URL_PARSE_ALLOW_URLAUTH    = 0x04
 
56
};
 
57
 
 
58
/* Parses full IMAP URL. The returned URL is allocated from data stack. */
 
59
int imap_url_parse(const char *url, struct imap_url *base,
 
60
                   enum imap_url_parse_flags flags,
 
61
                   struct imap_url **url_r, const char **error_r);
 
62
 
 
63
/*
 
64
 * IMAP URL construction
 
65
 */
 
66
 
 
67
const char *imap_url_create(const struct imap_url *url);
 
68
 
 
69
const char *imap_url_add_urlauth(const char *rumpurl, const char *mechanism,
 
70
                                 const unsigned char *token, size_t token_len);
 
71
 
 
72
#endif