Statistics
| Revision:

root / libsylph / smtp.h @ 2643

History | View | Annotate | Download (2.2 kB)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2008 Hiroyuki Yamamoto
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef __SMTP_H__
21
#define __SMTP_H__
22
23
#ifdef HAVE_CONFIG_H
24
#  include "config.h"
25
#endif
26
27
#include <glib.h>
28
#include <stdio.h>
29
30
#include "session.h"
31
32
typedef struct _SMTPSession        SMTPSession;
33
34
#define SMTP_SESSION(obj)        ((SMTPSession *)obj)
35
36
#define SMTPBUFSIZE                8192
37
38
typedef enum
39
{
40
        SM_OK                        = 0,
41
        SM_ERROR                = 128,
42
        SM_UNRECOVERABLE        = 129,
43
        SM_AUTHFAIL                = 130
44
} SMTPErrorValue;
45
46
typedef enum
47
{
48
        ESMTP_8BITMIME        = 1 << 0,
49
        ESMTP_SIZE        = 1 << 1,
50
        ESMTP_ETRN        = 1 << 2
51
} ESMTPFlag;
52
53
typedef enum
54
{
55
        SMTPAUTH_LOGIN      = 1 << 0,
56
        SMTPAUTH_CRAM_MD5   = 1 << 1,
57
        SMTPAUTH_DIGEST_MD5 = 1 << 2,
58
        SMTPAUTH_PLAIN      = 1 << 3
59
} SMTPAuthType;
60
61
typedef enum
62
{
63
        SMTP_READY,
64
        SMTP_CONNECTED,
65
        SMTP_HELO,
66
        SMTP_EHLO,
67
        SMTP_STARTTLS,
68
        SMTP_FROM,
69
        SMTP_AUTH,
70
        SMTP_AUTH_PLAIN,
71
        SMTP_AUTH_LOGIN_USER,
72
        SMTP_AUTH_LOGIN_PASS,
73
        SMTP_AUTH_CRAM_MD5,
74
        SMTP_RCPT,
75
        SMTP_DATA,
76
        SMTP_SEND_DATA,
77
        SMTP_EOM,
78
        SMTP_RSET,
79
        SMTP_QUIT,
80
        SMTP_ERROR,
81
        SMTP_DISCONNECTED,
82
83
        N_SMTP_PHASE
84
} SMTPState;
85
86
struct _SMTPSession
87
{
88
        Session session;
89
90
        SMTPState state;
91
92
        gboolean tls_init_done;
93
94
        gchar *hostname;
95
96
        gchar *user;
97
        gchar *pass;
98
99
        gchar *from;
100
        GSList *to_list;
101
        GSList *cur_to;
102
103
        FILE *send_data_fp;
104
        gint send_data_len;
105
106
        SMTPAuthType avail_auth_type;
107
        SMTPAuthType forced_auth_type;
108
        SMTPAuthType auth_type;
109
110
        SMTPErrorValue error_val;
111
        gchar *error_msg;
112
};
113
114
Session *smtp_session_new        (void);
115
116
#endif /* __SMTP_H__ */