2 * Copyright (C) 1998 Brandon Long <blong@fiction.net>
3 * Copyright (C) 1999-2001 Brendan Cully <brendan@kublai.com>
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, USA.
20 #ifndef _MUTT_SOCKET_H_
21 #define _MUTT_SOCKET_H_ 1
27 #define M_SOCK_LOG_CMD 2
28 #define M_SOCK_LOG_HDR 3
29 #define M_SOCK_LOG_FULL 4
31 typedef struct _connection
34 /* security strength factor, in bits */
38 char inbuf[LONG_STRING];
44 struct _connection *next;
47 int (*read) (struct _connection* conn, char* buf, size_t len);
48 int (*write) (struct _connection *conn, const char *buf, size_t count);
49 int (*open) (struct _connection *conn);
50 int (*close) (struct _connection *conn);
53 int mutt_socket_open (CONNECTION* conn);
54 int mutt_socket_close (CONNECTION* conn);
55 int mutt_socket_read (CONNECTION* conn, char* buf, size_t len);
56 int mutt_socket_readchar (CONNECTION *conn, char *c);
57 #define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
58 int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION *conn, int dbg);
59 #define mutt_socket_write(A,B) mutt_socket_write_d(A,B,M_SOCK_LOG_CMD);
60 int mutt_socket_write_d (CONNECTION *conn, const char *buf, int dbg);
62 /* stupid hack for imap_logout_all */
63 CONNECTION* mutt_socket_head (void);
64 void mutt_socket_free (CONNECTION* conn);
65 CONNECTION* mutt_conn_find (const CONNECTION* start, const ACCOUNT* account);
67 int raw_socket_read (CONNECTION* conn, char* buf, size_t len);
68 int raw_socket_write (CONNECTION* conn, const char* buf, size_t count);
69 int raw_socket_open (CONNECTION *conn);
70 int raw_socket_close (CONNECTION *conn);
72 #endif /* _MUTT_SOCKET_H_ */