2012-12-28 19:03:09 +08:00
|
|
|
#ifndef HEADER_CURL_IMAP_H
|
|
|
|
#define HEADER_CURL_IMAP_H
|
2009-12-13 05:54:01 +08:00
|
|
|
/***************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2017-08-23 06:08:18 +08:00
|
|
|
* Copyright (C) 2009 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2009-12-13 05:54:01 +08:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2016-02-03 07:19:02 +08:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2009-12-13 05:54:01 +08:00
|
|
|
*
|
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2013-01-04 09:50:28 +08:00
|
|
|
#include "pingpong.h"
|
2015-01-20 21:14:26 +08:00
|
|
|
#include "curl_sasl.h"
|
2009-12-13 05:54:01 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* IMAP unique setup
|
|
|
|
***************************************************************************/
|
|
|
|
typedef enum {
|
2012-12-29 03:59:14 +08:00
|
|
|
IMAP_STOP, /* do nothing state, stops the state machine */
|
|
|
|
IMAP_SERVERGREET, /* waiting for the initial greeting immediately after
|
|
|
|
a connect */
|
2013-02-11 05:18:30 +08:00
|
|
|
IMAP_CAPABILITY,
|
2009-12-13 05:54:01 +08:00
|
|
|
IMAP_STARTTLS,
|
2012-12-29 03:59:14 +08:00
|
|
|
IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
|
|
|
|
(multi mode only) */
|
2015-01-21 00:33:05 +08:00
|
|
|
IMAP_AUTHENTICATE,
|
2012-12-30 20:44:09 +08:00
|
|
|
IMAP_LOGIN,
|
2013-03-06 05:34:53 +08:00
|
|
|
IMAP_LIST,
|
2009-12-13 05:54:01 +08:00
|
|
|
IMAP_SELECT,
|
|
|
|
IMAP_FETCH,
|
2013-03-01 02:16:33 +08:00
|
|
|
IMAP_FETCH_FINAL,
|
2013-03-02 03:04:56 +08:00
|
|
|
IMAP_APPEND,
|
|
|
|
IMAP_APPEND_FINAL,
|
2014-04-18 22:43:04 +08:00
|
|
|
IMAP_SEARCH,
|
2009-12-13 05:54:01 +08:00
|
|
|
IMAP_LOGOUT,
|
2012-12-29 03:59:14 +08:00
|
|
|
IMAP_LAST /* never used */
|
2009-12-13 05:54:01 +08:00
|
|
|
} imapstate;
|
|
|
|
|
2016-06-21 21:47:12 +08:00
|
|
|
/* This IMAP struct is used in the Curl_easy. All IMAP data that is
|
2013-02-23 17:29:40 +08:00
|
|
|
connection-oriented must be in imap_conn to properly deal with the fact that
|
2016-06-21 21:47:12 +08:00
|
|
|
perhaps the Curl_easy is changed between the times the connection is
|
2013-02-23 17:29:40 +08:00
|
|
|
used. */
|
|
|
|
struct IMAP {
|
2013-02-24 01:09:24 +08:00
|
|
|
curl_pp_transfer transfer;
|
2013-02-23 17:29:40 +08:00
|
|
|
char *mailbox; /* Mailbox to select */
|
2013-02-24 01:24:53 +08:00
|
|
|
char *uidvalidity; /* UIDVALIDITY to check in select */
|
|
|
|
char *uid; /* Message UID to fetch */
|
2018-07-31 19:12:18 +08:00
|
|
|
char *mindex; /* Index in mail box of mail to fetch */
|
2013-02-24 01:24:53 +08:00
|
|
|
char *section; /* Message SECTION to fetch */
|
2014-04-19 00:42:40 +08:00
|
|
|
char *partial; /* Message PARTIAL to fetch */
|
2014-04-18 22:58:33 +08:00
|
|
|
char *query; /* Query to search for */
|
2013-03-03 17:12:27 +08:00
|
|
|
char *custom; /* Custom request */
|
|
|
|
char *custom_params; /* Parameters for the custom request */
|
2013-02-23 17:29:40 +08:00
|
|
|
};
|
|
|
|
|
2009-12-13 05:54:01 +08:00
|
|
|
/* imap_conn is used for struct connection-oriented data in the connectdata
|
|
|
|
struct */
|
|
|
|
struct imap_conn {
|
|
|
|
struct pingpong pp;
|
2013-02-27 07:15:16 +08:00
|
|
|
imapstate state; /* Always use imap.c:state() to change state! */
|
|
|
|
bool ssldone; /* Is connect() over SSL done? */
|
2017-08-23 06:08:18 +08:00
|
|
|
bool preauth; /* Is this connection PREAUTH? */
|
2015-01-20 21:14:26 +08:00
|
|
|
struct SASL sasl; /* SASL-related parameters */
|
2013-12-14 06:57:13 +08:00
|
|
|
unsigned int preftype; /* Preferred authentication type */
|
2013-02-27 07:07:37 +08:00
|
|
|
int cmdid; /* Last used command ID */
|
|
|
|
char resptag[5]; /* Response tag to wait for */
|
|
|
|
bool tls_supported; /* StartTLS capability supported by server */
|
|
|
|
bool login_disabled; /* LOGIN command disabled by server */
|
|
|
|
bool ir_supported; /* Initial response supported by server */
|
2013-02-28 01:31:08 +08:00
|
|
|
char *mailbox; /* The last selected mailbox */
|
2013-02-27 07:07:37 +08:00
|
|
|
char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */
|
2009-12-13 05:54:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct Curl_handler Curl_handler_imap;
|
|
|
|
extern const struct Curl_handler Curl_handler_imaps;
|
|
|
|
|
2013-12-14 06:57:13 +08:00
|
|
|
/* Authentication type flags */
|
|
|
|
#define IMAP_TYPE_CLEARTEXT (1 << 0)
|
|
|
|
#define IMAP_TYPE_SASL (1 << 1)
|
|
|
|
|
|
|
|
/* Authentication type values */
|
|
|
|
#define IMAP_TYPE_NONE 0
|
|
|
|
#define IMAP_TYPE_ANY ~0U
|
|
|
|
|
2012-12-28 19:03:09 +08:00
|
|
|
#endif /* HEADER_CURL_IMAP_H */
|