Provides RCF server-side functionality. More...
#include <RcfServer.hpp>
Inherits RCF::Noncopyable.
Public Member Functions | |
ServerTransport & | getServerTransport () |
Gets the first server transport of the RcfServer. More... | |
IpServerTransport & | getIpServerTransport () |
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. | |
ServerTransport & | addEndpoint (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 CertificateValidationCallback & | getCertificateValidationCallback () 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< Subscription > | createSubscription (T &servantObj, const RCF::Endpoint &publisherEp) |
Creates a subscription to a remote RCF publisher. More... | |
template<typename Interface , typename T > | |
std::shared_ptr< Subscription > | createSubscription (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... | |
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().
RCF::RcfServer::RcfServer | ( | ) |
Constructs an RcfServer instance with no initial server transport layers.
RCF::RcfServer::RcfServer | ( | const Endpoint & | endpoint | ) |
Constructs an RcfServer instance with one initial server transport layer.
RCF::RcfServer::RcfServer | ( | ServerTransportPtr | serverTransportPtr | ) |
Constructs an RcfServer instance with one initial server transport layer.
RCF::RcfServer::~RcfServer | ( | ) |
Destroys an RcfServer instance.
ServerTransport& RCF::RcfServer::addEndpoint | ( | const Endpoint & | endpoint | ) |
Adds another server transport layer to the RcfServer.
void RCF::RcfServer::start | ( | ) |
Starts the RcfServer. After starting, clients are able to connect to the server and execute remote calls.
void RCF::RcfServer::stop | ( | ) |
Stops the RcfServer. After stopping, clients are no longer able to connect to the server.
bool RCF::RcfServer::isStarted | ( | ) |
Returns true if the RcfServer has been started.
void RCF::RcfServer::enumerateProxyEndpoints | ( | std::vector< std::string > & | endpoints | ) |
Enumerates the proxy endpoints hosted on this RcfServer. See ProxyEndpoint.
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.
const std::vector<TransportProtocol>& RCF::RcfServer::getSupportedTransportProtocols | ( | ) | const |
Gets the supported encryption protocols for this RcfServer.
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().
ThreadPoolPtr RCF::RcfServer::getThreadPool | ( | ) |
Gets the thread pool for this RcfServer.
ServerTransport& RCF::RcfServer::getServerTransport | ( | ) |
Gets the first server transport of the RcfServer.
IpServerTransport& RCF::RcfServer::getIpServerTransport | ( | ) |
Gets the first server transport of the RcfServer, and casts it to an IpServerTransport.
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.
bool RCF::RcfServer::unbind | ( | const std::string & | name = "" | ) |
Removes a servant binding from the RcfServer.
void RCF::RcfServer::setCertificate | ( | CertificatePtr | certificatePtr | ) |
Sets the server-side SSL certificate the RcfServer presents to SSL-based clients.
CertificatePtr RCF::RcfServer::getCertificate | ( | ) |
Gets the server-side SSL certificate the RcfServer presents to SSL-based clients.
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.
std::string RCF::RcfServer::getOpenSslCipherSuite | ( | ) | const |
Gets the cipher suite to use when establishing an SSL connection. Only applicable to OpenSSL - based SSL.
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.
CertificatePtr RCF::RcfServer::getCaCertificate | ( | ) |
Gets the certificate authority certificate to use when validating certificates from a HTTPS client. Not applicable to Schannel-based SSL.
void RCF::RcfServer::setCertificateValidationCallback | ( | CertificateValidationCallback | certificateValidationCb | ) |
Sets the certificate validation callback, used to validate client certificates.
const CertificateValidationCallback& RCF::RcfServer::getCertificateValidationCallback | ( | ) | const |
Gets the certificate validation callback, used to validate client certificates.
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.
tstring RCF::RcfServer::getEnableSchannelCertificateValidation | ( | ) | const |
Gets the certificate name to match against, when validating a client certificate. Only applicable to Schannel-based SSL.
void RCF::RcfServer::setSslImplementation | ( | SslImplementation | sslImplementation | ) |
Sets the SSL implementation in use by this RcfServer (OpenSSL or Schannel).
SslImplementation RCF::RcfServer::getSslImplementation | ( | ) | const |
Gets the SSL implementation in use by this RcfServer (OpenSSL or Schannel).
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.
std::uint32_t RCF::RcfServer::getConnectionIdleTimeoutMs | ( | ) |
Gets the idle connection timeout value, in ms.
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.
std::uint32_t RCF::RcfServer::getConnectionIdleScanIntervalMs | ( | ) |
Gets the idle connection scan interval value, in ms.
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.
std::uint32_t RCF::RcfServer::getHttpSessionTimeoutMs | ( | ) |
Gets the HTTP session timeout value, in ms.
void RCF::RcfServer::setHttpServerHeader | ( | const std::string & | httpServerHeader | ) |
Sets the value of the "Server" header in HTTP responses.
std::string RCF::RcfServer::getHttpServerHeader | ( | ) | const |
Gets the value of the "Server" header in HTTP responses.
std::uint32_t RCF::RcfServer::getServerObjectHarvestingIntervalS | ( | ) | const |
Gets the server object harvesting interval, in s.
void RCF::RcfServer::setServerObjectHarvestingIntervalS | ( | std::uint32_t | harvestingIntervalS | ) |
Sets the server object harvesting interval, in s.
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.
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.
void RCF::RcfServer::deleteServerObject | ( | const std::string & | objectKey | ) |
Deletes the server object under the given key.
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.
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.
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.
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.
void RCF::RcfServer::setEnableProxyEndpoints | ( | bool | enable | ) |
Sets whether proxy endpoints are enabled on this RcfServer.
bool RCF::RcfServer::getEnableProxyEndpoints | ( | ) | const |
Gets whether proxy endpoints are enabled on this RcfServer.
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).
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).
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).
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).
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.
Path RCF::RcfServer::getUploadDirectory | ( | ) | const |
Gets the path under which client uploads are saved. Must be set before any files can be uploaded.
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.
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.
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.
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.
std::uint32_t RCF::RcfServer::getArchiveVersion | ( | ) |
Gets the archive version number used by this RcfServer.
void RCF::RcfServer::setArchiveVersion | ( | std::uint32_t | version | ) |
Sets the archive version number used by this RcfServer.