2 * Copyright notice from original mutt:
3 * Copyright (C) 1998 Brandon Long <blong@fiction.net>
4 * Copyright (C) 1999-2005 Brendan Cully <brendan@kublai.com>
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
11 #ifndef _MUTT_SOCKET_H_
12 #define _MUTT_SOCKET_H_ 1
18 #define M_SOCK_LOG_CMD 2
19 #define M_SOCK_LOG_HDR 3
20 #define M_SOCK_LOG_FULL 4
22 typedef struct _connection {
24 /* security strength factor, in bits */
28 char inbuf[LONG_STRING];
34 struct _connection *next;
37 int (*conn_read) (struct _connection * conn, char *buf, size_t len);
38 int (*conn_write) (struct _connection * conn, const char *buf,
40 int (*conn_open) (struct _connection * conn);
41 int (*conn_close) (struct _connection * conn);
44 int mutt_socket_open (CONNECTION * conn);
45 int mutt_socket_close (CONNECTION * conn);
46 int mutt_socket_read (CONNECTION * conn, char *buf, size_t len);
47 int mutt_socket_readchar (CONNECTION * conn, char *c);
49 #define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
50 int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn,
52 #define mutt_socket_write(A,B) mutt_socket_write_d(A,B,M_SOCK_LOG_CMD);
53 int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg);
55 /* stupid hack for imap_logout_all */
56 CONNECTION *mutt_socket_head (void);
57 void mutt_socket_free (CONNECTION * conn);
58 CONNECTION *mutt_conn_find (const CONNECTION * start,
59 const ACCOUNT * account);
61 int raw_socket_read (CONNECTION * conn, char *buf, size_t len);
62 int raw_socket_write (CONNECTION * conn, const char *buf, size_t count);
63 int raw_socket_open (CONNECTION * conn);
64 int raw_socket_close (CONNECTION * conn);
66 #endif /* _MUTT_SOCKET_H_ */