NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ncbi_socket.c File Reference
#include "ncbi_ansi_ext.h"
#include "ncbi_connssl.h"
#include "ncbi_once.h"
#include <connect/ncbi_connutil.h>
#include <connect/ncbi_socket_unix.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <ctype.h>
#include <stdlib.h>
#include "ncbi_strerror.c"
+ Include dependency graph for ncbi_socket.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  XWriteBufCtx
 

Macros

#define NCBI_USE_ERRCODE_X   Connect_Socket
 
#define INADDR_LOOPBACK   0x7F000001
 
#define IN_LOOPBACKNET   127
 
#define sys_gethostname   gethostname
 
#define SOCK_BUF_CHUNK_SIZE   16384
 
#define SOCK_GHBX_MT_SAFE   1 /* for gethostby...() */
 
#define SOCK_SEND_SLICE   (4 << 10) /* 4K */
 
#define SOCK_INVALID   INVALID_SOCKET
 
#define SOCK_ERRNO   WSAGetLastError()
 
#define SOCK_NFDS(s)   0
 
#define SOCK_CLOSE(s)   closesocket(s)
 
#define SOCK_EVENTS   (FD_CLOSE|FD_CONNECT|FD_OOB|FD_WRITE|FD_READ)
 
#define WIN_INT_CAST   (int)
 
#define WSA_INVALID_EVENT   ((WSAEVENT) 0)
 
#define abs(a)   ((a) < 0 ? -(a) : (a))
 
#define MAXIDLEN   80
 
#define SOCK_STRERROR(error)   s_StrError(0, (error))
 
#define SOCK_LOOPBACK   (assert(INADDR_LOOPBACK), htonl(INADDR_LOOPBACK))
 
#define SOCK_GET_TIMEOUT(s, t)   ((s)->t##_tv_set ? &(s)->t##_tv : 0)
 
#define SOCK_SET_TIMEOUT(s, t, v)
 
#define NCBI_INCLUDE_STRERROR_C
 
#define offsetof(T, F)   ((size_t)((char*) &(((T*) 0)->F) - (char*) 0))
 
#define SOCK_HAVE_SHOWDATALAYOUT   1
 
#define extentof(T, F)   (sizeof(((T*) 0)->F))
 
#define infof(T, F)
 
#define SOCK_SHOWDATALAYOUT_PARAMS
 
#define s_Send   s_Send_
 
#define MAX_TRIGGER_BUF   8192
 
#define s_Pushback(s, d, n)   BUF_Pushback(&(s)->r_buf, d, n)
 

Typedefs

typedef int TSOCK_socklen_t
 
typedef unsigned int TSOCK_Keep
 

Enumerations

enum  { fSOCK_KeepNone = 0 , fSOCK_KeepEvent = 1 , fSOCK_KeepSession = 2 , fSOCK_KeepPending = 4 }
 

Functions

static const char * s_StrError (SOCK sock, int error)
 
static const char * s_WinStrerror (DWORD error)
 
static void s_ErrorCallback (const SSOCK_ErrInfo *info)
 
void SOCK_SetErrHookAPI (FSOCK_ErrHook hook, void *data)
 
static unsigned int x_ID_Counter (void)
 
static const char * s_CP (unsigned int host, unsigned short port, const char *path, char *buf, size_t bufsize)
 
static const char * s_ID (const SOCK sock, char buf[80])
 
static unsigned short s_GetLocalPort (TSOCK_Handle fd)
 
static void s_DoLog (ELOG_Level level, const SOCK sock, EIO_Event event, const void *data, size_t size, const void *ptr)
 
static STimeouts_tv2to (const struct timeval *tv, STimeout *to)
 
static struct timeval * s_to2tv (const STimeout *to, struct timeval *tv)
 
static void x_ShowDataLayout (void)
 
static EIO_Status s_Init (void)
 
static EIO_Status s_Recv (SOCK, void *, size_t, size_t *, int)
 
static EIO_Status s_Send (SOCK, const void *, size_t, size_t *, int)
 
static EIO_Status s_InitAPI_ (int secure)
 
static EIO_Status s_InitAPI (int secure)
 
EIO_Status SOCK_InitializeAPI (void)
 Initialize all internal/system data & resources to be used by the SOCK API. More...
 
static void x_ShutdownSSL (void)
 
EIO_Status SOCK_ShutdownAPI (void)
 Cleanup; destroy all internal/system data & resources used by the SOCK API. More...
 
void SOCK_AllowSigPipeAPI (void)
 By default (on UNIX platforms) the SOCK API functions automagically call "signal(SIGPIPE, SIG_IGN)" on initialization. More...
 
size_t SOCK_OSHandleSize (void)
 Get size of OS-dependent native socket handle. More...
 
const STimeoutSOCK_SetSelectInternalRestartTimeout (const STimeout *t)
 This is a helper call that can improve I/O behavior. More...
 
ESOCK_IOWaitSysAPI SOCK_SetIOWaitSysAPI (ESOCK_IOWaitSysAPI api)
 This is a helper call that can improve I/O performance (ignored for MSVC). More...
 
static int s_gethostname (char *name, size_t namesize, ESwitch log)
 
static int x_IsAPIPA (unsigned int addr)
 
static const char * x_ChooseSelfIP (char **addrs)
 
static unsigned int s_gethostbyname_ (const char *hostname, int not_ip, int self, ESwitch log)
 
static unsigned int s_getlocalhostaddress (ESwitch reget, ESwitch log)
 
static unsigned int s_gethostbyname (const char *hostname, int not_ip, ESwitch log)
 
static char * s_gethostbyaddr_ (unsigned int host, char *name, size_t namesize, ESwitch log)
 
static const char * s_gethostbyaddr (unsigned int host, char *name, size_t namesize, ESwitch log)
 
static EIO_Status s_ApproveCallback (const char *host, unsigned int addr, unsigned short port, ESOCK_Side side, ESOCK_Type type, SOCK sock)
 
void SOCK_SetApproveHookAPI (FSOCK_ApproveHook hook, void *data)
 The hook is installed when non-NULL, and de-installed otherwise. More...
 
static int s_SetNonblock (TSOCK_Handle sock, int nonblock)
 
static int s_SetCloexec (TSOCK_Handle x_sock, int cloexec)
 
static int s_SetReuseAddress (TSOCK_Handle x_sock, int on_off)
 
static int s_IsSmallerTimeout (const struct timeval *t1, const struct timeval *t2)
 
static EIO_Status s_Select (size_t n, SSOCK_Poll polls[], const struct timeval *tv, int asis)
 
static void x_tvcpy (struct timeval *dst, struct timeval *src)
 
static EIO_Status s_IsConnected_ (SOCK sock, const struct timeval *tv, const char **what, int *error, int writeable)
 
static EIO_Status s_WaitConnected (SOCK sock, const struct timeval *tv)
 
static EIO_Status s_WritePending (SOCK, const struct timeval *, int, int)
 
static EIO_Status s_Read_ (SOCK sock, void *buf, size_t size, size_t *n_read, int peek)
 
static EIO_Status s_Read (SOCK sock, void *buf, size_t size, size_t *n_read, int peek)
 
static EIO_Status s_SelectStallsafe (size_t n, SSOCK_Poll polls[], const struct timeval *tv, size_t *n_ready)
 
static EIO_Status s_Wait (SOCK sock, EIO_Event event, const STimeout *timeout)
 
static void s_AddTimeout (struct timeval *tv, int ms_addend)
 
static EIO_Status s_Send_ (SOCK sock, const void *data, size_t size, size_t *n_written, int flag)
 
static EIO_Status s_WriteData (SOCK sock, const void *data, size_t size, size_t *n_written, int oob)
 
static size_t x_WriteBuf (void *x_ctx, const void *data, size_t size)
 
static EIO_Status s_Write_ (SOCK sock, const void *data, size_t size, size_t *n_written, int oob)
 
static EIO_Status s_Write (SOCK sock, const void *data, size_t size, size_t *n_written, int oob)
 
static EIO_Status s_Shutdown (SOCK sock, EIO_Event dir, const struct timeval *tv)
 
static EIO_Status s_Close_ (SOCK sock, int abort, TSOCK_Keep keep)
 
static EIO_Status s_Close (SOCK sock, int reclose, TSOCK_Keep keep)
 
static EIO_Status s_Connect_ (SOCK sock, const char *host, unsigned short port, const STimeout *timeout)
 
static EIO_Status s_Connect (SOCK sock, const char *host, unsigned short port, const STimeout *timeout)
 
static EIO_Status s_Create (const char *hostpath, unsigned short port, const STimeout *timeout, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
 
static void SOCK_ABORT (TSOCK_Handle x_sock)
 
static EIO_Status s_CreateOnTop (const void *handle, size_t handle_size, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
 
static EIO_Status s_CreateListening (const char *path, unsigned short port, unsigned short backlog, LSOCK *lsock, TSOCK_Flags flags)
 
static EIO_Status s_Accept (LSOCK lsock, const STimeout *timeout, SOCK *sock, TSOCK_Flags flags)
 
static EIO_Status s_CloseListening (LSOCK lsock)
 
static EIO_Status s_RecvMsg (SOCK sock, void *buf, size_t bufsize, size_t msgsize, size_t *msglen, unsigned int *sender_addr, unsigned short *sender_port)
 
static EIO_Status s_SendMsg (SOCK sock, const char *host, unsigned short port, const void *data, size_t datalen)
 
EIO_Status TRIGGER_Create (TRIGGER *trigger, ESwitch log)
 Create an event trigger. More...
 
EIO_Status TRIGGER_Close (TRIGGER trigger)
 Close an event trigger. More...
 
EIO_Status TRIGGER_Set (TRIGGER trigger)
 Set an event trigger. More...
 
static EIO_Status x_TriggerRead (const TRIGGER trigger, int isset)
 
EIO_Status TRIGGER_IsSet (TRIGGER trigger)
 Check whether the trigger has been set. More...
 
EIO_Status TRIGGER_Reset (TRIGGER trigger)
 Reset the trigger. More...
 
EIO_Status LSOCK_Create (unsigned short port, unsigned short backlog, LSOCK *lsock)
 [SERVER-side] Create and initialize the server-side(listening) socket Same as LSOCK_CreateEx() called with the last argument provided as fSOCK_LogDefault. More...
 
EIO_Status LSOCK_CreateEx (unsigned short port, unsigned short backlog, LSOCK *lsock, TSOCK_Flags flags)
 [SERVER-side] Create and initialize the server-side(listening) socket (socket() + bind() + listen()) More...
 
EIO_Status LSOCK_CreateUNIX (const char *path, unsigned short backlog, LSOCK *lsock, TSOCK_Flags flags)
 
EIO_Status LSOCK_Accept (LSOCK lsock, const STimeout *timeout, SOCK *sock)
 [SERVER-side] Accept connection from a client. More...
 
EIO_Status LSOCK_AcceptEx (LSOCK lsock, const STimeout *timeout, SOCK *sock, TSOCK_Flags flags)
 [SERVER-side] Accept connection from a client. More...
 
EIO_Status LSOCK_Close (LSOCK lsock)
 [SERVER-side] Close the listening socket, destroy relevant internal data. More...
 
EIO_Status LSOCK_GetOSHandleEx (LSOCK lsock, void *handle, size_t handle_size, EOwnership ownership)
 Get an OS-dependent native socket handle to use by platform-specific API. More...
 
EIO_Status LSOCK_GetOSHandle (LSOCK lsock, void *handle, size_t handle_size)
 Same as LSOCK_GetOSHandleEx(lsock, handle_buf, handle_size, eNoOwnership). More...
 
unsigned short LSOCK_GetPort (LSOCK lsock, ENH_ByteOrder byte_order)
 Get socket port number, which it listens on. More...
 
EIO_Status SOCK_CreateInternal (const char *host, unsigned short port, const STimeout *timeout, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
 
EIO_Status SOCK_CreateEx (const char *host, unsigned short port, const STimeout *timeout, SOCK *sock, const void *data, size_t size, TSOCK_Flags flags)
 [CLIENT-side] Connect client to another(server-side, listening) socket (socket() + connect() [+ select()]) More...
 
EIO_Status SOCK_Create (const char *host, unsigned short port, const STimeout *timeout, SOCK *sock)
 [CLIENT-side] Connect client to another(server-side, listening) socket (socket() + connect() [+ select()]) Equivalent to SOCK_CreateEx(host, port, timeout, sock, 0, 0, fSOCK_LogDefault). More...
 
EIO_Status SOCK_CreateUNIX (const char *path, const STimeout *timeout, SOCK *sock, const void *data, size_t size, TSOCK_Flags flags)
 
EIO_Status SOCK_CreateOnTopInternal (const void *handle, size_t handle_size, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
 
EIO_Status SOCK_CreateOnTopEx (const void *handle, size_t handle_size, SOCK *sock, const void *data, size_t size, TSOCK_Flags flags)
 [SERVER-side] Create a SOCKet on top of either an OS-dependent "handle" (file descriptor on Unix, SOCKET on MS-Windows) or an existing SOCK object. More...
 
EIO_Status SOCK_CreateOnTop (const void *handle, size_t handle_size, SOCK *sock)
 [SERVER-side] Create a socket on top of a "handle". More...
 
EIO_Status SOCK_Reconnect (SOCK sock, const char *host, unsigned short port, const STimeout *timeout)
 [CLIENT-side] Close the socket referred to by "sock" and then connect it to another "host:port"; fail if it takes more than "timeout" (close() + connect() [+ select()]) More...
 
EIO_Status SOCK_Shutdown (SOCK sock, EIO_Event dir)
 Shutdown the connection in only one direction (specified by "direction"). More...
 
EIO_Status SOCK_Close (SOCK sock)
 Close the SOCK handle, and destroy all relevant internal data. More...
 
EIO_Status SOCK_CloseEx (SOCK sock, int destroy)
 Close the SOCK handle, and conditionally destroy relevant internal data. More...
 
EIO_Status SOCK_CloseOSHandle (const void *handle, size_t handle_size)
 Close socket OS handle (ungracefully aborting the connection if necessary). More...
 
EIO_Status SOCK_Wait (SOCK sock, EIO_Event event, const STimeout *timeout)
 Block on the socket until either the specified "event" is available or "timeout" expires (if "timeout" is NULL then assume it infinite). More...
 
EIO_Status SOCK_Poll (size_t n, SSOCK_Poll polls[], const STimeout *timeout, size_t *n_ready)
 Block until at least one of the sockets enlisted in "polls" array (of size "n") becomes available for requested operation (SSOCK_Poll::event), or until timeout expires (wait indefinitely if timeout is passed as NULL). More...
 
EIO_Status SOCK_SetTimeout (SOCK sock, EIO_Event event, const STimeout *timeout)
 Specify timeout for the connection I/O (see SOCK_[Read|Write|Close]()). More...
 
const STimeoutSOCK_GetTimeout (SOCK sock, EIO_Event event)
 Get the connection's i/o timeout (or NULL, if the timeout is infinite). More...
 
EIO_Status SOCK_Read (SOCK sock, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how)
 Read/peek up to "size" bytes from "sock" to a buffer pointed to by "buf". More...
 
EIO_Status SOCK_ReadLine (SOCK sock, char *line, size_t size, size_t *n_read)
 Read a line from SOCK. More...
 
EIO_Status SOCK_Pushback (SOCK sock, const void *data, size_t size)
 Push the specified data back to the socket's input queue (in the socket's internal read buffer). More...
 
EIO_Status SOCK_Status (SOCK sock, EIO_Event direction)
 Return low-level socket I/O status of *last* socket operation. More...
 
EIO_Status SOCK_Write (SOCK sock, const void *data, size_t size, size_t *n_written, EIO_WriteMethod how)
 Write "size" bytes of "data" to "sock". More...
 
EIO_Status SOCK_Abort (SOCK sock)
 If there is outstanding connection or output data pending, cancel it. More...
 
unsigned short SOCK_GetLocalPortEx (SOCK sock, int trueport, ENH_ByteOrder byte_order)
 Get local port of the socket (true or cached / stored). More...
 
unsigned short SOCK_GetLocalPort (SOCK sock, ENH_ByteOrder byte_order)
 Get local port of the socket. More...
 
void SOCK_GetPeerAddress (SOCK sock, unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order)
 Get host and port of the socket's peer (remote end). More...
 
unsigned short SOCK_GetRemotePort (SOCK sock, ENH_ByteOrder byte_order)
 Get remote port of the socket (the port it is connected to). More...
 
char * SOCK_GetPeerAddressString (SOCK sock, char *buf, size_t bufsize)
 Equivalent to SOCK_GetPeerAddressStringEx(.,.,.,eSAF_Full) More...
 
char * SOCK_GetPeerAddressStringEx (SOCK sock, char *buf, size_t bufsize, ESOCK_AddressFormat format)
 
EIO_Status SOCK_GetOSHandleEx (SOCK sock, void *handle, size_t handle_size, EOwnership ownership)
 Get an OS-dependent native socket handle to use by platform-specific API. More...
 
EIO_Status SOCK_GetOSHandle (SOCK sock, void *handle, size_t handle_size)
 Same as SOCK_GetOSHandleEx(sock, handle_buf, handle_size, eNoOwnership). More...
 
ESwitch SOCK_SetReadOnWriteAPI (ESwitch on_off)
 By default, sockets will not try to read data from inside SOCK_Write(). More...
 
ESwitch SOCK_SetReadOnWrite (SOCK sock, ESwitch on_off)
 Control the reading-while-writing feature for socket "sock" individually. More...
 
void SOCK_SetCork (SOCK sock, int on_off)
 Control OS-defined send strategy by disabling/enabling the TCP layer to send incomplete network frames (packets). More...
 
void SOCK_DisableOSSendDelay (SOCK sock, int on_off)
 Control OS-defined send strategy by disabling/enabling the TCP Nagle algorithm (which is on by default) that packs multiple requests into a single packet and thus transfers the data in fewer transactions, miminizing the network traffic and generally bursting the throughput. More...
 
EIO_Status DSOCK_Create (SOCK *sock)
 Same as DSOCK_CreateEx(, fSOCK_LogDefault) More...
 
EIO_Status DSOCK_CreateEx (SOCK *sock, TSOCK_Flags flags)
 Create a datagram socket. More...
 
EIO_Status DSOCK_Bind (SOCK sock, unsigned short port)
 Assosiate a datagram socket with a local port. More...
 
EIO_Status DSOCK_Connect (SOCK sock, const char *hostname, unsigned short port)
 Associate a datagram socket with a destination address. More...
 
EIO_Status DSOCK_WaitMsg (SOCK sock, const STimeout *timeout)
 Wait for a datagram in a datagram socket. More...
 
EIO_Status DSOCK_RecvMsg (SOCK sock, void *buf, size_t bufsize, size_t msgsize, size_t *msglen, unsigned int *sender_addr, unsigned short *sender_port)
 Receive a datagram from a datagram socket. More...
 
EIO_Status DSOCK_SendMsg (SOCK sock, const char *host, unsigned short port, const void *data, size_t datalen)
 Send a datagram to a datagram socket. More...
 
EIO_Status DSOCK_WipeMsg (SOCK sock, EIO_Event direction)
 Clear message froma datagram socket. More...
 
EIO_Status DSOCK_SetBroadcast (SOCK sock, int broadcast)
 Set a datagram socket for broadcast. More...
 
TNCBI_BigCount DSOCK_GetMessageCount (SOCK sock, EIO_Event direction)
 Get message count. More...
 
int SOCK_IsDatagram (SOCK sock)
 Check whether a socket is a datagram one. More...
 
int SOCK_IsClientSide (SOCK sock)
 Check whether a socket is client-side. More...
 
int SOCK_IsServerSide (SOCK sock)
 Check whether a socket is server-side. More...
 
int SOCK_IsUNIX (SOCK sock)
 Check whether a socket is UNIX type. More...
 
int SOCK_IsSecure (SOCK sock)
 Check whether a socket is using SSL (Secure Socket Layer). More...
 
TNCBI_BigCount SOCK_GetPosition (SOCK sock, EIO_Event direction)
 Get current read or write position within a socket. More...
 
TNCBI_BigCount SOCK_GetCount (SOCK sock, EIO_Event direction)
 Get counts of read or written bytes. More...
 
TNCBI_BigCount SOCK_GetTotalCount (SOCK sock, EIO_Event direction)
 Get the total volume of data transferred by a socket. More...
 
ESwitch SOCK_SetInterruptOnSignalAPI (ESwitch on_off)
 Control restartability of I/O interrupted by signals. More...
 
ESwitch SOCK_SetInterruptOnSignal (SOCK sock, ESwitch on_off)
 Control restartability of I/O interrupted by signals on a per-socket basis. More...
 
ESwitch SOCK_SetReuseAddressAPI (ESwitch on_off)
 Control address reuse for socket addresses taken by the API. More...
 
void SOCK_SetReuseAddress (SOCK sock, int on_off)
 Control reuse of socket addresses on per-socket basis Note: only a boolean parameter value is can be used here. More...
 
ESwitch SOCK_SetDataLoggingAPI (ESwitch log)
 By default data are not logged. More...
 
ESwitch SOCK_SetDataLogging (SOCK sock, ESwitch log)
 Control the data logging for socket "sock" individually. More...
 
EIO_Status POLLABLE_Poll (size_t n, SPOLLABLE_Poll polls[], const STimeout *timeout, size_t *n_ready)
 Poll for I/O readiness. More...
 
ESOCK_Type POLLABLE_What (POLLABLE poll)
 Identifies a non-NULL POLLABLE. More...
 
POLLABLE POLLABLE_FromTRIGGER (TRIGGER trigger)
 
POLLABLE POLLABLE_FromLSOCK (LSOCK lsock)
 
POLLABLE POLLABLE_FromSOCK (SOCK sock)
 Conversion utilities from handles to POLLABLEs, and back. More...
 
TRIGGER POLLABLE_ToTRIGGER (POLLABLE poll)
 
LSOCK POLLABLE_ToLSOCK (POLLABLE poll)
 
SOCK POLLABLE_ToSOCK (POLLABLE poll)
 
int SOCK_ntoa (unsigned int host, char *buf, size_t bufsize)
 Convert IP address to a string in dotted notation. More...
 
int SOCK_isipEx (const char *str, int fullquad)
 Check whether the given string represents a valid IPv4 address. More...
 
int SOCK_isip (const char *str)
 Equivalent of SOCK_isip(host, 0) More...
 
int SOCK_IsLoopbackAddress (unsigned int ip)
 Check whether an address is a loopback one. More...
 
unsigned int SOCK_HostToNetLong (unsigned int value)
 See man for the BSDisms, htonl() and htons(). More...
 
unsigned short SOCK_HostToNetShort (unsigned short value)
 See man for the BSDisms, htonl() and htons(). More...
 
unsigned int SOCK_htonl (unsigned int value)
 
unsigned short SOCK_htons (unsigned short value)
 
int SOCK_gethostnameEx (char *buf, size_t bufsize, ESwitch log)
 Get the local host name. More...
 
int SOCK_gethostname (char *buf, size_t bufsize)
 Same as SOCK_gethostnameEx(,,<current API data logging>) More...
 
unsigned int SOCK_gethostbynameEx (const char *hostname, ESwitch log)
 Find and return IPv4 address of a named host. More...
 
unsigned int SOCK_gethostbyname (const char *hostname)
 Same as SOCK_gethostbynameEx(,<current API data logging>) More...
 
const char * SOCK_gethostbyaddrEx (unsigned int host, char *buf, size_t bufsize, ESwitch log)
 Take IPv4 host address (in network byte order) or 0 for current host, and fill out the provided buffer with the name, which the address corresponds to (in case of multiple names the primary name is used). More...
 
const char * SOCK_gethostbyaddr (unsigned int host, char *buf, size_t bufsize)
 Same as SOCK_gethostbyaddrEx(,,<current API data logging>) More...
 
unsigned int SOCK_GetLoopbackAddress (void)
 Get loopback IPv4 address. More...
 
unsigned int SOCK_GetLocalHostAddress (ESwitch reget)
 Get (and cache for faster follow-up retrievals) IPv4 address of local host. More...
 
const char * SOCK_StringToHostPortEx (const char *str, unsigned int *host, unsigned short *port, int flag)
 
const char * SOCK_StringToHostPort (const char *str, unsigned int *host, unsigned short *port)
 Read (skipping leading blanks) "[host][:port]" from a string stopping at either EOL or a blank character. More...
 
size_t SOCK_HostPortToStringEx (unsigned int host, unsigned short port, char *buf, size_t size, int flag)
 
size_t SOCK_HostPortToString (unsigned int host, unsigned short port, char *buf, size_t size)
 Print numeric string "host:port" into a buffer provided, not to exceed 'bufsize' bytes (including the teminating '\0' character). More...
 
void SOCK_SetupSSLInternal (FSSLSetup setup, int init)
 
void SOCK_SetupSSL (FSSLSetup setup)
 Store SSL setup callback until actual initialization. More...
 
EIO_Status SOCK_SetupSSLInternalEx (FSSLSetup setup, int init)
 
EIO_Status SOCK_SetupSSLEx (FSSLSetup setup)
 Take SSL setup callback, and then init the entire API (SOCK + SSL). More...
 
const char * SOCK_SSLName (void)
 Return an SSL provider name (in a const static storage), with special considerations: return NULL if SSL has not been set up (yet), and return "" if SSL has not been (properly) initialized for use. More...
 

Variables

const char g_kNcbiSockNameAbbr [] = "SOCK"
 
static volatile int s_Initialized = 0
 
static ESOCK_IOWaitSysAPI s_IOWaitSysAPI = eSOCK_IOWaitSysAPIAuto
 
static volatile unsigned int s_ID_Counter = 0
 
static ESwitch s_ReadOnWrite = eOff
 
static ESwitch s_ReuseAddress = eOff
 
static ESwitch s_InterruptOnSignal = eOff
 
static ESwitch s_Log = eOff
 
static const struct timeval * s_SelectTimeout = 0
 
static int s_AllowSigPipe = 0
 
static SOCKSSL s_SSL
 
static FSSLSetup volatile s_SSLSetup
 
static FSOCK_ErrHook volatile s_ErrHook
 
static void *volatile s_ErrData
 
static FSOCK_ApproveHook volatile s_ApproveHook
 
static void *volatile s_ApproveData
 
enum { ... }  ESOCK_Keep
 

Macro Definition Documentation

◆ abs

#define abs (   a)    ((a) < 0 ? -(a) : (a))

WSA_INVALID_EVENT

Definition at line 238 of file ncbi_socket.c.

◆ extentof

#define extentof (   T,
  F 
)    (sizeof(((T*) 0)->F))

SOCK_HAVE_SHOWDATALAYOUT

Definition at line 714 of file ncbi_socket.c.

◆ IN_LOOPBACKNET

#define IN_LOOPBACKNET   127

INADDR_LOOPBACK

Definition at line 145 of file ncbi_socket.c.

◆ INADDR_LOOPBACK

#define INADDR_LOOPBACK   0x7F000001

Definition at line 142 of file ncbi_socket.c.

◆ infof

#define infof (   T,
  F 
)
Value:
(unsigned int) offsetof(T, F), \
(unsigned int) extentof(T, F)
#define T(s)
Definition: common.h:230
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
#define F(x)
Make a parametrized function appear to have only one variable.
Definition: ncbi_math.c:342
#define offsetof(T, F)
Definition: ncbi_socket.c:700
#define extentof(T, F)
Definition: ncbi_socket.c:714

Definition at line 716 of file ncbi_socket.c.

◆ MAX_TRIGGER_BUF

#define MAX_TRIGGER_BUF   8192

◆ MAXIDLEN

#define MAXIDLEN   80

abs

Definition at line 241 of file ncbi_socket.c.

◆ NCBI_INCLUDE_STRERROR_C

#define NCBI_INCLUDE_STRERROR_C

Definition at line 322 of file ncbi_socket.c.

◆ NCBI_USE_ERRCODE_X

#define NCBI_USE_ERRCODE_X   Connect_Socket

Definition at line 138 of file ncbi_socket.c.

◆ offsetof

#define offsetof (   T,
  F 
)    ((size_t)((char*) &(((T*) 0)->F) - (char*) 0))

Definition at line 700 of file ncbi_socket.c.

◆ s_Pushback

#define s_Pushback (   s,
  d,
  n 
)    BUF_Pushback(&(s)->r_buf, d, n)

Definition at line 7326 of file ncbi_socket.c.

◆ s_Send

#define s_Send   s_Send_

Definition at line 3449 of file ncbi_socket.c.

◆ SOCK_BUF_CHUNK_SIZE

#define SOCK_BUF_CHUNK_SIZE   16384

Definition at line 179 of file ncbi_socket.c.

◆ SOCK_CLOSE

#define SOCK_CLOSE (   s)    closesocket(s)

Definition at line 190 of file ncbi_socket.c.

◆ SOCK_ERRNO

#define SOCK_ERRNO   WSAGetLastError()

Definition at line 188 of file ncbi_socket.c.

◆ SOCK_EVENTS

#define SOCK_EVENTS   (FD_CLOSE|FD_CONNECT|FD_OOB|FD_WRITE|FD_READ)

Definition at line 191 of file ncbi_socket.c.

◆ SOCK_GET_TIMEOUT

#define SOCK_GET_TIMEOUT (   s,
  t 
)    ((s)->t##_tv_set ? &(s)->t##_tv : 0)

Definition at line 247 of file ncbi_socket.c.

◆ SOCK_GHBX_MT_SAFE

#define SOCK_GHBX_MT_SAFE   1 /* for gethostby...() */

Definition at line 185 of file ncbi_socket.c.

◆ SOCK_HAVE_SHOWDATALAYOUT

#define SOCK_HAVE_SHOWDATALAYOUT   1

Definition at line 707 of file ncbi_socket.c.

◆ SOCK_INVALID

#define SOCK_INVALID   INVALID_SOCKET

Definition at line 187 of file ncbi_socket.c.

◆ SOCK_LOOPBACK

#define SOCK_LOOPBACK   (assert(INADDR_LOOPBACK), htonl(INADDR_LOOPBACK))

Definition at line 245 of file ncbi_socket.c.

◆ SOCK_NFDS

#define SOCK_NFDS (   s)    0

Definition at line 189 of file ncbi_socket.c.

◆ SOCK_SEND_SLICE

#define SOCK_SEND_SLICE   (4 << 10) /* 4K */

Definition at line 186 of file ncbi_socket.c.

◆ SOCK_SET_TIMEOUT

#define SOCK_SET_TIMEOUT (   s,
  t,
 
)
Value:
(((s)->t##_tv_set = (v) ? 1 : 0) \
? (void)((s)->t##_tv = *(v)) : (void) 0)
EIPRangeType t
Definition: ncbi_localip.c:101

Definition at line 249 of file ncbi_socket.c.

◆ SOCK_SHOWDATALAYOUT_PARAMS

#define SOCK_SHOWDATALAYOUT_PARAMS
Value:
infof(SOCK_struct, sock), \
infof(SOCK_struct, id), \
infof(TRIGGER_struct, isset), \
infof(SOCK_struct, host), \
infof(SOCK_struct, port), \
infof(SOCK_struct, myport), \
infof(SOCK_struct, err), \
infof(SOCK_struct, event), \
infof(SOCK_struct, sslctx), \
infof(SOCK_struct, r_tv), \
infof(SOCK_struct, w_tv), \
infof(SOCK_struct, c_tv), \
infof(SOCK_struct, r_to), \
infof(SOCK_struct, w_to), \
infof(SOCK_struct, c_to), \
infof(SOCK_struct, r_buf), \
infof(SOCK_struct, w_buf), \
infof(SOCK_struct, r_len), \
infof(SOCK_struct, w_len), \
infof(SOCK_struct, n_read), \
infof(SOCK_struct, n_written), \
infof(SOCK_struct, n_in), \
infof(SOCK_struct, n_out)
#define infof(T, F)
Definition: ncbi_socket.c:716

◆ SOCK_STRERROR

#define SOCK_STRERROR (   error)    s_StrError(0, (error))

Definition at line 243 of file ncbi_socket.c.

◆ sys_gethostname

#define sys_gethostname   gethostname

IN_LOOPBACKNET

Definition at line 156 of file ncbi_socket.c.

◆ WIN_INT_CAST

#define WIN_INT_CAST   (int)

Definition at line 192 of file ncbi_socket.c.

◆ WSA_INVALID_EVENT

#define WSA_INVALID_EVENT   ((WSAEVENT) 0)

Definition at line 194 of file ncbi_socket.c.

Typedef Documentation

◆ TSOCK_Keep

typedef unsigned int TSOCK_Keep

Definition at line 4070 of file ncbi_socket.c.

◆ TSOCK_socklen_t

Definition at line 256 of file ncbi_socket.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
fSOCK_KeepNone 
fSOCK_KeepEvent 
fSOCK_KeepSession 
fSOCK_KeepPending 

Definition at line 4064 of file ncbi_socket.c.

Function Documentation

◆ s_Accept()

static EIO_Status s_Accept ( LSOCK  lsock,
const STimeout timeout,
SOCK sock,
TSOCK_Flags  flags 
)
static

◆ s_AddTimeout()

static void s_AddTimeout ( struct timeval *  tv,
int  ms_addend 
)
static

Definition at line 3436 of file ncbi_socket.c.

Referenced by s_Send_().

◆ s_ApproveCallback()

static EIO_Status s_ApproveCallback ( const char *  host,
unsigned int  addr,
unsigned short  port,
ESOCK_Side  side,
ESOCK_Type  type,
SOCK  sock 
)
static

◆ s_Close()

static EIO_Status s_Close ( SOCK  sock,
int  reclose,
TSOCK_Keep  keep 
)
static

◆ s_Close_()

static EIO_Status s_Close_ ( SOCK  sock,
int  abort,
TSOCK_Keep  keep 
)
static

◆ s_CloseListening()

static EIO_Status s_CloseListening ( LSOCK  lsock)
static

◆ s_Connect()

static EIO_Status s_Connect ( SOCK  sock,
const char *  host,
unsigned short  port,
const STimeout timeout 
)
static

◆ s_Connect_()

static EIO_Status s_Connect_ ( SOCK  sock,
const char *  host,
unsigned short  port,
const STimeout timeout 
)
static

◆ s_CP()

static const char* s_CP ( unsigned int  host,
unsigned short  port,
const char *  path,
char *  buf,
size_t  bufsize 
)
static

Definition at line 409 of file ncbi_socket.c.

References buf, bufsize, and SOCK_HostPortToString().

Referenced by s_Accept(), and s_ID().

◆ s_Create()

static EIO_Status s_Create ( const char *  hostpath,
unsigned short  port,
const STimeout timeout,
SOCK sock,
const SSOCK_Init init,
TSOCK_Flags  flags 
)
static

◆ s_CreateListening()

static EIO_Status s_CreateListening ( const char *  path,
unsigned short  port,
unsigned short  backlog,
LSOCK lsock,
TSOCK_Flags  flags 
)
static

◆ s_CreateOnTop()

static EIO_Status s_CreateOnTop ( const void *  handle,
size_t  handle_size,
SOCK sock,
const SSOCK_Init init,
TSOCK_Flags  flags 
)
static

Definition at line 4751 of file ncbi_socket.c.

References assert, BUF_Destroy(), BUF_Read(), BUF_SetChunkSize(), BUF_Size(), BUF_Splice(), BUF_Write(), calloc(), SOCK_tag::connected, CORE_LOGF, CORE_LOGF_ERRNO_EXX, CORE_LOGF_ERRNO_X, CORE_LOGF_X, SOCKSSL_struct::Create, SNcbiSSLctx::cred, SOCK_tag::crossexec, eDefault, eIO_InvalidArg, eIO_NotSupported, eIO_Open, eIO_Success, eIO_Unknown, eLOG_Critical, eLOG_Error, eLOG_Note, eLOG_Trace, eLOG_Warning, eOn, eSOCK_Client, eSOCK_Server, eSOCK_Socket, SOCK_tag::event, flags, free(), fSOCK_InterruptOnSignal, fSOCK_KeepAlive, fSOCK_KeepEvent, fSOCK_KeepNone, fSOCK_KeepOnClose, fSOCK_KeepOnExec, fSOCK_KeepPending, fSOCK_KeepSession, fSOCK_LogDefault, fSOCK_LogOn, fSOCK_ReadOnWrite, fSOCK_Secure, SNcbiSSLctx::host, SOCK_tag::host, SOCK_tag::i_on_sig, SOCK_tag::id, in(), init(), SOCK_tag::keep, SOCK_tag::keepalive, SOCK_tag::log, MAXIDLEN, SOCK_tag::myport, NCBI_OS_DARWIN, SOCK_tag::path, SOCK_tag::pending, SOCK_tag::port, SOCK_tag::r_buf, SOCK_tag::r_on_w, s_Close(), s_DoLog(), s_ID(), s_InitAPI(), s_Initialized, s_Log, s_SetCloexec(), s_SetNonblock(), s_SSL, s_StrError(), s_WinStrerror(), SNcbiSSLctx::sess, SOCK_tag::side, ncbi::grid::netcache::search::fields::size, SNcbiSSLctx::sock, SOCK_tag::sock, SOCK_ABORT(), SOCK_BUF_CHUNK_SIZE, SOCK_Destroy, SOCK_ENOTCONN, SOCK_ERRNO, SOCK_EVENTS, SOCK_INVALID, SOCK_isip(), SOCK_STRERROR, SOCK_tag::sslctx, strdup, strncpy0(), strnlen, SOCK_tag::type, UTIL_ReleaseBuffer, UTIL_ReleaseBufferOnHeap(), SOCK_tag::w_buf, SOCK_tag::w_len, SOCK_tag::writable, and x_ID_Counter().

Referenced by SOCK_CreateOnTopInternal().

◆ s_DoLog()

static void s_DoLog ( ELOG_Level  level,
const SOCK  sock,
EIO_Event  event,
const void *  data,
size_t  size,
const void *  ptr 
)
static

◆ s_ErrorCallback()

static void s_ErrorCallback ( const SSOCK_ErrInfo info)
static

◆ s_gethostbyaddr()

static const char* s_gethostbyaddr ( unsigned int  host,
char *  name,
size_t  namesize,
ESwitch  log 
)
static

◆ s_gethostbyaddr_()

static char* s_gethostbyaddr_ ( unsigned int  host,
char *  name,
size_t  namesize,
ESwitch  log 
)
static

◆ s_gethostbyname()

static unsigned int s_gethostbyname ( const char *  hostname,
int  not_ip,
ESwitch  log 
)
static

◆ s_gethostbyname_()

static unsigned int s_gethostbyname_ ( const char *  hostname,
int  not_ip,
int  self,
ESwitch  log 
)
static

◆ s_gethostname()

static int s_gethostname ( char *  name,
size_t  namesize,
ESwitch  log 
)
static

◆ s_getlocalhostaddress()

static unsigned int s_getlocalhostaddress ( ESwitch  reget,
ESwitch  log 
)
static

◆ s_GetLocalPort()

static unsigned short s_GetLocalPort ( TSOCK_Handle  fd)
static

Definition at line 493 of file ncbi_socket.c.

Referenced by s_DoLog(), and SOCK_GetLocalPortEx().

◆ s_ID()

static const char* s_ID ( const SOCK  sock,
char  buf[80] 
)
static

◆ s_Init()

static EIO_Status s_Init ( void  )
static

◆ s_InitAPI()

static EIO_Status s_InitAPI ( int  secure)
static

◆ s_InitAPI_()

static EIO_Status s_InitAPI_ ( int  secure)
static

◆ s_IsConnected_()

static EIO_Status s_IsConnected_ ( SOCK  sock,
const struct timeval *  tv,
const char **  what,
int error,
int  writeable 
)
static

◆ s_IsSmallerTimeout()

static int s_IsSmallerTimeout ( const struct timeval *  t1,
const struct timeval *  t2 
)
static

NCBI_OS_MSWIN && FD_SETSIZE

Definition at line 1786 of file ncbi_socket.c.

Referenced by s_Send_().

◆ s_Read()

static EIO_Status s_Read ( SOCK  sock,
void *  buf,
size_t  size,
size_t *  n_read,
int  peek 
)
static

◆ s_Read_()

static EIO_Status s_Read_ ( SOCK  sock,
void *  buf,
size_t  size,
size_t *  n_read,
int  peek 
)
static

◆ s_Recv()

static EIO_Status s_Recv ( SOCK  sock,
void *  buf,
size_t  size,
size_t *  n_read,
int  flag 
)
static

◆ s_RecvMsg()

static EIO_Status s_RecvMsg ( SOCK  sock,
void *  buf,
size_t  bufsize,
size_t  msgsize,
size_t *  msglen,
unsigned int sender_addr,
unsigned short *  sender_port 
)
static

◆ s_Select()

static EIO_Status s_Select ( size_t  n,
SSOCK_Poll  polls[],
const struct timeval *  tv,
int  asis 
)
static

◆ s_SelectStallsafe()

static EIO_Status s_SelectStallsafe ( size_t  n,
SSOCK_Poll  polls[],
const struct timeval *  tv,
size_t *  n_ready 
)
static

◆ s_Send()

static EIO_Status s_Send ( SOCK  sock,
const void *  data,
size_t  size,
size_t *  n_written,
int  flag 
)
static

◆ s_Send_()

static EIO_Status s_Send_ ( SOCK  sock,
const void *  data,
size_t  size,
size_t *  n_written,
int  flag 
)
static

◆ s_SendMsg()

static EIO_Status s_SendMsg ( SOCK  sock,
const char *  host,
unsigned short  port,
const void *  data,
size_t  datalen 
)
static

◆ s_SetCloexec()

static int s_SetCloexec ( TSOCK_Handle  x_sock,
int  cloexec 
)
static

Definition at line 1668 of file ncbi_socket.c.

References flags, and HANDLE.

Referenced by DSOCK_CreateEx(), s_Accept(), s_Connect_(), s_CreateListening(), s_CreateOnTop(), and TRIGGER_Create().

◆ s_SetNonblock()

static int s_SetNonblock ( TSOCK_Handle  sock,
int  nonblock 
)
static

◆ s_SetReuseAddress()

static int s_SetReuseAddress ( TSOCK_Handle  x_sock,
int  on_off 
)
static

Definition at line 1691 of file ncbi_socket.c.

References FALSE, and TRUE.

Referenced by s_Accept(), s_CreateListening(), s_IsConnected_(), and SOCK_SetReuseAddress().

◆ s_Shutdown()

static EIO_Status s_Shutdown ( SOCK  sock,
EIO_Event  dir,
const struct timeval *  tv 
)
static

◆ s_StrError()

static const char* s_StrError ( SOCK  sock,
int  error 
)
static

◆ s_to2tv()

static struct timeval* s_to2tv ( const STimeout to,
struct timeval *  tv 
)
static

◆ s_tv2to()

static STimeout* s_tv2to ( const struct timeval *  tv,
STimeout to 
)
static

Definition at line 668 of file ncbi_socket.c.

References assert, int, STimeoutTag::sec, and STimeoutTag::usec.

Referenced by SOCK_GetTimeout(), and SOCK_SetSelectInternalRestartTimeout().

◆ s_Wait()

static EIO_Status s_Wait ( SOCK  sock,
EIO_Event  event,
const STimeout timeout 
)
static

Definition at line 3415 of file ncbi_socket.c.

References assert, eIO_Close, eIO_Open, eIO_Success, eIO_Unknown, poll, s_SelectStallsafe(), and s_to2tv().

Referenced by SOCK_Wait().

◆ s_WaitConnected()

static EIO_Status s_WaitConnected ( SOCK  sock,
const struct timeval *  tv 
)
static

◆ s_WinStrerror()

static const char* s_WinStrerror ( DWORD  error)
static

◆ s_Write()

static EIO_Status s_Write ( SOCK  sock,
const void *  data,
size_t  size,
size_t *  n_written,
int  oob 
)
static

◆ s_Write_()

static EIO_Status s_Write_ ( SOCK  sock,
const void *  data,
size_t  size,
size_t *  n_written,
int  oob 
)
static

◆ s_WriteData()

static EIO_Status s_WriteData ( SOCK  sock,
const void *  data,
size_t  size,
size_t *  n_written,
int  oob 
)
static

◆ s_WritePending()

static EIO_Status s_WritePending ( SOCK  sock,
const struct timeval *  tv,
int  writeable,
int  oob 
)
static

◆ SOCK_ABORT()

static void SOCK_ABORT ( TSOCK_Handle  x_sock)
static

◆ SOCK_CreateInternal()

EIO_Status SOCK_CreateInternal ( const char *  host,
unsigned short  port,
const STimeout timeout,
SOCK sock,
const SSOCK_Init init,
TSOCK_Flags  flags 
)

◆ SOCK_CreateOnTopInternal()

EIO_Status SOCK_CreateOnTopInternal ( const void *  handle,
size_t  handle_size,
SOCK sock,
const SSOCK_Init init,
TSOCK_Flags  flags 
)

◆ SOCK_HostPortToStringEx()

size_t SOCK_HostPortToStringEx ( unsigned int  host,
unsigned short  port,
char *  buf,
size_t  size,
int  flag 
)

◆ SOCK_SetupSSLInternal()

void SOCK_SetupSSLInternal ( FSSLSetup  setup,
int  init 
)

◆ SOCK_SetupSSLInternalEx()

EIO_Status SOCK_SetupSSLInternalEx ( FSSLSetup  setup,
int  init 
)

Definition at line 9004 of file ncbi_socket.c.

References eIO_Success, init(), s_InitAPI(), setup(), and SOCK_SetupSSLInternal().

Referenced by s_Init(), and SOCK_SetupSSLEx().

◆ SOCK_StringToHostPortEx()

const char* SOCK_StringToHostPortEx ( const char *  str,
unsigned int host,
unsigned short *  port,
int  flag 
)

◆ x_ChooseSelfIP()

static const char* x_ChooseSelfIP ( char **  addrs)
static

Definition at line 1164 of file ncbi_socket.c.

References ip, n, SOCK_IsLoopbackAddress(), and x_IsAPIPA().

Referenced by s_gethostbyname_().

◆ x_ID_Counter()

static unsigned int x_ID_Counter ( void  )
static

◆ x_IsAPIPA()

static int x_IsAPIPA ( unsigned int  addr)
static

Definition at line 1158 of file ncbi_socket.c.

Referenced by x_ChooseSelfIP().

◆ x_ShowDataLayout()

static void x_ShowDataLayout ( void  )
static

Definition at line 719 of file ncbi_socket.c.

References CORE_LOGF_X, eLOG_Trace, and SOCK_SHOWDATALAYOUT_PARAMS.

Referenced by s_Init().

◆ x_ShutdownSSL()

static void x_ShutdownSSL ( void  )
static

Definition at line 1009 of file ncbi_socket.c.

References SOCKSSL_struct::Exit, s_Initialized, s_SSL, and s_SSLSetup.

Referenced by SOCK_SetupSSLInternal(), and SOCK_ShutdownAPI().

◆ x_TriggerRead()

static EIO_Status x_TriggerRead ( const TRIGGER  trigger,
int  isset 
)
static

◆ x_tvcpy()

static void x_tvcpy ( struct timeval *  dst,
struct timeval *  src 
)
inlinestatic

Definition at line 2759 of file ncbi_socket.c.

Referenced by s_IsConnected_(), s_Read_(), s_Send(), s_Shutdown(), and s_WritePending().

◆ x_WriteBuf()

static size_t x_WriteBuf ( void *  x_ctx,
const void *  data,
size_t  size 
)
static

Variable Documentation

◆ 

enum { ... } ESOCK_Keep

◆ g_kNcbiSockNameAbbr

const char g_kNcbiSockNameAbbr[] = "SOCK"

Definition at line 266 of file ncbi_socket.c.

Referenced by CONN_GetSOCK(), s_ID(), s_VT_Open(), and x_GetType().

◆ s_AllowSigPipe

int s_AllowSigPipe = 0
static

Definition at line 301 of file ncbi_socket.c.

Referenced by s_Init(), s_Send_(), and SOCK_AllowSigPipeAPI().

◆ s_ApproveData

void* volatile s_ApproveData
static

Definition at line 314 of file ncbi_socket.c.

Referenced by s_ApproveCallback(), and SOCK_SetApproveHookAPI().

◆ s_ApproveHook

FSOCK_ApproveHook volatile s_ApproveHook
static

◆ s_ErrData

void* volatile s_ErrData
static

Definition at line 310 of file ncbi_socket.c.

Referenced by s_ErrorCallback(), and SOCK_SetErrHookAPI().

◆ s_ErrHook

FSOCK_ErrHook volatile s_ErrHook
static

◆ s_ID_Counter

volatile unsigned int s_ID_Counter = 0
static

Definition at line 282 of file ncbi_socket.c.

Referenced by x_ID_Counter().

◆ s_Initialized

volatile int s_Initialized = 0
static

◆ s_InterruptOnSignal

ESwitch s_InterruptOnSignal = eOff
static

◆ s_IOWaitSysAPI

ESOCK_IOWaitSysAPI s_IOWaitSysAPI = eSOCK_IOWaitSysAPIAuto
static

Definition at line 279 of file ncbi_socket.c.

Referenced by s_Select(), and SOCK_SetIOWaitSysAPI().

◆ s_Log

ESwitch s_Log = eOff
static

◆ s_ReadOnWrite

ESwitch s_ReadOnWrite = eOff
static

Definition at line 285 of file ncbi_socket.c.

Referenced by s_Select(), s_SelectStallsafe(), and SOCK_SetReadOnWriteAPI().

◆ s_ReuseAddress

ESwitch s_ReuseAddress = eOff
static

Definition at line 288 of file ncbi_socket.c.

Referenced by s_Accept(), s_IsConnected_(), and SOCK_SetReuseAddressAPI().

◆ s_SelectTimeout

const struct timeval* s_SelectTimeout = 0
static

Definition at line 297 of file ncbi_socket.c.

Referenced by s_Select(), and SOCK_SetSelectInternalRestartTimeout().

◆ s_SSL

SOCKSSL s_SSL
static

◆ s_SSLSetup

FSSLSetup volatile s_SSLSetup
static

Definition at line 306 of file ncbi_socket.c.

Referenced by s_InitAPI_(), SOCK_SetupSSLInternal(), SOCK_SSLName(), and x_ShutdownSSL().

Modified on Sun Jul 21 04:15:15 2024 by modify_doxy.py rev. 669887