1 #ifndef CONNECT___NCBI_CONN_STREAM__HPP
2 #define CONNECT___NCBI_CONN_STREAM__HPP
144 fConn_ReadUnbuffered = 4,
145 fConn_WriteUnbuffered = 8
221 (
const TConnector& connector,
224 TConn_Flags
flags = 0,
235 string GetType(
void)
const;
241 string GetDescription(
void)
const;
338 CONN GetCONN(
void)
const;
357 void x_Destroy(
void);
494 unsigned short max_try,
528 unsigned short port = 0,
529 const void* data = 0,
624 const void* data = 0,
724 unsigned short port = 0,
774 void SetURL(
const string& url) { m_URL = url; }
791 static void sx_Cleanup (
void* data);
824 (
const string& service,
832 (
const string& service,
833 const string& user_header,
847 static void sx_Reset (
void* data);
851 static void sx_Cleanup (
void* data);
855 static const SSERV_Info* sx_GetNextInfo(
void* data,
910 void ToVector(vector<char>*);
943 const vector<string>& args,
945 size_t pipe_size = 0,
985 (
const string& pipename,
1013 (
const string& host,
1017 unsigned short port = 0,
1061 (
const string& host,
1063 const string& user =
"ftp",
1064 const string& pass =
"-none@",
1066 unsigned short port = 0,
1094 (
const string& host,
1099 unsigned short port = 0,
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
CConn_FtpStream specialization (ctor) for download.
CConn_FtpStream specialization (ctor) for upload.
CConn_FtpStream is an elaborate FTP client, can be used for data downloading and/or uploading to and ...
Helper base class for HTTP-like streams.
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
const STimeout * GetTimeout(void) const
const STimeout * GetTimeout(void) const
Helper class to build streams on top of CONNECTOR (internal use only).
Base class, inherited from "std::iostream", does both input and output, using the specified CONNECTOR...
In-memory stream (a la strstream or stringstream)
CConn_NamedPipeStream for inter-process communication.
CConn_PipeStream for command piping.
This stream exchanges data with a named service, in a constraint that the service is implemented as o...
This stream exchanges data in a TCP channel, using the SOCK socket API.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Interface for testing cancellation request in a long lasting operation.
static void cleanup(void)
static CS_CONNECTION * conn
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
int GetStatusCode(void) const
Get the last seen HTTP status code, if available.
CConn_IOStream & operator<<(CConn_IOStream &os, const CConn_IOStreamSetWriteTimeout &s)
Stream manipulator "os << SetWriteTimeout(timeout)".
SHTTP_StatusData m_StatusData
CConn_IOStreamSetReadTimeout(const STimeout *timeout)
CConn_IOStreamSetWriteTimeout SetWriteTimeout(const STimeout *timeout)
static const STimeout kZeroTimeout
Polling timeout with the 0.0 time in it.
const CTempString GetStatusText(void) const
Get the last seen HTTP status text, if available.
TConnector(CONNECTOR connector, EIO_Status status=eIO_Success)
SHTTP_StatusData(const SHTTP_StatusData &)
FHTTP_Adjust m_UserAdjust
const STimeout * GetTimeout(void) const
CConn_IOStream(const CConn_IOStream &)
const STimeout * m_Timeout
virtual EIO_Status Pushback(const CT_CHAR_TYPE *data, streamsize size)
Push the specified data "data" of size "size" back into the underlying connection CONN (making it loo...
EIO_Status SetTimeout(EIO_Event direction, const STimeout *timeout) const
Set connection timeout for "direction".
pair< CONNECTOR, EIO_Status > TConnPair
friend CConn_IOStreamSetReadTimeout SetReadTimeout(const STimeout *)
CConn_IOStreamSetTimeout(const STimeout *timeout)
CConn_IOStream & operator>>(CConn_IOStream &is, const CConn_IOStreamSetReadTimeout &s)
Stream manipulator "is >> SetReadTimeout(timeout)".
friend CConn_IOStreamSetWriteTimeout SetWriteTimeout(const STimeout *)
const string & GetHTTPHeader(void) const
Get the last seen HTTP header text, if available.
SHTTP_StatusData & operator=(const SHTTP_StatusData &)
CConn_IOStreamSetReadTimeout SetReadTimeout(const STimeout *timeout)
SOCK GetSOCK(void)
Get underlying SOCK, if available (e.g. after Fetch())
int GetExitCode(void) const
A valid exit code is only made available after an explicit Close()
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_.
const void * m_Ptr
pointer to read memory area (if owned)
FHTTP_Cleanup m_UserCleanup
CPipe & GetPipe(void)
Return an underlying CPipe; it's valid for as long as the stream exists.
CConn_HttpStream_Base(const TConnector &connector, const STimeout *timeout, size_t buf_size, TConn_Flags flags=0)
virtual EIO_Status Pushback(const CT_CHAR_TYPE *data, streamsize size)
Push the specified data "data" of size "size" back into the underlying connection CONN (making it loo...
EHTTP_HeaderParse Parse(const char *header)
FHTTP_ParseHeader m_UserParseHeader
CPipe * m_Pipe
Underlying pipe.
CSocket & GetSocket(void)
Get CSocket, if available (else empty).
unique_ptr< CConn_Streambuf > x_CSb
unsigned int TConn_Flags
bitwise OR of EConn_Flag
int m_ExitCode
Process exit code.
const size_t kConn_DefaultBufSize
I/O buffer size per direction.
CConn_IOStreamSetWriteTimeout(const STimeout *timeout)
CConstIRef< ICanceled > m_Canceled
void SetURL(const string &url)
Set new URL to hit next.
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
int(* FHTTP_Adjust)(SConnNetInfo *net_info, void *user_data, unsigned int failure_count)
unsigned int TCONN_Callback
void(* FHTTP_Cleanup)(void *user_data)
EHTTP_HeaderParse
The extended version HTTP_CreateConnectorEx() is able to track the HTTP response chain and also chang...
EHTTP_HeaderParse(* FHTTP_ParseHeader)(const char *http_header, void *user_data, int server_error)
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
@ fCONN_Untie
do not call flush method prior to reading
unsigned int TCreateFlags
bitwise OR of "ECreateFlag"
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int TSERV_Type
Bitwise OR of ESERV_Type[Special].
void Reset(SOCK sock, EOwnership if_to_own, ECopyTimeout whence)
Close the current underlying "SOCK" (if any, and if owned), and from now on use "sock" as the underly...
unsigned int TSOCK_Flags
bitwise "OR" of ESOCK_Flags
IO_PREFIX::iostream CNcbiIostream
Portable alias for iostream.
void clear(void)
Clears the string.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
EIO_Event
I/O event (or direction).
@ eIO_Success
everything is fine, no error occurred
@ eIO_Unknown
unknown I/O error (likely fatal but can retry)
@ eIO_Close
also serves as an error indicator in SOCK_Poll
#define NCBI_XCONNECT_EXPORT
const struct ncbi::grid::netcache::search::fields::SIZE size
static const STimeout kZeroTimeout
static int x_Pushback(SOCK sock, BUF buf)
Implement CONNECTOR for a named pipe interprocess communication (based on the NCBI CNamedPipe).
Implement CONNECTOR for a pipe interprocess communication (based on the NCBI CPipe).
Helper class to fetch HTTP status code and text.
static const struct type types[]
string ToString(const wxRect &rc)