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 ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2013-01-07 03:13:58 +08:00
|
|
|
* Copyright (C) 2009 - 2013, 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
|
|
|
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
|
|
|
*
|
|
|
|
* 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"
|
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) */
|
2013-01-07 06:25:14 +08:00
|
|
|
IMAP_AUTHENTICATE_PLAIN,
|
2013-01-07 07:14:18 +08:00
|
|
|
IMAP_AUTHENTICATE_LOGIN,
|
|
|
|
IMAP_AUTHENTICATE_LOGIN_PASSWD,
|
2013-01-07 15:35:49 +08:00
|
|
|
IMAP_AUTHENTICATE_CRAMMD5,
|
2013-01-07 19:01:05 +08:00
|
|
|
IMAP_AUTHENTICATE_DIGESTMD5,
|
|
|
|
IMAP_AUTHENTICATE_DIGESTMD5_RESP,
|
2013-01-07 10:47:12 +08:00
|
|
|
IMAP_AUTHENTICATE_NTLM,
|
|
|
|
IMAP_AUTHENTICATE_NTLM_TYPE2MSG,
|
2013-02-28 05:19:48 +08:00
|
|
|
IMAP_AUTHENTICATE_FINAL,
|
2012-12-30 20:44:09 +08:00
|
|
|
IMAP_LOGIN,
|
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,
|
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;
|
|
|
|
|
2013-02-23 17:29:40 +08:00
|
|
|
/* This IMAP struct is used in the SessionHandle. All IMAP data that is
|
|
|
|
connection-oriented must be in imap_conn to properly deal with the fact that
|
|
|
|
perhaps the SessionHandle is changed between the times the connection is
|
|
|
|
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 */
|
|
|
|
char *section; /* Message SECTION to fetch */
|
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? */
|
2013-02-27 07:07:37 +08:00
|
|
|
unsigned int authmechs; /* Accepted authentication mechanisms */
|
|
|
|
unsigned int authused; /* Auth mechanism used for the connection */
|
|
|
|
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;
|
|
|
|
|
2012-12-28 19:03:09 +08:00
|
|
|
#endif /* HEADER_CURL_IMAP_H */
|