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
14 #include <lib-lua/lib-lua.h>
16 #include "mutt_ssl.li"
19 #define M_SOCK_LOG_CMD 2
20 #define M_SOCK_LOG_HDR 3
21 #define M_SOCK_LOG_FULL 4
23 typedef struct _connection {
25 /* security strength factor, in bits */
29 char inbuf[LONG_STRING];
35 struct _connection *next;
38 int (*conn_read) (struct _connection * conn, char *buf, ssize_t len);
39 int (*conn_write) (struct _connection * conn, const char *buf,
41 int (*conn_open) (struct _connection * conn);
42 int (*conn_close) (struct _connection * conn);
45 int mutt_socket_open (CONNECTION * conn);
46 int mutt_socket_close (CONNECTION * conn);
47 int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len);
48 int mutt_socket_readchar (CONNECTION * conn, char *c);
50 int mutt_socket_readln(char *buf, ssize_t buflen, CONNECTION * conn);
51 int mutt_socket_write(CONNECTION * conn, const char *buf);
53 int mutt_socket_readln2(buffer_t *buf, CONNECTION *conn);
55 int mutt_ssl_starttls (CONNECTION * conn);
56 int mutt_ssl_socket_setup (CONNECTION * conn);
58 /* stupid hack for imap_logout_all */
59 CONNECTION *mutt_socket_head (void);
60 void mutt_socket_free (CONNECTION * conn);
61 CONNECTION *mutt_conn_find (const CONNECTION * start,
62 const ACCOUNT * account);
64 int raw_socket_read (CONNECTION * conn, char *buf, ssize_t len);
65 int raw_socket_write (CONNECTION * conn, const char *buf, ssize_t count);
66 int raw_socket_open (CONNECTION * conn);
67 int raw_socket_close (CONNECTION * conn);
69 #endif /* _MUTT_SOCKET_H_ */