/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* 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
#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,
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);
gint sock_read (SockInfo *sock, gchar *buf, gint len);
gint sock_write (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_close (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);
gint fd_read (gint sock, gchar *buf, gint len);
gint fd_write (gint sock, const gchar *buf, gint len);
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__ */