NCBI C++ ToolKit
|
Classes | |
struct | SCONN_Callback |
struct | SMetaConnector |
Standard set of connector methods to handle a connection (corresponding connectors are also in here), part of the connection handle ("CONN"). More... | |
struct | SConnectorTag |
Connector specification. More... | |
struct | SFILE_ConnAttr |
struct | SFTP_Callback |
struct | SSERVICE_Extra |
Macros | |
#define | CONN_N_CALLBACKS 6 |
#define | CONN_SET_METHOD(meta, method, function, connector) |
#define | CONN_SET_DEFAULT_TIMEOUT(meta, timeout) |
#define | SERVICE_CreateConnector(service) SERVICE_CreateConnectorEx(service, fSERV_Any, 0, 0) |
Typedefs | |
typedef struct SConnectionTag * | CONN |
connection handle More... | |
typedef unsigned int | TCONN_Flags |
bitwise OR of ECONN_Flag More... | |
typedef unsigned int | TCONN_Callback |
typedef EIO_Status(* | FCONN_Callback) (CONN conn, TCONN_Callback type, void *data) |
typedef struct SConnectorTag * | CONNECTOR |
connector handle More... | |
typedef const char *(* | FConnectorGetType) (CONNECTOR connector) |
Get the name of the connector (may NOT be NULL) More... | |
typedef char *(* | FConnectorDescr) (CONNECTOR connector) |
Get the human readable connector's description (may be NULL on error) More... | |
typedef EIO_Status(* | FConnectorOpen) (CONNECTOR connector, const STimeout *timeout) |
Open connection. More... | |
typedef EIO_Status(* | FConnectorWait) (CONNECTOR connector, EIO_Event event, const STimeout *timeout) |
Wait until either read or write (depending on the "event" value) becomes available, or until "timeout" expires, or until error occurs. More... | |
typedef EIO_Status(* | FConnectorWrite) (CONNECTOR connector, const void *buf, size_t size, size_t *n_written, const STimeout *timeout) |
Write to connector. More... | |
typedef EIO_Status(* | FConnectorFlush) (CONNECTOR connector, const STimeout *timeout) |
Flush yet unwritten output data, if any. More... | |
typedef EIO_Status(* | FConnectorRead) (CONNECTOR connector, void *buf, size_t size, size_t *n_read, const STimeout *timeout) |
Read from connector. More... | |
typedef EIO_Status(* | FConnectorStatus) (CONNECTOR connector, EIO_Event direction) |
Obtain last I/O completion code from the transport level (connector). More... | |
typedef EIO_Status(* | FConnectorClose) (CONNECTOR connector, const STimeout *timeout) |
Close data link (if any) and cleanup related data structures. More... | |
typedef void(* | FSetupVTable) (CONNECTOR connector) |
Upcall on request to setup virtual function table (called from connection). More... | |
typedef void(* | FDestroy) (CONNECTOR connector) |
Destroy connector and its data handle. More... | |
typedef struct SConnectorTag | SConnector |
Connector specification. More... | |
typedef unsigned int | TFTP_Flags |
typedef EIO_Status(* | FFTP_Callback) (void *data, const char *cmd, const char *arg) |
typedef unsigned int | THTTP_Flags |
Bitwise OR of EHTTP_Flag. More... | |
typedef unsigned int | THCC_Flags |
bitwise OR of EHCC_Flag, deprecated More... | |
typedef EHTTP_HeaderParse(* | FHTTP_ParseHeader) (const char *http_header, void *user_data, int server_error) |
typedef int(* | FHTTP_Adjust) (SConnNetInfo *net_info, void *user_data, unsigned int failure_count) |
typedef void(* | FHTTP_Cleanup) (void *user_data) |
typedef void(* | FHTTP_NcbiMessageHook) (const char *message) |
typedef void(* | FSERVICE_Reset) (void *data) |
typedef void(* | FSERVICE_Cleanup) (void *data) |
typedef const SSERV_Info *(* | FSERVICE_GetNextInfo) (void *data, SERV_ITER iter) |
Functions | |
EIO_Status | CONN_CreateEx (CONNECTOR connector, TCONN_Flags flags, CONN *conn) |
Create all data necessary to establish a new connection (merely bind it to the specified CONNECTOR). More... | |
EIO_Status | CONN_Create (CONNECTOR connector, CONN *conn) |
Same as CONN_CreateEx() called with 0 in the "flags" parameter. More... | |
EIO_Status | CONN_ReInit (CONN conn, CONNECTOR connector) |
Reinit using new "connector". More... | |
const char * | CONN_GetType (CONN conn) |
Get verbal representation of connection type as a character string. More... | |
char * | CONN_Description (CONN conn) |
Return a human-readable description of the connection as a character '\0'-terminated string. More... | |
TNCBI_BigCount | CONN_GetPosition (CONN conn, EIO_Event event) |
Get read ("event" == eIO_Read) or write ("event" == eIO_Write) position within the connection. More... | |
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". More... | |
const STimeout * | CONN_GetTimeout (CONN conn, EIO_Event event) |
Retrieve current timeout, return NULL(kInfiniteTimeout) if it is infinite. More... | |
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"), until timeout expires, or until any error. More... | |
EIO_Status | CONN_Write (CONN conn, const void *buf, size_t size, size_t *n_written, EIO_WriteMethod how) |
EIO_Status | CONN_Pushback (CONN conn, const void *data, size_t size) |
Push "size" bytes from the buffer "data" back into connection. More... | |
EIO_Status | CONN_Flush (CONN conn) |
Explicitly flush connection from any pending data written by CONN_Write(). More... | |
EIO_Status | CONN_Read (CONN conn, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how) |
EIO_Status | CONN_ReadLine (CONN conn, char *line, size_t size, size_t *n_read) |
Read up to "size" bytes from connection into a string buffer pointed to by "line". More... | |
EIO_Status | CONN_Status (CONN conn, EIO_Event dir) |
Obtain status of the last I/O operation. More... | |
EIO_Status | CONN_Close (CONN conn) |
Close the connection and destroy all relevant internal data. More... | |
EIO_Status | CONN_SetCallback (CONN conn, ECONN_Callback type, const SCONN_Callback *new_cb, SCONN_Callback *old_cb) |
EIO_Status | CONN_GetSOCK (CONN conn, SOCK *sock) |
Get an underlying SOCK handle for connection that is implemented as a socket. More... | |
EIO_Status | CONN_SetFlags (CONN conn, TCONN_Flags flags) |
Set connection processing flags. More... | |
TCONN_Flags | CONN_GetFlags (CONN conn) |
Get connection processing flags currently in effect. More... | |
EIO_Status | CONN_SetUserData (CONN conn, void *data) |
Associate an arbitraty user data pointer with the connection. More... | |
void * | CONN_GetUserData (CONN conn) |
Get current value of the user's data pointer last associated with the connection, or NULL (if CONN is NULL or no pointer is currently set). More... | |
EIO_Status | METACONN_Insert (SMetaConnector *meta, CONNECTOR connector) |
Insert a connector in the beginning of the connection's list of connectors. More... | |
EIO_Status | METACONN_Remove (SMetaConnector *meta, CONNECTOR connector) |
Delete given "connector" all its descendants (all connectors if "connector" is NULL) from the connections's list of connectors. More... | |
CONNECTOR | FILE_CreateConnector (const char *ifname, const char *ofname) |
CONNECTOR | FILE_CreateConnectorEx (const char *ifname, const char *ofname, const SFILE_ConnAttr *attr) |
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 | FTP_CreateConnector (const SConnNetInfo *info, TFTP_Flags flag, const SFTP_Callback *cmcb) |
CONNECTOR | HTTP_CreateConnector (const SConnNetInfo *net_info, const char *user_header, THTTP_Flags flags) |
Same as HTTP_CreateConnector(net_info, flags, 0, 0, 0, 0) with the passed "user_header" overriding the value provided in "net_info->http_user_header". More... | |
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) method. More... | |
EIO_Status | HTTP_CreateTunnelEx (const SConnNetInfo *net_info, THTTP_Flags flags, const void *init_data, size_t init_size, void *user_data, FHTTP_Adjust adjust, SOCK *sock) |
Create a tunnel to "net_info->host:net_info->port" via an HTTP proxy server located at "net_info->http_proxy_host:net_info->http_proxy_port". More... | |
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) More... | |
void | HTTP_SetNcbiMessageHook (FHTTP_NcbiMessageHook) |
Set a message hook procedure for messages originating from NCBI via HTTP. More... | |
CONNECTOR | MEMORY_CreateConnector (void) |
CONNECTOR | MEMORY_CreateConnectorEx (BUF buf, unsigned int own_buf) |
CONNECTOR | NAMEDPIPE_CreateConnector (const string &pipename, size_t pipesize=0) |
Create CNamedPipe-based CONNECTOR. More... | |
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. More... | |
CONNECTOR | SERVICE_CreateConnectorEx (const char *service, TSERV_Type types, const SConnNetInfo *net_info, const SSERVICE_Extra *extra) |
CONNECTOR | SOCK_CreateConnectorEx (const char *host, unsigned short port, unsigned short max_try, const void *data, size_t size, TSOCK_Flags flags) |
CONNECTOR | SOCK_CreateConnector (const char *host, unsigned short port, unsigned short max_try) |
CONNECTOR | SOCK_CreateConnectorOnTopEx (SOCK sock, unsigned short own_sock, const char *hostport) |
CONNECTOR | SOCK_CreateConnectorOnTop (SOCK sock, unsigned short own_sock) |
#define CONN_N_CALLBACKS 6 |
Definition at line 478 of file ncbi_connection.h.
#define CONN_SET_DEFAULT_TIMEOUT | ( | meta, | |
timeout | |||
) |
Definition at line 215 of file ncbi_connector.h.
#define CONN_SET_METHOD | ( | meta, | |
method, | |||
function, | |||
connector | |||
) |
Definition at line 208 of file ncbi_connector.h.
#define SERVICE_CreateConnector | ( | service | ) | SERVICE_CreateConnectorEx(service, fSERV_Any, 0, 0) |
Definition at line 77 of file ncbi_service_connector.h.
typedef struct SConnectionTag* CONN |
connection handle
Definition at line 64 of file ncbi_connection.h.
typedef struct SConnectorTag* CONNECTOR |
connector handle
Definition at line 54 of file ncbi_connector.h.
typedef EIO_Status(* FCONN_Callback) (CONN conn, TCONN_Callback type, void *data) |
Definition at line 482 of file ncbi_connection.h.
typedef EIO_Status(* FConnectorClose) (CONNECTOR connector, const STimeout *timeout) |
Close data link (if any) and cleanup related data structures.
Definition at line 181 of file ncbi_connector.h.
typedef char*(* FConnectorDescr) (CONNECTOR connector) |
Get the human readable connector's description (may be NULL on error)
Definition at line 82 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorFlush) (CONNECTOR connector, const STimeout *timeout) |
Flush yet unwritten output data, if any.
Definition at line 133 of file ncbi_connector.h.
Get the name of the connector (may NOT be NULL)
Definition at line 75 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorOpen) (CONNECTOR connector, const STimeout *timeout) |
Open connection.
Used to setup all related data structures, but not necessarily has to actually open the data channel.
Definition at line 92 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorRead) (CONNECTOR connector, void *buf, size_t size, size_t *n_read, const STimeout *timeout) |
Read from connector.
The passed "n_read" is always non-NULL, and "*n_read" is always zero. Upon return, the number of bytes actually read must get reflected in "*n_read", and it may never be greater than "size".
Definition at line 152 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorStatus) (CONNECTOR connector, EIO_Event direction) |
Obtain last I/O completion code from the transport level (connector).
Definition at line 168 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorWait) (CONNECTOR connector, EIO_Event event, const STimeout *timeout) |
Wait until either read or write (depending on the "event" value) becomes available, or until "timeout" expires, or until error occurs.
Definition at line 104 of file ncbi_connector.h.
typedef EIO_Status(* FConnectorWrite) (CONNECTOR connector, const void *buf, size_t size, size_t *n_written, const STimeout *timeout) |
Write to connector.
The passed "n_written" is always non-NULL, and "*n_written" is always zero. Upon return, the number of bytes actually written must get reflected in "*n_written", and it may never be greater than "size".
Definition at line 120 of file ncbi_connector.h.
typedef void(* FDestroy) (CONNECTOR connector) |
Destroy connector and its data handle.
This is NOT a close request! Should not to be used on open connectors (that is, for those FConnectorClose must be called prior to this call).
Definition at line 258 of file ncbi_connector.h.
typedef EIO_Status(* FFTP_Callback) (void *data, const char *cmd, const char *arg) |
Definition at line 301 of file ncbi_ftp_connector.h.
typedef int(* FHTTP_Adjust) (SConnNetInfo *net_info, void *user_data, unsigned int failure_count) |
net_info | net_info to adjust (in place) |
user_data | supplemental user data |
failure_count | low word: # of failures since open |
Definition at line 248 of file ncbi_http_connector.h.
typedef void(* FHTTP_Cleanup) (void *user_data) |
user_data | supplemental user data |
Definition at line 254 of file ncbi_http_connector.h.
typedef void(* FHTTP_NcbiMessageHook) (const char *message) |
Definition at line 385 of file ncbi_http_connector.h.
typedef EHTTP_HeaderParse(* FHTTP_ParseHeader) (const char *http_header, void *user_data, int server_error) |
http_header | HTTP header to parse |
user_data | supplemental user data |
server_error | != 0 if HTTP error (NOT 2xx code) |
Definition at line 236 of file ncbi_http_connector.h.
typedef void(* FSERVICE_Cleanup) (void *data) |
Definition at line 55 of file ncbi_service_connector.h.
typedef const SSERV_Info*(* FSERVICE_GetNextInfo) (void *data, SERV_ITER iter) |
Definition at line 56 of file ncbi_service_connector.h.
typedef void(* FSERVICE_Reset) (void *data) |
Definition at line 54 of file ncbi_service_connector.h.
typedef void(* FSetupVTable) (CONNECTOR connector) |
Upcall on request to setup virtual function table (called from connection).
NB: May not detect any failures (follow up in Open to fail if necessary).
Definition at line 249 of file ncbi_connector.h.
typedef struct SConnectorTag SConnector |
Connector specification.
typedef unsigned int TCONN_Callback |
Definition at line 480 of file ncbi_connection.h.
typedef unsigned int TCONN_Flags |
bitwise OR of ECONN_Flag
Definition at line 73 of file ncbi_connection.h.
typedef unsigned int TFTP_Flags |
Definition at line 70 of file ncbi_ftp_connector.h.
typedef unsigned int THCC_Flags |
bitwise OR of EHCC_Flag, deprecated
Definition at line 162 of file ncbi_http_connector.h.
typedef unsigned int THTTP_Flags |
Bitwise OR of EHTTP_Flag.
Definition at line 145 of file ncbi_http_connector.h.
enum ECONN_Callback |
Set user callback function to be invoked upon an event specified by the callback type.
Note that the callback function gets always called prior to the event to happen, e.g. the eCONN_OnClose callback is called when the connection is about to close, but has not yet been closed.
Enumerator | |
---|---|
eCONN_OnClose | NB: CONN has been flushed prior to the call. |
eCONN_OnRead | Read from CONNECTOR is about to occur. |
eCONN_OnWrite | Write to CONNECTOR is about to occur. |
eCONN_OnFlush | About to be flushed (NB: == eIO_ReadWrite) |
eCONN_OnTimeout | CONNECTOR I/O has timed out. |
eCONN_OnOpen | Call prior to open (NB: "conn" still closed) |
Definition at line 470 of file ncbi_connection.h.
enum ECONN_Flag |
CONN flags should be kept compatible with CConn_IOStream::TConn_Flags.
Enumerator | |
---|---|
fCONN_Untie | do not call flush method prior to reading |
fCONN_Supplement | supplement I/O with extended return codes |
Definition at line 69 of file ncbi_connection.h.
enum EFILE_ConnMode |
Enumerator | |
---|---|
eFCM_Truncate | |
eFCM_Append | |
eFCM_Seek |
Definition at line 67 of file ncbi_file_connector.h.
enum EFTP_Flag |
Definition at line 53 of file ncbi_ftp_connector.h.
enum EHCC_Flag |
DEPRECATED, do not use!
Enumerator | |
---|---|
fHCC_UrlEncodeArgs | NB: Error-prone semantics, do not use! |
fHCC_UrlDecodeInput | Obsolete, may not work, do not use! Assume the response body as single-part, URL-encoded; perform the URL-decoding on read, and deliver decoded data to the user. Obsolete! |
fHCC_UrlEncodeOutput | Obsolete, may not work, do not use! |
fHCC_UrlCodec | fHCC_UrlDecodeInput | ...EncodeOutput |
Definition at line 148 of file ncbi_http_connector.h.
enum EHTTP_Flag |
Enumerator | |
---|---|
fHTTP_AutoReconnect | |
fHTTP_Flushable | Connector will really flush on Flush() HTTP connector flags. HTTP/1.0 or when fHTTP_WriteThru is not set: by default all data written to the connection are kept until read begins (even though CONN_Flush() might have been called in between the writes); with this flag set, CONN_Flush() will result the data to be actually sent to the server side, so the following write will form a new request, and not get added to the previous one; also this flag assures that the connector sends at least an HTTP header on "CLOSE" and re-"CONNECT", even if no data for HTTP body have been written. HTTP/1.1 and when fHTTP_WriteThru is set: CONN_Flush() attempts to send all pending data down to server. |
fHTTP_KeepHeader | Keep HTTP header (see limitations) Do not strip HTTP header (i.e. everything up to the first "\r\n\r\n", including the "\r\n\r\n") from the incomning HTTP response (including any server error, which then is made available for reading as well). *NOTE* this flag disables automatic authorization and redirection. |
fHTTP_PushAuth | HTTP/1.1 pushes out auth if present. Present credentials to the server if they are set in the connection parameters when sending 1st request. Normally, the credentials are only presented on a retry when the server rejects the initial request with 401 / 407. This saves a hit, but is only honored with HTTP/1.1. |
fHTTP_WriteThru | HTTP/1.1 writes through (chunked) Valid only with HTTP/1.1: Connection to the server is made upon a first CONN_Write(), or CONN_Flush() if fHTTP_Flushable is set, or CONN_Wait(eIO_Write), and each CONN_Write() forms a chunk of HTTP data to be sent to the server. Reading / waiting for read from the connector finalizes the body and, if reading, fetches the response. |
fHTTP_NoUpread | Do not use SOCK_SetReadOnWrite() Do *not* do internal reading into temporary buffer while sending data to HTTP server; by default any send operation tries to fetch data as they are coming back from the server in order to prevent stalling due to data clogging the connection. |
fHTTP_DropUnread | Each microsession drops unread data. Do not collect incoming data in "Read" mode before switching into "Write" mode for preparing next request; by default all data sent by the server get stored even if not all of it have been requested prior to a "Write" that followed data reading (stream emulation). |
fHTTP_NoAutoRetry | No auto-retries allowed. Do not attempt any auto-retries in case of failing connections (this flag effectively overrides SConnNetInfo::max_try with 1). |
fHTTP_NoAutomagicSID | Do not add NCBI SID automagically. |
fHTTP_UnsafeRedirects | Any redirect will be honored. For security reasons the following redirects comprise security risk, and thus, are prohibited: switching from https to http, and/or re-POSTing data (regardless of the transport, either http or https); this flag allows such redirects (when encountered) to be honored.
|
fHTTP_AdjustOnRedirect | Call adjust routine for redirects, too. |
fHTTP_SuppressMessages | Most annoying ones reduced to traces. |
Definition at line 127 of file ncbi_http_connector.h.
enum EHTTP_HeaderParse |
The extended version HTTP_CreateConnectorEx() is able to track the HTTP response chain and also change the URL of the server "on-the-fly":
FHTTP_ParseHeader() gets called every time a new HTTP response header is received from the server, and only if fHTTP_KeepHeader is NOT set. Return code from the parser adjusts the existing server error condition (if any) as the following:
+ eHTTP_HeaderError: unconditionally flag a server error; + eHTTP_HeaderSuccess: header parse successful, retain existing condition (note that in case of an already existing server error condition the response body can be logged but will not be made available for the user code to read, and eIO_Unknown will result on read); + eHTTP_HeaderContinue: if there was already a server error condition, the response body will be made available for the user code to read (but only if HTTP connector cannot post-process the request such as for redirects, authorization etc); otherwise, this code has the same effect as eHTTP_HeaderSuccess; + eHTTP_HeaderComplete: flag this request as processed completely, and do not do any post-processing (such as redirects, authorization etc), yet make the response body (if any, and regardless of whether there was a server error or not) available for reading.
Definition at line 230 of file ncbi_http_connector.h.
EIO_Status CONN_Close | ( | CONN | conn | ) |
Close the connection and destroy all relevant internal data.
[in] | conn | connection handle |
Definition at line 1162 of file ncbi_connection.c.
References BUF_Destroy(), conn, CONN_NOT_NULL, eIO_Success, free(), and x_ReInit().
Referenced by s_Open(), s_Resolve(), CConn_Streambuf::x_Close(), and x_LoadLocalIPs().
EIO_Status CONN_Create | ( | CONNECTOR | connector, |
CONN * | conn | ||
) |
Same as CONN_CreateEx() called with 0 in the "flags" parameter.
[in] | connector | connector |
[out] | conn | handle of the created connection |
Definition at line 457 of file ncbi_connection.c.
References conn, and CONN_CreateEx().
Referenced by CreateAsnConn_ServiceEx(), s_Open(), s_Resolve(), and x_LoadLocalIPs().
EIO_Status CONN_CreateEx | ( | CONNECTOR | connector, |
TCONN_Flags | flags, | ||
CONN * | conn | ||
) |
Create all data necessary to establish a new connection (merely bind it to the specified CONNECTOR).
Unsuccessful completion sets "*conn" to NULL, and leaves "connector" intact (can be used again).
[in] | connector | connector |
[in] | flags | connection flags |
[out] | conn | handle of the created connection |
Definition at line 417 of file ncbi_connection.c.
References assert, calloc(), conn, CONN_CALLTRACE, CONN_LOG, CONNECTION_MAGIC, eCONN_Unusable, eIO_InvalidArg, eIO_Success, eIO_Unknown, eLOG_Error, fCONN_Flush, flags, free(), int, kDefaultTimeout, and x_ReInit().
Referenced by CConn_Streambuf::CConn_Streambuf(), and CONN_Create().
char* CONN_Description | ( | CONN | conn | ) |
Return a human-readable description of the connection as a character '\0'-terminated string.
The string is not guaranteed to have any particular format, and is intended solely for something like logging and debugging. Return NULL if the connection cannot provide any description information (or if it is in a bad state). Application program must call free() to deallocate the space occupied by the returned string when the description is no longer needed.
[in] | conn | connection handle |
Definition at line 484 of file ncbi_connection.c.
References conn, CONN_NOT_NULL_EX, and eCONN_Unusable.
Referenced by CReaderServiceConnector::GetConnDescription(), CConn_IOStream::GetDescription(), CId2FetchApp::x_InitConnection(), and CConn_Streambuf::x_Message().
EIO_Status CONN_Flush | ( | CONN | conn | ) |
Explicitly flush connection from any pending data written by CONN_Write().
[in] | conn | connection handle |
Definition at line 833 of file ncbi_connection.c.
References assert, conn, CONN_LOG, CONN_NOT_NULL, eCONN_Open, eIO_Success, eIO_Timeout, eLOG_Trace, eLOG_Warning, kDefaultTimeout, s_Open(), and x_Flush().
Referenced by CConn_Streambuf::overflow(), s_Open(), and s_Resolve().
TCONN_Flags CONN_GetFlags | ( | CONN | conn | ) |
Get connection processing flags currently in effect.
[in] | conn | connection handle |
Definition at line 1257 of file ncbi_connection.c.
References conn, CONN_CALLTRACE, and fCONN_Flush.
TNCBI_BigCount CONN_GetPosition | ( | CONN | conn, |
EIO_Event | event | ||
) |
Get read ("event" == eIO_Read) or write ("event" == eIO_Write) position within the connection.
Positions are advanced from 0 on, for every successive byte of data, and only consider I/O that has caused calling the actual CONNECTOR's "read" (i.e. pushbacks never counted, and peeks – not always) and "write" methods. Special case: eIO_Open as "event" causes to clear *both* positions with 0, and to return 0.
[in] | conn | connection handle |
[in] | event | see description |
Definition at line 493 of file ncbi_connection.c.
References assert, conn, CONN_LOG_EX, CONN_NOT_NULL_EX, eIO_Open, eIO_Read, eIO_Write, and eLOG_Error.
Referenced by s_FtpCallback(), CDownloadJob::x_Download(), and CDownloadJob::x_DownloadAndExtract().
EIO_Status CONN_GetSOCK | ( | CONN | conn, |
SOCK * | sock | ||
) |
Get an underlying SOCK handle for connection that is implemented as a socket.
Non-eIO_Success return code guarantees "*sock" is NULL. Set "*sock" to NULL when no socket handle can be obtained.
[in] | conn | connection handle |
[out] | sock | non-NULL, to get the SOCK to |
Definition at line 1209 of file ncbi_connection.c.
References assert, SMetaConnector::c_get_type, conn, CONN_NOT_NULL, eCONN_Open, eIO_InvalidArg, eIO_Success, g_kNcbiSockNameAbbr, SMetaConnector::get_type, SConnectorTag::handle, if(), SConnectorTag::meta, s_Open(), and util::strcmp().
Referenced by CRPCClient< TRequest, TReply >::AsyncConnect(), CConn_IOStream::GetSOCK(), and CConn_Streambuf::x_Init().
Retrieve current timeout, return NULL(kInfiniteTimeout) if it is infinite.
event | Can be one of eIO_Open, eIO_Read, eIO_Write, and eIO_Close. In case of the event specified as eIO_ReadWrite, the current read timeout gets actually returned with a warning logged. |
[in] | conn | connection handle |
[in] | event | I/O direction, not "eIO_ReadWrite"! |
Definition at line 576 of file ncbi_connection.c.
References assert, conn, CONN_LOG_EX, CONN_NOT_NULL_EX, eIO_Close, eIO_Open, eIO_Read, eIO_ReadWrite, eIO_Write, eLOG_Error, and eLOG_Warning.
Referenced by CConn_FtpStream::Drain(), CConn_Streambuf::Fetch(), CConn_IOStream::GetTimeout(), CConn_Streambuf::overflow(), CConn_Streambuf::showmanyc(), CConn_Streambuf::underflow(), CConn_Streambuf::x_Close(), CConn_Streambuf::x_Read(), and CConn_Streambuf::xsputn().
Get verbal representation of connection type as a character string.
Note that the returned value is only valid until the next I/O operation in the connection. Return value NULL denotes unknown connection type.
[in] | conn | connection handle |
Definition at line 475 of file ncbi_connection.c.
References conn, CONN_NOT_NULL_EX, and eCONN_Unusable.
Referenced by CConn_IOStream::GetType(), and CConn_Streambuf::x_Message().
void* CONN_GetUserData | ( | CONN | conn | ) |
Get current value of the user's data pointer last associated with the connection, or NULL (if CONN is NULL or no pointer is currently set).
[in] | conn | connection handle |
Definition at line 1277 of file ncbi_connection.c.
References conn, and CONN_CALLTRACE.
EIO_Status CONN_Pushback | ( | CONN | conn, |
const void * | data, | ||
size_t | size | ||
) |
Push "size" bytes from the buffer "data" back into connection.
Return eIO_Success on success (including when pushing back nothing if "size" is zero – the "data" pointer is ignored then), other code on error.
[in] | conn | connection handle |
[in] | data | pointer to the data being pushed back |
[in] | size | # of bytes to push back |
Definition at line 808 of file ncbi_connection.c.
References assert, BUF_Pushback(), conn, CONN_NOT_NULL, data, eCONN_Open, eCONN_Unusable, eIO_InvalidArg, eIO_NotSupported, eIO_Success, eIO_Unknown, and ncbi::grid::netcache::search::fields::size.
Referenced by CConn_Streambuf::Pushback(), s_CONN_IO(), and CConn_Streambuf::x_Pushback().
EIO_Status CONN_Read | ( | CONN | conn, |
void * | buf, | ||
size_t | size, | ||
size_t * | n_read, | ||
EIO_ReadMethod | how | ||
) |
[in] | conn | connection handle |
[out] | buf | memory buffer to read to |
[in] | size | max. # of bytes to read |
[out] | n_read | non-NULL, # of actually read bytes |
[in] | how | peek/read/persist |
Definition at line 984 of file ncbi_connection.c.
References assert, buf, conn, CONN_NOT_NULL, eCONN_Open, eIO_InvalidArg, eIO_NotSupported, eIO_ReadPeek, eIO_ReadPersist, eIO_ReadPlain, eIO_Success, fCONN_Flush, fCONN_Supplement, fCONN_Untie, Read(), s_CONN_Read(), s_CONN_ReadPersist(), s_Open(), ncbi::grid::netcache::search::fields::size, and x_Flush().
Referenced by CConnTest::CheckFWConnections(), CConn_FtpStream::Drain(), s_AsnRead(), s_CONN_IO(), s_ReadFullResponse(), CConn_Streambuf::showmanyc(), CConn_Streambuf::underflow(), and CConn_Streambuf::x_Read().
EIO_Status CONN_ReadLine | ( | CONN | conn, |
char * | line, | ||
size_t | size, | ||
size_t * | n_read | ||
) |
Read up to "size" bytes from connection into a string buffer pointed to by "line".
Stop reading if either '
' or an error is encountered. Replace '
' with '\0'. Upon return, "*n_read" contains the number of characters stored in "line", not including the terminating '\0'. If there was not enough space provided in "line" to accomodate the '\0'-termination, then all "size" bytes are used up, and "*n_read" is equal to "size" upon return - this is the _only_ case when "line" is _not_ be '\0'-terminated.
Return code advises the caller whether another read can be attempted: * eIO_Success – read completed successfully ('
' is seen or the buffer has been filled up completely), keep reading; * other code – an error occurred, and further read attempt may fail.
This call utilizes eIO_Read timeout as set by CONN_SetTimeout().
[in] | conn | connection handle |
[out] | line | buffer to read to, non-NULL |
[in] | size | buffer size (may not be 0) |
[out] | n_read | line length, may not be NULL |
Definition at line 1035 of file ncbi_connection.c.
References assert, BUF_Pushback(), BUF_Size(), conn, CONN_LOG_EX, CONN_NOT_NULL, done, eCONN_Corrupt, eCONN_Open, eIO_InvalidArg, eIO_Success, eIO_Unknown, eLOG_Critical, fCONN_Flush, fCONN_Supplement, fCONN_Untie, i, len, ReadLine(), s_CONN_Read(), s_Open(), ncbi::grid::netcache::search::fields::size, x_Flush(), and x_size().
Referenced by xx_LoadLocalIPs().
EIO_Status CONN_ReInit | ( | CONN | conn, |
CONNECTOR | connector | ||
) |
Reinit using new "connector".
If "conn" is already opened, then close the current connection first, even if "connector" is just the same as the current CONNECTOR. If "connector" is NULL, then close and destroy the incumbent, and leave the connection empty (effective way to destroy CONNECTOR(s)).
[in] | conn | connection handle |
[in] | connector | new connector |
Definition at line 465 of file ncbi_connection.c.
References conn, CONN_NOT_NULL, and x_ReInit().
EIO_Status CONN_SetCallback | ( | CONN | conn, |
ECONN_Callback | type, | ||
const SCONN_Callback * | new_cb, | ||
SCONN_Callback * | old_cb | ||
) |
[in] | conn | connection to set callback for |
[in] | type | callback type |
[in] | new_cb | callback to set (NULL to reset) |
[out] | old_cb | to save old callback at (may be 0) |
Definition at line 1178 of file ncbi_connection.c.
References assert, conn, CONN_LOG_EX, CONN_N_CALLBACKS, CONN_NOT_NULL, eIO_InvalidArg, eIO_Success, eLOG_Error, and x_CB2IDX().
Referenced by s_AsnSetCloseCb(), s_FtpCallback(), CConn_IOStream::SetCanceledCallback(), CConn_Streambuf::x_Close(), CDownloadJob::x_Download(), CDownloadJob::x_DownloadAndExtract(), and CConn_Streambuf::x_Init().
EIO_Status CONN_SetFlags | ( | CONN | conn, |
TCONN_Flags | flags | ||
) |
Set connection processing flags.
[in] | conn | connection handle |
[in] | flags | new connection flags |
Definition at line 1243 of file ncbi_connection.c.
References conn, CONN_CALLTRACE, eIO_InvalidArg, eIO_Success, fCONN_Flush, and flags.
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".
May be called at any time during the connection lifetime.
event | Can be one of eIO_Open, eIO_Read, eIO_ReadWrite, eIO_Write, and eIO_Close. In case of eIO_ReadWrite, the timeout value updates both read and write timeouts simultaneously, effectively equivalent to making this call twice with eIO_Read and eIO_Write events, respectively. |
[in] | conn | connection handle |
[in] | event | I/O direction |
[in] | timeout | new timeout |
Definition at line 520 of file ncbi_connection.c.
References assert, conn, CONN_LOG_EX, CONN_NOT_NULL, eIO_Close, eIO_InvalidArg, eIO_Open, eIO_Read, eIO_ReadWrite, eIO_Success, eIO_Write, eLOG_Error, and kDefaultTimeout.
Referenced by CConnTest::CheckFWConnections(), CConn_FtpStream::Drain(), CConn_Streambuf::Fetch(), s_Open(), CConn_IOStream::SetTimeout(), CConn_Streambuf::showmanyc(), CId1Reader::x_ConnectAtSlot(), CId2Reader::x_ConnectAtSlot(), and CConn_Streambuf::x_Init().
EIO_Status CONN_SetUserData | ( | CONN | conn, |
void * | data | ||
) |
Associate an arbitraty user data pointer with the connection.
The pointer is not used by the connection itself but is retrievable with CONN_GetUserData() in the user's code as long as the CONN handle remains valid. Successive calls to CONN_SetUserData() replace the pointer value.
[in] | conn | connection handle |
[in] | data | user data pointer |
Definition at line 1265 of file ncbi_connection.c.
References conn, CONN_CALLTRACE, data, eIO_InvalidArg, and eIO_Success.
EIO_Status CONN_Status | ( | CONN | conn, |
EIO_Event | dir | ||
) |
Obtain status of the last I/O operation.
This is NOT a completion code of the last CONN call, but rather some status from a lower level CONNECTOR's layer (if available).
[in] | conn | connection handle |
[in] | dir | eIO_Open, eIO_Read, eIO_Write, or eIO_ReadWrite |
Definition at line 1118 of file ncbi_connection.c.
References assert, conn, CONN_NOT_NULL, eCONN_Cancel, eCONN_Corrupt, eCONN_Open, eCONN_Unusable, eIO_Interrupt, eIO_InvalidArg, eIO_NotSupported, eIO_Open, eIO_Read, eIO_ReadWrite, eIO_Success, eIO_Unknown, and eIO_Write.
Referenced by CConn_Streambuf::Status(), CConn_Streambuf::x_Close(), and CConn_Streambuf::x_Init().
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"), until timeout expires, or until any error.
[in] | conn | connection handle |
[in] | event | can only be either of eIO_Read,eIO_Write |
[in] | timeout | the maximal wait time |
Definition at line 615 of file ncbi_connection.c.
References assert, BUF_Size(), conn, CONN_LOG, CONN_NOT_NULL, eCONN_Open, eIO_Interrupt, eIO_InvalidArg, eIO_NotSupported, eIO_Read, eIO_Success, eIO_Timeout, eIO_Write, eLOG_Critical, eLOG_Error, eLOG_Trace, eLOG_Warning, kDefaultTimeout, s_Open(), STimeoutTag::sec, and STimeoutTag::usec.
Referenced by CConnTest::CheckFWConnections(), CReaderServiceConnector::Connect(), CConnTest::ExtraCheckOnFailure(), CConn_Streambuf::Fetch(), CConn_IOStream::Wait(), and CId2FetchApp::x_InitConnection().
EIO_Status CONN_Write | ( | CONN | conn, |
const void * | buf, | ||
size_t | size, | ||
size_t * | n_written, | ||
EIO_WriteMethod | how | ||
) |
[in] | conn | connection handle |
[in] | buf | pointer to the data buffer to write |
[in] | size | # of bytes to write |
[out] | n_written | non-NULL, # of actually written bytes |
[in] | how | eIO_WritePlain or eIO_WritePersist |
Definition at line 765 of file ncbi_connection.c.
References assert, conn, CONN_NOT_NULL, data, eCONN_Open, eIO_InvalidArg, eIO_NotSupported, eIO_Success, eIO_WritePersist, eIO_WritePlain, fCONN_Supplement, s_CONN_Write(), s_CONN_WritePersist(), s_Open(), ncbi::grid::netcache::search::fields::size, and Write().
Referenced by CConn_FtpStream::Drain(), CConn_Streambuf::overflow(), s_AsnWrite(), and CConn_Streambuf::xsputn().
Definition at line 345 of file ncbi_file_connector.c.
References FILE_CreateConnectorEx(), and NULL.
Referenced by s_LoadLocalIPs().
CONNECTOR FILE_CreateConnectorEx | ( | const char * | ifname, |
const char * | ofname, | ||
const SFILE_ConnAttr * | attr | ||
) |
Definition at line 353 of file ncbi_file_connector.c.
References SFileConnector::attr, SConnectorTag::destroy, eFCM_Truncate, SFileConnector::finp, SFileConnector::fout, free(), SConnectorTag::handle, SFileConnector::ifname, malloc(), SConnectorTag::meta, SConnectorTag::next, SFileConnector::ofname, s_Destroy(), s_Setup(), SConnectorTag::setup, and str().
Referenced by FILE_CreateConnector().
CONNECTOR FTP_CreateConnector | ( | const SConnNetInfo * | info, |
TFTP_Flags | flag, | ||
const SFTP_Callback * | cmcb | ||
) |
Definition at line 2463 of file ncbi_ftp_connector.c.
References info, and s_CreateConnector().
Referenced by s_FtpConnectorBuilder().
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 | ||
) |
Definition at line 2451 of file ncbi_ftp_connector.c.
References s_CreateConnector().
Referenced by s_FtpConnectorBuilder().
CONNECTOR HTTP_CreateConnector | ( | const SConnNetInfo * | net_info, |
const char * | user_header, | ||
THTTP_Flags | flags | ||
) |
Same as HTTP_CreateConnector(net_info, flags, 0, 0, 0, 0) with the passed "user_header" overriding the value provided in "net_info->http_user_header".
Definition at line 2965 of file ncbi_http_connector.c.
References flags, and s_CreateConnector().
Referenced by s_CreateConnectorHttp(), and s_LoadLocalIPs().
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) method.
Use the configuration values stored in "net_info". If "net_info" is NULL, then use the default info as created by ConnNetInfo_Create(0).
If "net_info" does not explicitly specify an HTTP request method (i.e. it has it as "eReqMethod_Any"), then the actual method sent to the HTTP server depends on whether any data has been written to the connection with CONN_Write(): the presence of pending data will cause a POST request (with a "Content-Length:" tag supplied automatically and reflecting the total pending data size), and GET request method will result in the absence of any data. An explicit value for the request method will cause the specified request to be used regardless of pending data, and will flag an error if any data will have to be sent with a GET (per the standard).
When not using HTTP/1.1's fHTTP_WriteThru mode, in order to work around some HTTP communication features, this code does:
1. Accumulate all output data in an internal memory buffer until the first CONN_Read() (including peek) or CONN_Wait(on read) is attempted (also see fHTTP_Flushable flag below). 2. On the first CONN_Read() or CONN_Wait(on read), compose and send the whole HTTP request as:
* METHOD <net_info->path>?<net_info->args> HTTP/1.0\r\n * <user_header\r\n> * Content-Length: <accumulated_data_length>\r\n * \r\n * <accumulated_data> *
When fHTTP_WriteThru is set with HTTP/1.1, writing to the connector begins upon any write operations, and reading from the connector causes the request body to finalize and response to be fetched from the server. Request method must be explicitly specified with fHTTP_WriteThru, "ANY" does not get accepted (eIO_NotSupported returned).
parse_header | may be NULL, then no addtl. parsing |
user_data | user data for HTTP CBs (callbacks) |
adjust | may be NULL |
cleanup | may be NULL |
Definition at line 2974 of file ncbi_http_connector.c.
References cleanup(), flags, and s_CreateConnector().
Referenced by s_HttpConnectorBuilder(), s_Open(), and s_Resolve().
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)
Definition at line 3050 of file ncbi_http_connector.c.
References flags, and HTTP_CreateTunnelEx().
Referenced by s_SocketConnectorBuilder().
EIO_Status HTTP_CreateTunnelEx | ( | const SConnNetInfo * | net_info, |
THTTP_Flags | flags, | ||
const void * | init_data, | ||
size_t | init_size, | ||
void * | user_data, | ||
FHTTP_Adjust | adjust, | ||
SOCK * | sock | ||
) |
Create a tunnel to "net_info->host:net_info->port" via an HTTP proxy server located at "net_info->http_proxy_host:net_info->http_proxy_port".
Return the tunnel as a socket via the last parameter. For compatibility with future API extensions, please make sure *sock is NULL when making the call. "net_info->scheme" is only used to infer the proper default form of the ":port" part in the "Host:" tag for the proxy request in case of HTTP[S] (thus, eURL_Unspec forces the ":port" part to be always present in the tag).
init_data | initial data block to send via tunnel |
init_size | size of the initial data block |
user_data | user data for the adjust callback |
adjust | adjust callback, may be NULL |
sock | return socket; must be non-NULL |
Definition at line 2987 of file ncbi_http_connector.c.
References assert, BUF_Prepend(), BUF_Size(), SHttpConnector::conn_state, eCS_Eom, eCS_ReadBody, eEM_Wait, eIO_InvalidArg, eIO_NotSupported, eIO_Success, eIO_Unknown, fHTTP_DropUnread, flags, SHttpConnector::http_code, SHttpConnector::net_info, s_CreateHttpConnector(), s_DestroyHttpConnector(), s_DropConnection(), s_PreRead(), SHttpConnector::sock, SConnNetInfo::timeout, and SHttpConnector::w_buf.
Referenced by HTTP_CreateTunnel(), and s_Connect().
void HTTP_SetNcbiMessageHook | ( | FHTTP_NcbiMessageHook | hook | ) |
Set a message hook procedure for messages originating from NCBI via HTTP.
Any hook will be called no more than once. Until no hook is installed, and exactly one message is caught, a critical error will be generated in the standard log file upon acceptance of every message. *Not MT-safe*.
hook | New hook to be installed, NULL to reset |
Definition at line 3059 of file ncbi_http_connector.c.
References s_MessageHook, and s_MessageIssued.
CONNECTOR MEMORY_CreateConnector | ( | void | ) |
Definition at line 243 of file ncbi_memory_connector.c.
References MEMORY_CreateConnectorEx().
Definition at line 249 of file ncbi_memory_connector.c.
References buf, SMemoryConnector::buf, SConnectorTag::destroy, free(), SConnectorTag::handle, malloc(), SConnectorTag::meta, SConnectorTag::next, SMemoryConnector::own_buf, s_Destroy(), s_Setup(), and SConnectorTag::setup.
Referenced by MEMORY_CreateConnector(), and s_CreateConnectorMemory().
EIO_Status METACONN_Insert | ( | SMetaConnector * | meta, |
CONNECTOR | connector | ||
) |
Insert a connector in the beginning of the connection's list of connectors.
Calls connector's FSetupVTable, which must be defined.
Definition at line 84 of file ncbi_connector.c.
References assert, SMetaConnector::default_timeout, eIO_InvalidArg, eIO_Success, eIO_Unknown, eLOG_Critical, eLOG_Error, g_NcbiDefConnTimeout, kDefaultTimeout, SMetaConnector::list, SConnectorTag::meta, METACONN_LOG, SConnectorTag::next, and SConnectorTag::setup.
Referenced by s_VT_Open(), and x_ReInit().
EIO_Status METACONN_Remove | ( | SMetaConnector * | meta, |
CONNECTOR | connector | ||
) |
Delete given "connector" all its descendants (all connectors if "connector" is NULL) from the connections's list of connectors.
FDestroy (if defined) gets called for each removed connector.
Definition at line 48 of file ncbi_connector.c.
References assert, SConnectorTag::destroy, eIO_InvalidArg, eIO_Success, eLOG_Error, SMetaConnector::list, SConnectorTag::meta, METACONN_LOG, and SConnectorTag::next.
Referenced by s_Close(), and x_ReInit().
Create CNamedPipe-based CONNECTOR.
Create new CONNECTOR structure to handle a data transfer between two processes through a named pipe. Return NULL on error.
pipesize | use default |
Definition at line 191 of file ncbi_namedpipe_connector.cpp.
References make_c_unique(), malloc(), s_Destroy(), and s_Setup().
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.
Create new CONNECTOR structure to handle data transfer with a spawned process (command) over an interprocess pipe. Return NULL on error.
cmd | Command name to execute |
args | Vector of string arguments for the command (argv[0] excluded) |
flags | See CPipe::TCreateFlags |
pipe | The connector is to be built on top of the specified CPipe (otherwise, a CPipe oobject gets created internally) |
own_pipe | Disposition of the "pipe" parameter when the connector gets destroyed |
pipe_size | Internal buffer size (0 uses some reasonable default) |
own_pipe | only if "pipe" given |
pipe_size | use default |
Definition at line 235 of file ncbi_pipe_connector.cpp.
References cmd, eTakeOwnership, flags, make_c_unique(), malloc(), s_Destroy(), and s_Setup().
Referenced by s_PipeConnectorBuilder().
CONNECTOR SERVICE_CreateConnectorEx | ( | const char * | service, |
TSERV_Type | types, | ||
const SConnNetInfo * | net_info, | ||
const SSERVICE_Extra * | extra | ||
) |
Definition at line 1278 of file ncbi_service_connector.c.
References assert, calloc(), ConnNetInfo_Clone(), ConnNetInfo_CreateInternal(), SConnectorTag::destroy, eFWMode_Adaptive, SServiceConnectorTag::extra, fHTTP_NoAutoRetry, SConnNetInfo::firewall, SSERVICE_Extra::flags, free(), fSERV_DelayOpen, fSERV_Firewall, fSERV_Stateless, SConnectorTag::handle, SServiceConnectorTag::iter, len, malloc(), SConnNetInfo::max_try, SConnectorTag::meta, SServiceConnectorTag::name, SServiceConnectorTag::net_info, SConnectorTag::next, s_Destroy(), s_OpenDispatcher(), s_Setup(), SERV_ServiceName(), SConnectorTag::setup, SConnNetInfo::stateless, SServiceConnectorTag::types, and types.
Referenced by CreateAsnConn_ServiceEx(), and s_ServiceConnectorBuilder().
Definition at line 368 of file ncbi_socket_connector.c.
References fSOCK_LogDefault, and s_Init().
CONNECTOR SOCK_CreateConnectorEx | ( | const char * | host, |
unsigned short | port, | ||
unsigned short | max_try, | ||
const void * | data, | ||
size_t | size, | ||
TSOCK_Flags | flags | ||
) |
Definition at line 377 of file ncbi_socket_connector.c.
References data, flags, s_Init(), and ncbi::grid::netcache::search::fields::size.
Referenced by s_SocketConnectorBuilder().
Definition at line 389 of file ncbi_socket_connector.c.
References s_Init().
Definition at line 397 of file ncbi_socket_connector.c.
References s_Init().
Referenced by s_SocketConnectorBuilder().
FHTTP_Adjust SSERVICE_Extra::adjust |
Definition at line 62 of file ncbi_service_connector.h.
Referenced by s_Adjust(), s_Open(), s_ServiceConnectorBuilder(), CConn_ServiceStream::sx_Adjust(), and CHttpRequest::x_InitConnection().
CONNECTOR SMetaConnector::c_close |
Definition at line 201 of file ncbi_connector.h.
Referenced by s_Close().
CONNECTOR SMetaConnector::c_descr |
Definition at line 194 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_flush |
Definition at line 198 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_get_type |
Definition at line 193 of file ncbi_connector.h.
Referenced by CONN_GetSOCK(), and s_VT_Open().
CONNECTOR SMetaConnector::c_open |
Definition at line 195 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_read |
Definition at line 199 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_status |
Definition at line 200 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_wait |
Definition at line 196 of file ncbi_connector.h.
Referenced by s_VT_Open().
CONNECTOR SMetaConnector::c_write |
Definition at line 197 of file ncbi_connector.h.
Referenced by s_VT_Open().
FSERVICE_Cleanup SSERVICE_Extra::cleanup |
Definition at line 63 of file ncbi_service_connector.h.
Referenced by CReaderServiceConnector::Connect(), s_Destroy(), s_ServiceConnectorBuilder(), CConn_ServiceStream::sx_Cleanup(), and CHttpRequest::x_InitConnection().
FConnectorClose SMetaConnector::close |
Definition at line 201 of file ncbi_connector.h.
Referenced by s_Close().
void* SCONN_Callback::data |
data to pass to the callback as its last arg
Definition at line 486 of file ncbi_connection.h.
Referenced by s_AsnClose(), s_AsnSetCloseCb(), s_FtpCallback(), CConn_IOStream::SetCanceledCallback(), CConn_IOStream::sx_IsCanceled(), CConn_Streambuf::x_Close(), and CConn_Streambuf::x_Init().
void* SFTP_Callback::data |
Definition at line 305 of file ncbi_ftp_connector.h.
Referenced by s_FtpConnectorBuilder(), CConn_FtpStream::sx_FtpCallback(), x_FTPParseSize(), and x_FTPRetrieveCB().
void* SSERVICE_Extra::data |
Definition at line 60 of file ncbi_service_connector.h.
Referenced by CReaderServiceConnector::Connect(), s_Adjust(), s_Close(), s_Destroy(), s_GetNextInfo(), s_Open(), s_ParseHeader(), s_ServiceConnectorBuilder(), CConn_ServiceStream::sx_Adjust(), CConn_ServiceStream::sx_Cleanup(), CConn_ServiceStream::sx_GetNextInfo(), CConn_ServiceStream::sx_ParseHeader(), CConn_ServiceStream::sx_Reset(), CRPCClient< TRequest, TReply >::x_FillConnNetInfo(), and CHttpRequest::x_InitConnection().
default timeout pointer
Definition at line 202 of file ncbi_connector.h.
Referenced by METACONN_Insert(), and s_Setup().
STimeout SMetaConnector::default_tmo |
storage for default_timeout
Definition at line 203 of file ncbi_connector.h.
FConnectorDescr SMetaConnector::descr |
Definition at line 194 of file ncbi_connector.h.
Referenced by s_VT_Open().
FDestroy SConnectorTag::destroy |
destroys handle, can be NULL
Definition at line 268 of file ncbi_connector.h.
Referenced by FILE_CreateConnectorEx(), MEMORY_CreateConnectorEx(), METACONN_Remove(), s_CreateConnector(), s_Init(), s_Resolve(), SERVICE_CreateConnectorEx(), x_DestroyConnector(), x_LoadLocalIPs(), and CConn_Streambuf::~CConn_Streambuf().
THTTP_Flags SSERVICE_Extra::flags |
Definition at line 66 of file ncbi_service_connector.h.
Referenced by CReaderServiceConnector::Connect(), s_Open(), s_ServiceConnectorBuilder(), SERVICE_CreateConnectorEx(), CRPCClient< TRequest, TReply >::x_FillConnNetInfo(), and CHttpRequest::x_InitConnection().
FConnectorFlush SMetaConnector::flush |
Definition at line 198 of file ncbi_connector.h.
Referenced by s_VT_Open().
FCONN_Callback SCONN_Callback::func |
function address to call on the event
Definition at line 485 of file ncbi_connection.h.
Referenced by s_AsnClose(), s_AsnSetCloseCb(), s_FtpCallback(), CConn_IOStream::SetCanceledCallback(), CConn_IOStream::sx_IsCanceled(), CConn_Streambuf::x_Close(), and CConn_Streambuf::x_Init().
FFTP_Callback SFTP_Callback::func |
Definition at line 304 of file ncbi_ftp_connector.h.
Referenced by s_FtpConnectorBuilder(), CConn_FtpStream::sx_FtpCallback(), x_FTPParseSize(), and x_FTPRetrieveCB().
DEF_CONN_TIMEOUT as STimeout.
Definition at line 54 of file ncbi_connutil.c.
Referenced by ConnNetInfo_CreateInternal(), CConn_Streambuf::Fetch(), METACONN_Insert(), s_ReadHeader(), CConnTest::SetTimeout(), and x_Large().
FSERVICE_GetNextInfo SSERVICE_Extra::get_next_info |
Definition at line 65 of file ncbi_service_connector.h.
Referenced by CReaderServiceConnector::Connect(), s_GetNextInfo(), s_ServiceConnectorBuilder(), and CConn_ServiceStream::sx_GetNextInfo().
FConnectorGetType SMetaConnector::get_type |
Definition at line 193 of file ncbi_connector.h.
Referenced by CONN_GetSOCK(), and s_VT_Open().
void* SConnectorTag::handle |
data handle of the connector
Definition at line 269 of file ncbi_connector.h.
Referenced by CONN_GetSOCK(), FILE_CreateConnectorEx(), CConn_MemoryStream::GetBUF(), MEMORY_CreateConnectorEx(), s_Close(), s_CreateConnector(), s_Destroy(), s_Init(), s_Setup(), s_VT_Close(), s_VT_Descr(), s_VT_Flush(), s_VT_GetType(), s_VT_Open(), s_VT_Read(), s_VT_Status(), s_VT_Wait(), s_VT_Write(), and SERVICE_CreateConnectorEx().
CONNECTOR SMetaConnector::list |
Definition at line 204 of file ncbi_connector.h.
Referenced by CConn_MemoryStream::GetBUF(), METACONN_Insert(), METACONN_Remove(), s_Close(), and s_VT_Open().
SMetaConnector* SConnectorTag::meta |
back link to original meta
Definition at line 266 of file ncbi_connector.h.
Referenced by CConn_Streambuf::CConn_Streambuf(), CONN_GetSOCK(), FILE_CreateConnectorEx(), MEMORY_CreateConnectorEx(), METACONN_Insert(), METACONN_Remove(), s_Close(), s_CreateConnector(), s_Init(), s_Setup(), s_VT_Open(), SERVICE_CreateConnectorEx(), and x_DestroyConnector().
CONNECTOR SConnectorTag::next |
linked list
Definition at line 270 of file ncbi_connector.h.
Referenced by CConn_Streambuf::CConn_Streambuf(), FILE_CreateConnectorEx(), MEMORY_CreateConnectorEx(), METACONN_Insert(), METACONN_Remove(), s_CreateConnector(), s_Init(), s_VT_Open(), SERVICE_CreateConnectorEx(), x_DestroyConnector(), and x_ReInit().
FConnectorOpen SMetaConnector::open |
Definition at line 195 of file ncbi_connector.h.
Referenced by s_VT_Open().
FHTTP_ParseHeader SSERVICE_Extra::parse_header |
Definition at line 64 of file ncbi_service_connector.h.
Referenced by s_ParseHeader(), s_ServiceConnectorBuilder(), CConn_ServiceStream::sx_ParseHeader(), CRPCClient< TRequest, TReply >::x_FillConnNetInfo(), and CHttpRequest::x_InitConnection().
TNCBI_BigCount SFILE_ConnAttr::r_pos |
Definition at line 79 of file ncbi_file_connector.h.
Referenced by s_VT_Open().
FConnectorRead SMetaConnector::read |
Definition at line 199 of file ncbi_connector.h.
Referenced by s_VT_Open().
FSERVICE_Reset SSERVICE_Extra::reset |
Definition at line 61 of file ncbi_service_connector.h.
Referenced by CReaderServiceConnector::Connect(), s_Close(), s_GetNextInfo(), s_ServiceConnectorBuilder(), and CConn_ServiceStream::sx_Reset().
FSetupVTable SConnectorTag::setup |
init meta, may not be NULL
Definition at line 267 of file ncbi_connector.h.
Referenced by FILE_CreateConnectorEx(), MEMORY_CreateConnectorEx(), METACONN_Insert(), s_CreateConnector(), s_Init(), and SERVICE_CreateConnectorEx().
FConnectorStatus SMetaConnector::status |
Definition at line 200 of file ncbi_connector.h.
Referenced by s_VT_Open().
EFILE_ConnMode SFILE_ConnAttr::w_mode |
Definition at line 77 of file ncbi_file_connector.h.
Referenced by s_VT_Open().
TNCBI_BigCount SFILE_ConnAttr::w_pos |
Definition at line 78 of file ncbi_file_connector.h.
Referenced by s_VT_Open().
FConnectorWait SMetaConnector::wait |
Definition at line 196 of file ncbi_connector.h.
Referenced by s_VT_Open().
FConnectorWrite SMetaConnector::write |
Definition at line 197 of file ncbi_connector.h.
Referenced by s_VT_Open().