Remote Call Framework 3.4
RCF::RcfServer Class Reference

Provides RCF server-side functionality. More...

#include <RcfServer.hpp>

Inherits RCF::Noncopyable.

Public Member Functions

ServerTransportgetServerTransport ()
 Gets the first server transport of the RcfServer. More...
 
IpServerTransportgetIpServerTransport ()
 Gets the first server transport of the RcfServer, and casts it to an IpServerTransport. More...
 
void setEnableProxyEndpoints (bool enable)
 Sets whether proxy endpoints are enabled on this RcfServer. More...
 
bool getEnableProxyEndpoints () const
 Gets whether proxy endpoints are enabled on this RcfServer. More...
 
std::uint32_t getArchiveVersion ()
 Gets the archive version number used by this RcfServer. More...
 
void setArchiveVersion (std::uint32_t version)
 Sets the archive version number used by this RcfServer. More...
 
Constructors and destructor
 RcfServer ()
 Constructs an RcfServer instance with no initial server transport layers. More...
 
 RcfServer (const Endpoint &endpoint)
 Constructs an RcfServer instance with one initial server transport layer. More...
 
 RcfServer (ServerTransportPtr serverTransportPtr)
 Constructs an RcfServer instance with one initial server transport layer. More...
 
 ~RcfServer ()
 Destroys an RcfServer instance. More...
 
Transports

This section describes functions relating to the transport layers of a RcfServer.

ServerTransportaddEndpoint (const Endpoint &endpoint)
 Adds another server transport layer to the RcfServer. More...
 
void start ()
 Starts the RcfServer. After starting, clients are able to connect to the server and execute remote calls. More...
 
void stop ()
 Stops the RcfServer. After stopping, clients are no longer able to connect to the server. More...
 
bool isStarted ()
 Returns true if the RcfServer has been started. More...
 
void enumerateProxyEndpoints (std::vector< std::string > &endpoints)
 Enumerates the proxy endpoints hosted on this RcfServer. See ProxyEndpoint. More...
 
void setSupportedTransportProtocols (const std::vector< TransportProtocol > &protocols)
 Sets the supported transport protocols for this RcfServer. More...
 
const std::vector< TransportProtocol > & getSupportedTransportProtocols () const
 Gets the supported encryption protocols for this RcfServer. More...
 
void setThreadPool (ThreadPoolPtr threadPoolPtr)
 
ThreadPoolPtr getThreadPool ()
 Gets the thread pool for this RcfServer. More...
 
Servant binding

This section describes functions related to servant binding. When clients make a remote call to a server, the call is routed to a corresponding servant object on the server. Servant objects are bound to a particular RCF interface, and must have functions that match the methods of the RCF interface.

template<typename InterfaceT , typename ImplementationT >
ServerBindingPtr bind (ImplementationT &servantObj, const std::string &name="")
 Creates a servant binding, exposing the servant object to remote calls through the RCF interface InterfaceT. More...
 
template<typename InterfaceT >
bool unbind (const std::string &name="")
 Removes a servant binding from the RcfServer. More...
 
SSL settings

This section describes functions relating to usage of SSL.

void setCertificate (CertificatePtr certificatePtr)
 Sets the server-side SSL certificate the RcfServer presents to SSL-based clients. More...
 
CertificatePtr getCertificate ()
 Gets the server-side SSL certificate the RcfServer presents to SSL-based clients. More...
 
void setOpenSslCipherSuite (const std::string &cipherSuite)
 Sets the cipher suite to use when establishing an SSL connection. Only applicable to OpenSSL - based SSL. More...
 
std::string getOpenSslCipherSuite () const
 Gets the cipher suite to use when establishing an SSL connection. Only applicable to OpenSSL - based SSL. More...
 
void setCaCertificate (CertificatePtr certificatePtr)
 Sets the certificate authority certificate to use when validating certificates from a HTTPS client. Not applicable to Schannel-based SSL. More...
 
CertificatePtr getCaCertificate ()
 Gets the certificate authority certificate to use when validating certificates from a HTTPS client. Not applicable to Schannel-based SSL. More...
 
void setCertificateValidationCallback (CertificateValidationCallback certificateValidationCb)
 Sets the certificate validation callback, used to validate client certificates. More...
 
const CertificateValidationCallbackgetCertificateValidationCallback () const
 Gets the certificate validation callback, used to validate client certificates. More...
 
void setEnableSchannelCertificateValidation (const tstring &peerName)
 Sets the certificate name to match against, when validating a client certificate. Only applicable to Schannel-based SSL. More...
 
tstring getEnableSchannelCertificateValidation () const
 Gets the certificate name to match against, when validating a client certificate. Only applicable to Schannel-based SSL. More...
 
void setSslImplementation (SslImplementation sslImplementation)
 Sets the SSL implementation in use by this RcfServer (OpenSSL or Schannel). More...
 
SslImplementation getSslImplementation () const
 Gets the SSL implementation in use by this RcfServer (OpenSSL or Schannel). More...
 
Timeout settings

This section describes functions related to server timeout settings.

void setConnectionIdleTimeoutMs (std::uint32_t idleConnectionTimeoutMs)
 Sets the idle connection timeout value, in ms. More...
 
std::uint32_t getConnectionIdleTimeoutMs ()
 Gets the idle connection timeout value, in ms. More...
 
void setConnectionIdleScanIntervalMs (std::uint32_t idleConnectionScanIntervalMs)
 Sets the idle connection scan interval value, in ms. More...
 
std::uint32_t getConnectionIdleScanIntervalMs ()
 Gets the idle connection scan interval value, in ms. More...
 
void setHttpSessionTimeoutMs (std::uint32_t httpSessionTimeoutMs)
 Sets the HTTP session timeout value, in ms. More...
 
std::uint32_t getHttpSessionTimeoutMs ()
 Gets the HTTP session timeout value, in ms. More...
 
void setHttpServerHeader (const std::string &httpServerHeader)
 Sets the value of the "Server" header in HTTP responses. More...
 
std::string getHttpServerHeader () const
 Gets the value of the "Server" header in HTTP responses. More...
 
void setHttpMessageVerifier (HttpMessageVerifierPtr verifierPtr)
 
HttpMessageVerifierPtr getHttpMessageVerifier () const
 
void setHealthCheckResponse (int statusCode, std::string statusMessage, std::string content)
 
void getHealthCheckResponse (int &statusCode, std::string &statusMessage, std::string &content)
 
Server objects

This section describes functions related to server objects. Server objects are created by server-side application code. Server objects can be of arbitrary type, and are associated with a string identifier which must be unique within the server. Server objects have an associated timeout value, which determines how long a server object can be idle before the server cleans it up.

std::uint32_t getServerObjectHarvestingIntervalS () const
 Gets the server object harvesting interval, in s. More...
 
void setServerObjectHarvestingIntervalS (std::uint32_t harvestingIntervalS)
 Sets the server object harvesting interval, in s. More...
 
template<typename T >
std::shared_ptr< T > queryServerObject (const std::string &objectKey)
 Queries for a server object under the given key. Returns an empty std::shared_ptr if no object is found. More...
 
template<typename T >
std::shared_ptr< T > getServerObject (const std::string &objectKey, std::uint32_t timeoutMs)
 Queries or creates a server object under the given key. If creating the object, the timeout value is applicable and determines how long the object will be kept alive if left unused. More...
 
void deleteServerObject (const std::string &objectKey)
 Deletes the server object under the given key. More...
 
Publish/subscribe

This section describes functions related to publish/subscribe functionality.

template<typename Interface >
std::shared_ptr< Publisher< Interface > > createPublisher ()
 Creates a publisher instance for the given RCF interface. More...
 
template<typename Interface >
std::shared_ptr< Publisher< Interface > > createPublisher (const PublisherParms &parms)
 Creates a publisher instance for the given RCF interface. More...
 
template<typename Interface , typename T >
std::shared_ptr< SubscriptioncreateSubscription (T &servantObj, const RCF::Endpoint &publisherEp)
 Creates a subscription to a remote RCF publisher. More...
 
template<typename Interface , typename T >
std::shared_ptr< SubscriptioncreateSubscription (T &servantObj, const SubscriptionParms &parms)
 Creates a subscription to a remote RCF publisher. More...
 
File transfers

This section describes functions related to file transfers.

void setUploadBandwidthLimit (std::uint32_t uploadQuotaBps)
 Sets the total bandwidth limit for all uploads to this RcfServer. By default the bandwidth limit is zero (unlimited). More...
 
std::uint32_t getUploadBandwidthLimit () const
 Gets the total bandwidth limit for all uploads to this RcfServer. By default the bandwidth limit is zero (unlimited). More...
 
void setDownloadBandwidthLimit (std::uint32_t downloadQuotaBps)
 Sets the total bandwidth limit for all downloads from this RcfServer. By default the bandwidth limit is zero (unlimited). More...
 
std::uint32_t getDownloadBandwidthLimit () const
 Gets the total bandwidth limit for all downloads from this RcfServer. By default the bandwidth limit is zero (unlimited). More...
 
void setUploadDirectory (const Path &uploadDir)
 Sets the path under which client uploads are saved. Must be set before any files can be uploaded. More...
 
Path getUploadDirectory () const
 Gets the path under which client uploads are saved. Must be set before any files can be uploaded. More...
 
void setDownloadProgressCallback (DownloadProgressCallback downloadProgressCb)
 Sets the download progress callback for this RcfServer. The callback is called for every chunk that is transferred when a client is downloading a file. More...
 
void setUploadProgressCallback (UploadProgressCallback uploadProgressCb)
 Sets the upload progress callback for this RcfServer. The callback is called for every chunk that is transferred when a client is uploading a file. More...
 
void setUploadBandwidthQuotaCallback (UploadBandwidthQuotaCallback uploadQuotaCb)
 Sets a custom upload bandwidth quota callback. The callback is called when a upload begins, and allows the application to assign a bandwidth quota to that upload. More...
 
void setDownloadBandwidthQuotaCallback (DownloadBandwidthQuotaCallback downloadQuotaCb)
 Sets a custom download bandwidth quota callback. The callback is called when a download begins, and allows the application to assign a bandwidth quota to that download. More...
 

Detailed Description

Provides RCF server-side functionality.

An RcfServer instance listens on one or more server transport layers, and responds to remote calls from RCF clients. Remote calls from RCF clients are routed through to servant bindings, configured with RcfServer::bind().

Constructor & Destructor Documentation

◆ RcfServer() [1/3]

RCF::RcfServer::RcfServer ( )

Constructs an RcfServer instance with no initial server transport layers.

◆ RcfServer() [2/3]

RCF::RcfServer::RcfServer ( const Endpoint endpoint)

Constructs an RcfServer instance with one initial server transport layer.

◆ RcfServer() [3/3]

RCF::RcfServer::RcfServer ( ServerTransportPtr  serverTransportPtr)

Constructs an RcfServer instance with one initial server transport layer.

◆ ~RcfServer()

RCF::RcfServer::~RcfServer ( )

Destroys an RcfServer instance.

Member Function Documentation

◆ addEndpoint()

ServerTransport& RCF::RcfServer::addEndpoint ( const Endpoint endpoint)

Adds another server transport layer to the RcfServer.

◆ start()

void RCF::RcfServer::start ( )

Starts the RcfServer. After starting, clients are able to connect to the server and execute remote calls.

◆ stop()

void RCF::RcfServer::stop ( )

Stops the RcfServer. After stopping, clients are no longer able to connect to the server.

◆ isStarted()

bool RCF::RcfServer::isStarted ( )

Returns true if the RcfServer has been started.

◆ enumerateProxyEndpoints()

void RCF::RcfServer::enumerateProxyEndpoints ( std::vector< std::string > &  endpoints)

Enumerates the proxy endpoints hosted on this RcfServer. See ProxyEndpoint.

◆ setSupportedTransportProtocols()

void RCF::RcfServer::setSupportedTransportProtocols ( const std::vector< TransportProtocol > &  protocols)

Sets the supported transport protocols for this RcfServer.

If one or more transport protocols are specified, then clients are required to use one of the specified transport protocols to connect to the server. If no encryption protocols are specified, then clients may use any transport protocol to connect to the server.

◆ getSupportedTransportProtocols()

const std::vector<TransportProtocol>& RCF::RcfServer::getSupportedTransportProtocols ( ) const

Gets the supported encryption protocols for this RcfServer.

◆ setThreadPool()

void RCF::RcfServer::setThreadPool ( ThreadPoolPtr  threadPoolPtr)

Sets the thread pool for this RcfServer to use when dispatching remote calls. The thread pool specified by this function is used by all the transports of the RcfServer. If you want a particular transport to use a different thread pool, use RCF::ServerTransport::setThreadPool().

◆ getThreadPool()

ThreadPoolPtr RCF::RcfServer::getThreadPool ( )

Gets the thread pool for this RcfServer.

◆ getServerTransport()

ServerTransport& RCF::RcfServer::getServerTransport ( )

Gets the first server transport of the RcfServer.

◆ getIpServerTransport()

IpServerTransport& RCF::RcfServer::getIpServerTransport ( )

Gets the first server transport of the RcfServer, and casts it to an IpServerTransport.

◆ bind()

template<typename InterfaceT , typename ImplementationT >
ServerBindingPtr RCF::RcfServer::bind ( ImplementationT &  servantObj,
const std::string &  name = "" 
)

Creates a servant binding, exposing the servant object to remote calls through the RCF interface InterfaceT.

The servant binding name is optional and normally only needed if you are creating several servant bindings for a single RCF interface.

◆ unbind()

template<typename InterfaceT >
bool RCF::RcfServer::unbind ( const std::string &  name = "")

Removes a servant binding from the RcfServer.

◆ setCertificate()

void RCF::RcfServer::setCertificate ( CertificatePtr  certificatePtr)

Sets the server-side SSL certificate the RcfServer presents to SSL-based clients.

◆ getCertificate()

CertificatePtr RCF::RcfServer::getCertificate ( )

Gets the server-side SSL certificate the RcfServer presents to SSL-based clients.

◆ setOpenSslCipherSuite()

void RCF::RcfServer::setOpenSslCipherSuite ( const std::string &  cipherSuite)

Sets the cipher suite to use when establishing an SSL connection. Only applicable to OpenSSL - based SSL.

◆ getOpenSslCipherSuite()

std::string RCF::RcfServer::getOpenSslCipherSuite ( ) const

Gets the cipher suite to use when establishing an SSL connection. Only applicable to OpenSSL - based SSL.

◆ setCaCertificate()

void RCF::RcfServer::setCaCertificate ( CertificatePtr  certificatePtr)

Sets the certificate authority certificate to use when validating certificates from a HTTPS client. Not applicable to Schannel-based SSL.

◆ getCaCertificate()

CertificatePtr RCF::RcfServer::getCaCertificate ( )

Gets the certificate authority certificate to use when validating certificates from a HTTPS client. Not applicable to Schannel-based SSL.

◆ setCertificateValidationCallback()

void RCF::RcfServer::setCertificateValidationCallback ( CertificateValidationCallback  certificateValidationCb)

Sets the certificate validation callback, used to validate client certificates.

◆ getCertificateValidationCallback()

const CertificateValidationCallback& RCF::RcfServer::getCertificateValidationCallback ( ) const

Gets the certificate validation callback, used to validate client certificates.

◆ setEnableSchannelCertificateValidation()

void RCF::RcfServer::setEnableSchannelCertificateValidation ( const tstring &  peerName)

Sets the certificate name to match against, when validating a client certificate. Only applicable to Schannel-based SSL.

◆ getEnableSchannelCertificateValidation()

tstring RCF::RcfServer::getEnableSchannelCertificateValidation ( ) const

Gets the certificate name to match against, when validating a client certificate. Only applicable to Schannel-based SSL.

◆ setSslImplementation()

void RCF::RcfServer::setSslImplementation ( SslImplementation  sslImplementation)

Sets the SSL implementation in use by this RcfServer (OpenSSL or Schannel).

◆ getSslImplementation()

SslImplementation RCF::RcfServer::getSslImplementation ( ) const

Gets the SSL implementation in use by this RcfServer (OpenSSL or Schannel).

◆ setConnectionIdleTimeoutMs()

void RCF::RcfServer::setConnectionIdleTimeoutMs ( std::uint32_t  idleConnectionTimeoutMs)

Sets the idle connection timeout value, in ms.

Client connections will be dropped if they remain idle long enough for the timeout setting to apply. A connection is idle if no remote calls are being made on it.

◆ getConnectionIdleTimeoutMs()

std::uint32_t RCF::RcfServer::getConnectionIdleTimeoutMs ( )

Gets the idle connection timeout value, in ms.

◆ setConnectionIdleScanIntervalMs()

void RCF::RcfServer::setConnectionIdleScanIntervalMs ( std::uint32_t  idleConnectionScanIntervalMs)

Sets the idle connection scan interval value, in ms.

This setting controls how often the RcfServer scans for idle client connections.

◆ getConnectionIdleScanIntervalMs()

std::uint32_t RCF::RcfServer::getConnectionIdleScanIntervalMs ( )

Gets the idle connection scan interval value, in ms.

◆ setHttpSessionTimeoutMs()

void RCF::RcfServer::setHttpSessionTimeoutMs ( std::uint32_t  httpSessionTimeoutMs)

Sets the HTTP session timeout value, in ms.

This setting controls how long idle HTTP sessions are allowed to persist on the server, before being destroyed.

◆ getHttpSessionTimeoutMs()

std::uint32_t RCF::RcfServer::getHttpSessionTimeoutMs ( )

Gets the HTTP session timeout value, in ms.

◆ setHttpServerHeader()

void RCF::RcfServer::setHttpServerHeader ( const std::string &  httpServerHeader)

Sets the value of the "Server" header in HTTP responses.

◆ getHttpServerHeader()

std::string RCF::RcfServer::getHttpServerHeader ( ) const

Gets the value of the "Server" header in HTTP responses.

◆ getServerObjectHarvestingIntervalS()

std::uint32_t RCF::RcfServer::getServerObjectHarvestingIntervalS ( ) const

Gets the server object harvesting interval, in s.

◆ setServerObjectHarvestingIntervalS()

void RCF::RcfServer::setServerObjectHarvestingIntervalS ( std::uint32_t  harvestingIntervalS)

Sets the server object harvesting interval, in s.

◆ queryServerObject()

template<typename T >
std::shared_ptr<T> RCF::RcfServer::queryServerObject ( const std::string &  objectKey)

Queries for a server object under the given key. Returns an empty std::shared_ptr if no object is found.

◆ getServerObject()

template<typename T >
std::shared_ptr<T> RCF::RcfServer::getServerObject ( const std::string &  objectKey,
std::uint32_t  timeoutMs 
)

Queries or creates a server object under the given key. If creating the object, the timeout value is applicable and determines how long the object will be kept alive if left unused.

◆ deleteServerObject()

void RCF::RcfServer::deleteServerObject ( const std::string &  objectKey)

Deletes the server object under the given key.

◆ createPublisher() [1/2]

template<typename Interface >
std::shared_ptr< Publisher<Interface> > RCF::RcfServer::createPublisher ( )

Creates a publisher instance for the given RCF interface.

Use the Publisher::publish() function on the returned Publisher instance, to publish remote calls to all listening subscribers.

◆ createPublisher() [2/2]

template<typename Interface >
std::shared_ptr< Publisher<Interface> > RCF::RcfServer::createPublisher ( const PublisherParms parms)

Creates a publisher instance for the given RCF interface.

Use the Publisher::publish() function on the returned Publisher instance, to publish remote calls to all listening subscribers.

◆ createSubscription() [1/2]

template<typename Interface , typename T >
std::shared_ptr< Subscription > RCF::RcfServer::createSubscription ( T &  servantObj,
const RCF::Endpoint publisherEp 
)

Creates a subscription to a remote RCF publisher.

Remote calls from the publisher will be routed to the given servant object.

◆ createSubscription() [2/2]

template<typename Interface , typename T >
std::shared_ptr< Subscription > RCF::RcfServer::createSubscription ( T &  servantObj,
const SubscriptionParms parms 
)

Creates a subscription to a remote RCF publisher.

Remote calls from the publisher will be routed to the given servant object.

◆ setEnableProxyEndpoints()

void RCF::RcfServer::setEnableProxyEndpoints ( bool  enable)

Sets whether proxy endpoints are enabled on this RcfServer.

◆ getEnableProxyEndpoints()

bool RCF::RcfServer::getEnableProxyEndpoints ( ) const

Gets whether proxy endpoints are enabled on this RcfServer.

◆ setUploadBandwidthLimit()

void RCF::RcfServer::setUploadBandwidthLimit ( std::uint32_t  uploadQuotaBps)

Sets the total bandwidth limit for all uploads to this RcfServer. By default the bandwidth limit is zero (unlimited).

◆ getUploadBandwidthLimit()

std::uint32_t RCF::RcfServer::getUploadBandwidthLimit ( ) const

Gets the total bandwidth limit for all uploads to this RcfServer. By default the bandwidth limit is zero (unlimited).

◆ setDownloadBandwidthLimit()

void RCF::RcfServer::setDownloadBandwidthLimit ( std::uint32_t  downloadQuotaBps)

Sets the total bandwidth limit for all downloads from this RcfServer. By default the bandwidth limit is zero (unlimited).

◆ getDownloadBandwidthLimit()

std::uint32_t RCF::RcfServer::getDownloadBandwidthLimit ( ) const

Gets the total bandwidth limit for all downloads from this RcfServer. By default the bandwidth limit is zero (unlimited).

◆ setUploadDirectory()

void RCF::RcfServer::setUploadDirectory ( const Path uploadDir)

Sets the path under which client uploads are saved. Must be set before any files can be uploaded.

◆ getUploadDirectory()

Path RCF::RcfServer::getUploadDirectory ( ) const

Gets the path under which client uploads are saved. Must be set before any files can be uploaded.

◆ setDownloadProgressCallback()

void RCF::RcfServer::setDownloadProgressCallback ( DownloadProgressCallback  downloadProgressCb)

Sets the download progress callback for this RcfServer. The callback is called for every chunk that is transferred when a client is downloading a file.

◆ setUploadProgressCallback()

void RCF::RcfServer::setUploadProgressCallback ( UploadProgressCallback  uploadProgressCb)

Sets the upload progress callback for this RcfServer. The callback is called for every chunk that is transferred when a client is uploading a file.

◆ setUploadBandwidthQuotaCallback()

void RCF::RcfServer::setUploadBandwidthQuotaCallback ( UploadBandwidthQuotaCallback  uploadQuotaCb)

Sets a custom upload bandwidth quota callback. The callback is called when a upload begins, and allows the application to assign a bandwidth quota to that upload.

◆ setDownloadBandwidthQuotaCallback()

void RCF::RcfServer::setDownloadBandwidthQuotaCallback ( DownloadBandwidthQuotaCallback  downloadQuotaCb)

Sets a custom download bandwidth quota callback. The callback is called when a download begins, and allows the application to assign a bandwidth quota to that download.

◆ getArchiveVersion()

std::uint32_t RCF::RcfServer::getArchiveVersion ( )

Gets the archive version number used by this RcfServer.

◆ setArchiveVersion()

void RCF::RcfServer::setArchiveVersion ( std::uint32_t  version)

Sets the archive version number used by this RcfServer.


The documentation for this class was generated from the following file: