(
unsigned shortport,
566 unsigned shortbacklog,
590(
unsigned shortport,
591 unsigned shortbacklog,
599(
unsigned shortport,
600 unsigned shortbacklog,
608(
unsigned shortport,
609 unsigned shortbacklog,
718 unsigned short* port,
727 unsigned short* port,
872(
const void* handle,
894(
const void* handle,
970 #define SOCK_Destroy(s) SOCK_Close(s) 1050(
const void* handle,
1497 unsigned int* host,
1498 unsigned short* port,
1520 unsigned short* port,
1716 unsigned shortport,
1780 unsigned short* sender_port
1791 unsigned int* sender_addr,
1792 unsigned short* sender_port
1813 unsigned shortport,
2110 structSPOLLABLE_tag;
2181(
unsigned int addr,
2199(
const char* host,
2246(
unsigned int value 2249 #define SOCK_NetToHostLong SOCK_HostToNetLong 2256(
unsigned short value 2259 #define SOCK_NetToHostShort SOCK_HostToNetShort 2265 #define SOCK_ntohl SOCK_htonl 2268 unsigned short SOCK_htons(
unsigned short);
2269 #define SOCK_ntohs SOCK_htons 2319 const char* hostname,
2330 const char* hostname
2351(
const char* hostname,
2361(
const char* hostname
2421(
unsigned int addr,
2433(
unsigned int addr,
2522(
const char*
str,
2523 unsigned int* host,
2524 unsigned short* port
2532(
const char*
str,
2534 unsigned short* port
2557(
unsigned inthost,
2558 unsigned shortport,
2573 unsigned shortport,
static const char * str(char *buf, int n)
void LSOCK_GetListeningAddress6(LSOCK lsock, TNCBI_IPv6Addr *addr, unsigned short *port, ENH_ByteOrder byte_order)
TRIGGER POLLABLE_ToTRIGGER(POLLABLE)
TNCBI_IPv6Addr * SOCK_gethostbyname6(TNCBI_IPv6Addr *addr, const char *hostname)
Same as SOCK_gethostbynameEx6(,,<current API data logging>)
struct SNcbiCred * NCBI_CRED
Opaque type for credentials.
LSOCK POLLABLE_ToLSOCK(POLLABLE)
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 charac...
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).
char * SOCK_GetPeerAddressStringEx(SOCK sock, char *buf, size_t bufsize, ESOCK_AddressFormat format)
Get textual representation of the socket's peer.
int SOCK_isipEx(const char *host, int fullquad)
Check whether a given string represents a valid bare IPv4 address.
ESwitch SOCK_SetReadOnWrite(SOCK sock, ESwitch on_off)
Control the reading-while-writing feature for socket "sock" individually.
EIO_Status TRIGGER_Set(TRIGGER trigger)
Set an event trigger.
size_t SOCK_HostPortToString6(const TNCBI_IPv6Addr *addr, unsigned short port, char *buf, size_t bufsize)
IPv6-aware version of SOCK_HostPortToString, which can handle both IPv4 and IPv6.
int SOCK_IsSecure(SOCK sock)
Check whether a socket is using SSL (Secure Socket Layer).
EIO_Status SOCK_SetTimeout(SOCK sock, EIO_Event event, const STimeout *timeout)
Specify timeout for the connection I/O (see SOCK_[Read|Write|Close]()).
void SOCK_DisableOSSendDelay(SOCK sock, int on_off)
Control OS-defined send strategy by disabling/enabling the TCP Nagle algorithm (which is on by defaul...
unsigned short port
Port (host byte order), 0 for non-IP SOCK.
unsigned int SOCK_HostToNetLong(unsigned int value)
See man for the BSDisms, htonl() and htons().
EIO_Status SOCK_Shutdown(SOCK sock, EIO_Event how)
Shutdown the connection in only one direction (specified by "direction").
unsigned short SOCK_GetRemotePort(SOCK sock, ENH_ByteOrder byte_order)
Get remote port of the socket (the port it is connected to).
EIO_Event event
[in] SOCK to poll (NULL if not to poll)
EIO_Status SOCK_Close(SOCK sock)
Close the SOCK handle, and destroy all relevant internal data.
int SOCK_IsAddress(const char *host)
Check whether a given string represents a bare IP address.
size_t SOCK_HostPortToString(unsigned int host, unsigned short port, char *buf, size_t bufsize)
Print numeric string "host:port" into a buffer provided, not to exceed 'bufsize' bytes (including the...
EIO_Status DSOCK_SetBroadcast(SOCK sock, int broadcast)
Set a datagram socket for broadcast.
EIO_Status LSOCK_Accept(LSOCK lsock, const STimeout *timeout, SOCK *sock)
[SERVER-side] Accept connection from a client.
EIO_Status LSOCK_Create6(unsigned short port, unsigned short backlog, LSOCK *lsock, ESwitch ipv6)
[SERVER-side] Create and initialize the server-side(listening) socket Same as LSOCK_CreateEx6() calle...
EIO_Status DSOCK_RecvMsg(SOCK sock, void *buf, size_t bufsize, size_t maxmsglen, size_t *msglen, unsigned int *sender_addr, unsigned short *sender_port)
Same as DSOCK_RecvMsg6() but only suitable for IPv4 sender address.
void(* FSOCK_ErrHook)(const SSOCK_ErrInfo *info, void *data)
const char * SOCK_SSLName(void)
Return an SSL provider name (in a const static storage), with special considerations: return NULL if ...
EIO_Status DSOCK_Connect(SOCK sock, const char *host, unsigned short port)
Associate a datagram socket with a destination address.
ESwitch SOCK_SetReuseAddressAPI(ESwitch on_off)
Control address reuse for socket addresses taken by the API.
const char * SOCK_gethostbyaddr(unsigned int addr, char *buf, size_t buflen)
Same as SOCK_gethostbyaddrEx(,,<current API data logging>)
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".
ESwitch SOCK_SetInterruptOnSignal(SOCK sock, ESwitch on_off)
Control restartability of I/O interrupted by signals on a per-socket basis.
EIO_Status SOCK_Status(SOCK sock, EIO_Event direction)
Return low-level socket I/O status of *last* socket operation.
EIO_Status SOCK_CloseOSHandle(const void *handle, size_t handle_size)
Close socket OS handle (ungracefully aborting the connection if necessary).
TNCBI_IPv6Addr * SOCK_gethostbynameEx6(TNCBI_IPv6Addr *addr, const char *hostname, ESwitch log)
Find and return an Internet address of a named host.
unsigned int SOCK_gethostbynameEx(const char *hostname, ESwitch log)
Find and return IPv4 address of a named host.
EIO_Status POLLABLE_Poll(size_t n, SPOLLABLE_Poll polls[], const STimeout *timeout, size_t *n_ready)
Poll for I/O readiness.
EIO_Status TRIGGER_Reset(TRIGGER trigger)
Reset the trigger.
EIO_Status SOCK_InitializeAPI(void)
Initialize all internal/system data & resources to be used by the SOCK API.
unsigned int SOCK_htonl(unsigned int)
int SOCK_gethostname(char *name, size_t namelen)
Same as SOCK_gethostnameEx(,,<current API data logging>)
unsigned short port
Port number, host byte order, never 0.
void SOCK_SetupSSL(FSSLSetup setup)
Store SSL setup callback until actual initialization.
POLLABLE POLLABLE_FromSOCK(SOCK)
void SOCK_SetCork(SOCK sock, int on_off)
Control OS-defined send strategy by disabling/enabling the TCP layer to send incomplete network frame...
void SOCK_AllowSigPipeAPI(void)
By default (on UNIX platforms) the SOCK API functions automagically call "signal(SIGPIPE,...
ENH_ByteOrder
Network and host byte order enumeration type.
ESOCK_Type POLLABLE_What(POLLABLE)
Identifies a non-NULL POLLABLE.
EIO_Status SOCK_CloseEx(SOCK sock, int destroy)
Close the SOCK handle, and conditionally destroy relevant internal data.
void SOCK_SetApproveHookAPI(FSOCK_ApproveHook hook, void *data)
The hook is installed when non-NULL, and de-installed otherwise.
ESOCK_IOWaitSysAPI SOCK_SetIOWaitSysAPI(ESOCK_IOWaitSysAPI api)
This is a helper call that can improve I/O performance (ignored for MSVC).
unsigned int SOCK_GetLoopbackAddress(void)
Get IPv4 loopback address.
int SOCK_IsServerSide(SOCK sock)
Check whether a socket is server-side.
EIO_Status DSOCK_RecvMsg6(SOCK sock, void *buf, size_t bufsize, size_t maxmsglen, size_t *msglen, TNCBI_IPv6Addr *sender_addr, unsigned short *sender_port)
Receive a datagram from a datagram socket.
unsigned short SOCK_HostToNetShort(unsigned short value)
See man for the BSDisms, htonl() and htons().
ESOCK_Side
Sides of socket.
void SOCK_GetPeerAddress6(SOCK sock, TNCBI_IPv6Addr *addr, unsigned short *port, ENH_ByteOrder byte_order)
Get host and port of the socket's peer (remote end).
EIO_Status LSOCK_CreateEx6(unsigned short port, unsigned short backlog, LSOCK *lsock, TSOCK_Flags flags, ESwitch ipv6)
[SERVER-side] Create and initialize the server-side(listening) socket (socket() + bind() + listen())
ESOCK_Type type
eSOCK_Socket (conn) / eSOCK_Datagram (packet)
int SOCK_IsLoopbackAddress(unsigned int ip)
Check whether an address is a loopback one.
TNCBI_BigCount SOCK_GetPosition(SOCK sock, EIO_Event direction)
Get current read or write position within a socket.
unsigned int SOCK_gethostbyname(const char *hostname)
Same as SOCK_gethostbynameEx(,<current API data logging>)
void SOCK_SetErrHookAPI(FSOCK_ErrHook hook, void *data)
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).
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...
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() [+ selec...
ESwitch SOCK_SetDataLoggingAPI(ESwitch log)
By default data are not logged.
EIO_Status SOCK_Abort(SOCK sock)
If there is outstanding connection or output data pending, cancel it.
EIO_Status SOCK_GetOSHandleEx(SOCK sock, void *handle_buf, size_t handle_size, EOwnership ownership)
Get an OS-dependent native socket handle to use by platform-specific API.
EIO_Status LSOCK_AcceptEx(LSOCK lsock, const STimeout *timeout, SOCK *sock, TSOCK_Flags flags)
[SERVER-side] Accept connection from a client.
TNCBI_IPv6Addr * SOCK_GetLoopbackAddress6(TNCBI_IPv6Addr *addr)
Get loopback address.
int SOCK_ntoa(unsigned int addr, char *buf, size_t bufsize)
Convert IP address to a string in dotted notation.
EIO_Status TRIGGER_Create(TRIGGER *trigger, ESwitch log)
Create an event trigger.
ESwitch SOCK_SetReadOnWriteAPI(ESwitch on_off)
By default, sockets will not try to read data from inside SOCK_Write().
ESOCK_IOWaitSysAPI
Selector of I/O wait system API: auto, poll(), or select().
EIO_Status DSOCK_Create(SOCK *sock)
Same as DSOCK_CreateEx(, fSOCK_LogDefault)
unsigned int SOCK_GetLocalHostAddress(ESwitch reget)
Same as SOCK_GetLocalHostAddress6() only strictly for IPv4.
const struct SOCKSSL_struct * SOCKSSL
Opaque type for SSL implementation.
EIO_Status TRIGGER_Close(TRIGGER trigger)
Close an event trigger.
TNCBI_IPv6Addr * SOCK_GetLocalHostAddress6(TNCBI_IPv6Addr *addr, ESwitch reget)
Get (and cache for faster follow-up retrievals) IP address of local host.
EIO_Status SOCK_ReadLine(SOCK sock, char *line, size_t size, size_t *n_read)
Read a line from SOCK.
int SOCK_IsDatagram(SOCK sock)
Check whether a socket is a datagram one.
EIO_Status LSOCK_GetOSHandle(LSOCK lsock, void *handle_buf, size_t handle_size)
Same as LSOCK_GetOSHandleEx(lsock, handle_buf, handle_size, eNoOwnership).
const char * host
Textual hostname if provided for outgoing.
int SOCK_isip6(const char *host)
Check whether a given string represents a valid bare IPv6 address.
ESwitch SOCK_SetIPv6API(ESwitch ipv6)
Select IPv6 as the underlying IP protocol.
char * LSOCK_GetListeningAddressString(LSOCK lsock, char *buf, size_t bufsize)
Equivalent to LSOCK_GetListeningAddressStringEx(.,.,.,eSAF_Full)
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".
EIO_Status DSOCK_WaitMsg(SOCK sock, const STimeout *timeout)
Wait for a datagram in a datagram socket.
TNCBI_BigCount SOCK_GetTotalCount(SOCK sock, EIO_Event direction)
Get the total volume of data transferred by a socket.
char * LSOCK_GetListeningAddressStringEx(LSOCK lsock, char *buf, size_t bufsize, ESOCK_AddressFormat format)
const char * SOCK_gethostbyaddrEx6(const TNCBI_IPv6Addr *addr, char *buf, size_t buflen, ESwitch log)
Take an Internet address (IPv6 or IPv4) [or 0 (or empty) for current host], and fill in the provided ...
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...
const char * host
Host name/IP (or path for non-IP SOCK)
int SOCK_gethostnameEx(char *name, size_t namelen, ESwitch log)
Get the local host name.
int SOCK_IsClientSide(SOCK sock)
Check whether a socket is client-side.
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.
ESOCK_ErrType
User-level error hook.
SOCK sock
Non-NULL when SOCK-related.
void LSOCK_GetListeningAddress(LSOCK lsock, unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order)
char * SOCK_GetPeerAddressString(SOCK sock, char *buf, size_t bufsize)
Equivalent to SOCK_GetPeerAddressStringEx(.,.,.,eSAF_Full)
EIO_Status LSOCK_CreateEx(unsigned short port, unsigned short backlog, LSOCK *lsock, TSOCK_Flags flags)
Same as LSOCK_CreateEx6(,,,, eOff)
ESOCK_ErrType type
See ESOCK_ErrType.
EIO_Status LSOCK_GetOSHandleEx(LSOCK lsock, void *handle_buf, size_t handle_size, EOwnership owndership)
Get an OS-dependent native socket handle to use by platform-specific API.
struct TRIGGER_tag * TRIGGER
EIO_Status TRIGGER_IsSet(TRIGGER trigger)
Check whether the trigger has been set.
TNCBI_IPv6Addr addr
IP (or -1 if unknown / broadcast), never 0.
unsigned short SOCK_htons(unsigned short)
int SOCK_IsUNIX(SOCK sock)
Check whether a socket is UNIX type.
EIO_Status SOCK_SetupSSLEx(FSSLSetup setup)
Take SSL setup callback, and then init the entire API (SOCK + SSL).
TNCBI_BigCount DSOCK_GetMessageCount(SOCK sock, EIO_Event direction)
Get message count.
EIO_Status SOCK_ShutdownAPI(void)
Cleanup; destroy all internal/system data & resources used by the SOCK API.
ESwitch SOCK_SetDataLogging(SOCK sock, ESwitch log)
Control the data logging for socket "sock" individually.
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 ...
EIO_Status DSOCK_CreateEx(SOCK *sock, TSOCK_Flags flags)
Create a datagram socket.
EIO_Status LSOCK_Create(unsigned short port, unsigned short backlog, LSOCK *lsock)
Same as LSOCK_Create6(,,, eOff) or LSOCK_CreateEx(,,, eDefault)
const char * SOCK_StringToHostPort6(const char *str, TNCBI_IPv6Addr *addr, unsigned short *port)
unsigned short LSOCK_GetPort(LSOCK lsock, ENH_ByteOrder byte_order)
Get socket port number, which it listens on.
POLLABLE POLLABLE_FromLSOCK(LSOCK)
const char * SOCK_gethostbyaddr6(const TNCBI_IPv6Addr *addr, char *buf, size_t buflen)
Same as SOCK_gethostbyaddrEx6(,,<current API data logging>)
const char * SOCK_gethostbyaddrEx(unsigned int addr, char *buf, size_t buflen, ESwitch log)
Take an IPv4 address (in network byte order) [or 0 for current host], and fill in the provided buffer...
EIO_Status DSOCK_Bind(SOCK sock, unsigned short port)
Same as DSOCK_Bind6(,, eOff)
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() [+ selec...
POLLABLE POLLABLE_FromTRIGGER(TRIGGER)
Conversion utilities from handles to POLLABLEs, and back.
int SOCK_IsLoopbackAddress6(const TNCBI_IPv6Addr *addr)
Check whether an address is a loopback one.
size_t SOCK_OSHandleSize(void)
Get size of OS-dependent native socket handle.
EIO_Status DSOCK_Bind6(SOCK sock, unsigned short port, ESwitch ipv6)
Assosiate a datagram socket with a local port.
EIO_Status LSOCK_Close(LSOCK lsock)
[SERVER-side] Close the listening socket, destroy relevant internal data.
struct SPOLLABLE_tag * POLLABLE
EIO_Status SOCK_CreateOnTop(const void *handle, size_t handle_size, SOCK *sock)
[SERVER-side] Create a socket on top of a "handle".
ESwitch SOCK_SetInterruptOnSignalAPI(ESwitch on_off)
Control restartability of I/O interrupted by signals.
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,...
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...
EIO_Status DSOCK_WipeMsg(SOCK sock, EIO_Event direction)
Clear message froma datagram socket.
TNCBI_BigCount SOCK_GetCount(SOCK sock, EIO_Event direction)
Get counts of read or written bytes.
const STimeout * SOCK_GetTimeout(SOCK sock, EIO_Event event)
Get the connection's i/o timeout (or NULL, if the timeout is infinite).
EIO_Event event
Meaningful only for the eSOCK_ErrIO type.
EIO_Event revent
[in] one of: eIO_Open/Read/Write/ReadWrite
ESOCK_Side side
eSOCK_Client (out) / eSOCK_Server (in)
EIO_Status status
Status code about to be returned (if known)
int SOCK_isip(const char *host)
Equivalent of SOCK_isip(host, 0)
const STimeout * SOCK_SetSelectInternalRestartTimeout(const STimeout *timeslice)
This is a helper call that can improve I/O behavior.
ESOCK_Type
Socket type (internal)
EIO_Status(* FSOCK_ApproveHook)(const SSOCK_ApproveInfo *info, void *data)
The approve hook is global per API and gets called with an arbitrary user "data", if so desired as a ...
SOCKSSL(* FSSLSetup)(void)
SSL setup callback.
SOCK POLLABLE_ToSOCK(POLLABLE)
unsigned short SOCK_GetLocalPort(SOCK sock, ENH_ByteOrder byte_order)
Get local port of the socket.
unsigned short SOCK_GetLocalPortEx(SOCK sock, int trueport, ENH_ByteOrder byte_order)
Get local port of the socket (true or cached / stored).
unsigned int TSOCK_Flags
bitwise "OR" of ESOCK_Flags
EIO_Status SOCK_GetOSHandle(SOCK sock, void *handle_buf, size_t handle_size)
Same as SOCK_GetOSHandleEx(sock, handle_buf, handle_size, eNoOwnership).
@ eSAF_IP
only numeric IP if INET socket, empty otherwise
@ eSAF_Full
address in full, native form
@ eSAF_Port
only numeric port if INET socket, empty otherwise
@ eSOCK_IOWaitSysAPISelect
always use select()
@ eSOCK_IOWaitSysAPIAuto
default; use some heuristics to choose API
@ eSOCK_IOWaitSysAPIPoll
always use poll()
@ eSOCK_ErrDns
DNS-related error (unresolvable hostname)
@ eSOCK_ErrIO
I/O-related error.
@ eSOCK_ErrInit
Socket layer initialization error.
@ fSOCK_CloseOnClose
close OS handle in SOCK_Close[Ex]()
@ fSOCK_KeepAlive
keep socket alive (if supported by OS)
@ fSOCK_BindLocal
bind to 127.0.0.1 only
@ fSOCK_Secure
subsumes CloseOnExec regardless of Keep
@ fSOCK_KeepOnClose
retain OS handle in SOCK_Close[Ex]()
@ fSOCK_BindAny
bind to 0.0.0.0 (i.e.
@ fSOCK_KeepOnExec
can be applied to all sockets
@ fSOCK_CloseOnExec
can be applied to all sockets, default
@ fSOCK_LogOff
NB: logging is inherited in accepted SOCK.
@ fSOCK_InterruptOnSignal
enum ENcbiSwitch ESwitch
Aux.
EIO_ReadMethod
I/O read method.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
EIO_WriteMethod
I/O write method.
EIO_Event
I/O event (or direction).
uint64_t TNCBI_BigCount
Big unsigned integer for file size and position.
#define NCBI_XCONNECT_EXPORT
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
#define NCBI_SOCK_DEPRECATED
static PCRE2_SIZE bufsize
User-level connection approval hook.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4