20 #include <citrusleaf/cf_clock.h>
25 #include <openssl/ssl.h>
30 #include <arpa/inet.h>
31 #include <netinet/in.h>
32 #include <sys/socket.h>
34 #define as_socket_data_t void
35 #define as_socket_size_t size_t
36 #define as_close(fd) (close(fd))
38 #if defined(__APPLE__)
39 #define SOL_TCP IPPROTO_TCP
40 #define MSG_NOSIGNAL 0
43 #define AS_IP_ADDRESS_SIZE 64
53 typedef struct as_tls_context_s {
60 struct as_conn_pool_lock_s;
66 typedef struct as_socket_s {
170 #if defined(__linux__) || defined(__APPLE__)
176 static inline uint64_t
177 as_socket_deadline(uint32_t timeout_ms)
179 return (timeout_ms && timeout_ms <= INT32_MAX)? cf_getms() + timeout_ms : 0;
188 as_socket_write_deadline(
189 as_error* err,
as_socket* sock,
struct as_node_s* node, uint8_t *buf,
size_t buf_len,
190 uint32_t socket_timeout, uint64_t deadline
199 as_socket_read_deadline(
200 as_error* err,
as_socket* sock,
struct as_node_s* node, uint8_t *buf,
size_t buf_len,
201 uint32_t socket_timeout, uint64_t deadline
struct as_conn_pool_lock_s * pool_lock
as_status as_socket_error(int fd, struct as_node_s *node, as_error *err, as_status status, const char *msg, int code)
void as_socket_error_append(as_error *err, struct sockaddr *addr)
int as_socket_validate(as_socket *sock)
int as_socket_validate_fd(int fd)
void as_socket_init(as_socket *sock)
void as_socket_close(as_socket *sock)
int as_socket_create_fd(int family)
bool as_socket_start_connect(as_socket *sock, struct sockaddr *addr)
int as_socket_create(as_socket *sock, int family, as_tls_context *ctx, const char *tls_name)
bool as_socket_wrap(as_socket *sock, int family, int fd, as_tls_context *ctx, const char *tls_name)
as_status as_socket_create_and_connect(as_socket *sock, as_error *err, struct sockaddr *addr, as_tls_context *ctx, const char *tls_name)