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