1 /**
2  * @file
3  * Low-level socket handling
4  *
5  * @authors
6  * Copyright (C) 1998 Brandon Long <blong@fiction.net>
7  * Copyright (C) 1999-2005 Brendan Cully <brendan@kublai.com>
8  *
9  * @copyright
10  * This program is free software: you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation, either version 2 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program.  If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef MUTT_CONN_SOCKET_H
25 #define MUTT_CONN_SOCKET_H
26 
27 #include <time.h>
28 
29 struct Connection;
30 
31 /**
32  * enum ConnectionType - Type of connection
33  */
34 enum ConnectionType
35 {
36   MUTT_CONNECTION_SIMPLE, ///< Simple TCP socket connection
37   MUTT_CONNECTION_TUNNEL, ///< Tunnelled connection
38   MUTT_CONNECTION_SSL,    ///< SSL/TLS-encrypted connection
39 };
40 
41 int                mutt_socket_close   (struct Connection *conn);
42 void               mutt_socket_empty   (struct Connection *conn);
43 struct Connection *mutt_socket_new     (enum ConnectionType type);
44 int                mutt_socket_open    (struct Connection *conn);
45 int                mutt_socket_poll    (struct Connection *conn, time_t wait_secs);
46 int                mutt_socket_read    (struct Connection *conn, char *buf, size_t len);
47 int                mutt_socket_readchar(struct Connection *conn, char *c);
48 int                mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg);
49 int                mutt_socket_write   (struct Connection *conn, const char *buf, size_t len);
50 int                mutt_socket_write_d (struct Connection *conn, const char *buf, int len, int dbg);
51 
52 #endif /* MUTT_CONN_SOCKET_H */
53