NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
socket.h
Go to the documentation of this file.
1
24#ifndef MUTT_CONN_SOCKET_H
25#define MUTT_CONN_SOCKET_H
26
27#include <time.h>
28
29struct Buffer;
30struct Connection;
31
36{
40};
41
42int mutt_socket_close (struct Connection *conn);
43void mutt_socket_empty (struct Connection *conn);
44struct Connection *mutt_socket_new (enum ConnectionType type);
45int mutt_socket_open (struct Connection *conn);
46int mutt_socket_poll (struct Connection *conn, time_t wait_secs);
47int mutt_socket_read (struct Connection *conn, char *buf, size_t len);
48int mutt_socket_readchar(struct Connection *conn, char *c);
49int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg);
50int mutt_socket_write (struct Connection *conn, const char *buf, size_t len);
51int mutt_socket_write_d (struct Connection *conn, const char *buf, int len, int dbg);
52
53/* logging levels */
54#define MUTT_SOCK_LOG_CMD 2
55#define MUTT_SOCK_LOG_HDR 3
56#define MUTT_SOCK_LOG_FULL 5
57
58#define mutt_socket_readln(buf, buflen, conn) mutt_socket_readln_d(buf, buflen, conn, MUTT_SOCK_LOG_CMD)
59#define mutt_socket_send(conn, buf) mutt_socket_send_d(conn, buf, MUTT_SOCK_LOG_CMD)
60#define mutt_socket_send_d(conn, buf, dbg) mutt_socket_write_d(conn, buf, mutt_str_len(buf), dbg)
61#define mutt_socket_write_n(conn, buf, len) mutt_socket_write_d(conn, buf, len, MUTT_SOCK_LOG_CMD)
62
63#define mutt_socket_buffer_readln(buf, conn) mutt_socket_buffer_readln_d(buf, conn, MUTT_SOCK_LOG_CMD)
64int mutt_socket_buffer_readln_d(struct Buffer *buf, struct Connection *conn, int dbg);
65
66#endif /* MUTT_CONN_SOCKET_H */
int mutt_socket_close(struct Connection *conn)
Close a socket.
Definition: socket.c:101
int mutt_socket_poll(struct Connection *conn, time_t wait_secs)
Checks whether reads would block.
Definition: socket.c:196
int mutt_socket_buffer_readln_d(struct Buffer *buf, struct Connection *conn, int dbg)
Read a line from a socket into a Buffer.
Definition: socket.c:342
int mutt_socket_write_d(struct Connection *conn, const char *buf, int len, int dbg)
Write data to a socket.
Definition: socket.c:156
struct Connection * mutt_socket_new(enum ConnectionType type)
Allocate and initialise a new connection.
Definition: socket.c:286
int mutt_socket_readchar(struct Connection *conn, char *c)
Simple read buffering to speed things up.
Definition: socket.c:214
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
Definition: socket.c:320
ConnectionType
Type of connection.
Definition: socket.h:36
@ MUTT_CONNECTION_SSL
SSL/TLS-encrypted connection.
Definition: socket.h:39
@ MUTT_CONNECTION_SIMPLE
Simple TCP socket connection.
Definition: socket.h:37
@ MUTT_CONNECTION_TUNNEL
Tunnelled connection.
Definition: socket.h:38
int mutt_socket_read(struct Connection *conn, char *buf, size_t len)
Read from a Connection.
Definition: socket.c:129
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
Definition: socket.c:77
int mutt_socket_write(struct Connection *conn, const char *buf, size_t len)
Write to a Connection.
Definition: socket.c:142
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
Definition: socket.c:252
String manipulation buffer.
Definition: buffer.h:34