NCBI C++ ToolKit
Classes | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends
Connection Streams
+ Collaboration diagram for Connection Streams:

Classes

class  CConn_IOStream
 Base class, inherited from "std::iostream", does both input and output, using the specified CONNECTOR. More...
 
class  CConn_IOStream::TConnector
 Helper class to build streams on top of CONNECTOR (internal use only). More...
 
class  CConn_IOStreamSetTimeout
 
class  CConn_IOStreamSetReadTimeout
 
class  CConn_IOStreamSetWriteTimeout
 
class  CConn_SocketStream
 This stream exchanges data in a TCP channel, using the SOCK socket API. More...
 
struct  SHTTP_StatusData
 Helper class to fetch HTTP status code and text. More...
 
class  CConn_HttpStream_Base
 Helper base class for HTTP-like streams. More...
 
class  CConn_HttpStream
 This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?args]. More...
 
class  CConn_ServiceStream
 This stream exchanges data with a named service, in a constraint that the service is implemented as one of the specified server "types" (details: <connect/ncbi_server_info.h>). More...
 
class  CConn_MemoryStream
 In-memory stream (a la strstream or stringstream) More...
 
class  CConn_PipeStream
 CConn_PipeStream for command piping. More...
 
class  CConn_NamedPipeStream
 CConn_NamedPipeStream for inter-process communication. More...
 
class  CConn_FtpStream
 CConn_FtpStream is an elaborate FTP client, can be used for data downloading and/or uploading to and from an FTP server. More...
 
class  CConn_FTPDownloadStream
 CConn_FtpStream specialization (ctor) for download. More...
 
class  CConn_FTPUploadStream
 CConn_FtpStream specialization (ctor) for upload. More...
 

Typedefs

typedef unsigned int CConn_IOStream::TConn_Flags
 bitwise OR of EConn_Flag More...
 
typedef pair< CONNECTOR, EIO_StatusCConn_IOStream::TConnPair
 

Enumerations

enum  { CConn_IOStream::fConn_Untie = fCONN_Untie , CConn_IOStream::fConn_DelayOpen = 2 , CConn_IOStream::fConn_ReadUnbuffered = 4 , CConn_IOStream::fConn_WriteUnbuffered = 8 }
 The values below must be compatible with TCONN_Flags. More...
 

Functions

 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 STimeoutCConn_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...
 
CSocketCConn_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_IOStreamCConn_IOStream::operator= (const CConn_IOStream &)
 
const STimeoutCConn_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_IOStreamoperator>> (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_IOStreamoperator<< (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_StatusDataSHTTP_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 stringCConn_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_InfoCConn_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...
 
CPipeCConn_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_IOStreamNcbiOpenURL (const string &url, size_t buf_size=kConn_DefaultBufSize)
 Given a URL, open the data source and make it available for _reading_. More...
 

Variables

const size_t kConn_DefaultBufSize = 16384
 I/O buffer size per direction. More...
 
static const STimeout CConn_IOStream::kZeroTimeout = { 0, 0 }
 Polling timeout with the 0.0 time in it. More...
 
enum CConn_IOStream:: { ... }  CConn_IOStream::EConn_Flag
 The values below must be compatible with TCONN_Flags. More...
 
CConn_StreambufCConn_IOStream::m_CSb
 
unique_ptr< CConn_StreambufCConn_IOStream::x_CSb
 
CSocket CConn_IOStream::m_Socket
 
SCONN_Callback CConn_IOStream::m_CB [4]
 
CConstIRef< ICanceledCConn_IOStream::m_Canceled
 
const STimeoutCConn_IOStreamSetTimeout::m_Timeout
 
int SHTTP_StatusData::m_Code
 
CTempString SHTTP_StatusData::m_Text
 
string SHTTP_StatusData::m_Header
 
SHTTP_StatusData CConn_HttpStream_Base::m_StatusData
 
void * CConn_HttpStream::m_UserData
 
FHTTP_Adjust CConn_HttpStream::m_UserAdjust
 
FHTTP_Cleanup CConn_HttpStream::m_UserCleanup
 
FHTTP_ParseHeader CConn_HttpStream::m_UserParseHeader
 
string CConn_HttpStream::m_URL
 
SSERVICE_Extra CConn_ServiceStream::m_Extra
 
const void * CConn_MemoryStream::m_Ptr
 pointer to read memory area (if owned) More...
 
CPipeCConn_PipeStream::m_Pipe
 Underlying pipe. More...
 
int CConn_PipeStream::m_ExitCode
 Process exit code. More...
 
SFTP_Callback CConn_FtpStream::m_Cmcb
 

Friends

CConn_IOStreamSetReadTimeout CConn_IOStreamSetReadTimeout::SetReadTimeout (const STimeout *)
 
CConn_IOStreamSetWriteTimeout CConn_IOStreamSetWriteTimeout::SetWriteTimeout (const STimeout *)
 

Detailed Description

Typedef Documentation

◆ TConn_Flags

typedef unsigned int CConn_IOStream::TConn_Flags

bitwise OR of EConn_Flag

Definition at line 147 of file ncbi_conn_stream.hpp.

◆ TConnPair

Definition at line 184 of file ncbi_conn_stream.hpp.

Enumeration Type Documentation

◆ anonymous enum

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.

Function Documentation

◆ CConn_FTPDownloadStream() [1/2]

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 
)
Parameters
offsetfile offset to begin download at

Definition at line 1404 of file ncbi_conn_stream.cpp.

References offset, SConnNetInfo::path, and CConn_FTPDownloadStream::x_InitDownload().

◆ 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 
)
Parameters
port0 means default (21 for FTP)
offsetfile offset to begin download at

Definition at line 1385 of file ncbi_conn_stream.cpp.

References file, offset, and CConn_FTPDownloadStream::x_InitDownload().

◆ CConn_FtpStream() [1/2]

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 
)

Definition at line 1303 of file ncbi_conn_stream.cpp.

◆ CConn_FtpStream() [2/2]

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 
)

Definition at line 1275 of file ncbi_conn_stream.cpp.

◆ CConn_FTPUploadStream() [1/2]

CConn_FTPUploadStream::CConn_FTPUploadStream ( const SConnNetInfo net_info,
TFTP_Flags  flag = 0,
Uint8  offset = 0,
const STimeout timeout = kDefaultTimeout 
)
Parameters
offsetfile offset to start upload at

Definition at line 1455 of file ncbi_conn_stream.cpp.

References offset, SConnNetInfo::path, and CConn_FTPUploadStream::x_InitUpload().

◆ CConn_FTPUploadStream() [2/2]

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 
)
Parameters
port0 means default (21 for FTP)
offsetfile offset to start upload at

Definition at line 1438 of file ncbi_conn_stream.cpp.

References file, offset, and CConn_FTPUploadStream::x_InitUpload().

◆ CConn_HttpStream() [1/5]

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 
)

Definition at line 738 of file ncbi_conn_stream.cpp.

◆ CConn_HttpStream() [2/5]

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 
)
Parameters
portdefault(e.g. 80=HTTP/443=HTTPS)

Definition at line 616 of file ncbi_conn_stream.cpp.

◆ CConn_HttpStream() [3/5]

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 
)

Definition at line 703 of file ncbi_conn_stream.cpp.

◆ CConn_HttpStream() [4/5]

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 
)

Definition at line 674 of file ncbi_conn_stream.cpp.

◆ CConn_HttpStream() [5/5]

CConn_HttpStream::CConn_HttpStream ( const string url,
THTTP_Flags  flags = fHTTP_AutoReconnect,
const STimeout timeout = kDefaultTimeout,
size_t  buf_size = kConn_DefaultBufSize 
)

Definition at line 647 of file ncbi_conn_stream.cpp.

◆ CConn_HttpStream_Base()

CConn_HttpStream_Base::CConn_HttpStream_Base ( const TConnector connector,
const STimeout timeout,
size_t  buf_size,
TConn_Flags  flags = 0 
)
inlineprotected
See also
CConn_IOStream

Definition at line 678 of file ncbi_conn_stream.hpp.

◆ CConn_IOStream() [1/3]

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".

Parameters
connA C object of type CONN (ncbi_connection.h) on top of which the stream is being constructed. May not be NULL.
closeTrue if to close CONN automatically (otherwise CONN remains open)
timeoutDefault I/O timeout (including to open the stream)
buf_sizeDefault size of underlying stream buffer's I/O arena (per direction)
flagsSpecifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input) and what to buffer
ptrSpecifies data which will be read from the stream prior to extracting from the actual connection (must not be modified while I/O not done)
sizeThe size of the area pointed to by the "ptr" argument
Note
On MSVC, "size" may not be generally more than 2GB-1 (the signed 32-bit int limit)
See also
CONN, ncbi_connection.h

Definition at line 70 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::CConn_IOStream ( const CConn_IOStream )
private

◆ CConn_IOStream() [3/3]

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 
)
protected

Create a stream based on CONNECTOR – only for internal use in derived classes.

The passed CONNECTOR always gets closed by stream dtor.

Parameters
connectorCONNECTOR coupled with an error code (if any)
timeoutDefault I/O timeout (including to open the stream)
buf_sizeDefault size of underlying stream buffer's I/O arena (per direction)
flagsSpecifies whether to tie input and output (a tied stream flushes all pending output prior to doing any input), and what to buffer
ptrSpecifies data which will be read from the stream prior to extracting from the actual connection (must not be modified while I/O not done)
sizeThe size of the area pointed to by the "ptr" argument
Note
On MSVC, "size" may not be generally more than 2GB-1 (the signed 32-bit int limit)

Definition at line 56 of file ncbi_conn_stream.cpp.

References eIO_Close, eIO_Success, init(), CConn_IOStream::m_CSb, and CConn_IOStream::x_CSb.

◆ CConn_IOStreamSetReadTimeout()

CConn_IOStreamSetReadTimeout::CConn_IOStreamSetReadTimeout ( const STimeout timeout)
inlineprotected

Definition at line 406 of file ncbi_conn_stream.hpp.

◆ CConn_IOStreamSetTimeout()

CConn_IOStreamSetTimeout::CConn_IOStreamSetTimeout ( const STimeout timeout)
inlineprotected

Definition at line 391 of file ncbi_conn_stream.hpp.

◆ CConn_IOStreamSetWriteTimeout()

CConn_IOStreamSetWriteTimeout::CConn_IOStreamSetWriteTimeout ( const STimeout timeout)
inlineprotected

Definition at line 435 of file ncbi_conn_stream.hpp.

◆ CConn_MemoryStream() [1/3]

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).

BUF's ownership is assumed by the stream as specified in "owner".

Definition at line 1058 of file ncbi_conn_stream.cpp.

◆ CConn_MemoryStream() [2/3]

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.

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.

Note
On MSVC, "size" may not be generally more than 2GB-1 (the signed 32-bit int limit); so if a larger area needs to be converted to a stream, then a BUF over the area needs to be built first, and then passed to the first version of the stream constructor.
Parameters
ownerno default for safety

Definition at line 1074 of file ncbi_conn_stream.cpp.

◆ CConn_MemoryStream() [3/3]

CConn_MemoryStream::CConn_MemoryStream ( size_t  buf_size = kConn_DefaultBufSize)

Definition at line 1049 of file ncbi_conn_stream.cpp.

◆ CConn_NamedPipeStream()

CConn_NamedPipeStream::CConn_NamedPipeStream ( const string pipename,
size_t  pipesize = 0,
const STimeout timeout = kDefaultTimeout,
size_t  buf_size = kConn_DefaultBufSize 
)

Definition at line 1199 of file ncbi_conn_stream.cpp.

◆ CConn_PipeStream()

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 
)

Definition at line 1163 of file ncbi_conn_stream.cpp.

◆ CConn_ServiceStream() [1/2]

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 
)

Definition at line 939 of file ncbi_conn_stream.cpp.

◆ CConn_ServiceStream() [2/2]

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 
)

Definition at line 909 of file ncbi_conn_stream.cpp.

◆ CConn_SocketStream() [1/5]

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.

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_infoConnection point and proxy tunnel location
dataPointer to block of data to send once connection is ready
sizeSize of the data block to send (or 0 if to send nothing)
flgsSocket flags (see <connect/ncbi_socket.h>)
timeoutDefault I/O timeout
buf_sizeDefault buffer size
flagsSpecifies 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 471 of file ncbi_conn_stream.cpp.

◆ CConn_SocketStream() [2/5]

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.

Parameters
hostHost to connect to
port... and port number
max_tryNumber of attempts
timeoutDefault I/O timeout
buf_sizeDefault buffer size
flagsSpecifies 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
hosthost to connect to
port... and port number
max_trynumber of attempts

Definition at line 252 of file ncbi_conn_stream.cpp.

◆ CConn_SocketStream() [3/5]

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.

Parameters
hostHost to connect to
port... and port number (however, see a note below)
dataPointer to block of data to send once connection is ready
sizeSize of the data block to send (or 0 if to send nothing)
flgsSocket flgs (see <connect/ncbi_socket.h>)
max_tryNumber of attempts
timeoutDefault I/O timeout
buf_sizeDefault buffer size
flagsSpecifies 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
hosthost[:port] to connect
port... and port number
datainitial data block
sizesize of the data block
flgssee ncbi_socket.h
max_trynumber of attempts

Definition at line 304 of file ncbi_conn_stream.cpp.

◆ CConn_SocketStream() [4/5]

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.

NOTE: this always revokes all ownership of the "socket"'s internals (effectively leaving the CSocket empty); CIO_Exception(eInvalidArg) is thrown if the internal SOCK is not owned by the passed CSocket. More details: <ncbi_socket_connector.h>SOCK_CreateConnectorOnTop().

Parameters
socketSocket to build the stream up on
timeoutDefault I/O timeout
buf_sizeDefault buffer size
flagsSpecifies 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.hpp, SOCK_CreateConnectorOnTop
Parameters
socketsocket, underlying SOCK always grabbed

Definition at line 355 of file ncbi_conn_stream.cpp.

◆ CConn_SocketStream() [5/5]

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.

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
sockSocket to build the stream on
if_to_ownWhether the sock object is owned (managed) by the stream at dtor
timeoutDefault I/O timeout
buf_sizeDefault buffer size
flagsSpecifies 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
socksocket
if_to_ownwhether stream to own "sock" param

Definition at line 321 of file ncbi_conn_stream.cpp.

◆ Clear()

void SHTTP_StatusData::Clear ( void  )
inline

◆ Close() [1/2]

EIO_Status CConn_IOStream::Close ( void  )
virtual

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 180 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]

EIO_Status CConn_PipeStream::Close ( void  )
virtual

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 from CConn_IOStream.

Definition at line 1186 of file ncbi_conn_stream.cpp.

References CPipe::Close(), CConn_IOStream::Close(), eIO_Write, CConn_PipeStream::m_ExitCode, CConn_PipeStream::m_Pipe, and CConn_IOStream::Status().

◆ Drain()

EIO_Status CConn_FtpStream::Drain ( const STimeout timeout = kDefaultTimeout)
virtual

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 1349 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()

EIO_Status CConn_IOStream::Fetch ( const STimeout timeout = kDefaultTimeout)

Flush the stream and fetch the response (w/o extracting any user data)

Returns
eIO_Success if the operation was successful, and some input (including none in case of EOF) will be available upon read

Definition at line 136 of file ncbi_conn_stream.cpp.

References conn, eIO_NotSupported, CConn_Streambuf::Fetch(), GET_CONN, CConn_IOStream::m_CSb, and NcbiBadbit.

Referenced by CCDDClient::JustAsk(), and CID2Client::JustAsk().

◆ GetBUF()

BUF CConn_MemoryStream::GetBUF ( void  )

Get the underlying BUF handle (it still remains managed by the stream)

Note
Causes the stream to flush().

Definition at line 1142 of file ncbi_conn_stream.cpp.

References CConn_IOStream::GetCONN(), SConnectorTag::handle, and SMetaConnector::list.

◆ GetCONN()

CONN CConn_IOStream::GetCONN ( void  ) const

◆ GetDescription()

string CConn_IOStream::GetDescription ( void  ) const
Returns
Verbal connection description (empty if unknown)
See also
CONN_Description

Definition at line 107 of file ncbi_conn_stream.cpp.

References conn, CONN_Description(), GET_CONN, kEmptyStr, CConn_IOStream::m_CSb, and text().

Referenced by CConnTest::ConnStatus().

◆ GetExitCode()

int CConn_PipeStream::GetExitCode ( void  ) const
inline

A valid exit code is only made available after an explicit Close()

See also
CProcess::CExitInfo

Definition at line 968 of file ncbi_conn_stream.hpp.

References CConn_PipeStream::m_ExitCode.

◆ GetHTTPHeader()

const string& CConn_HttpStream_Base::GetHTTPHeader ( void  ) const
inline

Get the last seen HTTP header text, if available.

Definition at line 673 of file ncbi_conn_stream.hpp.

References SHTTP_StatusData::m_Header, and CConn_HttpStream_Base::m_StatusData.

Referenced by CUrlUtils::GetLastModified(), CUrlUtils::IfModifiedSince(), and CHttpRequest::sx_ParseHeader().

◆ GetPipe()

CPipe& CConn_PipeStream::GetPipe ( void  )
inline

Return an underlying CPipe; it's valid for as long as the stream exists.

See also
CPipe

Definition at line 973 of file ncbi_conn_stream.hpp.

References CConn_PipeStream::m_Pipe.

Referenced by edirect::Execute(), and CWindowMaskerJob::x_CreateProjectItems().

◆ GetSOCK()

SOCK CConn_IOStream::GetSOCK ( void  )

Get underlying SOCK, if available (e.g. after Fetch())

Definition at line 161 of file ncbi_conn_stream.cpp.

References _ASSERT, conn, CONN_GetSOCK(), eIO_Success, GET_CONN, and CConn_IOStream::m_CSb.

Referenced by CConn_IOStream::GetSocket().

◆ GetSocket()

CSocket & CConn_IOStream::GetSocket ( void  )
inline

Get CSocket, if available (else empty).

The returned CSocket doesn't own the underlying SOCK, and is valid for as long as the stream exists.

See also
CSocket, SOCK

Definition at line 458 of file ncbi_conn_stream.hpp.

References eCopyTimeoutsFromSOCK, eNoOwnership, CConn_IOStream::GetSOCK(), CConn_IOStream::m_Socket, and CSocket::Reset().

Referenced by CConnTest::CheckFWConnections().

◆ GetStatusCode()

int CConn_HttpStream_Base::GetStatusCode ( void  ) const
inline

◆ GetStatusText()

const CTempString CConn_HttpStream_Base::GetStatusText ( void  ) const
inline

Get the last seen HTTP status text, if available.

Definition at line 670 of file ncbi_conn_stream.hpp.

References CConn_HttpStream_Base::m_StatusData, and SHTTP_StatusData::m_Text.

Referenced by CHttpRequest::sx_ParseHeader().

◆ GetTimeout() [1/2]

const STimeout * CConn_IOStream::GetTimeout ( EIO_Event  direction) const
Returns
Connection timeout for "direction"
eIO_Success if succeeded; other error code if failed
See also
CONN_GetTimeout

Definition at line 123 of file ncbi_conn_stream.cpp.

References conn, CONN_GetTimeout(), GET_CONN, kDefaultTimeout, and CConn_IOStream::m_CSb.

Referenced by CRPCClient< TRequest, TReply >::GetTimeout().

◆ GetTimeout() [2/2]

const STimeout* CConn_IOStreamSetTimeout::GetTimeout ( void  ) const
inline

Definition at line 388 of file ncbi_conn_stream.hpp.

◆ GetType()

string CConn_IOStream::GetType ( void  ) const
Returns
Verbal connection type (empty if unknown)
See also
CONN_GetType

Definition at line 99 of file ncbi_conn_stream.cpp.

References conn, CONN_GetType(), GET_CONN, kEmptyStr, CConn_IOStream::m_CSb, and type.

Referenced by CConnTest::ConnStatus().

◆ NcbiOpenURL()

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_.

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 1515 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, 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<<()

CConn_IOStream& operator<< ( CConn_IOStream os,
const CConn_IOStreamSetWriteTimeout s 
)
inline

Stream manipulator "os << SetWriteTimeout(timeout)".

Definition at line 449 of file ncbi_conn_stream.hpp.

References eIO_Success, eIO_Write, CConn_IOStreamSetWriteTimeout::GetTimeout(), NcbiBadbit, and CConn_IOStream::SetTimeout().

◆ operator=() [1/2]

CConn_IOStream& CConn_IOStream::operator= ( const CConn_IOStream )
private

◆ operator=() [2/2]

SHTTP_StatusData& SHTTP_StatusData::operator= ( const SHTTP_StatusData )
private

◆ operator>>()

CConn_IOStream& operator>> ( CConn_IOStream is,
const CConn_IOStreamSetReadTimeout s 
)
inline

Stream manipulator "is >> SetReadTimeout(timeout)".

Definition at line 420 of file ncbi_conn_stream.hpp.

References eIO_Read, eIO_Success, CConn_IOStreamSetReadTimeout::GetTimeout(), NcbiBadbit, and CConn_IOStream::SetTimeout().

◆ Parse()

EHTTP_HeaderParse SHTTP_StatusData::Parse ( const char *  header)

◆ Pushback() [1/2]

virtual EIO_Status CConn_IOStream::Pushback ( const CT_CHAR_TYPE data,
streamsize  size 
)
inlinevirtual

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 302 of file ncbi_conn_stream.hpp.

References data, ncbi::grid::netcache::search::fields::size, and CConn_IOStream::x_Pushback().

◆ Pushback() [2/2]

virtual EIO_Status CConn_MemoryStream::Pushback ( const CT_CHAR_TYPE data,
streamsize  size 
)
inlinevirtual

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 912 of file ncbi_conn_stream.hpp.

References data, ncbi::grid::netcache::search::fields::size, and CConn_IOStream::x_Pushback().

◆ SetCanceledCallback()

EIO_Status CConn_IOStream::SetCanceledCallback ( const ICanceled canceled)

◆ SetReadTimeout()

CConn_IOStreamSetReadTimeout SetReadTimeout ( const STimeout timeout)
inline

Definition at line 413 of file ncbi_conn_stream.hpp.

◆ SetTimeout()

EIO_Status CConn_IOStream::SetTimeout ( EIO_Event  direction,
const STimeout timeout 
) const

Set connection timeout for "direction".

Parameters
Canaccept 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 115 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()

void CConn_HttpStream::SetURL ( const string url)
inline

Set new URL to hit next.

Definition at line 780 of file ncbi_conn_stream.hpp.

References CConn_HttpStream::m_URL.

◆ SetWriteTimeout()

CConn_IOStreamSetWriteTimeout SetWriteTimeout ( const STimeout timeout)
inline

Definition at line 442 of file ncbi_conn_stream.hpp.

◆ SHTTP_StatusData() [1/2]

SHTTP_StatusData::SHTTP_StatusData ( const SHTTP_StatusData )
private

◆ SHTTP_StatusData() [2/2]

SHTTP_StatusData::SHTTP_StatusData ( void  )
inline

Definition at line 646 of file ncbi_conn_stream.hpp.

◆ Status()

EIO_Status CConn_IOStream::Status ( EIO_Event  direction = eIO_Close) const
Returns
Status of the last I/O performed by the underlying CONN in the specified "direction" (either eIO_Open, IO_Read, or eIO_Write); if "direction" is not specified (eIO_Close), return status of the last CONN I/O performed by the stream – the intended use for the latter is to obtain more detailed information in cases what a stream operation or I/O has just failed.
Warning
This method is not a status of iostream! Neither this is the last EIO_Status value returned by the other stream methods.
See also
CONN_Status

Definition at line 130 of file ncbi_conn_stream.cpp.

References eIO_NotSupported, CConn_IOStream::m_CSb, and CConn_Streambuf::Status().

Referenced by CConnTest::CheckFWConnections(), CConn_PipeStream::Close(), CConnTest::ConnStatus(), CConn_FTPDownloadStream::x_InitDownload(), and CConn_FTPUploadStream::x_InitUpload().

◆ sx_Adjust() [1/2]

int CConn_HttpStream::sx_Adjust ( SConnNetInfo net_info,
void *  data,
unsigned int  count 
)
staticprivate

◆ 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()

EIO_Status CConn_FtpStream::sx_FtpCallback ( void *  data,
const char *  cmd,
const char *  arg 
)
staticprivate

◆ sx_GetNextInfo()

const SSERV_Info * CConn_ServiceStream::sx_GetNextInfo ( void *  data,
SERV_ITER  iter 
)
staticprivate

◆ sx_IsCanceled()

EIO_Status CConn_IOStream::sx_IsCanceled ( CONN  conn,
TCONN_Callback  type,
void *  data 
)
staticprivate

◆ sx_ParseHeader() [1/2]

EHTTP_HeaderParse CConn_HttpStream::sx_ParseHeader ( const char *  header,
void *  data,
int  code 
)
staticprivate

◆ sx_ParseHeader() [2/2]

EHTTP_HeaderParse CConn_ServiceStream::sx_ParseHeader ( const char *  header,
void *  data,
int  code 
)
staticprivate

◆ sx_Reset()

void CConn_ServiceStream::sx_Reset ( void *  data)
staticprivate

◆ TConnector()

CConn_IOStream::TConnector::TConnector ( CONNECTOR  connector,
EIO_Status  status = eIO_Success 
)
inline
Parameters
connectorA 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).
statusI/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 200 of file ncbi_conn_stream.hpp.

◆ ToString()

void CConn_MemoryStream::ToString ( string str)

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.

Note that the operation is considered an extraction, so it effectively empties the stream, and both methods actually move the data from the stream to the respective containers. fill in the data, NULL is not accepted

Definition at line 1095 of file ncbi_conn_stream.cpp.

References _ASSERT, NCBI_THROW, ncbi::grid::netcache::search::fields::size, and str().

Referenced by CFlatFileGenerator::GetSeqFeatText(), CProjectStorage::GetString(), RequestToString(), and CTMS_DisplayTrack_Client::x_HttpFetch().

◆ ToVector()

void CConn_MemoryStream::ToVector ( vector< char > *  vec)

fill in the data, NULL is not accepted

Definition at line 1118 of file ncbi_conn_stream.cpp.

References _ASSERT, NCBI_THROW, and ncbi::grid::netcache::search::fields::size.

Referenced by CProjectStorage::GetVector().

◆ Wait()

EIO_Status CConn_IOStream::Wait ( EIO_Event  event,
const STimeout timeout = &kZeroTimeout 
)

Equivalent to CONN_Wait(GetCONN(), event, timeout)

Parameters
eventeIO_Read or eIO_Write
timeoutTime 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 173 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()

void CConn_FTPUploadStream::x_InitUpload ( const string file,
Uint8  offset 
)
protected

◆ x_Pushback()

EIO_Status CConn_IOStream::x_Pushback ( const CT_CHAR_TYPE data,
streamsize  size,
bool  push = false 
)
protected

◆ ~CConn_FtpStream()

CConn_FtpStream::~CConn_FtpStream ( )
virtual

Definition at line 1327 of file ncbi_conn_stream.cpp.

References CConn_IOStream::x_Destroy().

◆ ~CConn_HttpStream()

CConn_HttpStream::~CConn_HttpStream ( )
virtual

Definition at line 772 of file ncbi_conn_stream.cpp.

References CConn_IOStream::x_Destroy().

◆ ~CConn_IOStream()

CConn_IOStream::~CConn_IOStream ( )
virtual

Definition at line 84 of file ncbi_conn_stream.cpp.

References CConn_IOStream::x_Destroy().

◆ ~CConn_MemoryStream()

CConn_MemoryStream::~CConn_MemoryStream ( )
virtual

◆ ~CConn_PipeStream()

CConn_PipeStream::~CConn_PipeStream ( )
virtual

Definition at line 1178 of file ncbi_conn_stream.cpp.

References CConn_PipeStream::m_Pipe, and CConn_IOStream::x_Destroy().

◆ ~CConn_ServiceStream()

CConn_ServiceStream::~CConn_ServiceStream ( )
virtual

Definition at line 969 of file ncbi_conn_stream.cpp.

References CConn_IOStream::x_Destroy().

Variable Documentation

◆ 

enum { ... } CConn_IOStream::EConn_Flag

The values below must be compatible with TCONN_Flags.

◆ kConn_DefaultBufSize

const size_t kConn_DefaultBufSize = 16384

I/O buffer size per direction.

Definition at line 109 of file ncbi_conn_stream.hpp.

◆ kZeroTimeout

const STimeout CConn_IOStream::kZeroTimeout = { 0, 0 }
static

Polling timeout with the 0.0 time in it.

Definition at line 138 of file ncbi_conn_stream.hpp.

◆ m_Canceled

CConstIRef<ICanceled> CConn_IOStream::m_Canceled
private

◆ m_CB

SCONN_Callback CConn_IOStream::m_CB[4]
private

◆ m_Cmcb

SFTP_Callback CConn_FtpStream::m_Cmcb
protected

Definition at line 1054 of file ncbi_conn_stream.hpp.

Referenced by CConn_FtpStream::sx_FtpCallback().

◆ m_Code

int SHTTP_StatusData::m_Code

◆ m_CSb

CConn_Streambuf* CConn_IOStream::m_CSb
protected

◆ m_ExitCode

int CConn_PipeStream::m_ExitCode
protected

Process exit code.

Definition at line 977 of file ncbi_conn_stream.hpp.

Referenced by CConn_PipeStream::Close(), and CConn_PipeStream::GetExitCode().

◆ m_Extra

SSERVICE_Extra CConn_ServiceStream::m_Extra
protected

◆ m_Header

string SHTTP_StatusData::m_Header

◆ m_Pipe

CPipe* CConn_PipeStream::m_Pipe
protected

◆ m_Ptr

const void* CConn_MemoryStream::m_Ptr
protected

pointer to read memory area (if owned)

Definition at line 930 of file ncbi_conn_stream.hpp.

Referenced by CConn_MemoryStream::~CConn_MemoryStream().

◆ m_Socket

CSocket CConn_IOStream::m_Socket
private

Definition at line 372 of file ncbi_conn_stream.hpp.

Referenced by CConn_IOStream::Close(), and CConn_IOStream::GetSocket().

◆ m_StatusData

SHTTP_StatusData CConn_HttpStream_Base::m_StatusData
protected

◆ m_Text

CTempString SHTTP_StatusData::m_Text

◆ m_Timeout

const STimeout* CConn_IOStreamSetTimeout::m_Timeout
private

Definition at line 396 of file ncbi_conn_stream.hpp.

Referenced by CConn_IOStreamSetWriteTimeout::GetTimeout().

◆ m_URL

string CConn_HttpStream::m_URL
protected

Definition at line 790 of file ncbi_conn_stream.hpp.

Referenced by CConn_HttpStream::SetURL(), and CConn_HttpStream::sx_Adjust().

◆ m_UserAdjust

FHTTP_Adjust CConn_HttpStream::m_UserAdjust
protected

Definition at line 785 of file ncbi_conn_stream.hpp.

Referenced by CConn_HttpStream::sx_Adjust().

◆ m_UserCleanup

FHTTP_Cleanup CConn_HttpStream::m_UserCleanup
protected

Definition at line 786 of file ncbi_conn_stream.hpp.

Referenced by CConn_HttpStream::sx_Cleanup().

◆ m_UserData

void* CConn_HttpStream::m_UserData
protected

◆ m_UserParseHeader

FHTTP_ParseHeader CConn_HttpStream::m_UserParseHeader
protected

Definition at line 787 of file ncbi_conn_stream.hpp.

Referenced by CConn_HttpStream::sx_ParseHeader().

◆ x_CSb

unique_ptr<CConn_Streambuf> CConn_IOStream::x_CSb
private

Friends

◆ SetReadTimeout

CConn_IOStreamSetReadTimeout SetReadTimeout ( const STimeout timeout)
friend

Definition at line 413 of file ncbi_conn_stream.hpp.

◆ SetWriteTimeout

CConn_IOStreamSetWriteTimeout SetWriteTimeout ( const STimeout timeout)
friend

Definition at line 442 of file ncbi_conn_stream.hpp.

Modified on Wed May 29 18:34:31 2024 by modify_doxy.py rev. 669887