r_timeout(0
), w_timeout(0), c_timeout(0)
83r_timeout(0
), w_timeout(0), c_timeout(0)
108r_timeout(0
), w_timeout(0), c_timeout(0)
425 unsigned short* port,
439 unsigned short* port,
515 if(hostport.empty())
516*host =
'\0', port = 0;
545 if(
addr.IsEmpty())
556 string* sender_host,
557 unsigned short* sender_port,
572msglen, &
addr, sender_port);
651 unsigned short* port,
684 static const STimeoutkZero = {0, 0};
685 size_tx_n = polls.size();
692 for(
size_t i= 0;
i< x_n; ++
i) {
712x_polls[
i].
poll= 0;
716polls[
i].m_REvent = revent;
718x_polls[
i].
event= event;
720x_polls[
i].
poll= 0;
727x_ready ? &kZero : timeout, &xx_ready);
729 for(
size_t i= 0;
i< x_n; ++
i) {
730 if(x_polls[
i].revent)
731polls[
i].m_REvent = x_polls[
i].
revent;
735*n_ready = xx_ready + x_ready;
835 unsigned short* port)
837 const char* s =
str.c_str();
839 returne ? (size_t)(e - s) : string::npos;
845 unsigned short* port)
848 const char* s =
str.c_str();
851*
addr->GetAddrPtr() = temp;
852 returne ? (size_t)(e - s) : string::npos;
static const char * str(char *buf, int n)
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
EIO_Status Connect(const string &filename, const STimeout *timeout=kDefaultTimeout, TSOCK_Flags flags=fSOCK_LogDefault)
EIO_Status Connect(const string &host, unsigned short port, const STimeout *timeout=kDefaultTimeout, TSOCK_Flags flags=fSOCK_LogDefault)
Connect to "host:port".
void LSOCK_GetListeningAddress6(LSOCK lsock, TNCBI_IPv6Addr *addr, unsigned short *port, ENH_ByteOrder byte_order)
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.
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.
EIO_Status SOCK_SetTimeout(SOCK sock, EIO_Event event, const STimeout *timeout)
Specify timeout for the connection I/O (see SOCK_[Read|Write|Close]()).
EIO_Status Accept(CSocket *&sock, const STimeout *timeout=kInfiniteTimeout, TSOCK_Flags flags=fSOCK_LogDefault) const
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.
static CNCBI_IPAddr gethostbyname(const string &host, ESwitch log=eOff)
Return 0 or empty address on error.
SOCK GetSOCK(void) const
Access to the underlying "SOCK".
EIO_Status DSOCK_Connect(SOCK sock, const char *host, unsigned short port)
Associate a datagram socket with a destination address.
static unsigned int GetLoopbackAddress4(void)
TRIGGER GetTRIGGER(void) const
Access to the underlying "TRIGGER".
EIO_Status Recv(void *buf, size_t buflen, size_t *msglen=0, string *sender_host=0, unsigned short *sender_port=0, size_t maxmsglen=0)
EIO_Status ReadLine(string &str)
Read a line from socket (up to CR-LF, LF, or null character, discarding any of the EOLs).
STimeout * c_timeout
eIO_Close
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".
EIO_Status SOCK_Status(SOCK sock, EIO_Event direction)
Return low-level socket I/O status of *last* socket operation.
TNCBI_IPv6Addr * SOCK_gethostbynameEx6(TNCBI_IPv6Addr *addr, const char *hostname, ESwitch log)
Find and return an Internet address of a named host.
const STimeout * GetTimeout(EIO_Event event) const
Get timeout for I/O in the specified direction.
EIO_Status POLLABLE_Poll(size_t n, SPOLLABLE_Poll polls[], const STimeout *timeout, size_t *n_ready)
Poll for I/O readiness.
static string gethostname(ESwitch log=eOff)
Return empty string on error.
STimeout oo_timeout
storage for o_timeout
static EIO_Status Poll(vector< SPoll > &polls, const STimeout *timeout, size_t *n_ready=0)
Poll a vector of CPollable objects for I/O readiness.
POLLABLE POLLABLE_FromSOCK(SOCK)
static size_t StringToHostPort(const string &str, unsigned int *host, unsigned short *port)
Return number of characters parsed (0 if cannot detect "host:port"), and string::npos on error ("host...
EIO_Status Connect(const string &host, unsigned short port)
ENH_ByteOrder
Network and host byte order enumeration type.
void GetListeningAddress(CNCBI_IPAddr *addr, unsigned short *port, ENH_ByteOrder byte_order=eNH_HostByteOrder) const
Get listening address.
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.
static CNCBI_IPAddr GetLoopbackAddress(void)
Loopback address is in network byte order (when "unsigned int")
EIO_Status SetTimeout(EIO_Event event, const STimeout *timeout)
Set timeout for I/O in the specified direction.
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).
void Reset(SOCK sock, EOwnership if_to_own, ECopyTimeout whence)
Close the current underlying "SOCK" (if any, and if owned), and from now on use "sock" as the underly...
static string HostPortToString(const CNCBI_IPAddr &addr, unsigned short port)
See SOCK_HostPortToString[6], return empty when failed.
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...
EIO_Status SOCK_Abort(SOCK sock)
If there is outstanding connection or output data pending, cancel it.
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.
static bool isip(const string &host, bool fullquad=false)
For IPv4 only.
EIP_StringKind
Broader string classificator.
STimeout cc_timeout
storage for c_timeout
STimeout * r_timeout
eIO_Read
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.
static CNCBI_IPAddr GetLocalHostAddress(ESwitch reget=eDefault)
Local host address in network byte order (cached for faster retrieval)
EIO_Status SOCK_ReadLine(SOCK sock, char *line, size_t size, size_t *n_read)
Read a line from SOCK.
int SOCK_isip6(const char *host)
Check whether a given string represents a valid bare IPv6 address.
EIO_Status GetStatus(EIO_Event direction) const
Return status of *last* I/O operation without making any actual I/O.
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".
char * LSOCK_GetListeningAddressStringEx(LSOCK lsock, char *buf, size_t bufsize, ESOCK_AddressFormat format)
EIO_Status Reconnect(const STimeout *timeout=kDefaultTimeout)
Reconnect to the same address.
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...
void GetPeerAddress(unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order) const
Get peer address.
int SOCK_gethostnameEx(char *name, size_t namelen, ESwitch log)
Get the local host name.
virtual ~CSocket(void)
Call Close(), then self-destruct.
STimeout * o_timeout
eIO_Open
EOwnership m_IsOwned
Timeouts.
const char * SOCK_StringToHostPort6(const char *str, TNCBI_IPv6Addr *addr, unsigned short *port)
POLLABLE POLLABLE_FromLSOCK(LSOCK)
static string gethostbyaddr(const CNCBI_IPAddr &addr, ESwitch log=eOff)
Return empty string on error.
LSOCK GetLSOCK(void) const
Access to the underlying "LSOCK".
POLLABLE POLLABLE_FromTRIGGER(TRIGGER)
Conversion utilities from handles to POLLABLEs, and back.
static TNCBI_IPv6Addr GetLoopbackAddress6(void)
STimeout ww_timeout
storage for w_timeout
EIO_Status LSOCK_Close(LSOCK lsock)
[SERVER-side] Close the listening socket, destroy relevant internal data.
const STimeout * SOCK_GetTimeout(SOCK sock, EIO_Event event)
Get the connection's i/o timeout (or NULL, if the timeout is infinite).
virtual ~CListeningSocket(void)
Call Close(), then self-destruct.
EIO_Status SOCK_CreateUNIX(const char *path, const STimeout *timeout, SOCK *sock, const void *data, size_t size, TSOCK_Flags flags)
static string ntoa(const CNCBI_IPAddr &addr)
BSD-like API.
STimeout rr_timeout
storage for r_timeout
STimeout * w_timeout
eIO_Write
EIO_Status Write(const void *buf, size_t size, size_t *n_written=0, EIO_WriteMethod how=eIO_WritePersist)
Write to socket.
unsigned int TSOCK_Flags
bitwise "OR" of ESOCK_Flags
EIO_Status Read(void *buf, size_t size, size_t *n_read=0, EIO_ReadMethod how=eIO_ReadPlain)
Read from socket.
@ eIP_IPv6
Accept IPv6 notations only.
@ eIP_HistoricIPv4
Accept old-fashioned IPv4 notations.
@ eIP_Any
Any IPv4 or IPv6 notations.
@ eIP_FullQuadIPv4
Accept full-quad IPv4 notations only.
enum ENcbiSwitch ESwitch
Aux.
unsigned int usec
microseconds (modulo 1,000,000)
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).
@ eIO_Success
everything is fine, no error occurred
@ eIO_Unknown
unknown I/O error (likely fatal but can retry)
@ eIO_InvalidArg
bad argument / parameter value(s) supplied
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
@ eIO_Open
also serves as no-event indicator in SOCK_Poll
@ eIO_Close
also serves as an error indicator in SOCK_Poll
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
int NcbiIsEmptyIPv6(const TNCBI_IPv6Addr *addr)
Return non-zero if the address is empty (either as NULL or IPv6 or IPv4); return zero otherwise.
TNCBI_IPv6Addr * NcbiIPv4ToIPv6(TNCBI_IPv6Addr *addr, unsigned int ipv4, size_t pfxlen)
Embed a passed network byte order IPv4 address into an IPv6 address using the specified prefix length...
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