61 const int save_errno = errno;
83 rc = conn->
open(conn);
110 rc = conn->
close(conn);
130 return conn->
read(conn, buf, len);
156 const int rc = conn->
write(conn, buf + sent, len - sent);
188 return conn->
poll(conn, wait_secs);
243 for (i = 0; i < buflen - 1; i++)
257 if (i && (buf[i - 1] ==
'\r'))
311 char buf[1024] = { 0 };
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Convenience wrapper for the config headers.
void mutt_tunnel_socket_setup(struct Connection *conn)
Sets up tunnel connection functions.
An open network connection (socket)
Convenience wrapper for the core headers.
int mutt_ssl_socket_setup(struct Connection *conn)
Set up SSL socket mulitplexor.
int raw_socket_close(struct Connection *conn)
Close a socket - Implements Connection::close() -.
int raw_socket_open(struct Connection *conn)
Open a socket - Implements Connection::open() -.
int raw_socket_poll(struct Connection *conn, time_t wait_secs)
Check if any data is waiting on a socket - Implements Connection::poll() -.
int raw_socket_read(struct Connection *conn, char *buf, size_t len)
Read data from a socket - Implements Connection::read() -.
int raw_socket_write(struct Connection *conn, const char *buf, size_t count)
Write data to a socket - Implements Connection::write() -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG3
Log at debug level 3.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
Convenience wrapper for the library headers.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
int mutt_socket_close(struct Connection *conn)
Close a socket.
int mutt_socket_poll(struct Connection *conn, time_t wait_secs)
Checks whether reads would block.
int mutt_socket_buffer_readln_d(struct Buffer *buf, struct Connection *conn, int dbg)
Read a line from a socket into a Buffer.
int mutt_socket_write_d(struct Connection *conn, const char *buf, int len, int dbg)
Write data to a socket.
struct Connection * mutt_socket_new(enum ConnectionType type)
Allocate and initialise a new connection.
int mutt_socket_readchar(struct Connection *conn, char *c)
Simple read buffering to speed things up.
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
int mutt_socket_read(struct Connection *conn, char *buf, size_t len)
Read from a Connection.
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
static int socket_preconnect(void)
Execute a command before opening a socket.
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
Low-level socket handling.
ConnectionType
Type of connection.
@ MUTT_CONNECTION_SSL
SSL/TLS-encrypted connection.
@ MUTT_CONNECTION_TUNNEL
Tunnelled connection.
Handling of SSL encryption.
String manipulation buffer.
char host[128]
Server to login to.
unsigned short port
Port to connect to.
char inbuf[1024]
Buffer for incoming traffic.
int(* poll)(struct Connection *conn, time_t wait_secs)
int(* write)(struct Connection *conn, const char *buf, size_t count)
unsigned int ssf
Security strength factor, in bits (see notes)
int bufpos
Current position in the buffer.
int(* close)(struct Connection *conn)
int available
Amount of data waiting to be read.
struct ConnAccount account
Account details: username, password, etc.
int(* open)(struct Connection *conn)
int fd
Socket file descriptor.
int(* read)(struct Connection *conn, char *buf, size_t count)
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.