sync with 0.8.1cvs17
[claws.git] / src / socket.h
index 93eaa36bca46eb77c9b1bcb2112f72724e634982..ba0fb1933159444b3c49bab07e6cd6585bd453ba 100644 (file)
 
 #include <glib.h>
 #include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
-
-#if USE_THREADS
-#  include <pthread.h>
-#endif
+#include <netdb.h>
 
 typedef struct _SockInfo       SockInfo;
 
+#if USE_SSL
+#  include "ssl.h"
+#endif
+
 typedef enum
 {
        CONN_READY,
@@ -55,22 +56,18 @@ struct _SockInfo
        gushort port;
        ConnectionState state;
        gpointer data;
-#if USE_THREADS
-       pthread_t connect_thr;
-       pthread_mutex_t mutex;
+#if USE_SSL
+       SSL *ssl;
 #endif
 };
 
 gint sock_set_nonblocking_mode         (SockInfo *sock, gboolean nonblock);
 gboolean sock_is_nonblocking_mode      (SockInfo *sock);
 
-SockInfo *sock_connect_nb              (const gchar *hostname, gushort port);
-SockInfo *sock_connect                 (const gchar *hostname, gushort port);
-
+struct hostent *my_gethostbyname       (const gchar *hostname);
 
-#if USE_THREADS
-SockInfo *sock_connect_with_thread     (const gchar *hostname, gushort port);
-#endif
+SockInfo *sock_connect                 (const gchar *hostname, gushort port);
+SockInfo *sock_connect_cmd             (const gchar *hostname, const gchar *tunnelcmd);
 
 gint sock_printf       (SockInfo *sock, const gchar *format, ...)
                         G_GNUC_PRINTF(2, 3);
@@ -87,7 +84,6 @@ gint sock_gdk_input_add         (SockInfo             *sock,
                           GdkInputFunction      function,
                           gpointer              data);
 
-
 /* Functions to directly work on FD.  They are needed for pipes */
 gint fd_connect_unix   (const gchar *path);
 gint fd_open_unix      (const gchar *path);
@@ -99,4 +95,12 @@ gint fd_gets         (gint sock, gchar *buf, gint len);
 gchar *fd_getline      (gint sock);
 gint fd_close          (gint sock);
 
+/* Functions for SSL */
+#if USE_SSL
+gint ssl_read(SSL *ssl, gchar *buf, gint len);
+gint ssl_write(SSL *ssl, const gchar *buf, gint len);
+gint ssl_gets(SSL *ssl, gchar *buf, gint len);
+gchar *ssl_getline(SSL *ssl);
+#endif
+
 #endif /* __SOCKET_H__ */