root / libsylph / ssl.h @ 2121
History | View | Annotate | Download (1.7 kB)
| 1 | 528 | hiro | /*
|
|---|---|---|---|
| 2 | 578 | hiro | * LibSylph -- E-Mail client library |
| 3 | 1415 | hiro | * Copyright (C) 1999-2006 Hiroyuki Yamamoto |
| 4 | 528 | hiro | * |
| 5 | 578 | hiro | * This library is free software; you can redistribute it and/or |
| 6 | 578 | hiro | * modify it under the terms of the GNU Lesser General Public |
| 7 | 578 | hiro | * License as published by the Free Software Foundation; either |
| 8 | 578 | hiro | * version 2.1 of the License, or (at your option) any later version. |
| 9 | 528 | hiro | * |
| 10 | 578 | hiro | * This library is distributed in the hope that it will be useful, |
| 11 | 528 | hiro | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 578 | hiro | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | 578 | hiro | * Lesser General Public License for more details. |
| 14 | 528 | hiro | * |
| 15 | 578 | hiro | * You should have received a copy of the GNU Lesser General Public |
| 16 | 578 | hiro | * License along with this library; if not, write to the Free Software |
| 17 | 578 | hiro | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | 528 | hiro | */ |
| 19 | 528 | hiro | |
| 20 | 528 | hiro | #ifndef __SSL_H__
|
| 21 | 528 | hiro | #define __SSL_H__
|
| 22 | 528 | hiro | |
| 23 | 528 | hiro | #ifdef HAVE_CONFIG_H
|
| 24 | 528 | hiro | # include "config.h" |
| 25 | 528 | hiro | #endif
|
| 26 | 528 | hiro | |
| 27 | 528 | hiro | #if USE_SSL
|
| 28 | 528 | hiro | |
| 29 | 528 | hiro | #include <glib.h> |
| 30 | 528 | hiro | #include <openssl/crypto.h> |
| 31 | 528 | hiro | #include <openssl/x509.h> |
| 32 | 528 | hiro | #include <openssl/pem.h> |
| 33 | 528 | hiro | #include <openssl/ssl.h> |
| 34 | 528 | hiro | #include <openssl/err.h> |
| 35 | 528 | hiro | |
| 36 | 528 | hiro | #include "socket.h" |
| 37 | 528 | hiro | |
| 38 | 528 | hiro | typedef enum { |
| 39 | 528 | hiro | SSL_METHOD_SSLv23, |
| 40 | 528 | hiro | SSL_METHOD_TLSv1 |
| 41 | 528 | hiro | } SSLMethod; |
| 42 | 528 | hiro | |
| 43 | 528 | hiro | typedef enum { |
| 44 | 528 | hiro | SSL_NONE, |
| 45 | 528 | hiro | SSL_TUNNEL, |
| 46 | 528 | hiro | SSL_STARTTLS |
| 47 | 528 | hiro | } SSLType; |
| 48 | 528 | hiro | |
| 49 | 1415 | hiro | typedef gint (*SSLVerifyFunc) (SockInfo *sockinfo,
|
| 50 | 1415 | hiro | const gchar *hostname,
|
| 51 | 1415 | hiro | X509 *server_cert, |
| 52 | 1415 | hiro | glong verify_result); |
| 53 | 1415 | hiro | |
| 54 | 528 | hiro | void ssl_init (void); |
| 55 | 528 | hiro | void ssl_done (void); |
| 56 | 528 | hiro | gboolean ssl_init_socket (SockInfo *sockinfo); |
| 57 | 528 | hiro | gboolean ssl_init_socket_with_method (SockInfo *sockinfo, |
| 58 | 528 | hiro | SSLMethod method); |
| 59 | 528 | hiro | void ssl_done_socket (SockInfo *sockinfo);
|
| 60 | 528 | hiro | |
| 61 | 1415 | hiro | void ssl_set_verify_func (SSLVerifyFunc func);
|
| 62 | 1415 | hiro | |
| 63 | 528 | hiro | #endif /* USE_SSL */ |
| 64 | 528 | hiro | |
| 65 | 528 | hiro | #endif /* __SSL_H__ */ |