All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Macros | Functions
as_socket.h File Reference
#include <aerospike/as_error.h>
#include <citrusleaf/cf_clock.h>
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include <openssl/ssl.h>
#include <aerospike/as_config.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
+ Include dependency graph for as_socket.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_socket
 
struct  as_tls_context
 

Macros

#define as_close(fd)   (close(fd))
 
#define AS_IP_ADDRESS_SIZE   64
 
#define as_socket_data_t   void
 
#define as_socket_size_t   size_t
 

Functions

void as_socket_close (as_socket *sock)
 
int as_socket_create (as_socket *sock, int family, 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)
 
int as_socket_create_fd (int family)
 
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)
 
void as_socket_init (as_socket *sock)
 
bool as_socket_start_connect (as_socket *sock, struct sockaddr *addr)
 
int as_socket_validate (as_socket *sock)
 
int as_socket_validate_fd (int fd)
 
bool as_socket_wrap (as_socket *sock, int family, int fd, as_tls_context *ctx, const char *tls_name)
 

Macro Definition Documentation

#define as_close (   fd)    (close(fd))

Definition at line 36 of file as_socket.h.

#define AS_IP_ADDRESS_SIZE   64

Definition at line 43 of file as_socket.h.

#define as_socket_data_t   void

Definition at line 34 of file as_socket.h.

#define as_socket_size_t   size_t

Definition at line 35 of file as_socket.h.

Function Documentation

void as_socket_close ( as_socket sock)
private

Close and release resources associated with a as_socket.

int as_socket_create ( as_socket sock,
int  family,
as_tls_context ctx,
const char *  tls_name 
)
private

Create non-blocking socket. Family should be AF_INET or AF_INET6.

as_status as_socket_create_and_connect ( as_socket sock,
as_error err,
struct sockaddr *  addr,
as_tls_context ctx,
const char *  tls_name 
)
private

Create non-blocking socket and connect.

int as_socket_create_fd ( int  family)
private

Create non-blocking socket. Family should be AF_INET or AF_INET6. If socket create fails, return -errno.

as_status as_socket_error ( int  fd,
struct as_node_s *  node,
as_error err,
as_status  status,
const char *  msg,
int  code 
)
private

Create error message for socket error.

void as_socket_error_append ( as_error err,
struct sockaddr *  addr 
)
private

Append address to error message.

void as_socket_init ( as_socket sock)
private

Initialize an as_socket structure.

bool as_socket_start_connect ( as_socket sock,
struct sockaddr *  addr 
)
private

Connect to non-blocking socket.

int as_socket_validate ( as_socket sock)
private

Peek for socket connection status.

Returns
0 : socket is connected, but no data available. > 0 : byte size of data available. < 0 : socket is invalid.
int as_socket_validate_fd ( int  fd)
private

Peek for socket connection status using underlying fd. Needed to support libuv.

Returns
0 : socket is connected, but no data available. > 0 : byte size of data available. < 0 : socket is invalid.
bool as_socket_wrap ( as_socket sock,
int  family,
int  fd,
as_tls_context ctx,
const char *  tls_name 
)
private

Wrap existing fd in a socket. Family should be AF_INET or AF_INET6.