62 timeout, buf_size, flgs,
76 timeout, buf_size, flgs,
90 #define GET_CONN(sb) ((sb) ? (sb)->GetCONN() : 0)
212 memset(&cb, 0,
sizeof(cb));
254 unsigned short max_try,
261 timeout, buf_size,
flags)
269 unsigned short aport,
270 unsigned short max_try,
275 size_t len = ahost.size();
276 string x_host, xx_port;
281 if ((port = aport) != 0 &&
len) {
285 || x_host.empty() || xx_port.empty()
286 || !
isdigit((
unsigned char) xx_port[0]) || xx_port[0] ==
'0'
289 || (x_port ^ (x_port & 0xFFFF))) {
291 "CConn_SocketStream::CConn_SocketStream(\""
293 " Invalid/insufficient destination address");
309 unsigned short max_try,
315 timeout, buf_size,
flags)
329 timeout, buf_size,
flags)
340 "CConn_SocketStream::CConn_SocketStream(): "
341 " Socket may not be empty");
345 "CConn_SocketStream::CConn_SocketStream(): "
346 " Socket must be owned");
361 timeout, buf_size,
flags)
422 x_net_info->external = 0;
423 x_net_info->firewall = 0;
424 x_net_info->stateless = 0;
425 x_net_info->lb_disable = 0;
426 x_net_info->http_version = 0;
427 x_net_info->http_push_auth = 0;
428 x_net_info->http_proxy_leak = 0;
429 x_net_info->http_proxy_skip = 0;
430 x_net_info->http_proxy_only = 0;
431 x_net_info->user[0] =
'\0';
432 x_net_info->pass[0] =
'\0';
433 x_net_info->path[0] =
'\0';
434 x_net_info->http_proxy_host[0] =
'\0';
435 x_net_info->http_proxy_port = 0;
436 x_net_info->http_proxy_user[0] =
'\0';
437 x_net_info->http_proxy_pass[0] =
'\0';
439 if (x_net_info->http_referer) {
440 free((
void*) x_net_info->http_referer);
441 x_net_info->http_referer = 0;
443 x_net_info->timeout = timeout;
459 string hostport(net_info->
host);
480 timeout, buf_size,
flags)
501 const char* eol = strstr(header,
HTTP_EOL);
505 if (sscanf(header,
"HTTP/%*[0-9.] %u%n", &c, &
n) < 1 || eol < header +
n)
509 eol =
str + (size_t)(eol - header);
511 str += strspn(
str,
" \t");
513 if (!
isspace((
unsigned char) eol[-1]))
531 const char* user_header,
538 void** user_data_ptr,
549 "CConn_HttpStream::CConn_HttpStream(): "
555 "CConn_HttpStream::CConn_HttpStream(): "
556 " Bad request method (CONNECT)");
559 x_net_info->req_method = method;
561 x_net_info->http_version = 1;
564 "CConn_HttpStream::CConn_HttpStream(): "
565 " Bad URL \"" +
string(url) +
'"');
569 if ((
len = *host ? strlen(host) : 0) >=
sizeof(x_net_info->host)) {
571 "CConn_HttpStream::CConn_HttpStream(): "
572 " Host too long \"" +
string(host) +
'"');
574 memcpy(x_net_info->host, host, ++
len);
577 x_net_info->port = port;
580 "CConn_HttpStream::CConn_HttpStream(): "
581 " Path too long \"" +
string(path) +
'"');
585 "CConn_HttpStream::CConn_HttpStream(): "
586 " Args too long \"" +
string(args) +
'"');
588 if (user_header && *user_header
592 "Cannot set user header",
597 "CConn_HttpStream::CConn_HttpStream(): "
598 " " +
string(msg_ptr.
get()));
601 x_net_info->timeout = timeout;
603 *user_data_ptr = user_data;
604 *user_cleanup_ptr = user_cleanup;
618 const string& user_header,
640 m_UserAdjust(0), m_UserParseHeader(0)
667 m_UserAdjust(0), m_UserParseHeader(0)
675 const string& user_header,
696 m_UserAdjust(0), m_UserParseHeader(0)
704 const string& user_header,
731 m_UserAdjust(adjust), m_UserParseHeader(parse_header)
738 const string& user_header,
765 m_UserAdjust(adjust), m_UserParseHeader(parse_header)
794 if (http->exceptions())
802 unsigned int failure_count)
809 if (failure_count == (
unsigned int)(-1) && !http->
m_URL.empty()) {
820 if (retval < 0 && modified)
823 retval = modified ? 1 : -1;
827 if (http->exceptions())
847 const char* user_header,
863 "CConn_ServiceStream::CConn_ServiceStream(): "
866 if (user_header && *user_header
870 "Cannot set user header",
875 "CConn_ServiceStream::CConn_ServiceStream(): "
876 " " +
string(msg_ptr.
get()));
879 x_net_info->timeout = timeout;
882 memcpy(x_extra, extra,
sizeof(*x_extra));
884 memset(x_extra, 0,
sizeof(*x_extra));
891 memset(&xx_extra, 0,
sizeof(xx_extra));
892 xx_extra.
data = x_data;
893 xx_extra.
reset = x_reset;
894 xx_extra.
adjust = x_adjust;
920 extra && extra->reset
922 extra && extra->adjust
927 extra && extra->get_next_info
928 ? sx_GetNextInfo : 0,
938 const string& user_header,
950 extra && extra->reset
952 extra && extra->adjust
957 extra && extra->get_next_info
958 ? sx_GetNextInfo : 0,
990 if (svc->exceptions())
998 unsigned int failure_count)
1005 if (svc->exceptions())
1019 if (svc->exceptions())
1032 if (svc->exceptions())
1097 "CConn_MemoryStream::ToString(NULL) is not allowed");
1100 size_t size = sb && good() ? (size_t)(tellp() - tellg()) : 0;
1104 size_t s = (size_t) sb->sgetn(&(*
str)[0],
size);
1105 #ifdef NCBI_COMPILER_WORKSHOP
1120 "CConn_MemoryStream::ToVector(NULL) is not allowed");
1123 size_t size = sb && good() ? (size_t)(tellp() - tellg()) : 0;
1127 size_t s = (size_t) sb->sgetn(&(*vec)[0],
size);
1128 #ifdef NCBI_COMPILER_WORKSHOP
1149 const vector<string>& args,
1154 unique_ptr<CPipe> p(
new CPipe(pipe_size));
1156 pipe = c ? p.release() : 0;
1162 const vector<string>& args,
1210 unsigned short port,
1224 memcpy( x_cmcb, cmcb,
sizeof(*x_cmcb));
1225 memset(&xx_cmcb, 0,
sizeof(xx_cmcb));
1226 xx_cmcb.
data = x_data;
1227 xx_cmcb.
func = x_func;
1230 memset( x_cmcb, 0,
sizeof(*x_cmcb));
1239 if (timeout != net_info->
timeout) {
1243 "CConn_FtpStream::CConn_FtpStream(): "
1246 xx_net_info->
timeout = timeout;
1247 x_net_info = xx_net_info;
1249 x_net_info = net_info;
1251 if (x_net_info != net_info)
1277 unsigned short port,
1295 fConn_Untie | fConn_WriteUnbuffered)
1319 fConn_Untie | fConn_WriteUnbuffered)
1341 if (ftp->exceptions())
1351 static char sink[16384];
1368 while (read(sink,
sizeof(sink)))
1379 return status == eIO_Closed ?
eIO_Success : status;
1388 unsigned short port,
1411 if (net_info.
path[0])
1428 write(directory ?
"NLST " :
"RETR ", 5) <<
file <<
'\n';
1441 unsigned short port,
1460 if (net_info.
path[0])
1502 const char* s =
str.c_str();
1503 if (!
isalpha((
unsigned char)(*s)))
1505 for (++s; *s; ++s) {
1506 if (!
isalnum((
unsigned char)(*s)) && *s !=
'_')
1515 size_t len = url.size();
1536 unsigned short port;
1538 if (0 < pos && pos <
len - 1
1539 && url[pos - 1] !=
'/' && (pos == 1 || url[pos - 2] !=
'/')
1550 net_info->timeout, buf_size);
1552 switch (net_info->scheme) {
1559 if (*net_info->host || net_info->port)
1561 if (net_info->debug_printout) {
1564 net_info->external = 0;
1565 net_info->firewall = 0;
1566 net_info->stateless = 0;
1567 net_info->lb_disable = 0;
1568 net_info->http_version = 0;
1569 net_info->http_push_auth = 0;
1570 net_info->http_proxy_leak = 0;
1571 net_info->http_proxy_skip = 0;
1572 net_info->http_proxy_only = 0;
1573 net_info->user[0] =
'\0';
1574 net_info->pass[0] =
'\0';
1575 net_info->http_proxy_host[0] =
'\0';
1576 net_info->http_proxy_port = 0;
1577 net_info->http_proxy_user[0] =
'\0';
1578 net_info->http_proxy_pass[0] =
'\0';
1579 net_info->max_try = 0;
1582 if (net_info->http_referer) {
1583 free((
void*) net_info->http_referer);
1584 net_info->http_referer = 0;
1592 if (!net_info->user[0]) {
1593 strcpy(net_info->user,
"ftp");
1594 if (!net_info->pass[0])
1595 strcpy(net_info->pass,
"-none@");
1598 net_info->timeout, buf_size);
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
CConn_FtpStream specialization (ctor) for download.
CConn_FileStream(const string &ifname, const string &ofname=kEmptyStr, SFILE_ConnAttr *attr=0)
CConn_FtpStream is an elaborate FTP client, can be used for data downloading and/or uploading to and ...
Helper base class for HTTP-like streams.
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
Helper class to build streams on top of CONNECTOR (internal use only).
Base class, inherited from "std::iostream", does both input and output, using the specified CONNECTOR...
This stream exchanges data with a named service, in a constraint that the service is implemented as o...
This stream exchanges data in a TCP channel, using the SOCK socket API.
EIO_Status Status(EIO_Event direction) const
EIO_Status Fetch(const STimeout *timeout)
EIO_Status Pushback(const CT_CHAR_TYPE *data, streamsize size, bool push)
Push the specified data "data" of size "size" back into the underlying connection CONN.
Interface for testing cancellation request in a long lasting operation.
static void cleanup(void)
static CS_CONNECTION * conn
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
element_type * get(void) const
Get pointer.
unique_ptr< T, TDeleter > make_c_unique(T *p, TDeleter d)
Eliminates the necessity for specifying types of both allocated resource and deallocating C function.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
CConn_MemoryStream(size_t buf_size=kConn_DefaultBufSize)
EIO_Status Fetch(const STimeout *timeout=kDefaultTimeout)
Flush the stream and fetch the response (w/o extracting any user data)
void ToVector(vector< char > *)
fill in the data, NULL is not accepted
static int sx_Adjust(SConnNetInfo *net_info, void *data, unsigned int count)
static void sx_Cleanup(void *data)
virtual ~CConn_MemoryStream()
CConn_IOStream(CONN conn, bool close=false, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0, CT_CHAR_TYPE *ptr=0, size_t size=0)
Create a stream based on CONN, which is to be closed upon stream dtor but only if "close" parameter i...
static void sx_Cleanup(void *data)
static const SSERV_Info * sx_GetNextInfo(void *data, SERV_ITER iter)
void x_InitDownload(const string &file, Uint8 offset)
EIO_Status Wait(EIO_Event event, const STimeout *timeout=&kZeroTimeout)
Equivalent to CONN_Wait(GetCONN(), event, timeout)
virtual EIO_Status Close(void)
Close CONNection, free all internal buffers and underlying structures, and render the stream unusable...
const STimeout * GetTimeout(EIO_Event direction) const
virtual EIO_Status Drain(const STimeout *timeout=kDefaultTimeout)
Abort any command in progress, read and discard all input data, and clear stream error state when suc...
CConn_ServiceStream(const string &service, TSERV_Type types=fSERV_Any, const SConnNetInfo *net_info=0, const SSERVICE_Extra *extra=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
SHTTP_StatusData m_StatusData
void ToString(string *)
The CConnMemoryStream::To* methods allow to obtain unread portion of the stream into a single contain...
CConn_NamedPipeStream(const string &pipename, size_t pipesize=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
static const STimeout kZeroTimeout
Polling timeout with the 0.0 time in it.
virtual ~CConn_HttpStream()
static EIO_Status sx_FtpCallback(void *data, const char *cmd, const char *arg)
CConn_SocketStream(const string &host, unsigned short port, unsigned short max_try, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
Create a direct connection with host:port.
EIO_Status SetCanceledCallback(const ICanceled *canceled)
Cancellation support.
FHTTP_Adjust m_UserAdjust
virtual ~CConn_PipeStream()
static void sx_Reset(void *data)
virtual ~CConn_IOStream()
CConn_PipeStream(const string &cmd, const vector< string > &args, CPipe::TCreateFlags flags=0, size_t pipe_size=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
EIO_Status SetTimeout(EIO_Event direction, const STimeout *timeout) const
Set connection timeout for "direction".
string GetType(void) const
CConn_FTPDownloadStream(const string &host, const string &file=kEmptyStr, const string &user="ftp", const string &pass="-none@", const string &path=kEmptyStr, unsigned short port=0, TFTP_Flags flag=0, const SFTP_Callback *cmcb=0, Uint8 offset=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
EIO_Status Status(EIO_Event direction=eIO_Close) const
void x_InitUpload(const string &file, Uint8 offset)
CConn_FTPUploadStream(const string &host, const string &user, const string &pass, const string &file=kEmptyStr, const string &path=kEmptyStr, unsigned short port=0, TFTP_Flags flag=0, Uint8 offset=0, const STimeout *timeout=kDefaultTimeout)
CConn_FtpStream(const string &host, const string &user, const string &pass, const string &path=kEmptyStr, unsigned short port=0, TFTP_Flags flag=0, const SFTP_Callback *cmcb=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
CConn_HttpStream(const string &host, const string &path, const string &args=kEmptyStr, const string &user_header=kEmptyStr, unsigned short port=0, THTTP_Flags flags=fHTTP_AutoReconnect, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize)
SOCK GetSOCK(void)
Get underlying SOCK, if available (e.g. after Fetch())
EIO_Status x_Pushback(const CT_CHAR_TYPE *data, streamsize size, bool push=false)
CConn_IOStream * NcbiOpenURL(const string &url, size_t buf_size)
Given a URL, open the data source and make it available for _reading_.
static EHTTP_HeaderParse sx_ParseHeader(const char *header, void *data, int code)
const void * m_Ptr
pointer to read memory area (if owned)
FHTTP_Cleanup m_UserCleanup
virtual ~CConn_ServiceStream()
EHTTP_HeaderParse Parse(const char *header)
FHTTP_ParseHeader m_UserParseHeader
virtual ~CConn_FtpStream()
string GetDescription(void) const
CPipe * m_Pipe
Underlying pipe.
unique_ptr< CConn_Streambuf > x_CSb
static int sx_Adjust(SConnNetInfo *net_info, void *data, unsigned int count)
static EHTTP_HeaderParse sx_ParseHeader(const char *header, void *data, int code)
unsigned int TConn_Flags
bitwise OR of EConn_Flag
int m_ExitCode
Process exit code.
CConstIRef< ICanceled > m_Canceled
virtual EIO_Status Close(void)
Close CONNection, free all internal buffers and underlying structures, and render the stream unusable...
BUF GetBUF(void)
Get the underlying BUF handle (it still remains managed by the stream)
static EIO_Status sx_IsCanceled(CONN conn, TCONN_Callback type, void *data)
@ fConn_Untie
do not flush before reading
CONNECTOR MEMORY_CreateConnector(void)
CONNECTOR SOCK_CreateConnectorEx(const char *host, unsigned short port, unsigned short max_try, const void *data, size_t size, TSOCK_Flags flags)
CONNECTOR NAMEDPIPE_CreateConnector(const string &pipename, size_t pipesize=0)
Create CNamedPipe-based CONNECTOR.
CONNECTOR SERVICE_CreateConnectorEx(const char *service, TSERV_Type types, const SConnNetInfo *net_info, const SSERVICE_Extra *extra)
EIO_Status HTTP_CreateTunnel(const SConnNetInfo *net_info, THTTP_Flags flags, SOCK *sock)
Same as HTTP_CreateTunnelEx(net_info, flags, 0, 0, 0, 0, sock)
CONNECTOR PIPE_CreateConnector(const string &cmd, const vector< string > &args, CPipe::TCreateFlags flags=0, CPipe *pipe=0, EOwnership own_pipe=eTakeOwnership, size_t pipe_size=0)
Create CPipe-based CONNECTOR.
CONNECTOR FTP_CreateConnectorSimple(const char *host, unsigned short port, const char *user, const char *pass, const char *path, TFTP_Flags flag, const SFTP_Callback *cmcb)
CONNECTOR FILE_CreateConnectorEx(const char *ifname, const char *ofname, const SFILE_ConnAttr *attr)
CONNECTOR MEMORY_CreateConnectorEx(BUF buf, unsigned int own_buf)
CONNECTOR HTTP_CreateConnectorEx(const SConnNetInfo *net_info, THTTP_Flags flags, FHTTP_ParseHeader parse_header, void *user_data, FHTTP_Adjust adjust, FHTTP_Cleanup cleanup)
Create new CONNECTOR structure to hit the specified URL using HTTP with either POST / GET (or ANY) me...
CONNECTOR SOCK_CreateConnectorOnTop(SOCK sock, unsigned short own_sock)
void(* FSERVICE_Reset)(void *data)
EIO_Status CONN_Read(CONN conn, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how)
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
EIO_Status CONN_SetCallback(CONN conn, ECONN_Callback type, const SCONN_Callback *new_cb, SCONN_Callback *old_cb)
int(* FHTTP_Adjust)(SConnNetInfo *net_info, void *user_data, unsigned int failure_count)
unsigned int TCONN_Callback
EIO_Status CONN_Write(CONN conn, const void *buf, size_t size, size_t *n_written, EIO_WriteMethod how)
void(* FHTTP_Cleanup)(void *user_data)
FHTTP_ParseHeader parse_header
const SSERV_Info *(* FSERVICE_GetNextInfo)(void *data, SERV_ITER iter)
EIO_Status(* FFTP_Callback)(void *data, const char *cmd, const char *arg)
void * data
data to pass to the callback as its last arg
EIO_Status CONN_SetTimeout(CONN conn, EIO_Event event, const STimeout *timeout)
Specify timeout for the connection I/O, including "Connect" (aka "Open") and "Close".
CONNECTOR FTP_CreateConnector(const SConnNetInfo *info, TFTP_Flags flag, const SFTP_Callback *cmcb)
char * CONN_Description(CONN conn)
Return a human-readable description of the connection as a character '\0'-terminated string.
FSERVICE_GetNextInfo get_next_info
CONNECTOR SOCK_CreateConnector(const char *host, unsigned short port, unsigned short max_try)
EIO_Status CONN_Wait(CONN conn, EIO_Event event, const STimeout *timeout)
Block on the connection until it becomes available for either reading or writing (depending on "event...
EHTTP_HeaderParse
The extended version HTTP_CreateConnectorEx() is able to track the HTTP response chain and also chang...
void * handle
data handle of the connector
const char * CONN_GetType(CONN conn)
Get verbal representation of connection type as a character string.
EHTTP_HeaderParse(* FHTTP_ParseHeader)(const char *http_header, void *user_data, int server_error)
EIO_Status CONN_GetSOCK(CONN conn, SOCK *sock)
Get an underlying SOCK handle for connection that is implemented as a socket.
const STimeout * CONN_GetTimeout(CONN conn, EIO_Event event)
Retrieve current timeout, return NULL(kInfiniteTimeout) if it is infinite.
void(* FSERVICE_Cleanup)(void *data)
CONNECTOR SOCK_CreateConnectorOnTopEx(SOCK sock, unsigned short own_sock, const char *hostport)
FCONN_Callback func
function address to call on the event
@ eCONN_OnFlush
About to be flushed (NB: == eIO_ReadWrite)
@ eCONN_OnWrite
Write to CONNECTOR is about to occur.
@ eCONN_OnRead
Read from CONNECTOR is about to occur.
@ eCONN_OnOpen
Call prior to open (NB: "conn" still closed)
@ fHTTP_NoAutoRetry
No auto-retries allowed.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
@ eHTTP_HeaderSuccess
Parse succeeded, retain server status.
@ eHTTP_HeaderError
Parse failed, treat as a server error.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define THROW1_TRACE(exception_class, exception_arg)
Throw trace.
#define NCBI_CATCH_ALL(message)
This macro is deprecated - use *_X or *_XX variant instead of it.
void Reset(void)
Reset reference object.
bool NotNull(void) const THROWS_NONE
Check if pointer is not null – same effect as NotEmpty().
unsigned int TCreateFlags
bitwise OR of "ECreateFlag"
EIO_Status Close(int *exitcode=0)
Close pipe.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int TSERV_Type
Bitwise OR of ESERV_Type[Special].
@ fSERV_DelayOpen
Don't open service until use.
EOwnership SetOwnership(EOwnership if_to_own)
Specify if this "CSocket" is to own the underlying "SOCK".
static SIZE_TYPE StringToHostPort(const string &str, unsigned int *host, unsigned short *port)
Return position past the end of the parsed portion, NPOS on error.
EIO_Status SOCK_Close(SOCK sock)
Close the SOCK handle, and destroy all relevant internal data.
SOCK GetSOCK(void) const
Access to the underlying "SOCK".
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...
EIO_Status SOCK_Abort(SOCK sock)
If there is outstanding connection or output data pending, cancel it.
unsigned int TSOCK_Flags
bitwise "OR" of ESOCK_Flags
IO_PREFIX::iostream CNcbiIostream
Portable alias for iostream.
NCBI_NS_STD::string::size_type SIZE_TYPE
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
CTempString & assign(const char *src_str, size_type len)
Assign new values to the content of the a string.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ eNocase
Case insensitive compare.
char http_proxy_host[255+1]
unsigned short http_proxy_port
int ConnNetInfo_OverrideUserHeader(SConnNetInfo *net_info, const char *header)
int ConnNetInfo_ParseURL(SConnNetInfo *net_info, const char *url)
int ConnNetInfo_SetArgs(SConnNetInfo *net_info, const char *args)
SConnNetInfo * ConnNetInfo_Clone(const SConnNetInfo *net_info)
LOG CORE_GetLOG(void)
Get the log handle that is to be used by the core internals (CORE LOG).
int ConnNetInfo_SetUserHeader(SConnNetInfo *net_info, const char *header)
enum ENcbiOwnership EOwnership
Ownership relations between objects.
void ConnNetInfo_Log(const SConnNetInfo *net_info, ELOG_Level sev, LOG log)
SConnNetInfo * ConnNetInfo_Create(const char *service)
const char * NcbiMessagePlusError(int *dynamic, const char *message, int error, const char *descr)
Add current "error" (and maybe its description) to the message: <message>[ {error=[[<error>][,...
EIO_Event
I/O event (or direction).
EBDebugPrintout debug_printout
int ConnNetInfo_SetPath(SConnNetInfo *net_info, const char *path)
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
@ eIO_Interrupt
signal arrival prevented any I/O to succeed
@ eIO_NotSupported
operation is not supported or is not available
@ eIO_Success
everything is fine, no error occurred
@ eIO_Unknown
unknown I/O error (likely fatal but can retry)
@ eIO_ReadPlain
read readily available data only, wait if none
@ eIO_ReadPersist
read exactly as much as requested, w/waits
@ eIO_WritePersist
write exactly as much as specified, w/waits
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
@ eIO_Close
also serves as an error indicator in SOCK_Poll
unsigned int
A callback function used to compare two keys in a database.
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
int NCBI_HasSpaces(const char *s, size_t n)
Return non-zero(true) if a block of memory based at "s" and of size "n" has any space characters (as ...
static CConn_IOStream::TConnector s_ServiceConnectorBuilder(const char *service, TSERV_Type types, const SConnNetInfo *net_info, const char *user_header, const SSERVICE_Extra *extra, void *x_data, SSERVICE_Extra *x_extra, FSERVICE_Reset x_reset, FHTTP_Adjust x_adjust, FSERVICE_Cleanup x_cleanup, FHTTP_ParseHeader x_parse_header, FSERVICE_GetNextInfo x_get_next_info, const STimeout *timeout)
AutoPtr< char, CDeleter< char > > TTempCharPtr
static CConn_IOStream::TConnector s_PipeConnectorBuilder(const string &cmd, const vector< string > &args, CPipe::TCreateFlags flgs, size_t pipe_size, CPipe *&pipe)
static CConn_IOStream::TConnector s_FtpConnectorBuilder(const char *host, unsigned short port, const char *user, const char *pass, const char *path, const SConnNetInfo *net_info, TFTP_Flags flgs, const SFTP_Callback *cmcb, void *x_data, SFTP_Callback *x_cmcb, FFTP_Callback x_func, const STimeout *timeout)
static CConn_IOStream::TConnector s_HttpConnectorBuilder(const SConnNetInfo *net_info, EReqMethod method, const char *url, const char *host, unsigned short port, const char *path, const char *args, const char *user_header, void *x_data, FHTTP_Adjust x_adjust, FHTTP_Cleanup x_cleanup, FHTTP_ParseHeader x_parse_header, THTTP_Flags flgs, const STimeout *timeout, void **user_data_ptr, FHTTP_Cleanup *user_cleanup_ptr, void *user_data=0, FHTTP_Cleanup user_cleanup=0)
static SOCK s_GrabSOCK(CSocket &socket)
static CConn_IOStream::TConnector s_SocketConnectorBuilder(const string &ahost, unsigned short aport, unsigned short max_try, const void *data, size_t size, TSOCK_Flags flgs)
static bool x_IsIdentifier(const string &str)
SConnNetInfo * ConnNetInfo_CreateInternal(const char *service)
char * SERV_ServiceName(const char *service)
EIO_Status SOCK_CreateOnTopInternal(const void *handle, size_t handle_size, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
EIO_Status SOCK_CreateInternal(const char *host, unsigned short port, const STimeout *timeout, SOCK *sock, const SSOCK_Init *init, TSOCK_Flags flags)
static const char * str(char *buf, int n)
static void Delete(SConnNetInfo *net_info)
Functor template for deleting object.
static const struct type types[]