NCBI C++ ToolKit
Public Member Functions | Protected Attributes | Static Private Member Functions | List of all members
CConn_ServiceStream Class Reference

Search Toolkit Book for 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...

#include <connect/ncbi_conn_stream.hpp>

+ Inheritance diagram for CConn_ServiceStream:
+ Collaboration diagram for CConn_ServiceStream:

Public Member Functions

 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 (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 ()
 
- Public Member Functions inherited from CConn_HttpStream_Base
int GetStatusCode (void) const
 Get the last seen HTTP status code, if available. More...
 
const CTempString GetStatusText (void) const
 Get the last seen HTTP status text, if available. More...
 
const stringGetHTTPHeader (void) const
 Get the last seen HTTP header text, if available. More...
 
- Public Member Functions inherited from 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...
 
virtual ~CConn_IOStream ()
 
string GetType (void) const
 
string GetDescription (void) const
 
EIO_Status SetTimeout (EIO_Event direction, const STimeout *timeout) const
 Set connection timeout for "direction". More...
 
const STimeoutGetTimeout (EIO_Event direction) const
 
EIO_Status Status (EIO_Event direction=eIO_Close) const
 
EIO_Status Fetch (const STimeout *timeout=kDefaultTimeout)
 Flush the stream and fetch the response (w/o extracting any user data) More...
 
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 look like received yet unread data). More...
 
SOCK GetSOCK (void)
 Get underlying SOCK, if available (e.g. after Fetch()) More...
 
CSocketGetSocket (void)
 Get CSocket, if available (else empty). More...
 
virtual EIO_Status Close (void)
 Close CONNection, free all internal buffers and underlying structures, and render the stream unusable for further I/O. More...
 
EIO_Status SetCanceledCallback (const ICanceled *canceled)
 Cancellation support. More...
 
CONN GetCONN (void) const
 
EIO_Status Wait (EIO_Event event, const STimeout *timeout=&kZeroTimeout)
 Equivalent to CONN_Wait(GetCONN(), event, timeout) More...
 

Protected Attributes

SSERVICE_Extra m_Extra
 
- Protected Attributes inherited from CConn_HttpStream_Base
SHTTP_StatusData m_StatusData
 
- Protected Attributes inherited from CConn_IOStream
CConn_Streambufm_CSb
 

Static Private Member Functions

static void sx_Reset (void *data)
 
static int sx_Adjust (SConnNetInfo *net_info, void *data, unsigned int count)
 
static void sx_Cleanup (void *data)
 
static EHTTP_HeaderParse sx_ParseHeader (const char *header, void *data, int code)
 
static const SSERV_Infosx_GetNextInfo (void *data, SERV_ITER iter)
 

Additional Inherited Members

- Public Types inherited from CConn_IOStream
enum  { fConn_Untie = fCONN_Untie , fConn_DelayOpen = 2 , fConn_ReadUnbuffered = 4 , fConn_WriteUnbuffered = 8 }
 The values below must be compatible with TCONN_Flags. More...
 
typedef unsigned int TConn_Flags
 bitwise OR of EConn_Flag More...
 
typedef pair< CONNECTOR, EIO_StatusTConnPair
 
- Public Attributes inherited from CConn_IOStream
enum CConn_IOStream:: { ... }  EConn_Flag
 The values below must be compatible with TCONN_Flags. More...
 
- Static Public Attributes inherited from CConn_IOStream
static const STimeout kZeroTimeout = { 0, 0 }
 Polling timeout with the 0.0 time in it. More...
 
- Protected Member Functions inherited from CConn_HttpStream_Base
 CConn_HttpStream_Base (const TConnector &connector, const STimeout *timeout, size_t buf_size, TConn_Flags flags=0)
 
- Protected Member Functions inherited from 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...
 
EIO_Status x_Pushback (const CT_CHAR_TYPE *data, streamsize size, bool push=false)
 
void x_Destroy (void)
 
- Protected Member Functions inherited from CConnIniter
 CConnIniter (void)
 

Detailed Description

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

Additional specifications can be passed in an SConnNetInfo structure, otherwise created by using the service name as a registry section to obtain the information from (details: <connect/ncbi_connutil.h>).

In case when the service is implemented over underlying HTTP (which is NOT generally guaranteed), the HTTP status data become available.

Provided "timeout" is set at the connection level, and if different from kDefaultTimeout, it overrides the value supplied by an underlying connector (the latter value is kept in SConnNetInfo::timeout).

See also
SERVICE_CreateConnector

Definition at line 826 of file ncbi_conn_stream.hpp.


The documentation for this class was generated from the following files:
Modified on Fri Jun 14 16:54:59 2024 by modify_doxy.py rev. 669887