Remove useless cruft from OpenSSL days
[claws.git] / src / common / socket.h
index 441deb8874378f6641658bb2ddc6193f0bc38e29..cee9d138963eb9531a65ad3b9891a9674b0c178b 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifndef __SOCKET_H__
 #define __SOCKET_H__
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#include "claws-features.h"
+#endif
+
+#if (defined (_XOPEN_SOURCE) && !defined (_BSD_SOURCE))
+#define _BSD_SOURCE
 #endif
 
 #include <glib.h>
@@ -31,7 +35,7 @@
 
 typedef struct _SockInfo       SockInfo;
 
-#if USE_OPENSSL
+#ifdef USE_GNUTLS
 #  include "ssl.h"
 #endif
 
@@ -54,9 +58,12 @@ typedef gboolean (*SockFunc)         (SockInfo       *sock,
 struct _SockInfo
 {
        gint sock;
-#if USE_OPENSSL
-       SSL *ssl;
-       guint g_source;
+#if USE_GNUTLS
+       gnutls_session_t ssl;
+       gnutls_certificate_credentials_t xcred;
+       gnutls_x509_crt_t client_crt;
+       gnutls_x509_privkey_t client_key;
+       gchar *gnutls_priority;
 #endif
        GIOChannel *sock_ch;
 
@@ -68,6 +75,9 @@ struct _SockInfo
        SockFunc callback;
        GIOCondition condition;
        gchar *canonical_name;
+       
+       const void *account;
+       gboolean is_smtp;
 };
 
 void refresh_resolvers                 (void);
@@ -85,21 +95,14 @@ guint sock_add_watch                        (SockInfo *sock, GIOCondition condition,
 struct hostent *my_gethostbyname       (const gchar *hostname);
 
 SockInfo *sock_connect                 (const gchar *hostname, gushort port);
-SockInfo *sock_connect_cmd             (const gchar *hostname, const gchar *tunnelcmd);
 gint sock_connect_async                        (const gchar *hostname, gushort port,
                                         SockConnectFunc func, gpointer data);
 gint sock_connect_async_cancel         (gint id);
 
 /* Basic I/O functions */
-gint sock_printf       (SockInfo *sock, const gchar *format, ...)
-                        G_GNUC_PRINTF(2, 3);
 gint sock_read         (SockInfo *sock, gchar *buf, gint len);
 gint sock_write                (SockInfo *sock, const gchar *buf, gint len);
 gint sock_write_all    (SockInfo *sock, const gchar *buf, gint len);
-gint sock_gets         (SockInfo *sock, gchar *buf, gint len);
-gchar *sock_getline    (SockInfo *sock);
-gint sock_puts         (SockInfo *sock, const gchar *buf);
-gint sock_peek         (SockInfo *sock, gchar *buf, gint len);
 gint sock_close                (SockInfo *sock);
 
 /* Functions to directly work on FD.  They are needed for pipes */
@@ -107,21 +110,12 @@ gint fd_connect_unix      (const gchar *path);
 gint fd_open_unix      (const gchar *path);
 gint fd_accept         (gint sock);
 
-gint fd_read           (gint sock, gchar *buf, gint len);
+gint fd_connect_inet(gushort port);
+gint fd_open_inet(gushort port);
+
 gint fd_write          (gint sock, const gchar *buf, gint len);
 gint fd_write_all      (gint sock, const gchar *buf, gint len);
 gint fd_gets           (gint sock, gchar *buf, gint len);
-gint fd_getline                (gint sock, gchar **str);
 gint fd_close          (gint sock);
 
-/* Functions for SSL */
-#if USE_OPENSSL
-gint ssl_read          (SSL *ssl, gchar *buf, gint len);
-gint ssl_write         (SSL *ssl, const gchar *buf, gint len);
-gint ssl_write_all     (SSL *ssl, const gchar *buf, gint len);
-gint ssl_gets          (SSL *ssl, gchar *buf, gint len);
-gint ssl_getline       (SSL *ssl, gchar **str);
-gint ssl_peek          (SSL *ssl, gchar *buf, gint len);
-#endif
-
 #endif /* __SOCKET_H__ */