libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
qi::ServiceDirectoryProxy Class Reference

#include <servicedirectoryproxy.hpp>

Classes

struct  Status
 

Public Types

enum  IdValidationStatus { IdValidationStatus::Done, IdValidationStatus::PendingCheckOnListen }
 
enum  ListenStatus { ListenStatus::NotListening, ListenStatus::Listening, ListenStatus::Starting, ListenStatus::PendingConnection }
 
enum  ConnectionStatus { ConnectionStatus::NotConnected, ConnectionStatus::Connected, ConnectionStatus::Starting }
 
using ServiceFilter = std::function< bool(boost::string_ref)>
 

Public Member Functions

 ServiceDirectoryProxy (bool enforceAuth=true)
 
 ~ServiceDirectoryProxy ()
 
UrlVector endpoints () const
 
Future< ListenStatuslistenAsync (const Url &url)
 
Future< IdValidationStatussetValidateIdentity (const std::string &key, const std::string &crt)
 
void setAuthProviderFactory (AuthProviderFactoryPtr provider)
 
qi::Future< void > attachToServiceDirectory (const Url &serviceDirectoryUrl)
 
void close ()
 
Future< ServiceFiltersetServiceFilter (ServiceFilter filter=ka::constant_function(false))
 

Public Attributes

Property< bool > & connected
 
Property< Status > & status
 

Detailed Description

This class implements a proxy to a service directory that clients can connect to in order to access the service directory services. It does that by propagating the services from the service directory to itself and its own services back to the service directory.

It can also filter out some of the services to disable their access from clients.

The following diagram roughly explains how the service propagation is implemented:

*
* Proxy Client Proxy Service Directory SD Client
* ------------ ----- ----------------- ---------
* | | | |
* | --- Register service ---> | --- Mirror to SD -----> | |
* | --- Unregister service -> | --- Unmirror to SD ---> | |
* | | | |
* | | <-- Mirror from SD ---- | <- Register service --- |
* | | <-- Unmirror from SD -- | <- Unregister service - |
* | | | |
*
*

Definition at line 50 of file servicedirectoryproxy.hpp.

Member Typedef Documentation

using qi::ServiceDirectoryProxy::ServiceFilter = std::function<bool(boost::string_ref)>

Definition at line 77 of file servicedirectoryproxy.hpp.

Member Enumeration Documentation

Enumerator
NotConnected 

The proxy is not set to connect to the service directory.

Connected 

The proxy is connected to the service directory.

Starting 

The proxy started connection to the service directory.

Definition at line 70 of file servicedirectoryproxy.hpp.

Enumerator
Done 

The provided identity has been validated.

PendingCheckOnListen 

The provided identity is stored and will be validated on next listen.

Definition at line 55 of file servicedirectoryproxy.hpp.

Enumerator
NotListening 

The proxy is not set to listen.

Listening 

The proxy is successfully listening.

Starting 

The proxy started setup for listening.

PendingConnection 

The proxy is waiting for a connection to a service directory to start listening.

Definition at line 61 of file servicedirectoryproxy.hpp.

Constructor & Destructor Documentation

qi::ServiceDirectoryProxy::ServiceDirectoryProxy ( bool  enforceAuth = true)
Parameters
enforceAuthIf set to true, rejects clients that try to skip the authentication step. If false, accepts all incoming connections whether or not they authentify.
qi::ServiceDirectoryProxy::~ServiceDirectoryProxy ( )

Member Function Documentation

qi::Future<void> qi::ServiceDirectoryProxy::attachToServiceDirectory ( const Url serviceDirectoryUrl)
void qi::ServiceDirectoryProxy::close ( )
UrlVector qi::ServiceDirectoryProxy::endpoints ( ) const
Future<ListenStatus> qi::ServiceDirectoryProxy::listenAsync ( const Url url)
void qi::ServiceDirectoryProxy::setAuthProviderFactory ( AuthProviderFactoryPtr  provider)
Future<ServiceFilter> qi::ServiceDirectoryProxy::setServiceFilter ( ServiceFilter  filter = ka::constant_function(false))
Parameters
filterA function object that when passed the name of a service returns true if the service must be filtered and false if it must be made available. By default, this argument will be set to a function that always return false, thus filtering nothing.
Returns
The previous filter
Future<IdValidationStatus> qi::ServiceDirectoryProxy::setValidateIdentity ( const std::string &  key,
const std::string &  crt 
)

Member Data Documentation

Property<bool>& qi::ServiceDirectoryProxy::connected

Definition at line 104 of file servicedirectoryproxy.hpp.

Property<Status>& qi::ServiceDirectoryProxy::status

Definition at line 106 of file servicedirectoryproxy.hpp.


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