1 /* 2 * libEtPan! -- a mail stuff library 3 * 4 * Copyright (C) 2001, 2005 - DINH Viet Hoa 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of the libEtPan! project nor the names of its 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32 /* 33 * $Id: imapdriver_types.h,v 1.27 2007/06/30 12:58:21 hoa Exp $ 34 */ 35 36 #ifndef IMAPDRIVER_TYPES_H 37 38 #define IMAPDRIVER_TYPES_H 39 40 #include <libetpan/libetpan-config.h> 41 42 #include <libetpan/mailimap.h> 43 #include <libetpan/maildriver_types.h> 44 #include <libetpan/generic_cache_types.h> 45 #include <libetpan/mailstorage_types.h> 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /* IMAP driver for session */ 52 53 struct imap_session_state_data { 54 mailimap * imap_session; 55 char * imap_mailbox; 56 struct mail_flags_store * imap_flags_store; 57 void (* imap_ssl_callback)(struct mailstream_ssl_context * ssl_context, void * data); 58 void * imap_ssl_cb_data; 59 }; 60 61 enum { 62 IMAP_SECTION_MESSAGE, 63 IMAP_SECTION_HEADER, 64 IMAP_SECTION_MIME, 65 IMAP_SECTION_BODY 66 }; 67 68 /* cached IMAP driver for session */ 69 70 enum { 71 IMAPDRIVER_CACHED_SET_SSL_CALLBACK = 1, 72 IMAPDRIVER_CACHED_SET_SSL_CALLBACK_DATA = 2, 73 /* cache */ 74 IMAPDRIVER_CACHED_SET_CACHE_DIRECTORY = 1001 75 }; 76 77 struct imap_cached_session_state_data { 78 mailsession * imap_ancestor; 79 char * imap_quoted_mb; 80 char imap_cache_directory[PATH_MAX]; 81 carray * imap_uid_list; 82 uint32_t imap_uidvalidity; 83 }; 84 85 86 /* IMAP storage */ 87 88 /* 89 imap_mailstorage is the state data specific to the IMAP4rev1 storage. 90 91 - servername this is the name of the IMAP4rev1 server 92 93 - port is the port to connect to, on the server. 94 you give 0 to use the default port. 95 96 - command, if non-NULL the command used to connect to the 97 server instead of allowing normal TCP connections to be used. 98 99 - connection_type is the type of socket layer to use. 100 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS, 101 CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS or 102 CONNECTION_TYPE_COMMAND. 103 104 - auth_type is the authenticate mechanism to use. 105 The value can be IMAP_AUTH_TYPE_PLAIN. 106 Other values are not yet implemented. 107 108 - login is the login of the IMAP4rev1 account. 109 110 - password is the password of the IMAP4rev1 account. 111 112 - cached if this value is != 0, a persistant cache will be 113 stored on local system. 114 115 - cache_directory is the location of the cache 116 */ 117 118 struct imap_mailstorage { 119 char * imap_servername; 120 uint16_t imap_port; 121 char * imap_command; 122 int imap_connection_type; 123 124 int imap_auth_type; 125 char * imap_login; /* deprecated */ 126 char * imap_password; /* deprecated */ 127 128 int imap_cached; 129 char * imap_cache_directory; 130 131 struct { 132 int sasl_enabled; 133 char * sasl_auth_type; 134 char * sasl_server_fqdn; 135 char * sasl_local_ip_port; 136 char * sasl_remote_ip_port; 137 char * sasl_login; 138 char * sasl_auth_name; 139 char * sasl_password; 140 char * sasl_realm; 141 } imap_sasl; 142 143 char * imap_local_address; 144 uint16_t imap_local_port; 145 }; 146 147 /* this is the type of IMAP4rev1 authentication */ 148 149 enum { 150 IMAP_AUTH_TYPE_PLAIN, /* plain text authentication */ 151 IMAP_AUTH_TYPE_SASL_ANONYMOUS, /* SASL anonymous */ 152 IMAP_AUTH_TYPE_SASL_CRAM_MD5, /* SASL CRAM MD5 */ 153 IMAP_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */ 154 IMAP_AUTH_TYPE_SASL_PLAIN, /* SASL plain */ 155 IMAP_AUTH_TYPE_SASL_SCRAM_MD5, /* SASL SCRAM MD5 */ 156 IMAP_AUTH_TYPE_SASL_GSSAPI, /* SASL GSSAPI */ 157 IMAP_AUTH_TYPE_SASL_DIGEST_MD5 /* SASL digest MD5 */ 158 }; 159 160 161 #ifdef __cplusplus 162 } 163 #endif 164 165 #endif 166