1 #ifndef HEADER_CURL_IMAP_H
2 #define HEADER_CURL_IMAP_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
26 #include "curl_sasl.h"
28 /****************************************************************************
30 ***************************************************************************/
32 IMAP_STOP, /* do nothing state, stops the state machine */
33 IMAP_SERVERGREET, /* waiting for the initial greeting immediately after
37 IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
49 IMAP_LAST /* never used */
52 /* This IMAP struct is used in the Curl_easy. All IMAP data that is
53 connection-oriented must be in imap_conn to properly deal with the fact that
54 perhaps the Curl_easy is changed between the times the connection is
57 curl_pp_transfer transfer;
58 char *mailbox; /* Mailbox to select */
59 char *uidvalidity; /* UIDVALIDITY to check in select */
60 char *uid; /* Message UID to fetch */
61 char *mindex; /* Index in mail box of mail to fetch */
62 char *section; /* Message SECTION to fetch */
63 char *partial; /* Message PARTIAL to fetch */
64 char *query; /* Query to search for */
65 char *custom; /* Custom request */
66 char *custom_params; /* Parameters for the custom request */
69 /* imap_conn is used for struct connection-oriented data in the connectdata
73 imapstate state; /* Always use imap.c:state() to change state! */
74 bool ssldone; /* Is connect() over SSL done? */
75 bool preauth; /* Is this connection PREAUTH? */
76 struct SASL sasl; /* SASL-related parameters */
77 unsigned int preftype; /* Preferred authentication type */
78 unsigned int cmdid; /* Last used command ID */
79 char resptag[5]; /* Response tag to wait for */
80 bool tls_supported; /* StartTLS capability supported by server */
81 bool login_disabled; /* LOGIN command disabled by server */
82 bool ir_supported; /* Initial response supported by server */
83 char *mailbox; /* The last selected mailbox */
84 char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */
85 struct dynbuf dyn; /* for the IMAP commands */
88 extern const struct Curl_handler Curl_handler_imap;
89 extern const struct Curl_handler Curl_handler_imaps;
91 /* Authentication type flags */
92 #define IMAP_TYPE_CLEARTEXT (1 << 0)
93 #define IMAP_TYPE_SASL (1 << 1)
95 /* Authentication type values */
96 #define IMAP_TYPE_NONE 0
97 #define IMAP_TYPE_ANY ~0U
99 #endif /* HEADER_CURL_IMAP_H */