2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
35 # include <openssl/crypto.h>
36 # include <openssl/x509.h>
37 # include <openssl/pem.h>
38 # include <openssl/ssl.h>
39 # include <openssl/err.h>
42 typedef struct _SockInfo SockInfo;
64 ConnectionState state;
67 pthread_t connect_thr;
68 pthread_mutex_t mutex;
75 gint sock_set_nonblocking_mode (SockInfo *sock, gboolean nonblock);
76 gboolean sock_is_nonblocking_mode (SockInfo *sock);
78 SockInfo *sock_connect_nb (const gchar *hostname, gushort port);
79 SockInfo *sock_connect (const gchar *hostname, gushort port);
83 SockInfo *sock_connect_with_thread (const gchar *hostname, gushort port);
86 gint sock_printf (SockInfo *sock, const gchar *format, ...)
88 gint sock_read (SockInfo *sock, gchar *buf, gint len);
89 gint sock_write (SockInfo *sock, const gchar *buf, gint len);
90 gint sock_gets (SockInfo *sock, gchar *buf, gint len);
91 gchar *sock_getline (SockInfo *sock);
92 gint sock_puts (SockInfo *sock, const gchar *buf);
93 gint sock_close (SockInfo *sock);
95 /* wrapper functions */
96 gint sock_gdk_input_add (SockInfo *sock,
97 GdkInputCondition condition,
98 GdkInputFunction function,
102 /* Functions to directly work on FD. They are needed for pipes */
103 gint fd_connect_unix (const gchar *path);
104 gint fd_open_unix (const gchar *path);
105 gint fd_accept (gint sock);
107 gint fd_read (gint sock, gchar *buf, gint len);
108 gint fd_write (gint sock, const gchar *buf, gint len);
109 gint fd_gets (gint sock, gchar *buf, gint len);
110 gchar *fd_getline (gint sock);
111 gint fd_close (gint sock);
113 #endif /* __SOCKET_H__ */