Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__ConnStreams.html below:
NCBI C++ ToolKit: Connection Streams
CConn_IOStream::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 is passed as "true". More...
CConn_IOStream::TConnector::TConnector (CONNECTOR connector, EIO_Status status=eIO_Success) CConn_IOStream::CConn_IOStream (const TConnector &connector, 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 CONNECTOR – only for internal use in derived classes. More...
virtual CConn_IOStream::~CConn_IOStream () string CConn_IOStream::GetType (void) const string CConn_IOStream::GetDescription (void) const EIO_Status CConn_IOStream::SetTimeout (EIO_Event direction, const STimeout *timeout) const Set connection timeout for "direction". More...
const STimeout * CConn_IOStream::GetTimeout (EIO_Event direction) const EIO_Status CConn_IOStream::Status (EIO_Event direction=eIO_Close) const EIO_Status CConn_IOStream::Fetch (const STimeout *timeout=kDefaultTimeout) Flush the stream and fetch the response (w/o extracting any user data) More...
virtual EIO_Status CConn_IOStream::Pushback (const CT_CHAR_TYPE *data, streamsize size) Push the specified data "data" of size "size" back into the underlying connection CONN (making it look like received yet unread data). More...
SOCK CConn_IOStream::GetSOCK (void) Get underlying SOCK, if available (e.g. after Fetch()) More...
CSocket & CConn_IOStream::GetSocket (void) Get CSocket, if available (else empty). More...
virtual EIO_Status CConn_IOStream::Close (void) Close CONNection, free all internal buffers and underlying structures, and render the stream unusable for further I/O. More...
EIO_Status CConn_IOStream::SetCanceledCallback (const ICanceled *canceled) Cancellation support. More...
CONN CConn_IOStream::GetCONN (void) const EIO_Status CConn_IOStream::Wait (EIO_Event event, const STimeout *timeout=&kZeroTimeout) Equivalent to CONN_Wait(GetCONN(), event, timeout) More...
EIO_Status CConn_IOStream::x_Pushback (const CT_CHAR_TYPE *data, streamsize size, bool push=false) void CConn_IOStream::x_Destroy (void) static EIO_Status CConn_IOStream::sx_IsCanceled (CONN conn, TCONN_Callback type, void *data) CConn_IOStream::CConn_IOStream (const CConn_IOStream &) CConn_IOStream & CConn_IOStream::operator= (const CConn_IOStream &) const STimeout * CConn_IOStreamSetTimeout::GetTimeout (void) const CConn_IOStreamSetTimeout::CConn_IOStreamSetTimeout (const STimeout *timeout) CConn_IOStreamSetReadTimeout::CConn_IOStreamSetReadTimeout (const STimeout *timeout) CConn_IOStreamSetReadTimeout SetReadTimeout (const STimeout *timeout) CConn_IOStream & operator>> (CConn_IOStream &is, const CConn_IOStreamSetReadTimeout &s) Stream manipulator "is >> SetReadTimeout(timeout)". More...
CConn_IOStreamSetWriteTimeout::CConn_IOStreamSetWriteTimeout (const STimeout *timeout) CConn_IOStreamSetWriteTimeout SetWriteTimeout (const STimeout *timeout) CConn_IOStream & operator<< (CConn_IOStream &os, const CConn_IOStreamSetWriteTimeout &s) Stream manipulator "os << SetWriteTimeout(timeout)". More...
CConn_SocketStream::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. More...
CConn_SocketStream::CConn_SocketStream (const string &host, unsigned short port=0, const void *data=0, size_t size=0, TSOCK_Flags flgs=fSOCK_LogDefault, unsigned short max_try=DEF_CONN_MAX_TRY, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0) Create a direct connection with "host:port" and send an initial "data" block of the specified "size" first; the remaining communication can proceed as usual. More...
CConn_SocketStream::CConn_SocketStream (SOCK sock, EOwnership if_to_own, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0) This variant uses an existing socket "sock" to build a stream upon it. More...
CConn_SocketStream::CConn_SocketStream (CSocket &socket, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0) This variant uses an existing CSocket to build a stream up on it. More...
CConn_SocketStream::CConn_SocketStream (const SConnNetInfo &net_info, const void *data=0, size_t size=0, TSOCK_Flags flgs=fSOCK_LogDefault, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0) Create a tunneled socket stream connection. More...
SHTTP_StatusData::SHTTP_StatusData (void) EHTTP_HeaderParse SHTTP_StatusData::Parse (const char *header) void SHTTP_StatusData::Clear (void) SHTTP_StatusData::SHTTP_StatusData (const SHTTP_StatusData &) SHTTP_StatusData & SHTTP_StatusData::operator= (const SHTTP_StatusData &) int CConn_HttpStream_Base::GetStatusCode (void) const Get the last seen HTTP status code, if available. More...
const CTempString CConn_HttpStream_Base::GetStatusText (void) const Get the last seen HTTP status text, if available. More...
const string & CConn_HttpStream_Base::GetHTTPHeader (void) const Get the last seen HTTP header text, if available. More...
CConn_HttpStream_Base::CConn_HttpStream_Base (const TConnector &connector, const STimeout *timeout, size_t buf_size, TConn_Flags flags=0) CConn_HttpStream::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) CConn_HttpStream::CConn_HttpStream (const string &url, THTTP_Flags flags=fHTTP_AutoReconnect, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) CConn_HttpStream::CConn_HttpStream (const string &url, EReqMethod method, const string &user_header=kEmptyStr, THTTP_Flags flags=fHTTP_AutoReconnect, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) CConn_HttpStream::CConn_HttpStream (const string &url, const SConnNetInfo *net_info, const string &user_header=kEmptyStr, FHTTP_ParseHeader parse_header=0, void *user_data=0, FHTTP_Adjust adjust=0, FHTTP_Cleanup cleanup=0, THTTP_Flags flags=fHTTP_AutoReconnect, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) CConn_HttpStream::CConn_HttpStream (const SConnNetInfo *net_info=0, const string &user_header=kEmptyStr, FHTTP_ParseHeader parse_header=0, void *user_data=0, FHTTP_Adjust adjust=0, FHTTP_Cleanup cleanup=0, THTTP_Flags flags=fHTTP_AutoReconnect, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) virtual CConn_HttpStream::~CConn_HttpStream () void CConn_HttpStream::SetURL (const string &url) Set new URL to hit next. More...
static int CConn_HttpStream::sx_Adjust (SConnNetInfo *net_info, void *data, unsigned int count) static void CConn_HttpStream::sx_Cleanup (void *data) static EHTTP_HeaderParse CConn_HttpStream::sx_ParseHeader (const char *header, void *data, int code) CConn_ServiceStream::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) CConn_ServiceStream::CConn_ServiceStream (const string &service, const string &user_header, TSERV_Type types=fSERV_Any, const SSERVICE_Extra *extra=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) virtual CConn_ServiceStream::~CConn_ServiceStream () static void CConn_ServiceStream::sx_Reset (void *data) static int CConn_ServiceStream::sx_Adjust (SConnNetInfo *net_info, void *data, unsigned int count) static void CConn_ServiceStream::sx_Cleanup (void *data) static EHTTP_HeaderParse CConn_ServiceStream::sx_ParseHeader (const char *header, void *data, int code) static const SSERV_Info * CConn_ServiceStream::sx_GetNextInfo (void *data, SERV_ITER iter) CConn_MemoryStream::CConn_MemoryStream (size_t buf_size=kConn_DefaultBufSize) CConn_MemoryStream::CConn_MemoryStream (BUF buf, EOwnership owner=eTakeOwnership, size_t buf_size=kConn_DefaultBufSize) Build a stream on top of an NCBI buffer (which in turn could have been built over a memory area of a specified size). More...
CConn_MemoryStream::CConn_MemoryStream (const void *ptr, size_t size, EOwnership owner, size_t buf_size=kConn_DefaultBufSize) Build a stream on top of an existing data area of a specified size. More...
virtual CConn_MemoryStream::~CConn_MemoryStream () virtual EIO_Status CConn_MemoryStream::Pushback (const CT_CHAR_TYPE *data, streamsize size) Push the specified data "data" of size "size" back into the underlying connection CONN (making it look like received yet unread data). More...
void CConn_MemoryStream::ToString (string *) The CConnMemoryStream::To* methods allow to obtain unread portion of the stream into a single container (as a string or a vector) so that all data is kept in sequential memory locations. More...
void CConn_MemoryStream::ToVector (vector< char > *) fill in the data, NULL is not accepted More...
BUF CConn_MemoryStream::GetBUF (void) Get the underlying BUF handle (it still remains managed by the stream) More...
CConn_PipeStream::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) virtual CConn_PipeStream::~CConn_PipeStream () virtual EIO_Status CConn_PipeStream::Close (void) Close CONNection, free all internal buffers and underlying structures, and render the stream unusable for further I/O. More...
int CConn_PipeStream::GetExitCode (void) const A valid exit code is only made available after an explicit Close() More...
CPipe & CConn_PipeStream::GetPipe (void) Return an underlying CPipe; it's valid for as long as the stream exists. More...
CConn_NamedPipeStream::CConn_NamedPipeStream (const string &pipename, size_t pipesize=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) CConn_FtpStream::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_FtpStream::CConn_FtpStream (const SConnNetInfo &net_info, TFTP_Flags flag=0, const SFTP_Callback *cmcb=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) virtual CConn_FtpStream::~CConn_FtpStream () virtual EIO_Status CConn_FtpStream::Drain (const STimeout *timeout=kDefaultTimeout) Abort any command in progress, read and discard all input data, and clear stream error state when successful (eIO_Success returns) More...
static EIO_Status CConn_FtpStream::sx_FtpCallback (void *data, const char *cmd, const char *arg) CConn_FTPDownloadStream::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) CConn_FTPDownloadStream::CConn_FTPDownloadStream (const SConnNetInfo &net_info, TFTP_Flags flag=0, const SFTP_Callback *cmcb=0, Uint8 offset=0, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize) void CConn_FTPDownloadStream::x_InitDownload (const string &file, Uint8 offset) CConn_FTPUploadStream::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_FTPUploadStream::CConn_FTPUploadStream (const SConnNetInfo &net_info, TFTP_Flags flag=0, Uint8 offset=0, const STimeout *timeout=kDefaultTimeout) void CConn_FTPUploadStream::x_InitUpload (const string &file, Uint8 offset) CConn_IOStream * NcbiOpenURL (const string &url, size_t buf_size=kConn_DefaultBufSize) Given a URL, open the data source and make it available for _reading_. More...
◆ TConn_Flags ◆ TConnPair ◆ anonymous enum
The values below must be compatible with TCONN_Flags.
Enumerator fConn_Untie
do not flush before reading
fConn_DelayOpen
do not force CONN open in ctor
fConn_ReadUnbuffered
read buffer NOT to be alloc'd
fConn_WriteUnbuffered
write buffer NOT 2.b. alloc'd
Definition at line 141 of file ncbi_conn_stream.hpp.
◆ CConn_FTPDownloadStream() [1/2] ◆ CConn_FTPDownloadStream() [2/2] CConn_FTPDownloadStream::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
) ◆ CConn_FtpStream() [1/2] ◆ CConn_FtpStream() [2/2] ◆ CConn_FTPUploadStream() [1/2] ◆ CConn_FTPUploadStream() [2/2] ◆ CConn_HttpStream() [1/5] ◆ CConn_HttpStream() [2/5] ◆ CConn_HttpStream() [3/5] ◆ CConn_HttpStream() [4/5] ◆ CConn_HttpStream() [5/5] ◆ CConn_HttpStream_Base() ◆ CConn_IOStream() [1/3]
Create a stream based on CONN, which is to be closed upon stream dtor but only if "close" parameter is passed as "true".
-
Parameters
-
conn A C object of type CONN (ncbi_connection.h) on top of which the stream is being constructed. May not be NULL. close True if to close CONN automatically (otherwise CONN remains open) timeout Default I/O timeout (including to open the stream) buf_size Default size of underlying stream buffer's I/O arena (per direction) flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input) and what to buffer ptr Specifies data which will be read from the stream prior to extracting from the actual connection (must not be modified while I/O not done) size The size of the area pointed to by the "ptr" argument
-
See also
-
CONN, ncbi_connection.h
Definition at line 73 of file ncbi_conn_stream.cpp.
References eIO_Close, eIO_Success, init(), CConn_IOStream::m_CSb, and CConn_IOStream::x_CSb.
◆ CConn_IOStream() [2/3] ◆ CConn_IOStream() [3/3]
Create a stream based on CONNECTOR – only for internal use in derived classes.
The passed CONNECTOR always gets closed by stream dtor.
-
Parameters
-
connector CONNECTOR coupled with an error code (if any) timeout Default I/O timeout (including to open the stream) buf_size Default size of underlying stream buffer's I/O arena (per direction) flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer ptr Specifies data which will be read from the stream prior to extracting from the actual connection (must not be modified while I/O not done) size The size of the area pointed to by the "ptr" argument
Definition at line 59 of file ncbi_conn_stream.cpp.
References eIO_Close, eIO_Success, init(), CConn_IOStream::m_CSb, and CConn_IOStream::x_CSb.
◆ CConn_IOStreamSetReadTimeout() ◆ CConn_IOStreamSetTimeout() ◆ CConn_IOStreamSetWriteTimeout() ◆ CConn_MemoryStream() [1/3]
Build a stream on top of an NCBI buffer (which in turn could have been built over a memory area of a specified size).
BUF's ownership is assumed by the stream as specified in "owner".
Definition at line 1062 of file ncbi_conn_stream.cpp.
◆ CConn_MemoryStream() [2/3]
Build a stream on top of an existing data area of a specified size.
The contents of the area are what will be read first from the stream. Writing to the stream will _not_ modify the contents of the area. When read from the stream, the written data will appear following the initial data block. Ownership of the area pointed to by "ptr" is controlled by the "owner" parameter, and if the ownership is passed to the stream the area will be deleted by "delete[] (char*)" from the stream destructor. That is, if there are any requirements to be considered for deleting the area (like deleting an object or an array of objects), then the ownership must not be passed to the stream. Note that the area pointed to by "ptr" should not be changed while it is still holding the data yet to be read from the stream.
-
Parameters
-
owner no default for safety
Definition at line 1078 of file ncbi_conn_stream.cpp.
◆ CConn_MemoryStream() [3/3] ◆ CConn_NamedPipeStream() ◆ CConn_PipeStream() ◆ CConn_ServiceStream() [1/2] ◆ CConn_ServiceStream() [2/2] ◆ CConn_SocketStream() [1/5]
Create a tunneled socket stream connection.
The following fields of SConnNetInfo are used (other ignored):
scheme – must be http or unspecified, checked host:port – target server http_proxy_host:http_proxy_port – HTTP proxy server to tunnel thru http_proxy_user:http_proxy_pass – credentials for the proxy, if needed http_proxy_leak – ignore bad proxy and connect direct timeout – timeout to connect to HTTP proxy firewall – if true then look at proxy_server proxy_server – use as "host" if non-empty and FW debug_printout – how to log socket data by default http_push_auth – whether to push credentials at once
-
Parameters
-
net_info Connection point and proxy tunnel location data Pointer to block of data to send once connection is ready size Size of the data block to send (or 0 if to send nothing) flgs Socket flags (see <connect/ncbi_socket.h>) timeout Default I/O timeout buf_size Default buffer size flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer
-
See also
-
CConn_IOStream, SConnNetInfo
Definition at line 475 of file ncbi_conn_stream.cpp.
◆ CConn_SocketStream() [2/5]
Create a direct connection with host:port.
-
Parameters
-
host Host to connect to port ... and port number max_try Number of attempts timeout Default I/O timeout buf_size Default buffer size flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer
-
See also
-
CConn_IOStream
-
Parameters
-
host host to connect to port ... and port number max_try number of attempts
Definition at line 256 of file ncbi_conn_stream.cpp.
◆ CConn_SocketStream() [3/5]
Create a direct connection with "host:port" and send an initial "data" block of the specified "size" first; the remaining communication can proceed as usual.
-
Parameters
-
host Host to connect to port ... and port number (however, see a note below) data Pointer to block of data to send once connection is ready size Size of the data block to send (or 0 if to send nothing) flgs Socket flgs (see <connect/ncbi_socket.h>) max_try Number of attempts timeout Default I/O timeout buf_size Default buffer size flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer
-
Note
-
As a special case, if "port" is specified as 0, then the "host" parameter is expected to have a "host:port" string as its value.
-
See also
-
CConn_IOStream
-
Parameters
-
host host[:port] to connect port ... and port number data initial data block size size of the data block flgs see ncbi_socket.h max_try number of attempts
Definition at line 308 of file ncbi_conn_stream.cpp.
◆ CConn_SocketStream() [4/5] ◆ CConn_SocketStream() [5/5]
This variant uses an existing socket "sock" to build a stream upon it.
The caller may retain the ownership of "sock" by passing "if_to_own" as "eNoOwnership" to the stream constructor – in that case, the socket "sock" will not be closed / destroyed upon stream destruction, and can further be used (including proper closing when no longer needed). Otherwise, "sock" becomes invalid once the stream is closed/destroyed. NOTE: To maintain data integrity and consistency, "sock" should not be used elsewhere while it is also being in use by the stream. More details: <ncbi_socket_connector.h>SOCK_CreateConnectorOnTop().
-
Parameters
-
sock Socket to build the stream on if_to_own Whether the sock object is owned (managed) by the stream at dtor timeout Default I/O timeout buf_size Default buffer size flags Specifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer
-
See also
-
CConn_IOStream, ncbi_socket.h, SOCK_CreateConnectorOnTop
-
Parameters
-
sock socket if_to_own whether stream to own "sock" param
Definition at line 325 of file ncbi_conn_stream.cpp.
◆ Clear() void SHTTP_StatusData::Clear ( void ) inline ◆ Close() [1/2]
Close CONNection, free all internal buffers and underlying structures, and render the stream unusable for further I/O.
-
Returns
-
eIO_Success when closed without errors; eIO_Closed if it was already closed; other error code if failed to close in an orderly fashion
-
Warning
-
Regardless of the return code, this method makes the stream unable to accept any further actions and / or I/O (they all would fail).
-
Note
-
Can be used at places where reaching end-of-scope for the stream. would be impractical
-
See also
-
CONN_Close
Reimplemented in CConn_PipeStream.
Definition at line 183 of file ncbi_conn_stream.cpp.
References _ASSERT, CConn_Streambuf::Close(), eCopyTimeoutsFromSOCK, eIO_Success, eNoOwnership, GET_CONN, CConn_IOStream::m_Canceled, CConn_IOStream::m_CSb, CConn_IOStream::m_Socket, NcbiBadbit, CSocket::Reset(), and CConstRef< C, Locker >::Reset().
Referenced by CConn_PipeStream::Close(), CDownloadJob::x_Download(), and CDownloadJob::x_DownloadAndExtract().
◆ Close() [2/2] ◆ Drain()
Abort any command in progress, read and discard all input data, and clear stream error state when successful (eIO_Success returns)
-
Note
-
The call empties out both the stream and the underlying CONN.
Definition at line 1353 of file ncbi_conn_stream.cpp.
References _VERIFY, conn, CONN_GetTimeout(), CONN_Read(), CONN_SetTimeout(), CONN_Write(), eIO_Read, eIO_ReadPersist, eIO_ReadPlain, eIO_ReadWrite, eIO_Success, eIO_Write, eIO_WritePersist, CConn_IOStream::GetCONN(), kInfiniteTimeout, and n.
◆ Fetch() ◆ GetBUF() BUF CConn_MemoryStream::GetBUF ( void ) ◆ GetCONN() CONN CConn_IOStream::GetCONN ( void ) const
-
Returns
-
Internal CONNection handle, which is still owned and used by the stream (or NULL if no such handle exists)
-
Note
-
Connection can have additional flags set for I/O processing
-
See also
-
CONN, ncbi_connection.h, CONN_GetFlags
Definition at line 96 of file ncbi_conn_stream.cpp.
References GET_CONN, and CConn_IOStream::m_CSb.
Referenced by CConnTest::CheckFWConnections(), CReaderServiceConnector::Connect(), CConnTest::ConnStatus(), CConn_FtpStream::Drain(), CAsnConverter< TCpp, TC >::FromC(), CConn_MemoryStream::GetBUF(), CReaderServiceConnector::GetConnDescription(), CAsnConverter< TCpp, TC >::ToC(), CId1Reader::x_ConnectAtSlot(), CId2Reader::x_ConnectAtSlot(), CDownloadJob::x_Download(), CDownloadJob::x_DownloadAndExtract(), and CId2FetchApp::x_InitConnection().
◆ GetDescription() string CConn_IOStream::GetDescription ( void ) const ◆ GetExitCode() int CConn_PipeStream::GetExitCode ( void ) const inline ◆ GetHTTPHeader() const string& CConn_HttpStream_Base::GetHTTPHeader ( void ) const inline ◆ GetPipe() CPipe& CConn_PipeStream::GetPipe ( void ) inline ◆ GetSOCK() SOCK CConn_IOStream::GetSOCK ( void ) ◆ GetSocket() CSocket & CConn_IOStream::GetSocket ( void ) inline ◆ GetStatusCode() int CConn_HttpStream_Base::GetStatusCode ( void ) const inline
Get the last seen HTTP status code, if available.
Definition at line 661 of file ncbi_conn_stream.hpp.
References SHTTP_StatusData::m_Code, and CConn_HttpStream_Base::m_StatusData.
Referenced by CNcbiApplogApp::Cmd_Health(), CUrlUtils::GetLastModified(), CUrlUtils::IfModifiedSince(), CNcbiApplogApp::ReadCgiResponse(), CHttpRequest::sx_ParseHeader(), CEutilsClient::x_FetchOnce(), CEutilsClient::x_GetOnce(), x_IsUrlAccessible(), CEutilsClient::x_LinkOnce(), CEutilsClient::x_LinkOnceT(), CEutilsClient::x_LinkOutOnce(), CEutilsClient::x_SearchOnce(), and CEutilsClient::x_SummaryOnce().
◆ GetStatusText() ◆ GetTimeout() [1/2] ◆ GetTimeout() [2/2] ◆ GetType() string CConn_IOStream::GetType ( void ) const ◆ NcbiOpenURL()
Given a URL, open the data source and make it available for _reading_.
See <connect/ncbi_connutil.h> for supported schemes.
If "url" looks like an identifier (no scheme provided), then it will be opened as a named NCBI service (using CConn_ServiceStream); if the "url" looks like a string in the form "host:port", a socket to that host and port will be connected (using CConn_SocketStream); otherwise, a stream will be created according to the URL scheme (recognized are: "ftp://", "http://", "https://", and "file://").
-
Warning
-
Writing to the resultant stream is undefined, unless it's either a service or a socket stream.
Definition at line 1519 of file ncbi_conn_stream.cpp.
References _ASSERT, ConnNetInfo_CreateInternal(), ConnNetInfo_Log(), ConnNetInfo_ParseURL(), ConnNetInfo_SetUserHeader(), CORE_GetLOG(), CORE_LOCK_READ, CORE_UNLOCK, eLOG_Note, NStr::eNocase, eReqMethod_Any, eReqMethod_Connect, ERR_POST_X, Error(), eURL_File, eURL_Ftp, eURL_Http, eURL_Https, fHTTP_AutoReconnect, NStr::Find(), free(), fSERV_Any, fSOCK_LogDefault, AutoPtr< X, Del >::get(), kDefaultTimeout, kEmptyStr, kInfiniteTimeout, len, make_c_unique(), NCBI_HasSpaces(), SERV_ServiceName(), NStr::StartsWith(), CSocketAPI::StringToHostPort(), and x_IsIdentifier().
◆ operator<<() ◆ operator=() [1/2] ◆ operator=() [2/2] ◆ operator>>() ◆ Parse()
Definition at line 502 of file ncbi_conn_stream.cpp.
References CTempString::assign(), SHTTP_StatusData::Clear(), eHTTP_HeaderError, eHTTP_HeaderSuccess, HTTP_EOL, isspace(), SHTTP_StatusData::m_Code, SHTTP_StatusData::m_Header, SHTTP_StatusData::m_Text, n, and str().
Referenced by CConn_HttpStream::sx_ParseHeader(), and CConn_ServiceStream::sx_ParseHeader().
◆ Pushback() [1/2]
Push the specified data "data" of size "size" back into the underlying connection CONN (making it look like received yet unread data).
If there is any non-empty pending input sequence (internal read buffer) it will be attempted to return to CONN first. Note that it can include any initial read area ("ptr"), which could have been specified in the ctor yet still unread, so potentially unwanted data copying may result.
-
Returns
-
Any status other than eIO_Success means that nothing from "data" has been returned to the connection
-
Note
-
Can be used to push just the pending internal input alone back into CONN if used with a "size" of 0 ("data" is ignored then).
-
See also
-
CONN_Pushback
Reimplemented in CConn_MemoryStream.
Definition at line 296 of file ncbi_conn_stream.hpp.
References data, ncbi::grid::netcache::search::fields::size, and CConn_IOStream::x_Pushback().
◆ Pushback() [2/2]
Push the specified data "data" of size "size" back into the underlying connection CONN (making it look like received yet unread data).
If there is any non-empty pending input sequence (internal read buffer) it will be attempted to return to CONN first. Note that it can include any initial read area ("ptr"), which could have been specified in the ctor yet still unread, so potentially unwanted data copying may result.
-
Returns
-
Any status other than eIO_Success means that nothing from "data" has been returned to the connection
-
Note
-
Can be used to push just the pending internal input alone back into CONN if used with a "size" of 0 ("data" is ignored then).
-
See also
-
CONN_Pushback
Reimplemented from CConn_IOStream.
Definition at line 901 of file ncbi_conn_stream.hpp.
References data, ncbi::grid::netcache::search::fields::size, and CConn_IOStream::x_Pushback().
◆ SetCanceledCallback()
Cancellation support.
-
Note
-
The ICanceled implementation must be derived from CObject as its first superclass.
-
See also
-
ICanceled
Definition at line 205 of file ncbi_conn_stream.cpp.
References conn, CONN_SetCallback(), SCONN_Callback::data, eCONN_OnFlush, eCONN_OnOpen, eCONN_OnRead, eCONN_OnWrite, eIO_NotSupported, eIO_Success, SCONN_Callback::func, GET_CONN, CConn_IOStream::m_Canceled, CConn_IOStream::m_CB, CConn_IOStream::m_CSb, CConstRef< C, Locker >::NotNull(), and CConn_IOStream::sx_IsCanceled().
Referenced by CConnTest::CheckFWConnections(), CConnTest::DispatcherOkay(), CConnTest::HttpOkay(), CConnTest::ServiceOkay(), CConnTest::StatefulOkay(), and CConnTest::x_GetFirewallConfiguration().
◆ SetReadTimeout() ◆ SetTimeout()
Set connection timeout for "direction".
-
Parameters
-
Can accept a pointer to a finite timeout, or either of the special values: kInfiniteTimeout, kDefaultTimeout
-
Returns
-
eIO_Success if succeeded; other error code if failed
-
See also
-
CONN_SetTimeout, SetReadTimeout, SetWriteTimeout
Definition at line 118 of file ncbi_conn_stream.cpp.
References conn, CONN_SetTimeout(), eIO_NotSupported, GET_CONN, and CConn_IOStream::m_CSb.
Referenced by CConnTest::CheckFWConnections(), operator<<(), operator>>(), and CRPCClient< TRequest, TReply >::SetTimeout().
◆ SetURL() ◆ SetWriteTimeout() ◆ SHTTP_StatusData() [1/2] ◆ SHTTP_StatusData() [2/2] ◆ Status() ◆ sx_Adjust() [1/2] int CConn_HttpStream::sx_Adjust ( SConnNetInfo * net_info, void * data, unsigned int count ) staticprivate
Definition at line 805 of file ncbi_conn_stream.cpp.
References _ASSERT, SHTTP_StatusData::Clear(), ConnNetInfo_ParseURL(), data, failure, CConn_IOStream::m_CSb, CConn_HttpStream_Base::m_StatusData, CConn_HttpStream::m_URL, CConn_HttpStream::m_UserAdjust, CConn_HttpStream::m_UserData, NCBI_CATCH_ALL, and THROW1_TRACE.
◆ sx_Adjust() [2/2] int CConn_ServiceStream::sx_Adjust ( SConnNetInfo * net_info, void * data, unsigned int count ) staticprivate ◆ sx_Cleanup() [1/2] void CConn_HttpStream::sx_Cleanup ( void * data ) staticprivate ◆ sx_Cleanup() [2/2] void CConn_ServiceStream::sx_Cleanup ( void * data ) staticprivate ◆ sx_FtpCallback() ◆ sx_GetNextInfo() ◆ sx_IsCanceled()
Definition at line 235 of file ncbi_conn_stream.cpp.
References _ASSERT, conn, SCONN_Callback::data, data, eCONN_OnFlush, eCONN_OnOpen, eCONN_OnRead, eCONN_OnWrite, eIO_Interrupt, eIO_ReadWrite, eIO_Success, SCONN_Callback::func, int, CConn_IOStream::m_Canceled, CConn_IOStream::m_CB, n, and CConstRef< C, Locker >::NotNull().
Referenced by CConn_IOStream::SetCanceledCallback().
◆ sx_ParseHeader() [1/2]
Definition at line 783 of file ncbi_conn_stream.cpp.
References _ASSERT, data, eHTTP_HeaderError, eHTTP_HeaderSuccess, failure, SHTTP_StatusData::m_Code, CConn_IOStream::m_CSb, CConn_HttpStream_Base::m_StatusData, CConn_HttpStream::m_UserData, CConn_HttpStream::m_UserParseHeader, NCBI_CATCH_ALL, SHTTP_StatusData::Parse(), and THROW1_TRACE.
◆ sx_ParseHeader() [2/2]
Definition at line 980 of file ncbi_conn_stream.cpp.
References _ASSERT, SSERVICE_Extra::data, data, eHTTP_HeaderError, eHTTP_HeaderSuccess, failure, SHTTP_StatusData::m_Code, CConn_IOStream::m_CSb, CConn_ServiceStream::m_Extra, CConn_HttpStream_Base::m_StatusData, NCBI_CATCH_ALL, SHTTP_StatusData::Parse(), SSERVICE_Extra::parse_header, and THROW1_TRACE.
◆ sx_Reset() void CConn_ServiceStream::sx_Reset ( void * data ) staticprivate ◆ TConnector()
-
Parameters
-
connector A C object of type CONNECTOR (ncbi_connector.h) on top of which a stream will be constructed. NULL CONNECTOR indicates an error (if none is passed in the second argument, eIO_Unknown results). status I/O status to use in the underlying streambuf (e.g. when CONNECTOR is NULL), and if non-eIO_Success will also cause a non-NULL CONNECTOR (if any passed in the first argument) to be destroyed.
-
See also
-
CONNECTOR, ncbi_connector.h
Definition at line 197 of file ncbi_conn_stream.hpp.
◆ ToString() void CConn_MemoryStream::ToString ( string * str ) ◆ ToVector() void CConn_MemoryStream::ToVector ( vector< char > * vec ) ◆ Wait()
Equivalent to CONN_Wait(GetCONN(), event, timeout)
-
Parameters
-
event eIO_Read or eIO_Write timeout Time to wait for the event (poll if zero time specified, and return immediately)
-
Returns
-
eIO_Success if the event is available; eIO_Timeout if the time has expired; other code to signify some error condition
-
See also
-
CONN_Wait
Definition at line 176 of file ncbi_conn_stream.cpp.
References conn, CONN_Wait(), GET_CONN, and CConn_IOStream::m_CSb.
◆ x_Destroy() void CConn_IOStream::x_Destroy ( void ) protected ◆ x_InitDownload() void CConn_FTPDownloadStream::x_InitDownload ( const string & file, Uint8 offset ) protected ◆ x_InitUpload() ◆ x_Pushback() ◆ ~CConn_FtpStream() CConn_FtpStream::~CConn_FtpStream ( ) virtual ◆ ~CConn_HttpStream() CConn_HttpStream::~CConn_HttpStream ( ) virtual ◆ ~CConn_IOStream() CConn_IOStream::~CConn_IOStream ( ) virtual ◆ ~CConn_MemoryStream() CConn_MemoryStream::~CConn_MemoryStream ( ) virtual ◆ ~CConn_PipeStream() CConn_PipeStream::~CConn_PipeStream ( ) virtual ◆ ~CConn_ServiceStream() CConn_ServiceStream::~CConn_ServiceStream ( ) virtual ◆ enum { ... } CConn_IOStream::EConn_Flag
The values below must be compatible with TCONN_Flags.
◆ kConn_DefaultBufSize const size_t kConn_DefaultBufSize = 16384 ◆ kZeroTimeout ◆ m_Canceled ◆ m_CB ◆ m_Cmcb ◆ m_Code int SHTTP_StatusData::m_Code ◆ m_CSb
Definition at line 361 of file ncbi_conn_stream.hpp.
Referenced by CConn_IOStream::CConn_IOStream(), CConn_IOStream::Close(), CConn_IOStream::Fetch(), CConn_IOStream::GetCONN(), CConn_IOStream::GetSOCK(), CConn_IOStream::GetTimeout(), CConn_IOStream::SetCanceledCallback(), CConn_IOStream::SetTimeout(), CConn_HttpStream::sx_Adjust(), CConn_HttpStream::sx_ParseHeader(), CConn_ServiceStream::sx_ParseHeader(), CConn_IOStream::Wait(), CConn_IOStream::x_Destroy(), and CConn_IOStream::x_Pushback().
◆ m_ExitCode int CConn_PipeStream::m_ExitCode protected ◆ m_Extra ◆ m_Header string SHTTP_StatusData::m_Header ◆ m_Pipe CPipe* CConn_PipeStream::m_Pipe protected ◆ m_Ptr const void* CConn_MemoryStream::m_Ptr protected ◆ m_Socket ◆ m_StatusData ◆ m_Text ◆ m_Timeout ◆ m_URL string CConn_HttpStream::m_URL protected ◆ m_UserAdjust ◆ m_UserCleanup ◆ m_UserData void* CConn_HttpStream::m_UserData protected ◆ m_UserParseHeader ◆ x_CSb ◆ SetReadTimeout ◆ SetWriteTimeout
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