2012-12-28 15:03:09 +04:00
|
|
|
#ifndef HEADER_CURL_IMAP_H
|
|
|
|
#define HEADER_CURL_IMAP_H
|
2009-12-13 00:54:01 +03:00
|
|
|
/***************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2015-01-20 17:27:25 +03:00
|
|
|
* Copyright (C) 2009 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2009-12-13 00:54:01 +03: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 02:19:02 +03:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2009-12-13 00:54:01 +03: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 05:50:28 +04:00
|
|
|
#include "pingpong.h"
|
2015-01-20 16:14:26 +03:00
|
|
|
#include "curl_sasl.h"
|
2009-12-13 00:54:01 +03:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* IMAP unique setup
|
|
|
|
***************************************************************************/
|
|
|
|
typedef enum {
|
2012-12-28 23:59:14 +04:00
|
|
|
IMAP_STOP, /* do nothing state, stops the state machine */
|
|
|
|
IMAP_SERVERGREET, /* waiting for the initial greeting immediately after
|
|
|
|
a connect */
|
2013-02-11 01:18:30 +04:00
|
|
|
IMAP_CAPABILITY,
|
2009-12-13 00:54:01 +03:00
|
|
|
IMAP_STARTTLS,
|
2012-12-28 23:59:14 +04:00
|
|
|
IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
|
|
|
|
(multi mode only) */
|
2015-01-20 19:33:05 +03:00
|
|
|
IMAP_AUTHENTICATE,
|
2012-12-30 16:44:09 +04:00
|
|
|
IMAP_LOGIN,
|
2013-03-06 01:34:53 +04:00
|
|
|
IMAP_LIST,
|
2009-12-13 00:54:01 +03:00
|
|
|
IMAP_SELECT,
|
|
|
|
IMAP_FETCH,
|
2013-02-28 22:16:33 +04:00
|
|
|
IMAP_FETCH_FINAL,
|
2013-03-01 23:04:56 +04:00
|
|
|
IMAP_APPEND,
|
|
|
|
IMAP_APPEND_FINAL,
|
2014-04-18 18:43:04 +04:00
|
|
|
IMAP_SEARCH,
|
2009-12-13 00:54:01 +03:00
|
|
|
IMAP_LOGOUT,
|
2012-12-28 23:59:14 +04:00
|
|
|
IMAP_LAST /* never used */
|
2009-12-13 00:54:01 +03:00
|
|
|
} imapstate;
|
|
|
|
|
2016-06-21 16:47:12 +03:00
|
|
|
/* This IMAP struct is used in the Curl_easy. All IMAP data that is
|
2013-02-23 13:29:40 +04:00
|
|
|
connection-oriented must be in imap_conn to properly deal with the fact that
|
2016-06-21 16:47:12 +03:00
|
|
|
perhaps the Curl_easy is changed between the times the connection is
|
2013-02-23 13:29:40 +04:00
|
|
|
used. */
|
|
|
|
struct IMAP {
|
2013-02-23 21:09:24 +04:00
|
|
|
curl_pp_transfer transfer;
|
2013-02-23 13:29:40 +04:00
|
|
|
char *mailbox; /* Mailbox to select */
|
2013-02-23 21:24:53 +04:00
|
|
|
char *uidvalidity; /* UIDVALIDITY to check in select */
|
|
|
|
char *uid; /* Message UID to fetch */
|
|
|
|
char *section; /* Message SECTION to fetch */
|
2014-04-18 20:42:40 +04:00
|
|
|
char *partial; /* Message PARTIAL to fetch */
|
2014-04-18 18:58:33 +04:00
|
|
|
char *query; /* Query to search for */
|
2013-03-03 13:12:27 +04:00
|
|
|
char *custom; /* Custom request */
|
|
|
|
char *custom_params; /* Parameters for the custom request */
|
2013-02-23 13:29:40 +04:00
|
|
|
};
|
|
|
|
|
2009-12-13 00:54:01 +03:00
|
|
|
/* imap_conn is used for struct connection-oriented data in the connectdata
|
|
|
|
struct */
|
|
|
|
struct imap_conn {
|
|
|
|
struct pingpong pp;
|
2013-02-27 03:15:16 +04:00
|
|
|
imapstate state; /* Always use imap.c:state() to change state! */
|
|
|
|
bool ssldone; /* Is connect() over SSL done? */
|
2015-01-20 16:14:26 +03:00
|
|
|
struct SASL sasl; /* SASL-related parameters */
|
2013-12-14 02:57:13 +04:00
|
|
|
unsigned int preftype; /* Preferred authentication type */
|
2013-02-27 03:07:37 +04: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-27 21:31:08 +04:00
|
|
|
char *mailbox; /* The last selected mailbox */
|
2013-02-27 03:07:37 +04:00
|
|
|
char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */
|
2009-12-13 00:54:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct Curl_handler Curl_handler_imap;
|
|
|
|
extern const struct Curl_handler Curl_handler_imaps;
|
|
|
|
|
2013-12-14 02:57:13 +04: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 15:03:09 +04:00
|
|
|
#endif /* HEADER_CURL_IMAP_H */
|