Kea
1.9.9-git
|
HA peer configuration. More...
#include <ha_config.h>
Public Types | |
enum | Role { PRIMARY, SECONDARY, STANDBY, BACKUP } |
Server's role in the High Availability setup. More... | |
Public Member Functions | |
PeerConfig () | |
Constructor. More... | |
void | addBasicAuthHttpHeader (http::PostHttpRequestJsonPtr request) const |
Adds a basic HTTP authentication header to a request when credentials are specified. More... | |
http::BasicHttpAuthPtr & | getBasicAuth () |
Returns non-const basic HTTP authentication. More... | |
const http::BasicHttpAuthPtr & | getBasicAuth () const |
Returns const basic HTTP authentication. More... | |
util::Optional< std::string > | getCertFile () const |
Returns server's cert-file. More... | |
util::Optional< std::string > | getKeyFile () const |
Returns server's key-file. More... | |
std::string | getLogLabel () const |
Returns a string identifying a server used in logging. More... | |
std::string | getName () const |
Returns server name. More... | |
Role | getRole () const |
Returns server's role. More... | |
asiolink::TlsContextPtr | getTlsContext () const |
Returns a pointer to the server's TLS context. More... | |
util::Optional< std::string > | getTrustAnchor () const |
Returns server's trust-anchor. More... | |
http::Url | getUrl () const |
Returns URL of the server's control channel. More... | |
bool | isAutoFailover () const |
Checks if the auto-failover function is enabled for the server. More... | |
void | setAutoFailover (const bool auto_failover) |
Enables/disables auto-failover function for the server. More... | |
void | setCertFile (const util::Optional< std::string > &cert) |
Sets server's cert-file. More... | |
void | setKeyFile (const util::Optional< std::string > &key) |
Sets server's key-file. More... | |
void | setName (const std::string &name) |
Sets server name. More... | |
void | setRole (const std::string &role) |
Sets servers role. More... | |
void | setTrustAnchor (const util::Optional< std::string > &ca) |
Sets server's trust-anchor. More... | |
void | setUrl (const http::Url &url) |
Sets server's URL. More... | |
Static Public Member Functions | |
static std::string | roleToString (const HAConfig::PeerConfig::Role &role) |
Returns role name. More... | |
static Role | stringToRole (const std::string &role) |
Decodes role provided as a string. More... | |
Public Attributes | |
asiolink::TlsContextPtr | tls_context_ |
Server TLS context. More... | |
HA peer configuration.
It holds configuration of one of the servers participating in the high availability configuration. It may represent configuration of this server or its partner.
Definition at line 53 of file ha_config.h.
Server's role in the High Availability setup.
The following roles are supported:
Enumerator | |
---|---|
PRIMARY | |
SECONDARY | |
STANDBY | |
BACKUP |
Definition at line 70 of file ha_config.h.
isc::ha::HAConfig::PeerConfig::PeerConfig | ( | ) |
Constructor.
Definition at line 30 of file ha_config.cc.
void isc::ha::HAConfig::PeerConfig::addBasicAuthHttpHeader | ( | http::PostHttpRequestJsonPtr | request | ) | const |
Adds a basic HTTP authentication header to a request when credentials are specified.
Definition at line 96 of file ha_config.cc.
|
inline |
Returns non-const basic HTTP authentication.
Definition at line 197 of file ha_config.h.
|
inline |
Returns const basic HTTP authentication.
Definition at line 202 of file ha_config.h.
|
inline |
Returns server's cert-file.
Definition at line 116 of file ha_config.h.
|
inline |
Returns server's key-file.
Definition at line 128 of file ha_config.h.
std::string isc::ha::HAConfig::PeerConfig::getLogLabel | ( | ) | const |
Returns a string identifying a server used in logging.
The label is constructed from server name and server URL.
Definition at line 52 of file ha_config.cc.
|
inline |
Returns server name.
Definition at line 81 of file ha_config.h.
|
inline |
Returns server's role.
Definition at line 152 of file ha_config.h.
|
inline |
Returns a pointer to the server's TLS context.
Definition at line 140 of file ha_config.h.
References tls_context_.
|
inline |
Returns server's trust-anchor.
Definition at line 104 of file ha_config.h.
|
inline |
Returns URL of the server's control channel.
Definition at line 92 of file ha_config.h.
|
inline |
Checks if the auto-failover function is enabled for the server.
Definition at line 184 of file ha_config.h.
|
static |
Returns role name.
role | Role which name should be returned. |
Definition at line 79 of file ha_config.cc.
References BACKUP, PRIMARY, SECONDARY, and STANDBY.
Referenced by isc::ha::HAService::HAService(), and isc::ha::HAService::processStatusGet().
|
inline |
Enables/disables auto-failover function for the server.
auto_failover | Boolean value indicating if auto-failover function should be enabled/disabled for the server. |
Definition at line 192 of file ha_config.h.
|
inline |
Sets server's cert-file.
cert | Certificate file name. |
Definition at line 123 of file ha_config.h.
|
inline |
Sets server's key-file.
key | Private key file name. |
Definition at line 135 of file ha_config.h.
void isc::ha::HAConfig::PeerConfig::setName | ( | const std::string & | name | ) |
Sets server name.
name | Server name. |
BadValue | if the server name is empty. |
Definition at line 36 of file ha_config.cc.
References isc_throw, name_, and isc::util::str::trim().
void isc::ha::HAConfig::PeerConfig::setRole | ( | const std::string & | role | ) |
Sets servers role.
The following are the supported roles in the textual form:
role | Server role in the textual form. |
Definition at line 47 of file ha_config.cc.
|
inline |
Sets server's trust-anchor.
ca | Trust anchor aka Certificate Authority. |
Definition at line 111 of file ha_config.h.
|
inline |
|
static |
asiolink::TlsContextPtr isc::ha::HAConfig::PeerConfig::tls_context_ |
Server TLS context.
Definition at line 214 of file ha_config.h.
Referenced by getTlsContext().