Dmitigr Pgfe  1.1beta
The modern C++ API to PostgreSQL
Public Member Functions | List of all members
Connection_options Class Referenceabstract

Defines an interface to work with Connection options. More...

#include <dmitigr/pgfe/connection_options.hpp>

Public Member Functions

virtual ~Connection_options ()=default
 The destructor. More...
 
General options
virtual Connection_optionsset (Communication_mode value)=0
 Sets the communication mode. More...
 
virtual Communication_mode communication_mode () const =0
 
Options specific to the Unix Domain Sockets (UDS) communication mode.
Remarks
These options are not available on Microsoft Windows.
virtual Connection_optionsset_uds_directory (std::filesystem::path value)=0
 Sets absolute name of the directory where the Unix-domain socket file is located (usually /tmp). More...
 
virtual const std::filesystem::path & uds_directory () const =0
 
virtual Connection_optionsset_uds_file_extension (std::string value)=0
 Sets a Unix-domain socket file extension. More...
 
virtual const std::string & uds_file_extension () const =0
 
virtual Connection_optionsset_uds_require_server_process_username (std::optional< std::string > value)=0
 Sets obligation of verification that the server process is running under the specified username for successful authentication. More...
 
virtual const std::optional< std::string > & uds_require_server_process_username () const =0
 
Options specific to the TCP communication mode
virtual Connection_optionsset_tcp_keepalives_enabled (bool value)=0
 Sets the keepalives mode. More...
 
virtual bool is_tcp_keepalives_enabled () const =0
 
virtual Connection_optionsset_tcp_keepalives_idle (std::optional< std::chrono::seconds > value)=0
 Sets the interval (in seconds) after which start keepalives. More...
 
virtual std::optional< std::chrono::seconds > tcp_keepalives_idle () const =0
 
virtual Connection_optionsset_tcp_keepalives_interval (std::optional< std::chrono::seconds > value)=0
 Sets the interval (in seconds) between keepalives. More...
 
virtual std::optional< std::chrono::seconds > tcp_keepalives_interval () const =0
 
virtual Connection_optionsset_tcp_keepalives_count (std::optional< int > value)=0
 Sets the number of keepalives before connection lost. More...
 
virtual std::optional< int > tcp_keepalives_count () const =0
 
virtual Connection_optionsset_tcp_host_address (std::optional< std::string > value)=0
 Sets numeric IP address of the host to connect to. More...
 
virtual const std::optional< std::string > & tcp_host_address () const =0
 
virtual Connection_optionsset_tcp_host_name (std::optional< std::string > value)=0
 Sets name of the host to connect to. More...
 
virtual const std::optional< std::string > & tcp_host_name () const =0
 
virtual Connection_optionsset_tcp_host_port (const std::int_fast32_t value)=0
 Sets server's port number. More...
 
virtual std::int_fast32_t tcp_host_port () const =0
 
Authentication options
virtual Connection_optionsset_username (std::string value)=0
 Sets name of the role registered on the server. More...
 
virtual const std::string & username () const =0
 
virtual Connection_optionsset_database (std::string value)=0
 Sets name of the database on the server to connect to. More...
 
virtual const std::string & database () const =0
 
virtual Connection_optionsset_password (std::optional< std::string > value)=0
 Sets password for such authentication methods as Password Authentication, LDAP Authentication. More...
 
virtual const std::optional< std::string > & password () const =0
 
virtual Connection_optionsset_kerberos_service_name (std::optional< std::string > value)=0
 Sets Kerberos service name to use when authenticating with GSSAPI Authentication. More...
 
virtual const std::optional< std::string > & kerberos_service_name () const =0
 
SSL options
virtual Connection_optionsset_ssl_enabled (bool value)=0
 Sets the SSL mode enabled if (value == true), or disabled otherwise. More...
 
virtual bool is_ssl_enabled () const =0
 
virtual Connection_optionsset_ssl_compression_enabled (bool value)=0
 Sets the SSL compression enabled if (value == true), or disabled otherwise. More...
 
virtual bool is_ssl_compression_enabled () const =0
 
virtual Connection_optionsset_ssl_certificate_file (std::optional< std::filesystem::path > value)=0
 Sets the name of the file containing the SSL client certificate. More...
 
virtual const std::optional< std::filesystem::path > & ssl_certificate_file () const =0
 
virtual Connection_optionsset_ssl_private_key_file (std::optional< std::filesystem::path > value)=0
 Sets name of the file containing the SSL client private key. More...
 
virtual const std::optional< std::filesystem::path > & ssl_private_key_file () const =0
 
virtual Connection_optionsset_ssl_certificate_authority_file (std::optional< std::filesystem::path > value)=0
 Sets name of the file containing the SSL client certificate authority (CA). More...
 
virtual const std::optional< std::filesystem::path > & ssl_certificate_authority_file () const =0
 
virtual Connection_optionsset_ssl_certificate_revocation_list_file (std::optional< std::filesystem::path > value)=0
 Sets name of the file containing the SSL client certificate revocation list (CRL). More...
 
virtual const std::optional< std::filesystem::path > & ssl_certificate_revocation_list_file () const =0
 
virtual Connection_optionsset_ssl_server_host_name_verification_enabled (bool value)=0
 Sets obligation of verification that the requested server host name matches that in the certificate. More...
 
virtual bool is_ssl_server_host_name_verification_enabled () const =0
 

Constructors

virtual std::unique_ptr< Connectionmake_connection () const =0
 
virtual std::unique_ptr< Connection_optionsclone () const =0
 
static DMITIGR_PGFE_API std::unique_ptr< Connection_options > APIENTRY make ()
 

Detailed Description

Defines an interface to work with Connection options.

Constructor & Destructor Documentation

◆ ~Connection_options()

virtual ~Connection_options ( )
virtualdefault

The destructor.

Member Function Documentation

◆ clone()

virtual std::unique_ptr<Connection_options> clone ( ) const
pure virtual
Returns
The copy of this instance.

◆ communication_mode()

virtual Communication_mode communication_mode ( ) const
pure virtual
Returns
The current value of the option.
See also
set(Communication_mode)

◆ database()

virtual const std::string& database ( ) const
pure virtual
Returns
The current value of the option.
See also
set_database()

◆ is_ssl_compression_enabled()

virtual bool is_ssl_compression_enabled ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_compression_enabled()

◆ is_ssl_enabled()

virtual bool is_ssl_enabled ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_enabled()

◆ is_ssl_server_host_name_verification_enabled()

virtual bool is_ssl_server_host_name_verification_enabled ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_server_host_name_verification_enabled()

◆ is_tcp_keepalives_enabled()

virtual bool is_tcp_keepalives_enabled ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_keepalives_enabled()

◆ kerberos_service_name()

virtual const std::optional<std::string>& kerberos_service_name ( ) const
pure virtual
Returns
The current value of the option.
See also
set_kerberos_service_name()

◆ make()

static DMITIGR_PGFE_API std::unique_ptr<Connection_options> APIENTRY make ( )
static
Returns
The new instance of the default connection options.

◆ make_connection()

virtual std::unique_ptr<Connection> make_connection ( ) const
pure virtual
Returns
The instance of type Connection initialized with this instance.
See also
Connection::make()

◆ password()

virtual const std::optional<std::string>& password ( ) const
pure virtual
Returns
The current value of the option.
See also
set_password()

◆ set()

virtual Connection_options* set ( Communication_mode  value)
pure virtual

Sets the communication mode.

Exception safety guarantee
Strong.
Remarks
The Communication_mode::uds communication mode is unavailable on Microsoft Windows.
See also
communication_mode()

◆ set_database()

virtual Connection_options* set_database ( std::string  value)
pure virtual

Sets name of the database on the server to connect to.

Exception safety guarantee
Strong.
See also
database()

◆ set_kerberos_service_name()

virtual Connection_options* set_kerberos_service_name ( std::optional< std::string >  value)
pure virtual

Sets Kerberos service name to use when authenticating with GSSAPI Authentication.

Requires
(!value || !value->empty())
Exception safety guarantee
Strong.
See also
kerberos_service_name()

◆ set_password()

virtual Connection_options* set_password ( std::optional< std::string >  value)
pure virtual

Sets password for such authentication methods as Password Authentication, LDAP Authentication.

Requires
(!value || !value->empty())
Exception safety guarantee
Strong.
See also
password()

◆ set_ssl_certificate_authority_file()

virtual Connection_options* set_ssl_certificate_authority_file ( std::optional< std::filesystem::path >  value)
pure virtual

Sets name of the file containing the SSL client certificate authority (CA).

If this option is set, verification that the server certificate is issued by a trusted certificate authority (CA) will be performed.

Requires
(is_ssl_enabled() && (!value || !value->empty())).
Exception safety guarantee
Strong.
See also
ssl_certificate_authority_file()

◆ set_ssl_certificate_file()

virtual Connection_options* set_ssl_certificate_file ( std::optional< std::filesystem::path >  value)
pure virtual

Sets the name of the file containing the SSL client certificate.

Requires
(is_ssl_enabled() && (!value || !value->empty())).
Exception safety guarantee
Strong.
See also
ssl_certificate_file()

◆ set_ssl_certificate_revocation_list_file()

virtual Connection_options* set_ssl_certificate_revocation_list_file ( std::optional< std::filesystem::path >  value)
pure virtual

Sets name of the file containing the SSL client certificate revocation list (CRL).

Requires
(is_ssl_enabled() && (!value || !value->empty())).
Exception safety guarantee
Strong.
See also
ssl_certificate_revocation_list_file()

◆ set_ssl_compression_enabled()

virtual Connection_options* set_ssl_compression_enabled ( bool  value)
pure virtual

Sets the SSL compression enabled if (value == true), or disabled otherwise.

Requires
(is_ssl_enabled())
Exception safety guarantee
Strong.
See also
is_ssl_compression_enabled()

◆ set_ssl_enabled()

virtual Connection_options* set_ssl_enabled ( bool  value)
pure virtual

Sets the SSL mode enabled if (value == true), or disabled otherwise.

Requires
(is_ssl_enabled())
Exception safety guarantee
Strong.
See also
is_ssl_enabled()

◆ set_ssl_private_key_file()

virtual Connection_options* set_ssl_private_key_file ( std::optional< std::filesystem::path >  value)
pure virtual

Sets name of the file containing the SSL client private key.

Requires
(is_ssl_enabled() && (!value || !value->empty())).
Exception safety guarantee
Strong.
See also
ssl_private_key_file()

◆ set_ssl_server_host_name_verification_enabled()

virtual Connection_options* set_ssl_server_host_name_verification_enabled ( bool  value)
pure virtual

Sets obligation of verification that the requested server host name matches that in the certificate.

Requires
(is_ssl_enabled() && ssl_certificate_authority_file())
Exception safety guarantee
Strong.
See also
is_ssl_server_host_name_verification_enabled()

◆ set_tcp_host_address()

virtual Connection_options* set_tcp_host_address ( std::optional< std::string >  value)
pure virtual

Sets numeric IP address of the host to connect to.

With this option a host name lookup can be avoided.

Parameters
value- must be a valid host address in either IPv4 or IPv6 format.
Requires
((communication_mode() == Communication_mode::tcp) && (value || tcp_host_name())).
Exception safety guarantee
Strong.
Remarks
When using SSL or some authentication methods (such as Kerberos) the option tcp_host_name is mandatory even if using this option. If both tcp_host_address and tcp_host_name are set, the value of tcp_host_address will be treated as PostgreSQL server address to connect.
See also
tcp_host_address(), set_tcp_host_name()

◆ set_tcp_host_name()

virtual Connection_options* set_tcp_host_name ( std::optional< std::string >  value)
pure virtual

Sets name of the host to connect to.

Parameters
value- must be a valid host name.
Requires
((communication_mode() == Communication_mode::tcp) && (value || tcp_host_address())).
Exception safety guarantee
strong.
Remarks
If the option tcp_host_address is set, host name lookup will not occurs even if this option is also set. However, the value of this option may be required for some authentication methods or SSL certificate verification.
See also
tcp_host_name(), set_tcp_host_address()

◆ set_tcp_host_port()

virtual Connection_options* set_tcp_host_port ( const std::int_fast32_t  value)
pure virtual

Sets server's port number.

Exception safety guarantee
Strong.
Requires
(communication_mode() == Communication_mode::tcp)
See also
tcp_host_port()

◆ set_tcp_keepalives_count()

virtual Connection_options* set_tcp_keepalives_count ( std::optional< int >  value)
pure virtual

Sets the number of keepalives before connection lost.

Parameters
value- the value of std::nullopt means system default.
Requires
(communication_mode() == Communication_mode::tcp).
Exception safety guarantee
Strong.
Remarks
This option is system dependent and has no effect on systems where TCP_KEEPCNT socket option (or its equivalent) is unavailable.
See also
tcp_keepalives_count()

◆ set_tcp_keepalives_enabled()

virtual Connection_options* set_tcp_keepalives_enabled ( bool  value)
pure virtual

Sets the keepalives mode.

Exception safety guarantee
Strong.
See also
is_tcp_keepalives_enabled()

◆ set_tcp_keepalives_idle()

virtual Connection_options* set_tcp_keepalives_idle ( std::optional< std::chrono::seconds >  value)
pure virtual

Sets the interval (in seconds) after which start keepalives.

Parameters
value- the value of std::nullopt means system default.
Requires
(communication_mode() == Communication_mode::tcp)
Exception safety guarantee
Strong.
Remarks
This option is system dependent and has no effect on systems where TCP_KEEPIDLE socket option (or its equivalent) is unavailable.
See also
tcp_keepalives_idle()

◆ set_tcp_keepalives_interval()

virtual Connection_options* set_tcp_keepalives_interval ( std::optional< std::chrono::seconds >  value)
pure virtual

Sets the interval (in seconds) between keepalives.

Parameters
value- the value of std::nullopt means system default.
Requires
(communication_mode() == Communication_mode::tcp)
Exception safety guarantee
Strong.
Remarks
This option is system dependent and has no effect on systems where TCP_KEEPINTVL socket option (or its equivalent) is unavailable.
See also
tcp_keepalives_interval()

◆ set_uds_directory()

virtual Connection_options* set_uds_directory ( std::filesystem::path  value)
pure virtual

Sets absolute name of the directory where the Unix-domain socket file is located (usually /tmp).

Requires
(communication_mode() == Communication_mode::uds). A value must be a valid absolute directory path.
Exception safety guarantee
Strong.
See also
uds_directory()

◆ set_uds_file_extension()

virtual Connection_options* set_uds_file_extension ( std::string  value)
pure virtual

Sets a Unix-domain socket file extension.

Requires
(communication_mode() == Communication_mode::uds && !value.empty())
Exception safety guarantee
Strong.
See also
uds_file_extension()

◆ set_uds_require_server_process_username()

virtual Connection_options* set_uds_require_server_process_username ( std::optional< std::string >  value)
pure virtual

Sets obligation of verification that the server process is running under the specified username for successful authentication.

Parameters
value- the value of std::nullopt means disabled.
Requires
(communication_mode() == Communication_mode::uds && (!value || !value->empty()))
Exception safety guarantee
Strong.
See also
uds_require_server_process_username()

◆ set_username()

virtual Connection_options* set_username ( std::string  value)
pure virtual

Sets name of the role registered on the server.

Exception safety guarantee
strong.
See also
username()

◆ ssl_certificate_authority_file()

virtual const std::optional<std::filesystem::path>& ssl_certificate_authority_file ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_certificate_authority_file()

◆ ssl_certificate_file()

virtual const std::optional<std::filesystem::path>& ssl_certificate_file ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_certificate_file()

◆ ssl_certificate_revocation_list_file()

virtual const std::optional<std::filesystem::path>& ssl_certificate_revocation_list_file ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_certificate_revocation_list_file()

◆ ssl_private_key_file()

virtual const std::optional<std::filesystem::path>& ssl_private_key_file ( ) const
pure virtual
Returns
The current value of the option.
See also
set_ssl_private_key_file()

◆ tcp_host_address()

virtual const std::optional<std::string>& tcp_host_address ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_host_address()

◆ tcp_host_name()

virtual const std::optional<std::string>& tcp_host_name ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_host_name()

◆ tcp_host_port()

virtual std::int_fast32_t tcp_host_port ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_host_port()

◆ tcp_keepalives_count()

virtual std::optional<int> tcp_keepalives_count ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_keepalives_count()

◆ tcp_keepalives_idle()

virtual std::optional<std::chrono::seconds> tcp_keepalives_idle ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_keepalives_idle()

◆ tcp_keepalives_interval()

virtual std::optional<std::chrono::seconds> tcp_keepalives_interval ( ) const
pure virtual
Returns
The current value of the option.
See also
set_tcp_keepalives_interval()

◆ uds_directory()

virtual const std::filesystem::path& uds_directory ( ) const
pure virtual
Returns
The current value of the option.
See also
set_uds_directory()

◆ uds_file_extension()

virtual const std::string& uds_file_extension ( ) const
pure virtual
Returns
The current value of the option.
See also
set_uds_file_extension()

◆ uds_require_server_process_username()

virtual const std::optional<std::string>& uds_require_server_process_username ( ) const
pure virtual
Returns
The current value of the option.
See also
set_uds_require_server_process_username()

◆ username()

virtual const std::string& username ( ) const
pure virtual
Returns
The current value of the option.
See also
set_username()

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